text icon indicating copy to clipboard operation
text copied to clipboard

Add paste event handler to allow pasting markdown

Open juliusknorr opened this issue 3 years ago • 6 comments

Fixes https://github.com/nextcloud/text/issues/16

Marking as draft as this still needs a bit of testing if this is feasible for common use cases of pasting random text

juliusknorr avatar Jul 13 '22 06:07 juliusknorr

While I have the use case very often, I'd still be curious if anyone could think of scenarios where just always parsing pasted text as markdown could be unexpected to users. Any objections @nextcloud/office ?

juliusknorr avatar Jul 13 '22 06:07 juliusknorr

Nice, I would love to be able to paste markdown and get it formatted direclty!

This should also fix #55.

mejo- avatar Jul 13 '22 06:07 mejo-

This should also fix #55.

No that one is about typing not pasting, but this would fix #938

susnux avatar Jul 19 '22 13:07 susnux

I'd still be curious if anyone could think of scenarios where just always parsing pasted text as markdown could be unexpected to users.

When pasting markdown into a codeblock i would expect it to show up as source code not interpreted as markup.

max-nextcloud avatar Jul 21 '22 17:07 max-nextcloud

Maybe this would be better as a context menu option similar to how Word processors have different options on how to paste

marcelklehr avatar Jul 22 '22 10:07 marcelklehr

Or to follow common practice:

Use this for all normal paste and add a handler for ctrl + shift + v to paste without formatting.

susnux avatar Jul 24 '22 14:07 susnux

Changed the approach a bit by using clipboardTextParser and skipping the markdown parsing when Ctrl+Shift+V is used.

juliusknorr avatar Oct 17 '22 06:10 juliusknorr

🏓 For review ;)

juliusknorr avatar Nov 07 '22 16:11 juliusknorr



Test summary

106 0 0 0Flakiness 1


Run details

Project Text
Status Passed
Commit 1d35c76ee5 ℹ️
Started Nov 9, 2022 3:34 PM
Ended Nov 9, 2022 3:41 PM
Duration 07:11 💡
OS Linux Ubuntu -
Browser Electron 106

View run in Cypress Dashboard ➡️


Flakiness

cypress/e2e/sections.spec.js Flakiness
1 Content Sections > Heading anchors > Anchor scrolls into view

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

cypress[bot] avatar Nov 07 '22 16:11 cypress[bot]

/compile

juliusknorr avatar Nov 09 '22 20:11 juliusknorr