Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: fix https://github.com/siyuan-note/siyuan/issues/6569

Vanessa5b8958d0df42
diff --git a/app/src/protyle/toolbar/InlineMemo.ts b/app/src/protyle/toolbar/InlineMemo.ts
index 676448345b..b5969e34b7 100644
--- a/app/src/protyle/toolbar/InlineMemo.ts
+++ b/app/src/protyle/toolbar/InlineMemo.ts
@@ -16,7 +16,8 @@ export class InlineMemo extends ToolbarItem {
return;
}
const memoElement = hasClosestByAttribute(range.startContainer, "data-type", "inline-memo");
- if (memoElement) {
+ if (memoElement && memoElement.textContent === range.toString()) {
+ // https://github.com/siyuan-note/siyuan/issues/6569
protyle.toolbar.showRender(protyle, memoElement);
return;
}
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index 8d92a3d20c..b4d3fcb115 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -544,12 +544,18 @@ export class Toolbar {
currentNewNode.style.fontSize === nextNewNode.style.fontSize &&
currentNewNode.style.backgroundColor === nextNewNode.style.backgroundColor) {
// 合并相同的 node
- if (currentNewNode.getAttribute("data-type").indexOf("inline-math") > -1) {
+ const currentType = currentNewNode.getAttribute("data-type")
+ if (currentType.indexOf("inline-math") > -1) {
// 数学公式合并 data-content https://github.com/siyuan-note/siyuan/issues/6028
nextNewNode.setAttribute("data-content", currentNewNode.getAttribute("data-content") + nextNewNode.getAttribute("data-content"));
- } else if (currentNewNode.getAttribute("data-type").indexOf("block-ref") === -1) {
- // 引用不虚合并内容 https://ld246.com/article/1664454663564
+ } else if (currentType.indexOf("block-ref") === -1) {
+ // 引用不需合并内容 https://ld246.com/article/1664454663564
nextNewNode.innerHTML = currentNewNode.innerHTML + nextNewNode.innerHTML;
+ // 如果为备注时,合并备注内容
+ if (currentType.indexOf("inline-memo") > -1) {
+ nextNewNode.setAttribute("data-inline-memo-content", (currentNewNode.getAttribute("data-inline-memo-content") || "") +
+ (nextNewNode.getAttribute("data-inline-memo-content") || ""));
+ }
}
newNodes.splice(i, 1);
i--;