Page 1 of 1
Adding shortcut keys
Posted: Wed Nov 28, 2018 8:17 pm
by akheiljain
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.
Re: Adding shortcut keys
Posted: Thu Nov 29, 2018 12:40 pm
by Radu
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
Re: Adding shortcut keys
Posted: Wed Dec 12, 2018 5:43 pm
by Cosmin Duna
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