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/17555

Vanessa0dc545607b28
diff --git a/app/src/protyle/breadcrumb/action.ts b/app/src/protyle/breadcrumb/action.ts
index de725a751f..2df89cdfc2 100644
--- a/app/src/protyle/breadcrumb/action.ts
+++ b/app/src/protyle/breadcrumb/action.ts
@@ -100,7 +100,7 @@ export const fullscreen = (element: Element, btnElement?: Element) => {
};
export const updateReadonly = (target: Element, protyle: IProtyle) => {
- if (!window.siyuan.config.readonly) {
+ if (!window.siyuan.config.readonly && protyle.element.getAttribute("disabled-forever") !== "true") {
const isReadonly = target.querySelector("use").getAttribute("xlink:href") !== "#iconUnlock";
if (window.siyuan.config.editor.readOnly) {
if (isReadonly) {
diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.ts
index 306da01788..7ee24ce91a 100644
--- a/app/src/protyle/breadcrumb/index.ts
+++ b/app/src/protyle/breadcrumb/index.ts
@@ -573,6 +573,9 @@ ${padHTML}
}
public render(protyle: IProtyle, update = false, nodeElement?: Element | false) {
+ if (protyle.element.getAttribute("disabled-forever") === "true") {
+ return;
+ }
/// #if !MOBILE
let range: Range;
let blockElement: Element;
diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts
index 783522e4ff..31d053e225 100644
--- a/app/src/protyle/util/onGet.ts
+++ b/app/src/protyle/util/onGet.ts
@@ -251,7 +251,12 @@ const setHTML = (options: {
if (protyle.breadcrumb) {
protyle.breadcrumb.element.nextElementSibling.textContent = "";
}
- protyle.element.removeAttribute("disabled-forever");
+ if (protyle.element.hasAttribute("disabled-forever")) {
+ if (protyle.wysiwyg.element.getAttribute("custom-sy-readonly") === "false") {
+ protyle.disabled = false;
+ }
+ protyle.element.removeAttribute("disabled-forever");
+ }
if (options.action.includes(Constants.CB_GET_OPENNEW) && window.siyuan.config.editor.readOnly && !window.siyuan.config.readonly) {
enableProtyle(protyle);
} else {