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:
Vanessa915ab22b518a
diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.tsindex f82b8cc929..ef68071046 100644--- a/app/src/mobile/editor.ts+++ b/app/src/mobile/editor.ts@@ -3,7 +3,7 @@ import {setEditor} from "./util/setEmpty";import {closePanel} from "./util/closePanel";import {Constants} from "../constants";import {fetchPost} from "../util/fetch";-import {disabledProtyle, enableProtyle, onGet} from "../protyle/util/onGet";+import {disabledProtyle, onGet} from "../protyle/util/onGet";import {addLoading} from "../protyle/ui/initUI";import {focusBlock} from "../protyle/util/selection";import {scrollCenter} from "../util/highlightById";diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.tsindex 544f7dbb69..628ea707e2 100644--- a/app/src/protyle/util/paste.ts+++ b/app/src/protyle/util/paste.ts@@ -8,14 +8,12 @@ import {clipboard} from "electron";import {hasClosestBlock} from "./hasClosest";import {focusByWbr, getEditorRange} from "./selection";import {blockRender} from "../markdown/blockRender";-import * as dayjs from "dayjs";import {highlightRender} from "../markdown/highlightRender";import {updateTransaction} from "../wysiwyg/transaction";import {fetchPost, fetchSyncPost} from "../../util/fetch";import {isDynamicRef, isFileAnnotation} from "../../util/functions";import {insertHTML} from "./insertHTML";import {scrollCenter} from "../../util/highlightById";-import {getContenteditableElement} from "../wysiwyg/getBlock";import {hideElements} from "../ui/hideElements";const filterClipboardHint = (protyle: IProtyle, textPlain: string) => {@@ -169,7 +167,6 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven});const code = processPasteCode(textHTML, textPlain);const range = getEditorRange(protyle.wysiwyg.element);- const id = nodeElement.getAttribute("data-node-id");// process codeif (nodeElement.getAttribute("data-type") === "NodeCodeBlock") {// 粘贴在代码位置diff --git a/app/src/protyle/wysiwyg/list.ts b/app/src/protyle/wysiwyg/list.tsindex 8a0d28ac00..39a058ae1c 100644--- a/app/src/protyle/wysiwyg/list.ts+++ b/app/src/protyle/wysiwyg/list.ts@@ -328,17 +328,17 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:});if (!window.siyuan.config.editor.listLogicalOutdent && !nextElement.classList.contains("protyle-attr")) {// 传统缩进- let newId+ let newId;if (lastBlockElement.getAttribute("data-subtype") !== nextElement.getAttribute("data-subtype")) {- newId = Lute.NewNodeID()- lastBlockElement = document.createElement("div")- lastBlockElement.classList.add("list")- lastBlockElement.setAttribute("data-subtype", nextElement.getAttribute("data-subtype"))- lastBlockElement.setAttribute("data-node-id", newId)- lastBlockElement.setAttribute("data-type", "NodeList")- lastBlockElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"))- lastBlockElement.innerHTML = `<div class="protyle-attr" contenteditable="false">${Constants.ZWSP}</div>`- previousElement.after(lastBlockElement)+ newId = Lute.NewNodeID();+ lastBlockElement = document.createElement("div");+ lastBlockElement.classList.add("list");+ lastBlockElement.setAttribute("data-subtype", nextElement.getAttribute("data-subtype"));+ lastBlockElement.setAttribute("data-node-id", newId);+ lastBlockElement.setAttribute("data-type", "NodeList");+ lastBlockElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));+ lastBlockElement.innerHTML = `<div class="protyle-attr" contenteditable="false">${Constants.ZWSP}</div>`;+ previousElement.after(lastBlockElement);doOperations.push({action: "insert",id: newId,@@ -357,16 +357,17 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:undoOperations.push({action: "move",id: nextElement.getAttribute("data-node-id"),- previousID: previousID || nextElement.previousElementSibling.getAttribute("data-node-id"),+ parentID: lastBlockElement.getAttribute("data-node-id"),+ previousID: previousID || nextElement.previousElementSibling?.getAttribute("data-node-id"),});previousID = nextElement.getAttribute("data-node-id");- const tempElement = nextElement- nextElement = nextElement.nextElementSibling+ const tempElement = nextElement;+ nextElement = nextElement.nextElementSibling;lastBlockElement.lastElementChild.before(tempElement);}if (lastBlockElement.getAttribute("data-subtype") === "o") {Array.from(lastBlockElement.children).forEach(orderItem => {- const id = orderItem.getAttribute("data-node-id")+ const id = orderItem.getAttribute("data-node-id");if (id) {undoOperations.push({action: "update",@@ -377,7 +378,7 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:});updateListOrder(lastBlockElement, 1);Array.from(lastBlockElement.children).forEach(orderItem => {- const id = orderItem.getAttribute("data-node-id")+ const id = orderItem.getAttribute("data-node-id");if (id) {doOperations.push({action: "update",@@ -526,17 +527,17 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:});if (!window.siyuan.config.editor.listLogicalOutdent && !nextElement.classList.contains("protyle-attr")) {// 传统缩进- let newId+ let newId;if (!lastBlockElement.classList.contains("list")) {- newId = Lute.NewNodeID()- lastBlockElement = document.createElement("div")- lastBlockElement.classList.add("list")- lastBlockElement.setAttribute("data-subtype", nextElement.getAttribute("data-subtype"))- lastBlockElement.setAttribute("data-node-id", newId)- lastBlockElement.setAttribute("data-type", "NodeList")- lastBlockElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"))- lastBlockElement.innerHTML = `<div class="protyle-attr" contenteditable="false">${Constants.ZWSP}</div>`- parentLiItemElement.after(lastBlockElement)+ newId = Lute.NewNodeID();+ lastBlockElement = document.createElement("div");+ lastBlockElement.classList.add("list");+ lastBlockElement.setAttribute("data-subtype", nextElement.getAttribute("data-subtype"));+ lastBlockElement.setAttribute("data-node-id", newId);+ lastBlockElement.setAttribute("data-type", "NodeList");+ lastBlockElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));+ lastBlockElement.innerHTML = `<div class="protyle-attr" contenteditable="false">${Constants.ZWSP}</div>`;+ parentLiItemElement.after(lastBlockElement);doOperations.push({action: "insert",id: newId,@@ -546,7 +547,7 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:}let previousID;while (nextElement && !nextElement.classList.contains("protyle-attr")) {- const nextId = nextElement.getAttribute("data-node-id")+ const nextId = nextElement.getAttribute("data-node-id");if (nextElement.getAttribute("data-subtype") !== lastBlockElement.getAttribute("data-subtype")) {undoOperations.push({action: "update",@@ -571,16 +572,17 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:undoOperations.push({action: "move",id: nextId,- previousID: previousID || nextElement.previousElementSibling.getAttribute("data-node-id"),+ parentID: lastBlockElement.getAttribute("data-node-id"),+ previousID: previousID || nextElement.previousElementSibling?.getAttribute("data-node-id"),});previousID = nextId;- const tempElement = nextElement- nextElement = nextElement.nextElementSibling+ const tempElement = nextElement;+ nextElement = nextElement.nextElementSibling;lastBlockElement.lastElementChild.before(tempElement);}if (lastBlockElement.getAttribute("data-subtype") === "o") {Array.from(lastBlockElement.children).forEach(orderItem => {- const id = orderItem.getAttribute("data-node-id")+ const id = orderItem.getAttribute("data-node-id");if (id) {undoOperations.push({action: "update",@@ -591,7 +593,7 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:});updateListOrder(lastBlockElement, 1);Array.from(lastBlockElement.children).forEach(orderItem => {- const id = orderItem.getAttribute("data-node-id")+ const id = orderItem.getAttribute("data-node-id");if (id) {doOperations.push({action: "update",