This commit is contained in:
Vanessa 2023-08-03 21:43:04 +08:00
parent 91b23f0bb0
commit c6122f2da1
2 changed files with 19 additions and 8 deletions

View file

@ -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) => {

View file

@ -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") {