2017 © Pedro Peláez
 

yii2-extension yii2-ckeditor

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

image

mranger/yii2-ckeditor

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  • Friday, November 4, 2016
  • by MrAnger
  • Repository
  • 1 Watchers
  • 2 Stars
  • 232 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 27 Versions
  • 13 % Grown

The README.md

yii2-ckeditor widget

Установка

php composer.phar require --prefer-dist mranger/yii2-ckeditor "*"

или, (*1)

"mranger/yii2-ckeditor": "*"

Так как у меня не получилось нормально реализовать зависимость от пакета CKEditor, бог его знает почему. Вам придется самим добавить зависимость от данного пакета в вашем composer.json Я обычно прописываю зависимость от полного пакета последней версии., (*2)

"ckeditor/ckeditor": "dev-full/4.7.x",, (*3)

Более подробно можно прочитать по ссылке: http://docs.ckeditor.com/#!/guide/dev_package_managers., (*4)

Использование

use mranger\ckeditor\CKEditor;

echo $form->field($model, 'content')->widget(CKEditor::className());

Можно создавать свои пресеты, которые будут хранить настройки вашего редактора, для этого нужно будет сначала определить папку где будут лежать файлы с пресетами (стандартный путь "@app/ckeditor-presets")., (*5)

Пример кода пресета и вызова виджета:, (*6)

пресет: default.php, (*7)

return [
    'height' => '300px',
    'toolbarGroups'        => [
        ['name' => 'basicstyles', 'groups' => ['basicstyles', 'colors', 'cleanup']],
        ['name' => 'styles'],
        ['name' => 'blocks'],
        ['name' => 'colors'],
        ['name' => 'document', 'groups' => ['mode', 'document', 'doctools']],
        ['name' => 'tools'],
        ['name' => 'others'],
        '/',
        ['name' => 'paragraph', 'groups' => ['list', 'indent', 'blocks', 'align', 'bidi']],
        ['name' => 'links'],
        ['name' => 'insert'],
        ['name' => 'clipboard', 'groups' => ['clipboard', 'undo']],
        ['name' => 'editing', 'groups' => ['find', 'selection', 'spellchecker']],
    ],
    'filebrowserUploadUrl' => Url::to(['wysiwyg/image-upload'], true),
];

Вызов виджета:, (*8)

echo $form->field($model, 'content')->widget(CKEditor::className(), [
    'preset' => 'default',
    'presetDirPath' => '@app/presets', //стандартный путь "@app/ckeditor-presets" можно не указывать
]);

Что бы дать возможность загрузки файлов через редактор, необходимо сначала подключить необходимый экшен для загрузки файлов. Контролер может быть абсолютно любой., (*9)

public function actions() {
        return [
            'ckeditor-file-upload' => [
                'class' => 'mranger\ckeditor\actions\FileUploadAction',
            ],
        ];
    }

После этого в настройках(пресете) указать url по которому должны производиться запросы для загрузки файлов., (*10)

[
 'filebrowserUploadUrl' => Url::to(['your-controller/ckeditor-file-upload'], true),
]

По умолчанию разрешена загрузка только файлов с расширениями: "png, jpg, jpeg, bmp, gif, ico, swf", файлы загружаются по пути: '@webroot/upload'. Если же необходимо изменить данные параметры, то в массиве params приложения можно определить свои параметры, а именно:, (*11)

[
 'CKEditorFileUploadAllowedExtensions' => 'gif, png, jpg', // разрешенные расширения файлов
 'CKEditorFileUploadPath' => '@webroot/ckeditor',          // путь для сохранения файлов
 'CKEditorFileUploadedUrl' => 'http://mysite.ru/ckeditor', // ссылка, по которой будут доступны сохраненые файлы
]

В настройках виджета можно подключить сторонние плагины для CKEditor, для этого необходимо в пресете добавить массив 'externalPlugins' c содержимым следующего формата:, (*12)

return [
    'externalPlugins'        => [
        [
            'name' => '', // название плагина
            'url' => '',  // url до папки плагином
            'fileName' => '' , // файл плагина
        ],
    ],
];

The Versions

04/11 2016

dev-master

9999999-dev

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

by Avatar MrAnger

widget ckeditor wysiwyg

04/11 2016

1.2.4

1.2.4.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

by Avatar MrAnger

widget ckeditor wysiwyg

02/11 2016

1.2.3

1.2.3.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

by Avatar MrAnger

widget ckeditor wysiwyg

18/09 2016

1.2.2

1.2.2.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

by Avatar MrAnger

widget ckeditor wysiwyg

12/09 2016

1.2.1

1.2.1.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

by Avatar MrAnger

widget ckeditor wysiwyg

22/08 2016

1.2.0

1.2.0.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

by Avatar MrAnger

widget ckeditor wysiwyg

22/08 2016

1.1.12

1.1.12.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

  • bower-asset/ckeditor dev-full/stable

 

by Avatar MrAnger

widget ckeditor wysiwyg

22/08 2016

1.1.11

1.1.11.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Avatar MrAnger

widget ckeditor wysiwyg

22/08 2016

1.1.10

1.1.10.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

  • ckeditor 4.*

 

by Avatar MrAnger

widget ckeditor wysiwyg

22/08 2016

1.1.9

1.1.9.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

  • ckeditor 4.*

 

by Avatar MrAnger

widget ckeditor wysiwyg

22/08 2016

1.1.8

1.1.8.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

  • bower-asset/ckeditor#full 4.*

 

by Avatar MrAnger

widget ckeditor wysiwyg

22/08 2016

1.1.7

1.1.7.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar MrAnger

widget ckeditor wysiwyg

22/08 2016

1.1.6

1.1.6.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar MrAnger

widget ckeditor wysiwyg

21/08 2016

1.1.5

1.1.5.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Avatar MrAnger

widget ckeditor wysiwyg

21/08 2016

1.1.4

1.1.4.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar MrAnger

widget ckeditor wysiwyg

21/08 2016

1.1.3

1.1.3.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar MrAnger

widget ckeditor wysiwyg

21/08 2016

1.1.1

1.1.1.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Avatar MrAnger

widget ckeditor wysiwyg

21/08 2016

1.1.0

1.1.0.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Development Requires

by Avatar MrAnger

widget ckeditor wysiwyg

21/08 2016

1.0.9

1.0.9.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar MrAnger

widget ckeditor wysiwyg

21/08 2016

1.0.8

1.0.8.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar MrAnger

widget ckeditor wysiwyg

21/08 2016

1.0.7

1.0.7.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar MrAnger

widget ckeditor wysiwyg

21/08 2016

1.0.6

1.0.6.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar MrAnger

widget ckeditor wysiwyg

21/08 2016

1.0.5

1.0.5.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar MrAnger

widget ckeditor wysiwyg

21/08 2016

1.0.4

1.0.4.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar MrAnger

widget ckeditor wysiwyg

21/08 2016

1.0.3

1.0.3.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar MrAnger

widget ckeditor wysiwyg

21/08 2016

1.0.1

1.0.1.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar MrAnger

widget ckeditor wysiwyg

21/08 2016

1.0.0

1.0.0.0

CKEditor Yii2 widget working via official ckeditor composer package and using custom presets.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar MrAnger

widget ckeditor wysiwyg