Webapp 18 Highlighting

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Konstantin
Posts: 61
Joined: Tue Oct 27, 2015 11:49 am

Webapp 18 Highlighting

Post by Konstantin »

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
Site Admin
Posts: 95
Joined: Thu Jun 09, 2016 2:01 pm

Re: Webapp 18 Highlighting

Post by Gabriel Titerlea »

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
Joined: Tue Oct 27, 2015 11:49 am

Re: Webapp 18 Highlighting

Post by Konstantin »

We have functionality for applet to highlight text by different colors
I need do it for Webapp
https://drive.google.com/open?id=0B8kWu ... WdKQ2k3THM
Gabriel Titerlea
Site Admin
Posts: 95
Joined: Thu Jun 09, 2016 2:01 pm

Re: Webapp 18 Highlighting

Post by Gabriel Titerlea »

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
Site Admin
Posts: 95
Joined: Thu Jun 09, 2016 2:01 pm

Re: Webapp 18 Highlighting

Post by Gabriel Titerlea »

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
Joined: Tue Oct 27, 2015 11:49 am

Re: Webapp 18 Highlighting

Post by Konstantin »

Hello.
It's a long time passed, maybe you have new api to highlight pieces of text or still only through styles?
mihaela
Posts: 489
Joined: Wed May 20, 2009 2:40 pm

Re: Webapp 18 Highlighting

Post by mihaela »

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
Joined: Tue May 26, 2015 10:28 am

Re: Webapp 18 Highlighting

Post by aleh.haidash »

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: 489
Joined: Wed May 20, 2009 2:40 pm

Re: Webapp 18 Highlighting

Post by mihaela »

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
mihaela
Posts: 489
Joined: Wed May 20, 2009 2:40 pm

Re: Webapp 18 Highlighting

Post by mihaela »

Hi,

We just released the 21.1 version of Web Author and it includes a new API for working with non persistent highlights:
https://www.oxygenxml.com/maven/com/oxy ... nager.html

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