Skip to main content
This API supports undo/redo in NOTE.This API modifies the single link selected by the current lasso selection. You must lasso-select exactly one link first. If there is no lasso selection, the selection is not a link, or the selection contains multiple links, the call fails. It is recommended to call this API from the plugin UI entered via a lasso toolbar button.
static modifyLassoLink(modifyLink: {
 destPath: string;
 destPage?: number;
 linkType: number;
 style: number;
 fullText?: string;
 showText?: string;
}): Promise<APIResponse<boolean>>;
Parameters
ParameterTypeDescription
modifyLink.destPathstringDestination path / URL: when linkType === 4, set this to the URL; otherwise set it to the destination file path
modifyLink.destPagenumberDestination page (only valid when linkType === 0 or linkType === 2)
For linkType === 0: must be a non-negative integer, meaning the target note page
For linkType === 2: a negative value jumps to the document current page; a non-negative integer jumps to the specified document page
modifyLink.linkTypenumberLink type: 0 note page, 1 note file, 2 document, 3 image, 4 URL
modifyLink.stylenumberLink style: 0 solid underline, 1 solid border, 2 dashed border
modifyLink.fullTextstringFull text (required for text links)
modifyLink.showTextstringDisplay text (required for text links)
Currently, modifyLassoLink only allows linkType in 0..4. When reading lasso link data, you may encounter linkType=6 (digest link). This type is currently read-only and cannot be modified via this API. See Link / LassoLink.
Returns
This API cannot modify a text link into a stroke link, nor modify a stroke link into a text link.

Example

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

/**
 * Example: modify the single link data in the current lasso selection.
 */
export async function exampleModifyLassoLink() {
 const res = await PluginNoteAPI.modifyLassoLink({
 destPath: '/storage/emulated/0/Note/target.note',
 destPage: 1,
 linkType: 0,
 style: 1,
 fullText: 'Full Text',
 showText: 'Show Text',
 });

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