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:
Vanessa2e1394a01bc6
diff --git a/app/src/protyle/export/util.ts b/app/src/protyle/export/util.tsindex 70cc16284f..b047bef807 100644--- a/app/src/protyle/export/util.ts+++ b/app/src/protyle/export/util.ts@@ -111,18 +111,18 @@ export const exportImage = (id: string) => {watermarkPreviewElement.innerHTML = window.siyuan.config.export.imageWatermarkDesc;} else if (window.siyuan.config.export.imageWatermarkStr) {if (window.siyuan.config.export.imageWatermarkStr.startsWith("http")) {- watermarkPreviewElement.setAttribute("style", `background-image: url(${window.siyuan.config.export.imageWatermarkStr});background-repeat: repeat;position: absolute;top: 0;left: 0;width: 100%;height: 100%;border-radius: var(--b3-border-radius-b);`)+ watermarkPreviewElement.setAttribute("style", `background-image: url(${window.siyuan.config.export.imageWatermarkStr});background-repeat: repeat;position: absolute;top: 0;left: 0;width: 100%;height: 100%;border-radius: var(--b3-border-radius-b);`);} else {addScript("/stage/protyle/js/html2canvas.min.js?v=1.4.1", "protyleHtml2canvas").then(() => {- const width = Math.max(exportDialog.element.querySelector('.export-img').clientWidth / 3, 150);- watermarkPreviewElement.setAttribute("style", `width: ${width}px;height: ${width}px;display: flex;justify-content: center;align-items: center;color: var(--b3-border-color);font-size: 14px;`)+ const width = Math.max(exportDialog.element.querySelector(".export-img").clientWidth / 3, 150);+ watermarkPreviewElement.setAttribute("style", `width: ${width}px;height: ${width}px;display: flex;justify-content: center;align-items: center;color: var(--b3-border-color);font-size: 14px;`);watermarkPreviewElement.innerHTML = `<div style="transform: rotate(-45deg)">${window.siyuan.config.export.imageWatermarkStr}</div>`;window.html2canvas(watermarkPreviewElement, {useCORS: true,scale: 1,}).then((canvas) => {watermarkPreviewElement.innerHTML = "";- watermarkPreviewElement.setAttribute("style", `background-image: url(${canvas.toDataURL("image/png")});background-repeat: repeat;position: absolute;top: 0;left: 0;width: 100%;height: 100%;border-radius: var(--b3-border-radius-b);`)+ watermarkPreviewElement.setAttribute("style", `background-image: url(${canvas.toDataURL("image/png")});background-repeat: repeat;position: absolute;top: 0;left: 0;width: 100%;height: 100%;border-radius: var(--b3-border-radius-b);`);});});}@@ -130,7 +130,7 @@ export const exportImage = (id: string) => {} else {watermarkPreviewElement.removeAttribute("style");}- }+ };const refreshPreview = (response: IWebSocketData) => {previewElement.innerHTML = response.data.content;// https://github.com/siyuan-note/siyuan/issues/9685diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.tsindex c8c453b249..51d39cb04a 100644--- a/app/src/protyle/render/av/asset.ts+++ b/app/src/protyle/render/av/asset.ts@@ -125,7 +125,7 @@ export const updateAssetCell = (options: {}const cellValue = genCellValueByElement(getTypeByCellElement(item) || item.dataset.type as TAVCol, item);const rowID = (hasClosestByClassName(item, "av__row") as HTMLElement).dataset.id;- const oldValue = JSON.parse(JSON.stringify(cellValue))+ const oldValue = JSON.parse(JSON.stringify(cellValue));if (elementIndex === 0) {if (options.type === "remove") {cellValue.mAsset.find((oldItem, index) => {@@ -317,7 +317,7 @@ export const addAssetLink = (protyle: IProtyle, data: IAV, cellElements: HTMLEle});};-export const dragUpload = (files: string[], protyle: IProtyle, cellElement: HTMLElement, avID: string, blockElement: Element) => {+export const dragUpload = (files: string[], protyle: IProtyle, cellElement: HTMLElement, avID: string) => {const msgId = showMessage(window.siyuan.languages.uploading, 0);fetchPost("/api/asset/insertLocalAssets", {assetPaths: files,diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.tsindex d05d475ec0..0810e95353 100644--- a/app/src/protyle/render/av/cell.ts+++ b/app/src/protyle/render/av/cell.ts@@ -56,7 +56,7 @@ export const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement)});cellValue.mSelect = mSelect;} else if (["date", "created", "updated"].includes(colType)) {- cellValue[colType as "date"] = JSON.parse(cellElement.querySelector(".av__celltext").getAttribute("data-value"))+ cellValue[colType as "date"] = JSON.parse(cellElement.querySelector(".av__celltext").getAttribute("data-value"));} else if (colType === "checkbox") {cellValue.checkbox = {checked: cellElement.querySelector("use").getAttribute("xlink:href") === "#iconCheck" ? true : false@@ -67,16 +67,16 @@ export const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement)contents: Array.from(cellElement.querySelectorAll("span")).map((item: HTMLElement) => item.textContent),};} else if (colType === "mAsset") {- const mAsset: IAVCellAssetValue[] = []+ const mAsset: IAVCellAssetValue[] = [];Array.from(cellElement.children).forEach((item) => {- const isImg = item.classList.contains("av__cellassetimg")+ const isImg = item.classList.contains("av__cellassetimg");mAsset.push({type: isImg ? "image" : "file",content: isImg ? item.getAttribute("src") : item.getAttribute("data-url"),name: isImg ? "" : item.textContent- })- })- cellValue.mAsset = mAsset+ });+ });+ cellValue.mAsset = mAsset;}if (colType === "block") {cellValue.isDetached = cellElement.dataset.detached === "true";@@ -313,7 +313,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], typeevent.preventDefault();event.stopPropagation();}- })+ });}inputElement.addEventListener("keydown", (event) => {if (event.isComposing) {diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.tsindex 25477d5808..a053a1d937 100644--- a/app/src/protyle/render/av/openMenuPanel.ts+++ b/app/src/protyle/render/av/openMenuPanel.ts@@ -894,7 +894,7 @@ export const openMenuPanel = (options: {break;} else if (type === "removeCol") {const colId = menuElement.querySelector(".b3-menu__item").getAttribute("data-col-id");- let previousID: string+ let previousID: string;const colData = data.view.columns.find((item: IAVColumn, index) => {if (item.id === colId) {previousID = data.view.columns[index - 1]?.id;diff --git a/app/src/protyle/render/av/rollup.ts b/app/src/protyle/render/av/rollup.tsindex d37843ade7..8447310f09 100644--- a/app/src/protyle/render/av/rollup.ts+++ b/app/src/protyle/render/av/rollup.ts@@ -13,7 +13,7 @@ const updateCol = (protyle: IProtyle, data: IAV, colId: string, itemElement: HTMif (item.id === colId) {return true;}- })+ });transaction(protyle, [{action: "updateAttrViewColRollup",id: colId,@@ -28,8 +28,8 @@ const updateCol = (protyle: IProtyle, data: IAV, colId: string, itemElement: HTM// operation.ParentID 汇总列基于的关联列 ID// operation.KeyID 目标列 ID// operation.Data 计算方式- }])-}+ }]);+};const genSearchList = (element: Element, keyword: string, avId: string, cb?: () => void) => {fetchPost("/api/av/searchAttributeViewRelationKey", {@@ -115,8 +115,8 @@ export const goSearchRollupCol = (options: {export const goSearchRollupTarget = (avId: string, target: HTMLElement) => {-}+};export const goSearchRollupCalc = (avId: string, target: HTMLElement) => {-}+};diff --git a/app/src/protyle/render/av/select.ts b/app/src/protyle/render/av/select.tsindex b06da6ea2b..a5ccef810f 100644--- a/app/src/protyle/render/av/select.ts+++ b/app/src/protyle/render/av/select.ts@@ -500,7 +500,7 @@ export const addColOptionOrCell = (protyle: IProtyle, data: IAV, cellElements: H});return true;}- })+ });if (item.classList.contains("custom-attr__avvalue")) {item.innerHTML = genAVValueHTML(cellValue);} else {diff --git a/app/src/protyle/upload/index.ts b/app/src/protyle/upload/index.tsindex 79c7e35f13..080f9de62e 100644--- a/app/src/protyle/upload/index.ts+++ b/app/src/protyle/upload/index.ts@@ -125,12 +125,12 @@ const genUploadedLabel = (responseText: string, protyle: IProtyle) => {const path = response.data.succMap[key];const type = pathPosix().extname(key).toLowerCase();const filename = protyle.options.upload.filename(key);- const name = filename.substring(0, filename.length - type.length)+ const name = filename.substring(0, filename.length - type.length);avAssets.push({type: Constants.SIYUAN_ASSETS_IMAGE.includes(type) ? "image" : "file",content: path,name: name- })+ });succFileText += genAssetHTML(type, path, name, filename);if (!Constants.SIYUAN_ASSETS_AUDIO.includes(type) && !Constants.SIYUAN_ASSETS_VIDEO.includes(type) &&keys.length - 1 !== index) {@@ -146,7 +146,7 @@ const genUploadedLabel = (responseText: string, protyle: IProtyle) => {if ((nodeElement && nodeElement.classList.contains("av"))) {updateCellsValue(protyle, nodeElement, avAssets);document.querySelector(".av__panel")?.remove();- return+ return;}if (document.querySelector(".av__panel")) {const blockElement = hasClosestBlock(protyle.wysiwyg.element.querySelector(".av__cell--select"));diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.tsindex 5a7bdcc922..362a5871d9 100644--- a/app/src/protyle/util/editorCommonEvent.ts+++ b/app/src/protyle/util/editorCommonEvent.ts@@ -1016,7 +1016,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {for (let i = 0; i < event.dataTransfer.files.length; i++) {files.push(event.dataTransfer.files[i].path);}- dragUpload(files, protyle, cellElement, avElement.dataset.avId, avElement);+ dragUpload(files, protyle, cellElement, avElement.dataset.avId);}}}