Add Highlighter on document
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
-
- Posts: 168
- Joined: Fri Jan 20, 2017 1:11 pm
Add Highlighter on document
Hello,
We use Author web in version 26.0.0, and we want to manage Highlighter on the document.
I tried to do it this way :
The highlighter is well added in editorAccess, and can be accessed in an other java doOperation().
But no blue STROKE_WAVY_NO_ENDINGS are displayed in web author.
Even if i force the refresh of the document with authorEditorAccess.refresh(), no highlighter are displayed.
How can we manage highlighter in Author Web ?
Thanks,
Regards,
Isabelle
We use Author web in version 26.0.0, and we want to manage Highlighter on the document.
I tried to do it this way :
Code: Select all
public String doOperation(AuthorDocumentModel authorDocumentModel, ArgumentsMap argumentsMap) throws IllegalArgumentException, AuthorOperationException {
AuthorAccess authorAccess = authorDocumentModel.getAuthorAccess();
AuthorEditorAccess editorAccess = authorAccess.getEditorAccess();
AuthorHighlighter highlighter = editorAccess.getHighlighter();
ColorHighlightPainter colorHighlightPainter = new ColorHighlightPainter();
colorHighlightPainter.setColor(Color.COLOR_BLUE);
colorHighlightPainter.setTextDecorationStroke(Graphics.STROKE_WAVY_NO_ENDINGS);
int oxygenOffsetStart = 70;
int oxygenOffsetEnd = 100;
String authorRuleMatch = "It is a Match";
highlighter.addHighlight(oxygenOffsetStart, oxygenOffsetEnd, colorHighlightPainter, authorRuleMatch);
}
But no blue STROKE_WAVY_NO_ENDINGS are displayed in web author.
Even if i force the refresh of the document with authorEditorAccess.refresh(), no highlighter are displayed.
How can we manage highlighter in Author Web ?
Thanks,
Regards,
Isabelle
-
- Site Admin
- Posts: 172
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Add Highlighter on document
Post by Bogdan Dumitru »
Hi Isabelle,
Unfortunately, the ColorHighlightPainter API doesn't work in Web Author.
Try instead setting styles via CSS by specifying the "class" attribute on the highlight. Somewhat like this:
and then add an application-level CSS to match be above class. See here a sample plugin that adds such a CSS.
Unfortunately, the ColorHighlightPainter API doesn't work in Web Author.
Try instead setting styles via CSS by specifying the "class" attribute on the highlight. Somewhat like this:
Code: Select all
Map<String, String> attrs = new HashMap<>();
attrs.put("class", "custom-highlight");
highlighter.addHighlight(startOffset, endOffset, null, attrs);
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service