Skip to content

Commit

Permalink
fix(canvas): clipboard init error
Browse files Browse the repository at this point in the history
  • Loading branch information
liujuping committed Jan 15, 2024
1 parent 8931d83 commit 1393a8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/designer/src/designer/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ class Clipboard implements IClipboard {
}
const copyPaster = document.createElement<'textarea'>('textarea');
copyPaster.style.cssText = 'position: absolute;left: -9999px;top:-100px';
document.body.appendChild(copyPaster);
if (document.body) {
document.body.appendChild(copyPaster);
} else {
document.addEventListener('DOMContentLoaded', () => {
document.body.appendChild(copyPaster);
});
}
const dispose = this.initCopyPaster(copyPaster);
return () => {
dispose();
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/shell/api/material.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface IPublicApiMaterial {
* set data for Assets
* @returns void
*/
setAssets(assets: IPublicTypeAssetsJson): void;
setAssets(assets: IPublicTypeAssetsJson): Promise<void>;

/**
* 获取「资产包」结构
Expand Down

0 comments on commit 1393a8e

Please sign in to comment.