Browse Source

Update CKEditor, replaced by zertex/ckeditor

master
Egorka 6 years ago
parent
commit
ae1bc44c9e
  1. 31
      backend/bootstrap/SetUp.php
  2. 29
      backend/config/main.php
  3. 2
      common/modules/blog/views/manage/category/_form.php
  4. 2
      common/modules/blog/views/manage/post/_form.php
  5. 2
      common/modules/forms/views/manage/form/_form/_form-items.php
  6. 5
      common/modules/pages/views/manage/page/_form.php
  7. 14
      composer.json
  8. 54
      core/components/ckeditor/presets/basic/plugins.php
  9. 4
      core/components/ckeditor/presets/basic/toolbar.php
  10. 54
      core/components/ckeditor/presets/developer/plugins.php
  11. 17
      core/components/ckeditor/presets/developer/toolbar.php
  12. 54
      core/components/ckeditor/presets/editor/plugins.php
  13. 17
      core/components/ckeditor/presets/editor/toolbar.php
  14. BIN
      static/files/bd942d71aa78e54a473ea0ddc2a0d7f6.jpg

31
backend/bootstrap/SetUp.php

@ -3,8 +3,9 @@
namespace backend\bootstrap; namespace backend\bootstrap;
use core\entities\Settings; use core\entities\Settings;
use mihaildev\ckeditor\CKEditor;
use mihaildev\elfinder\ElFinder; use zertex\elfinder\ElFinder;
use zertex\ckeditor\CKEditor;
use yii\base\BootstrapInterface; use yii\base\BootstrapInterface;
use yii\helpers\ArrayHelper; use yii\helpers\ArrayHelper;
@ -13,8 +14,32 @@ class SetUp implements BootstrapInterface
public function bootstrap($app) public function bootstrap($app)
{ {
$container = \Yii::$container; $container = \Yii::$container;
// init presets
$presetsPath = \Yii::getAlias('@core/components/ckeditor/presets');
// basic
$app->params['ckeditor']['basic']['toolbar'] = require $presetsPath . '/basic/toolbar.php';
$app->params['ckeditor']['basic']['plugins'] = require $presetsPath . '/basic/plugins.php';
// editor
$app->params['ckeditor']['editor']['toolbar'] = require $presetsPath . '/editor/toolbar.php';
$app->params['ckeditor']['editor']['plugins'] = require $presetsPath . '/editor/plugins.php';
// debeloper
$app->params['ckeditor']['developer']['toolbar'] = require $presetsPath . '/developer/toolbar.php';
$app->params['ckeditor']['developer']['plugins'] = require $presetsPath . '/developer/plugins.php';
// set preset example
/*$form->field($model, 'content')->widget(CKEditor::class, [
'editorOptions' => \zertex\elfinder\ElFinder::ckeditorOptions('elfinder',[
'toolbar' => Yii::$app->params['ckeditor']['editor']['toolbar'],
'extraPlugins' => Yii::$app->params['ckeditor']['editor']['plugins'],
])
])*/
$container->set(CKEditor::class, [ $container->set(CKEditor::class, [
'editorOptions' => ElFinder::ckeditorOptions('elfinder', []), 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [
'toolbar' => $app->params['ckeditor']['editor']['toolbar'],
'extraPlugins' => $app->params['ckeditor']['editor']['plugins'],
]),
]); ]);
// load settings // load settings

29
backend/config/main.php

@ -20,8 +20,12 @@ return [
'common\bootstrap\SetUp', 'common\bootstrap\SetUp',
'backend\bootstrap\SetUp', 'backend\bootstrap\SetUp',
], ],
'modules' => [], 'modules' => [
'controllerMap' => [ 'elfinder' => [
'class' => 'core\components\elfinder\ElFinderModule',
],
],
/*'controllerMap' => [
'elfinder' => [ 'elfinder' => [
'class' => 'mihaildev\elfinder\Controller', 'class' => 'mihaildev\elfinder\Controller',
'access' => ['@'], 'access' => ['@'],
@ -41,6 +45,27 @@ return [
], ],
], ],
], ],
],*/
'controllerMap' => [
'elfinder' => [
'class' => 'zertex\elfinder\Controller',
'access' => ['@'],
'plugin' => [
[
'class'=>'\zertex\elfinder\plugin\Sluggable',
'lowercase' => true,
'replacement' => '-'
]
],
'roots' => [
[
'baseUrl'=>'@static',
'basePath'=>'@staticRoot',
'path' => 'files',
'name' => 'Global'
],
],
],
], ],
'components' => [ 'components' => [
'request' => [ 'request' => [

2
common/modules/blog/views/manage/category/_form.php

@ -1,6 +1,6 @@
<?php <?php
use mihaildev\ckeditor\CKEditor; use zertex\ckeditor\CKEditor;
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;

2
common/modules/blog/views/manage/post/_form.php

@ -1,7 +1,7 @@
<?php <?php
use kartik\file\FileInput; use kartik\file\FileInput;
use mihaildev\ckeditor\CKEditor; use zertex\ckeditor\CKEditor;
use yii\helpers\Html; use yii\helpers\Html;
use kartik\form\ActiveForm; use kartik\form\ActiveForm;
use yii\web\JsExpression; use yii\web\JsExpression;

2
common/modules/forms/views/manage/form/_form/_form-items.php

@ -4,7 +4,7 @@
* Date: 29.07.2018 * Date: 29.07.2018
*/ */
use mihaildev\ckeditor\CKEditor; use zertex\ckeditor\CKEditor;
use yii\web\JsExpression; use yii\web\JsExpression;
use yii\helpers\Url; use yii\helpers\Url;

5
common/modules/pages/views/manage/page/_form.php

@ -1,6 +1,6 @@
<?php <?php
use mihaildev\ckeditor\CKEditor; use zertex\ckeditor\CKEditor;
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
@ -22,8 +22,7 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'parentId')->dropDownList($model->parentsList()) ?> <?= $form->field($model, 'parentId')->dropDownList($model->parentsList()) ?>
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'content')->widget(CKEditor::class) ?> <?= $form->field($model, 'content')->widget(CKEditor::class) ?>
</div> </div>
</div> </div>

14
composer.json

@ -14,7 +14,7 @@
}, },
"minimum-stability": "stable", "minimum-stability": "stable",
"require": { "require": {
"php": ">=5.4.0", "php": ">=7.1.0",
"yiisoft/yii2": "~2.0.6", "yiisoft/yii2": "~2.0.6",
"yiisoft/yii2-bootstrap": "~2.0.0", "yiisoft/yii2-bootstrap": "~2.0.0",
"yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0", "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0",
@ -39,7 +39,9 @@
"zertex/yii2-avatar-generator": "*", "zertex/yii2-avatar-generator": "*",
"paulzi/yii2-sortable": "^1.0", "paulzi/yii2-sortable": "^1.0",
"paulzi/yii2-adjacency-list" : "^2.1", "paulzi/yii2-adjacency-list" : "^2.1",
"yiisoft/yii2-jui": "^2.0" "yiisoft/yii2-jui": "^2.0",
"zertex/yii2-elfinder": "^1.2",
"zertex/yii2-ckeditor": "^1.0"
}, },
"require-dev": { "require-dev": {
"yiisoft/yii2-debug": "~2.0.0", "yiisoft/yii2-debug": "~2.0.0",
@ -55,6 +57,14 @@
{ {
"type": "composer", "type": "composer",
"url": "https://asset-packagist.org" "url": "https://asset-packagist.org"
},
{
"type": "vcs",
"url": "https://github.com/zertex/yii2-ckeditor.git"
},
{
"type": "vcs",
"url": "https://github.com/zertex/yii2-elfinder.git"
} }
] ]
} }

