跳转到主要内容
static insertKeyWord(notePath: string, page: number, keyword: string):
 Promise<APIResponse<boolean>>;
参数
参数类型说明
notePathstring笔记/文档文件路径
pagenumber页码(从 0 开始)
keywordstring关键字内容
返回

示例

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

/**
 * 插入关键字的示例。
 */
export async function exampleInsertKeyWord() {
  const notePath = '/storage/emulated/0/Note/demo.note';
  const page = 1;
  const keyword = 'TODO';

  const res = await PluginFileAPI.insertKeyWord(notePath, page, keyword);
  if (!res.success) {
    throw new Error(res.error?.message ?? 'insertKeyWord 调用失败');
  }
  return res.result;
}