Skip to content

Commit

Permalink
fix: new selection from penpot
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfran committed Mar 19, 2024
1 parent 49defa6 commit 57178b7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions libs/plugins-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 57178b7

Please sign in to comment.