Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/17814

Vanessac80222f01a1d
diff --git a/app/src/constants.ts b/app/src/constants.ts
index f18432ff80..1b7008119c 100644
--- a/app/src/constants.ts
+++ b/app/src/constants.ts
@@ -67,6 +67,9 @@ export abstract class Constants {
public static readonly CUSTOM_SY_AV_VIEW: string = "custom-sy-av-view";
public static readonly CUSTOM_SY_TITLE_EMPTY: string = "custom-sy-title-empty";
+ // 临时标记 DOM 属性以辅助完成其功能
+ public static readonly ATTRIBUTE_EDITING = "data-editing";
+
// size
public static readonly SIZE_DATABASE_MAZ_SIZE: number = 102400;
public static readonly SIZE_UPLOAD_TIP_SIZE: number = 268435456; // 256 M
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index ccf0da562a..11ff857d49 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -862,6 +862,8 @@ export class Toolbar {
if (!nodeElement) {
return;
}
+ // https://github.com/siyuan-note/siyuan/issues/17814
+ nodeElement.setAttribute(Constants.ATTRIBUTE_EDITING, "true");
hideElements(["hint", "select"], protyle);
window.siyuan.menus.menu.remove();
const id = nodeElement.getAttribute("data-node-id");
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index f2cf4473c6..5cba37a63e 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -110,6 +110,10 @@ const promiseTransaction = () => {
let updatedEmbed = false;
const updateHTML = (item: Element, html: string) => {
+ if (item.getAttribute(Constants.ATTRIBUTE_EDITING) === "true") {
+ item.removeAttribute(Constants.ATTRIBUTE_EDITING);
+ return;
+ }
const tempElement = document.createElement("template");
tempElement.innerHTML = protyle.lute.SpinBlockDOM(html);
tempElement.content.querySelectorAll(".protyle-wysiwyg--select").forEach(selectItem => {