wangningkai/yii2-markdown-editor

Yii2 Markdown Editor

dev-master 2020-07-27 06:01 UTC

This package is auto-updated.

Last update: 2024-11-27 15:39:28 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

优秀的Markdown编辑器 Markdown Editor For Yii2

安装

建议通过 composer进行安装.

命令行安装

php composer.phar require --prefer-dist yiier/yii2-editor.md "*"

composer.json文件中引入

"yiier/yii2-editor.md": "*"

使用

安装完成后, 复制一下代码到需要使用的地方:

<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use WangNingkai\MarkdownEditor\MarkdownEditorWidget;

?>
<?= $form->field($model, 'content')->widget(MarkdownEditorWidget::className(), [
        'options'=>[// html attributes
            'id'=>'content'
        ],
        'clientOptions' => [
            'imageUpload' => true,
            'imageFormats' => ['jpg', 'jpeg', 'gif', 'png', 'bmp', 'webp'],
            'imageUploadURL' => '/Action/to/upload',
        ]
    ]
) ?>