Page 1 of 1

Change editing options for Dita in Oxygen web author

Posted: Tue May 31, 2016 4:17 pm
by mitpatoliya
Hi I am newbie to oxygenxml

I am using oxygen web author as dita editing platform.
I also have requirement where I want to customize options which are available when we right click on dita file during edit.
Now I am not sure what all steps I need to do. I understand I need to use Oxygen SDK to do that but I see many different things available there.
Will appreciate any help there.

Re: Change editing options for Dita in Oxygen web author

Posted: Tue May 31, 2016 5:19 pm
by cristi_talau
Hello,

The documentation for integrations can be found in the user manual here [1]. Depending on the type of actions you want to add/remove in the context menu there are two approaches:
1. The actions are DITA-related. In this case you should edit the default DITA "framework". You can use an oXygen Desktop application to configure the DITA framework using its GUI. More details here [2].
2. Otherwise, you can write a JavaScript plugin to add/remove actions from the context menu. More details in the user manual [3] and in this tutorial [4].

If you provide more details about your goal, we can give you more specific advice.

Best,
Cristian

[1] https://www.oxygenxml.com/doc/versions/ ... rview.html
[2] https://www.oxygenxml.com/doc/versions/ ... works.html
[3] https://www.oxygenxml.com/doc/versions/ ... ng_js.html
[4] https://www.oxygenxml.com/maven/com/oxy ... ction.html

Re: Change editing options for Dita in Oxygen web author

Posted: Tue May 31, 2016 6:33 pm
by mitpatoliya
Thanks a lot for quick response.

I want to basically remove most of those options which are visible when you right click on dita xml file because those users will not have much idea on dita. For them important document will be pdf which will be generated as output from that xml.
Hope this gives more idea.

Re: Change editing options for Dita in Oxygen web author

Posted: Wed Jun 01, 2016 10:48 am
by cristi_talau
Hello,

In order to remove DITA-related actions from the context, you can use the Contextual Menu editor in the Document Type Configuration dialog [1].

Regarding the PDF generation, you can setup a web service that generates the PDF from the DITA content. This web service will simply invoke the DITA-OT PDF transformation. Then you can add an action in the Web Author to simply download the PDF document.

Best,
Cristian

[1] http://oxygenxml.com/doc/versions/18.0/ ... b-tab.html

Re: Change editing options for Dita in Oxygen web author

Posted: Thu Jun 02, 2016 2:32 pm
by mitpatoliya
Thanks Cristian for you prompt response.

Could you please point me to proper API which I should use to remove editing options?

I have created new plugin.js and placed in my app folder. It is loaded correctly.

Now I need logic to remove those existing edit actions.I am checking this but now sure which to use.
https://www.oxygenxml.com/maven/com/oxy ... ditor.html

Re: Change editing options for Dita in Oxygen web author

Posted: Thu Jun 02, 2016 3:23 pm
by cristi_talau
Hello,

You should listen for the ACTIONS_LOADED_EVENT on the editor. In the event handler you should remove the action from the ActionsManager:

Code: Select all

editor.getActionsManager().unregisterAction(actionId)


Note that the ACTIONS_LOADED_EVENT is triggered multiple times as actions are loaded incrementally.

Best,
Cristian

Re: Change editing options for Dita in Oxygen web author

Posted: Thu Jun 02, 2016 4:55 pm
by mitpatoliya
Thanks a lot.
I was able to disable most of the actions using following code

Code: Select all

//alert("hiiii");
goog.events.listen(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, function(e) {
  var editor = e.editor;
  // Register the newly created action.
  //editor.getActionsManager().registerAction('insert.link', new WebLinkAction(editor));
 // alert("loadded");
 
  var am=editor.getActionsManager();
  am.unregisterAction("Author/InsertElement");
  am.unregisterAction("Author/RenameElement");
  am.unregisterAction("Author/Print");
  am.unregisterAction("Author/Undo");
  am.unregisterAction("Author/Redo");
  am.unregisterAction("Author/Enter");
  am.unregisterAction("Author/Copy");
  am.unregisterAction("Author/Paste");
  am.unregisterAction("Author/Cut");
  am.unregisterAction("Author/Tab");
  am.unregisterAction("Author/CopySpecial");
  am.unregisterAction("Author/PasteSpecial");
  am.unregisterAction("Author/DummyCut");
  am.unregisterAction("Author/Download");
  am.unregisterAction("Author/About");
  am.unregisterAction("Author/ShowXML");
  am.unregisterAction("Author/FindReplace");
  am.unregisterAction("App/FocusAttributesPanel");
 am.unregisterAction("Author/ReportProblem");
 am.unregisterAction("Author/About");
 am.unregisterAction("Author/Help");
 am.unregisterAction("Author/ShiftTab");
 am.unregisterAction("Author/ReportProblem");
 am.unregisterAction("Author/SurroundWithElement");
 am.unregisterAction("Author/ValidationResults");
 var tc=am.getActionById("Author/TrackChanges");
 tc.isTrackingChanges_=true;

});


Now facing only two major issue.
Few actions are still there.

I want to keep tracking option on for all document how do I do that? Trying with following code but no success.
var tc=am.getActionById("Author/TrackChanges");
tc.isTrackingChanges_=true;

Re: Change editing options for Dita in Oxygen web author

Posted: Thu Jun 02, 2016 5:07 pm
by cristi_talau
Hello,

Regarding the actions you disabled. I am not sure which actions are still there. I guess that they are DITA-related actions. The best way to edit those is to configure the DITA framework as I described in a previous post using the Context Menu editor [1].

A less robust approach is to remove them using the JS API but you will have to figure out their IDs. You can find them by dumping the actions manager to the browser console and look at all the registered actions.

Regarding the track changes enforcement. You can invoke the "TrackChanges" action client-side

Code: Select all

tc.actionPerformed(function(){})


Best,
Cristian

[1] http://oxygenxml.com/doc/versions/18.0/ ... b-tab.html

Re: Change editing options for Dita in Oxygen web author

Posted: Thu Jun 02, 2016 6:33 pm
by mitpatoliya
Thanks again christian.

I was able to make tracking enabled by your solution.

Remaining actions are "Insert","Genrate ID","Link","Table".

Re: Change editing options for Dita in Oxygen web author

Posted: Fri Jun 03, 2016 8:18 am
by cristi_talau
Hello,

Those actions are added by the default DITA framework. You can use the Document Type Preferences dialog to remove those actions. You may need to delete them from "Author" > "Actions" tab as well as from the "Author" > "Context Menu" tab.

Best,
Cristian