Page 1 of 1

Call multiple AuthorOperation implementations in Web Author action?

Posted: Wed Jun 27, 2018 10:27 pm
by hatchjk
We recently upgraded from Web Author 18.1 to 20.0. Under 18.1, we had the following simple action defined for Web Author (displaying only the actionPerformed function for brevity):

Code: Select all

MarkCrossRefAction.prototype.actionPerformed = function (callback) {
var url = window.prompt("Cross Reference URL:", "");
if (url) {
var surroundWith = '<a class="cross-ref" href="' + url + '"></a>';
var am = this.editor.getActionsManager();
am.invokeOperation('ro.sync.ecss.extensions.commons.operations.SurroundWithFragmentOperation', {
fragment: surroundWith
},
function () {
am.invokeOperation('org.lds.cm.ldssource.framework.operations.InsertLinkPrefixOperation', {
},
callback);
});
} else {
callback && callback();
}
};
The purpose of the second invokeOperation call is to place a customized prefix onto the URL value of the link generated by the first invoked operation (SurroundWithFragmentOperation). This prefix is generated by a custom AuthorOperation implementation, InsertLinkPrefixOperation. This operation operates on the selected node, which is the newly generated cross-reference link installed by the previously invoked operation.

This no longer works under v20.0 -- no exceptions thrown, it seems to just ignore the call to InsertLinkPrefixOperation. From inspection of the Web Author JS API it isn't apparent if something different has to happen for this to work going forward. Do we need to be more explicit in identifying the selection on which the second operation should accept? Any help?

Re: Call multiple AuthorOperation implementations in Web Author action?

Posted: Thu Jun 28, 2018 1:59 pm
by cristi_talau
Hello,

From the symptoms you described it seems that the operation "org.lds.cm.ldssource.framework.operations.InsertLinkPrefixOperation" is not annotated as safe to be invoked from the JS code. The annotation is "ro.sync.ecss.extensions.api.webapp.WebappRestSafe". This annotation is enforced starting from version 20.

Anyway, to confirm this you can look in the server-side logs for more information: https://www.oxygenxml.com/doc/versions/ ... -logs.html .

Best,
Cristian