Skip to content

krokwen/yii2-grafikart-markdown-editor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MARKDOWN EDITOR

About Markdown:

Installation

php composer.phar require --prefer-dist chestr92/yii2-grafikart-markdown-editor

or add

"chestr92/yii2-grafikart-markdown-editor" : "^0.1"

o the require section of your composer.json file.

if need upload images on server when include module to your config

    'modules' => [
        'markdown-editor' => [
            'class' => 'chestr92\GrafikartMarkdownEditor\Module',
            'uploadDir' => '@webroot/images/markdown',
            'isFileNameUnique' => true, //set unique name or use base name,
            'maxSize' => 2097152, // in bites, Default 2mb
            'expansions' => ['jpg', 'png'] 
        ],
    ],
    ...

Form

  <?= $form->field($model, 'firstMessage')->widget(chestr92\GrafikartMarkdownEditor\widgets\MdEditor::className(), [
            'uploader' => Url::to(['markdown-editor/upload/data']), //or false. Default false
            'preview' => true, // default false,
            'jsOptions' => [], // js options of widget. See https://github.com/Grafikart/JS-Markdown-Editor,
            'images' => [], //Default images See https://github.com/Grafikart/JS-Markdown-Editor,
        ]) ?>

Render

$parser = new cebe\markdown\Markdown();
echo $parser->parse($model->firstMessage);

About

Markdown editor with opportunity uploading images

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.5%
  • PHP 1.5%