Skip to content

Commit 0f4a2cb

Browse files
committed
fix(editor): update mutation type for undo-redo
1 parent 51c0ab1 commit 0f4a2cb

File tree

1 file changed

+6
-2
lines changed
  • front-end/h5/src/store/plugins/undo-redo

1 file changed

+6
-2
lines changed

front-end/h5/src/store/plugins/undo-redo/index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import undoRedoHistory from './History'
55
* #!zh: setElementCommonStyle 因为是在 mousemove 时候触发的,执行过于频繁,没有必要计入history,因此需要过滤。
66
* 主要记录:拖动完成时候(mouseup)时候的位置、删除元素之前的状态等
77
*/
8-
const unRecordHistoryMutationTypes = ['editor/setElementCommonStyle']
8+
// const unRecordHistoryMutationTypes = ['editor/setElementCommonStyle']
9+
const recordHistoryMutationTypes = [
10+
'editor/recordRect',
11+
'editor/elementManager'
12+
]
913

1014
const undoRedoPlugin = (store) => {
1115
// initialize and save the starting stage
@@ -15,7 +19,7 @@ const undoRedoPlugin = (store) => {
1519

1620
store.subscribe((mutation, state) => {
1721
const { type } = mutation
18-
if (unRecordHistoryMutationTypes.includes(type)) return
22+
if (!recordHistoryMutationTypes.includes(type)) return
1923
// is called AFTER every mutation
2024
undoRedoHistory.addState(cloneDeep(state))
2125
})

0 commit comments

Comments
 (0)