From a834f60a5ee0f84f3367a36e6c276315baa0a91a Mon Sep 17 00:00:00 2001 From: Gene Date: Thu, 9 Jan 2025 18:05:52 +0800 Subject: [PATCH] fix: resetCanvasState indirectly called in useHistory, resets the isBlock status (#1009) --- packages/canvas/DesignCanvas/src/api/useCanvas.js | 1 + packages/toolbars/redoundo/src/composable/useHistory.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/canvas/DesignCanvas/src/api/useCanvas.js b/packages/canvas/DesignCanvas/src/api/useCanvas.js index dfe347fd8..34308096f 100644 --- a/packages/canvas/DesignCanvas/src/api/useCanvas.js +++ b/packages/canvas/DesignCanvas/src/api/useCanvas.js @@ -560,6 +560,7 @@ export default function () { setSaved, clearCanvas, getPageSchema, + resetCanvasState, resetPageCanvasState, resetBlockCanvasState, clearCurrentState, diff --git a/packages/toolbars/redoundo/src/composable/useHistory.js b/packages/toolbars/redoundo/src/composable/useHistory.js index 0ac76af49..52860d20d 100644 --- a/packages/toolbars/redoundo/src/composable/useHistory.js +++ b/packages/toolbars/redoundo/src/composable/useHistory.js @@ -61,7 +61,8 @@ const push = (schema) => { const go = (addend, valid) => { historyState.index = historyState.index + addend - useCanvas().importSchema(string2Schema(list[historyState.index])) + const { pageState, resetCanvasState } = useCanvas() + resetCanvasState({ ...pageState, pageSchema: string2Schema(list[historyState.index]) }) // 不是锁定状态,撤销操作后,传递第二个标识位,将 list 的长度减一,置灰 undoredo 操作按钮 if (typeof valid === 'boolean') {