小编Fly*_*pig的帖子

如何在CKEditor的Save按钮上捕获click事件

我尝试以这种方式捕获CKEditor的保存按钮上发生的click事件

  var element = CKEDITOR.document.getById('CKEditor1');
  element.on('click', function (ev) {
      //ev.removeListener();
      alert('hello');
      return false;
  });
Run Code Online (Sandbox Code Playgroud)

但它不起作用.当我点击CKEditor的保存按钮时,就会发生回发.如果可能的话,帮助我使用正确的代码示例捕获点击事件发生在CKEditor的保存按钮上.谢谢

我得到了解决方案

  CKEDITOR.plugins.registered['save'] = {
      init: function (editor) {
         var command = editor.addCommand('save',
         {
              modes: { wysiwyg: 1, source: 1 },
              exec: function (editor) { // Add here custom function for the save button
              alert('You clicked the save button in CKEditor toolbar!');
              }
         });
         editor.ui.addButton('Save', { label: 'Save', command: 'save' });
      }
  }
Run Code Online (Sandbox Code Playgroud)

我正在寻找的上述代码.上面的代码帮助我捕获工具栏中的保存按钮的单击事件.谢谢

javascript jquery webforms ckeditor

9
推荐指数
2
解决办法
9986
查看次数

标签 统计

ckeditor ×1

javascript ×1

jquery ×1

webforms ×1