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

Vanessa5aedda83072f
diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.ts
index 4df0e5f036..5050d41dab 100644
--- a/app/src/protyle/index.ts
+++ b/app/src/protyle/index.ts
@@ -109,6 +109,10 @@ export class Protyle {
this.protyle.element.innerHTML = "";
this.protyle.element.classList.add("protyle");
+ // 启用 RTL 时给 .protyle 元素添加 .rtl 类名,方便主题开发者判断 RTL 方向
+ if (window.siyuan.config.editor.rtl) {
+ this.protyle.element.classList.add("rtl");
+ }
if (mergedOptions.render.breadcrumb) {
this.protyle.element.appendChild(this.protyle.breadcrumb.element.parentElement);
}
diff --git a/app/src/protyle/util/reload.ts b/app/src/protyle/util/reload.ts
index 877d160e31..dae474b60a 100644
--- a/app/src/protyle/util/reload.ts
+++ b/app/src/protyle/util/reload.ts
@@ -24,6 +24,12 @@ export const reloadProtyle = (protyle: IProtyle, focus: boolean, updateReadonly?
} else {
protyle.wysiwyg.element.classList.remove("protyle-wysiwyg--attr");
}
+ // RTL 切换时同步 .protyle 元素的 .rtl 类名
+ if (window.siyuan.config.editor.rtl) {
+ protyle.element.classList.add("rtl");
+ } else {
+ protyle.element.classList.remove("rtl");
+ }
if (protyle.title) {
protyle.title.element.removeAttribute("data-render");
protyle.title.element.setAttribute("spellcheck", window.siyuan.config.editor.spellcheck.toString());