Skip to content

Commit dddafdf

Browse files
dx123456Qiu-Jun
authored andcommitted
fix: 修复清空画布时,历史记录没有清空问题
1 parent 596e54f commit dddafdf

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/core/plugin/HistoryPlugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ type extendCanvas = {
2121

2222
class HistoryPlugin implements IPluginTempl {
2323
static pluginName = 'HistoryPlugin';
24-
static apis = ['undo', 'redo'];
25-
static events = ['historyUpdate'];
24+
static apis = ['undo', 'redo', 'historyUpdate'];
25+
static events = [];
2626
hotkeys: string[] = ['ctrl+z', 'ctrl+shift+z', '⌘+z', '⌘+shift+z'];
2727
constructor(public canvas: fabric.Canvas & extendCanvas, public editor: IEditor) {
2828
fabric.Canvas.prototype._historyNext = () => {

src/components/save.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ const saveWith = debounce(function (type) {
9999
*/
100100
const clear = () => {
101101
canvasEditor.clear();
102+
canvasEditor.canvas.clearHistory(false);
103+
canvasEditor.historyUpdate();
102104
};
103105
104106
const beforeClear = () => {

0 commit comments

Comments
 (0)