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:
Vanessa1fedca69299c
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex b45d635d4f..d097b4fefe 100644--- a/app/src/menus/protyle.ts+++ b/app/src/menus/protyle.ts@@ -27,10 +27,6 @@ import {pasteAsPlainText, pasteText} from "../protyle/util/paste";/// #if !MOBILEimport {openFileById, updateBacklinkGraph} from "../editor/util";/// #endif-/// #if !BROWSER-import {getCurrentWindow} from "@electron/remote";-import {clipboard} from "electron";-/// #endifimport {isMobile} from "../util/functions";import {removeFoldHeading} from "../protyle/util/heading";import {lineNumberRender} from "../protyle/markdown/highlightRender";@@ -344,7 +340,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {accelerator: window.siyuan.config.keymap.editor.general.pasteAsPlainText.custom,click() {focusByRange(getEditorRange(nodeElement));- pasteAsPlainText(protyle)+ pasteAsPlainText(protyle);}}).element);/// #endifdiff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex de947ccac4..d1fb17504a 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -427,23 +427,23 @@ export class Toolbar {if (type === "sub" && types.includes("sup")) {types.find((item, index) => {if (item === "sup") {- types.splice(index, 1)+ types.splice(index, 1);if (!this.element.classList.contains("fn__none")) {- this.element.querySelector(`[data-type="sup"]`).classList.remove("protyle-toolbar__item--current");+ this.element.querySelector("[data-type=\"sup\"]").classList.remove("protyle-toolbar__item--current");}return true;}- })+ });} else if (type === "sup" && types.includes("sub")) {types.find((item, index) => {if (item === "sub") {types.splice(index, 1);if (!this.element.classList.contains("fn__none")) {- this.element.querySelector(`[data-type="sub"]`).classList.remove("protyle-toolbar__item--current");+ this.element.querySelector("[data-type=\"sub\"]").classList.remove("protyle-toolbar__item--current");}return true;}- })+ });}types = [...new Set(types)];if (index === 0 && previousElement && previousElement.nodeType !== 3 &&@@ -635,7 +635,7 @@ export class Toolbar {let html = protyle.lute.SpinBlockDOM(nodeElement.outerHTML);let title = "HTML";let placeholder = "";- const isInlineMemo = type && type.split(" ").includes("inline-memo")+ const isInlineMemo = type && type.split(" ").includes("inline-memo");switch (renderElement.getAttribute("data-subtype")) {case "abc":title = window.siyuan.languages.staff;@@ -888,11 +888,11 @@ export class Toolbar {if (!target.value) {// https://github.com/siyuan-note/insider/issues/1046if (type.replace("inline-memo", "") === "") {- renderElement.outerHTML = renderElement.innerHTML + "<wbr>"+ renderElement.outerHTML = renderElement.innerHTML + "<wbr>";focusByWbr(nodeElement, this.range);} else {- renderElement.setAttribute("data-type", type.replace("inline-memo", ""))- renderElement.removeAttribute("data-inline-memo-content")+ renderElement.setAttribute("data-type", type.replace("inline-memo", ""));+ renderElement.removeAttribute("data-inline-memo-content");}} else {renderElement.setAttribute("data-inline-memo-content", Lute.EscapeHTMLStr(target.value));@@ -935,10 +935,12 @@ export class Toolbar {this.subElement.classList.add("fn__none");this.subElement.querySelector('[data-type="pin"]').classList.remove("block__icon--active");if (renderElement.tagName === "SPAN") {- const range = getEditorRange(renderElement);- range.setStartAfter(renderElement);- range.collapse(true);- focusByRange(range);+ if (type === "inline-memo" && !textElement.value) {+ renderElement.outerHTML = renderElement.innerHTML + "<wbr>";+ focusByWbr(nodeElement, this.range);+ } else {+ focusByRange(this.range);+ }} else {focusSideBlock(renderElement);}diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.tsindex 97ed5220d7..4fd7fcd33f 100644--- a/app/src/protyle/util/paste.ts+++ b/app/src/protyle/util/paste.ts@@ -57,7 +57,7 @@ export const pasteAsPlainText = async (protyle:IProtyle) => {insertHTML(protyle.lute.BlockDOM2Content(protyle.lute.InlineMd2BlockDOM(clipboard.readText())), protyle, false, false);}/// #endif-}+};export const pasteText = (protyle: IProtyle, textPlain: string, nodeElement: Element) => {const range = getEditorRange(protyle.wysiwyg.element);diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex dd69a1d5ad..4626fbb69e 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -58,7 +58,6 @@ import {BlockPanel} from "../../block/Panel";import * as dayjs from "dayjs";import {highlightRender} from "../markdown/highlightRender";import {countBlockWord} from "../../layout/status";-import {insertHTML} from "../util/insertHTML";import {openMobileFileById} from "../../mobile/editor";import {pasteAsPlainText} from "../util/paste";@@ -296,7 +295,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {if (start !== 0) {const editElement = getContenteditableElement(nodeElement);if (editElement.tagName === "TABLE") {- const cellElement = hasClosestByMatchTag(range.startContainer, "TH") || hasClosestByMatchTag(range.startContainer, "TD") || editElement.querySelector("th, td")+ const cellElement = hasClosestByMatchTag(range.startContainer, "TH") || hasClosestByMatchTag(range.startContainer, "TD") || editElement.querySelector("th, td");if (getSelectionOffset(cellElement, cellElement, range).start !== 0) {setFirstNodeRange(cellElement, range);event.stopPropagation();