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 sortLayers(notePath: string, page: number, layerIds: number[]): Promise<APIResponse<boolean>>;
参数
| 参数 | 类型 | 说明 |
|---|
notePath | string | 笔记文件路径 |
page | number | 页面索引(从 0 开始) |
layerIds | number[] | 需要排序的图层 ID (0-3)列表(顺序即层级顺序) |
返回
import { PluginFileAPI } from 'sn-plugin-lib';
/**
* 排序图层的示例(传入期望的层级顺序)。
*/
export async function exampleSortLayers() {
const notePath = '/storage/emulated/0/Note/demo.note';
const page = 1;
const res = await PluginFileAPI.sortLayers(notePath, page, [2, 1, 0]);
if (!res.success) {
throw new Error(res.error?.message ?? 'sortLayers 调用失败');
}
return res.result;
}