Code Monkey home page Code Monkey logo

Comments (10)

kosssi avatar kosssi commented on August 26, 2024

// config
window.CKEDITOR.config.customConfig = window.CKEDITOR_BASEPATH + window.CKEDITOR.config.customConfig;
// plugin
window.CKEDITOR.plugins.basePath = window.CKEDITOR_BASEPATH + window.CKEDITOR.plugins.basePath;

// add plugin
window.CKEDITOR.plugins.addExternal('sourcedialog', '/bundles/.../plugins/sourcedialog/','plugin.js');
window.CKEDITOR.config.extraPlugins = 'sourcedialog';

// remove plugin
window.CKEDITOR.config.removePlugins = 'smiley,flash,horizontalrule,magicline,pagebreak,iframe,wsc';

...

from create-bundle.

dinamic avatar dinamic commented on August 26, 2024

I guess one should override the includejsfiles-ckeditor.html.twig file by extending the CreateBundle and include any custom configuration after bootstrapping the ckeditor.

Example:

{% include "SymfonyCmfCreateBundle::includejsfiles-create.html.twig" %}

<script>window.CKEDITOR_BASEPATH = '{{ cmfCreateEditorBasePath }}';</script>
{% javascripts output="/js/ckeditor.js"
'@SymfonyCmfCreateBundle/Resources/public/js/init-create-ckeditor.js'
'@SymfonyCmfCreateBundle/Resources/public/vendor/ckeditor/ckeditor.js'
%}
<script src="{{ asset_url }}"></script>

<script type="text/javascript">
    $(document).ready(function(){
        window.CKEDITOR.plugins.addExternal('dynamicfieldprice', '/bundles/customcreate/vendor/ckeditor/plugins/dynamicfieldprice/','plugin.js');
        window.CKEDITOR.config.extraPlugins = 'dynamicfieldprice';
    });
</script>
{% endjavascripts %}

from create-bundle.

dinamic avatar dinamic commented on August 26, 2024

I guess this would not be very developer friendly or at least it did not came natural to me.

Wouldn't assetic be able to handle it for us, so we can escape the need for extending the bundle only for providing some additional configuration for the ckeditor?

from create-bundle.

dbu avatar dbu commented on August 26, 2024

if i understand kossi correctly he is saying that you can let the default stuff happen but include your own javascript afterwards to change the configuration.

from create-bundle.

dinamic avatar dinamic commented on August 26, 2024

Yes, I've provided the example from my case and it works just fine.

My point was that there could be more elegant solution.

from create-bundle.

kosssi avatar kosssi commented on August 26, 2024

if you can make a PR don't hesitate ;)

from create-bundle.

dbu avatar dbu commented on August 26, 2024

But it should not be needed to extend the bundle or replace a template, just have some js executed after the call to load create. Did you need to do more than that?

----- Reply message -----
Von: "Nikola Petkanski" [email protected]
An: "symfony-cmf/CreateBundle" [email protected]
Cc: "David Buchmann" [email protected]
Betreff: [CreateBundle] Provide means to configure ckeditor (#53)
Datum: Di., Mai. 14, 2013 17:02
Yes, I've provided the example from my case and it works just fine.

My point was that there could be more elegant solution.


Reply to this email directly or view it on GitHub.

from create-bundle.

dinamic avatar dinamic commented on August 26, 2024

Well, we already have the privilege check in place. I see no reason to duplicate logic.

I think extending the template is the way. app/Resources/views can be used in order to avoid extending the template for just one template file.

from create-bundle.

dbu avatar dbu commented on August 26, 2024

i still don't see why/if you need to replace the template or if you can just add your own js after that. unless you want to run the includejsfile action in many places, in which case overwriting the template in app/Resources would indeed be the easiest.

from create-bundle.

dinamic avatar dinamic commented on August 26, 2024

I don't like the way the configuration can be done atm.
I will make a PR once I figure out solution that is more flexible.

from create-bundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.