Adding shortcut keys

Post here questions and problems related to oXygen frameworks/document types.
akheiljain
Posts: 22
Joined: Wed Nov 28, 2018 8:13 pm

Adding shortcut keys

Post by akheiljain » Wed Nov 28, 2018 8:17 pm

I would like to configure/customize a keyboard shortcut & Tool bar menu to perform the following action.
unwrap element <email> everywhere in the current document.
How would I go about implementing this functionality.
Background: I am looking into changing authoring tools from XMetal to Oxygen and trying to figure out how to port my MACRO's from XMetal to Oxygen.

Radu
Posts: 7120
Joined: Fri Jul 09, 2004 5:18 pm

Re: Adding shortcut keys

Post by Radu » Thu Nov 29, 2018 12:40 pm

Hi,

I will assume you also want to share this custom action with others.
Usually you would first need the extend the DITA framework configuration and save that extension to a separate folder:

http://blog.oxygenxml.com/2015/08/docum ... aring.html

The DITA framework extension has an "Author" tab with an "Actions" tab in which you can define new actions, actions which can be added to the DITA main menu, contextual menu or toolbar:

https://www.oxygenxml.com/doc/versions/ ... olbar.html

An action can call various operations in various XPath activation contexts, we do have an "UnwrapTagsOperation" operation:

https://www.oxygenxml.com/doc/versions/ ... tions.html

but it unwraps the tag only for the first element selected by the XPath expression so it would not be that good for your needs.
You can define your custom "AuthorOperation" Java implementation which would use our API to make changes to the document:

https://www.oxygenxml.com/InstData/Edit ... oller.html

or you could use the existing "JSOperation" and pass to it some Javascript code which uses our Java API to make changes to the document, this would look something like this:

https://github.com/oxygenxml/javascript ... keyrefs.js

I do not have a sample doing exactly what you want but if you want I can try to come up with the code for it next week and update this forum thread.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Cosmin Duna
Posts: 20
Joined: Wed Dec 12, 2018 5:33 pm

Re: Adding shortcut keys

Post by Cosmin Duna » Wed Dec 12, 2018 5:43 pm

Hi,
We created a 'JSOperation' for unwrap the 'email' element:
https://github.com/oxygenxml/javascript ... lements.js

For change the unwrapped element, you can edit the 'elementToUnwrap' variable.

Regards,
Cosmin
Cosmin Duna
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply