【发布时间】:2012-09-13 16:17:47
【问题描述】:
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 和TextStrikethrough。
但是现在在我的MyCommandExtension 的 JavaScript 中,我如何确定最初触发了哪个命令?
MyCommandExtension.prototype.isAvailable = function (selection, pipeline) {
...
console.log(this.properties.name);
...
};
在这种情况下,this.properties.name 将被记录为不太有用但完全正确:
“禁用命令”
我怀疑该信息在 pipeline 参数中的某处可用,但尚未找到。
如何从MyCommandExtension 中找出原始命令?
【问题讨论】:
标签: tridion