ckeditor插件开发简单实例(ckeditor配置)万万没想到

随心笔谈9个月前发布 admin
74 0

(function() {

    //Section 1 : 按下自定义按钮时执行的代码

    var a={

        exec: function(editor) {

        var data=””; 

        var mySelection=editor.getSelection();

        if (CKEDITOR.env.ie) {

            mySelection.unlock(true);

            data=mySelection.getNative().createRange().text;

        } else {

            data=mySelection.getNative();

        }

        if(data!=null&&data!=”){

            editor.insertHtml(data+’ckeditor插件开发简单实例(ckeditor配置)万万没想到‘);

        }

        }

    },

    b=’addmap’;

    CKEDITOR.plugins.add(b, {

        init: function(editor) {

            editor.addCommand(b, a);

            editor.ui.addButton(‘addmap’, {

                label: ‘add map link’,

                icon: this.path + ‘map.gif’,

                command: b

            });

        }

    });

})();

© 版权声明

相关文章