Skip to content

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

@basiclines

Description

@basiclines

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);
    }
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions