Right Click Actions
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 21
- Joined: Wed Jan 16, 2019 5:16 am
Right Click Actions
Post by nstensland »
Is it possible to register a command via JavaScript API into the right click menu? I was able to register it into the toolbar but cannot find a way to register into the right click menu. I understand that it is possible via framework, am wondering if it is possible via JavaScript API.
Thanks,
Nat
Thanks,
Nat
Re: Right Click Actions
Hi Nat,
Sure, from the Javascript code you can call any Java API you want.
In the sample project:
https://github.com/oxygenxml/wsaccess-j ... le-plugins
there are 3 plugin folders with names starting with contributePopupAction which may be interesting as examples for you.
Regards,
Radu
Sure, from the Javascript code you can call any Java API you want.
In the sample project:
https://github.com/oxygenxml/wsaccess-j ... le-plugins
there are 3 plugin folders with names starting with contributePopupAction which may be interesting as examples for you.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 21
- Joined: Wed Jan 16, 2019 5:16 am
Re: Right Click Actions
Post by nstensland »
I meant javascript running in the client browser. We are using Oxygen Web Author. We are integration via a html Frame.
Is there a list of what the differences is between Oxygen stand alone and Web Author. It seems there are differences and some items which are not available in Web Author?
Can I add right click actions in javascript, in client browser via framework.js for example?
Thanks,
Nat
Is there a list of what the differences is between Oxygen stand alone and Web Author. It seems there are differences and some items which are not available in Web Author?
Can I add right click actions in javascript, in client browser via framework.js for example?
Thanks,
Nat
-
- Posts: 496
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Right Click Actions
Post by cristi_talau »
Hello,
Web Author displays only the actions configured in the framework that are compatible with the web. For example, an action that displays a Java Swing dialog is not compatible.
If you implemented custom AuthorOperations, that you think are compatible with Web Author but still don't show up in the context menu, you should annotate them with @WebappCompatible [1].
If some of the builtin actions do not show up, it means that they are most likely not compatible with Web Author. If you consider one of the missing actions is important, please report this to us and we will prioritize making it compatible in a future version.
Regarding adding actions from JS code, you can follow the tutorial here [2]. Instead of actionsConfig.toolbars you should work with actionsConfig.contextualItems [3]. This way you can replace the incompatible action with a JS-based implementation.
Best,
Cristian
[1] https://www.oxygenxml.com/InstData/Edit ... tible.html
[2] https://www.oxygenxml.com/maven/com/oxy ... ction.html
[3] https://www.oxygenxml.com/maven/com/oxy ... Event.html
Web Author displays only the actions configured in the framework that are compatible with the web. For example, an action that displays a Java Swing dialog is not compatible.
If you implemented custom AuthorOperations, that you think are compatible with Web Author but still don't show up in the context menu, you should annotate them with @WebappCompatible [1].
If some of the builtin actions do not show up, it means that they are most likely not compatible with Web Author. If you consider one of the missing actions is important, please report this to us and we will prioritize making it compatible in a future version.
Regarding adding actions from JS code, you can follow the tutorial here [2]. Instead of actionsConfig.toolbars you should work with actionsConfig.contextualItems [3]. This way you can replace the incompatible action with a JS-based implementation.
Best,
Cristian
[1] https://www.oxygenxml.com/InstData/Edit ... tible.html
[2] https://www.oxygenxml.com/maven/com/oxy ... ction.html
[3] https://www.oxygenxml.com/maven/com/oxy ... Event.html
-
- Posts: 21
- Joined: Wed Jan 16, 2019 5:16 am
Re: Right Click Actions
Post by nstensland »
Thanks. Seems to work using contextualItems!
Quick follow up: sync.api.Workspace.EventType.EDITOR_LOADED, why does this get called 3 times when a page loads? First two times toolbar is null. Not sure from documentation what EDITOR_LOADED means exactly I guess.
Thanks again,
Nat
Quick follow up: sync.api.Workspace.EventType.EDITOR_LOADED, why does this get called 3 times when a page loads? First two times toolbar is null. Not sure from documentation what EDITOR_LOADED means exactly I guess.
Thanks again,
Nat
-
- Site Admin
- Posts: 95
- Joined: Thu Jun 09, 2016 2:01 pm
Re: Right Click Actions
Post by Gabriel Titerlea »
The EDITOR_LOADED event is called only once. Maybe you are referring to the ACTIONS_LOADED event.why does this get called 3 times when a page loads
Look at this code to better understand how the events are fired:
Code: Select all
goog.events.listen(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, function(e) {
console.log('EDITOR_LOADED');
// This code will be called only once, after the editor is loaded.
var editor = e.editor;
goog.events.listen(editor, sync.api.Editor.EventTypes.ACTIONS_LOADED, function(e) {
console.log('ACTIONS_LOADED');
// This code will be called 3 times. Once for every toolbar that is loaded in the editor.
var actionsConfiguration = e.actionsConfiguration;
// This should have a value every time this function is called. Are you sure this is null?
var toolbars = actionsConfiguration.toolbars;
// These 2 objects are only present during the third call of this
// function if the active framework provides actions or contextualItems.
var actions = actionsConfiguration.actions;
var contextualItems = actionsConfiguration.contextualItems;
console.log('Toolbars: ', toolbars);
console.log('Actions: ', actions);
console.log('ContextualItems: ', contextualItems);
});
});
-
- Posts: 21
- Joined: Wed Jan 16, 2019 5:16 am
Re: Right Click Actions
Post by nstensland »
Sorry yes, pasted the wrong thing. Action I meant. Thanks.
-
- Posts: 21
- Joined: Wed Jan 16, 2019 5:16 am
Re: Right Click Actions
Post by nstensland »
Is there a way to override the copy,cut and paste commands using frameworks.js client side browser approach?
Thanks again!
Nat
Thanks again!
Nat
-
- Posts: 496
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Right Click Actions
Post by cristi_talau »
Hello,
To override an action from the context menu you have to register your action with the same ID in the ActionsManager.
However, implementing cut/copy/paste actions yourself in the browser is quite complicated due to security restrictions. If you give us more details about what you are trying to achieve, we may give you a better advice.
For example, in order to customize what happens when you paste from an external document (Word, HTML, etc) there is a stylesheet that you can modify [1].
Best,
Cristian
[1] https://www.oxygenxml.com/doc/versions/ ... mart-paste
To override an action from the context menu you have to register your action with the same ID in the ActionsManager.
However, implementing cut/copy/paste actions yourself in the browser is quite complicated due to security restrictions. If you give us more details about what you are trying to achieve, we may give you a better advice.
For example, in order to customize what happens when you paste from an external document (Word, HTML, etc) there is a stylesheet that you can modify [1].
Best,
Cristian
[1] https://www.oxygenxml.com/doc/versions/ ... mart-paste
-
- Posts: 21
- Joined: Wed Jan 16, 2019 5:16 am
Re: Right Click Actions
Post by nstensland »
This is an internal copy/paste. What is the 'action id' of cut, copy and paste built in commands in the contextual menu? Trying to replace it or remove without success.
-
- Posts: 496
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Right Click Actions
Post by cristi_talau »
Hello,
To find the Id of an action you can follow the steps here [1].
The IDs of the Cut/Copy/Paste actions in the context menu are:
- Author/CutSpecial
- Author/CopySpecial
- Author/PasteSpecial
And the actions that are bound to shortcuts are
- Author/Cut
- Author/Copy
- Author/Paste
Best,
Cristian
[1] https://www.oxygenxml.com/maven/com/oxy ... ction.html
To find the Id of an action you can follow the steps here [1].
The IDs of the Cut/Copy/Paste actions in the context menu are:
- Author/CutSpecial
- Author/CopySpecial
- Author/PasteSpecial
And the actions that are bound to shortcuts are
- Author/Cut
- Author/Copy
- Author/Paste
Best,
Cristian
[1] https://www.oxygenxml.com/maven/com/oxy ... ction.html
Return to “SDK-API, Frameworks - Document Types”
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