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:
Vanessa8c3676468618
diff --git a/app/src/ai/actions.ts b/app/src/ai/actions.tsindex a906cb0868..abc46a4a68 100644--- a/app/src/ai/actions.ts+++ b/app/src/ai/actions.ts@@ -251,7 +251,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {let target = event.target as HTMLElement;while (target && !target.isSameNode(element)) {if (target.classList.contains("b3-list-item__action")) {- const subItem = window.siyuan.storage[Constants.LOCAL_AI][target.parentElement.dataset.index]+ const subItem = window.siyuan.storage[Constants.LOCAL_AI][target.parentElement.dataset.index];editDialog(subItem.name, subItem.memo);menu.close();event.stopPropagation();diff --git a/app/src/block/popover.ts b/app/src/block/popover.tsindex da21bf9b4a..b0b86ba371 100644--- a/app/src/block/popover.ts+++ b/app/src/block/popover.ts@@ -139,7 +139,7 @@ export const initBlockPopover = (app: App) => {const hidePopover = (event: MouseEvent & { path: HTMLElement[] }) => {// pad 端点击后 event.target 不会更新。- const target = isTouchDevice() ? document.elementFromPoint(event.clientX, event.clientY) : event.target as HTMLElement+ const target = isTouchDevice() ? document.elementFromPoint(event.clientX, event.clientY) : event.target as HTMLElement;if (!target) {return false;}diff --git a/app/src/card/openCard.ts b/app/src/card/openCard.tsindex b10998479e..85521920fe 100644--- a/app/src/card/openCard.ts+++ b/app/src/card/openCard.ts@@ -673,7 +673,7 @@ const emitEvent = (app: App, card: ICard, type: string) => {export const openCard = (app: App) => {if (window.siyuan.config.readonly) {- return+ return;}fetchPost("/api/riff/getRiffDueCards", {deckID: ""}, (cardsResponse) => {openCardByData(app, cardsResponse.data, "all");diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.tsindex 1f07b3ff6c..38d69002c3 100644--- a/app/src/dialog/processSystem.ts+++ b/app/src/dialog/processSystem.ts@@ -295,10 +295,10 @@ export const refreshFileTree = (cb?: () => void) => {setStorageVal(Constants.LOCAL_FILEPOSITION, window.siyuan.storage[Constants.LOCAL_FILEPOSITION]);fetchPost("/api/filetree/refreshFiletree", {}, () => {if (cb) {- cb()+ cb();}});-}+};let statusTimeout: number;export const progressStatus = (data: IWebSocketData) => {diff --git a/app/src/editor/rename.ts b/app/src/editor/rename.tsindex 392e44d10d..edf6fb8c00 100644--- a/app/src/editor/rename.ts+++ b/app/src/editor/rename.ts@@ -139,10 +139,10 @@ export const renameAsset = (assetPath: string) => {if (item.path === assetPath) {item.parent.updateTitle(getDisplayName(response.data.newPath));}- })+ });getAllEditor().forEach(item => {item.reload(false);- })+ });});});};diff --git a/app/src/emoji/index.ts b/app/src/emoji/index.tsindex 82b7962fff..2579d0935a 100644--- a/app/src/emoji/index.ts+++ b/app/src/emoji/index.ts@@ -518,7 +518,7 @@ export const getEmojiDesc = (emoji: IEmojiItem) => {return emoji.description_ja_jp;}return emoji.description;-}+};export const getEmojiTitle = (index: number) => {diff --git a/app/src/layout/dock/Graph.ts b/app/src/layout/dock/Graph.tsindex 3d88744857..95c1f94b6d 100644--- a/app/src/layout/dock/Graph.ts+++ b/app/src/layout/dock/Graph.ts@@ -322,11 +322,11 @@ export class Graph extends Model {this.searchGraph(false, undefined, true);} else if (dataType === "fullscreen") {fullscreen(this.element, target);- const minElement = this.element.querySelector('.block__icons .block__icon[data-type="min"]')+ const minElement = this.element.querySelector('.block__icons .block__icon[data-type="min"]');if (this.element.className.includes("fullscreen")) {- minElement.classList.add("fn__none")+ minElement.classList.add("fn__none");} else {- minElement.classList.remove("fn__none")+ minElement.classList.remove("fn__none");}}break;diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.tsindex 35c3156d56..aa727f25fc 100644--- a/app/src/layout/dock/Outline.ts+++ b/app/src/layout/dock/Outline.ts@@ -379,7 +379,7 @@ export class Outline extends Model {if ((item.action === "update" || item.action === "insert") &&(item.data.indexOf('data-type="NodeHeading"') > -1 || item.data.indexOf(`<div contenteditable="true" spellcheck="${window.siyuan.config.editor.spellcheck}"><wbr></div>`) > -1)) {needReload = true;- return true+ return true;} else if (item.action === "delete" || item.action === "move") {needReload = true;return true;diff --git a/app/src/layout/dock/index.ts b/app/src/layout/dock/index.tsindex a815c2cbe6..1395891494 100644--- a/app/src/layout/dock/index.ts+++ b/app/src/layout/dock/index.ts@@ -455,7 +455,7 @@ export class Dock {return;}// 关系图全屏不应该退出 & https://github.com/siyuan-note/siyuan/issues/11775- const fullscreenElement = this.layout.element.querySelector(".fullscreen")+ const fullscreenElement = this.layout.element.querySelector(".fullscreen");if (fullscreenElement && fullscreenElement.clientHeight > 0) {return;}diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex bad0afb1f7..501997ca5b 100644--- a/app/src/menus/protyle.ts+++ b/app/src/menus/protyle.ts@@ -654,7 +654,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {protyle.toolbar.showContent(protyle, range, nodeElement);/// #elseconst oldHTML = nodeElement.outerHTML;- const id = nodeElement.getAttribute("data-node-id")+ const id = nodeElement.getAttribute("data-node-id");if (range.toString() !== "" || (range.cloneContents().childNodes[0] as HTMLElement)?.classList?.contains("emoji")) {window.siyuan.menus.menu.append(new MenuItem({icon: "iconCopy",@@ -1632,7 +1632,7 @@ export const inlineMathMenu = (protyle: IProtyle, element: Element) => {y: rect.top + 26,h: 26});-}+};const genImageWidthMenu = (label: string, assetElement: HTMLElement, imgElement: HTMLElement, protyle: IProtyle, id: string, nodeElement: HTMLElement, html: string) => {return {@@ -1874,7 +1874,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:}});const menus: IMenu[] = [];- menus.push(...otherMenus)+ menus.push(...otherMenus);menus.push({type: "separator"});@@ -1950,7 +1950,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:return true;}});- const insertMenus = []+ const insertMenus = [];insertMenus.push({icon: "iconBefore",label: window.siyuan.languages.insertRowAbove,@@ -1989,8 +1989,8 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:}});}- menus.push(...insertMenus)- const other2Menus: IMenu[] = []+ menus.push(...insertMenus);+ const other2Menus: IMenu[] = [];if (((!hasNone || (hasNone && !hasRowSpan && hasColSpan)) &&(!previousHasNone || (previousHasNone && !previousHasRowSpan && previousHasColSpan))) ||((!hasNone || (hasNone && !hasRowSpan && hasColSpan)) &&@@ -2052,7 +2052,7 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:type: "separator"});}- const removeMenus = []+ const removeMenus = [];if (cellElement.parentElement.parentElement.tagName !== "THEAD" &&((!hasNone && !hasRowSpan) || (hasNone && !hasRowSpan && hasColSpan))) {removeMenus.push({diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.tsindex 9bde8c1556..83cb2afbe1 100644--- a/app/src/protyle/gutter/index.ts+++ b/app/src/protyle/gutter/index.ts@@ -23,7 +23,6 @@ import {focusBlock, focusByRange, getEditorRange} from "../util/selection";import {hideElements} from "../ui/hideElements";import {highlightRender} from "../render/highlightRender";import {blockRender} from "../render/blockRender";-import {removeEmbed} from "../wysiwyg/removeEmbed";import {getContenteditableElement, getTopAloneElement, isNotEditBlock} from "../wysiwyg/getBlock";import * as dayjs from "dayjs";import {fetchPost} from "../../util/fetch";@@ -90,24 +89,24 @@ export class Gutter {selectElements.push(item);});} else {- const gutterId = buttonElement.getAttribute("data-node-id")+ const gutterId = buttonElement.getAttribute("data-node-id");selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));let selectedIncludeGutter = false;selectElements.forEach((item => {- const itemId = item.getAttribute("data-node-id")+ const itemId = item.getAttribute("data-node-id");if (itemId === gutterId) {- selectedIncludeGutter = true+ selectedIncludeGutter = true;}selectIds.push(itemId);- }))+ }));if (!selectedIncludeGutter) {- const gutterNodeElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${gutterId}"]`)+ const gutterNodeElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${gutterId}"]`);if (gutterNodeElement) {selectElements.forEach((item => {- item.classList.remove("protyle-wysiwyg--select")+ item.classList.remove("protyle-wysiwyg--select");}));- gutterNodeElement.classList.add("protyle-wysiwyg--select")- selectElements = [gutterNodeElement]+ gutterNodeElement.classList.add("protyle-wysiwyg--select");+ selectElements = [gutterNodeElement];selectIds = [gutterId];}}diff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.tsindex c8dffef784..d006f1d250 100644--- a/app/src/protyle/header/Title.ts+++ b/app/src/protyle/header/Title.ts@@ -115,7 +115,7 @@ export class Title {event.stopPropagation();}} else if (event.key === "Enter") {- const editElment = getContenteditableElement(protyle.wysiwyg.element.firstElementChild)+ const editElment = getContenteditableElement(protyle.wysiwyg.element.firstElementChild);if (editElment && editElment.textContent === "" && !protyle.wysiwyg.element.firstElementChild.classList.contains("av")) {// 配合提示文本使用,避免提示文本挤压到第二个块中focusBlock(protyle.wysiwyg.element.firstElementChild, protyle.wysiwyg.element);diff --git a/app/src/protyle/render/av/row.ts b/app/src/protyle/render/av/row.tsindex 77f24b8457..ae70cabfe4 100644--- a/app/src/protyle/render/av/row.ts+++ b/app/src/protyle/render/av/row.ts@@ -132,7 +132,7 @@ ${getTypeByCellElement(item) === "block" ? ' data-detached="true"' : ""}><span c});let html = "";srcIDs.forEach((id) => {- const blockCellElement = blockElement.querySelector(`[data-block-id="${id}"]`)+ const blockCellElement = blockElement.querySelector(`[data-block-id="${id}"]`);if (!blockCellElement) {html += `<div class="av__row" data-type="ghost" data-id="${id}" data-avid="${avId}" data-previous-id="${previousId}">${colHTML}diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex 1b8ca56468..5db2c836bc 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -750,7 +750,7 @@ export class WYSIWYG {this.element.querySelectorAll("iframe").forEach(item => {item.style.pointerEvents = "none";});- const needScroll = ["IMG", "VIDEO", "AUDIO"].includes(target.tagName) || target.classList.contains("img")+ const needScroll = ["IMG", "VIDEO", "AUDIO"].includes(target.tagName) || target.classList.contains("img");documentSelf.onmousemove = (moveEvent: MouseEvent) => {const moveTarget = moveEvent.target as HTMLElement;// table cell selectdiff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex 1cf5470715..852d481551 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -1182,7 +1182,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {// h1 - h6 hotkeyif (matchHotKey(window.siyuan.config.keymap.editor.heading.paragraph.custom, event)) {- const selectsElement = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"))+ const selectsElement = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));if (selectsElement.length === 0) {selectsElement.push(nodeElement);}diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.tsindex cfb6f1f744..e206325b24 100644--- a/app/src/protyle/wysiwyg/remove.ts+++ b/app/src/protyle/wysiwyg/remove.ts@@ -251,7 +251,7 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ranif (previousElement) {if (previousElement.classList.contains("p") && getContenteditableElement(previousElement).textContent === "") {// 空块向后删除时移除改块 https://github.com/siyuan-note/siyuan/issues/11732- const ppElement = getPreviousBlock(previousElement)+ const ppElement = getPreviousBlock(previousElement);transaction(protyle, [{action: "delete",id: previousElement.getAttribute("data-node-id"),diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex 955c27952d..a9c9f81cb3 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -1144,7 +1144,7 @@ export const transaction = (protyle: IProtyle, doOperations: IOperation[], undoO});}});- })+ });return;}if (needDebounce) {@@ -1166,10 +1166,10 @@ export const transaction = (protyle: IProtyle, doOperations: IOperation[], undoO// 插入块后会导致高度变化,从而产生再次定位 https://github.com/siyuan-note/siyuan/issues/11798doOperations.find(item => {if (item.action === "insert") {- protyle.observerLoad?.disconnect()+ protyle.observerLoad?.disconnect();return true;}- })+ });};const processFold = (operation: IOperation, protyle: IProtyle) => {@@ -1225,7 +1225,7 @@ const processFold = (operation: IOperation, protyle: IProtyle) => {}return;}-}+};export const updateTransaction = (protyle: IProtyle, id: string, newHTML: string, html: string) => {if (newHTML === html) {