diff --git a/app/src/layout/index.ts b/app/src/layout/index.ts index 9d0740b87..5ff3dd580 100644 --- a/app/src/layout/index.ts +++ b/app/src/layout/index.ts @@ -79,6 +79,14 @@ export class Layout { item.element.style.width = ""; item.element.style.height = ""; item.element.classList.add("fn__flex-1"); + if (this.direction === "lr") { + // 向右分屏,左侧文档抖动,移除动画和边距 + item.element.querySelectorAll(".protyle-wysiwyg").forEach((element: HTMLElement) => { + element.style.transition = "none" + element.style.paddingRight = "16px"; + element.style.paddingLeft = "24px"; + }); + } item.element.after(child.element); return true; } diff --git a/app/src/protyle/scroll/event.ts b/app/src/protyle/scroll/event.ts index 56a7834d5..436df0a76 100644 --- a/app/src/protyle/scroll/event.ts +++ b/app/src/protyle/scroll/event.ts @@ -74,6 +74,8 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => { // up if (element.scrollTop < element.clientHeight && protyle.wysiwyg.element.firstElementChild.getAttribute("data-eof") !== "true") { + // 禁用滚动时会产生抖动 https://ld246.com/article/1666717094418 + protyle.contentElement.style.width = (protyle.contentElement.clientWidth) + "px"; protyle.contentElement.style.overflow = "hidden"; protyle.wysiwyg.element.setAttribute("data-top", element.scrollTop.toString()); fetchPost("/api/filetree/getDoc", { @@ -83,6 +85,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => { size: Constants.SIZE_GET, }, getResponse => { protyle.contentElement.style.overflow = ""; + protyle.contentElement.style.width = ""; onGet(getResponse, protyle, [Constants.CB_GET_BEFORE, Constants.CB_GET_UNCHANGEID]); }); } diff --git a/app/src/protyle/ui/initUI.ts b/app/src/protyle/ui/initUI.ts index 5d7ac0d15..08b101349 100644 --- a/app/src/protyle/ui/initUI.ts +++ b/app/src/protyle/ui/initUI.ts @@ -97,21 +97,7 @@ export const setPadding = (protyle: IProtyle) => { } else { protyle.wysiwyg.element.style.padding = `16px ${min16}px ${bottomHeight} ${min24}px`; } - if (!isMobile()) { - // 防止右侧分屏后,左侧页签抖动;10 为滚动条宽度 - if (!protyle.options.backlinkData && // https://github.com/siyuan-note/siyuan/issues/6099 - !window.siyuan.config.editor.fullWidth) { - protyle.wysiwyg.element.style.width = (protyle.element.clientWidth - 10) + "px"; - if (protyle.options.render.title) { - protyle.title.element.style.width = (protyle.element.clientWidth - min16 - min24 - 10) + "px"; - } - } else { - protyle.wysiwyg.element.style.width = ""; - if (protyle.options.render.title) { - protyle.title.element.style.width = ""; - } - } - } + protyle.wysiwyg.element.style.transition = ""; // addWnd 时防止向右分屏,左侧文档抖动,移除动画 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) => {