跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.supernote.com/llms.txt

Use this file to discover all available pages before exploring further.

必须先在文档应用中选中文本后才能调用该接口,否则调用会失败。
static getLastSelectedText(): Promise<APIResponse<string>>;
返回

示例

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;
}