mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Desktop: Fixes #6257: Fixed the missing format when pasting text by Ctrl+V in Rich Text editor (#6901)
This commit is contained in:
parent
50baad3c04
commit
5364965a69
@ -1008,7 +1008,9 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
|
|||||||
const result = await markupToHtml.current(MarkupToHtml.MARKUP_LANGUAGE_MARKDOWN, pastedText, markupRenderOptions({ bodyOnly: true }));
|
const result = await markupToHtml.current(MarkupToHtml.MARKUP_LANGUAGE_MARKDOWN, pastedText, markupRenderOptions({ bodyOnly: true }));
|
||||||
editor.insertContent(result.html);
|
editor.insertContent(result.html);
|
||||||
} else { // Paste regular text
|
} else { // Paste regular text
|
||||||
const pastedHtml = event.clipboardData.getData('text/html');
|
// 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();
|
||||||
if (pastedHtml) { // Handles HTML
|
if (pastedHtml) { // Handles HTML
|
||||||
const modifiedHtml = await processPastedHtml(pastedHtml);
|
const modifiedHtml = await processPastedHtml(pastedHtml);
|
||||||
editor.insertContent(modifiedHtml);
|
editor.insertContent(modifiedHtml);
|
||||||
|
Loading…
Reference in New Issue
Block a user