egeloen / IvoryCKEditorBundle

Provides a CKEditor integration for your Symfony project.
MIT License
336 stars 114 forks source link

Allow to use CKEditor with Symfony4 #329

Open VoodooPrograms opened 6 years ago

VoodooPrograms commented 6 years ago

When authors will make CKEditor work fine with newest Symfony 4? I was trying to upgrade my project from 3.4 to 4.0, when that problem appears. Problem 1

Muspi commented 6 years ago

Hey, following this with attention :)

Paktusin commented 6 years ago

same problem

Muspi commented 6 years ago

My solution: use ckeditor natively in my app ;)

jdutheil commented 6 years ago

Juste require it with "@dev".. But there's still others issues after that, like "textarea" type.. ;/

JellyBellyDev commented 6 years ago

I'm interested too!

SamuelSSalazar commented 6 years ago

While they release the bundle with Symfony 4 support you can use CKEditor 5 natively. Here is how i did it for easy admin textarea fields:

  1. Download the library from https://docs.ckeditor.com/ckeditor5/latest/builds/guides/integration/installation.html#Zip-download and put them into your public dir.

  2. In config/packages/easy_admin/design.yml add the files and a custom js file:

        js:
            - '/ckeditor5/ckeditor.js.map'
            - '/ckeditor5/ckeditor.js'
            - '/ckeditor5/mycustom.js'
  3. In the entity.yml add css_class to the property:

    form:
          - { property: 'myTextProp', css_class: 'awesome-ckeditor', type: 'textarea' }
  4. Finally in your custom js file add this code to initialize the editors:

    $(document).ready(function () {
    
            document.querySelectorAll( '.awesome-ckeditor textarea' )
                .forEach(function(el){
                    el.removeAttribute('required');
                    ClassicEditor
                        .create( el )
                        .then( function (editor) {
                            console.log( editor );
                            var div = el.parentNode.querySelector('.ck-editor__editable');
                            div.style.backgroundColor = 'white'; 
                            div.style.minHeight = '300px';
                        } )
                        .catch( function (error) {
                            console.error( error );
                        } );
                });
    
        });

Hope it helps for a temporal solution. I´m looking forward to the next release of this bundle.

rbrlortie commented 6 years ago

@SamuelSSalazar's solution works great.

Make sure your css_class is the same in your custom file and on entity's form input.

I had to put my JS inclusions under easy_admin.yaml under:

easy_admin:
    design:
      assets:
        js:
          - 'ckeditor5/ckeditor.js.map'
          - 'ckeditor5/ckeditor.js'
          - 'ckeditor5/mycustom.js'
jlemale commented 6 years ago

There are some PR about it but @egeloen has no time to review them. :/

Dear #PHP and #Symfony community, still nobody intersted to take the lead of the #Ivory libraries & bundles? (no time for them...) See https://twitter.com/egeloen/status/949356450962399235

cybernet commented 6 years ago

so no one seems to care ...

laminr commented 6 years ago

I do, but I don't have the current knowledge to handle it (not yet)

szymach commented 6 years ago

There is an issue with SensioDistributionBundle - it is not and will not be compatibile with Symfony 4, so until it is required in tests, they will not actually test all components in the 4.x version. It will either have to be removed or replaced.

szymach commented 6 years ago

If you are really hard pressed to use this bundle with Symfony 4, my organization has made a fork that uses the #342 to allow it. You can find it on packagist.

Note that this is not a fork intended for any new features, though we may accept some bug fixes PR if someone bothers to submit to us. Use it as a substitute until a new maintainer for this bundles comes up.

crayner commented 6 years ago

Have a full Symfony 4 integration of CKEditor. Currently waiting for flex recipe approval, but it works. See on packagist.

vikas-srivastava commented 6 years ago

@crayner I tried it but @EasyAdminBundle heavily relying on this module for CKEditor field type

jacquesndl commented 6 years ago

@vikas-srivastava

In the EasyAdmin cfg, you can write

- { property: 'content', type: 'Hillrange\CKEditor\Form\CKEditorType' }

instead of

- { property: 'content', type: 'ckeditor' }

I hope it helped you.

proArtex commented 6 years ago

FOS took this bundle over: https://github.com/FriendsOfSymfony/FOSCKEditorBundle

TheRatG commented 6 years ago

FOSCKEditorBundle

- { property: 'content', type: 'FOS\CKEditorBundle\Form\Type\CKEditorType' }

pierrealexaline commented 5 years ago

Then which version ? the official or forked ? Ivory or not ???? what the conclusion about this ? I search to use ckeditor with easy_admin and symfony 4 ...Thx

xabbuh commented 5 years ago

As mentioned above FOSCKEditorBundle is the bundle to use now.