OxygenXML Web author highlighted text
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
-
- Posts: 12
- Joined: Mon Dec 12, 2022 11:19 pm
OxygenXML Web author highlighted text
Hi there,
I am trying to get the highlighted text (which could be a double click or selection with cursor).
when user does this highlight text operation, which is represented on UI with blue background color, how do i get the selected/highlighted text and not the whole text under the tag. For example in attached screenshot "Jennifer Angelini" is under a tag. But if the user highlights Angelini like in the screenshot, how do i get that particular part of the text ("Angelini")?
I am trying to get the highlighted text (which could be a double click or selection with cursor).
when user does this highlight text operation, which is represented on UI with blue background color, how do i get the selected/highlighted text and not the whole text under the tag. For example in attached screenshot "Jennifer Angelini" is under a tag. But if the user highlights Angelini like in the screenshot, how do i get that particular part of the text ("Angelini")?
Screenshot 2022-12-12 at 3.22.54 PM.png
I have tried selection manager and highlights manager. Here is the code I used for highlights manager but somehow its not being called. Code: Select all
var highlightManager = e.editor.getEditingSupport().getWidgetsFactory().getHighlightsManager();
highlightManager.listen(sync.api.HighlightUpdateEvent.EventType.HIGHLIGHT_ADDED, function(e) {
console.log("highlight changed ", e);
});
You do not have the required permissions to view the files attached to this post.
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: OxygenXML Web author highlighted text
Post by cristi_talau »
Hello,
In Web Author, the selection has two particular cases: an interval selection, and a "caret" selection where the interval is empty. Highlights are a different object. They can be added using the API, so if no customisation is implemented, there are not highligts.
Coming back to your question about how to obtain the selected text, there is no simple API to do this. There are two workarounds:
1. Use the Selection.getCaretPositionInformation() API [1] and travese the XML DOM nodes to obtain the selected text.
2. Use a NON-API JS method that may be removed in a future release, but which works with Web Author 25.0:
Best,
Cristian
[1] https://www.oxygenxml.com/maven/com/oxy ... on__anchor
In Web Author, the selection has two particular cases: an interval selection, and a "caret" selection where the interval is empty. Highlights are a different object. They can be added using the API, so if no customisation is implemented, there are not highligts.
Coming back to your question about how to obtain the selected text, there is no simple API to do this. There are two workarounds:
1. Use the Selection.getCaretPositionInformation() API [1] and travese the XML DOM nodes to obtain the selected text.
2. Use a NON-API JS method that may be removed in a future release, but which works with Web Author 25.0:
Code: Select all
sync.model.ContentModel.getTextFromSelection(sel)
Cristian
[1] https://www.oxygenxml.com/maven/com/oxy ... on__anchor
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