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:
Vanessa87a5ce001f3c
diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.tsindex 68c32a87f7..84469d889f 100644--- a/app/src/protyle/util/onGet.ts+++ b/app/src/protyle/util/onGet.ts@@ -239,7 +239,7 @@ const setHTML = (options: {/// #endif}if (options.isSyncing) {- disabledForeverProtyle(protyle)+ disabledForeverProtyle(protyle);} else {if (protyle.disabled) {disabledProtyle(protyle);@@ -288,10 +288,10 @@ const setHTML = (options: {export const disabledForeverProtyle = (protyle: IProtyle) => {disabledProtyle(protyle);if (protyle.breadcrumb) {- protyle.breadcrumb.element.querySelector(".b3-button").textContent = window.siyuan.languages["_kernel"][81]+ protyle.breadcrumb.element.querySelector(".b3-button").textContent = window.siyuan.languages["_kernel"][81];}protyle.element.setAttribute("disabled-forever", "true");-}+};/** 禁用编辑器 */export const disabledProtyle = (protyle: IProtyle) => {diff --git a/app/src/protyle/wysiwyg/commonHotkey.ts b/app/src/protyle/wysiwyg/commonHotkey.tsindex 48641b2e58..e553c01146 100644--- a/app/src/protyle/wysiwyg/commonHotkey.ts+++ b/app/src/protyle/wysiwyg/commonHotkey.ts@@ -120,7 +120,7 @@ export const upSelect = (options: {countBlockWord(ids, options.protyle.block.rootID);options.event.stopPropagation();options.event.preventDefault();-}+};export const downSelect = (options: {protyle: IProtyle,@@ -153,7 +153,7 @@ export const downSelect = (options: {if (selectElements.length === 0) {options.nodeElement.classList.add("protyle-wysiwyg--select");} else {- options.cb(selectElements)+ options.cb(selectElements);}const ids: string[] = [];options.protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select").forEach(item => {@@ -162,29 +162,29 @@ export const downSelect = (options: {countBlockWord(ids, options.protyle.block.rootID);options.event.stopPropagation();options.event.preventDefault();-}+};export const getStartEndElement = (selectElements: NodeListOf<Element>) => {- let startElement- let endElement+ let startElement;+ let endElement;selectElements.forEach(item => {if (item.getAttribute("select-start")) {- startElement = item+ startElement = item;}if (item.getAttribute("select-end")) {- endElement = item+ endElement = item;}});if (!startElement) {- startElement = selectElements[0]- startElement.setAttribute("select-start", "true")+ startElement = selectElements[0];+ startElement.setAttribute("select-start", "true");}if (!endElement) {- endElement = selectElements[selectElements.length - 1]- endElement.setAttribute("select-end", "true")+ endElement = selectElements[selectElements.length - 1];+ endElement.setAttribute("select-end", "true");}return {startElement,endElement- }-}+ };+};diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex e31f549350..fee6f48398 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -7,8 +7,6 @@ import {getEditorRange,getSelectionOffset, getSelectionPosition,selectAll,- setFirstNodeRange,- setLastNodeRange} from "../util/selection";import {hasClosestBlock,@@ -292,8 +290,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {if (previousElement && previousElement.getAttribute("data-node-id")) {previousElement.classList.add("protyle-wysiwyg--select");selectElements.forEach(item => {- item.removeAttribute("select-end")- })+ item.removeAttribute("select-end");+ });previousElement.setAttribute("select-end", "true");const top = previousElement.getBoundingClientRect().top - protyle.contentElement.getBoundingClientRect().top;if (top < 0) {@@ -318,8 +316,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {if (nextElement && nextElement.getAttribute("data-node-id")) {nextElement.classList.add("protyle-wysiwyg--select");selectElements.forEach(item => {- item.removeAttribute("select-end")- })+ item.removeAttribute("select-end");+ });nextElement.setAttribute("select-end", "true");const bottom = nextElement.getBoundingClientRect().bottom - protyle.contentElement.getBoundingClientRect().bottom;if (bottom > 0) {@@ -331,7 +329,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {selectLastElement.parentElement.classList.add("protyle-wysiwyg--select");}}- })+ });return;}@@ -339,7 +337,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {upSelect({protyle, event, nodeElement, editorElement, range,cb(selectElements) {- const startEndElement = getStartEndElement(selectElements)+ const startEndElement = getStartEndElement(selectElements);if (startEndElement.startElement.getBoundingClientRect().top >= startEndElement.endElement.getBoundingClientRect().top) {const previousElement = startEndElement.endElement.previousElementSibling as HTMLElement;if (previousElement && previousElement.getAttribute("data-node-id")) {@@ -360,11 +358,11 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {startEndElement.endElement.removeAttribute("select-end");const previousElement = getPreviousBlock(startEndElement.endElement);if (previousElement) {- previousElement.setAttribute("select-end", "true")+ previousElement.setAttribute("select-end", "true");}}}- })+ });return;}@@ -372,7 +370,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {downSelect({protyle, event, nodeElement, editorElement, range,cb(selectElements) {- const startEndElement = getStartEndElement(selectElements)+ const startEndElement = getStartEndElement(selectElements);if (startEndElement.startElement.getBoundingClientRect().top <= startEndElement.endElement.getBoundingClientRect().top) {const nextElement = startEndElement.endElement.nextElementSibling as HTMLElement;if (nextElement && nextElement.getAttribute("data-node-id")) {@@ -393,11 +391,11 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {startEndElement.endElement.removeAttribute("select-end");const nextElement = getNextBlock(startEndElement.endElement);if (nextElement) {- nextElement.setAttribute("select-end", "true")+ nextElement.setAttribute("select-end", "true");}}}- })+ });return;}diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex d6960ac49a..0b87788c6a 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -743,8 +743,8 @@ export const turnsIntoTransaction = (options: {setFold(options.protyle, item);}item.classList.remove("protyle-wysiwyg--select");- item.removeAttribute("select-start")- item.removeAttribute("select-end")+ item.removeAttribute("select-start");+ item.removeAttribute("select-end");html += item.outerHTML;const id = item.getAttribute("data-node-id");undoOperations.push({