Page 1 of 1

Activate TrackChanges in WebApp

Posted: Fri Oct 21, 2016 11:39 am
by aleh.haidash
I use Webapp 18.0.6. And I need activate trackchanges depending on my condition. How can I do it?
I tried like this way, but it not work. Button "TrackChanges" pressed but Track Changes doesn't work.

Code: Select all


goog.events.listen(window.editor, sync.api.Editor.EventTypes.ACTIONS_LOADED, function(e) {
if(<my condition>){
var trackChangesAction = editor.getActionsManager().getActionById("Author/TrackChanges");
if(trackChangesAction!=null){
trackChangesAction.actionPerformed();
}
}
});

Re: Activate TrackChanges in WebApp

Posted: Fri Oct 21, 2016 2:33 pm
by cristi_talau
Hello,

The "Track changes" state in oXygen can be controlled in several ways:
1. By the user, when pressing the "Toggle change tracking" button.
2. It may be saved in the document (check for a <?oxy_options track_changes="on"?> processing instruction at the end of the document)
3. It is configured as an option (available in the Administration Page in Web Author 18.1).

I tried your code and it seems that:
- it changes the track changes state. It actually changes it three times. Maybe the initial state of the "Track changes" is not the one you expected.
- the toggled state of the button is not updated. Unfortunately there is currently no simple way to update the toggled state of a button. I will register an issue about that.

What you can do instead, if you want also the button state to be updated is to trigger synthetic mouse events on the button. I found this answer to work http://stackoverflow.com/a/24026594 .

Best,
Cristian

Re: Activate TrackChanges in WebApp

Posted: Fri Oct 21, 2016 2:47 pm
by aleh.haidash
Hello.
Thanks for the answer.