Access to editor from outside
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 61
- Joined: Tue Oct 27, 2015 11:49 am
Access to editor from outside
Post by Konstantin »
Hello !!!
I use WebApp 18.0.0
I load content from outside datasource, at some time I need know state of this content.
I created custom servlet which is getting request from my application but I can not get editor or content from it.
How can I do this?
For example I need know that is this content isDirty
I use WebApp 18.0.0
I load content from outside datasource, at some time I need know state of this content.
I created custom servlet which is getting request from my application but I can not get editor or content from it.
How can I do this?
For example I need know that is this content isDirty
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Access to editor from outside
Post by cristi_talau »
Hello,
One way to have access to the editor is to implement a JS extension (ideally as a plugin). You can find more details about how to load your JS code in the editor page here [1]. In the JavaScript file that you load you can use our JavaScript API [2] to get the editor content and to check whether it is dirty or not.
We also have Java API that you can use from a plugin. So, it is important for us to understand your final goal with this integration. This way, we can guide you to the best approach.
Best,
Cristian
[1] https://www.oxygenxml.com/doc/versions/ ... ng_js.html
[2] https://www.oxygenxml.com/maven/com/oxy ... 0.0/jsdoc/
One way to have access to the editor is to implement a JS extension (ideally as a plugin). You can find more details about how to load your JS code in the editor page here [1]. In the JavaScript file that you load you can use our JavaScript API [2] to get the editor content and to check whether it is dirty or not.
We also have Java API that you can use from a plugin. So, it is important for us to understand your final goal with this integration. This way, we can guide you to the best approach.
Best,
Cristian
[1] https://www.oxygenxml.com/doc/versions/ ... ng_js.html
[2] https://www.oxygenxml.com/maven/com/oxy ... 0.0/jsdoc/
-
- Posts: 61
- Joined: Tue Oct 27, 2015 11:49 am
Re: Access to editor from outside
Post by Konstantin »
We have application which uses WebApp thru iframe.We also have Java API that you can use from a plugin. So, it is important for us to understand your final goal with this integration. This way, we can guide you to the best approach.
We can open some WebApp in tabs.
When we close some tab we need know that is this WebApp has changes (isDirty) and then show message to user about saving content and then if necessary send to WebApp request about saving content.
For this we created plugin Servlet but we can't understand how we can get state (isDirty) of editor and it content from Servlet.
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Access to editor from outside
Post by cristi_talau »
Hello,
You will need to inject some custom JavaScript code in the Web Author iframe. This can be done using a plugin as I explained in the previous post.
This JS code should first get a reference to the editor once it is opened, e.g.
Then it should listen for the tab closed event and check whether the editor is dirty [1], and display a dialog.
In order to save the editor you can invoke the editor builtin action using a code like the one below:
Please let me know if this approach does not work for you.
Best,
Cristian
[1] https://www.oxygenxml.com/maven/com/oxy ... ml#isDirty
You will need to inject some custom JavaScript code in the Web Author iframe. This can be done using a plugin as I explained in the previous post.
This JS code should first get a reference to the editor once it is opened, e.g.
Code: Select all
goog.events.listen(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, function(e) {
window.editor = e.editor;
});
In order to save the editor you can invoke the editor builtin action using a code like the one below:
Code: Select all
editor.getActionsManager().getActionById('Author/Save').actionPerformed(function(){
console.log('done saving');
});
Best,
Cristian
[1] https://www.oxygenxml.com/maven/com/oxy ... ml#isDirty
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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