mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2025-01-18 05:22:28 -05:00
3ee244db92
* add figma-create-plugin ui * first attempt * more changes * update packages * fix stuff * implement reload action * simplify code * create wrapper * fix logo * adjust sizes * add changelog * update design again * temporary fix --------- Co-authored-by: Alex Sánchez <sion333@gmail.com>
28 lines
751 B
TypeScript
28 lines
751 B
TypeScript
import { findAllTextNodes } from './findAllTextnodes';
|
|
import { handleExportMessage } from './handleExportMessage';
|
|
import { BASE_WIDTH, LOADING_HEIGHT } from './pluginSizes';
|
|
import { registerChange } from './registerChange';
|
|
|
|
figma.showUI(__html__, { themeColors: true, width: BASE_WIDTH, height: LOADING_HEIGHT });
|
|
|
|
figma.ui.onmessage = message => {
|
|
if (message.type === 'ready') {
|
|
findAllTextNodes();
|
|
}
|
|
|
|
if (message.type === 'export') {
|
|
handleExportMessage(message.data as Record<string, string>);
|
|
}
|
|
|
|
if (message.type === 'cancel') {
|
|
figma.closePlugin();
|
|
}
|
|
|
|
if (message.type === 'reload') {
|
|
findAllTextNodes();
|
|
}
|
|
};
|
|
|
|
figma.on('currentpagechange', () => {
|
|
figma.currentPage.once('nodechange', registerChange);
|
|
});
|