craftcms / craftcms/ckeditor

Nested Entries: invalid Entry ID in custom plugin

Open
#261 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
47
Forks
32
PR merge metrics
No merged PRs in 30d

Description

Description

I'm trying to build a CKEditor plugin that will (try) to make use of the nested entries functionality and to better understand how it works first, I just copied everything over from the entries files: https://github.com/craftcms/ckeditor/tree/4.x/src/web/assets/ckeditor/src/entries

Then changed all the handles to be unique, so they wouldn't conflict with each other. (e.g. changed all CraftEntries to like CraftInlineEntries) (my code is linked below).

Everything works the same as the Nested Entries functionality, I can select the Entry type, edit the fields and save, except something goes wrong after/before the saving of the nested entry in the slideout.

Since I saw some similar issues here #254, I'd though to add one as well, because maybe there is a underlying issue, I tried the corresponding fix (#257) as well, but doesn't solve the case below.


So: I can add an entry via the new toolbar button, the slideout shows then an "Entry saved/created" popup is shown and an ID gets returned. Then the HTML gets added to the ckeditor field, all the same as "New Entry" but with this new plugin, the entry ID shows as invalid whenever added to the CKEditor field.

Screenshot 2024-06-28 at 10 32 29

Also if I click on the entry link in the "Entry created" notification, it also says the element doesn't exist.

I used as HTML output for this new plugin opposed to , now weirdly enough if I go and edit it via the source of the CKEditor field from <craft-inline-entry data-entry-id="698358"> to <craft-entry data-entry-id="698358"> it somehow can find that entry 🤔 I don't really see why this happens, as the rendering of it, is just an entry lookup by ID in both cases?

Steps to reproduce
  1. Install CKEditor Inline Entries (https://github.com/Little-Miss-Robot/craft-ckeditor-inline-entries)
  2. Add the "New inline entry" button to a CKEditor config
  3. Add a Entry type to a field with the above CKEditor config
  4. Create a "new inline entry" via the toolbar
Additional info
  • Craft version: Craft 5.2.4.1
  • Plugins & versions: CKEditor 4.1.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the invalid ID using the linked CKEditor Inline Entries plugin and compare it with the copied files in src/web/assets/ckeditor/src/entries. Trace the saved entry and the generated markup, then verify that the custom element resolves the same entry as .

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, content
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.