Skip to main content
This API supports undo/redo in NOTE.This API modifies the TextBox selected by the current lasso selection. The lasso selection must contain exactly one TextBox; otherwise the call fails. It is recommended to call this API from the plugin UI entered via a lasso toolbar button.
static modifyLassoText(textBox: {
 fontSize?: number;
 fontPath?: string;
 textContentFull: string;
 textRect: Rect;
 textDigestData?: string;
 textAlign?: number;
 textBold?: number;
 textItalics?: number;
 textFrameWidthType?: number;
 textFrameWidth?: number;
 textFrameStyle?: number;
 textEditable?: number;
}): Promise<APIResponse<boolean>>;
Parameters
ParameterTypeDescription
textBox.textContentFullstringText content (required, non-empty)
textBox.textRectRectTextBox rectangle (required; must be non-zero area)
textBox.fontSizenumberFont size (optional; must be positive)
textBox.fontPathstringFont path (optional)
textBox.textDigestDatastringDigest data (optional)
textBox.textAlignnumberAlignment (optional)
textBox.textBoldnumberBold (optional)
textBox.textItalicsnumberItalic (optional)
textBox.textFrameWidthTypenumberBorder width type (optional)
textBox.textFrameWidthnumberBorder width (optional)
textBox.textFrameStylenumberBorder style (optional)
textBox.textEditablenumberEditable state (optional)
Returns

Example

import { PluginNoteAPI, type TextBox } from 'sn-plugin-lib';

/**
* Example: modify a lasso-selected TextBox (read first, then update content).
 */
export async function exampleModifyLassoText() {
 const listRes = await PluginNoteAPI.getLassoText();
 if (!listRes.success) {
 throw new Error(listRes.error?.message ?? 'getLassoText call failed');
 }

 const textBoxes = (listRes.result ?? []) as TextBox[];
 const first = textBoxes[0];
 if (!first) {
 return false;
 }

 const res = await PluginNoteAPI.modifyLassoText({
 ...first,
 textContentFull: 'Updated by plugin',
 });

 if (!res.success) {
 throw new Error(res.error?.message ?? 'modifyLassoText call failed');
 }
 return res.result;
}