The Tridion user interface allows you to extend specific commands, which is a great way to change the behavior of some existing commands. In the editor configuration file, this is done with the following section:
<ext:commands> <ext:command name="TextUnderline" extendingcommand="MyTextUnderline"/> <ext:command name="TextStrikethrough" extendingcommand="MyTextStrikethrough"/>
I am working on a general command extension class that can be used to change the behavior of several commands:
<ext:commands> <ext:command name="TextUnderline" extendingcommand="MyCommandExtension"/> <ext:command name="TextStrikethrough" extendingcommand="MyCommandExtension"/>
So, in this second fragment of the configuration, we have the same MyCommandExtension , which extends both TextUnderline and TextStrikethrough .
But now in JavaScript for my MyCommandExtension , how can I determine which command was originally run?
MyCommandExtension.prototype.isAvailable = function (selection, pipeline) { ... console.log(this.properties.name); ... };
In this case, this.properties.name will be registered as less useful, but completely correct:
"DisabledCommand"
I suspect that the information is available somewhere in the pipeline parameter, but not yet found.
How to find out the original command from MyCommandExtension ?
source share