static insertKeyWord(notePath: string, page: number, keyword: string):
Promise<APIResponse<boolean>>;
| 参数 | 类型 | 说明 |
|---|---|---|
notePath | string | 笔记/文档文件路径 |
page | number | 页码(从 0 开始) |
keyword | string | 关键字内容 |
APIResponse<boolean>:result === true表示插入成功
示例
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;
}