Page 1 of 1

Webapp 18 Highlighting

Posted: Thu Jul 21, 2016 11:44 am
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() ?

Re: Webapp 18 Highlighting

Posted: Thu Jul 21, 2016 3:28 pm
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

Re: Webapp 18 Highlighting

Posted: Thu Jul 21, 2016 5:10 pm
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

Re: Webapp 18 Highlighting

Posted: Fri Jul 22, 2016 1:27 pm
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

Re: Webapp 18 Highlighting

Posted: Mon Aug 01, 2016 4:17 pm
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

Re: Webapp 18 Highlighting

Posted: Mon Nov 20, 2017 1:02 pm
by Konstantin
Hello.
It's a long time passed, maybe you have new api to highlight pieces of text or still only through styles?

Re: Webapp 18 Highlighting

Posted: Tue Nov 21, 2017 4:30 pm
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

Re: Webapp 18 Highlighting

Posted: Tue Feb 27, 2018 5:10 pm
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.

Re: Webapp 18 Highlighting

Posted: Wed Feb 28, 2018 5:25 pm
by mihaela
Hi,

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

Best Regards,
Mihaela

Re: Webapp 18 Highlighting

Posted: Thu May 23, 2019 5:00 pm
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