Skip to main content
When operating on the currently opened note, changes are typically written to an in-memory cache and are not persisted to the file immediately. If you call file-related APIs without saving (e.g. replaceElements, insertElementsmodifyElements etc.), the data state may become inconsistent. It is recommended to call saveCurrentNote first to persist cached data to the file, and then perform file-level read/write operations.
static saveCurrentNote(): Promise<APIResponse<boolean>>;
Returns

Example

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

/**
 * Example: save the current note.
 */
export async function exampleSaveCurrentNote() {
 const res = await PluginNoteAPI.saveCurrentNote();
 if (!res.success) {
 throw new Error(res.error?.message ?? 'saveCurrentNote call failed');
 }
 return res.result;
}