php - 编辑器选中加粗的代码是什么
高洛峰
高洛峰 2017-04-11 10:26:12
0
0
279

以下代码是在编辑器中通过点击H2按钮,弹窗输入信息输出这个结果:[h2]弹窗输入的内容[/h2]

(function () {
    function Wecenterh2Dialog(editor) {
 
        return {
            title: 'H2',
            minWidth: 470,
            minHeight: 110,
            buttons: [
                CKEDITOR.dialog.okButton,
                CKEDITOR.dialog.cancelButton
            ],
            contents:
            [
                {
                    elements:
                    [
                        {
                            id: 'text',
                            type: 'text',
                            required: true,
                            commit: function () {
                                if (this.getValue()) {
                                    editor.insertHtml('[h2]' + this.getValue()  + '[/h2]');
                                    //editor.insertText( '!![输入内容](' + this.getValue() + ')' );
                                }
                            }
                        },
                        {
                            type: 'html',
                            html : '<p style="font-size:14px;color:#999;">我们目前支持: h2 !</p>'
                        }
                    ]
                }
            ],
            onLoad: function () {
                //alert('onLoad');
            },
            onShow: function () {
                //alert('onShow');
            },
            onHide: function () {
                //alert('onHide');
            },
            onOk: function () {
                this.commitContent();
            },
            onCancel: function () {
                //alert('onCancel');
            },
            resizable: false
        };
    }
 
    CKEDITOR.dialog.add('Wecenterh2', function (editor) {
        return Wecenterh2Dialog(editor);
    });
})();

现在我不想让他通过弹窗的方式输入,怎么修改可以通过编辑器中【B】也就是加粗的方式直接,选中文章中某些内容(比如选中文章中的:弹窗输入的内容,然后按下编辑器的H2)后直接输出:[h2]弹窗输入的内容[/h2]

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

全部回复(0)
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!