Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected rich-text copy-paste #22622

Closed
KN4CK3R opened this issue Jan 27, 2023 · 9 comments
Closed

Unexpected rich-text copy-paste #22622

KN4CK3R opened this issue Jan 27, 2023 · 9 comments
Labels
topic/ui Change the appearance of the Gitea UI

Comments

@KN4CK3R
Copy link
Member

KN4CK3R commented Jan 27, 2023

Copy-pasting file contents from the normal file view
grafik
results in the full markup content

<html><body>
<!--StartFragment-->

module ROME
--


<code class="code-inner"><span class="n">require</span> <span class="n">github</span><span class="p">.</span><span class="n">com</span><span class="o">/</span><span class="mi">01</span><span class="o">-</span><span class="n">edu</span><span class="o">/</span><span class="n">z01</span> <span class="n">v0</span><span class="p">.</span><span class="mf">1.0</span> <span class="o">/</span><span class="o">/</span> <span class="n">indirect</span>
</code><!--EndFragment-->
</body>
</html>

if pasted into some input fields (like the Github comment fields). Copy-pasting from Github files works as intended.

@KN4CK3R KN4CK3R added type/bug topic/ui Change the appearance of the Gitea UI labels Jan 27, 2023
@silverwind
Copy link
Member

silverwind commented Jan 27, 2023

I don't think the source page can control what is being copied, so this behaviour to also copy rich must be some heuristics done by the browser based on the HTML tags present (likely pre plays a role).

@silverwind
Copy link
Member

a rich-text input field (like the Github comment fields)

GitHub comment field is not rich text, it's just a <textarea>. Are you using any browser extensions that transforms it?

@KN4CK3R
Copy link
Member Author

KN4CK3R commented Jan 27, 2023

No browser extension used. Wrong wording on my side. It's still unexpected if I paste the content here, it comes with the html tags.

@silverwind
Copy link
Member

silverwind commented Jan 27, 2023

Yeah, I can reproduce with this. I think this is a bug in GitHub's paste event handling, it does not happen with a regular text area. GitHub seems to try something smart when pasting and it fails.

So we first need to know what the GitHub code tries to do.

@silverwind
Copy link
Member

Checking the JS in the debugger, there are 6 paste event handlers attached. I think the most likely culprit may be https://github.com/github/paste-markdown.

@KN4CK3R
Copy link
Member Author

KN4CK3R commented Jan 27, 2023

If you are sure it's not Giteas fault we can close this issue. Just noticed that behaviour yesterday.

@silverwind silverwind added the type/upstream This is an issue in one of Gitea's dependencies and should be reported there label Jan 27, 2023
@silverwind
Copy link
Member

The bug is surely not ours, but lets keep this open for further investigation.

@silverwind
Copy link
Member

Reported it in github/paste-markdown#80.

@silverwind silverwind removed the type/upstream This is an issue in one of Gitea's dependencies and should be reported there label Jan 27, 2023
@silverwind
Copy link
Member

Closing, Github bug.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

No branches or pull requests

2 participants