11/* Config */
22import { PLUGIN_UI_CONFIG as UiConfig } from './config' ;
33/* Helpers */
4- import { getNodeProps , notifyConfigDefault } from './helpers/helpers' ;
4+ import { getNodeProps , notifyConfigDevDefault } from './helpers/helpers' ;
55/* Demo */
66import { createColorfulSpiral } from './demo/spiralGenerator' ;
77
@@ -20,7 +20,7 @@ figma.ui.onmessage = (msg) => {
2020 origin : 'figma' ,
2121 message : `Created a spiral with ${ msg . count } ${ msg . shape } s` ,
2222 } ) ;
23- figma . notify ( "Figma: Created spiral" , notifyConfigDefault ) ;
23+ figma . notify ( "Figma: Created spiral" , notifyConfigDevDefault ) ;
2424 break ;
2525 case 'demo-insert-quote' :
2626 let quote = msg . quote ?? '' ;
@@ -38,7 +38,7 @@ figma.ui.onmessage = (msg) => {
3838 figma . currentPage . appendChild ( textNode ) ;
3939 figma . currentPage . selection = [ textNode ] ;
4040 figma . viewport . scrollAndZoomIntoView ( [ textNode ] ) ;
41- figma . notify ( "Figma: Inserted quote" , notifyConfigDefault ) ;
41+ figma . notify ( "Figma: Inserted quote" , notifyConfigDevDefault ) ;
4242 } )
4343 . catch ( err => {
4444 console . error ( "Failed to load font:" , err ) ;
@@ -47,7 +47,12 @@ figma.ui.onmessage = (msg) => {
4747 break ;
4848 /* /DEMO */
4949
50- case 'get-selection-contents-deep' :
50+ case 'get-frame-contents-deep' :
51+ /* check if selection has at least one frame */
52+ if ( ! figma . currentPage . selection . some ( node => node . type === 'FRAME' ) ) {
53+ figma . notify ( "Figma: No frame selected" , notifyConfigDevDefault ) ;
54+ break ;
55+ }
5156 const frameContents = figma . currentPage . selection
5257 . filter ( node => node . type === 'FRAME' )
5358 . flatMap ( frame => {
@@ -71,15 +76,15 @@ figma.ui.onmessage = (msg) => {
7176 console . log ( frameContents ) ;
7277 figma . notify ( "Figma: Selection contents sent. Check console for details." ) ;
7378 figma . ui . postMessage ( {
74- type : 'get-selection -contents-deep' ,
79+ type : 'get-frame -contents-deep' ,
7580 origin : 'figma' ,
7681 message : frameContents ,
7782 } ) ;
7883 break ;
7984
8085 case 'show-notification' :
8186 if ( msg . message ) {
82- figma . notify ( msg . message , notifyConfigDefault ) ;
87+ figma . notify ( msg . message , notifyConfigDevDefault ) ;
8388 }
8489 break ;
8590
0 commit comments