sangroya/yii2-ckeditor

CKEditor for Yii

Installs: 2 005

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Language:HTML

Type:yii2-extension

dev-main 2021-07-01 07:40 UTC

This package is auto-updated.

Last update: 2024-04-29 04:27:54 UTC


README

CKEditor for Yii with static build (https://docs.ckeditor.com/ckeditor4/latest/builds/)

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist sangroya/yii2-ckeditor5 "*"

or add

"sangroya/yii2-ckeditor": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

use sangroya\ckeditor\CKEditor;


<?= $form->field($model, 'text')->widget(CKEditor::className(), [
        'options' => ['rows' => 6],
        'preset'=>'full',
    ]) ?>```
    
Upload Url
-----

```php
use sangroya\ckeditor\CKEditor;


<?= $form->field($model, 'text')->widget(CKEditor::className(), [
        'options' => ['rows' => 6],
        'preset'=>'full',
        'clientOptions'=>[
              'filebrowserUploadUrl' =>  '/site/ckeditor-image-upload',//this will be the url where you want to ckeditor send the post request with file data
         ], 
    ]) ?>```

Custom Toolbar
-----
```php
use sangroya\ckeditor\CKEditor;


<?= $form->field($model, 'text')->widget(CKEditor::className(), [
        'options' => ['rows' => 6],
        'preset'=>'full',
        'clientOptions'=>[
              'filebrowserUploadUrl' =>  '/site/ckeditor-image-upload',//this will be the url where you want to ckeditor send the post request with file data
               'toolbarGroups' => [
        
                            ['name' => 'document', 'groups' => ['mode', 'document', 'doctools']],

                            ['name' => 'clipboard', 'groups' => ['clipboard', 'undo']],

                            ['name' => 'forms'],

                            ['name' => 'basicstyles', 'groups' => ['basicstyles', 'colors','cleanup']],
                            '/',

                            ['name' => 'paragraph', 'groups' => [ 'list', 'indent', 'blocks', 'align', 'bidi' , 'paragraph' ]],

                            ['name' => 'links'],

                            ['name' => 'insert'],
                            

                            '/',['name'=>'align'],

                            ['name' => 'styles'],

                            ['name' => 'blocks'],

                            ['name' => 'colors'],

                            ['name' => 'tools'],

                            ['name' => 'others'],
                            ['about' => 'about'],

                    
                    ],
         ], 
    ]) ?>```