Spis treści

Usunięcie odległości miedzy akapitami

$this->registerJs("
    CKEDITOR.addCss('.cke_editable p { margin: 0 !important; } body{line-height: normal !important;}');
");

test

Pole formularza

$form->field($model, 'opis')->widget(CKEditor::className(), [
                'preset' => 'full',
                'clientOptions' => [
                    'extraPlugins' => 'justify',
                    'skin' => 'kama',
                    'height'=>200
                ]
            ])->label('Opis');

Ładowanie ajaxem treści do edytora

model: GrupyStudentowZapisy

<?=
$form->field($model, 'mail')->widget(CKEditor::className(), [
    'preset' => 'standard',
    'clientOptions' => [
        'extraPlugins' =>
        'justify',
        'height' => '200',
        'skin' => 'kama'
    ]
])->label('Treść maila powiadamiającego');
?>
 
<?=
$form->field($model, 'opis')->widget(CKEditor::className(), [
    'preset' => 'standard',
    'clientOptions' => [
        'extraPlugins' =>
        'justify',
        'height' => '200',
        'skin' => 'kama'
    ]
])->label('Opis');
?>
 
$('#zestaw').on('change', function () {
    $.ajax({
        url: '/grzapisy/zestawy/dane?id=' + $(this).val(),
        type: 'GET',
        dataType: 'json',
        success: function (data) {
            var editor_m = CKEDITOR.instances['grupystudentowzapisy-mail'];
            var editor_o = CKEDITOR.instances['grupystudentowzapisy-opis'];
 
            editor_m.setData(data.mail);
            editor_o.setData(data.opis);
        },
        error: function () {
            console.error('Wystąpił błąd podczas pobierania danych.');
        }
    });
});