0
Fork 0
mirror of https://github.com/penpot/penpot-plugins.git synced 2025-01-06 14:50:21 -05:00

fix: new selection from penpot

This commit is contained in:
Juanfran 2024-03-19 14:53:16 +01:00
parent 49defa6c2b
commit 57178b7531

View file

@ -3,7 +3,7 @@ import './lib/plugin-modal';
import { ɵloadPlugin } from './lib/load-plugin';
import { setFileState, setPageState, setSelection, setTheme } from './lib/api';
import { getPartialState, getSelectedUuids } from 'plugins-parser';
import { getPartialState } from 'plugins-parser';
repairIntrinsics({
evalTaming: 'unsafeEval',
@ -39,12 +39,15 @@ export function initialize(api: any) {
setFileState(file);
});
api.addListener('plugin-selection', 'selection', (selection: any) => {
const selectionData = getSelectedUuids(selection);
console.log('Selection Changed:', selectionData);
api.addListener(
'plugin-selection',
'selection',
(selection: { uuid: string }[]) => {
console.log('Selection Changed:', selection);
setSelection(selectionData);
});
setSelection(selection.map(({ uuid }) => uuid));
}
);
api.addListener('plugin-theme', 'theme', (theme: 'light' | 'default') => {
console.log('Theme change:', theme);