u/magic_notetaker

background processing and element access via File API

some operations are currently quite costly and take quite long (particularly on the A5X). An example is finding free space on a page in another note, because it needs scanning all stroke points with accessory methods. Now two questions / requests on this:
- give us a method to query via File API in pages for elements intersecting with a certain rect. ( to not get All Elements, but just those in a certain rect).
- is there a possibility to have code running in the background. It seems closing the UI also pauses all kind of code and it only resumes where it left off once the UI is shown again (hope I am not doing anything wrong here).

reddit.com
u/magic_notetaker — 2 days ago

Can't copy elements to a different note

I’m building a Supernote plugin and trying to copy lasso-selected elements from the current note into another note file. The creation in the new note file works fine, but currently the source elements are deleted afterwards (basically making it a move operation). But I would like to keep them. Current stuck with this. Anyone that can help me or has experience with this. u/sn-Dunn: any suggestions from your end how to accomplish this?

The simplified flow is:

// User has an active lasso selection in the current note

const sourcePath = await PluginCommAPI.getCurrentFilePath();
const sourcePage = await PluginCommAPI.getCurrentPageNum();
const lassoRect = await PluginCommAPI.getLassoRect();
const sourceElements = await PluginCommAPI.getLassoElements();

// For each selected stroke element:
// 1. Read source stroke data into plain JS arrays:
const points = await source.stroke.points.getRange(0, count);
const pressures = await source.stroke.pressures.getRange(0, count);
const flagDraw = await source.stroke.flagDraw.getRange(0, count);

// 2. Create a new stroke element:
const target = await PluginCommAPI.createElement(0);

// 3. Write copied/transformed data into the new element:
await target.stroke.points.setRange(0, points.length - 1, movedPoints);
await target.stroke.pressures.setRange(0, pressures.length - 1, pressures);
await target.stroke.flagDraw.setRange(0, flagDraw.length - 1, flagDraw);

target.pageNum = targetPage;
target.layerNum = 0;

// 4. Insert the newly created element into another note file:
await PluginFileAPI.insertElements(targetNotePath, targetPage, [target]);

Expected behavior: the selected source elements remain untouched, and copied elements appear in the target note.

Observed behavior: the copied element appears in the target note, but the original lasso-selected source element disappears immediately from the source note, as if it had been moved rather than copied.

Additional observation: using PluginCommAPI.saveStickerByLasso(stickerPath) on the same active lasso selection does not remove the source content.

Question: is this sequence valid for copying lasso-selected elements to another note file? In particular, is it valid to use PluginCommAPI.createElement(...) together with PluginFileAPI.insertElements(...) while a lasso selection is active, or is there a required step to detach/release/clone elements so the source lasso content is not affected?

reddit.com
u/magic_notetaker — 7 days ago

Security Architecture of Plugins

As I become more aware of the full power of plugins I am also feeling this could become a big security issue. It seems plugins can pretty much access all the users files, change them, communicate everything to any server on the internet. So it could be potentially used to scan files for information and sent them out, it could also just destroy data.

So I am wondering if it would not be good to put some sandbox constraints on plugins, e.g. having them read only from Inbox and write only to Export. Not allowing delete. Also to make use of internet something that has to be at least confirmed on install by the user. Perhaps the user can also block access to certain folders, so that notes and docs here cannot be accessed by plugins at all and are thereby protected.

This is not well thought through from my side. I just wanted to put my thoughts out there and would want to know if there are already any constraints in place or if others are being thought of. Or if the future inkHub upload would include some check of the code before publishing the plugin. I am a big fan of the plugin architecture and the possibilities, but I also know that many supernote users are appreciate security and privacy a lot, so it feels this should be addressed in some way.

reddit.com
u/magic_notetaker — 7 days ago

Suggestion to enable creating headings pages beyond the current

Thanks for this API. It is really quite powerful already. What works great is creating textboxes and other objects on different pages of the note. But currently, it seems there is no option to also create a textbox that is a header. This would be powerful for my use case (basically importing markdown files into a note for detailed review, annotation, and editing. Currently, you cannot navigate to another page, nor lasso something on another page; any of these would be necessary to create a heading from an existing textbox object. It would be great to enable creating a heading directly from a collection of objects, or at least from a certain textbox on any page. u/Dunn_sn

reddit.com
u/magic_notetaker — 14 days ago

Live Demos of the Textbox Helper

To make it a bit easier to see what is possible with the textbox helper beta:

- demo of cleaning up a supernote created textbox by removing spaces and linebreaks
- demo of splitting a paragraph into sentences and joining those again.
- demo of apply text handwritten deletions and replacements
- demo of importing a plain textfile with a long text, that will split to different pages, according to margins and font-size selected
- demo of exporting a textboxes to a docx file (using both headers, or defined textsizes to define what to include). Handwritten material is excluded.

Find the Plugin here: https://github.com/tilmanbergt/textboxHelper

u/magic_notetaker — 16 days ago

Textbox Helper Plugin

I’ve published an experimental Supernote NOTE plugin called Textbox Helper.

It focuses on structured editing of textboxes inside notes. Current features include:

  • splitting a textbox into smaller sentence-based textboxes
  • joining selected textboxes in reading order
  • cleaning repeated spaces and removing manual line breaks
  • importing plain text into NOTE textboxes
  • scanning textbox content and exporting it to DOCX
  • applying handwritten edit markers, including delete markers and early replace-marker support, with preview before changes are applied

It is still beta software, so I would recommend testing it on copied notes first.

For developers, the src/shared folder may be useful beyond this plugin. It contains reusable helper code for working with Supernote textboxes, including:

  • textbox geometry and reading-order sorting
  • page-space rectangle and overlap calculations
  • native text-layout measurement wrappers
  • textbox height estimation and resizing
  • hit testing from page coordinates to measured text lines and words
  • pagination and textbox insertion helpers

My hope is that this can be useful both as a practical plugin and as reference code for people building Supernote plugins that work seriously with textboxes.

GitHub: https://github.com/tilmanbergt/textboxHelper

Please give your feedback and suggestions!

Note: I am asked to "Use appropriate Post Flairs to make it easier for others to search." but I see no way in the creat post screen to add a flair, I can add 3 types of tags, but they do not apply. Not quite getting this...

reddit.com
u/magic_notetaker — 17 days ago