chulakov / yii2-js-typograf
Chulakov JS Typograf 包
0.1.0
2021-08-06 11:36 UTC
Requires
- php: >=7.0.0
- tinymce/tinymce: ~5.0
- yidas/yii2-bower-asset: ~2.0
- yiisoft/yii2: ~2.0
This package is auto-updated.
Last update: 2024-09-06 19:35:24 UTC
README
本组件基于JS v6.12.1的典型格式化器创建,用于格式化文本。
安装
要将组件连接到代码中,需要在 composer.json 文件中添加以下代码
"require": {
"chulakov/yii2-js-typograf": "~1.0.0"
},
...
"repositories": [
{
"type": "vcs",
"url": "git@git.chulakov.org:OlegChulakovStudio/yii2-js-typograf.git"
}
]
描述
该包包含不同类型表单字段的可视化小部件实现,包括基于TinyMCE的视觉编辑器。
普通文本字段小部件
<?= $form->field($model, "description")->widget(TypografTextWidget::class); ?>
多行文本字段小部件
<?= $form->field($model, "description")->widget(TypografTextAreaWidget::class, [ 'options' => [ 'rows' => '3' ] ]); ?>
基于TinyMCE的文本编辑器小部件
<?= $form->field($model, "title")->widget(\chulakov\typograf\widgets\TypografTinyMceWidget::class,[ 'clientOptions' => [ 'min_height' => 500, 'plugins' => [ 'lists', 'visualblocks visualchars code nonbreaking', 'autoresize', 'paste', 'link', 'typograf', 'code' ], 'toolbar1' => 'undo redo | formatselect | bold | bullist | nonbreaking removeformat | typograf code | link', 'content_css' => '', 'menubar' => false, 'branding' => false, 'paste_as_text' => true, 'formats' => [ 'underline' => ['inline' => 'span', 'classes' => 'underline'], 'strikethrough' => ['inline' => 'span', 'classes' => 'strike'], ], ] ]); ?>