Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0.0-beta.4] GQL isn't working? #163

Closed
davidhellmann opened this issue Feb 8, 2024 · 7 comments
Closed

[4.0.0-beta.4] GQL isn't working? #163

davidhellmann opened this issue Feb 8, 2024 · 7 comments
Labels

Comments

@davidhellmann
Copy link

Description

Tried to use GQL within the GQL Playground but looks like it isn't working. Tested also with Craft 4.x and CKE 3.x and this is working.

Steps to reproduce

image
image

Additional info

  • Craft version: 5.beta-1
@davidhellmann davidhellmann changed the title [4.0.0-beta.1] GQL isn't working? [4.0.0-beta.4] GQL isn't working? Feb 9, 2024
@davidwebca
Copy link

Just realized the same thing just now. I tried changing the configs, creating new fields, with or without sub entries inside the field. Just came here to mention this in case it helps!

@davidwebca
Copy link

davidwebca commented Feb 10, 2024

I take it back, I'm actually backtracking to fix the issue by downgrading the plugin one version at a time and I now realize that since v4 beta 1, it's been failing but I hadn't realized because they were released in quick successions.

--

Re-edit: Sorry for the multiple posts. Actually I just found out that I can't downgrade and nothing works anymore, CKEditor seems broken with Craft beta 1 regardless of the CKEditor beta version used. A "[]" gets returned by GraphQL regardless of what version I downgrade to.

brandonkelly added a commit that referenced this issue Feb 11, 2024
@brandonkelly
Copy link
Member

Thanks for reporting that! Just released CKEditor 4.0.0-beta.5 with a fix.

@davidhellmann
Copy link
Author

davidhellmann commented Feb 11, 2024

Follow-up question @brandonkelly

The output with entry blocks looks like this:

"textEditorDefault": "<p>Quo cu eius tollit instructior.</p><p>Entry 4051</p><p>Quo cu eius tollit instructior.</p><p>Entry 4052</p><p>An populo iriure interesset sit!.</p>"

Is a children's method coming, or how does that work in the future? Just want to know if I can build on top of that or go straight with a Matrix field at the moment.

Thank you!

@carlcs
Copy link

carlcs commented Feb 11, 2024

@davidhellmann You need to set up element partials for the entry types that you're embedding within your CKEditor fields.

https://craftcms.com/docs/5.x/system/elements.html#rendering-elements

@davidhellmann
Copy link
Author

Oh, thought that was also for twig templates. I'll have a look. Thank you!

@brandonkelly
Copy link
Member

brandonkelly commented Feb 15, 2024

Just released Craft 5.0.0-beta.2 and CKEditor 4.0.0-beta.6, which adds support for querying and mutating nested entries within CKEditor fields directly (craftcms/cms#14366).

So if you want to fetch nested entry data without having it pre-rendered as HTML via the partial template, you could have your partial template just include a placeholder referencing the entry ID, e.g.

<div data-craft-entry-id="{{ entry.id }}"></div>

And then fetch the nested entry data via a second GraphQL query, and do whatever you want from there.

Note that if you’re creating new nested entries via GraphQL, you will need to update the parent element’s CKEditor field value with a new <craft-entry> tag referencing it, before it will actually show up within the field.

<craft-entry data-entry-id="123"></craft-entry>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants