Replacing words with plugin in Oxygen XML Web Author
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
-
- Posts: 2
- Joined: Thu Mar 21, 2019 6:43 pm
Replacing words with plugin in Oxygen XML Web Author
Hello
I'm looking for a way to automatically replace words with Oxygen XML Web Author plugin:
It seems that XSLTOperation and XQueryOperationAlternatively might be helpful, but this operation cannot be invoked using JavaScript API. XQueryUpdateOperation is not applicable in Oxygen XML Web Author at all.
Or maybe there there is an API to access Find/Replace functionality? Any code examples are appreciated
Thanks in advance
I'm looking for a way to automatically replace words with Oxygen XML Web Author plugin:
- * Plugin will propose word replacement.
* User will accept replacement.
* Plugin will replace all occurrences of the word in selected fragment or whole document.
It seems that XSLTOperation and XQueryOperationAlternatively might be helpful, but this operation cannot be invoked using JavaScript API. XQueryUpdateOperation is not applicable in Oxygen XML Web Author at all.
Or maybe there there is an API to access Find/Replace functionality? Any code examples are appreciated
Thanks in advance
-
- Posts: 2
- Joined: Thu Mar 21, 2019 6:43 pm
Re: Replacing words with plugin in Oxygen XML Web Author
Follow up: I've found MoveCaretOperation. Not sure if I can select single world/phrase with it. And I cannot make it working:
(Not sure how to make indents working)
Code: Select all
goog.events.listen(
searchButton,
goog.events.EventType.CLICK,
function (e) {
editor.getActionsManager().invokeOperation(
'ro.sync.ecss.extensions.commons.operations.MoveCaretOperation', {
"xpathLocation": "//*[text()[contains(.,'metres')]]",
"selection": "After",
"position": "Before"
},
function (err, resultString) {
if (resultString === 'ok') {
console.log("OK");
} else {
workspace.getNotificationManager().showWarning(resultString, true);
console.warn(resultString);
}
})
});
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Replacing words with plugin in Oxygen XML Web Author
Post by cristi_talau »
Hello,
The best answer depends on how your plugin is structured and what it tries to achieve. I assume you managed to identify a word that should be changed.
If your plugin is similar to a spellchecker, you can take a look at our LanguageTool integration [2]. It uses the Spellcheck API to implement something similar with what you described.
We are currently working on adding an API for adding text highlights using Java code. If that would be of interest for you, we can give you access to a nightly build that includes that support (which will be available in the next release).
Best,
Cristian
[1] https://www.oxygenxml.com/doc/versions/ ... ation_tips
[2] https://github.com/oxygenxml/web-author ... ool-plugin
The best answer depends on how your plugin is structured and what it tries to achieve. I assume you managed to identify a word that should be changed.
- What information do you have about the location of the word?
- Did you manage to locate the word using the JS API or the Java API?
If your plugin is similar to a spellchecker, you can take a look at our LanguageTool integration [2]. It uses the Spellcheck API to implement something similar with what you described.
We are currently working on adding an API for adding text highlights using Java code. If that would be of interest for you, we can give you access to a nightly build that includes that support (which will be available in the next release).
Best,
Cristian
[1] https://www.oxygenxml.com/doc/versions/ ... ation_tips
[2] https://github.com/oxygenxml/web-author ... ool-plugin
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