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:
Vanessaaf35b8ba576c
diff --git a/app/src/asset/anno.ts b/app/src/asset/anno.tsindex a8a405f5b2..5400de0ea7 100644--- a/app/src/asset/anno.ts+++ b/app/src/asset/anno.ts@@ -6,7 +6,6 @@ import {setStorageVal, writeText} from "../protyle/util/compatibility";import {getAllModels} from "../layout/getAll";import {focusByRange} from "../protyle/util/selection";import {Constants} from "../constants";-import {showMessage} from "../dialog/message";export const initAnno = (element: HTMLElement, pdf: any, pdfConfig: any) => {getConfig(pdf);diff --git a/app/src/asset/index.ts b/app/src/asset/index.tsindex 7152712279..7ca8d95412 100644--- a/app/src/asset/index.ts+++ b/app/src/asset/index.ts@@ -14,7 +14,6 @@ import {webViewerPageNumberChanged} from "./pdf/app";import {fetchPost} from "../util/fetch";import {setStorageVal, updateHotkeyTip} from "../protyle/util/compatibility";import {App} from "../index";-import {showMessage} from "../dialog/message";export class Asset extends Model {public path: string;diff --git a/app/src/config/bazaar.ts b/app/src/config/bazaar.tsindex f62b3b5604..e0aa58c095 100644--- a/app/src/config/bazaar.ts+++ b/app/src/config/bazaar.ts@@ -309,11 +309,11 @@ export const bazaar = {if (["icons", "themes"].includes(bazaarType)) {showSwitch = true;}- const counterElement = contentElement.parentElement.querySelector(".counter")+ const counterElement = contentElement.parentElement.querySelector(".counter");if (response.data.packages.length === 0) {- counterElement.classList.add("fn__none")+ counterElement.classList.add("fn__none");} else {- counterElement.classList.remove("fn__none")+ counterElement.classList.remove("fn__none");counterElement.textContent = response.data.packages.length;response.data.packages.forEach((item: IBazaarItem) => {const dataObj = {diff --git a/app/src/editor/util.ts b/app/src/editor/util.tsindex d9ff6bcaf8..9ff8c385cf 100644--- a/app/src/editor/util.ts+++ b/app/src/editor/util.ts@@ -19,7 +19,6 @@ import {pushBack} from "../util/backForward";import {Asset} from "../asset";import {Layout} from "../layout";import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName,} from "../protyle/util/hasClosest";-import {setTitle} from "../dialog/processSystem";import {zoomOut} from "../menus/protyle";import {countBlockWord, countSelectWord} from "../layout/status";import {showMessage} from "../dialog/message";diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.tsindex b5a4649ccb..1ff7a8f67e 100644--- a/app/src/protyle/gutter/index.ts+++ b/app/src/protyle/gutter/index.ts@@ -1616,7 +1616,7 @@ export class Gutter {click: () => {this.genClick(nodeElements, protyle, (e: HTMLElement) => {if (e.classList.contains("av")) {- e.style.margin = ""+ e.style.margin = "";resizeAV(e);} else {e.style.textAlign = "left";diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.tsindex 92b8e87d13..7455e66ddd 100644--- a/app/src/protyle/render/av/action.ts+++ b/app/src/protyle/render/av/action.ts@@ -65,7 +65,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEleconst gutterElement = hasClosestByClassName(event.target, "av__gutters");if (gutterElement) {- const gutterRect = gutterElement.getBoundingClientRect()+ const gutterRect = gutterElement.getBoundingClientRect();avContextmenu(protyle, gutterElement.parentElement, {x: gutterRect.left,y: gutterRect.bottom,@@ -262,7 +262,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positiicon: "iconTrashcan",label: window.siyuan.languages.delete,click() {- const avID = blockElement.getAttribute("data-av-id")+ const avID = blockElement.getAttribute("data-av-id");const undoOperations: IOperation[] = [];rowElements.forEach(item => {undoOperations.push({@@ -271,8 +271,8 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positipreviousID: item.previousElementSibling?.getAttribute("data-id") || "",srcIDs: [item.getAttribute("data-id")],isDetached: item.querySelector('.av__cell[data-detached="true"]') ? true : false,- })- })+ });+ });transaction(protyle, [{action: "removeAttrViewBlock",srcIDs: blockIds,@@ -349,7 +349,7 @@ export const updateAVName = (protyle: IProtyle, blockElement: Element) => {if (newData === nameElement.dataset.title.trim()) {return;}- const newUpdated = dayjs().format("YYYYMMDDHHmmss")+ const newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "setAttrViewName",id: avId,diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.tsindex bd737e7a10..268b6cfd31 100644--- a/app/src/protyle/render/av/cell.ts+++ b/app/src/protyle/render/av/cell.ts@@ -355,7 +355,7 @@ export const cellScrollIntoView = (blockElement: HTMLElement, cellRect: DOMRect,avScrollElement.scrollLeft = avScrollElement.scrollLeft + cellRect.right - avScrollRect.right;}}- const avHeaderRect = blockElement.querySelector(".av__header").getBoundingClientRect()+ const avHeaderRect = blockElement.querySelector(".av__header").getBoundingClientRect();if (avHeaderRect.bottom > cellRect.top) {const contentElement = hasClosestByClassName(blockElement, "protyle-content", true);if (contentElement) {@@ -370,7 +370,7 @@ export const cellScrollIntoView = (blockElement: HTMLElement, cellRect: DOMRect,}}}-}+};export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type?: TAVCol) => {if (!type) {@@ -385,7 +385,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], typeconst blockElement = hasClosestBlock(cellElements[0]);let cellRect = cellElements[0].getBoundingClientRect();if (blockElement) {- cellScrollIntoView(blockElement, cellRect)+ cellScrollIntoView(blockElement, cellRect);}cellRect = cellElements[0].getBoundingClientRect();let html = "";diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.tsindex 3f01244689..7f7b2e21ce 100644--- a/app/src/protyle/render/av/col.ts+++ b/app/src/protyle/render/av/col.ts@@ -1,4 +1,3 @@-import {hasClosestBlock} from "../../util/hasClosest";import {Menu} from "../../../plugin/Menu";import {transaction} from "../../wysiwyg/transaction";import {fetchPost} from "../../../util/fetch";diff --git a/app/src/protyle/render/av/keydown.ts b/app/src/protyle/render/av/keydown.tsindex cfd2be3464..2557737ff7 100644--- a/app/src/protyle/render/av/keydown.ts+++ b/app/src/protyle/render/av/keydown.ts@@ -28,13 +28,13 @@ export const avKeydown = (event: KeyboardEvent, nodeElement: HTMLElement, protylevent.preventDefault();return true;}- let newCellElement+ let newCellElement;if (event.key === "ArrowLeft") {- const previousRowElement = selectCellElement.parentElement.previousElementSibling+ const previousRowElement = selectCellElement.parentElement.previousElementSibling;if (selectCellElement.previousElementSibling && selectCellElement.previousElementSibling.classList.contains("av__cell")) {- newCellElement = selectCellElement.previousElementSibling+ newCellElement = selectCellElement.previousElementSibling;} else if (previousRowElement && !previousRowElement.classList.contains("av__row--header")) {- newCellElement = previousRowElement.lastElementChild.previousElementSibling+ newCellElement = previousRowElement.lastElementChild.previousElementSibling;}if (newCellElement) {selectCellElement.classList.remove("av__cell--select");@@ -45,11 +45,11 @@ export const avKeydown = (event: KeyboardEvent, nodeElement: HTMLElement, protylreturn true;}if (event.key === "ArrowRight") {- const nextRowElement = selectCellElement.parentElement.nextElementSibling+ const nextRowElement = selectCellElement.parentElement.nextElementSibling;if (selectCellElement.nextElementSibling && selectCellElement.nextElementSibling.classList.contains("av__cell")) {- newCellElement = selectCellElement.nextElementSibling+ newCellElement = selectCellElement.nextElementSibling;} else if (nextRowElement && !nextRowElement.classList.contains("av__row--footer")) {- newCellElement = nextRowElement.querySelector(".av__cell")+ newCellElement = nextRowElement.querySelector(".av__cell");}if (newCellElement) {selectCellElement.classList.remove("av__cell--select");@@ -60,9 +60,9 @@ export const avKeydown = (event: KeyboardEvent, nodeElement: HTMLElement, protylreturn true;}if (event.key === "ArrowUp") {- const previousRowElement = selectCellElement.parentElement.previousElementSibling+ const previousRowElement = selectCellElement.parentElement.previousElementSibling;if (previousRowElement && !previousRowElement.classList.contains("av__row--header")) {- newCellElement = previousRowElement.querySelector(`.av__cell[data-col-id="${selectCellElement.dataset.colId}"]`)+ newCellElement = previousRowElement.querySelector(`.av__cell[data-col-id="${selectCellElement.dataset.colId}"]`);}if (newCellElement) {selectCellElement.classList.remove("av__cell--select");@@ -73,9 +73,9 @@ export const avKeydown = (event: KeyboardEvent, nodeElement: HTMLElement, protylreturn true;}if (event.key === "ArrowDown") {- const nextRowElement = selectCellElement.parentElement.nextElementSibling+ const nextRowElement = selectCellElement.parentElement.nextElementSibling;if (nextRowElement && !nextRowElement.classList.contains("av__row--footer")) {- newCellElement = nextRowElement.querySelector(`.av__cell[data-col-id="${selectCellElement.dataset.colId}"]`)+ newCellElement = nextRowElement.querySelector(`.av__cell[data-col-id="${selectCellElement.dataset.colId}"]`);}if (newCellElement) {selectCellElement.classList.remove("av__cell--select");@@ -111,30 +111,30 @@ export const avKeydown = (event: KeyboardEvent, nodeElement: HTMLElement, protyl}// TODO event.shiftKeyif (event.key === "ArrowUp") {- const previousRowElement = selectRowElements[0].previousElementSibling+ const previousRowElement = selectRowElements[0].previousElementSibling;selectRow(selectRowElements[0].querySelector(".av__firstcol"), "unselectAll");if (previousRowElement && !previousRowElement.classList.contains("av__row--header")) {selectRow(previousRowElement.querySelector(".av__firstcol"), "select");cellScrollIntoView(nodeElement, previousRowElement.getBoundingClientRect(), true);} else {- nodeElement.classList.add("protyle-wysiwyg--select")+ nodeElement.classList.add("protyle-wysiwyg--select");}event.preventDefault();return true;}if (event.key === "ArrowDown") {- const nextRowElement = selectRowElements[selectRowElements.length - 1].nextElementSibling+ const nextRowElement = selectRowElements[selectRowElements.length - 1].nextElementSibling;selectRow(selectRowElements[0].querySelector(".av__firstcol"), "unselectAll");if (nextRowElement && !nextRowElement.classList.contains("av__row--add")) {selectRow(nextRowElement.querySelector(".av__firstcol"), "select");cellScrollIntoView(nodeElement, nextRowElement.getBoundingClientRect(), true);} else {- nodeElement.classList.add("protyle-wysiwyg--select")+ nodeElement.classList.add("protyle-wysiwyg--select");}event.preventDefault();return true;}}return false;-}+};diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.tsindex 74bc8d98f6..46b2bb4465 100644--- a/app/src/protyle/render/av/render.ts+++ b/app/src/protyle/render/av/render.ts@@ -219,7 +219,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;if (newCellElement) {newCellElement.classList.add("av__cell--select");}- focusBlock(e)+ focusBlock(e);}if (cb) {cb();diff --git a/app/src/protyle/render/av/row.ts b/app/src/protyle/render/av/row.tsindex 2d246deec6..12163d375b 100644--- a/app/src/protyle/render/av/row.ts+++ b/app/src/protyle/render/av/row.ts@@ -27,7 +27,7 @@ export const selectRow = (checkElement: Element, type: "toggle" | "select" | "un}focusBlock(hasClosestBlock(rowElement) as HTMLElement);updateHeader(rowElement);-}+};export const updateHeader = (rowElement: HTMLElement) => {const blockElement = hasClosestBlock(rowElement);diff --git a/app/src/protyle/toolbar/Link.ts b/app/src/protyle/toolbar/Link.tsindex 294cf2daaf..93ae0ee886 100644--- a/app/src/protyle/toolbar/Link.ts+++ b/app/src/protyle/toolbar/Link.ts@@ -1,7 +1,6 @@import {ToolbarItem} from "./ToolbarItem";import {linkMenu} from "../../menus/protyle";import {hasClosestBlock, hasClosestByAttribute} from "../util/hasClosest";-import {focusByRange, focusByWbr} from "../util/selection";import {readText} from "../util/compatibility";import {Constants} from "../../constants";diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.tsindex 6c85acdad3..270af7ba7e 100644--- a/app/src/protyle/util/onGet.ts+++ b/app/src/protyle/util/onGet.ts@@ -1,4 +1,3 @@-import {setTitle} from "../../dialog/processSystem";import {Constants} from "../../constants";import {hideElements} from "../ui/hideElements";import {fetchPost} from "../../util/fetch";diff --git a/app/src/protyle/util/resize.ts b/app/src/protyle/util/resize.tsindex 79c2da1c07..67b0e91d51 100644--- a/app/src/protyle/util/resize.ts+++ b/app/src/protyle/util/resize.ts@@ -52,7 +52,7 @@ export const resize = (protyle: IProtyle) => {export const resizeAV = (item: HTMLElement) => {if (!item.classList.contains("av") || item.getAttribute("data-render") !== "true") {- return+ return;}if (item.style.width.endsWith("%") || item.style.margin) {const avHeaderElement = item.firstElementChild.firstElementChild as HTMLElement;@@ -63,7 +63,7 @@ export const resizeAV = (item: HTMLElement) => {avBodyElement.style.paddingRight = "";item.style.alignSelf = "";if (!item.style.width.endsWith("%")) {- item.style.width = ""+ item.style.width = "";item.style.maxWidth = "100%";}} else {@@ -81,4 +81,4 @@ export const resizeAV = (item: HTMLElement) => {item.style.maxWidth = "";}}-}+};diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex c15c16aa21..80b1ead9cf 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -1341,7 +1341,7 @@ export class WYSIWYG {}const nodeElement = hasClosestBlock(target);- const avRowElement = hasClosestByClassName(target, "av__row")+ const avRowElement = hasClosestByClassName(target, "av__row");if (avRowElement && avContextmenu(protyle, avRowElement, {x: event.clientX,y: avRowElement.getBoundingClientRect().bottom,diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex 3e67899350..c49276b0ee 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -1176,7 +1176,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {}updateBatchTransaction(selectElements, protyle, (e: HTMLElement) => {if (e.classList.contains("av")) {- e.style.margin = ""+ e.style.margin = "";resizeAV(e);} else {e.style.textAlign = "left";@@ -1198,7 +1198,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {}updateBatchTransaction(selectElements, protyle, (e: HTMLElement) => {if (e.classList.contains("av")) {- e.style.margin = "0 auto"+ e.style.margin = "0 auto";resizeAV(e);} else {e.style.textAlign = "center";diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex 886d09d375..b5c798492f 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -716,7 +716,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:} else if (operation.action === "doUpdateUpdated") {updateElements.forEach(item => {item.setAttribute("updated", operation.data);- })+ });}};