Skip to content

Instantly share code, notes, and snippets.

@PavelLaptev
Created April 25, 2020 10:21
Show Gist options
  • Save PavelLaptev/f8a2a867095990103d3b3af019a0e8a8 to your computer and use it in GitHub Desktop.
Save PavelLaptev/f8a2a867095990103d3b3af019a0e8a8 to your computer and use it in GitHub Desktop.
import {figmaNotify} from './';
export default function populateOnlySelected(selectedLayers, obj, btnName) {
selectedLayers.map((item, i) => {
if (typeof obj[i] !== 'undefined') {
try {
figma.loadFontAsync(item.fontName).then(() => {
item.characters = obj[i][btnName].toString();
});
} catch (error) {
figmaNotify('error', 'Select only text layers or option "By layer name"', 1500);
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment