An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/6141
Vanessa1d1e224dd20f
diff --git a/app/src/protyle/util/table.ts b/app/src/protyle/util/table.tsindex 60cb3eb682..556aaa0cb9 100644--- a/app/src/protyle/util/table.ts+++ b/app/src/protyle/util/table.ts@@ -65,7 +65,7 @@ export const setTableAlign = (protyle: IProtyle, cellElements: HTMLElement[], no});}updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);- nodeElement.querySelector("wbr").remove();+ focusByWbr(tableElement, range)};export const insertRow = (protyle: IProtyle, range: Range, cellElement: HTMLElement, nodeElement: Element) => {@@ -203,13 +203,19 @@ export const deleteRow = (protyle: IProtyle, range: Range, cellElement: HTMLElem};export const deleteColumn = (protyle: IProtyle, range: Range, nodeElement: Element, cellElement: HTMLElement) => {- range.insertNode(document.createElement("wbr"));+ const wbrElement = document.createElement("wbr");+ range.insertNode(wbrElement);const html = nodeElement.outerHTML;+ wbrElement.remove();const index = getColIndex(cellElement);- if (cellElement.previousElementSibling || cellElement.nextElementSibling) {- range.selectNodeContents(cellElement.previousElementSibling || cellElement.nextElementSibling);+ const sideCellElement = (cellElement.previousElementSibling || cellElement.nextElementSibling) as HTMLElement+ if (sideCellElement) {+ range.selectNodeContents(sideCellElement);range.collapse(true);- range.insertNode(document.createElement("wbr"));+ // 滚动条横向定位+ if (sideCellElement.offsetLeft + sideCellElement.clientWidth > nodeElement.firstElementChild.scrollLeft + nodeElement.firstElementChild.clientWidth) {+ nodeElement.firstElementChild.scrollLeft = sideCellElement.offsetLeft + sideCellElement.clientWidth - nodeElement.firstElementChild.clientWidth;+ }}const tableElement = nodeElement.querySelector("table");for (let i = 0; i < tableElement.rows.length; i++) {@@ -222,7 +228,7 @@ export const deleteColumn = (protyle: IProtyle, range: Range, nodeElement: Eleme}nodeElement.querySelectorAll("col")[index]?.remove();updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);- focusByWbr(nodeElement, range);+ focusByRange(range);};export const moveRowToUp = (protyle: IProtyle, range: Range, cellElement: HTMLElement, nodeElement: Element) => {@@ -251,6 +257,7 @@ export const moveRowToUp = (protyle: IProtyle, range: Range, cellElement: HTMLEl}updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);focusByWbr(nodeElement, range);+ scrollCenter(protyle, rowElement);};export const moveRowToDown = (protyle: IProtyle, range: Range, cellElement: HTMLElement, nodeElement: Element) => {@@ -280,6 +287,7 @@ export const moveRowToDown = (protyle: IProtyle, range: Range, cellElement: HTML}updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);focusByWbr(nodeElement, range);+ scrollCenter(protyle, rowElement);};export const moveColumnToLeft = (protyle: IProtyle, range: Range, cellElement: HTMLElement, nodeElement: Element) => {@@ -295,9 +303,14 @@ export const moveColumnToLeft = (protyle: IProtyle, range: Range, cellElement: Hreturn true;}});+nodeElement.querySelectorAll("tr").forEach((trElement) => {trElement.cells[cellIndex].after(trElement.cells[cellIndex - 1]);});+ // 滚动条横向定位+ if (cellElement.offsetLeft < nodeElement.firstElementChild.scrollLeft) {+ nodeElement.firstElementChild.scrollLeft = cellElement.offsetLeft;+ }const colElements = nodeElement.querySelectorAll("col");colElements[cellIndex].after(colElements[cellIndex - 1]);updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);@@ -320,6 +333,10 @@ export const moveColumnToRight = (protyle: IProtyle, range: Range, cellElement:nodeElement.querySelectorAll("tr").forEach((trElement) => {trElement.cells[cellIndex].before(trElement.cells[cellIndex + 1]);});+ // 滚动条横向定位+ if (cellElement.offsetLeft + cellElement.clientWidth > nodeElement.firstElementChild.scrollLeft + nodeElement.firstElementChild.clientWidth) {+ nodeElement.firstElementChild.scrollLeft = cellElement.offsetLeft + cellElement.clientWidth - nodeElement.firstElementChild.clientWidth;+ }const colElements = nodeElement.querySelectorAll("col");colElements[cellIndex].before(colElements[cellIndex + 1]);updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);