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: https://github.com/siyuan-note/siyuan/issues/17051
Vanessa70b23c351fb0
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex 0ec84e72c2..7b3233d97a 100644--- a/app/src/menus/protyle.ts+++ b/app/src/menus/protyle.ts@@ -2261,7 +2261,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:const location = (dialog.element.querySelector("select") as HTMLSelectElement).value;const captionElement = nodeElement.querySelector("caption");if (title) {- const html = `<caption${location === "bottom" ? "caption-side: bottom;" : ""}>${Lute.EscapeHTMLStr(title)}</caption>`;+ const html = `<caption contenteditable="false" ${location === "bottom" ? "caption-side: bottom;" : ""}>${Lute.EscapeHTMLStr(title)}</caption>`;if (captionElement) {captionElement.outerHTML = html;} else {@@ -2400,8 +2400,8 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:${window.siyuan.languages.insertRowBefore.replace("${x}", `<span class="fn__space"></span><input style="width:64px" type="number" step="1" min="1" value="1" placeholder="${window.siyuan.languages.enterKey}" class="b3-text-field"><span class="fn__space"></span>`)}</div>`,accelerator: window.siyuan.config.keymap.editor.table.insertRowAbove.custom,- click: () => {- insertRowAbove(protyle, range, cellElement, nodeElement);+ click: (element: HTMLElement) => {+ insertRowAbove(protyle, range, cellElement, nodeElement, parseInt(element.querySelector("input").value));}});if (!nextHasNone || (nextHasNone && !nextHasRowSpan && nextHasColSpan)) {diff --git a/app/src/protyle/util/table.ts b/app/src/protyle/util/table.tsindex 5349ace362..9dd58bf47a 100644--- a/app/src/protyle/util/table.ts+++ b/app/src/protyle/util/table.ts@@ -121,7 +121,7 @@ export const insertRow = (protyle: IProtyle, range: Range, cellElement: HTMLElemscrollToView(nodeElement, newRowElememt, protyle);};-export const insertRowAbove = (protyle: IProtyle, range: Range, cellElement: HTMLElement, nodeElement: Element) => {+export const insertRowAbove = (protyle: IProtyle, range: Range, cellElement: HTMLElement, nodeElement: Element, count = 1) => {const wbrElement = document.createElement("wbr");range.insertNode(wbrElement);const html = nodeElement.outerHTML;@@ -160,10 +160,13 @@ export const insertRowAbove = (protyle: IProtyle, range: Range, cellElement: HTMif (cellElement.parentElement.parentElement.tagName === "THEAD" && !cellElement.parentElement.previousElementSibling) {cellElement.parentElement.parentElement.insertAdjacentHTML("beforebegin", `<thead><tr>${rowHTML}</tr></thead>`);newRowElememt = nodeElement.querySelector("thead tr");+ if (count > 1) {+ cellElement.parentElement.parentElement.nextElementSibling.insertAdjacentHTML("afterbegin", `<tr>${rowHTML.replace(/<th/g, "<td").replace(/<\/th>/g, "</td>")}</tr>`.repeat(count - 1));+ }cellElement.parentElement.parentElement.nextElementSibling.insertAdjacentHTML("afterbegin", cellElement.parentElement.parentElement.innerHTML.replace(/<th/g, "<td").replace(/<\/th>/g, "</td>"));cellElement.parentElement.parentElement.remove();} else {- cellElement.parentElement.insertAdjacentHTML("beforebegin", `<tr>${rowHTML}</tr>`);+ cellElement.parentElement.insertAdjacentHTML("beforebegin", `<tr>${rowHTML}</tr>`.repeat(count));newRowElememt = cellElement.parentElement.previousElementSibling as HTMLTableRowElement;}range.selectNodeContents(newRowElememt.cells[getColIndex(cellElement)]);