Call multiple AuthorOperation implementations in Web Author action?
Posted: Wed Jun 27, 2018 10:27 pm
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):
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?
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();
}
};
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?