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.
This page includes two APIs:
registerButton and registerButtonListener. Call order: register the button first (registerButton), then register the click listener (registerButtonListener).registerButton
Register a plugin button. Only after registration can users see the plugin button in the corresponding NOTE/DOC entry and trigger button press events.| Parameter | Type | Description |
|---|---|---|
type | number | Button type: 1 toolbar button, 2 lasso toolbar button, 3 selection toolbar button in DOC |
appTypes | string[] | App types array: NOTE / DOC |
button | PluginButton | Button configuration object |
Promise<boolean>: whether registration succeeds
registerButtonListener
Listen for plugin button press events. Typically, you register buttons during app startup and register listeners during plugin initialization.| Parameter | Type | Description |
|---|---|---|
buttonListener | ButtonListener | callback onButtonPress(event) |
ButtonSubscription: subscription object. Callremove()to unregister the listener
Type Definitions
ButtonListener
onButtonPress(event): triggered when the button is pressedevent.id: button idevent.name: button nameevent.icon: button icon- For more details, see: Plugin UI - Button Event Listener
ButtonSubscription
- Returned by
registerButtonListener - Call
remove()to unregister the button event listener