-
Notifications
You must be signed in to change notification settings - Fork 126
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: escape character on paste, escape before splitting line #154
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! You have identified that decodeEntities
is part of the problem. Unfortunately there is a regression—the user should still be able to paste HTML.
Please see if you can get the desired behavior without breaking paste from raw HTML OR paste from formatted text. A good way to test this is to copy the raw HTML and then copy and paste the bulleted list in the original post.
@@ -237,15 +238,14 @@ export const Editable = connect()(({ focus, itemsRanked, contextChain, showConte | |||
// this reflects the format of the source data more than the actual contents | |||
// text/plain may contain text that ultimately looks like html (contains <li>) and should be parsed as html | |||
const plainText = e.clipboardData.getData('text/plain') | |||
const htmlText = e.clipboardData.getData('text/html') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, removing this breaks the desired behavior of being able to paste from a bulleted list (from a webpage or word processor for example).
@@ -1470,7 +1470,7 @@ export const importText = (itemsRanked, inputText) => { | |||
importCursor.pop() | |||
} | |||
} | |||
}, { decodeEntities: true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely part of the issue. We may have to manually encode characters like &
since we do not want <
to be encoded. Maybe htmlparser2 has more options.
If you want to support html
I have solved the task at hand. If you want me to spend more time on it you have to increase the bounty. |
Ah, good point! In that case, it should handle the following two cases:
<li>A</li>
<li>B</li>
<li>C & D</li> This PR introduces a regression by breaking case (1) (copying formatted text). The bounty will be granted to a PR that solves the task without introducing any regressions. Thank you! |
73b453a
to
6c05e04
Compare
No description provided.