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

fix: Properly copy selection as markdown to the plaintext clipboard #5212

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented Jan 8, 2024

Using clipboardTextSerializer we can copy the current selection as markdown and don't need the extra keyboard shortcut, which was broken anyways as it always selected the full text

Steps to reproduce:

Fix #5213

@juliusknorr juliusknorr requested review from max-nextcloud and mejo- and removed request for max-nextcloud January 8, 2024 10:14
@juliusknorr juliusknorr added bug Something isn't working 3. to review labels Jan 8, 2024
@juliusknorr juliusknorr added this to the Nextcloud 29 milestone Jan 8, 2024
Using clipboardTextSerializer we can copy the current selection as markdown and don't need the extra keyboard shortcut, which was broken anyways as it always selected the full text

Signed-off-by: Julius Härtl <jus@bitgrid.net>
Copy link
Collaborator

@max-nextcloud max-nextcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have not tested it yet. Code changes look good. Nice to see more code getting removed than added. :)

I wonder what would happen with non-markdown files. I think the code in the editor factory might serve the purpose of extracting plaintext from the codeblock we currently wrap other files such as source code in.

src/components/Editor.vue Show resolved Hide resolved
Copy link
Collaborator

@max-nextcloud max-nextcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works like a charm.

@max-nextcloud max-nextcloud merged commit 0e0a288 into main Jan 15, 2024
52 checks passed
@max-nextcloud max-nextcloud deleted the bugfix/noid/copy-markdown branch January 15, 2024 12:39
@juliusknorr
Copy link
Member Author

/backport to stable28

@susnux
Copy link
Contributor

susnux commented Mar 12, 2024

While this works this creates a lot of UX issues, as even if you just copy parts of code it always adds the code tags.
You can no longer e.g. copy email addresses, passwords (you should not do this but thats a different story), shell commands etc.

Could we maybe somehow instead put both into the clipboard? text/plain and text/markdown?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

View raw markup
3 participants