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: Improve table and tab title arrow navigation https://github.com/siyuan-note/siyuan/issues/20406
Danielfaf07a2a9edc
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.syindex e2aa3e22c2..11b5f23152 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy@@ -7,7 +7,7 @@"id": "20200924100950-9op5xi1","title": "Shortcuts","type": "doc",- "updated": "20261010134815"+ "updated": "20261010201951"},"Children": [{@@ -4274,7 +4274,7 @@"HeadingLevel": 2,"Properties": {"id": "20210106154056-koo4wdj",- "updated": "20261010134815"+ "updated": "20261010201951"},"Children": [{@@ -13681,7 +13681,7 @@"HeadingLevel": 3,"Properties": {"id": "20210106154319-jeh8w1g",- "updated": "20261008221006"+ "updated": "20261010201951"},"Children": [{@@ -13717,6 +13717,20 @@}]},+ {+ "ID": "20261010201951-9uwktyc",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261010201951-9uwktyc",+ "updated": "20261010201951"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "At a table cell boundary, arrow keys move to the adjacent cell. If there is no cell in that direction, they move to the surrounding document content; at a document boundary, the cell remains focused."+ }+ ]+ },{"ID": "20210106154319-otreidg","Type": "NodeTable",@@ -14871,7 +14885,7 @@"Type": "NodeHeading","Properties": {"id": "20260905124213-pfrny4c",- "updated": "20260906013806"+ "updated": "20261010201951"},"HeadingLevel": 3,"Children": [@@ -14886,7 +14900,7 @@"Type": "NodeParagraph","Properties": {"id": "20260905124213-dh6bex8",- "updated": "20260906013806"+ "updated": "20261010201951"},"Children": [{@@ -14914,6 +14928,10 @@{"Type": "NodeText","Data": " to finish editing and move to the content. Clicking the content also ends title editing."+ },+ {+ "Type": "NodeText",+ "Data": " Up and Down move between surrounding blocks, the active tab title, and its content. At the start or end of a tab title, Left and Right keep the caret inside the title."}]},diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.syindex c0f46ce924..339b8d95d4 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy@@ -7,7 +7,7 @@"id": "20200813004551-gm0pbn1","title": "快捷键","type": "doc",- "updated": "20261010134815"+ "updated": "20261010201951"},"Children": [{@@ -4272,7 +4272,7 @@"HeadingLevel": 2,"Properties": {"id": "20201227133317-rkh4bji",- "updated": "20261010134815"+ "updated": "20261010201951"},"Children": [{@@ -13751,7 +13751,7 @@"HeadingLevel": 3,"Properties": {"id": "20201227133317-xpgtzbg",- "updated": "20261008221006"+ "updated": "20261010201951"},"Children": [{@@ -13787,6 +13787,20 @@}]},+ {+ "ID": "20261010201951-6o053ma",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261010201951-6o053ma",+ "updated": "20261010201951"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "在表格单元格的边界按方向键可进入相邻单元格;该方向没有单元格时,焦点移到表格外的相邻文档内容。到达文档边界时,焦点保持在单元格内。"+ }+ ]+ },{"ID": "20201227133317-v7clw0j","Type": "NodeTable",@@ -14941,7 +14955,7 @@"Type": "NodeHeading","Properties": {"id": "20260905124213-avhukx7",- "updated": "20260906013806"+ "updated": "20261010201951"},"HeadingLevel": 3,"Children": [@@ -14956,7 +14970,7 @@"Type": "NodeParagraph","Properties": {"id": "20260905124213-w4xwhs9",- "updated": "20260906013806"+ "updated": "20261010201951"},"Children": [{@@ -14984,6 +14998,10 @@{"Type": "NodeText","Data": " 结束编辑并进入正文;点击正文也可结束编辑。"+ },+ {+ "Type": "NodeText",+ "Data": "上下方向键在相邻块、当前页签标题和正文之间移动焦点;在页签标题的开头或末尾按左右方向键,光标保持在标题内。"}]},diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.syindex 3cce32fada..486536259a 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy@@ -7,7 +7,7 @@"id": "20211226122549-jktxego","title": "快捷鍵","type": "doc",- "updated": "20261010134815"+ "updated": "20261010201951"},"Children": [{@@ -4266,7 +4266,7 @@"HeadingLevel": 2,"Properties": {"id": "20211226122652-htptsmh",- "updated": "20261010134815"+ "updated": "20261010201951"},"Children": [{@@ -13669,7 +13669,7 @@"HeadingLevel": 3,"Properties": {"id": "20211226122652-x2dmpab",- "updated": "20261008221006"+ "updated": "20261010201951"},"Children": [{@@ -13705,6 +13705,20 @@}]},+ {+ "ID": "20261010201951-dvpf2e5",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261010201951-dvpf2e5",+ "updated": "20261010201951"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "在表格儲存格的邊界按方向鍵可進入相鄰儲存格;該方向沒有儲存格時,焦點移到表格外的相鄰文件內容。到達文件邊界時,焦點維持在儲存格內。"+ }+ ]+ },{"ID": "20211226122652-n2r88dm","Type": "NodeTable",@@ -14859,7 +14873,7 @@"Type": "NodeHeading","Properties": {"id": "20260905124213-degzfbw",- "updated": "20260906013806"+ "updated": "20261010201951"},"HeadingLevel": 3,"Children": [@@ -14874,7 +14888,7 @@"Type": "NodeParagraph","Properties": {"id": "20260905124213-z6l8pda",- "updated": "20260906013806"+ "updated": "20261010201951"},"Children": [{@@ -14902,6 +14916,10 @@{"Type": "NodeText","Data": " 結束編輯並進入內文;點擊內文也可結束編輯。"+ },+ {+ "Type": "NodeText",+ "Data": "上下方向鍵在相鄰區塊、目前頁籤標題和內文之間移動焦點;在頁籤標題的開頭或末尾按左右方向鍵,游標維持在標題內。"}]},diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.syindex 19f6c8576f..e49adf9b66 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy@@ -9,7 +9,7 @@"id": "20240530101000-xsbxokr","title": "ショートカット","type": "doc",- "updated": "20261010134815"+ "updated": "20261010201951"},"Children": [{@@ -4228,7 +4228,7 @@"Properties": {"ID": "20240530101000-twmuxke","id": "20240530101000-675gu9g",- "updated": "20261010134815"+ "updated": "20261010201951"},"Children": [{@@ -13628,7 +13628,7 @@"Properties": {"ID": "20240530101000-uqhtil9","id": "20240530101000-9x0xqew",- "updated": "20261008221006"+ "updated": "20261010201951"},"Children": [{@@ -13686,6 +13686,20 @@}]},+ {+ "ID": "20261010201951-pdtqvt3",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20261010201951-pdtqvt3",+ "updated": "20261010201951"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "テーブルのセルの端で矢印キーを押すと、隣のセルへ移動します。その方向にセルがない場合は、テーブルの外の隣接する文書内容へ移動します。文書の端ではセル内にフォーカスが留まります。"+ }+ ]+ },{"ID": "20240530101000-prxsqyv","Type": "NodeTable",@@ -14788,7 +14802,7 @@"Type": "NodeHeading","Properties": {"id": "20260905124213-unrfwm9",- "updated": "20260906013806"+ "updated": "20261010201951"},"HeadingLevel": 3,"Children": [@@ -14803,7 +14817,7 @@"Type": "NodeParagraph","Properties": {"id": "20260905124213-fem82m0",- "updated": "20260906013806"+ "updated": "20261010201951"},"Children": [{@@ -14831,6 +14845,10 @@{"Type": "NodeText","Data": " を押すと編集を終了して本文に移動します。本文をクリックしてもタイトルの編集を終了できます。"+ },+ {+ "Type": "NodeText",+ "Data": "上下の矢印キーで、隣接するブロック、現在のタブのタイトル、本文の間を移動できます。タブタイトルの先頭または末尾で左右の矢印キーを押しても、カーソルはタイトル内に留まります。"}]},diff --git a/app/src/protyle/render/tableCellInput.test.ts b/app/src/protyle/render/tableCellInput.test.tsindex 19cf7433be..bbb061264d 100644--- a/app/src/protyle/render/tableCellInput.test.ts+++ b/app/src/protyle/render/tableCellInput.test.ts@@ -85,7 +85,7 @@ const browserCases = async (source: string, queueSource: string, editorSource: sconst table = wysiwyg.firstElementChild as HTMLElement;const queue = Object.assign(new Queue(), {element: wysiwyg, lastHTMLs: {[table.dataset.nodeId]: table.outerHTML}});const owner = {element, wysiwyg: queue, lute, contentElement: wysiwyg, options: {typewriterMode: false},- hint: {render: noop},+ hint: {render: noop}, toolbar: {},block: {rootID: "root"}, disabled: false} as unknown as IProtyle;const range = document.createRange();range.selectNodeContents(table.querySelector("th"));@@ -94,6 +94,7 @@ const browserCases = async (source: string, queueSource: string, editorSource: schanges.length = 0;return {owner, queue, element, wysiwyg, table, range};};+ let tableExitTarget: HTMLElement;const editorDependencies = {...dependencies, ...api, TABLE_CELL_INLINE_ATTRIBUTE: "data-sy-table-cell-inline",TABLE_CELL_RICH_ATTRIBUTE: "data-sy-table-cell-rich", TABLE_CELL_SLASH_IDS: new Set(),@@ -101,6 +102,19 @@ const browserCases = async (source: string, queueSource: string, editorSource: sgetDefaultToolbar: (): string[] => [], updateOutlineCurrentBlock: noop,setMobileToolbarUndo: noop, setTableCellRichContext: noop, bindTableCellRichDrag: noop,bindLiteCodeActions: noop, highlightRender: noop,+ isTableCellCaretAtBoundary: () => true,+ getAdjacentRichTableCell: (): undefined => undefined,+ getCaretGoalX: () => 80,+ leaveRichTableCell: () => {+ if (!tableExitTarget) {+ return false;+ }+ const range = document.createRange();+ range.selectNodeContents(tableExitTarget);+ range.collapse(true);+ focusByRange(range);+ return true;+ },imgMenu: (protyle: IProtyle, _range: Range, image: HTMLElement) => {check.equal(image.closest(".protyle-wysiwyg"), image.closest(".table__cell-editor").querySelector(".protyle-wysiwyg"));check.ok(protyle !== tableImageOwner, "the menu must use the cell editor's transaction context");@@ -514,6 +528,28 @@ const browserCases = async (source: string, queueSource: string, editorSource: scheck.ok(cells[1].querySelector(".table__cell-editor"));await finish(element);}+ for (const key of ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]) {+ const {owner, element, table, wysiwyg} = fixture();+ const cell = table.querySelector("td");+ await open(owner, cell);+ const host = cell.querySelector<HTMLElement>(".table__cell-editor");+ host.dispatchEvent(new KeyboardEvent("keydown", {key, bubbles: true, cancelable: true}));+ check.ok(cell.querySelector(".table__cell-editor"), "no adjacent region keeps editing active");+ tableExitTarget = document.createElement("div");+ tableExitTarget.contentEditable = "true";+ tableExitTarget.textContent = "Outside";+ wysiwyg.appendChild(tableExitTarget);+ const input = host.querySelector<HTMLElement>('[contenteditable="true"]');+ input.textContent = "Saved before leaving";+ input.dispatchEvent(new Event("input", {bubbles: true}));+ host.dispatchEvent(new KeyboardEvent("keydown", {key, bubbles: true, cancelable: true}));+ check.equal(cell.querySelector(".table__cell-editor"), null);+ check.ok(cell.textContent.includes("Saved before leaving"));+ check.ok(tableExitTarget.contains(getSelection().anchorNode));+ check.ok(tableExitTarget.contains(owner.toolbar.range.startContainer));+ tableExitTarget = undefined;+ await finish(element);+ }for (const invalidate of ["disabled", "removed"]) {const {owner, queue, element, table} = fixture();let release: () => void;diff --git a/app/src/protyle/render/tableCellRichEditor.ts b/app/src/protyle/render/tableCellRichEditor.tsindex 35d52418d6..86324cdff7 100644--- a/app/src/protyle/render/tableCellRichEditor.ts+++ b/app/src/protyle/render/tableCellRichEditor.ts@@ -16,7 +16,7 @@ import {getTableBlockHTML, getTableCellInlineHTML, getTableCellRichBlockDOM, renimport {TABLE_CELL_RICH_ATTRIBUTE} from "../util/tableCellRichValue";import {focusByOffset, getUndoFocusContext} from "../util/selection";import {focusByRange, getSelectionOffset} from "../util/selectionOffsets";-import {getAdjacentRichTableCell, isTableCellCaretAtBoundary} from "../util/tableCellRichNavigation";+import {getAdjacentRichTableCell, isTableCellCaretAtBoundary, leaveRichTableCell} from "../util/tableCellRichNavigation";import {focusEditableAtGoalX, getCaretGoalX} from "../wysiwyg/verticalCaret";import {fixTable} from "../util/table";import {updateTableCellContentLayout} from "../util/tableCellRich";@@ -517,10 +517,16 @@ const mountTableCellRichEditor = async (request: object, previousEditor: typeofevent.stopImmediatePropagation();restoreTableVirtualizationDOM(table);const nextCell = getAdjacentRichTableCell(cell, event.key);+ const goalX = getCaretGoalX(range);if (nextCell) {- const goalX = getCaretGoalX(range);finish();openTableCellRichEditor(owner, nextCell, {key: event.key, goalX});+ } else {+ commit();+ if (leaveRichTableCell(owner, table, event.key, goalX)) {+ finish();+ owner.toolbar.range = getSelection().getRangeAt(0).cloneRange();+ }}return;}diff --git a/app/src/protyle/util/tableCellRichNavigation.ts b/app/src/protyle/util/tableCellRichNavigation.tsindex 9f3073f140..a0b7e47e1e 100644--- a/app/src/protyle/util/tableCellRichNavigation.ts+++ b/app/src/protyle/util/tableCellRichNavigation.ts@@ -1,6 +1,19 @@import {buildTableGrid, getVerticalTableCell} from "./table";import {isCaretAtVerticalBoundary} from "../wysiwyg/verticalCaret";import {stripSemanticMarkersFromRangeText} from "./inlineElementMarker";+import {focusAdjacentVerticalRegion} from "../wysiwyg/verticalNavigation";+import {getAdjacentVerticalBlock} from "../wysiwyg/verticalTarget";+import {focusBlock} from "./selection";++// 单元格边界之外沿所属文档导航,文档没有相邻区域时保留单元格编辑状态。+export const leaveRichTableCell = (protyle: IProtyle, table: HTMLElement, key: string, goalX: number) => {+ const direction = key === "ArrowLeft" || key === "ArrowUp" ? "up" : "down";+ if (key === "ArrowUp" || key === "ArrowDown") {+ return focusAdjacentVerticalRegion(protyle, table, direction, goalX) === "moved";+ }+ const target = getAdjacentVerticalBlock(table, direction);+ return !!target && !!focusBlock(target, undefined, direction === "down");+};export const isTableCellCaretAtBoundary = (element: HTMLElement, range: Range, key: string) => {if (!range.collapsed || !element.contains(range.startContainer)) {diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex 1071cf34c5..789aac0645 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -477,6 +477,14 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {!event.altKey && !event.shiftKey && isNotCtrl(event);if ((event.key.startsWith("Arrow") && !isPlainVerticalArrow) ||event.key === "Home" || event.key === "End") {+ if (calloutTitleElement.classList.contains("tab-item-title") && range.collapsed &&+ !event.altKey && !event.shiftKey && isNotCtrl(event)) {+ const offset = getSelectionOffset(calloutTitleElement, nodeElement, range);+ if (event.key === "ArrowLeft" && offset.start === 0 ||+ event.key === "ArrowRight" && offset.end === calloutTitleElement.textContent.length) {+ event.preventDefault();+ }+ }event.stopPropagation();return;}diff --git a/app/src/protyle/wysiwyg/verticalNavigation.ts b/app/src/protyle/wysiwyg/verticalNavigation.tsindex 553906f749..0fc2ce1ed5 100644--- a/app/src/protyle/wysiwyg/verticalNavigation.ts+++ b/app/src/protyle/wysiwyg/verticalNavigation.ts@@ -157,7 +157,10 @@ const resolveBlockVerticalNavigationTarget = (editorElement: HTMLElement, elemenif (editable?.tagName === "TABLE") {editable = getTableBoundaryCell(editable as HTMLTableElement, direction, goalX);}- return editable ? {type: "text", owner: element, editable, scope} :+ const revealTitle = !!editable && editable === region?.title && !isVerticalNavigationElementVisible(editable);+ return editable ? {type: "text", owner: element, editable, scope,+ reveal: revealTitle ? () => !!region.setTitleEditing?.(true) : undefined,+ rollbackReveal: revealTitle ? () => region.setTitleEditing?.(false) : undefined} :{type: "atomic", owner: element, scope};};diff --git a/app/src/protyle/wysiwyg/verticalTarget.ts b/app/src/protyle/wysiwyg/verticalTarget.tsindex 0a40d0e113..0c6e85d106 100644--- a/app/src/protyle/wysiwyg/verticalTarget.ts+++ b/app/src/protyle/wysiwyg/verticalTarget.ts@@ -54,7 +54,8 @@ const findVisibleBoundaryBlock = (element: Element, direction: TVerticalDirectioconst region = getHostVerticalRegion(element);// 非容器块属于一个不透明导航区域,不能根据其内部渲染结果改变外部导航目标。if (element.getAttribute("fold") === "1" || !isContainerBlock(element) ||- (direction === "down" && region?.title && isVerticalNavigationElementVisible(region.title))) {+ (direction === "down" && region?.title &&+ (region.setTitleEditing || isVerticalNavigationElementVisible(region.title)))) {return element;}}diff --git a/app/tests/verticalNavigation.test.js b/app/tests/verticalNavigation.test.jsindex bb25e15764..945eb79dbc 100644--- a/app/tests/verticalNavigation.test.js+++ b/app/tests/verticalNavigation.test.js@@ -33,7 +33,14 @@ const rendererModules = () => {modules["util/documentRange"] = readFileSync(path.join(root, "util/documentRange.ts"), "utf8");modules["wysiwyg/getBlock"] = 'import {hasClosestBlock, hasClosestByClassName} from "../util/hasClosest";\n' +extract("wysiwyg/getBlock", ["getContenteditableElement", "isContainerBlock", "getNextBlock", "getPreviousBlock"]);- modules["render/tabsRender"] = "export const setTabTitleNavigationEditing = () => false;";+ modules["render/tabsRender"] = `export const setTabTitleNavigationEditing = (item, editing) => {+ item.querySelector(".tab-item-info").style.display = editing ? "block" : "none";+ item.dataset.tabsEditing = String(editing);+ return true;+ };`;+ modules["util/tableExit"] = 'import {focusAdjacentVerticalRegion} from "../wysiwyg/verticalNavigation";\n' ++ 'import {getAdjacentVerticalBlock} from "../wysiwyg/verticalTarget";\n' ++ 'import {focusBlock} from "./selection";\n' + extract("util/tableCellRichNavigation", ["leaveRichTableCell"]);modules["../util/highlightById"] = "export const scrollCenter = () => {};";modules["render/av/focus"] = 'import {focusEditableAtGoalX} from "../../wysiwyg/verticalCaret";\n' +'import {isTableLikeView} from "./viewType";\n' +@@ -514,6 +521,31 @@ const runEntryCases = async () => {[`<div class="bq" data-node-id="hidden" style="display:none">hidden</div>${paragraph}`, "body", false],["<div data-type=\"NodeTable\" data-node-id=\"table\"><table><tr><td id=\"target\" contenteditable=\"true\">cell</td></tr></table></div>", "target", false],];+ {+ const tabs = `<div class="tabs" data-node-id="tabs" data-type="NodeTabs">+<div class="tab-item" data-node-id="tab" data-type="NodeTabItem" data-tabs-hidden="false">+<div class="tab-item-info" style="display:none"><div id="tab-title" class="tab-item-title" contenteditable="true">Title</div></div>+<div class="tab-item-content">${paragraph}</div></div></div>`;+ const {protyle, editor} = setup(`<div data-node-id="before">Before</div>${tabs}`);+ const before = editor.firstElementChild;+ assert.equal(focusAdjacentVerticalRegion(protyle, before, "down", 40), "moved");+ assert.ok(document.getElementById("tab-title").contains(getSelection().anchorNode));+ assert.equal(focusAdjacentVerticalRegion(protyle, document.getElementById("body").parentElement,+ "up", 40), "moved");+ assert.ok(document.getElementById("tab-title").contains(getSelection().anchorNode));+ cases++;+ }+ for (const key of ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]) {+ const {protyle, editor} = setup(`<div data-node-id="before" data-type="NodeParagraph"><div contenteditable="true">Before</div></div>+<div data-type="NodeTable" data-node-id="table"><table><tr><td>Cell</td></tr></table></div>+<div data-node-id="after" data-type="NodeParagraph"><div contenteditable="true">After</div></div>`);+ const table = editor.querySelector('[data-node-id="table"]');+ select(table.querySelector("td"));+ assert.equal(window.navigationModules("util/tableExit").leaveRichTableCell(protyle, table, key, 40), true);+ const target = editor.querySelector(`[data-node-id="${["ArrowUp", "ArrowLeft"].includes(key) ? "before" : "after"}"]`);+ assert.ok(target.contains(getSelection().anchorNode), key);+ cases++;+ }window.titleEnterCalls = 0;variants.push([`<div id="target" class="custom-block" data-type="NodeCustomBlock" data-node-id="custom" contenteditable="false"><div contenteditable="true">plugin editor</div></div>`, "target", true]);