pasting formatted
This commit is contained in:
@@ -126,11 +126,13 @@
|
|||||||
@apply mb-2;
|
@apply mb-2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reading-content strong {
|
.reading-content strong,
|
||||||
|
.reading-content b {
|
||||||
@apply font-semibold theme-header;
|
@apply font-semibold theme-header;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reading-content em {
|
.reading-content em,
|
||||||
|
.reading-content i {
|
||||||
@apply italic;
|
@apply italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,11 +208,13 @@
|
|||||||
@apply mb-2;
|
@apply mb-2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-content strong {
|
.editor-content strong,
|
||||||
|
.editor-content b {
|
||||||
@apply font-semibold theme-header;
|
@apply font-semibold theme-header;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-content em {
|
.editor-content em,
|
||||||
|
.editor-content i {
|
||||||
@apply italic;
|
@apply italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {
|
|||||||
createEditor,
|
createEditor,
|
||||||
Descendant,
|
Descendant,
|
||||||
Element as SlateElement,
|
Element as SlateElement,
|
||||||
Node as SlateNode,
|
|
||||||
Transforms,
|
Transforms,
|
||||||
Editor,
|
Editor,
|
||||||
Range
|
Range
|
||||||
@@ -311,13 +310,11 @@ const withImages = (editor: ReactEditor) => {
|
|||||||
editor.insertData = (data) => {
|
editor.insertData = (data) => {
|
||||||
const html = data.getData('text/html');
|
const html = data.getData('text/html');
|
||||||
|
|
||||||
if (html && html.includes('<img')) {
|
if (html) {
|
||||||
debug.log('📋 Image paste detected in Slate editor');
|
debug.log('📋 HTML paste detected in Slate editor');
|
||||||
|
|
||||||
// Convert HTML to Slate nodes maintaining order
|
|
||||||
const slateNodes = htmlToSlate(html);
|
const slateNodes = htmlToSlate(html);
|
||||||
|
|
||||||
// Insert all nodes in sequence
|
|
||||||
slateNodes.forEach(node => {
|
slateNodes.forEach(node => {
|
||||||
Transforms.insertNodes(editor, node);
|
Transforms.insertNodes(editor, node);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user