Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Ignore line breaks for creating the unique text selections #7

Open
basiclines opened this issue Feb 3, 2021 · 0 comments
Labels
enhancement New feature or request P2

Comments

@basiclines
Copy link
Owner

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);
    }
})
@basiclines basiclines added the enhancement New feature or request label Feb 3, 2021
@basiclines basiclines added the P2 label Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2
Projects
None yet
Development

No branches or pull requests

1 participant