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:
Vanessa7e37563fcd78
diff --git a/app/src/block/Panel.ts b/app/src/block/Panel.tsindex 058eccada4..c430abf8c0 100644--- a/app/src/block/Panel.ts+++ b/app/src/block/Panel.ts@@ -14,7 +14,6 @@ import {openFileById} from "../editor/util";import {fetchPost} from "../util/fetch";import {showMessage} from "../dialog/message";import {App} from "../index";-import {isMobile} from "../util/functions";import {resize} from "../protyle/util/resize";export class BlockPanel {diff --git a/app/src/history/diff.ts b/app/src/history/diff.tsindex 2b51133a4f..3b6c1017b6 100644--- a/app/src/history/diff.ts+++ b/app/src/history/diff.ts@@ -230,7 +230,7 @@ const genHTML = (left: string, right: string, dialog: Dialog, direct: string) =><span class="fn__flex-1"></span></div>`;headElement.nextElementSibling.innerHTML = `<div class="fn__flex history__panel" style="height: 100%">- <div class="history__side" ${isMobile() ? '' : `style="width: ${window.siyuan.storage[Constants.LOCAL_HISTORY].sideDiffWidth}"`}>+ <div class="history__side" ${isMobile() ? "" : `style="width: ${window.siyuan.storage[Constants.LOCAL_HISTORY].sideDiffWidth}"`}><ul class="b3-list b3-list--background"><li class="b3-list-item"><span class="b3-list-item__toggle b3-list-item__toggle--hl">diff --git a/app/src/history/doc.ts b/app/src/history/doc.tsindex 74df038ae3..83b041f598 100644--- a/app/src/history/doc.ts+++ b/app/src/history/doc.ts@@ -62,7 +62,7 @@ export const openDocHistory = (options: {pathString: string}) => {const contentHTML = `<div class="fn__flex fn__flex-1 history__panel">- <ul class="b3-list b3-list--background history__side" ${isMobile() ? '' : `style="width: ${window.siyuan.storage[Constants.LOCAL_HISTORY].sideDocWidth}"`}>+ <ul class="b3-list b3-list--background history__side" ${isMobile() ? "" : `style="width: ${window.siyuan.storage[Constants.LOCAL_HISTORY].sideDocWidth}"`}><li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li></ul><div class="history__resize"></div>@@ -168,7 +168,7 @@ export const openDocHistory = (options: {action: [Constants.CB_GET_HISTORY, Constants.CB_GET_HTML],});}- dialog.element.querySelector('.protyle-title__input').textContent = item.title;+ dialog.element.querySelector(".protyle-title__input").textContent = item.title;isLoading = false;});target.parentElement.querySelector(".b3-list-item--focus")?.classList.remove("b3-list-item--focus");diff --git a/app/src/history/history.ts b/app/src/history/history.tsindex 6d9742a4ef..71f07d3316 100644--- a/app/src/history/history.ts+++ b/app/src/history/history.ts@@ -66,9 +66,9 @@ const renderDoc = (element: HTMLElement, currentPage: number) => {opElement.querySelector('option[value="replace"]').classList.remove("fn__none");opElement.querySelector('option[value="outline"]').classList.remove("fn__none");}- window.siyuan.storage[Constants.LOCAL_HISTORY].notebookId = notebookElement.value- window.siyuan.storage[Constants.LOCAL_HISTORY].type = parseInt(typeElement.value)- window.siyuan.storage[Constants.LOCAL_HISTORY].operation = opElement.value+ window.siyuan.storage[Constants.LOCAL_HISTORY].notebookId = notebookElement.value;+ window.siyuan.storage[Constants.LOCAL_HISTORY].type = parseInt(typeElement.value);+ window.siyuan.storage[Constants.LOCAL_HISTORY].operation = opElement.value;setStorageVal(Constants.LOCAL_HISTORY, window.siyuan.storage[Constants.LOCAL_HISTORY]);fetchPost("/api/history/searchHistory", {notebook: notebookElement.value,@@ -393,7 +393,7 @@ export const openHistory = (app: App) => {</div></div><div class="fn__flex fn__flex-1 history__panel">- <ul class="b3-list b3-list--background history__side" ${isMobile() ? '' : `style="width: ${localHistory.sideWidth}"`}>+ <ul class="b3-list b3-list--background history__side" ${isMobile() ? "" : `style="width: ${localHistory.sideWidth}"`}><li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li></ul><div class="history__resize"></div>@@ -483,7 +483,7 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {const docElement = firstPanelElement.querySelector('.history__text[data-type="docPanel"]') as HTMLElement;const assetElement = firstPanelElement.querySelector('.history__text[data-type="assetPanel"]');const mdElement = firstPanelElement.querySelector('.history__text[data-type="mdPanel"]') as HTMLTextAreaElement;- const titleElement = firstPanelElement.querySelector('.protyle-title__input') as HTMLElement;+ const titleElement = firstPanelElement.querySelector(".protyle-title__input") as HTMLElement;renderDoc(firstPanelElement, 1);historyEditor = new Protyle(app, docElement, {blockId: "",diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.tsindex e90a3733ef..35eb6e3c95 100644--- a/app/src/mobile/util/initFramework.ts+++ b/app/src/mobile/util/initFramework.ts@@ -46,7 +46,7 @@ const openDockMenu = (app: App) => {}}custom = plugin.docks[dockId].mobileModel(document.querySelector('#sidebar [data-type="sidebar-plugin"]'));- window.siyuan.mobile.docks[dockId] = custom+ window.siyuan.mobile.docks[dockId] = custom;}}});diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.tsindex f77ef81a7e..269c59fed9 100644--- a/app/src/protyle/gutter/index.ts+++ b/app/src/protyle/gutter/index.ts@@ -286,7 +286,7 @@ export class Gutter {blockElement.setAttribute("updated", newUpdated);} else {if (!protyle.disabled && event.shiftKey) {- const blockId = rowElement.querySelector('[data-dtype="block"] .av__celltext--ref')?.getAttribute("data-id")+ const blockId = rowElement.querySelector('[data-dtype="block"] .av__celltext--ref')?.getAttribute("data-id");if (blockId) {fetchPost("/api/attr/getBlockAttrs", {id: blockId}, (response) => {openFileAttr(response.data, "av", protyle);@@ -2243,9 +2243,9 @@ export class Gutter {element = rowElement;let iconAriaLabel = isMac() ? window.siyuan.languages.rowTip : window.siyuan.languages.rowTip.replace("⇧", "Shift+");if (protyle.disabled) {- iconAriaLabel = window.siyuan.languages.rowTip.substring(0, window.siyuan.languages.rowTip.indexOf("<br"))+ iconAriaLabel = window.siyuan.languages.rowTip.substring(0, window.siyuan.languages.rowTip.indexOf("<br"));} else if (rowElement.querySelector('[data-dtype="block"]')?.getAttribute("data-detached") === "true") {- iconAriaLabel = window.siyuan.languages.rowTip.substring(0, window.siyuan.languages.rowTip.lastIndexOf("<br"))+ iconAriaLabel = window.siyuan.languages.rowTip.substring(0, window.siyuan.languages.rowTip.lastIndexOf("<br"));}html = `<button data-type="NodeAttributeViewRowMenu" data-node-id="${dataNodeId}" data-row-id="${rowElement.dataset.id}" class="ariaLabel" data-position="right" aria-label="${iconAriaLabel}"><svg><use xlink:href="#iconDrag"></use></svg><span ${protyle.disabled ? "" : 'draggable="true" class="fn__grab"'}></span></button>`;if (!protyle.disabled) {@@ -2278,7 +2278,7 @@ export class Gutter {index += 1;let gutterTip = this.gutterTip;if (protyle.disabled) {- gutterTip = this.gutterTip.split("<br>").splice(0, 2).join("<br>")+ gutterTip = this.gutterTip.split("<br>").splice(0, 2).join("<br>");}const buttonHTML = `<button class="ariaLabel" data-position="right" aria-label="${gutterTip}"data-type="${type}" data-subtype="${nodeElement.getAttribute("data-subtype")}" data-node-id="${nodeElement.getAttribute("data-node-id")}">diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.tsindex 4e350723c8..e64129b302 100644--- a/app/src/protyle/render/av/action.ts+++ b/app/src/protyle/render/av/action.ts@@ -265,7 +265,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positi/// #if !MOBILEconst blockId = rowElements[0].getAttribute("data-id");const openSubmenus = openEditorTab(protyle.app, [blockId], undefined, undefined, true);- openSubmenus.push({type: "separator"})+ openSubmenus.push({type: "separator"});openSubmenus.push({icon: "iconAttr",label: window.siyuan.languages.attr,@@ -274,7 +274,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement, positiopenFileAttr(response.data, "av", protyle);});}- })+ });menu.addItem({id: "openBy",label: window.siyuan.languages.openBy,diff --git a/app/src/protyle/render/av/keydown.ts b/app/src/protyle/render/av/keydown.tsindex 58de9d5a1f..8124fbf5f9 100644--- a/app/src/protyle/render/av/keydown.ts+++ b/app/src/protyle/render/av/keydown.ts@@ -43,7 +43,7 @@ export const avKeydown = (event: KeyboardEvent, nodeElement: HTMLElement, protylnodeElement.querySelectorAll(".av__cell--select, .av__cell--active").forEach(item => {item.classList.remove("av__cell--select", "av__cell--active");item.querySelector(".av__drag-fill")?.remove();- })+ });selectRow(rowElement.querySelector(".av__firstcol"), "select");event.preventDefault();return true;diff --git a/app/src/protyle/scroll/index.ts b/app/src/protyle/scroll/index.tsindex 520c8b899b..b9d8b614d4 100644--- a/app/src/protyle/scroll/index.ts+++ b/app/src/protyle/scroll/index.ts@@ -4,7 +4,6 @@ import {fetchPost} from "../../util/fetch";import {updateHotkeyTip} from "../util/compatibility";import {hasClosestByClassName} from "../util/hasClosest";import {goEnd, goHome} from "../wysiwyg/commonHotkey";-import {isMobile} from "../../util/functions";import {showTooltip} from "../../dialog/tooltip";export class Scroll {diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.tsindex 40c631c5b5..6ca0c35812 100644--- a/app/src/protyle/util/insertHTML.ts+++ b/app/src/protyle/util/insertHTML.ts@@ -224,7 +224,7 @@ const processTable = (range: Range, html: string, protyle: IProtyle, blockElemenrange.collapse(false);updateTransaction(protyle, blockElement.getAttribute("data-node-id"), blockElement.outerHTML, oldHTML);return true;-}+};export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,// 移动端插入嵌入块时,获取到的 range 为旧值diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.tsindex 22921db49b..940367c48e 100644--- a/app/src/protyle/util/paste.ts+++ b/app/src/protyle/util/paste.ts@@ -244,7 +244,7 @@ const readLocalFile = async (protyle: IProtyle, localFiles: string[]) => {}uploadLocalFiles(localFiles, protyle, true);writeText("");-}+};export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEvent) & { target: HTMLElement }) => {event.stopPropagation();diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex 6ea8cd9cd0..0086f400fb 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -336,7 +336,7 @@ export class WYSIWYG {const selectCellElements: HTMLTableCellElement[] = [];const scrollLeft = nodeElement.firstElementChild.scrollLeft;const tableSelectElement = nodeElement.querySelector(".table__select") as HTMLElement;- html = '<table>'+ html = "<table>";nodeElement.querySelectorAll("th, td").forEach((item: HTMLTableCellElement) => {if (!item.classList.contains("fn__none") &&item.offsetLeft + 6 > tableSelectElement.offsetLeft + scrollLeft && item.offsetLeft + item.clientWidth - 6 < tableSelectElement.offsetLeft + scrollLeft + tableSelectElement.clientWidth &&@@ -347,15 +347,15 @@ export class WYSIWYG {selectCellElements.forEach((item, index) => {if (index === 0 || !item.previousElementSibling ||!item.previousElementSibling.isSameNode(selectCellElements[index - 1])) {- html += "<tr>"+ html += "<tr>";}html += item.outerHTML;if (!item.nextElementSibling || !selectCellElements[index + 1] ||!item.nextElementSibling.isSameNode(selectCellElements[index + 1])) {html += "</tr>";}- })- html += '</table>'+ });+ html += "</table>";textPlain = protyle.lute.HTML2Md(html);} else {const tempElement = document.createElement("div");@@ -1466,7 +1466,7 @@ export class WYSIWYG {const selectCellElements: HTMLTableCellElement[] = [];const scrollLeft = nodeElement.firstElementChild.scrollLeft;const tableSelectElement = nodeElement.querySelector(".table__select") as HTMLElement;- html = '<table>'+ html = "<table>";const oldHTML = nodeElement.outerHTML;nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));nodeElement.querySelectorAll("th, td").forEach((item: HTMLTableCellElement) => {@@ -1479,7 +1479,7 @@ export class WYSIWYG {selectCellElements.forEach((item, index) => {if (index === 0 || !item.previousElementSibling ||!item.previousElementSibling.isSameNode(selectCellElements[index - 1])) {- html += "<tr>"+ html += "<tr>";}html += item.outerHTML;if (!item.nextElementSibling || !selectCellElements[index + 1] ||@@ -1487,8 +1487,8 @@ export class WYSIWYG {html += "</tr>";}item.innerHTML = "";- })- html += '</table>'+ });+ html += "</table>";textPlain = protyle.lute.HTML2Md(html);updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, oldHTML);} else {