An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:lipstick: https://github.com/siyuan-note/siyuan/issues/11285
Vanessa402a7a205da6
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex 4f6890d490..f78dcb36f1 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -629,10 +629,10 @@ export class Toolbar {i--;} else {this.range.insertNode(currentNewNode);- // https://github.com/siyuan-note/siyuan/issues/6155- if (currentNewNode.nodeType !== 3 && ["code", "tag", "kbd"].includes(type)) {- const previousSibling = hasPreviousSibling(currentNewNode);- if (!previousSibling || previousSibling.textContent.endsWith("\n")) {+ if (currentNewNode.nodeType === 1 && ["code", "tag", "kbd"].includes(type)) {+ // 添加为 span https://github.com/siyuan-note/siyuan/issues/6155+ const currentPreviousSibling = hasPreviousSibling(currentNewNode);+ if (!currentPreviousSibling || currentPreviousSibling.textContent.endsWith("\n")) {currentNewNode.before(document.createTextNode(Constants.ZWSP));}if (!currentNewNode.textContent.startsWith(Constants.ZWSP)) {@@ -647,6 +647,47 @@ export class Toolbar {) {currentNewNode.after(document.createTextNode(Constants.ZWSP));}+ } else if (currentNewNode.nodeType === 3 && ["code", "tag", "kbd", "clear"].includes(type)) {+ const currentPreviousSibling = hasPreviousSibling(currentNewNode) as HTMLElement;+ let previousIsCTK = false;+ if (currentPreviousSibling) {+ if (currentPreviousSibling.nodeType === 1) {+ const currentPreviousSiblingTypes = currentPreviousSibling.dataset.type.split(" ")+ if (currentPreviousSiblingTypes.includes("code") || currentPreviousSiblingTypes.includes("tag") || currentPreviousSiblingTypes.includes("kbd")) {+ previousIsCTK = true;+ }+ } else if (currentPreviousSibling.textContent.endsWith(Constants.ZWSP)) {+ currentPreviousSibling.textContent = currentPreviousSibling.textContent.substring(0, currentPreviousSibling.textContent.length - 1);+ }+ }+ const currentNextSibling = hasNextSibling(currentNewNode) as HTMLElement;+ let nextIsCTK = false;+ if (currentNextSibling) {+ if (currentNextSibling.nodeType === 1) {+ const currentNextSiblingTypes = currentNextSibling.dataset.type.split(" ")+ if (currentNextSiblingTypes.includes("code") || currentNextSiblingTypes.includes("tag") || currentNextSiblingTypes.includes("kbd")) {+ nextIsCTK = true;+ }+ } else if (currentNextSibling.textContent.startsWith(Constants.ZWSP)) {+ currentNextSibling.textContent = currentNextSibling.textContent.substring(1);+ }+ }+ if (currentNewNode) {+ if (previousIsCTK) {+ if (!currentNewNode.textContent.startsWith(Constants.ZWSP)) {+ currentNewNode.textContent = Constants.ZWSP + currentNewNode.textContent;+ }+ } else if (currentNewNode.textContent.startsWith(Constants.ZWSP)) {+ currentNewNode.textContent = currentNewNode.textContent.substring(1);+ }+ if (nextIsCTK) {+ if (!currentNextSibling.textContent.startsWith(Constants.ZWSP)) {+ currentNextSibling.textContent = Constants.ZWSP + currentNextSibling.textContent;+ }+ } else if (currentNewNode.textContent.endsWith(Constants.ZWSP)) {+ currentNewNode.textContent = currentNewNode.textContent.substring(0, currentNewNode.textContent.length - 1);+ }+ }}this.range.collapse(false);}diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex 5926b9b2d1..3570f7e5da 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -91,6 +91,7 @@ import {} from "../render/av/cell";import {openEmojiPanel, unicode2Emoji} from "../../emoji";import {openLink} from "../../editor/openLink";+import {mathRender} from "../render/mathRender";export class WYSIWYG {public lastHTMLs: { [key: string]: string } = {};@@ -1443,6 +1444,7 @@ export class WYSIWYG {tempElement.append(range.extractContents());nodeElement.outerHTML = protyle.lute.SpinBlockDOM(nodeElement.outerHTML);nodeElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${id}"]`) as HTMLElement;+ mathRender(nodeElement);focusByWbr(nodeElement, range);} else {const inlineMathElement = hasClosestByAttribute(range.commonAncestorContainer, "data-type", "inline-math");