2017 © Pedro Peláez
 

yii2-extension yii2-ckeditor-widget

CKEditor widget for Yii2.

image

alexdin/yii2-ckeditor-widget

CKEditor widget for Yii2.

  • Wednesday, November 30, 2016
  • by alexdin
  • Repository
  • 1 Watchers
  • 0 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 76 Forks
  • 0 Open issues
  • 15 Versions
  • 0 % Grown

The README.md

CKEditor Widget for Yii2

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads, (*1)

Renders a CKEditor WYSIWYG text editor plugin widget., (*2)

Installation

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

Either run, (*4)

composer require alexdin/yii2-ckeditor-widget

or add, (*5)

"alexdin/yii2-ckeditor-widget" : "2.0"

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

Skins & Plugins

This widget works with default's dev-full/stable branch of CKEditor, with a set of plugins and skins. If you wish to configure a different skins or plugins that the one proposed, you will have to download them separately and configure the widget's clientOptions attribute accordingly., (*7)

Usage

The library comes with two widgets: CKEditor and CKEditorInline. One is for classic edition and the other for inline editing respectively., (*8)

Using a model with a basic preset:, (*9)


use alexdin\ckeditor\CKEditor; = $form->field($model, 'text')->widget(CKEditor::className(), [ 'options' => ['rows' => 6], 'preset' => 'basic' ]) ?>

Using inline edition with basic preset:, (*10)


use alexdin\ckeditor\CKEditorInline; 'basic']);?> This text can be edited now :)

How to add custom plugins

This is the way to add custom plugins to the editor. Since version 2.0 we are working with the packagist version of the CKEditor library, therefore we are required to use its configuration API in order to add external plugins., (*11)

Lets add the popular Code Editor Plugin for example. This plugin would allow us to add a button to our editor's toolbar so we can add code to the content we are editing., (*12)

Assuming you have downloaded the plugin and added to the root directory of your Yii2 site. I have it this way:, (*13)

+ frontend 
+ -- web 
    + -- pbckcode 

We can now add it to our CKEditor widget. For this example I am using CKEditorInline widget. One thing you notice on this example is that we do not use the preset attribute; this is highly important as we want to add a customized toolbar to our widget. No more talking, here is the code:, (*14)

registerJs("CKEDITOR.plugins.addExternal('pbckcode', '/pbckcode/plugin.js', '');");

// ... 
// Using the plugin
 'custom', 'clientOptions' => [
    'extraPlugins' => 'pbckcode',
    'toolbarGroups' => [
        ['name' => 'undo'],
        ['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']],
        ['name' => 'colors'],
        ['name' => 'links', 'groups' => ['links', 'insert']],
        ['name' => 'others', 'groups' => ['others', 'about']],
        
        ['name' => 'pbckcode'] // 



Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. , (*15)

About extra assets

You maybe wonder why there is file alexdin-ckeditor.widget.js. The reason is that due to the way Yii2 works with forms and Cross-Site Request Forgery (csrf). CKEditor does not trigger the on change event nor collects the CSRF token when using file uploads., (*16)

The asset tackles both issues., (*17)

Testing

To test the extension, is better to clone this repository on your computer. After, go to the extensions folder and do the following (assuming you have composer installed on your computer):, (*18)

$ composer install --no-interaction --prefer-source --dev

Once all required libraries are installed then do:, (*19)

$ vendor/bin/phpunit

Further Information

Please, check the CKEditor plugin site documentation for further information about its configuration options., (*20)

Contributing

Please see CONTRIBUTING for details., (*21)

Credits

License

The BSD License (BSD). Please see License File for more information., (*22)

alexdin!
Web development has never been so fun!
www.alexdin.us, (*23)

The Versions

30/11 2016

dev-master

9999999-dev http://yiiwheels.com/extension/ckeditor-widget

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 yii yii 2 widget ckeditor alexdin

30/11 2016

2.0.6

2.0.6.0 http://yiiwheels.com/extension/ckeditor-widget

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 yii yii 2 widget ckeditor alexdin

14/11 2016

2.0.5

2.0.5.0 http://yiiwheels.com/extension/ckeditor-widget

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 yii yii 2 widget ckeditor alexdin

14/11 2016

2.0.4

2.0.4.0 http://yiiwheels.com/extension/ckeditor-widget

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 yii yii 2 widget ckeditor alexdin

14/11 2016

2.0.3

2.0.3.0 http://yiiwheels.com/extension/ckeditor-widget

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 yii yii 2 widget ckeditor alexdin

14/11 2016

2.0.2

2.0.2.0 http://yiiwheels.com/extension/ckeditor-widget

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget ckeditor

10/11 2016

2.0.1

2.0.1.0 http://yiiwheels.com/extension/ckeditor-widget

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget ckeditor

21/09 2016

2.0.0

2.0.0.0 http://yiiwheels.com/extension/ckeditor-widget

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget ckeditor

30/04 2015

1.0.4

1.0.4.0 http://yiiwheels.com/extension/ckeditor-widget

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget ckeditor

11/04 2015

1.0.3

1.0.3.0 http://yiiwheels.com/extension/ckeditor-widget

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget ckeditor

16/03 2015

1.0.2

1.0.2.0 http://yiiwheels.com/extension/ckeditor-widget

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii yii 2 widget ckeditor

04/03 2015

1.0.1

1.0.1.0

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii widget ckeditor

02/03 2015

1.0.0

1.0.0.0

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii widget ckeditor

03/05 2014

0.1.1

0.1.1.0

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii widget ckeditor

12/03 2014

0.1.0

0.1.0.0

CKEditor widget for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii widget ckeditor