SketchAPI
SketchAPI copied to clipboard
APIs missing: When create a new style (both Layer and Text), we need an easier way to update our Styles list
It would be nice to be able to update the styles list in a simpler way.
This is what I have to do right now (an example with Layer styles):
let sharedStyle = layerStyles.push({
name: "New Style Name",
style: layer.style,
document: document,
});
updateLayerStyles();
[...]
function updateLayerStyles() {
layerStyles = document.sharedLayerStyles;
arrayLayerStyleIDs = layerStyles.map((sharedstyle) => sharedstyle["id"]);
arrayLayerStyleNames = layerStyles.map(
(sharedstyle) => sharedstyle["name"]
);
arrayLayerStyleStyles = layerStyles.map(
(sharedstyle) => sharedstyle["style"]
);
}
It would be nice to have something simpler, like:
let sharedStyle = layerStyles.push({
name: "New Style Name",
style: layer.style,
document: document,
});
sharedStyle.add();