Thank you for choosing this extension , enjoy it!!!
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist echotrue/yii2-markdown "*"
or add
"echotrue/yii2-markdown": "*"
to the require section of your composer.json
file . and run this command:
composer update
Add an actions() method in controller
public function actions()
{
return [
'upload' => [
'class' => 'echotrue\markdown\UploadAction',
],
];
}
used in view :
<?= $form->field($model, 'username')->widget(\echtrue\markdown\MarkDown::className(), [
'options' => ['id' => 'yii-markdown','width'=>'1000px'],
'model' => $model,
'attribute' => 'username',
]) ?>
or
<?= \echotrue\markdown\MarkDown::widget([
'options' => [
'id' => 'yii-markdown',
//'height'=>"100px",
],
'name' => 'username',
]); ?>
upload path :
create a new folder which named markdown_upload
in webroot
width: height: