Author mode CSS: any way to do this?

Post here questions and problems related to oXygen frameworks/document types.
martindholmes
Posts: 139
Joined: Wed Apr 20, 2005 5:43 pm
Location: Victoria, BC, Canada

Author mode CSS: any way to do this?

Post by martindholmes » Thu Apr 04, 2019 8:32 pm

Hi all,

This may be an impossible goal, but it's worth asking:

I have documents which are tagged in stand-off mode, using anchor elements, like this:

Code: Select all


...This discussion covers <anchor next="#v2j_ht4_1hb" ana="e:institution" />institutional repositories<anchor xml:id="v2j_ht4_1hb"/> and library support....
where the first anchor marks the start of a range of text and the second marks the end of it. I would really like to be able to underline the text between the two anchors in a specific colour based on the @ana value of the first attribute. I've been looking at the oxy_xpath function and trying to imagine how I might do this, but I can't figure out a way. Can anyone suggest how this might be done? If it were possible, it would make Author mode a really fabulous tool for stand-off markup.

All help appreciated,
Martin

arcuous
Posts: 9
Joined: Sat Dec 31, 2016 10:05 pm

Re: Author mode CSS: any way to do this?

Post by arcuous » Thu Apr 04, 2019 10:55 pm

I found this answer which suggests it's not possible: https://stackoverflow.com/questions/716 ... een-2-tags, and which also suggests the more obvious use of your <anchor> elements to wrap the text. I'm assuming they may overlap though, so your kind of marker tags are required instead.

Radu
Posts: 6393
Joined: Fri Jul 09, 2004 5:18 pm

Re: Author mode CSS: any way to do this?

Post by Radu » Fri Apr 05, 2019 10:52 am

Hi Martin,

We have Java API to add non-persistent highlights to Oxygen's Author page:

https://www.oxygenxml.com/InstData/Edit ... hlighter--

Besides adding highlight ranges you also configure the painter which will take care of painting over each highlighted area.

For example this is an open source plugin (based on the Workspace Access plugin extension) which adds support for a custom spell checker in Oxygen:

https://github.com/danielnaber/oxygen-l ... ool-plugin

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

martindholmes
Posts: 139
Joined: Wed Apr 20, 2005 5:43 pm
Location: Victoria, BC, Canada

Re: Author mode CSS: any way to do this?

Post by martindholmes » Fri Apr 05, 2019 10:54 pm

Ah! I hadn't noticed that. I guess I should be able to use it with a caret listener to highlight ranges when the caret hits an anchor.

Thanks indeed,
Martin

martindholmes
Posts: 139
Joined: Wed Apr 20, 2005 5:43 pm
Location: Victoria, BC, Canada

Re: Author mode CSS: any way to do this?

Post by martindholmes » Sat Apr 06, 2019 12:35 am

Looking at the AuthorCaretListener, I'm going to have to instantiate it when the editor is activated, of course. Is there any way to do this through a Document Type configuration in JavaScript, as I can do with regular Author actions, or will this have to be done through a plugin? It looks as though the extensions page of the Document Type configuration only allows Java classes.

Cheers,
Martin

Radu
Posts: 6393
Joined: Fri Jul 09, 2004 5:18 pm

Re: Author mode CSS: any way to do this?

Post by Radu » Mon Apr 08, 2019 7:54 am

Hi Martin,

Indeed the "Extensions" tab in the Document Type Association configuration dialog allows only Java extension classes to be added.
So you either need to implement a Java extension and add it in a JAR library referenced in the "Claspath" tab or from a plugin when an editor is opened and the current page is Author or when an editor page changes (and the current page is author) you would need to add the caret listener.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply