Page 1 of 1

Hide or collapse certain tags by name in via framework or plugin

Posted: Mon Jun 27, 2022 10:55 pm
by shreya
Is there any way to collapse or expand certain or specific tags using any action operation or via oxygen plugin APIs ?
I want to create a custom action that collapses or expands all occurrence of a certain tag. Is there any way to achieve that?

Re: Hide or collapse certain tags by name in via framework or plugin

Posted: Tue Jun 28, 2022 8:03 am
by Radu
Hi,

You have APIs to set pseudo classes to certain elements:
ro.sync.ecss.extensions.api.AuthorPseudoClassController.setPseudoClass(String, AuthorElement)
https://www.oxygenxml.com/InstData/Edit ... oller.html
Like for example in a custom Author operation:

Code: Select all

  public void doOperation(AuthorAccess authorAccess, ArgumentsMap args)
    throws AuthorOperationException {
    
    AuthorNode[] elems = authorAccess.getDocumentController().findNodesByXPath("//element", true, true, true);
    for (int i = 0; i < elems.length; i++) {
      authorAccess.getDocumentController().setPseudoClass("collapse", (AuthorElement) elems[i]);
    }
and then in the CSS you are using to render the XML in the Author visual editing mode you can match elements which have a custom pseudo class like for example:

Code: Select all

element:collapse {
 display:none;
}
Regards,
Radu

Re: Hide or collapse certain tags by name in via framework or plugin

Posted: Wed Jun 29, 2022 8:28 am
by shreya
Hi,
By adding the pseudo classes, it will hide the entire element. I'm just looking for collapsing or hiding certain tags (preferably how it looks like in partial tags display mode) without removing or hiding the content in them. Is there any way to achieve that?

Re: Hide or collapse certain tags by name in via framework or plugin

Posted: Wed Jun 29, 2022 8:48 am
by Radu
Hi,
There is an -oxy-display-tags CSS property but it does not have many values, you could hide the tags completely like this:

Code: Select all

element:collapse {
 -oxy-display-tags:none:
}
maybe add some custom marker image before the element:

Code: Select all

element:collapse:before{
    content: url(markerImage.png);
}
https://www.oxygenxml.com/doc/versions/ ... -tags.html

Regards,
Radu

Re: Hide or collapse certain tags by name in via framework or plugin

Posted: Wed Jun 29, 2022 9:15 am
by shreya
Hi,
Does "oxy-display-tags" work in Oxygen Web Author as well?

Re: Hide or collapse certain tags by name in via framework or plugin

Posted: Wed Jun 29, 2022 3:43 pm
by mihaela
Hello,

Yes, the -oxy-display-tags CSS property works also in Oxygen Web Author.

Best Regards,
Mihaela