Ckeditor自动将类添加到p

时间:2016-09-02 16:10:40

标签: ckeditor

我想添加课程" text-justify"自动到每个p,任何人都知道如何做到这一点?

现在我正在使用此代码:

    CKEDITOR.on('dialogDefinition', function (ev) {
    var dialogName = ev.data.name;
    var dialogDefinition = ev.data.definition;

    if (dialogName == 'table' || dialogName == 'tableProperties') {
        var info = dialogDefinition.getContents('info');

        // Remove fields
        var cellSpacing = info.remove('txtCellSpace');
        var cellPadding = info.remove('txtCellPad');
        var border = info.remove('txtBorder');
        var width = info.remove('txtWidth');
        var height = info.remove('txtHeight');
        var align = info.remove('cmbAlign');
    }
});

$('#content, #longContent').ckeditor({
    contentsCss: '/CMS/style_ckeditor.css',
    allowedContent: true,
    extraPlugins: 'button,menubutton,htmlbuttons,menu,floatpanel,panel',
    htmlbuttons: [
        {
            name:'button1',
            icon:'icon1.png',
            html:'<p class="act-left">Sekretarz Zgromaczenia<br /><strong>Alfred Błaszczyk</strong></p><p class="act-right">Przewodniczący Zgromadzenia<br /><strong>Tomasz Radomski</strong></p><div class="clearfix"></div>',
            title:'Dodaj podpisy'
        },
        {
            name:'button2',
            icon:'icon3.png',
            html:'<ol class="law"><li>&nbsp;<ol><li>tekst</li></ol></li></ol>',
            title:'Dodaj paragraf'
        }
    ]
}).ckeditorGet().on('insertElement', function (event) {
    var el = event.data;

    if (el.is('table')) {
        $(event.data.$)
            .addClass('table table-bordered table-striped')
            .removeAttr('cellpadding cellspacing')
            .wrap('<div class="table-responsive"></div>');
    }
}, null, null, 20);

它适用于为表添加类,但是当我想要与P类似时,它没有用。

0 个答案:

没有答案