ofilin/yii2-quill

Quill 资产与插件

0.3.4 2020-11-23 19:18 UTC

This package is auto-updated.

Last update: 2024-09-24 03:51:16 UTC


README

这是基于https://github.com/bizley/yii2-quill的分支,包含了Quill本地库,并且不包含KatexHighlight插件。

Quill的Yii 2实现,现代所见即所得编辑器。

Quill

您可以在https://quilljs.com/找到Quill

yii2-quill

  • 添加了表情符号支持(注意:在quill编辑的页面注册资产ofilin\quill\EmojiAsset以正确显示表情符号)

安装

将此包添加到您的composer.json

{
    "require": {
        "ofilin/yii2-quill": "^0.3"
    }
}

然后运行composer update,或者运行composer require ofilin/yii2-quill:^0.3

使用

将其用作活动字段扩展

<?= $form->field($model, $attribute)->widget(\ofilin\quill\Quill::class, []) ?>

或者作为独立小部件

<?= \ofilin\quill\Quill::widget(['name' => 'editor', 'value' => '']) ?>

带有表情符号插件

<?= $form->field($model, 'text_msg')->label(false)->widget(\ofilin\quill\Quill::class, [
    'theme' => 'snow',
    'placeholder' => 'Text',
    'toolbarOptions' => [
        ["bold", "italic", "code", "link", "emoji"],
    ],
]) ?>