调用该接口会将贴纸插入到当前打开文件当前页当前图层。
static insertSticker(path: string): Promise<APIResponse<boolean>>;
参数
| 参数 | 类型 | 说明 |
|---|
path | string | 贴纸文件(.sticker)路径 |
返回
import { PluginCommAPI } from 'sn-plugin-lib';
/**
* 插入贴纸的示例。
*/
export async function exampleInsertSticker() {
const stickerPath = '/storage/emulated/0/Note/stickers/demo.sticker';
const res = await PluginCommAPI.insertSticker(stickerPath);
if (!res.success) {
throw new Error(res.error?.message ?? 'insertSticker 调用失败');
}
return res.result;
}