From a93baaf00a837e76b92d7959e5fed000289feb72 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 13 Mar 2025 11:58:11 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/14326 --- app/src/protyle/wysiwyg/transaction.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts index 61cf7f50e..6ac0efcc4 100644 --- a/app/src/protyle/wysiwyg/transaction.ts +++ b/app/src/protyle/wysiwyg/transaction.ts @@ -455,6 +455,19 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo: return; } if (operation.action === "update") { + // 缩放后仅更新局部 https://github.com/siyuan-note/siyuan/issues/14326 + if (updateElements.length === 0) { + const newUpdateElement = protyle.wysiwyg.element.firstElementChild + const newUpdateId = newUpdateElement.getAttribute("data-node-id") + const tempElement = document.createElement("template"); + tempElement.innerHTML = operation.data; + const newTempElement = tempElement.content.querySelector(`[data-node-id="${newUpdateId}"]`); + if (newTempElement) { + updateElements.push(newUpdateElement) + operation.data = newTempElement.outerHTML + operation.id = newUpdateId + } + } if (updateElements.length > 0) { updateBlock(updateElements, protyle, operation, isUndo); } else if (isUndo) {