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

Vanessac6122f2da1f0
diff --git a/app/src/protyle/ui/initUI.ts b/app/src/protyle/ui/initUI.ts
index 42f88c0c19..1d90404e11 100644
--- a/app/src/protyle/ui/initUI.ts
+++ b/app/src/protyle/ui/initUI.ts
@@ -141,13 +141,6 @@ export const setPadding = (protyle: IProtyle) => {
min24 = 96;
}
}
- if (protyle.options.render.background) {
- protyle.background.element.lastElementChild.setAttribute("style", `left:${min16}px`);
- protyle.background.element.querySelector(".protyle-background__img .protyle-icons").setAttribute("style", `right:${min16}px`);
- }
- if (protyle.options.render.title) {
- protyle.title.element.style.margin = `16px ${min16}px 0 ${min24}px`;
- }
let bottomHeight = "16px";
if (protyle.options.typewriterMode) {
if (isMobile()) {
@@ -157,10 +150,26 @@ export const setPadding = (protyle: IProtyle) => {
}
}
if (protyle.options.backlinkData) {
+ if ((min16 === min24 && protyle.wysiwyg.element.style.padding === `4px ${min16}px`) ||
+ (min16 !== min24 && protyle.wysiwyg.element.style.padding === `4px ${min16}px 4px ${min24}px`)) {
+ return true;
+ }
protyle.wysiwyg.element.style.padding = `4px ${min16}px 4px ${min24}px`;
} else {
+ // https://github.com/siyuan-note/siyuan/issues/8859
+ if ((min16 === min24 && protyle.wysiwyg.element.style.padding === `16px ${min16}px ${bottomHeight}`) ||
+ (min16 !== min24 && protyle.wysiwyg.element.style.padding === `16px ${min16}px ${bottomHeight} ${min24}px`)) {
+ return true;
+ }
protyle.wysiwyg.element.style.padding = `16px ${min16}px ${bottomHeight} ${min24}px`;
}
+ if (protyle.options.render.background) {
+ protyle.background.element.lastElementChild.setAttribute("style", `left:${min16}px`);
+ protyle.background.element.querySelector(".protyle-background__img .protyle-icons").setAttribute("style", `right:${min16}px`);
+ }
+ if (protyle.options.render.title) {
+ protyle.title.element.style.margin = `16px ${min16}px 0 ${min24}px`;
+ }
if (window.siyuan.config.editor.codeSyntaxHighlightLineNum) {
setTimeout(() => { // https://github.com/siyuan-note/siyuan/issues/5612
protyle.wysiwyg.element.querySelectorAll('.code-block [contenteditable="true"]').forEach((block: HTMLElement) => {
diff --git a/app/src/protyle/util/resize.ts b/app/src/protyle/util/resize.ts
index bda7887e67..9e4548371a 100644
--- a/app/src/protyle/util/resize.ts
+++ b/app/src/protyle/util/resize.ts
@@ -5,7 +5,9 @@ import {Constants} from "../../constants";
export const resize = (protyle: IProtyle) => {
hideElements(["gutter"], protyle);
- setPadding(protyle);
+ if (setPadding(protyle)) {
+ return;
+ }
// 不能 clearTimeout,否则 split 时左侧无法 resize
window.setTimeout(() => {
if (typeof echarts !== "undefined") {