Page 1 of 1

Evaluate Node Collection of Selection

Posted: Tue Jun 13, 2017 9:02 pm
by jacobBocaj
Hello,

I would like to prevent the deletion of <title> elements (and their content) within an xml document if the <title> element has an attribute of 'hTitle'. Thus far I have managed to prevent the deletion of element content by overidding the 'delete' method in an extension class of AuthorDocumentFilter; within this overridden 'delete' method I check the node at the caret and stop the content deletion if the 'hTitle' attribute exist. This works great if the user attempts to delete content at the cursor position.

However, when the user attempts a delete operation on a selection spanning a collection of elements I am unable to find a working approach to check the element content of the selection and stop the deletion operation. Is there a class method to access the element content of a selection? I tried to use getFullySelectedNode form WSAuthorEditorPageBase in hopes that I could parse the children of that node, but I wan't able to make that work.

Any advice will be greatly appreciated.
Thanks,
Jacob

Re: Evaluate Node Collection of Selection

Posted: Wed Jun 14, 2017 8:25 am
by Radu
Hi Jacob,

You could try this API:

ro.sync.ecss.extensions.api.AuthorDocumentController.getNodesToSelect(int, int)

Regards,
Radu

Re: Evaluate Node Collection of Selection

Posted: Wed Jun 14, 2017 11:47 pm
by jacobBocaj
Hello Radu,

Thank you for this suggestion. This solution works perfectly.

Regards,
Jacob