codezeen/yii2-tinymce

TinyMCE extension for Yii2 with compressor

Installs: 7 749

Dependents: 1

Suggesters: 0

Security: 0

Stars: 2

Watchers: 3

Forks: 0

Open Issues: 1

Type:yii2-extension

1.0.0 2015-05-10 06:56 UTC

This package is not auto-updated.

Last update: 2024-11-09 19:22:16 UTC


README

TinyMCE Extension For Yii2 With Compressor

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist codezeen/yii2-tinymce "*"

or add

"codezeen/yii2-tinymce": "*"

to the require section of your composer.json file.

Usage

Register Asset Only

If you only want to use the asset, you only need to write the following code to the file view:

<?= \codezeen\yii2\tinymce\TinyMceAsset::register($this); ?>

Usage With ActiveForm

<?= $form->field($model, 'attribute')->widget(
    TinyMce::className(),
    [
        'settings'        => [
            'language'               => 'en',
            'plugins'                => [
                "advlist autolink lists link image charmap print preview hr anchor pagebreak",
                "searchreplace visualblocks visualchars code fullscreen",
                "insertdatetime media nonbreaking save table contextmenu directionality",
                "template paste textcolor"
            ],
            'toolbar'                => "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media | forecolor backcolor",
            'toolbar_items_size'     => 'small',
            'image_advtab'           => true,
            'relative_urls'          => false,
        ],
    ]
) ?>

Usage Without ActiveForm

<?= TinyMce::widget([
    // ...
]) ?>

Usage With Compressor

Add the following code to the controller

public function actions()
{
    return [
        'tinyMceCompressor' => [
            'class' => TinyMceCompressorAction::className(),
        ],
    ];
}

Then, add route to configured action to widget options:

$form->field($model, 'content')->widget(
    TinyMce::className(),
    ['compressorRoute' => 'controller/tiny-mce-compressor']
)

More Information About TinyMCE

Please, check the TinyMCE plugin site documentation for more options.