Skip to main content
Participant
December 3, 2018
Question

How to change Edit context?

  • December 3, 2018
  • 1 reply
  • 457 views

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

    This topic has been closed for replies.

    1 reply

    Preran
    Legend
    December 3, 2018

    Hi EdenWS,

    Please post your question here https://forums.adobexdplatform.com/top/all

    Thanks,

    Preran