Skip to content

Commit adb9f6b

Browse files
liujupingJackLian
authored andcommitted
fix(canvas): clipboard init error
1 parent 1132a30 commit adb9f6b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

packages/designer/src/designer/clipboard.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ class Clipboard implements IClipboard {
7373
}
7474
const copyPaster = document.createElement<'textarea'>('textarea');
7575
copyPaster.style.cssText = 'position: absolute;left: -9999px;top:-100px';
76-
document.body.appendChild(copyPaster);
76+
if (document.body) {
77+
document.body.appendChild(copyPaster);
78+
} else {
79+
document.addEventListener('DOMContentLoaded', () => {
80+
document.body.appendChild(copyPaster);
81+
});
82+
}
7783
const dispose = this.initCopyPaster(copyPaster);
7884
return () => {
7985
dispose();

packages/types/src/shell/api/material.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface IPublicApiMaterial {
1515
* set data for Assets
1616
* @returns void
1717
*/
18-
setAssets(assets: IPublicTypeAssetsJson): void;
18+
setAssets(assets: IPublicTypeAssetsJson): Promise<void>;
1919

2020
/**
2121
* 获取「资产包」结构

0 commit comments

Comments
 (0)