Webapp 18 set content
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 61
- Joined: Tue Oct 27, 2015 11:49 am
Webapp 18 set content
Post by Konstantin »
Hi !!!
In Applet we set new content to editor thru:
Now in Webapp 18 I try do it thru this:
But it does not works and I can't find opportunity to do it.
How can I do it?
In Applet we set new content to editor thru:
Code: Select all
final WSEditor editorAccess = editorComponent.getWSEditorAccess();
editorAccess.reloadContent(new StringReader(xmlContent), false);
Code: Select all
private AuthorDocumentModel documentModel;
...
documentModel.getWSEditor().reloadContent(new StringReader("99999999999"), false);
How can I do it?
-
- Site Admin
- Posts: 95
- Joined: Thu Jun 09, 2016 2:01 pm
Re: Webapp 18 set content
Post by Gabriel Titerlea »
Dear Konstantin,
The Web Author client does not know that the server model has changed unless it asks for the specific information.
I have added an issue for your request and it should be available in the next maintenance build (about 3 weeks from now).
The new API will allow you to synchronize the content of the client with the content of the document from the server.
The API is already available in version 18 but it's not documented and it doesn't work with full-tags sentinels mode.
You can test it right now by calling the editor.restoreContent() method using javascript [1].
You can save a reference to the editor instance by listening for the EDITOR_LOADED event:
If you are developing a plugin for Web Author, you only need to add a javascript file to a web folder inside your plugin and it will be loaded into the Web Author.
[1] - https://www.oxygenxml.com/maven/com/oxy ... index.html
Regards,
Gabriel
The Web Author client does not know that the server model has changed unless it asks for the specific information.
I have added an issue for your request and it should be available in the next maintenance build (about 3 weeks from now).
The new API will allow you to synchronize the content of the client with the content of the document from the server.
The API is already available in version 18 but it's not documented and it doesn't work with full-tags sentinels mode.
You can test it right now by calling the editor.restoreContent() method using javascript [1].
You can save a reference to the editor instance by listening for the EDITOR_LOADED event:
Code: Select all
(function () {
goog.events.listen(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, function(e) {
// Save the editor for later use.
var editor = e.editor;
});
// At a later time, when you need to restore the content of the client editor, you can call:
try {
editor.restoreContent();
} catch (e) {
// Note: The method will throw a benign error in version 18 so you might want to wrap it inside a try-catch
}
})();
[1] - https://www.oxygenxml.com/maven/com/oxy ... index.html
Regards,
Gabriel
-
- Posts: 61
- Joined: Tue Oct 27, 2015 11:49 am
-
- Posts: 32
- Joined: Tue May 26, 2015 10:28 am
Re: Webapp 18 set content
Post by aleh.haidash »
Hello.Gabriel Titerlea wrote:Dear Konstantin,
The Web Author client does not know that the server model has changed unless it asks for the specific information.
I have added an issue for your request and it should be available in the next maintenance build (about 3 weeks from now).
The new API will allow you to synchronize the content of the client with the content of the document from the server.
The API is already available in version 18 but it's not documented and it doesn't work with full-tags sentinels mode.
You can test it right now by calling the editor.restoreContent() method using javascript [1].
You can save a reference to the editor instance by listening for the EDITOR_LOADED event:If you are developing a plugin for Web Author, you only need to add a javascript file to a web folder inside your plugin and it will be loaded into the Web Author.Code: Select all
(function () {
goog.events.listen(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, function(e) {
// Save the editor for later use.
var editor = e.editor;
});
// At a later time, when you need to restore the content of the client editor, you can call:
try {
editor.restoreContent();
} catch (e) {
// Note: The method will throw a benign error in version 18 so you might want to wrap it inside a try-catch
}
})();
[1] - https://www.oxygenxml.com/maven/com/oxy ... index.html
Regards,
Gabriel
I tried use this solution, but it doesn't work.
I use doc url like this http://<host>/webapp_editor?sourceDocPath=<path to document>. After opening document i recieve request on my servlet (webapp_editor), but after calling editor.restoreContent() the request didn't come.
How can I send request for refreshing content in editor using servlet?
Best Regards,
Aleh
Aleh
-
- Site Admin
- Posts: 95
- Joined: Thu Jun 09, 2016 2:01 pm
Re: Webapp 18 set content
Post by Gabriel Titerlea »
Hello,
First, a few explanations:
During an editing session with Web Author 3 versions of a file are used:
- The original file stored on disk [_]
- The file from disk stored in the server memory [s]
- The file from disk stored in the browser memory
The two versions, [s] and , are constantly synchronised. However it is possible to make changes to the server version [s]
without the browser knowing about it. In this case we will call editor.restoreContent to synchronize the content from the server [s]
with the content from the browser .
The original file [_] is only modified when one saves the document or when one initially opens the file for editing.
That being said if you want to refresh the content from content references you can use this method:
post39974.html#p40382
If you will open a file which contains a conref to another file and you will use the method linked above you will notice that
Web Author will make a request for the referred file and will bring the content into the currently opened document in the browser.
Because editor.restoreContent is not marked as API and is subject to change I would suggest to avoid using it.
Best,
Gabriel
First, a few explanations:
During an editing session with Web Author 3 versions of a file are used:
- The original file stored on disk [_]
- The file from disk stored in the server memory [s]
- The file from disk stored in the browser memory
The two versions, [s] and , are constantly synchronised. However it is possible to make changes to the server version [s]
without the browser knowing about it. In this case we will call editor.restoreContent to synchronize the content from the server [s]
with the content from the browser .
The original file [_] is only modified when one saves the document or when one initially opens the file for editing.
That being said if you want to refresh the content from content references you can use this method:
post39974.html#p40382
If you will open a file which contains a conref to another file and you will use the method linked above you will notice that
Web Author will make a request for the referred file and will bring the content into the currently opened document in the browser.
Because editor.restoreContent is not marked as API and is subject to change I would suggest to avoid using it.
Best,
Gabriel
-
- Posts: 32
- Joined: Tue May 26, 2015 10:28 am
Re: Webapp 18 set content
Post by aleh.haidash »
I understood.
But I have a case like this:
1) User 1 opens document in Webapp in readOnly mode
2) User 2 opens this document in editing mode -> add some changes -> save document
3) Send a event to user 1 with notifocation.
How can I refresh content for user 1 (without reopening the tab)?
But I have a case like this:
1) User 1 opens document in Webapp in readOnly mode
2) User 2 opens this document in editing mode -> add some changes -> save document
3) Send a event to user 1 with notifocation.
How can I refresh content for user 1 (without reopening the tab)?
Best Regards,
Aleh
Aleh
-
- Site Admin
- Posts: 95
- Joined: Thu Jun 09, 2016 2:01 pm
Re: Webapp 18 set content
Post by Gabriel Titerlea »
I understand.
It's not possible to do that at the moment but I will add your vote to the issue for implementing this.
Best,
Gabriel
It's not possible to do that at the moment but I will add your vote to the issue for implementing this.
Best,
Gabriel
-
- Posts: 32
- Joined: Tue May 26, 2015 10:28 am
Re: Webapp 18 set content
Post by aleh.haidash »
Hello.
I would like to raise this issue again.
Are this feature available in 19.1?
BR,
Aleh
I would like to raise this issue again.
Are this feature available in 19.1?
BR,
Aleh
Best Regards,
Aleh
Aleh
-
- Site Admin
- Posts: 95
- Joined: Thu Jun 09, 2016 2:01 pm
Re: Webapp 18 set content
Post by Gabriel Titerlea »
Hello,
In 19.1 you can reload the content of a document by invoking the ReloadContentOperation[1] operation.
You can invoke this operation from a javascript plugin like this:
You might find this tutorial useful as well [2][3].
Best regards,
Gabriel
[1] https://www.oxygenxml.com/InstData/Edit ... ation.html
[2] https://www.oxygenxml.com/maven/com/oxy ... ction.html
[3] https://www.oxygenxml.com/maven/com/oxy ... nager.html
In 19.1 you can reload the content of a document by invoking the ReloadContentOperation[1] operation.
You can invoke this operation from a javascript plugin like this:
Code: Select all
editor.getActionsManager().invokeOperation(
'ro.sync.ecss.extensions.commons.operations.ReloadContentOperation', {},
function () {
console.log('content reloaded')
}
);
Best regards,
Gabriel
[1] https://www.oxygenxml.com/InstData/Edit ... ation.html
[2] https://www.oxygenxml.com/maven/com/oxy ... ction.html
[3] https://www.oxygenxml.com/maven/com/oxy ... nager.html
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