From b7b2fe76de7e4afd1f3370eafdf1a0d4175f22bf Mon Sep 17 00:00:00 2001 From: yaolongfei <2991205548@qq.com> Date: Sat, 3 Aug 2024 15:20:54 +0800 Subject: [PATCH] fix(multi editor): clear selection clear selection when switching editors https://github.com/cycleccc/wangEditor-next/issues/60 --- packages/core/src/text-area/syncSelection.ts | 2 ++ packages/table-module/src/module/with-selection.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/src/text-area/syncSelection.ts b/packages/core/src/text-area/syncSelection.ts index d178d194d..93501c5c5 100644 --- a/packages/core/src/text-area/syncSelection.ts +++ b/packages/core/src/text-area/syncSelection.ts @@ -172,6 +172,8 @@ export function DOMSelectionToEditor(textarea: TextArea, editor: IDomEditor) { IS_FOCUSED.set(editor, true) } else { IS_FOCUSED.delete(editor) + Transforms.deselect(editor) + return } if (!domSelection) { diff --git a/packages/table-module/src/module/with-selection.ts b/packages/table-module/src/module/with-selection.ts index fc43f8056..c6ccf3858 100644 --- a/packages/table-module/src/module/with-selection.ts +++ b/packages/table-module/src/module/with-selection.ts @@ -34,7 +34,7 @@ export function withSelection(editor: T) { }) if (!fromEntry || !toEntry) { - // TableCursor.unselect(editor) + TableCursor.unselect(editor) return apply(op) }