2017 © Pedro Peláez
 

yii2-extension yii2-froala-editor

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

image

froala/yii2-froala-editor

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  • Sunday, June 24, 2018
  • by stefanneculai
  • Repository
  • 10 Watchers
  • 68 Stars
  • 16,371 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 20 Forks
  • 9 Open issues
  • 31 Versions
  • 14 % Grown

The README.md

Yii Framework Froala WYSIWYG HTML Editor

Packagist Packagist, (*1)

Yii 2 widget for Froala Wysiwyg editor., (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist froala/yii2-froala-editor

or add, (*5)

"froala/yii2-froala-editor": "^3.2.5"

to the require section of your composer.json file., (*6)

Usage

Once the extension is installed, simply use it in your code by :, (*7)

<?php echo froala\froalaeditor\FroalaEditorWidget::widget([
    'name' => 'content',
    'options' => [
        // html attributes
        'id'=>'content'
    ],
    'clientOptions' => [
        'toolbarInline'=> false,
        'theme' =>'royal', //optional: dark, red, gray, royal
        'language'=>'en_gb' // optional: ar, bs, cs, da, de, en_ca, en_gb, en_us ...
    ]
]); ?>

or use with a model:, (*8)

<?php echo froala\froalaeditor\FroalaEditorWidget::widget([
    'model' => $model,
    'attribute' => 'content',
    'options' => [
        // html attributes
        'id'=>'content'
    ],
    'clientOptions' => [
        'toolbarInline' => false,
        'theme' => 'royal', //optional: dark, red, gray, royal
        'language' => 'en_gb' // optional: ar, bs, cs, da, de, en_ca, en_gb, en_us ...
    ]
]); ?>

add Font-awesome cdn for font-awesome plugin, (*9)

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

Upload example

Using the basic Yii template make a new folder under /web/ called uploads., (*10)

For controler:, (*11)

public function actionUpload() {
    $base_path = Yii::getAlias('@app');
    $web_path = Yii::getAlias('@web');
    $model = new UploadForm();

    if (Yii::$app->request->isPost) {
        $model->file = UploadedFile::getInstanceByName('file');

        if ($model->validate()) {
            $model->file->saveAs($base_path . '/web/uploads/' . $model->file->baseName . '.' . $model->file->extension);
        }
    }

    // Get file link
    $res = [
        'link' => $web_path . '/uploads/' . $model->file->baseName . '.' . $model->file->extension,
    ];

    // Response data
    Yii::$app->response->format = Yii::$app->response->format = Response::FORMAT_JSON;
    return $res;
}

For model:, (*12)

namespace app\models;
use yii\base\Model;
use yii\web\UploadedFile;

/**
 * UploadForm is the model behind the upload form.
 */
class UploadForm extends Model
{
    /**
     * @var UploadedFile|Null file attribute
     */
    public $file;

    /**
     * @return array the validation rules.
     */
    public function rules()
    {
        return [
            [['file'], 'file']
        ];
    }
}

For the view:, (*13)

<?= \froala\froalaeditor\FroalaEditorWidget::widget([
    'name' => 'body',
    'clientOptions' => [
        'toolbarInline'=> false,
        'height' => 200,
        'theme' => 'royal',//optional: dark, red, gray, royal
        'language' => 'en_gb' ,
        'toolbarButtons' => ['fullscreen', 'bold', 'italic', 'underline', '|', 'paragraphFormat', 'insertImage'],
        'imageUploadParam' => 'file',
        'imageUploadURL' => \yii\helpers\Url::to(['site/upload/'])
    ],
    'clientPlugins'=> ['fullscreen', 'paragraph_format', 'image']
]); ?>

For full details on usage, see the documentation., (*14)

Custom Buttons Example

The custom Buttons can be defined in JS files anywhere you want, in this example in /basic/assets/ folder., (*15)

In the view:, (*16)

registerJsFile('/basic/assets/alert.js', ['depends' => '\Froala\Editor\FroalaEditorAsset']);?>

= \Froala\Editor\FroalaEditorWidget::widget([
    'name'          => 'body',
    'clientOptions' => [
        'toolbarInline'    => false,
        'height'           => 200,
        'theme'            => 'royal',//optional: dark, red, gray, royal
        'language'         => 'en_gb',
        'toolbarButtons'   => ['fullscreen', 'bold', 'italic', 'underline', '|', 'paragraphFormat', 'insertImage', 'alert']
    ],
    'clientPlugins' => ['fullscreen', 'paragraph_format', 'image']
]); ?>

In /basic/assets/alert.js:, (*17)

FroalaEditor.DefineIcon('alert', {NAME: 'info'});
FroalaEditor.RegisterCommand('alert', {
        title: 'Hello',
        focus: false,
        undo: false,
        refreshAfterCallback: false,
        callback: function () {
            alert('Hello!');
        }
    }
);

For more details you can go to Custom Buttons, (*18)

License

This package is available under MIT License. However, Froala editor requires purchasing a license from https://www.froala.com/wysiwyg-editor/pricing., (*19)

The Versions

24/06 2018

dev-master

9999999-dev

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

21/06 2018

2.8.3

2.8.3.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

26/04 2018

2.8.1

2.8.1.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

13/04 2018

2.8.0

2.8.0.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

08/03 2018

2.7.6

2.7.6.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

02/02 2018

2.7.5

2.7.5.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

31/01 2018

2.7.4

2.7.4.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

11/12 2017

2.7.3

2.7.3.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

23/11 2017

2.7.2

2.7.2.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

19/09 2017

2.7.0

2.7.0.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

04/05 2017

2.6.0

2.6.0.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

14/03 2017

2.5.1

2.5.1.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

27/02 2017

2.5.0

2.5.0.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

26/01 2017

2.4.1

2.4.1.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

09/12 2016

2.4.0

2.4.0.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

19/10 2016

2.3.5

2.3.5.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

21/07 2016

2.3.4

2.3.4.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

20/06 2016

2.3.3

2.3.3.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

08/06 2016

2.3.2

2.3.2.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

03/06 2016

2.3.1

2.3.1.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

20/05 2016

2.3.0

2.3.0.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

22/04 2016

2.2.4

2.2.4.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

04/04 2016

2.2.3

2.2.3.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

26/03 2016

2.2.2

2.2.2.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

02/03 2016

2.2.1

2.2.1.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

29/02 2016

2.2.0

2.2.0.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

01/02 2016

2.1.0

2.1.0.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

14/12 2015

2.0.5

2.0.5.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

08/12 2015

2.0.3

2.0.3.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

07/12 2015

2.0.2

2.0.2.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor

18/11 2015

2.0.1

2.0.1.0

A beautiful jQuery WYSIWYG HTML text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.

  Sources   Download

MIT

The Requires

 

by Stefan Neculai

jquery javascript html text editor wysiwyg jquery-plugin froala rte rich editor rich text editor