I'm working on a plugin that does some auditing of various types of layers in the document. One of the first things I do is get a list of all text layers:
const allText = sketch.find('Text')
Then I do a bunch of stuff to process the layers, etc. At one point my plugin allows the user to select and highlight various text layers. I select them using the ID:
let layer = sketch.find('[id=DKE90DKA-3KS-EKKKSLEEKSKS]')
Then I select it:
layer.selected = true
And this is where it gets weird. For some layers in my list, it doesn't actually select anything in the document.
layer.selected = true, but if I do this:
So essentially, the layer sort of exists in the document in some form, but it's not "physically" there. Like I can't click it or find it or actually select it, even though the
selected attribute is
true. It does not show up in the sidebar as a selected layer.
It obviously doesn't do this for all the layers I find, but it does it for some.
So first of all, does anyone know what is going on here? Why is this happening?
Second question, when I do
sketch.find('Text') how can I iterate through each layer this finds and filter out all these "non-existent" layers?