figma-content-buddy
figma-content-buddy copied to clipboard
Feature request: Ignore line breaks for creating the unique text selections
The idea will be to allow users to define whenever they want line breaks ignored or not when creating all the selection options.
Requested by @lolergb
Some pseudo-code provided for this feature.
let inputSearch = "Byeeeee";
let changeText = "Bye";
let search = new RegExp(inputSearch, 'gi');
function changeContent(node, text) {
let font = node.fontName;
figma
.loadFontAsync(font)
.then(() => {
node.characters = text;
})
.catch((e) => {
console.info(e);
});
console.log(node.characters);
}
function myTrim(x) {
return x.replace(/\s+/g, ' ');
}
figma.currentPage.findAll((node) => {
if (node.characters && myTrim(node.characters).match(search)) {
console.log(node.characters)
//changeContent(node, changeText);
}
})