跳转到主要内容
调用该接口会将贴纸插入到当前打开文件当前页当前图层。
static insertSticker(path: string): Promise<APIResponse<boolean>>;
参数
参数类型说明
pathstring贴纸文件(.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;
}