An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Preserve IME input when editing selected mindmap nodes https://github.com/siyuan-note/siyuan/issues/21045
Danielf71de3bce28d
diff --git a/app/src/assets/scss/protyle/_mindmap-view.scss b/app/src/assets/scss/protyle/_mindmap-view.scssindex 847e3b4063..ac8d3926a1 100644--- a/app/src/assets/scss/protyle/_mindmap-view.scss+++ b/app/src/assets/scss/protyle/_mindmap-view.scss@@ -51,6 +51,20 @@outline: 1px solid var(--b3-theme-primary);}+ &__selection-input {+ position: absolute;+ z-index: 3;+ min-height: 28px;+ white-space: pre-wrap;+ overflow-wrap: anywhere;+ pointer-events: none;+ opacity: 0;++ &--composing {+ opacity: 1;+ }+ }+&--nested {width: 260px;--mindmap-view-height: 260px;@@ -1121,6 +1135,7 @@&__route-handle,&__route-status,&__selection-box,+ &__selection-input,&__document-viewport,&__inspector-popover,&__add-bridge,diff --git a/app/src/protyle/render/listMindmap/arrows.test.ts b/app/src/protyle/render/listMindmap/arrows.test.tsindex 1e739958c3..edca79a274 100644--- a/app/src/protyle/render/listMindmap/arrows.test.ts+++ b/app/src/protyle/render/listMindmap/arrows.test.ts@@ -76,6 +76,7 @@ const setup = (arrowDirection?: ListMindmapRelation["arrowDirection"]) => {style: {}, classList: {toggle: () => {}}});Object.assign(target, {scale: 1, offsetX: 0, offsetY: 0, world: {style: {}}, zoomLabel: {}, zoomSlider: {},+ syncSelectionInput: () => {},viewport: {clientWidth: 400, clientHeight: 200, getBoundingClientRect: () => ({left: 0, top: 0})},canvas: {getContext: () => context}, options: {host: {}}, colorProbe: {style: {}},inspector: {hidden: true},diff --git a/app/src/protyle/render/listMindmap/model.test.ts b/app/src/protyle/render/listMindmap/model.test.tsindex 36f17af390..1f16c665ff 100644--- a/app/src/protyle/render/listMindmap/model.test.ts+++ b/app/src/protyle/render/listMindmap/model.test.ts@@ -448,7 +448,8 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,check.notEqual(addedID, itemID);check.equal(target.activeEditor, undefined, "new nodes remain selected without mounting an editor");check.equal(editorOptions, undefined);- check.equal(document.activeElement, target.host, "new nodes retain the canvas keyboard focus");+ check.equal(document.activeElement, target.host.querySelector(".mindmap-view__selection-input"),+ "new nodes prepare an editable target for the first IME keystroke");check.match(copies[1].textContent, /Added/);// Direct typing opens the new node's editor and preserves the embedded source identity.target.host.dispatchEvent(new KeyboardEvent("keydown", {key: "x", bubbles: true, cancelable: true}));@@ -815,7 +816,11 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,window.getSelection().removeAllRanges();window.getSelection().addRange(sourceRange);check.ok(api.focusListMindmap(focusList, focusHost));- check.equal(document.activeElement, focusHost);+ // 隐藏窗口在尚未接收原生指针事件时只更新 activeElement,补发焦点事件验证选区交接。+ focusHost.dispatchEvent(new FocusEvent("focus"));+ await new Promise(resolve => setTimeout(resolve, 0));+ check.equal(document.activeElement, focusHost.querySelector(".mindmap-view__selection-input"),+ "creating a mindmap retains the editable input focus while moving the source selection");check.ok(focusHost.contains(window.getSelection().anchorNode));focusHost.dispatchEvent(new KeyboardEvent("keydown", {key: "Enter", bubbles: true, cancelable: true}));check.equal(mindmapKeys, 1);@@ -1382,7 +1387,8 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,check.ok(after.left >= viewportRect.left && after.right <= viewportRect.right &&after.top >= viewportRect.top && after.bottom <= viewportRect.bottom,`${item.key} reveals the target after layout, readOnly=${readOnly}`);- check.equal(document.activeElement, navigationHost, "navigation keeps keyboard focus on the canvas");+ check.equal(document.activeElement, readOnly ? navigationHost : navigationHost.querySelector(".mindmap-view__selection-input"),+ "navigation prepares the selected node for native text input");}navigationView.fit();navigationView.selectNode(model.root.id);@@ -2064,6 +2070,90 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,navigate(" ");check.equal(edits.length, beforeSpaceEdit);view.setReadOnly(false);+ // 浏览器原生组合输入必须从选中态的可编辑目标开始,不能用合成 keydown 代替输入法。+ const selectionInput = host.querySelector<HTMLElement>(".mindmap-view__selection-input");+ const ime = (text: string) => require("electron").ipcRenderer.invoke("mindmap-view-ime", text);+ const insertText = (text: string) => require("electron").ipcRenderer.invoke("mindmap-view-insert-text", text);+ view.focusNode(beta);+ check.equal(document.activeElement, selectionInput);+ check.equal(selectionInput.isContentEditable, true);+ const beforeIME = edits.length;+ await ime("n");+ await ime("ni");+ check.equal(document.activeElement, selectionInput, "composition retains its original input target");+ check.equal(edits.length, beforeIME, "uncommitted phonetic text does not replace node content");+ check.equal(selectionInput.textContent, "ni");+ check.equal(getComputedStyle(selectionInput).opacity, "1", "composition preview is visible");+ const confirmation = new KeyboardEvent("keydown", {key: "Enter", keyCode: 229, bubbles: true, cancelable: true});+ selectionInput.dispatchEvent(confirmation);+ check.equal(confirmation.defaultPrevented, false, "IME confirmation is not a node shortcut");+ await insertText("你好");+ await settle();+ check.equal(edits.length, beforeIME + 1);+ check.equal(editTexts[editTexts.length - 1], "你好", "the entire first composition reaches the node editor");+ check.equal(selectionInput.textContent, "");+ view.setEditing();+ view.focusNode(beta);+ await ime("n");+ await ime("");+ await settle();+ check.equal(edits.length, beforeIME + 1, "canceling composition preserves the original node");+ check.equal(getComputedStyle(selectionInput).opacity, "0");+ await nativeInput([{type: "keyDown", keyCode: "X"}, {type: "char", keyCode: "X"}, {type: "keyUp", keyCode: "X"}]);+ check.equal(editTexts[editTexts.length - 1], "X", "ordinary typing uses native input without duplicating the first key");+ view.setEditing();+ view.focusNode(beta);+ const beforeSpace = edits.length;+ await nativeInput([{type: "keyDown", keyCode: "Space"}, {type: "keyUp", keyCode: "Space"}]);+ check.equal(edits.length, beforeSpace + 1);+ check.equal(editTexts[editTexts.length - 1], undefined, "space retains its open-editor shortcut");+ view.setEditing();+ view.focusNode(beta);+ await nativeInput([{type: "keyDown", keyCode: "Up"}, {type: "keyUp", keyCode: "Up"}]);+ check.equal(view.selectedId, alpha, "the editable input target preserves node navigation");+ check.equal(document.activeElement, selectionInput);+ view.focusNode(beta);+ const beforeStaleIME = edits.length;+ await ime("n");+ view.focusNode(alpha);+ selectionInput.dispatchEvent(new CompositionEvent("compositionend", {data: "你", bubbles: true}));+ selectionInput.textContent = "你";+ selectionInput.dispatchEvent(new InputEvent("input", {data: "你", inputType: "insertText", bubbles: true}));+ await settle();+ check.equal(edits.length, beforeStaleIME, "changing selection does not insert stale composition text");+ check.equal(selectionInput.textContent, "", "late composition input cannot carry over to the new selection");+ view.focusNode(beta);+ let finishInput: (value: boolean) => void;+ finishAllowed = new Promise<boolean>(resolve => finishInput = resolve);+ await insertText("Pending");+ view.focusNode(alpha);+ view.focusNode(beta);+ finishInput(true);+ await settle();+ check.equal(edits.length, beforeStaleIME, "delayed editor activation cannot follow a newer selection, even of the same node");+ finishAllowed = true;+ let inputCopiedNodes: string[];+ view.options.onCopy = (ids: string[]) => inputCopiedNodes = ids;+ selectionInput.dispatchEvent(new ClipboardEvent("copy", {bubbles: true, cancelable: true}));+ check.deepEqual(inputCopiedNodes, [beta], "copy from the idle input still copies the selected node");+ view.options.onCopy = undefined;+ view.setReadOnly(true);+ check.equal(selectionInput.hidden, true);+ check.equal(document.activeElement, host, "read-only selection returns focus to the canvas");+ view.setReadOnly(false);+ document.body.classList.add("body--android");+ view.focusNode(beta);+ check.equal(document.activeElement, host, "mobile selection does not open the software keyboard");+ document.body.classList.remove("body--android");+ view.focusNode(model.root.id);+ await ime("zhong");+ await insertText("中文根节点");+ await settle();+ const composedTitle = host.querySelector<HTMLTextAreaElement>(".mindmap-view__root-title");+ check.equal(composedTitle.value, "中文根节点", "virtual roots receive the committed composition too");+ composedTitle.dispatchEvent(new KeyboardEvent("keydown", {key: "Escape", bubbles: true}));+ view.focusNode(beta);+ edits.length = beforeIME;navigate(" ");check.equal(edits[edits.length - 1], beta, "space opens the selected node editor");check.equal(editTexts[editTexts.length - 1], undefined, "space keeps the node content");@@ -2100,7 +2190,8 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,check.equal(titleInput.selectionStart, titleInput.value.length);check.equal(titleInput.selectionEnd, titleInput.value.length);titleInput.dispatchEvent(new KeyboardEvent("keydown", {key: "Escape", bubbles: true}));- check.equal(document.activeElement, host);+ await settle();+ check.equal(document.activeElement, selectionInput);select(model.root.id);navigate("R");const typedTitleInput = host.querySelector<HTMLTextAreaElement>(".mindmap-view__root-title");@@ -3323,6 +3414,7 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,window.dispatchEvent(new Event("beforeprint"));await settle();check.ok(host.offsetHeight < screenHeight, "PDF does not retain the fixed editor canvas height");+ check.equal(getComputedStyle(selectionInput).display, "none", "printing excludes the IME input target");const printBounds = viewport.getBoundingClientRect();for (const node of view.positions.values()) {check.ok(node.x * view.scale + view.offsetX >= 0);@@ -4328,13 +4420,13 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,};await settle();await clickMouse(nodeElement(deleteFirst));- check.equal(document.activeElement, host);+ check.equal(document.activeElement, host.querySelector(".mindmap-view__selection-input"));await nativeKey("Backspace");check.equal(deleteList.querySelector(`[data-node-id="${deleteFirst}"]`), null);check.equal(nodeElement(deleteFirst), null);check.ok(deleteList.querySelector(`[data-node-id="${deleteSecond}"]`));check.equal(nodeElement(deleteSecond).getAttribute("aria-selected"), "true");- check.equal(document.activeElement, host);+ check.equal(document.activeElement, host.querySelector(".mindmap-view__selection-input"));await clickMouse(nodeElement(deleteSecond));const beforeProtectedDelete = deleteList.outerHTML;deleting.setEditing(deleteSecond);@@ -4353,7 +4445,7 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,check.equal(nodeElement(deleteSecond), null);check.ok(nodeElement(deleteModel.root.id));check.equal(nodeElement(deleteModel.root.id).getAttribute("aria-selected"), "true");- check.equal(document.activeElement, host);+ check.equal(document.activeElement, host.querySelector(".mindmap-view__selection-input"));await clickMouse(nodeElement(deleteModel.root.id));await nativeKey("Backspace");check.ok(nodeElement(deleteModel.root.id), "the last root is preserved for the macOS Delete key");@@ -4376,7 +4468,8 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,check.equal(api.resolveVisibleListMindmapBlock(locateList).carrier, locateHost);located.reveal();located.focus();- check.equal(document.activeElement, locateHost);+ check.equal(document.activeElement, locateHost.querySelector(".mindmap-view__selection-input"),+ "locating a node prepares its keyboard input target");check.equal(locateHost.querySelector(`[data-mindmap-id="${locateChild.id}"]`).getAttribute("aria-selected"), "true");const missingBlock = document.createElement("div");missingBlock.dataset.nodeId = "missing-block";@@ -5810,6 +5903,14 @@ app.commandLine.appendSwitch("disable-gpu");app.whenReady().then(async () => {const win = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true, contextIsolation: false, offscreen: true}});win.webContents.debugger.attach("1.3");+ ipcMain.handle("mindmap-view-ime", async (_event, text) => {+ await win.webContents.debugger.sendCommand("Input.imeSetComposition", {+ text, selectionStart: text.length, selectionEnd: text.length,+ });+ });+ ipcMain.handle("mindmap-view-insert-text", async (_event, text) => {+ await win.webContents.debugger.sendCommand("Input.insertText", {text});+ });ipcMain.handle("mindmap-view-print-media", async (_event, media) => {await win.webContents.debugger.sendCommand("Emulation.setEmulatedMedia", {media});});diff --git a/app/src/protyle/render/listMindmap/paste.test.ts b/app/src/protyle/render/listMindmap/paste.test.tsindex 3f57d100f0..0d4f6d80a3 100644--- a/app/src/protyle/render/listMindmap/paste.test.ts+++ b/app/src/protyle/render/listMindmap/paste.test.ts@@ -48,12 +48,13 @@ test("selected mind map nodes paste all clipboard files into a new child after f});test("mind map paste respects edit state, selection and read-only boundaries", () => {- for (const mode of ["readonly", "editing", "relation", "multiple", "missing", "unselected",+ for (const mode of ["readonly", "editing", "composing", "relation", "multiple", "missing", "unselected","input", "editable", "handled", "text", "export"]) {const current = create();switch (mode) {case "readonly": current.target.readOnly = true; break;case "editing": current.target.editingId = "node"; break;+ case "composing": current.target.selectionComposing = true; break;case "relation": current.target.relationFrom = "node"; break;case "multiple": current.target.getSelectedIds = () => ["node", "other"]; break;case "missing": current.target.model.nodes.clear(); break;@@ -71,6 +72,21 @@ test("mind map paste respects edit state, selection and read-only boundaries", (}});+test("the selection input preserves node paste until native composition starts", () => {+ const current = create();+ current.event.target.isContentEditable = true;+ current.target.selectionInput = current.event.target;+ current.target.pasteSelection(current.event);+ current.finish();+ assert.equal(current.event.defaultPrevented, true);+ assert.equal(current.calls.length, 1);+ current.event.defaultPrevented = false;+ current.target.selectionComposing = true;+ current.target.pasteSelection(current.event);+ assert.equal(current.event.defaultPrevented, false);+ assert.equal(current.calls.length, 1);+});+test("delayed node paste never follows a changed selection or deleted node", () => {for (const change of ["selection", "delete", "readonly"]) {const current = create();diff --git a/app/src/protyle/render/listMindmap/view.ts b/app/src/protyle/render/listMindmap/view.tsindex 4411250233..ee2b583272 100644--- a/app/src/protyle/render/listMindmap/view.ts+++ b/app/src/protyle/render/listMindmap/view.ts@@ -182,6 +182,13 @@ export class ListMindmapView {private relationFrom?: string;private relationPreview?: {x: number, y: number, targetId?: string};private editingId?: string;+ private readonly selectionInput = createElement("div", "b3-text-field mindmap-view__selection-input");+ private selectionInputId?: string;+ private selectionInputRevision = 0;+ private selectionCompositionRevision = 0;+ private selectionComposing = false;+ private selectionCompositionEnding = false;+ private touchInput = false;private pointer?: PointerState;private pointerCapture?: HTMLElement;private pinching = false;@@ -241,6 +248,12 @@ export class ListMindmapView {this.documentViewport.hidden = true;this.documentViewport.setAttribute("aria-hidden", "true");this.viewport.append(this.canvas, this.world, this.documentViewport);+ this.selectionInput.contentEditable = "plaintext-only";+ this.selectionInput.tabIndex = -1;+ this.selectionInput.hidden = true;+ this.selectionInput.setAttribute("role", "textbox");+ this.selectionInput.setAttribute("aria-label", this.label("text"));+ this.world.append(this.selectionInput);this.tooltip.hidden = true;this.tooltip.setAttribute("role", "tooltip");this.colorProbe.setAttribute("aria-hidden", "true");@@ -268,6 +281,39 @@ export class ListMindmapView {this.viewport.append(this.selectionBox);this.createToolbar();this.listen(document, "pointerdown", this.dismissControls, {capture: true});+ this.listen(options.host, "pointerdown", (event: PointerEvent) => {+ this.touchInput = event.pointerType === "touch";+ }, {capture: true});+ this.listen(options.host, "focus", () => queueMicrotask(() => {+ // 等待调用方交接选区,避免嵌套 focus 被浏览器恢复到不可编辑的画布。+ if (!this.destroyed && document.activeElement === options.host) {+ this.focusSelectionInput();+ }+ }));+ this.listen(this.selectionInput, "compositionstart", () => {+ this.selectionComposing = true;+ this.selectionCompositionRevision = this.selectionInputRevision;+ this.selectionInput.classList.add("mindmap-view__selection-input--composing");+ });+ this.listen(this.selectionInput, "compositionend", () => {+ this.selectionComposing = false;+ this.selectionCompositionEnding = true;+ const revision = this.selectionCompositionRevision;+ // 等待浏览器写入最后一次 input,整个组词过程保持同一输入目标。+ queueMicrotask(() => {+ this.selectionCompositionEnding = false;+ if (revision === this.selectionInputRevision) {+ this.commitSelectionInput();+ } else if (!this.selectionComposing) {+ this.selectionInput.textContent = "";+ }+ });+ });+ this.listen(this.selectionInput, "input", (event: InputEvent) => {+ if (!event.isComposing && !this.selectionComposing && !this.selectionCompositionEnding) {+ this.commitSelectionInput();+ }+ });this.listen(options.host, "pointerdown", this.activatePointer, {capture: true});this.listen(options.host, "click", this.activatePointer, {capture: true});this.listen(options.host, "click", (event: MouseEvent) => {@@ -1193,6 +1239,7 @@ export class ListMindmapView {this.setInteractionActive(true);this.selectNode(id);this.options.host.focus({preventScroll: true});+ this.focusSelectionInput();this.queueInspectorLayout(reveal);if (reveal) {this.revealNode(id);@@ -1204,6 +1251,7 @@ export class ListMindmapView {this.nodeElements.get(this.editingId)?.classList.remove("mindmap-view__node--editing");}this.editingId = id;+ this.syncSelectionInput();if (id) {this.setInteractionActive(true);this.destroyContentViews(id);@@ -1213,6 +1261,64 @@ export class ListMindmapView {this.refreshLayout();}+ private syncSelectionInput() {+ const focused = document.activeElement === this.selectionInput;+ const id = !this.destroyed && !this.readOnly && !this.editingId && !this.relationFrom &&+ !this.selectedRelation && !this.selectedSummary && !this.selectedEdge &&+ this.getSelectedIds().length === 1 && this.model.nodes.has(this.selectedId) ? this.selectedId : undefined;+ if (id !== this.selectionInputId) {+ this.selectionInputId = id;+ this.selectionInputRevision++;+ this.selectionInput.textContent = "";+ this.selectionComposing = false;+ this.selectionCompositionEnding = false;+ this.selectionInput.classList.remove("mindmap-view__selection-input--composing");+ }+ this.selectionInput.hidden = !id;+ const position = this.positions.get(id);+ if (position) {+ this.selectionInput.style.left = `${position.x}px`;+ this.selectionInput.style.top = `${position.y}px`;+ this.selectionInput.style.width = `${position.width}px`;+ }+ if (!id && focused) {+ this.options.host.focus({preventScroll: true});+ }+ }++ private focusSelectionInput() {+ this.syncSelectionInput();+ // 触屏点选仍保持画布焦点,避免仅选择节点就弹出软键盘。+ if (this.selectionInputId && !this.touchInput &&+ !document.body.matches(".body--ios, .body--android, .body--harmony")) {+ this.selectionInput.focus({preventScroll: true});+ }+ }++ private commitSelectionInput() {+ this.selectionInput.classList.remove("mindmap-view__selection-input--composing");+ const id = this.selectionInputId;+ const revision = this.selectionInputRevision;+ if (!id || this.selectionComposing || this.selectionCompositionEnding || !this.selectionInput.textContent) {+ return;+ }+ this.finishThen(() => {+ if (revision !== this.selectionInputRevision || this.readOnly || this.editingId || this.selectionComposing) {+ return;+ }+ const text = this.selectionInput.textContent;+ if (!text) {+ return;+ }+ if (this.model.nodes.get(id)?.virtual) {+ this.editRootTitle(id, false, text);+ } else {+ this.setEditing(id);+ this.options.onEdit?.(id, this.getContentHost(id), text);+ }+ });+ }+public refreshLayout() {if (this.destroyed || this.frame || this.pointer?.relation) {return;@@ -2052,6 +2158,7 @@ export class ListMindmapView {const height = this.viewport.clientHeight;this.resizeViewport(width, height);this.world.style.transform = `translate(${this.offsetX}px, ${this.offsetY}px) scale(${this.scale})`;+ this.syncSelectionInput();this.rememberViewport();this.updateDocumentViewport();this.zoomLabel.textContent = `${Math.round(this.scale * 100)}%`;@@ -2640,12 +2747,14 @@ export class ListMindmapView {if (event.ctrlKey || event.metaKey || this.multiSelect) {this.suppressLinkClick = true;this.options.host.focus({preventScroll: true});+ this.focusSelectionInput();this.cancelPointer();return;}}if ((!this.editingId || id) && !this.isTemporaryPan(event)) {this.options.host.focus({preventScroll: true});+ this.focusSelectionInput();}// 在捕获指针改变悬停状态前记录控件所属节点,避免拖动时重算整张脑图。const hiddenControls = Array.from(this.world.querySelectorAll<HTMLElement>(@@ -3391,9 +3500,9 @@ export class ListMindmapView {private copySelection = (event: ClipboardEvent) => {const cut = event.type === "cut";- if (event.defaultPrevented || this.editingId || this.relationFrom ||+ if (event.defaultPrevented || this.editingId || this.relationFrom || this.selectionComposing ||cut && this.readOnly || !this.options.onCopy || !this.getSelectedIds().length ||- (event.target as HTMLElement).isContentEditable ||+ (event.target !== this.selectionInput && (event.target as HTMLElement).isContentEditable) ||(event.target as HTMLElement).closest("input, textarea, select")) {return;}@@ -3402,9 +3511,9 @@ export class ListMindmapView {};private pasteSelection = (event: ClipboardEvent) => {- if (event.defaultPrevented || this.readOnly || this.editingId || this.relationFrom ||+ if (event.defaultPrevented || this.readOnly || this.editingId || this.relationFrom || this.selectionComposing ||!this.options.onPaste || this.getSelectedIds().length !== 1 ||- (event.target as HTMLElement).isContentEditable ||+ (event.target !== this.selectionInput && (event.target as HTMLElement).isContentEditable) ||(event.target as HTMLElement).closest("input, textarea, select")) {return;}@@ -3446,7 +3555,15 @@ export class ListMindmapView {}return;}- const target = event.target as HTMLElement;+ const selectionInput = event.target === this.selectionInput;+ if (selectionInput && (this.selectionComposing || this.selectionCompositionEnding || event.isComposing ||+ event.key === "Process" || event.key === "Dead" || event.keyCode === 229 ||+ !event.ctrlKey && !event.metaKey && !event.altKey && event.key !== " " && Array.from(event.key).length === 1)) {+ // 原生输入事件提供实际文本,keydown 的字母不能代替输入法结果。+ event.stopPropagation();+ return;+ }+ const target = selectionInput ? this.options.host : event.target as HTMLElement;const startingComposition = event.isComposing || event.key === "Process" || event.key === "Dead" ||event.keyCode === 229;if (target.closest("input, textarea, select, audio, video, iframe") ||diff --git a/app/src/protyle/render/listMindmap/viewportFocus.test.ts b/app/src/protyle/render/listMindmap/viewportFocus.test.tsindex ef25fafda9..ef5a28e19a 100644--- a/app/src/protyle/render/listMindmap/viewportFocus.test.ts+++ b/app/src/protyle/render/listMindmap/viewportFocus.test.ts@@ -36,6 +36,7 @@ const setup = () => {offsetWidth: 400, offsetHeight: 300,getBoundingClientRect: () => ({left: 0, top: 0, right: 400, bottom: 300, width: 400, height: 300})},selectNode: () => {}, queueInspectorLayout: () => {}, findLine: (): unknown => undefined, selectLine: () => {},+ focusSelectionInput: () => {},clearSelection: () => { target.selectedId = undefined; },boundedPan: (x: number, y: number) => ({x, y}), draw: () => drawn++,finishThen: (action: () => void) => { finished++; target.editingId = undefined; action(); },