Fix paste handler in Editor.tsx

This commit is contained in:
Gregory Schier
2024-05-09 23:17:43 -07:00
parent 2e3af37d16
commit 19d2574e33

View File

@@ -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),