Annotate a JS Function with 'WebappRestSafe'
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
Annotate a JS Function with 'WebappRestSafe'
Hi !
I have created a custom action and put it in plugin.js file of my web author plugin.
In my plugin.js file I have a code snippet:
My common.js code :
I get the error :
How do I annotate JS code with 'WebappRestSafe' ? I have seen implementations in Java, but I don't know for Javascript.
I have tried couple of approaches but it didn't work.
I have created a custom action and put it in plugin.js file of my web author plugin.
In my plugin.js file I have a code snippet:
Code: Select all
this.editor.getActionsManager().invokeOperation('ro.sync.ecss.extensions.commons.operations.JSOperation',
{
script:'common.js'
});
Code: Select all
class GetCurrentId {
doOperation() {
var currentNode = authorAccess.getEditorAccess().getFullySelectedNode();
var currentNodeId= currentNode("id");
return currentNodeId;
}
}
- safe.JPG (30.17 KiB) Viewed 171 times
I have tried couple of approaches but it didn't work.
Re: Annotate a JS Function with 'WebappRestSafe'
Hello,
If you only need to retrieve the id of the fully selected element, I recommend using the sync.api.dom.Element [1] API, which is more streamlined for this purpose. For example, you can use the method sync.api.Selection.getFullySelectedNode() [2] (accessed via sync.api.EditingSupport.getSelectionManager().getSelection()) and then get the id attribute using sync.api.dom.Element.getAttribute("id") [3]
[1] https://www.oxygenxml.com/maven/com/oxy ... ement.html
[2] https://www.oxygenxml.com/maven/com/oxy ... de__anchor
[3] https://www.oxygenxml.com/maven/com/oxy ... te__anchor
Best,
Cosmin
If you only need to retrieve the id of the fully selected element, I recommend using the sync.api.dom.Element [1] API, which is more streamlined for this purpose. For example, you can use the method sync.api.Selection.getFullySelectedNode() [2] (accessed via sync.api.EditingSupport.getSelectionManager().getSelection()) and then get the id attribute using sync.api.dom.Element.getAttribute("id") [3]
[1] https://www.oxygenxml.com/maven/com/oxy ... ement.html
[2] https://www.oxygenxml.com/maven/com/oxy ... de__anchor
[3] https://www.oxygenxml.com/maven/com/oxy ... te__anchor
Best,
Cosmin
Cosmin Eftenie
www.oxygenxml.com
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