LaravelRUS / SleepingOwlAdmin

🦉 Administrative interface builder for Laravel (Laravel admin)
http://sleepingowladmin.ru/
MIT License
805 stars 217 forks source link

Add custom plugins to ckeditor #155

Closed Badou90 closed 8 years ago

Badou90 commented 8 years ago

Searched for this feature, but still dont know how to add custom plugins to ckeditor I know that there is config part in sleeping_owl.php file, but it trying to get files from ckeditor cdn standart package, not from local folders

butschster commented 8 years ago

Try to add in boostrap.php

PackageManager::get('ckeditor')
  ->js('ckeditor.plugin.test', asset('libs/path_to_plugin.js'), 'ckeditor')
  ->js('ckeditor.plugin.test1', asset('libs/path_to_plugin.js'), 'ckeditor')
  ->css('ckeditor.plugin.css', asset('libs/path_to_plugin.css'));

and then configure editor settings

sleeping_owl.php

'wysiwyg' => [
        ...
        /*
         * See http://docs.ckeditor.com/#!/api/CKEDITOR.config
         */
        'ckeditor'  => [
            'height' => 200,
        ],
        ...
    ],
alehkudrevich commented 8 years ago

Hello. I want to add own plugin to ckeditor.

bootstrap.php

PackageManager::get('ckeditor')->js('ckeditor.plugin.simplebox', asset('packages/sleepingowl/admin/ckeditor/plugins/simplebox/plugin.js'), 'ckeditor');

sleeping_owl.php

'ckeditor' => [
            'allowedContent' => true,
            'extraPlugins' => 'simplebox',
        ],

As a result browser display errors.

ckeditorerror

Badou90 commented 8 years ago

I think that first you need to ovveride default ckeditor plugin like PackageManager::add('ckeditor') ->js('ckeditor', resources_url('libs/ckeditor/ckeditor.js'), 'jquery');

I put custom ckeditor in packages/sleepingowl/default/libs for this purpose Now when i try to connect some plugin via config it shows me that

Resource name "imageuploader" was not found at "http://domain.loc/packages/sleepingowl/default/libs/ckeditor/plugins/imageuploader/plugin.js?t=G6DD".

butschster commented 8 years ago

My experience:

// app/Admin/bootstrap.php
PackageManager::add('ckeditor')
    ->js('ckeditor', asset('libs/ckeditor/ckeditor.js'));
// config/sleeping_owl.php

...
'wysiwyg'     => [
    'default'   => 'ckeditor',

    /*
     * See http://docs.ckeditor.com/#!/api/CKEDITOR.config
     */
    'ckeditor'  => [
        'height' => 300,
        'customConfig' => '/libs/ckeditor/config.js' // If you want use javascript config
    ],
...
// libs/ckeditor/config.js

CKEDITOR.editorConfig = function( config ) {
      // Define changes to default configuration here.
      // For complete reference see:
      // http://docs.ckeditor.com/#!/api/CKEDITOR.config

      ...
}

PROFIT!

eugenem commented 7 years ago

It stopped working at new versions. Tried:

PackageManager::add('ckeditor') ->js('ckeditor', '//cdn.ckeditor.com/4.5.7/standard-all/ckeditor.js', 'jquery');

#WysiwygManager::register('ckeditor')
#    ->js(null, '//cdn.ckeditor.com/4.5.7/standard-all/ckeditor.js', ['jquery']);

How do I do it properly?