An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:rotating_light:
Vanessafd648825958a
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.tsindex 17e217b36a..f011c99ca4 100644--- a/app/src/protyle/render/av/action.ts+++ b/app/src/protyle/render/av/action.ts@@ -17,7 +17,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEleconst addElement = hasClosestByAttribute(event.target, "data-type", "av-header-add");if (addElement) {const addMenu = addCol(protyle, blockElement);- const addRect = addElement.getBoundingClientRect()+ const addRect = addElement.getBoundingClientRect();addMenu.open({x: addRect.left,y: addRect.bottom,diff --git a/app/src/protyle/render/av/addCol.ts b/app/src/protyle/render/av/addCol.tsindex ec230a391f..82f5991a55 100644--- a/app/src/protyle/render/av/addCol.ts+++ b/app/src/protyle/render/av/addCol.ts@@ -99,4 +99,4 @@ export const addCol = (protyle: IProtyle, blockElement: HTMLElement) => {}});return menu;-}+};diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.tsindex b4ae20b5cb..7935867468 100644--- a/app/src/protyle/render/av/cell.ts+++ b/app/src/protyle/render/av/cell.ts@@ -217,7 +217,7 @@ export const showHeaderCellMenu = (protyle: IProtyle, blockElement: HTMLElement,y: cellRect.bottom,h: cellRect.height});- const inputElement = window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement+ const inputElement = window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement;if (inputElement) {inputElement.select();inputElement.focus();diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.tsindex c9d306995c..f4cc69623d 100644--- a/app/src/protyle/render/av/openMenuPanel.ts+++ b/app/src/protyle/render/av/openMenuPanel.ts@@ -10,11 +10,11 @@ export const openMenuPanel = (protyle: IProtyle, blockElement: HTMLElement, typereturn;}window.siyuan.menus.menu.remove();- const avId = blockElement.getAttribute("data-av-id")+ const avId = blockElement.getAttribute("data-av-id");fetchPost("/api/av/renderAttributeView", {id: avId}, (response) => {const data = response.data.av as IAV;- const tabRect = blockElement.querySelector(".layout-tab-bar").getBoundingClientRect()- let html+ const tabRect = blockElement.querySelector(".layout-tab-bar").getBoundingClientRect();+ let html;if (type === "config") {html = getConfigHTML(data, tabRect);} else if (type === "properties") {@@ -51,8 +51,8 @@ export const openMenuPanel = (protyle: IProtyle, blockElement: HTMLElement, typeevent.stopPropagation();break;} else if (type === "showAllCol") {- const doOperations: IOperation[] = []- const undoOperations: IOperation[] = []+ const doOperations: IOperation[] = [];+ const undoOperations: IOperation[] = [];data.columns.forEach((item: IAVColumn) => {if (item.hidden) {doOperations.push({@@ -60,16 +60,16 @@ export const openMenuPanel = (protyle: IProtyle, blockElement: HTMLElement, typeid: item.id,parentID: avId,data: false- })+ });undoOperations.push({action: "setAttrViewColHidden",id: item.id,parentID: avId,data: true- })- item.hidden = false+ });+ item.hidden = false;}- })+ });if (doOperations.length > 0) {transaction(protyle, doOperations, undoOperations);avMenuPanel.innerHTML = getPropertiesHTML(data, tabRect);@@ -77,8 +77,8 @@ export const openMenuPanel = (protyle: IProtyle, blockElement: HTMLElement, typeevent.stopPropagation();break;} else if (type === "hideAllCol") {- const doOperations: IOperation[] = []- const undoOperations: IOperation[] = []+ const doOperations: IOperation[] = [];+ const undoOperations: IOperation[] = [];data.columns.forEach((item: IAVColumn) => {if (!item.hidden && item.type !== "block") {doOperations.push({@@ -86,16 +86,16 @@ export const openMenuPanel = (protyle: IProtyle, blockElement: HTMLElement, typeid: item.id,parentID: avId,data: true- })+ });undoOperations.push({action: "setAttrViewColHidden",id: item.id,parentID: avId,data: false- })- item.hidden = true+ });+ item.hidden = true;}- })+ });if (doOperations.length > 0) {transaction(protyle, doOperations, undoOperations);avMenuPanel.innerHTML = getPropertiesHTML(data, tabRect);@@ -141,7 +141,7 @@ export const openMenuPanel = (protyle: IProtyle, blockElement: HTMLElement, type}});});-}+};const getConfigHTML = (data: IAV, tabRect: DOMRect) => {return `<div class="b3-dialog__scrim" data-type="close"></div>@@ -175,8 +175,8 @@ const getConfigHTML = (data: IAV, tabRect: DOMRect) => {<span class="b3-menu__accelerator">50</span><svg class="b3-menu__icon b3-menu__icon--arrow"><use xlink:href="#iconRight"></use></svg></button>-</div>`-}+</div>`;+};const getPropertiesHTML = (data: IAV, tabRect: DOMRect) => {let showHTML = "";@@ -187,13 +187,13 @@ const getPropertiesHTML = (data: IAV, tabRect: DOMRect) => {<svg class="b3-menu__icon"><use xlink:href="#${getColIconByType(item.type)}"></use></svg><span class="b3-menu__label">${item.name}</span><svg class="b3-menu__action" data-type="showCol" data-id="${item.id}"><use xlink:href="#iconEyeoff"></use></svg>-</button>`+</button>`;} else {showHTML += `<button class="b3-menu__item"><svg class="b3-menu__icon"><use xlink:href="#${getColIconByType(item.type)}"></use></svg><span class="b3-menu__label">${item.name}</span><svg class="b3-menu__action${item.type === "block" ? " fn__none" : ""}" data-type="hideCol" data-id="${item.id}"><use xlink:href="#iconEye"></use></svg>-</button>`+</button>`;}});if (hideHTML) {@@ -235,5 +235,5 @@ ${hideHTML}`;<svg class="b3-menu__icon"><use xlink:href="#iconAdd"></use></svg><span class="b3-menu__label">${window.siyuan.languages.new}</span></button>-</div>`-}+</div>`;+};diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.tsindex 3952a4dbc6..59a06b88b0 100644--- a/app/src/protyle/render/av/render.ts+++ b/app/src/protyle/render/av/render.ts@@ -129,11 +129,11 @@ ${cell.color ? `color:${cell.color};` : ""}"><span class="av__celltext">${text}<}};-let lastParentID: string-let lastElement: HTMLElement+let lastParentID: string;+let lastElement: HTMLElement;export const refreshAV = (protyle: IProtyle, operation: IOperation) => {if (lastParentID === operation.parentID && protyle.contentElement.isSameNode(lastElement)) {- return+ return;}lastElement = protyle.contentElement;lastParentID = operation.parentID;@@ -148,12 +148,12 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.parentID}"]`)).forEach((item: HTMLElement) => {const cellElement = item.querySelector(`.av__cell[data-id="${operation.id}"]`) as HTMLElement;if (!cellElement || cellElement.style.width === operation.data) {- return+ return;}const index = cellElement.dataset.index;item.querySelectorAll(".av__row").forEach(rowItem => {(rowItem.querySelector(`[data-index="${index}"]`) as HTMLElement).style.width = operation.data;- })+ });});} else {Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.parentID}"]`)).forEach((item: HTMLElement) => {diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.tsindex 9bb24348f5..27df812806 100644--- a/app/src/protyle/util/editorCommonEvent.ts+++ b/app/src/protyle/util/editorCommonEvent.ts@@ -723,13 +723,13 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {return;}const rowElement = target.parentElement;- const selectIds = []+ const selectIds = [];if (rowElement.classList.contains("av__row--select")) {rowElement.parentElement.querySelectorAll(".av__row--select:not(.av__row--header)").forEach((item) => {- selectIds.push(item.getAttribute("data-id"))- })+ selectIds.push(item.getAttribute("data-id"));+ });} else {- selectIds.push(rowElement.getAttribute("data-id"))+ selectIds.push(rowElement.getAttribute("data-id"));}if (selectIds.length === 1) {event.dataTransfer.setDragImage(rowElement, 0, 0);@@ -823,7 +823,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {if (!blockElement) {return;}- const avId = blockElement.getAttribute("data-av-id")+ const avId = blockElement.getAttribute("data-av-id");transaction(protyle, [{action: "sortAttrViewCol",parentID: avId,@@ -849,7 +849,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {} else {previousID = targetElement.previousElementSibling?.getAttribute("data-id") || "";}- const avId = blockElement.getAttribute("data-av-id")+ const avId = blockElement.getAttribute("data-av-id");if (gutterTypes[0] === "nodeattributeview" && gutterTypes[1] === "row") {// 行内拖拽const doOperations: IOperation[] = [];@@ -861,13 +861,13 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {parentID: avId,previousID,id: item,- })+ });undoOperations.push({action: "sortAttrViewRow",parentID: avId,previousID: undoPreviousId,id: item,- })+ });});transaction(protyle, doOperations, undoOperations);} else {diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex fa48de7a6b..3e8c13190a 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -356,12 +356,12 @@ export class WYSIWYG {const dragElement = target.parentElement;const oldWidth = dragElement.clientWidth;const dragIndex = dragElement.getAttribute("data-index");- let newWidth: string+ let newWidth: string;documentSelf.onmousemove = (moveEvent: MouseEvent) => {newWidth = oldWidth + (moveEvent.clientX - event.clientX) + "px";dragElement.parentElement.parentElement.querySelectorAll(".av__row").forEach(item => {(item.querySelector(`[data-index="${dragIndex}"]`) as HTMLElement).style.width = newWidth;- })+ });};documentSelf.onmouseup = () => {