skeeks / yii2-ckeditor
CKEditor扩展用于Yii2。
1.1.5
2023-06-13 08:52 UTC
Requires
- yiisoft/yii2: ^2.0
README
渲染一个CKEditor WYSIWYG文本编辑插件小部件。
安装
安装此扩展的最佳方式是通过composer。
运行以下命令之一
php composer.phar require "skeeks/yii2-ckeditor" "*"
或者
"skeeks/yii2-ckeditor" : "*"
将以下内容添加到应用程序的composer.json
文件的require部分。
皮肤和插件
此小部件与CKEditor的默认dev-full/stable
分支一起使用,包含一系列插件和皮肤。如果您想配置其他皮肤或插件,而不是所提议的,您需要单独下载它们,并相应地配置小部件的clientOptions
属性。
使用方法
库包含两个小部件:CKEditor
和CKEditorInline
。一个用于经典编辑,另一个用于内联编辑。
使用带有基本预设的模型
use skeeks\yii2\ckeditor\CKEditorWidget;
use skeeks\yii2\ckeditor\CKEditorPresets;
<?= $form->field($model, 'text')->widget(CKEditorWidget::className(), [
'preset' => CKEditorPresets::BASIC
]) ?>
<?= $form->field($model, 'text')->widget(CKEditorWidget::className(), [
'options' => ['rows' => 6],
'preset' => CKEditorPresets::FULL
]) ?>
<?= $form->field($model, 'description_short')->widget(
\skeeks\cms\widgets\formInputs\ckeditor\Ckeditor::className(),
[
'preset' => \skeeks\yii2\ckeditor\CKEditorPresets::CLEAN,
'clientOptions' =>
[
'height' => 200,
'extraPlugins' => 'ckwebspeech,sourcedialog,codemirror,ajax,codesnippet,xml,widget,lineutils,dialog,dialogui',
'toolbarGroups' => [
['name' => 'undo'],
['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']],
['name' => 'colors'],
['name' => 'links', 'groups' => ['links']],
['name' => 'others','groups' => ['others', 'about']],
],
'removeButtons' => 'Subscript,Superscript,Flash,Table,HorizontalRule,Smiley,SpecialChar,PageBreak,Iframe',
'removePlugins' => 'elementspath',
'resize_enabled' => true
]
]
); ?>
更多信息
请查看CKEditor插件网站的文档以获取有关其配置选项的更多信息。
SkeekS CMS (Yii2) — 快速、简单、有效!
skeeks.com | cms.skeeks.com