跳转到主要内容
static insertNotePage(params: { notePath: string; page: number; template: string }): Promise<APIResponse<boolean>>;
参数
参数类型说明
params.notePathstring笔记文件路径
params.pagenumber页码(从 0 开始)
params.templatestring模版来源:
- 系统模版:通过 getNoteSystemTemplates 获取,传递其中的模版名称(Templatename)即可创建;
- 自定义模版:传递自定义模版的图片路径,根据图片文件创建笔记。
返回

示例

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

/**
 * 插入新页面的示例。
 */
export async function exampleInsertNotePage() {
  const res = await PluginFileAPI.insertNotePage({
    notePath: '/storage/emulated/0/Note/demo.note',
    page: 2,
    template: 'style_blank',
  });

  if (!res.success) {
    throw new Error(res.error?.message ?? 'insertNotePage 调用失败');
  }
  return res.result;
}