This commit is contained in:
Vanessa 2022-10-26 23:12:41 +08:00
parent 4a2a422c69
commit 9ae773dd3c
3 changed files with 12 additions and 15 deletions

View file

@ -79,6 +79,14 @@ export class Layout {
item.element.style.width = ""; item.element.style.width = "";
item.element.style.height = ""; item.element.style.height = "";
item.element.classList.add("fn__flex-1"); 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); item.element.after(child.element);
return true; return true;
} }

View file

@ -74,6 +74,8 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
// up // up
if (element.scrollTop < element.clientHeight && if (element.scrollTop < element.clientHeight &&
protyle.wysiwyg.element.firstElementChild.getAttribute("data-eof") !== "true") { 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.contentElement.style.overflow = "hidden";
protyle.wysiwyg.element.setAttribute("data-top", element.scrollTop.toString()); protyle.wysiwyg.element.setAttribute("data-top", element.scrollTop.toString());
fetchPost("/api/filetree/getDoc", { fetchPost("/api/filetree/getDoc", {
@ -83,6 +85,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {
size: Constants.SIZE_GET, size: Constants.SIZE_GET,
}, getResponse => { }, getResponse => {
protyle.contentElement.style.overflow = ""; protyle.contentElement.style.overflow = "";
protyle.contentElement.style.width = "";
onGet(getResponse, protyle, [Constants.CB_GET_BEFORE, Constants.CB_GET_UNCHANGEID]); onGet(getResponse, protyle, [Constants.CB_GET_BEFORE, Constants.CB_GET_UNCHANGEID]);
}); });
} }

View file

@ -97,21 +97,7 @@ export const setPadding = (protyle: IProtyle) => {
} else { } else {
protyle.wysiwyg.element.style.padding = `16px ${min16}px ${bottomHeight} ${min24}px`; protyle.wysiwyg.element.style.padding = `16px ${min16}px ${bottomHeight} ${min24}px`;
} }
if (!isMobile()) { protyle.wysiwyg.element.style.transition = ""; // addWnd 时防止向右分屏,左侧文档抖动,移除动画
// 防止右侧分屏后左侧页签抖动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 = "";
}
}
}
if (window.siyuan.config.editor.codeSyntaxHighlightLineNum) { if (window.siyuan.config.editor.codeSyntaxHighlightLineNum) {
setTimeout(() => { // https://github.com/siyuan-note/siyuan/issues/5612 setTimeout(() => { // https://github.com/siyuan-note/siyuan/issues/5612
protyle.wysiwyg.element.querySelectorAll('.code-block [contenteditable="true"]').forEach((block: HTMLElement) => { protyle.wysiwyg.element.querySelectorAll('.code-block [contenteditable="true"]').forEach((block: HTMLElement) => {