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/17002
Vanessa19d9c455a7ba
diff --git a/app/src/boot/globalEvent/mousemove.ts b/app/src/boot/globalEvent/mousemove.tsindex f0498813c5..1331fe063c 100644--- a/app/src/boot/globalEvent/mousemove.ts+++ b/app/src/boot/globalEvent/mousemove.ts@@ -222,7 +222,8 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {const cellElement = (hasClosestByTag(target, "TH") || hasClosestByTag(target, "TD")) as HTMLTableCellElement;const tableElement = blockElement.querySelector("table");if (cellElement && tableElement && tableElement.getAttribute("contenteditable") === "true") {- const tableHeight = blockElement.querySelector("table").clientHeight;+ const tableHeight = blockElement.querySelector("colgroup").clientHeight;+ const captionHeight = blockElement.querySelector("caption")?.clientHeight || 0;const resizeElement = blockElement.querySelector(".table__resize");if (blockElement.style.textAlign === "center" || blockElement.style.textAlign === "right") {resizeElement.parentElement.style.left = tableElement.offsetLeft + "px";@@ -232,10 +233,10 @@ export const windowMouseMove = (event: MouseEvent, mouseIsEnter: boolean) => {const rect = cellElement.getBoundingClientRect();if (rect.right - event.clientX < 3 && rect.right - event.clientX > 0) {resizeElement.setAttribute("data-col-index", (getColIndex(cellElement) + cellElement.colSpan - 1).toString());- resizeElement.setAttribute("style", `height:${tableHeight}px;left: ${Math.round(cellElement.offsetWidth + cellElement.offsetLeft - blockElement.firstElementChild.scrollLeft - 3)}px;display:block`);+ resizeElement.setAttribute("style", `top:${captionHeight}px;height:${tableHeight}px;left: ${Math.round(cellElement.offsetWidth + cellElement.offsetLeft - blockElement.firstElementChild.scrollLeft - 3)}px;display:block`);} else if (event.clientX - rect.left < 3 && event.clientX - rect.left > 0 && cellElement.previousElementSibling) {resizeElement.setAttribute("data-col-index", (getColIndex(cellElement) - 1).toString());- resizeElement.setAttribute("style", `height:${tableHeight}px;left: ${Math.round(cellElement.offsetLeft - blockElement.firstElementChild.scrollLeft - 3)}px;display:block`);+ resizeElement.setAttribute("style", `top:${captionHeight}px;height:${tableHeight}px;left: ${Math.round(cellElement.offsetLeft - blockElement.firstElementChild.scrollLeft - 3)}px;display:block`);}}}diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex a086f9e9c1..054f7f6dad 100644--- a/app/src/menus/protyle.ts+++ b/app/src/menus/protyle.ts@@ -716,6 +716,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {/// #elseconst oldHTML = nodeElement.outerHTML;const id = nodeElement.getAttribute("data-node-id");+ const captionElement = hasClosestByTag(range.startContainer, "CAPTION");if (range.toString() !== "" || (range.cloneContents().childNodes[0] as HTMLElement)?.classList?.contains("emoji")) {window.siyuan.menus.menu.append(new MenuItem({id: "copy",@@ -737,7 +738,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {copyPlainText(getSelection().getRangeAt(0).toString());}}).element);- if (protyle.disabled) {+ if (protyle.disabled || captionElement) {return;}window.siyuan.menus.menu.append(new MenuItem({@@ -820,7 +821,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {}}}- if (!protyle.disabled) {+ if (!protyle.disabled && !captionElement) {window.siyuan.menus.menu.append(new MenuItem({id: "paste",label: window.siyuan.languages.paste,@@ -858,15 +859,17 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {}}).element);}- window.siyuan.menus.menu.append(new MenuItem({- id: "selectAll",- label: window.siyuan.languages.selectAll,- icon: "iconSelect",- accelerator: "⌘A",- click() {- selectAll(protyle, nodeElement, range);- }- }).element);+ if (!captionElement) {+ window.siyuan.menus.menu.append(new MenuItem({+ id: "selectAll",+ label: window.siyuan.languages.selectAll,+ icon: "iconSelect",+ accelerator: "⌘A",+ click() {+ selectAll(protyle, nodeElement, range);+ }+ }).element);+ }if (nodeElement.classList.contains("table") && !protyle.disabled) {const cellElement = hasClosestByTag(range.startContainer, "TD") || hasClosestByTag(range.startContainer, "TH");if (cellElement) {diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.tsindex 5db14daf16..e13da9da3a 100644--- a/app/src/protyle/gutter/index.ts+++ b/app/src/protyle/gutter/index.ts@@ -1627,7 +1627,8 @@ export class Gutter {if (!tableElement.contains(range.startContainer)) {range = getEditorRange(tableElement.querySelector("th"));}- const cellElement = hasClosestByTag(range.startContainer, "TD") || hasClosestByTag(range.startContainer, "TH");+ const cellElement = hasClosestByTag(range.startContainer, "TD") ||+ hasClosestByTag(range.startContainer, "TH") || nodeElement.querySelector("th, td");if (cellElement) {window.siyuan.menus.menu.append(new MenuItem({id: "separator_table", type: "separator"}).element);window.siyuan.menus.menu.append(new MenuItem({diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex 61341f3736..e2381c1b7c 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -12,7 +12,7 @@ import {setFirstNodeRange,setLastNodeRange} from "../util/selection";-import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "../util/hasClosest";+import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName, hasClosestByTag} from "../util/hasClosest";import {Link} from "./Link";import {setPosition} from "../../util/setPosition";import {transaction, updateTransaction} from "../wysiwyg/transaction";@@ -114,7 +114,8 @@ export class Toolbar {public render(protyle: IProtyle, range: Range, event?: KeyboardEvent) {this.range = range;let nodeElement = hasClosestBlock(range.startContainer);- if (isMobile() || !nodeElement || protyle.disabled || nodeElement.classList.contains("av")) {+ if (isMobile() || !nodeElement || protyle.disabled || nodeElement.classList.contains("av") ||+ hasClosestByTag(range.startContainer, "CAPTION")) {this.element.classList.add("fn__none");return;}@@ -1115,7 +1116,7 @@ export class Toolbar {focusBlock(renderElement);renderElement.classList.add("protyle-wysiwyg--select");}- protyle.wysiwyg.element.focus({ preventScroll: true});+ protyle.wysiwyg.element.focus({preventScroll: true});return;}let inlineLastNode: Element;@@ -1221,7 +1222,7 @@ export class Toolbar {}}updateTransaction(protyle, id, nodeElement.outerHTML, html);- protyle.wysiwyg.element.focus({ preventScroll: true});+ protyle.wysiwyg.element.focus({preventScroll: true});};this.subElement.style.zIndex = (++window.siyuan.zIndex).toString();this.subElement.classList.remove("fn__none");