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:
Vanessa39f9aaca8230
diff --git a/app/src/boot/onGetConfig.ts b/app/src/boot/onGetConfig.tsindex 9c953d78c0..5cc2cc211b 100644--- a/app/src/boot/onGetConfig.ts+++ b/app/src/boot/onGetConfig.ts@@ -251,32 +251,32 @@ export const initWindow = (app: App) => {ipcRenderer.on(Constants.SIYUAN_OPENURL, (event, url) => {if (/^siyuan:\/\/plugins\//.test(url)) {// siyuan://plugins/plugin-samplecustom_tab?title=自定义页签&icon=iconFace&data={"text": "This is the custom plugin tab I opened via protocol."}- const pluginId = url.replace("siyuan://plugins/", "").split("?")[0]+ const pluginId = url.replace("siyuan://plugins/", "").split("?")[0];app.plugins.find(plugin => {const match = Object.keys(plugin.models).find(key => {if (key === pluginId) {- let data = getSearch("data", url)+ let data = getSearch("data", url);try {data = JSON.parse(data || "{}");} catch (e) {- console.log("Error open plugin tab with protocol:", e)+ console.log("Error open plugin tab with protocol:", e);}openFile({app,custom: {title: getSearch("title", url),icon: getSearch("icon", url),- data: JSON.parse(getSearch("data", url) || "{}"),+ data,fn: plugin.models[key]},});- return true+ return true;}- })+ });if (match) {- return true+ return true;}- })+ });return;}if (isSYProtocol(url)) {diff --git a/app/src/config/repos.ts b/app/src/config/repos.tsindex c079a5679c..287820e70d 100644--- a/app/src/config/repos.ts+++ b/app/src/config/repos.ts@@ -360,11 +360,11 @@ export const repos = {});const syncModeElement = repos.element.querySelector("#syncMode") as HTMLSelectElement;syncModeElement.addEventListener("change", () => {- fetchPost("/api/sync/setSyncMode", {mode: parseInt(syncModeElement.value, 10)}, (response) => {+ fetchPost("/api/sync/setSyncMode", {mode: parseInt(syncModeElement.value, 10)}, () => {if (syncModeElement.value === "1") {- syncPerceptionElement.parentElement.classList.remove("fn__none")+ syncPerceptionElement.parentElement.classList.remove("fn__none");} else {- syncPerceptionElement.parentElement.classList.add("fn__none")+ syncPerceptionElement.parentElement.classList.add("fn__none");}window.siyuan.config.sync.mode = parseInt(syncModeElement.value, 10);});diff --git a/app/src/constants.ts b/app/src/constants.tsindex 1f7bf40255..221f8e015c 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -204,7 +204,7 @@ export abstract class Constants {220: "\\",221: "]",222: "'",- }+ };// 冲突不使用 "⌘S/Q"// "⌘", "⇧", "⌥", "⌃"// "⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌘⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←",diff --git a/app/src/dialog/tooltip.ts b/app/src/dialog/tooltip.tsindex 1f10b41e3c..e22797dc7f 100644--- a/app/src/dialog/tooltip.ts+++ b/app/src/dialog/tooltip.ts@@ -26,7 +26,7 @@ export const showTooltip = (message: string, target: Element, error = false) =>messageElement.classList.add("tooltip--memo"); // 为行级备注添加 class https://github.com/siyuan-note/siyuan/issues/6161}let left = targetRect.left;- let topSpace = 8+ let topSpace = 8;const position = target.getAttribute("data-position");if (position === "right") {left = targetRect.right - messageElement.clientWidth;diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.tsindex 4e2254f551..53fce6d1e7 100644--- a/app/src/layout/Wnd.ts+++ b/app/src/layout/Wnd.ts@@ -580,18 +580,18 @@ export class Wnd {Array.from(this.headersElement.children).forEach((item: HTMLElement) => {const iconElement = item.querySelector(".item__icon");const graphicElement = item.querySelector(".item__graphic");- let iconHTML = undefined+ let iconHTML = undefined;if (iconElement) {if (iconElement.firstElementChild?.tagName === "IMG") {// 图标为图片的文档- iconHTML = `<img src="${iconElement.firstElementChild.getAttribute("src")}" class="b3-menu__icon">`+ iconHTML = `<img src="${iconElement.firstElementChild.getAttribute("src")}" class="b3-menu__icon">`;} else {// 有图标的文档- iconHTML = `<span class="b3-menu__icon">${iconElement.innerHTML}</span>`+ iconHTML = `<span class="b3-menu__icon">${iconElement.innerHTML}</span>`;}} else if (!graphicElement) {// 没有图标的文档- iconHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE, "b3-menu__icon", true)+ iconHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE, "b3-menu__icon", true);}window.siyuan.menus.menu.append(new MenuItem({label: escapeHtml(item.querySelector(".item__text").textContent),diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.tsindex 0a77cb360c..07985a58c7 100644--- a/app/src/layout/dock/Outline.ts+++ b/app/src/layout/dock/Outline.ts@@ -106,12 +106,12 @@ export class Outline extends Model {click: (element: HTMLElement) => {const id = element.getAttribute("data-node-id");if (this.isPreview) {- const headElement = document.getElementById(id)+ const headElement = document.getElementById(id);if (headElement) {- const tabElement = hasTopClosestByClassName(headElement, "protyle")+ const tabElement = hasTopClosestByClassName(headElement, "protyle");if (tabElement) {- const tab = getInstanceById(tabElement.getAttribute("data-id")) as Tab- tab.parent.switchTab(tab.headElement)+ const tab = getInstanceById(tabElement.getAttribute("data-id")) as Tab;+ tab.parent.switchTab(tab.headElement);}headElement.scrollIntoView();} else {@@ -337,7 +337,7 @@ export class Outline extends Model {if (this.isPreview) {this.tree.element.querySelectorAll(".popover__block").forEach(item => {item.classList.remove("popover__block");- })+ });}if (currentId) {diff --git a/app/src/layout/topBar.ts b/app/src/layout/topBar.tsindex 67e477576c..0e2265cb07 100644--- a/app/src/layout/topBar.ts+++ b/app/src/layout/topBar.ts@@ -17,7 +17,6 @@ import {Constants} from "../constants";import {isBrowser, isWindow} from "../util/functions";import {Menu} from "../plugin/Menu";import {fetchPost} from "../util/fetch";-import {escapeAttr} from "../util/escape";import {needSubscribe} from "../util/needSubscribe";import * as dayjs from "dayjs";@@ -236,30 +235,30 @@ export const initBar = (app: App) => {event.stopPropagation();event.preventDefault();fetchPost("/api/sync/getSyncInfo", {}, (response) => {- let html = ""+ let html = "";if (!window.siyuan.config.sync.enabled || (0 === window.siyuan.config.sync.provider && needSubscribe(""))) {html = response.data.stat;} else {- html = window.siyuan.languages._kernel[82].replace("%s", dayjs(response.data.synced).format("YYYY-MM-DD HH:mm")) + "<br>"+ html = window.siyuan.languages._kernel[82].replace("%s", dayjs(response.data.synced).format("YYYY-MM-DD HH:mm")) + "<br>";html += " " + response.data.stat;if (response.data.kernels.length > 0) {- html += "<br>"- html += window.siyuan.languages.currentKernel + "<br>"- html += " " + response.data.kernel + "/" + window.siyuan.config.system.kernelVersion + " (" + window.siyuan.config.system.os + "/" + window.siyuan.config.system.name + ")<br>"- html += window.siyuan.languages.otherOnlineKernels + "<br>"+ html += "<br>";+ html += window.siyuan.languages.currentKernel + "<br>";+ html += " " + response.data.kernel + "/" + window.siyuan.config.system.kernelVersion + " (" + window.siyuan.config.system.os + "/" + window.siyuan.config.system.name + ")<br>";+ html += window.siyuan.languages.otherOnlineKernels + "<br>";response.data.kernels.forEach((item: {os: string;ver: string;hostname: string;id: string;}) => {- html += ` ${item.id}/${item.ver} (${item.os}/${item.hostname}) <br>`- })+ html += ` ${item.id}/${item.ver} (${item.os}/${item.hostname}) <br>`;+ });}}barSyncElement.setAttribute("aria-label", html);- })- })+ });+ });barSyncElement.setAttribute("aria-label", window.siyuan.config.sync.stat || (window.siyuan.languages.syncNow + " " + updateHotkeyTip(window.siyuan.config.keymap.general.syncNow.custom)));};diff --git a/app/src/menus/util.ts b/app/src/menus/util.tsindex e6c5c6a7b4..17f0381f45 100644--- a/app/src/menus/util.ts+++ b/app/src/menus/util.ts@@ -126,4 +126,4 @@ export const copyPNG = (imgElement: HTMLImageElement) => {};tempElement.src = imgElement.getAttribute("src");}-}+};diff --git a/app/src/plugin/loader.ts b/app/src/plugin/loader.tsindex 9eaac8f6ed..e35d1b7301 100644--- a/app/src/plugin/loader.ts+++ b/app/src/plugin/loader.ts@@ -139,7 +139,7 @@ export const afterLoadPlugin = (plugin: Plugin) => {}if (!isWindow() || isMobile()) {- const pluginMenu: IMenu[] = []+ const pluginMenu: IMenu[] = [];plugin.topBarIcons.forEach(element => {if (isMobile()) {if (window.siyuan.storage[Constants.LOCAL_PLUGINTOPUNPIN].includes(element.id)) {@@ -149,7 +149,7 @@ export const afterLoadPlugin = (plugin: Plugin) => {click() {element.dispatchEvent(new CustomEvent("click"));}- })+ });} else {document.querySelector("#menuAbout").after(element);}@@ -161,17 +161,17 @@ export const afterLoadPlugin = (plugin: Plugin) => {}});if (isMobile() && pluginMenu.length > 0) {- const pluginElement = document.createElement("div")- pluginElement.classList.add("b3-menu__item")- pluginElement.setAttribute("data-menu", "true")- pluginElement.innerHTML = `<svg class="b3-menu__icon"><use xlink:href="#iconPlugin"></use></svg><span class="b3-menu__label">${window.siyuan.languages.plugin}</span>`+ const pluginElement = document.createElement("div");+ pluginElement.classList.add("b3-menu__item");+ pluginElement.setAttribute("data-menu", "true");+ pluginElement.innerHTML = `<svg class="b3-menu__icon"><use xlink:href="#iconPlugin"></use></svg><span class="b3-menu__label">${window.siyuan.languages.plugin}</span>`;pluginElement.addEventListener("click", () => {- const menu = new Menu()+ const menu = new Menu();pluginMenu.forEach(item => {- menu.addItem(item)- })+ menu.addItem(item);+ });menu.fullscreen();- })+ });document.querySelector("#menuAbout").after(pluginElement);}}diff --git a/app/src/protyle/toolbar/Font.ts b/app/src/protyle/toolbar/Font.tsindex 9e16c1bf81..cb9152f329 100644--- a/app/src/protyle/toolbar/Font.ts+++ b/app/src/protyle/toolbar/Font.ts@@ -1,7 +1,7 @@import {setStorageVal, updateHotkeyTip} from "../util/compatibility";import {ToolbarItem} from "./ToolbarItem";import {setPosition} from "../../util/setPosition";-import {focusBlock, focusByRange, getSelectionPosition} from "../util/selection";+import {focusByRange, getSelectionPosition} from "../util/selection";import {Constants} from "../../constants";import {hasClosestBlock, hasClosestByAttribute} from "../util/hasClosest";import {updateBatchTransaction} from "../wysiwyg/transaction";diff --git a/app/src/search/menu.ts b/app/src/search/menu.tsindex 5b5654f13d..51485e223c 100644--- a/app/src/search/menu.ts+++ b/app/src/search/menu.ts@@ -227,7 +227,7 @@ export const saveCriterion = (config: ISearchOption,criteriaElement.firstElementChild.insertAdjacentHTML("beforeend", `<div data-type="set-criteria" class="b3-chip b3-chip--middle b3-chip--pointer b3-chip--${["secondary", "primary", "info", "success", "warning", "error", ""][(criteriaElement.firstElementChild.childElementCount) % 7]}">${criterion.name}<svg class="b3-chip__close" data-type="remove-criteria"><use xlink:href="#iconCloseRound"></use></svg></div>`);});});-}+};export const moreMenu = async (config: ISearchOption,criteriaData: ISearchOption[],