wise5lin / yii2-tinymce5
此包已被弃用且不再维护。未建议替代包。
Yii 2 的 TinyMCE 5 小部件
1.0.0
2019-11-12 13:06 UTC
Requires
- php: >=5.6.0
- tinymce/tinymce: ^5.1.1
- yiisoft/yii2: ^2.0.0
This package is not auto-updated.
Last update: 2024-01-18 08:44:29 UTC
README
安装
安装此扩展的首选方式是通过 Composer。
只需运行以下命令
php composer.phar require --prefer-dist wise5lin/yii2-tinymce5 "~1.0.0"
或在您的 composer.json
文件的 require
部分添加以下内容:
"wise5lin/yii2-tinymce5": "~1.0.0"
使用
扩展安装后,只需在您的代码中使用它
use wise5lin\tinymce5\TinyMCE;
<?= $form->field($model, 'content')->widget(TinyMCE::class) ?>
设置
预设 - 选择编辑器面板的预定义设置。它可以取值 basic
、full
和 custom
。
<?= $form->field($model, 'content')->widget(TinyMCE::class, [
'preset' => 'full', // basic (default), custom
]) ?>
基本预设
完整预设
不包括付费插件
editorOptions - js 编辑器选项,查看所有可能的选项在 官方网站 上。
<?= $form->field($model, 'content')->widget(TinyMCE::class, [
'preset' => 'full',
// https://www.tiny.cloud/docs/configure
'editorOptions' => [
'height' => 300,
]
]) ?>
editorInlineContainerTag - inline
模式下编辑器容器的 HTML 标签。
仅在编辑器处于 inline
模式时使用!
<?= $form->field($model, 'content')->widget(TinyMCE::class, [
'preset' => 'full',
'editorOptions' => [
'height' => 300,
'inline' => true,
],
'editorInlineContainerTag' => 'div' // Default
]) ?>
editorInlineContainerOptions - inline
模式下编辑器容器的 HTML 属性。
仅在编辑器处于 inline
模式时使用!
<?= $form->field($model, 'content')->widget(TinyMCE::class, [
'preset' => 'full',
'editorOptions' => [
'height' => 300,
'inline' => true,
],
'editorInlineContainerTag' => 'div',
'editorInlineContainerOptions' => [
'class' => 'my-class'
],
]) ?>