From 19d2574e33b5259a32fab40846ed33799b9ec66a Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Thu, 9 May 2024 23:17:43 -0700 Subject: [PATCH] Fix paste handler in Editor.tsx --- src-web/components/core/Editor/Editor.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src-web/components/core/Editor/Editor.tsx b/src-web/components/core/Editor/Editor.tsx index 284a3bd7..0574e924 100644 --- a/src-web/components/core/Editor/Editor.tsx +++ b/src-web/components/core/Editor/Editor.tsx @@ -329,10 +329,18 @@ function getExtensions({ return [ // NOTE: These *must* be anonymous functions so the references update properly EditorView.domEventHandlers({ - focus: () => onFocus.current?.(), - blur: () => onBlur.current?.(), - keydown: (e) => onKeyDown.current?.(e), - paste: (e) => onPaste.current?.(e.clipboardData?.getData('text/plain') ?? ''), + focus: () => { + onFocus.current?.(); + }, + blur: () => { + onBlur.current?.(); + }, + keydown: (e) => { + onKeyDown.current?.(e); + }, + paste: (e) => { + onPaste.current?.(e.clipboardData?.getData('text/plain') ?? ''); + }, }), tooltips({ parent }), keymap.of(singleLine ? defaultKeymap.filter((k) => k.key !== 'Enter') : defaultKeymap),