Tridion 的用户界面允许您扩展特定的命令,这是修改某些现有命令的行为的好方法。在编辑器的配置文件中,这是通过如下部分完成的:
<ext:commands>
<ext:command name="TextUnderline" extendingcommand="MyTextUnderline"/>
<ext:command name="TextStrikethrough" extendingcommand="MyTextStrikethrough"/>
我正在开发一个通用命令扩展类,可用于修改许多命令的行为:
<ext:commands>
<ext:command name="TextUnderline" extendingcommand="MyCommandExtension"/>
<ext:command name="TextStrikethrough" extendingcommand="MyCommandExtension"/>
所以在第二个配置片段中,我们有相同的MyCommandExtension
延伸两者TextUnderline
and TextStrikethrough
.
但现在在我的 JavaScript 中MyCommandExtension
,我如何确定最初触发的是哪个命令?
MyCommandExtension.prototype.isAvailable = function (selection, pipeline) {
...
console.log(this.properties.name);
...
};
在这种情况下this.properties.name
将被记录为不太有用但完全正确的:
“禁用命令”
我怀疑该信息可以在pipeline
参数,但还没找到。
我怎样才能找到原始命令MyCommandExtension
?