From 4e0b2fae5d2a59f068b1d5315f3fab6134e4d203 Mon Sep 17 00:00:00 2001 From: liujuping Date: Thu, 7 Sep 2023 10:09:40 +0800 Subject: [PATCH] feat(hotkey): when text is selected, allow the default copy and paste behavior --- packages/engine/src/inner-plugins/builtin-hotkey.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/engine/src/inner-plugins/builtin-hotkey.ts b/packages/engine/src/inner-plugins/builtin-hotkey.ts index 692773a75..1a1f3a9c4 100644 --- a/packages/engine/src/inner-plugins/builtin-hotkey.ts +++ b/packages/engine/src/inner-plugins/builtin-hotkey.ts @@ -277,6 +277,10 @@ export const builtinHotkey = (ctx: IPublicModelPluginContext) => { if (isFormEvent(e) || !doc) { return; } + const anchorValue = document.getSelection()?.anchorNode?.nodeValue; + if (anchorValue && typeof anchorValue === 'string') { + return; + } e.preventDefault(); let selected = doc.selection.getTopNodes(true);