Skip to main content
You must select text in DOC before calling this API; otherwise the call fails.
static getSelectedText(): Promise<APIResponse<string>>;
Returns

Example

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

/**
 * Example: get selected text.
 */
export async function exampleGetSelectedText() {
 const res = await PluginDocAPI.getSelectedText();
 if (!res.success) {
 throw new Error(res.error?.message ?? 'getSelectedText call failed');
 }
 return res.result;
}