Cleditor - minor plugin error

本秂侑毒 提交于 2019-12-04 16:54:15

Error is here you have

editor.execCommand(data.command, html);

and it should be:

editor.execCommand(data.command, html, null, data.button);

EDIT:

verry annoying, at the end of your function just add:

return false;

here is jsfiddle for that

and final code

(function($) {


  // Define the hello button
  $.cleditor.buttons.video = {
    name: "video",
    image: "video.gif",
    title: "Insert Video",
    command: "inserthtml",
    buttonClick: videoClick
  };


  // Add the button to the default controls before the bold button
  $.cleditor.defaultOptions.controls = $.cleditor.defaultOptions.controls
    .replace("bold", "video bold");


  // Handle the hello button click event
  function videoClick(e, data) {

        // Get the editor
        var editor = data.editor;

        // Insert some html into the document
        var html = "[VIDEO]";
        editor.execCommand(data.command, html, null, data.button);


        // Hide the popup and set focus back to the editor
       // editor.focus();
       return false;
  }


})(jQuery);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!