Webapp 18 Highlighting

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
Konstantin
Posts: 61

Webapp 18 Highlighting

Thu Jul 21, 2016 11:44 am

Hi guys !
In Oxygen applet we use a highlighting thru:
Tags attribute:
<p audience="audience_name01">text</p>
and insert data about tag an color to:

Code: Select all

final AuthorEditorAccess editorAccess = authorAccess.getEditorAccess();
final AuthorHighlighter highlighter = editorAccess.getHighlighter();
highlighter.addHighlight(element.getStartOffset(),
               element.getEndOffset(),
               painter,
               new AuthorConditionalProcessingHighlight(element));


But now in Webapp 18 is unsupported:
authorAccess.getEditorAccess().getHighlighter()

Do you have another opportunity to do this ?
Do you have plans to support getHighlighter() ?
Gabriel Titerlea
Posts: 39

Re: Webapp 18 Highlighting

Thu Jul 21, 2016 3:28 pm

Hello,

Can you explain exactly what you want to achieve with the highlighter?
We do not support the AuthorHighlighter in the WebApp. We will have a method of inserting non-persistent markers on the client-side with javascript though. Would this suit your needs?

Regards,
Gabriel
Konstantin
Posts: 61

Re: Webapp 18 Highlighting

Thu Jul 21, 2016 5:10 pm

We have functionality for applet to highlight text by different colors
I need do it for Webapp
https://drive.google.com/open?id=0B8kWu38k-wQUV3JqOWdKQ2k3THM
Gabriel Titerlea
Posts: 39

Re: Webapp 18 Highlighting

Fri Jul 22, 2016 1:27 pm

We don't support AuthorHighlighter, but if the only thing you want to do is change the color of elements depending on an attribute value you could add a css to the WebApp using a javascript plugin [1].

In your css you can select attributes with certain values like this:

Code: Select all

// Note that the attribute name must be prepended with "data-attr-"
*[data-attr-color="red"] {
  background-color: rgba(255, 0, 0, 0.19);
}


To load your css you can use a WebappStaticResourcesFolder extension for your plugin. Check the link [1] for more info.

Once you have a static resource folder all you need to do is load your custom css into the WebApp by listening for the EDITOR_LOADED event inside a plugin:

Code: Select all

(function () {
  goog.events.listenOnce(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, function(e) {
    var doc;
 
    // We insert the editor content inside an element with id editor-frame
    var editorFrame = document.getElementById('editor-frame');
   
    // Depending on user preferences we may insert the editor content inside an iframe.
    // In that case you should load your css inside the iframe.
    if (editorFrame.nodeName === 'IFRAME') {
      doc = editorFrame.contentDocument;
    } else {
      doc = editorFrame.ownerDocument;
    }

    // Static resources folders are accessible at the plugin-resources endpoint.
    var url = "../plugin-resources/STATIC_RESOURCES_FOLDER/highlighter.css";
    if (doc.createStyleSheet) {
      doc.createStyleSheet(url);
    } else {
      var link = goog.dom.createDom('link', {
        href: url,
        rel: "stylesheet",
        type: "text/css"
      });
      goog.dom.appendChild(doc.head, link);
    }
  });

})();



[1] - https://www.oxygenxml.com/doc/versions/ ... gin,static
Gabriel Titerlea
Posts: 39

Re: Webapp 18 Highlighting

Mon Aug 01, 2016 4:17 pm

Hello Konstantin,

There's an even better solution for highlighting specific attributes. You can use an Author Stylesheet Plugin Extension [1] in your plugin.
You can write css selectors specific to your document type without the extra "data-attr-".
example:

Code: Select all

title[attribute="value"] {
  color: red
}



Regards,
Gabriel

[1] https://www.oxygenxml.com/doc/versions/ ... stylesheet
Konstantin
Posts: 61

Re: Webapp 18 Highlighting

Mon Nov 20, 2017 1:02 pm

Hello.
It's a long time passed, maybe you have new api to highlight pieces of text or still only through styles?
mihaela
Posts: 190

Re: Webapp 18 Highlighting

Tue Nov 21, 2017 4:30 pm

Hello Konstantin,

There is no support in Web Author for editorAccess.getHighlighter() API for the moment. We will let you know when it will be implemented.

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
aleh.haidash
Posts: 32

Re: Webapp 18 Highlighting

Tue Feb 27, 2018 5:10 pm

Hello.
Do you have any news about highlighting api from js or java in Webapp 19.1? Maybe it can be done?
Thanks.
Best Regards,
Aleh
mihaela
Posts: 190

Re: Webapp 18 Highlighting

Wed Feb 28, 2018 5:25 pm

Hi,

The highlighting api was not implemented yet. We will update this thread when the feature will be available.

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

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 0 guests