From 26764ff9f6a8e99902c540c446fd1ada2cd3c6f9 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 2 Apr 2024 23:58:00 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/10844 --- app/src/protyle/wysiwyg/index.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 57bcfc5b5..c3f145835 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -414,13 +414,18 @@ export class WYSIWYG { const dragElement = target.parentElement; const oldWidth = dragElement.clientWidth; const dragColId = dragElement.getAttribute("data-col-id"); - let newWidth: string; + let newWidth: number; const scrollElement = nodeElement.querySelector(".av__scroll"); const contentRect = protyle.contentElement.getBoundingClientRect(); documentSelf.onmousemove = (moveEvent: MouseEvent) => { - newWidth = Math.max(oldWidth + (moveEvent.clientX - event.clientX), 25) + "px"; + newWidth = Math.max(oldWidth + (moveEvent.clientX - event.clientX), 25); scrollElement.querySelectorAll(".av__row, .av__row--footer").forEach(item => { - (item.querySelector(`[data-col-id="${dragColId}"]`) as HTMLElement).style.width = newWidth; + const cellElement = item.querySelector(`[data-col-id="${dragColId}"]`) as HTMLElement + if (cellElement.previousElementSibling) { + cellElement.style.width = newWidth + "px"; + } else { + cellElement.style.width = newWidth + 24 + "px"; + } }); stickyRow(nodeElement, contentRect, "bottom"); }; @@ -431,7 +436,7 @@ export class WYSIWYG { documentSelf.ondragstart = null; documentSelf.onselectstart = null; documentSelf.onselect = null; - if (!newWidth || newWidth === oldWidth + "px") { + if (!newWidth || newWidth === oldWidth) { return; } transaction(protyle, [{