Provides methods for managing plugin-specific data associated with a Penpot shape.
Retrieves the data for our own plugin, given a specific key.
The key for which to retrieve the data.
Returns the data associated with the key as a string.
const data = shape.getPluginData('exampleKey');console.log(data); Copy
const data = shape.getPluginData('exampleKey');console.log(data);
Sets the plugin-specific data for the given key.
The key for which to set the data.
The data to set for the key.
shape.setPluginData('exampleKey', 'exampleValue'); Copy
shape.setPluginData('exampleKey', 'exampleValue');
Retrieves all the keys for the plugin-specific data.
Returns an array of strings representing all the keys.
const keys = shape.getPluginDataKeys();console.log(keys); Copy
const keys = shape.getPluginDataKeys();console.log(keys);
If we know the namespace of an external plugin, this is the way to get their data.
The namespace for the shared data.
Returns the shared data associated with the key as a string.
const sharedData = shape.getSharedPluginData('exampleNamespace', 'exampleKey');console.log(sharedData); Copy
const sharedData = shape.getSharedPluginData('exampleNamespace', 'exampleKey');console.log(sharedData);
Sets the shared plugin-specific data for the given namespace and key.
shape.setSharedPluginData('exampleNamespace', 'exampleKey', 'exampleValue'); Copy
shape.setSharedPluginData('exampleNamespace', 'exampleKey', 'exampleValue');
Retrieves all the keys for the shared plugin-specific data in the given namespace.
Returns an array of strings representing all the keys in the namespace.
const sharedKeys = shape.getSharedPluginDataKeys('exampleNamespace');console.log(sharedKeys); Copy
const sharedKeys = shape.getSharedPluginDataKeys('exampleNamespace');console.log(sharedKeys);
Provides methods for managing plugin-specific data associated with a Penpot shape.