public/code.js
// TODO: Need to add a limit, incase user tries to add too many layer styles at once
Need to add a limit, incase user tries to add too many layer styles at once
Need to add a limit incase user tries to add too many layer styles at once
function addLayerStyle(node) {
    return __awaiter(this, void 0, void 0, function* () {
        var layerStyles = getLayerStyles();
        for (let i = 0; i < layerStyles.length; i++) {
            var layerStyle = layerStyles[i];
            if (layerStyle.id === node.id) {
                console.log("Layer style already exists");
                figma.notify("Layer style already exists");
                return;
            }
        }
        var newLayerStyle = { id: node.id, node: copyPasteStyle(node), name: node.name };
        layerStyles.push(newLayerStyle);
        figma.root.setPluginData("styles", JSON.stringify(layerStyles));
    });
}
function addLayerStyle ( node ) { return __awaiter ( this , void 0 , void 0 , function * ( ) { var layerStyles = getLayerStyles ( ) ; for ( let i = 0 ; i < layerStyles . length ; i ++ ) { var layerStyle = layerStyles [ i ] ; if ( layerStyle . id === node . id ) { console . log ( "Layer style already exists" ) ; figma . notify ( "Layer style already exists" ) ; return ; } } var newLayerStyle = { id : node . id , node : copyPasteStyle ( node ) , name : node . name } ; layerStyles . push ( newLayerStyle ) ; figma . root . setPluginData ( "styles" , JSON . stringify ( layerStyles ) ) ; } ) ; }
TODO: Need to add a limit, incase user tries to add too many layer styles at once
TODO : Need to add a limit incase user tries to add too many layer styles at once