2amigos / yii2-ckeditor-widget

CKEditor WYSIWYG widget for Yii2.
https://2amigos.us/open-source/ckeditor-widget
Other
172 stars 111 forks source link

how can I do a custom preset or remove some buttons from basic? #132

Closed rizrob66 closed 5 years ago

rizrob66 commented 5 years ago

please help me, I need a custom preset or remove some buttons from basic? riz

Aribros commented 5 years ago

Just declare preset as "custom", then add/remove the necessary cofiguration in the clientOptions array. See the example code below.

    <?= $form->field($model, 'message')->widget(CKEditor::className(), [
        'options' => ['rows' => 6],
        'preset' => 'custom',
        'clientOptions' => [
            'height' => 400,
            'toolbarGroups' => [
                ['name' => 'undo'],
                ['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']],
                ['name' => 'colors'],
                ['name' => 'links', 'groups' => ['links', 'insert']],
                ['name' => 'others', 'groups' => ['others', 'about']],
            ],
            'removeButtons' => 'Subscript,Superscript,Flash,Table,HorizontalRule,Smiley,SpecialChar,PageBreak,Iframe',
            'removePlugins' => 'elementspath',
            'resize_enabled' => false
        ]
    ]) ?>