跳转到主要内容
该接口只能在 NOTE(笔记)中调用。pngPath 需指向存在且可读的图片文件。
static insertImage(pngPath: string): Promise<APIResponse<boolean>>;
参数
参数类型说明
pngPathstring图片文件路径(需存在且可读)
返回

示例

import { PluginNoteAPI } from 'sn-plugin-lib';

/**
 * 插入图片示例。
 */
export async function exampleInsertImage() {
  const pngPath = '/storage/emulated/0/Note/demo.png';

  const res = await PluginNoteAPI.insertImage(pngPath);
  if (!res.success) {
    throw new Error(res.error?.message ?? 'insertImage 调用失败');
  }

  return res.result;
}