delgus/yii2-knedlik-wysiwyg

The extension for using the Kendlik editor

Installs: 19

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Language:JavaScript

Type:yii2-extension

dev-master 2018-07-28 13:46 UTC

This package is auto-updated.

Last update: 2025-06-27 23:58:15 UTC


README

The extension for using the Kendlik editor

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist delgus/yii2-knedlik-wysiwyg=dev-master

or add

"delgus/yii2-knedlik-wysiwyg": "dev-master"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by(properties 'name' and 'id' - required) :

<?= \delgus\knedlik\Knedlik::widget(
                [
                    'name' => 'knedlick',
                    'id' => 'knedlick',
                    'clientOptions' => [
                        'lang' => 'ru',
                        'outside' => ['bold', 'italic'],
                        'style' => 'flat',
                    ],
                ]
            ) ?>

In ActiveForm:

 <?= $form->field($model, 'subject')->widget(\delgus\knedlik\Knedlik::class,['id' => 'knedlick']) ?>

For upload images:

  • In view show property upload:
 <?= \delgus\knedlik\Knedlik::widget(
                [
                    'name' => 'knedlick',
                    'id' => 'knedlick',
                    'clientOptions' => [
                       ...
                        'upload' => 'site/upload'
                        ...
                    ],
                ]
            ) ?>
  • In Controller:
    public function behaviors()
    {
        return [
           ...
            'knedlik' => [
                'class' => DisableCsrfBehavior::classname(),
                'actions' => ['upload'],
            ],
            ...
        ];
    }

    public function actions()
    {
        return [
           ...
            'upload' => [
                'class' => KnedlikAction::class,
                'uploadDir' => '/uploads'
            ],
            ...
        ];
    }

Thank you)