Skip to content

Conversation

@mejo-
Copy link
Member

@mejo- mejo- commented Dec 30, 2022

📝 Summary

Until now, every newline was transformed into a paragraph break when pasting plaintext.

Instead, newlines will be treated as linebreaks. Two newlines in a row will be treated as paragraph break.

Fixes: #3598

The second commit in this PR adds a change to catch shiftKey when pasting with middle click.

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits

Until now, every newline was transformed into a paragraph break when
pasting plaintext.

Instead, newlines will be treated as linebreaks. Two newlines in a row
will be treated as paragraph break.

Fixes: #3598

Signed-off-by: Jonas <jonas@freesources.org>
We distinguish between <Ctrl>-<V> and <Ctrl>-<Shift>-<V> when pasting
text to decide whether the input should be treated as markdown or
plaintext.

On Linux systems, it's also possible to paste text with a middle mouse
click. Let's consider there as well whether the <Shift> key is down.

Sidenote: with shift key down, the handleClick and handleClickOn events
are not called, so we have to go through the DOM events directly.

Signed-off-by: Jonas <jonas@freesources.org>
@mejo-
Copy link
Member Author

mejo- commented Dec 30, 2022

/compile

Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@cypress
Copy link

cypress bot commented Dec 30, 2022



Test summary

116 0 0 0Flakiness 1


Run details

Project Text
Status Passed
Commit 9237f91
Started Dec 30, 2022 6:33 PM
Ended Dec 30, 2022 6:38 PM
Duration 05:34 💡
OS Linux Ubuntu -
Browser Electron 106

View run in Cypress Dashboard ➡️


Flakiness

cypress/e2e/nodes/Links.spec.js Flakiness
1 test link marks > link preview > shows a link preview

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

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.

Approach looks good. Please check my comment and play with that a bit. I don't know of the top of my head how the code will behave. Feel free to merge as is if the behavior makes sense.

update: I did so myself.

@max-nextcloud max-nextcloud merged commit 7c745b9 into master Dec 30, 2022
@delete-merged-branch delete-merged-branch bot deleted the fix/plaintext_newlines branch December 30, 2022 22:25
mejo- added a commit that referenced this pull request Dec 31, 2022
Until now, every newline was transformed into a paragraph break when
pasting plaintext.

Instead, newlines will be treated as linebreaks. Two newlines in a row
will be treated as paragraph break.

Fixes: #3598

Manual backport of #3623

Signed-off-by: Jonas <jonas@freesources.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Treat newlines as hard linebreaks (not paragraph breaks) when pasting plaintext

4 participants