Detect switch to EDIT_AS_XML_DESCRIPTION action
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
Detect switch to EDIT_AS_XML_DESCRIPTION action
Hello,
We use Author web in version 27.0.0, and we are looking for an equivalent of the method :
For our desktop version, with oxygen sdk, we use this to update our available actions if we are in Author or Text mode.
I tried to add it this way :
With WSEditorSwitchTabListener extends WSEditorListener and S1000DWorkspaceAccessPluginExtension added in plugin.xml file
The listener is well added to documentModel.getWSEditor() but it does not work.
I try to find the event listener to handle it like that in javascript
But I did not find the good EventType.
Can you tell me how to do it properly ?
Thank you
Regards,
Isabelle
We use Author web in version 27.0.0, and we are looking for an equivalent of the method :
Code: Select all
WSEditorPageChangedListener.editorPageChanged
I tried to add it this way :
Code: Select all
public class S1000DWorkspaceAccessPluginExtension implements WorkspaceAccessPluginExtension {
@Override
public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) {
WebappPluginWorkspace workspace = (WebappPluginWorkspace) pluginWorkspaceAccess;
workspace.addEditingSessionLifecycleListener(new WebappEditingSessionLifecycleListener() {
@Override
public void editingSessionStarted(String sessionId, AuthorDocumentModel documentModel) {
documentModel.getWSEditor().addEditorListener(new WSEditorSwitchTabListener(documentModel));
}
});
}
@Override
public boolean applicationClosing() {
return true;
}
}
Code: Select all
<extension type="WorkspaceAccess" class="com._4dconcept.adam.author.web.s1000d.plugin.extension.S1000DWorkspaceAccessPluginExtension"/>
I try to find the event listener to handle it like that in javascript
Code: Select all
goog.events.listen(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, function (e) {
let editor = e.editor;
let editingSupport = editor.getEditingSupport();
if (editingSupport.getType() === sync.api.Editor.EditorTypes.TEXT) {
clearActions();
}
Can you tell me how to do it properly ?
Thank you
Regards,
Isabelle
-
- Site Admin
- Posts: 170
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Detect switch to EDIT_AS_XML_DESCRIPTION action
Post by Bogdan Dumitru »
Hello Isabelle,
The WSEditorSwitchTabListener API works just in Oxygen XML Editor, it doesn't work in Oxygen XML Web Author.
Web Author doesn't have a dedicated API to listen for switches to text page, but please tell us more about your use-case, why you need to listen to switches to text page and maybe we can give you some hooks.
The WSEditorSwitchTabListener API works just in Oxygen XML Editor, it doesn't work in Oxygen XML Web Author.
Web Author doesn't have a dedicated API to listen for switches to text page, but please tell us more about your use-case, why you need to listen to switches to text page and maybe we can give you some hooks.
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
Re: Detect switch to EDIT_AS_XML_DESCRIPTION action
Hello,
It is really annoying for us !
As I explain in my initial post, we use this listener to update custom available actions if we are in Author or Text mode.
For exemple, in Author mode we will show in contextual menu some actions, and hide them in Text mode.
But more important, we have implemented our own grammatical checker et we need to clear all AuthorHighlighter every time user switch to Text mode and go back to Author mode to force user to refresh grammatical checker.
Regards,
Isabelle
It is really annoying for us !
As I explain in my initial post, we use this listener to update custom available actions if we are in Author or Text mode.
For exemple, in Author mode we will show in contextual menu some actions, and hide them in Text mode.
But more important, we have implemented our own grammatical checker et we need to clear all AuthorHighlighter every time user switch to Text mode and go back to Author mode to force user to refresh grammatical checker.
Regards,
Isabelle
-
- Site Admin
- Posts: 170
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Detect switch to EDIT_AS_XML_DESCRIPTION action
Post by Bogdan Dumitru »
Hello Isabelle,
For the contextual menu I don't think there should be done something specific because in Text mode there is no contextual menu. But indeed, the AuthorHighlighter have to be cleared after switching to Author mode.
To intercept the switch to Author mode you can use the EDITABLE_WIDGET_ACTIVE_STATE_CHANGED JavaScript event:
To clear the AuthorHighlighter you can define an operation that clears it, annotate it with WebappRestSafe and WebappCompatible and invoke it from JavaScript using the ActionsManager [1].
[1] https://www.oxygenxml.com/maven/com/oxy ... on__anchor
For the contextual menu I don't think there should be done something specific because in Text mode there is no contextual menu. But indeed, the AuthorHighlighter have to be cleared after switching to Author mode.
To intercept the switch to Author mode you can use the EDITABLE_WIDGET_ACTIVE_STATE_CHANGED JavaScript event:
Code: Select all
editor.getEditingSupport().listen(sync.internal_api.EditableWidgetActiveStateChangedEvent.EDITABLE_WIDGET_ACTIVE_STATE_CHANGED, e => console.log("is text page active: ", e.isActive));
[1] https://www.oxygenxml.com/maven/com/oxy ... on__anchor
Bogdan Dumitru
http://www.oxygenxml.com
http://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