1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Desktop: Fixes #7036: Fix pasting plain text (#7045)

This commit is contained in:
Self Not Found 2022-11-14 20:29:07 +08:00 committed by GitHub
parent 7d135730bf
commit 673653a141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1010,7 +1010,10 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
} else { // Paste regular text
// event.clipboardData.getData('text/html') wraps the content with <html><body></body></html>,
// which seems to be not supported in editor.insertContent().
const pastedHtml = clipboard.readHTML();
//
// when pasting text with Ctrl+Shift+V, the format should be ignored.
// In this case, event.clopboardData.getData('text/html') returns an empty string, but the clipboard.readHTML() still returns the formatted text.
const pastedHtml = event.clipboardData.getData('text/html') ? clipboard.readHTML() : '';
if (pastedHtml) { // Handles HTML
const modifiedHtml = await processPastedHtml(pastedHtml);
editor.insertContent(modifiedHtml);