Skip to content

Commit

Permalink
fix: 修复清空画布时,历史记录没有清空问题
Browse files Browse the repository at this point in the history
  • Loading branch information
dx123456 authored and Qiu-Jun committed Jul 19, 2024
1 parent bd003b2 commit ae8c120
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/plugin/HistoryPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ type extendCanvas = {

class HistoryPlugin implements IPluginTempl {
static pluginName = 'HistoryPlugin';
static apis = ['undo', 'redo'];
static events = ['historyUpdate'];
static apis = ['undo', 'redo', 'historyUpdate'];
static events = [];
hotkeys: string[] = ['ctrl+z', 'ctrl+shift+z', '⌘+z', '⌘+shift+z'];
constructor(public canvas: fabric.Canvas & extendCanvas, public editor: IEditor) {
fabric.Canvas.prototype._historyNext = () => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/save.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ const saveWith = debounce(function (type) {
*/
const clear = () => {
canvasEditor.clear();
canvasEditor.canvas.clearHistory(false);
canvasEditor.historyUpdate();
};

const beforeClear = () => {
Expand Down

0 comments on commit ae8c120

Please sign in to comment.