symfony-cmf/create-bundle

Working with CKEditor : button 'source' is disabled

Bomere opened this issue · 2 comments

Hi,
I have a mistake with CKEditor. It's a feature or a bad config ?

I installed the bundle symfony-cmf and the create-bundle.
In file 'composer.json', I added extra info to get full ckeditor version.

"extra": {
        ...
        "ckeditor-directory": "vendor/symfony-cmf/create-bundle/Symfony/Cmf/Bundle/CreateBundle/Resources/public/vendor/ckeditor",
        "ckeditor-repository": "https://github.com/ckeditor/ckeditor-releases.git",
        "ckeditor-commit": "fe258604491af861b44b48e48c3e9a997ff7b2ad"
}

It's works ! The full version is in cmfcreate bundle directory ( /bundles/cmfcreate/vendor/ckeditor/ ).
But I have all buttons except the source button. I don't understand why...

capture d ecran 2014-09-11 a 17 41 54

If someone would like to enlighten me ?

Thank you

dbu commented

you have much more buttons than i would expect. http://cmf.liip.ch for example has a lot less - afaik the only way to change what buttons you want atm is to overwrite the template rendering ckeditor in app/Resources. as mentioned in #23 it would be cool if we manage to find a sane way to make this more convenient, whithout creating a huge configuration system.

Ok, thank you :-)

I found another way to integrate the source button. It's seem to be a feature of CKEditor, when I downloaded full version, the plugin sourcedialog was not present ...
http://ckeditor.com/comment/130748#comment-130748

I removed extra info from composer.json to get the standard edition of CKEditor and, in future, for get the new versions of software.

I downloaded the sourcedialog addon on the website of CKEditor and I copy it in my home bundle :
http://ckeditor.com/addon/sourcedialog

In the template, just before the end tag of body, I added the extra plugin

{% render(controller("cmf_create.jsloader.controller:includeJSFilesAction")) %}
{% if app.security is not null and is_granted('ROLE_ADMIN') %}
    <script type="text/javascript">
        $(document).ready(function(){
            window.CKEDITOR.plugins.addExternal('sourcedialog', '/bundles/home/vendor/ckeditor/plugins/sourcedialog/','plugin.js');
            window.CKEDITOR.config.extraPlugins = 'sourcedialog';
        });
    </script>
{% endif %}

And finally, it's work's !
capture d ecran 2014-09-12 a 10 20 23