sangroya/yii2-ckeditor

CKEditor for Yii

安装数: 2,006

依赖者: 0

建议者: 0

安全性: 0

星标: 1

关注者: 1

分支: 0

公开问题: 0

语言:HTML

类型:yii2-extension

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

This package is auto-updated.

Last update: 2024-09-29 05:49:06 UTC


README

带有静态构建的 CKEditor for Yii(https://docs.ckeditor.com/ckeditor4/latest/builds/

安装

安装此扩展的首选方式是通过 composer

运行以下命令之一

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

"sangroya/yii2-ckeditor": "*"

将以下内容添加到您的 composer.json 文件的 require 部分。

使用方法

扩展安装后,只需在代码中通过以下方式使用它:

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'],

                    
                    ],
         ], 
    ]) ?>```