Persist data for a plugin

Hi, any chances that a plugin can save some data to localStorage ?
I tried but theres an error that says that the iframe window has no access.

I want to make a plugin where the user can save its “favorites”, and every time the plugin its opened, the favorites are still there.

Hi!, currently, there is no way for a plugin to use localStorage. However we’ll keep this in mind for future updates.

For now, the only solution is to use the PluginData storage. If your “favorites” are associated with a File, you can save data directly in the root of the file using methods like:

penpot.root.setPluginData('example', 'data');

console.log(penpot.root.getPluginData('example'));
1 Like