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

Are you missing a feature? Request its implementation here.
shreya
Posts: 29
Joined: Mon Jun 27, 2022 9:09 pm

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

Post 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?
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

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

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
shreya
Posts: 29
Joined: Mon Jun 27, 2022 9:09 pm

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

Post 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?
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

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

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
shreya
Posts: 29
Joined: Mon Jun 27, 2022 9:09 pm

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

Post by shreya »

Hi,
Does "oxy-display-tags" work in Oxygen Web Author as well?
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

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

Post by mihaela »

Hello,

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

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
Post Reply