You must select text in DOC before calling this API; otherwise the call will fail.
APIResponse<string>:resultis the last selected text content
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Get the last selected text content.
static getLastSelectedText(): Promise<APIResponse<string>>;
APIResponse<string>:
result is the last selected text contentimport { PluginDocAPI } from 'sn-plugin-lib';
/**
* Example: get the last selected text.
*/
export async function exampleGetLastSelectedText() {
const res = await PluginDocAPI.getLastSelectedText();
if (!res.success) {
throw new Error(res.error?.message ?? 'getLastSelectedText call failed');
}
return res.result;
}