From 97dbab13a88cbeb7b9d41287fc7e6a2086211f1e Mon Sep 17 00:00:00 2001 From: Nikolay Martynenko Date: Fri, 10 Jul 2020 19:31:25 +0300 Subject: [PATCH] Trigger editor.insertText by paste too (#3776) --- packages/slate-react/src/plugin/with-react.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/slate-react/src/plugin/with-react.ts b/packages/slate-react/src/plugin/with-react.ts index 6b9204077..f29f4255c 100644 --- a/packages/slate-react/src/plugin/with-react.ts +++ b/packages/slate-react/src/plugin/with-react.ts @@ -148,7 +148,7 @@ export const withReact = (editor: T) => { if (fragment) { const decoded = decodeURIComponent(window.atob(fragment)) const parsed = JSON.parse(decoded) as Node[] - Transforms.insertFragment(e, parsed) + e.insertFragment(parsed) return } @@ -163,7 +163,7 @@ export const withReact = (editor: T) => { Transforms.splitNodes(e, { always: true }) } - Transforms.insertText(e, line) + e.insertText(line) split = true } }