Copy link to clipboard
Copied
Hi, I want to traverse the whole document to look for specific nodes such as text to change them to outlines.
But I am failing because I cannot select text that is inside a group that is a part of the Artboard.
function deepSearchGroups(selection, node) {
selection.items = node;
node.children.forEach(subnode => {if(subnode instanceof Group) {
selection.items = subnode;
let subTexts = subnode.children.filter(subnodeChild => {return subnodeChild instanceof Text;
});
subTexts.forEach(subText => {selection.items = subText;
commands.convertToPath();
});
deepSearchGroups(subnode);
}});
}
Message I am getting tells me I am not in the right Edit context.
Plugin Error: Cannot select node not in the current edit context: [object Object]
The question is.. how to get there? I do not want user to be selecting anything since I want to check whole document.
I also do not want to detach nodes from parents since the structure is already established.
Selection doesn't work and normally I would assume that this would be a way of getting to the right node....
Documentation doesn't explain how to change scope.
https://adobexdplatform.com/plugin-docs/reference/core/scenegraph.html
https://adobexdplatform.com/plugin-docs/reference/core/edit-context.html
Copy link to clipboard
Copied
Find more inspiration, events, and resources on the new Adobe Community
Explore Now