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