mirror of
https://github.com/penpot/penpot-plugins.git
synced 2025-01-08 07:50:44 -05:00
fix: new selection from penpot
This commit is contained in:
parent
49defa6c2b
commit
57178b7531
1 changed files with 9 additions and 6 deletions
|
@ -3,7 +3,7 @@ import './lib/plugin-modal';
|
||||||
|
|
||||||
import { ɵloadPlugin } from './lib/load-plugin';
|
import { ɵloadPlugin } from './lib/load-plugin';
|
||||||
import { setFileState, setPageState, setSelection, setTheme } from './lib/api';
|
import { setFileState, setPageState, setSelection, setTheme } from './lib/api';
|
||||||
import { getPartialState, getSelectedUuids } from 'plugins-parser';
|
import { getPartialState } from 'plugins-parser';
|
||||||
|
|
||||||
repairIntrinsics({
|
repairIntrinsics({
|
||||||
evalTaming: 'unsafeEval',
|
evalTaming: 'unsafeEval',
|
||||||
|
@ -39,12 +39,15 @@ export function initialize(api: any) {
|
||||||
setFileState(file);
|
setFileState(file);
|
||||||
});
|
});
|
||||||
|
|
||||||
api.addListener('plugin-selection', 'selection', (selection: any) => {
|
api.addListener(
|
||||||
const selectionData = getSelectedUuids(selection);
|
'plugin-selection',
|
||||||
console.log('Selection Changed:', selectionData);
|
'selection',
|
||||||
|
(selection: { uuid: string }[]) => {
|
||||||
|
console.log('Selection Changed:', selection);
|
||||||
|
|
||||||
setSelection(selectionData);
|
setSelection(selection.map(({ uuid }) => uuid));
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
api.addListener('plugin-theme', 'theme', (theme: 'light' | 'default') => {
|
api.addListener('plugin-theme', 'theme', (theme: 'light' | 'default') => {
|
||||||
console.log('Theme change:', theme);
|
console.log('Theme change:', theme);
|
||||||
|
|
Loading…
Reference in a new issue