firdows/yii2-mkeditor

CKEditor and KCFinder

Installs: 21

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 1

Type:yii2-extension

0.1.0 2016-04-30 04:18 UTC

This package is auto-updated.

Last update: 2024-03-23 14:52:21 UTC


README

CKEditor and KCFinder Mkeditor

CKEditor and KCFinder

Installation

The preferred way to install this extension is through composer.

Either run

composer require firdows/yii2-mkeditor "*"

or add

"firdows/yii2-mkeditor": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

Convert textarea to CKEditor

<?php
//CKEditor
echo $form->field($model, 'detail')->widget(
  \firdows\mkeditor\CKEditor::className(), 
  [
    'uploadDir' => '/var/www/public_html/UserFiles',
    'uploadURL' => '/UserFiles/',
    'filemanager'=>true, //true = enabled kcfinder, false = disabled kcfinder
    'preset'=>'full' //toolbar -> basic, standard, full
  ]
)->label(false); ?>

Example
687474703a2f2f696b686c6173736572766963652e636f6d2f75706c6f6164732f636170747572652f75706c6f61642e706e67

Usage with On Change

<?php $this->registerJs(" 
    var content = '';
    CKEDITOR.on('instanceCreated', function (e) {
    content = e.editor.getData();
      e.editor.on('change', function (ev) {
        content = ev.editor.getData();
      });
    });

"); ?>

<?php
//CKEditor
echo $form->field($model, 'detail')->widget(
  \firdows\mkeditor\CKEditor::className(), 
  [
    'uploadDir' => '/var/www/public_html/UserFiles',
    'uploadURL' => '/UserFiles/',
    'filemanager'=>true, //true = enabled kcfinder, false = disabled kcfinder
    'preset'=>'full', //toolbar -> basic, standard, full
    'onChange' => true
  ]
)->label(false); ?>

Example
<img src="http://ikhlasservice.com/uploads/capture/Update Article.png"width="400"/>

Credit

Jehdu Ahmad