From 63badb1c7467ef1897a3af66650a8fe2979d6bd8 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 29 Oct 2024 12:08:37 +0800 Subject: [PATCH] :lipstick: https://github.com/siyuan-note/siyuan/issues/12911 --- app/src/assets/scss/mobile.scss | 4 ++++ app/src/assets/scss/protyle/_protyle.scss | 2 +- app/src/block/Panel.ts | 2 +- app/src/protyle/scroll/index.ts | 3 --- app/src/protyle/util/resize.ts | 3 +++ app/src/protyle/wysiwyg/index.ts | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/assets/scss/mobile.scss b/app/src/assets/scss/mobile.scss index efd8bbad3..fd7a6f35c 100644 --- a/app/src/assets/scss/mobile.scss +++ b/app/src/assets/scss/mobile.scss @@ -481,6 +481,10 @@ &-background__img img { height: 200px; } + + &-scroll { + right: 0; + } } .av__views .block__icon { diff --git a/app/src/assets/scss/protyle/_protyle.scss b/app/src/assets/scss/protyle/_protyle.scss index 9bb0a2db9..6208b1de1 100644 --- a/app/src/assets/scss/protyle/_protyle.scss +++ b/app/src/assets/scss/protyle/_protyle.scss @@ -6,7 +6,7 @@ .protyle-scroll { --b3-dynamicscroll-width: 200px; position: absolute; - right: 0; + right: 10px; top: 30px; width: 16px; bottom: 9px; // 下图标 hover 时,需要留出一定的空间 diff --git a/app/src/block/Panel.ts b/app/src/block/Panel.ts index e3a3268fe..058eccada 100644 --- a/app/src/block/Panel.ts +++ b/app/src/block/Panel.ts @@ -195,7 +195,7 @@ export class BlockPanel { } // 由于 afterCB 中高度的设定,需在之后再进行设定 // 49 = 16(上图标)+16(下图标)+8(padding)+9(底部距离) - editor.protyle.scroll.element.parentElement.setAttribute("style", `--b3-dynamicscroll-width:${Math.min(editor.protyle.contentElement.clientHeight - 49, 200)}px;${isMobile() ? "" : "right:10px"}`); + editor.protyle.scroll.element.parentElement.setAttribute("style", `--b3-dynamicscroll-width:${Math.min(editor.protyle.contentElement.clientHeight - 49, 200)}px;`); } }); this.editors.push(editor); diff --git a/app/src/protyle/scroll/index.ts b/app/src/protyle/scroll/index.ts index 646949bdb..520c8b899 100644 --- a/app/src/protyle/scroll/index.ts +++ b/app/src/protyle/scroll/index.ts @@ -17,9 +17,6 @@ export class Scroll { constructor(protyle: IProtyle) { this.parentElement = document.createElement("div"); this.parentElement.classList.add("protyle-scroll"); - if (!isMobile()) { - this.parentElement.style.right = "10px"; - } this.parentElement.innerHTML = `
diff --git a/app/src/protyle/util/resize.ts b/app/src/protyle/util/resize.ts index e30f24a70..1cb09df2c 100644 --- a/app/src/protyle/util/resize.ts +++ b/app/src/protyle/util/resize.ts @@ -11,6 +11,9 @@ export const resize = (protyle: IProtyle) => { const MIN_ABS = 4; // 不能 clearTimeout,否则 split 时左侧无法 resize setTimeout(() => { + if (protyle.scroll && protyle.scroll.element.parentElement.getAttribute("style")) { + protyle.scroll.element.parentElement.setAttribute("style", `--b3-dynamicscroll-width:${Math.min(protyle.contentElement.clientHeight - 49, 200)}px`); + } if (!protyle.disabled) { const contentRect = protyle.contentElement.getBoundingClientRect(); protyle.wysiwyg.element.querySelectorAll(".av").forEach((item: HTMLElement) => { diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 68a9f2b7f..134713e6f 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -519,7 +519,7 @@ export class WYSIWYG { } nodeElement.querySelectorAll(".av__row").forEach((rowElement: HTMLElement, index: number) => { if ((newIndex.rowIndex < firstCellIndex.rowIndex && index >= newIndex.rowIndex && index < firstCellIndex.rowIndex) || - (newIndex.rowIndex > dragFillCellIndex.rowIndex && index <= newIndex.rowIndex&& index > dragFillCellIndex.rowIndex)) { + (newIndex.rowIndex > dragFillCellIndex.rowIndex && index <= newIndex.rowIndex && index > dragFillCellIndex.rowIndex)) { rowElement.querySelectorAll(".av__cell").forEach((cellElement: HTMLElement, cellIndex: number) => { if (cellIndex >= firstCellIndex.celIndex && cellIndex <= newIndex.celIndex) { cellElement.classList.add("av__cell--active");