@8btc/xcanvas 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,27 +44,31 @@ export interface XCanvasAPI {
|
|
|
44
44
|
rawApi: ExcalidrawImperativeAPI;
|
|
45
45
|
/** 在控制台中打印出当前canvas状态,用于调试 */
|
|
46
46
|
__printCanvasInfo: () => void;
|
|
47
|
-
/**
|
|
48
|
-
|
|
47
|
+
/** 插入多张图片 */
|
|
48
|
+
insertImgs: (url: string[]) => Promise<void>;
|
|
49
|
+
/** 追加多张图片到画布末尾, 如果画布中存在对应图片(url相同),则不做任何操作 */
|
|
50
|
+
appendImgs: (urls: string[]) => Promise<void>;
|
|
49
51
|
/** 保存canvas数据 */
|
|
50
52
|
save: () => any;
|
|
51
53
|
/** 从数据中恢复canvas画布 */
|
|
52
54
|
restore: (data: any) => Promise<void>;
|
|
53
55
|
/**
|
|
54
56
|
* 对整个canvas进行截图,生成缩略图
|
|
55
|
-
* @returns
|
|
57
|
+
* @returns 同 `HTMLCanvasElement.toDataURL()` base64 编码的 png 文件,
|
|
56
58
|
*/
|
|
57
59
|
captureCanvas: () => Promise<string>;
|
|
60
|
+
/**
|
|
61
|
+
* 将指定的 loading 元素替换为真实图片
|
|
62
|
+
*/
|
|
63
|
+
replaceLoadingWithImages: (id: string, url: string) => Promise<void>;
|
|
58
64
|
}
|
|
59
|
-
```
|
|
60
65
|
|
|
61
|
-
### 可以监听的事件
|
|
62
|
-
|
|
63
|
-
```typescript
|
|
64
66
|
export type Events = {
|
|
65
67
|
"chat-to-edit": {
|
|
66
68
|
type: "chat-to-edit";
|
|
67
69
|
url: string;
|
|
70
|
+
prompt: string;
|
|
71
|
+
id: string;
|
|
68
72
|
};
|
|
69
73
|
};
|
|
70
74
|
```
|