Skip to content

Commit 4026a71

Browse files
committed
2 parents bd003b2 + 4d22bc5 commit 4026a71

File tree

4 files changed

+23
-19
lines changed

4 files changed

+23
-19
lines changed

packages/core/ServersPlugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ class ServersPlugin {
132132
// 加载后钩子
133133
this.editor.hooksEntity.hookImportAfter.callAsync(jsonFile, () => {
134134
// 修复导入带水印的json无法清除问题 #359
135-
this.editor?.updateDrawStatus(!!temp['overlayImage']);
135+
this.editor?.updateDrawStatus &&
136+
typeof this.editor.updateDrawStatus === 'function' &&
137+
this.editor.updateDrawStatus(!!temp['overlayImage']);
136138
this.canvas.renderAll();
137139
callback && callback();
138140
this.editor.emit('loadJson');

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/align.vue

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,44 @@
1414
<!-- 水平对齐 -->
1515
<Tooltip :content="$t('attrSeting.align.left')">
1616
<Button @click="left" size="small" type="text">
17-
<leftIcon class="icon"></leftIcon>
17+
<leftIcon />
1818
</Button>
1919
</Tooltip>
2020
<Tooltip :content="$t('attrSeting.align.centerX')">
2121
<Button @click="xcenter" size="small" type="text">
22-
<centerxIcon class="icon"></centerxIcon>
22+
<centerxIcon />
2323
</Button>
2424
</Tooltip>
2525
<Tooltip :content="$t('attrSeting.align.right')">
2626
<Button @click="right" size="small" type="text">
27-
<rightIcon class="icon"></rightIcon>
27+
<rightIcon />
2828
</Button>
2929
</Tooltip>
3030
<!-- 垂直对齐 -->
3131
<Tooltip :content="$t('attrSeting.align.top')">
3232
<Button @click="top" size="small" type="text">
33-
<topIcon class="icon"></topIcon>
33+
<topIcon />
3434
</Button>
3535
</Tooltip>
3636
<Tooltip :content="$t('attrSeting.align.centerY')">
3737
<Button @click="ycenter" size="small" type="text">
38-
<centeryIcon class="icon"></centeryIcon>
38+
<centeryIcon />
3939
</Button>
4040
</Tooltip>
4141
<Tooltip :content="$t('attrSeting.align.bottom')">
4242
<Button @click="bottom" size="small" type="text">
43-
<bottomIcon class="icon"></bottomIcon>
43+
<bottomIcon />
4444
</Button>
4545
</Tooltip>
4646
<!-- 平均对齐 -->
4747
<Tooltip :content="$t('attrSeting.align.averageX')">
4848
<Button @click="xequation" size="small" type="text">
49-
<sxIcon class="icon"></sxIcon>
49+
<sxIcon />
5050
</Button>
5151
</Tooltip>
5252
<Tooltip :content="$t('attrSeting.align.averageY')">
5353
<Button @click="yequation" size="small" type="text">
54-
<syIcon class="icon"></syIcon>
54+
<syIcon />
5555
</Button>
5656
</Tooltip>
5757
</div>
@@ -62,17 +62,17 @@
6262
<script name="Align" setup>
6363
import useSelect from '@/hooks/select';
6464

65-
import leftIcon from '@/assets/icon/left.svg?component';
66-
import rightIcon from '@/assets/icon/right.svg?component';
65+
import leftIcon from '@/assets/icon/left.svg';
66+
import rightIcon from '@/assets/icon/right.svg';
6767

68-
import topIcon from '@/assets/icon/top.svg?component';
69-
import bottomIcon from '@/assets/icon/bottom.svg?component';
68+
import topIcon from '@/assets/icon/top.svg';
69+
import bottomIcon from '@/assets/icon/bottom.svg';
7070

71-
import sxIcon from '@/assets/icon/sx.svg?component';
72-
import syIcon from '@/assets/icon/sy.svg?component';
71+
import sxIcon from '@/assets/icon/sx.svg';
72+
import syIcon from '@/assets/icon/sy.svg';
7373

74-
import centerxIcon from '@/assets/icon/centerx.svg?component';
75-
import centeryIcon from '@/assets/icon/centery.svg?component';
74+
import centerxIcon from '@/assets/icon/centerx.svg';
75+
import centeryIcon from '@/assets/icon/centery.svg';
7676

7777
const { mixinState, canvasEditor } = useSelect();
7878

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)