必须先在文档应用中选中文本后才能调用该接口,否则调用会失败。
APIResponse<string>:result为最近一次选中的文本内容
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
获取最近一次选中的文本内容。
static getLastSelectedText(): Promise<APIResponse<string>>;
APIResponse<string>:result 为最近一次选中的文本内容import { PluginDocAPI } from 'sn-plugin-lib';
/**
* 获取最近一次选中文本的示例。
*/
export async function exampleGetLastSelectedText() {
const res = await PluginDocAPI.getLastSelectedText();
if (!res.success) {
throw new Error(res.error?.message ?? 'getLastSelectedText 调用失败');
}
return res.result;
}