craftcms / ckeditor

Edit rich text content in Craft CMS using CKEditor.
https://plugins.craftcms.com/ckeditor
GNU General Public License v3.0
46 stars 23 forks source link

The convert command doesn't find Redactor fields in super table fields nested in matrix fields #109

Open MoritzLost opened 1 year ago

MoritzLost commented 1 year ago

Description

I just noticed that Redactor fields inside Super Table fields inside Matrix fields are not converted by the ckeditor/convert command. Looks like the command can't find those fields, because they don't show up in the output of the command at all. Regular Super Table fields (not nested inside Matrix fields) work fine.

Edit: I was wrong, the nested fields do show up and they are even converted correctly in the config/project/ folder. However, the changed config is not applied to the database for some reason, so the field still shows up as a Redactor field in the field settings. Running php craft project-config/apply --force fixes this, after that the field correctly shows up as a CKEditor field.

Can this be fixed inside the command? Or is this a Super Table issue? In the meantime, it would probably be a good idea to add a note regarding this issue and the workaround to the README.

Steps to reproduce

  1. Install the Super Table plugin.
  2. Create a matrix field and add a new block type. Inside the block type, add a Super Table field. Inside the Super Table field, add a Redactor field.
  3. Run php craft ckeditor/convert. The YAML file inside config/project/superTableBlockTypes/ will be updated correctly. But the field will still show up as a Redactor field in the field settings in the backend.
  4. Run php craft project-config/apply --force. Now the field settings in the backend should correctly show the field as a CKEditor field.

Additional info

brandonkelly commented 1 year ago

I wasn’t able to reproduce this locally. Is it still happening for you?

MoritzLost commented 11 months ago

@brandonkelly Sorry for the late reply!

Yes, I'm still seeing this issue. Note it only occurs in this specific setup (Redactor field inside a Super Table field inside a Matrix field). After running ckeditor/convert, even though the field shows up in the list of converted fields, after reloading the settings page for the Matrix field, the nested field still shows a Redactor field. Only after running project-config/apply --force does it show up as a CKEditor field. So the project config is correctly modified, it's only not fully applied to the current environment. Not a huge issue, but still annoying and can potentially cause confusion.

chrismlusk commented 8 months ago

I also experienced this issue when running ckeditor/convert. Running project-config/apply --force resolved it, but yes, it was confusing. A note in the README would have been useful.

brandonkelly commented 4 months ago

Running project-config/apply --force should not be necessary. Any chance either of you could share a database backup from before running ckeditor/convert, plus your composer.json file? If so please send to support@craftcms.com.

MoritzLost commented 4 months ago

@brandonkelly Can't share a DB backup unfortunately :/

I'm still seeing the issue on the latest Craft & CKEditor versions. It's only happening with the specific field setup (Matrix field with a block type that contains a Super Table field, which in turn contains a Redactor field). Did you try to reproduce with that exact field setup?

Not super important I guess since it's just a one-time operation to fix it.

TheFunkyMonk commented 3 months ago

Running project-config/apply --force should not be necessary. Any chance either of you could share a database backup from before running ckeditor/convert, plus your composer.json file? If so please send to support@craftcms.com.

We experienced the same issue, just shared those files via email.

TheFunkyMonk commented 3 months ago

Update: rebuilding project config with php craft project-config/rebuild resolved this issue for us!

jenibelle08 commented 3 months ago

Likewise, this error just happened with us, with a Matrix field with a block type that contains a Super Table field. We'll send over the files if/when it happens again.

nikolowry commented 2 weeks ago

Be great to add a little notice to the README until someone figures out a fix. Not fun having a panic attack during an upgrade and needing to dig-through GitHub bugs


EDIT: project-config/apply --force helped some, but still missed about ~10 Matrix/SuperTable fields. Had to open up every field to validate, which kind of defeats the purpose of having a migration in the first place.