Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 如何在tinymce中添加新按钮_Jquery_Content Management System_Tinymce - Fatal编程技术网

Jquery 如何在tinymce中添加新按钮

Jquery 如何在tinymce中添加新按钮,jquery,content-management-system,tinymce,Jquery,Content Management System,Tinymce,我已经解决了我的部分,几乎添加了一个按钮 setup : function(ed) { // Add a custom button ed.addButton('Information', { title : 'Viktig Information', image : '../img/page_white_text.png', onclick : function() { // Add you own

我已经解决了我的部分,几乎添加了一个按钮

    setup : function(ed) {
    // Add a custom button
    ed.addButton('Information', {
        title : 'Viktig Information',
        image : '../img/page_white_text.png',
        onclick : function() {
            // Add you own code to execute something on click
            ed.focus();
            ed.selection.setContent('Text here');
    }
    });
}
但现在我想知道我如何才能让它像他们的粗体按钮一样工作?因此,当我按下粗体时,文本变为粗体


我希望我的按钮也一样,当我按下按钮时,我希望出现一个div。有人知道我怎么做吗

初始化TinyMCE时,可以指定哪行上有哪些按钮

这里有一些文档


这是一项容易完成的任务。 只需在编辑器init函数中添加类似的内容。 我也看到了


但我指的是我自己的按钮。我想做一个自己的按钮,我自己的功能,与tinymce一起工作。你使用tinymce 3或4吗?这部分我已经解决了,但我希望它像粗体文本一样,所以它添加了Textthx,用于接受我的答案。如果你发现一个答案特别有用,你甚至可以选择这样一个答案:
tinyMCE.init({
  ...
  theme_advanced_buttons1: 'bold,italic,..'

  setup: function(ed) {

      ed.onInit.add(function(ed) {
        // Scroll runter
        ed.addCommand('my_own_command', function() {
          alert('my_own_command called!');
        });
      });

      // Register example button
      ed.addButton('example', {
        title: 'example.desc',
        // make sure the image exists
        image: '../jscripts/tiny_mce/plugins/example/img/example.gif',
        onclick: function() {
          ed.windowManager.alert('Hello world!!');
          // execute my_own_command
          ed.execCommand('my_own_command');
        }
      });
    }, // end setup
    ...
});