Created
April 25, 2020 10:21
-
-
Save PavelLaptev/f8a2a867095990103d3b3af019a0e8a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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