bestmomo / laravel5-5-example

Laravel 5.5 example for tutorial
217 stars 122 forks source link

How to add plugins to ckedit? #26

Closed weslings closed 5 years ago

weslings commented 5 years ago

How can I add plugins, especially codesnippet, to ckeditor? Even changing the 5.5 with the 5.3 version, in which codesnippet is included, does not work. Do i need to implement it in a view?

bestmomo commented 5 years ago

You must load standard-all version from CDN.

And in CKEditor config add:

config.extraPlugins = 'codesnippet';
weslings commented 5 years ago

It doesn't work. I took codesnippet inclusive it's dependencies (dialog & widget) in following path:

public/adminlte/plugins/ckeditor/plugins

I then modified config.js located in the ckeditor with

config.extraPlugins = 'codesnippet';

with no effect. I also tried

config.extraPlugins = 'dialog,widget,codesnippet';

also with no effect. What am I missing?

bestmomo commented 5 years ago

I've tried it on this project and it works for me in editor. I just changed in view:

<script src="https://cdn.ckeditor.com/4.7.3/standard-all/ckeditor.js"></script>

And in ckeditor.js:

CKEDITOR.editorConfig = function( config ) {
    config.extraPlugins = 'codesnippet'
   ...
    config.toolbarGroups = [
        ...
        { name: 'document',    groups: [ 'mode', 'document', 'doctools' ,'CodeSnippet'] },
       ...
    ]
}
weslings commented 5 years ago

Thank you, this was the hint I needed.