54
core/components/ckeditor/presets/basic/plugins.php

@ -0,0 +1,54 @@
<?php
return [
/*'codemirror',
'codesnippet',
'videodetector',
'clipboard',
'panelbutton',
'floatpanel',
'quicktable',
'specialchar',
'copyformatting',
'colordialog',
'templates',
'menu',
'contextmenu',
'tabletools',
'spoiler',
'showblocks',
'pagebreak',
'fakeobjects',
'liststyle',
'iframe',
'forms',
//'footnotes',
'flash',
'find',
'richcombo',
'font',
'entities',
'preview',
'button',
'menubutton',
'language',
'indent',
'print',
'tableresize',
'justify',
'notification',
'allowsave',
'newpage',
'a11yhelp',
'blockquote',
'resize',
'elementspath',
'htmlwriter',
'bidi',*/
'colorbutton',
//'div',
//'wordcount',
//'selectall'
//'autosave'
//'bbcode'
];

4
core/components/ckeditor/presets/basic/toolbar.php

@ -0,0 +1,4 @@
<?php
return [
[ 'name' => 'basicstyles', 'items' => [ 'Bold', 'Italic', 'Underline', 'Strike', '-', 'TextColor', 'BGColor' ] ],
];

54
core/components/ckeditor/presets/developer/plugins.php

