1

当用户单击 Tridion 2013 XPM 中的“取消编辑”按钮时,我想做一些事情。下面是我的配置文件和 JS 文件。问题是当我单击“取消编辑”按钮时 JS 没有被触发。

配置文件

    <?xml version="1.0"?>
    <Configuration                 xmlns="http://www.sdltridion.com/2009/GUI/Configuration/Merge"  xmlns:cfg="http://www.sdltridion.com/2009/GUI/Configuration" xmlns:ext="http://www.sdltridion.com/2009/GUI/extensions" xmlns:cmenu="http://www.sdltridion.com/2009/GUI/extensions/ContextMenu">
<resources cache="true">
<cfg:filters/>
<cfg:groups>
    <cfg:group name="xpmextension.CommandSet">
        <cfg:fileset>
            <cfg:file type="script">/js/xpmextension.js</cfg:file>
            <cfg:file type="reference">xpmextension.Interface</cfg:file>
        </cfg:fileset>
        <cfg:dependencies>
          <cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency>
          <cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency>
        </cfg:dependencies>
    </cfg:group>  
</cfg:groups>   
   </resources>
 <definitionfiles/>
  <extensions>
   <ext:editorextensions>
  <ext:editorextension target="SiteEdit">
    <ext:editurls />
    <ext:listdefinitions/>
    <ext:taskbars/>
    <ext:commands/>     
    <ext:commandextensions>
    <ext:commands>
      <ext:command name="CancelEditing" extendingcommand="xpmextension"/>
    </ext:commands>
    <ext:dependencies>
      <cfg:dependency>xpmextension.CommandSet</cfg:dependency>
    </ext:dependencies>
    </ext:commandextensions>        
    <ext:contextmenus/>
    <ext:lists/>
    <ext:tabpages/>
    <ext:toolbars/>     
    <ext:ribbontoolbars/>           
  </ext:editorextension>
</ext:editorextensions>
<ext:dataextenders/>
 </extensions>  
 <commands>
<cfg:commandset id="xpmextension.intereface">
<cfg:command name="xpmextension" implementation="Extensions.xpmextension"/>
<cfg:dependencies>
<cfg:dependency>xpmextension</cfg:dependency>
</cfg:dependencies>
</cfg:commandset>
 </commands>
 <contextmenus/>
 <localization/>
 <settings>
<defaultpage>/Views/Default.aspx</defaultpage>
<navigatorurl>/Views/Default.aspx</navigatorurl>
<editurls/>
<listdefinitions/>
<itemicons/>
<theme>
  <path>css</path>
</theme>
<customconfiguration/>
</settings>
</Configuration>

下面是我的 JS 文件

Type.registerNamespace("Extensions");

  Extensions.xpmextension = function Extensions$xpmextension()
  {
   Type.enableInterface(this, "Extensions.xpmextension");
   this.addInterface("Tridion.Cme.Command", ["xpmextension"]);
  };
  
  Extensions.xpmextension.prototype.isAvailable = function xpmextension$isAvailable(selection) {
  return true;
  }
  
  Extensions.xpmextension.prototype.isEnabled = function xpmextension$isEnabled(selection) {
  return true;
  }

      Extensions.xpmextension.prototype._execute = function xpmextension$_execute(selection) 
      {      
      alert("You have clicked the button");
	  alert(window.location.href);
      
      }

4

0 回答 0