From ea9ddb7b69c66adfe08e85c86dfbb3eec2e362a6 Mon Sep 17 00:00:00 2001 From: jaesung-lee Date: Tue, 19 Oct 2021 17:36:11 +0900 Subject: [PATCH] fix: divide the block when pasting text to wysiwyg (#1854) --- apps/editor/src/wysiwyg/clipboard/paste.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/editor/src/wysiwyg/clipboard/paste.ts b/apps/editor/src/wysiwyg/clipboard/paste.ts index 93de153bbc..49d5b37da1 100644 --- a/apps/editor/src/wysiwyg/clipboard/paste.ts +++ b/apps/editor/src/wysiwyg/clipboard/paste.ts @@ -157,8 +157,9 @@ function createTableFromPastingTable(rows: Node[], schema: Schema, startFromBody export function changePastedSlice(slice: Slice, schema: Schema) { const nodes: Node[] = []; + const { content, openStart, openEnd } = slice; - slice.content.forEach((node) => { + content.forEach((node) => { if (node.type.name === 'table') { const tableContent = getTableContentFromSlice(new Slice(Fragment.from(node), 0, 0)); @@ -174,5 +175,5 @@ export function changePastedSlice(slice: Slice, schema: Schema) { } }); - return new Slice(Fragment.from(nodes), 0, 0); + return new Slice(Fragment.from(nodes), openStart, openEnd); }