@ -0,0 +1,54 @@
<?php
return [
'codemirror',
'codesnippet',
'videodetector',
'clipboard',
'panelbutton',
'floatpanel',
'quicktable',
'specialchar',
'copyformatting',
'colordialog',
'templates',
'menu',
'contextmenu',
'tabletools',
'spoiler',
'showblocks',
'pagebreak',
'fakeobjects',
'liststyle',
'iframe',
'forms',
//'footnotes',
'flash',
'find',
'richcombo',
'font',
'entities',
'preview',
'button',
'menubutton',
'language',
'indent',
'print',
'tableresize',
'justify',
'notification',
'allowsave',
'newpage',
'a11yhelp',
'blockquote',
'resize',
'elementspath',
'htmlwriter',
'bidi',
'colorbutton',
'div',
//'wordcount',
'selectall'
//'autosave'
//'bbcode'
];

17
core/components/ckeditor/presets/developer/toolbar.php

@ -0,0 +1,17 @@
<?php
return [
[ 'name' => 'document', 'items' => [ 'Source', '-', 'searchCode', 'autoFormat', 'CommentSelectedRange', 'UncommentSelectedRange', 'AutoComplete', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates' ] ],
[ 'name' => 'clipboard', 'items' => [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] ],
[ 'name' => 'editing', 'items' => [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] ],
[ 'name' => 'forms', 'items' => [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] ],
'/',
[ 'name' => 'basicstyles', 'items' => [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat' ] ],
[ 'name' => 'paragraph', 'items' => [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language' ] ],
[ 'name' => 'links', 'items' => [ 'Link', 'Unlink', 'Anchor' ] ],
[ 'name' => 'insert', 'items' => [ 'CodeSnippet', 'Image', 'VideoDetector', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe', 'Footnotes', 'Spoiler' ] ],
'/',
[ 'name' => 'styles', 'items' => [ 'Styles', 'Format', 'Font', 'FontSize' ] ],
[ 'name' => 'colors', 'items' => [ 'TextColor', 'BGColor' ] ],
[ 'name' => 'tools', 'items' => [ 'Maximize', 'ShowBlocks' ] ],
[ 'name' => 'about', 'items' => [ 'About' ] ]
];

54
core/components/ckeditor/presets/editor/plugins.php

@ -0,0 +1,54 @@
<?php
return [
'codemirror',
'codesnippet',
'videodetector',
'clipboard',
'panelbutton',
'floatpanel',
'quicktable',
'specialchar',
'copyformatting',
'colordialog',
'templates',
'menu',
'contextmenu',
'tabletools',
'spoiler',
'showblocks',
'pagebreak',
'fakeobjects',
'liststyle',
'iframe',
//'forms',
//'footnotes',
'flash',
'find',
'richcombo',
'font',
'entities',
'preview',
'button',
'menubutton',
//'language',
'indent',
'print',
'tableresize',
'justify',
'notification',
//'allowsave',
//'newpage',
'a11yhelp',
'blockquote',
'resize',
'elementspath',
'htmlwriter',
'bidi',
'colorbutton',
'div',
//'wordcount',
'selectall'
//'autosave'
//'bbcode'
];

17
core/components/ckeditor/presets/editor/toolbar.php

@ -0,0 +1,17 @@
<?php
return [
[ 'name' => 'document', 'items' => [ 'Source', '-', 'searchCode', 'autoFormat', 'CommentSelectedRange', 'UncommentSelectedRange', 'AutoComplete', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates' ] ],
[ 'name' => 'clipboard', 'items' => [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] ],
[ 'name' => 'editing', 'items' => [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] ],
[ 'name' => 'forms', 'items' => [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] ],
'/',
[ 'name' => 'basicstyles', 'items' => [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat' ] ],
[ 'name' => 'paragraph', 'items' => [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language' ] ],
[ 'name' => 'links', 'items' => [ 'Link', 'Unlink', 'Anchor' ] ],
[ 'name' => 'insert', 'items' => [ 'CodeSnippet', 'Image', 'VideoDetector', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe', 'Footnotes', 'Spoiler' ] ],
'/',
[ 'name' => 'styles', 'items' => [ 'Styles', 'Format', 'Font', 'FontSize' ] ],
[ 'name' => 'colors', 'items' => [ 'TextColor', 'BGColor' ] ],
[ 'name' => 'tools', 'items' => [ 'Maximize', 'ShowBlocks' ] ],
[ 'name' => 'about', 'items' => [ 'About' ] ]
];

BIN
static/files/bd942d71aa78e54a473ea0ddc2a0d7f6.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Loading…
Cancel
Save