From 9010399d76b96b93ef265cc2f8ae7d7512fc7452 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 19 Jun 2024 11:10:38 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/11757 --- app/src/protyle/wysiwyg/commonHotkey.ts | 1 + app/src/protyle/wysiwyg/index.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/wysiwyg/commonHotkey.ts b/app/src/protyle/wysiwyg/commonHotkey.ts index 9af51bc75..165fb05cf 100644 --- a/app/src/protyle/wysiwyg/commonHotkey.ts +++ b/app/src/protyle/wysiwyg/commonHotkey.ts @@ -320,6 +320,7 @@ export const alignImgLeft = (protyle: IProtyle, nodeElement: Element, assetEleme nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss")); assetElements.forEach((item: HTMLElement) => { item.style.minWidth = ""; + // 兼容历史居中问题 item.style.display = ""; }); updateTransaction(protyle, id, nodeElement.outerHTML, html); diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 4d778d5ac..a125daefe 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -630,7 +630,7 @@ export class WYSIWYG { dragElement.parentElement.parentElement.style.width = ""; } if (moveEvent.clientX > x - dragWidth + 8 && moveEvent.clientX < mostRight) { - if ((dragElement.tagName === "IMG" && dragElement.parentElement.parentElement.style.display !== "block") || !isCenter) { + if ((dragElement.tagName === "IMG" && !dragElement.parentElement.parentElement.style.minWidth) || !isCenter) { dragElement.style.width = Math.max(17, dragWidth + (moveEvent.clientX - x)) + "px"; } else { dragElement.style.width = Math.max(17, dragWidth + (moveEvent.clientX - x) * 2) + "px";