Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/5468

Vanessada2b19c2fdac
diff --git a/app/src/config/editor.ts b/app/src/config/editor.ts
index 7feb41b57e..edb74f9d26 100644
--- a/app/src/config/editor.ts
+++ b/app/src/config/editor.ts
@@ -196,6 +196,11 @@ export const editor = {
getAllModels().editor.forEach((item) => {
item.editor.reload();
setPadding(item.editor.protyle);
+ if (window.siyuan.config.editor.fullWidth) {
+ item.editor.protyle.wysiwyg.element.setAttribute("data-fullwidth", "true");
+ } else {
+ item.editor.protyle.wysiwyg.element.removeAttribute("data-fullwidth");
+ }
});
setInlineStyle();
}
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index e548a76f0e..21d03a71a2 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -78,6 +78,9 @@ export class WYSIWYG {
if (window.siyuan.config.editor.displayBookmarkIcon) {
this.element.classList.add("protyle-wysiwyg--attr");
}
+ if (window.siyuan.config.editor.fullWidth) {
+ this.element.setAttribute("data-fullwidth", "true");
+ }
this.bindEvent(protyle);
keydown(protyle, this.element);
dropEvent(protyle, this.element);
@@ -87,14 +90,14 @@ export class WYSIWYG {
const ialKeys = Object.keys(ial);
for (let i = 0; i < this.element.attributes.length; i++) {
const oldKey = this.element.attributes[i].nodeName;
- if (!["type", "class", "spellcheck", "contenteditable", "data-doc-type", "style"].includes(oldKey) &&
+ if (!["type", "class", "spellcheck", "contenteditable", "data-doc-type", "data-fullwidth", "style"].includes(oldKey) &&
!ialKeys.includes(oldKey)) {
this.element.removeAttribute(oldKey);
i--;
}
}
ialKeys.forEach((key: string) => {
- if (!["title-img", "title", "updated", "icon", "id", "type", "class", "spellcheck", "contenteditable", "data-doc-type", "style"].includes(key)) {
+ if (!["title-img", "title", "updated", "icon", "id", "type", "class", "spellcheck", "contenteditable", "data-doc-type", "data-fullwidth", "style"].includes(key)) {
this.element.setAttribute(key, ial[key]);
}
});