ckeditor icon indicating copy to clipboard operation
ckeditor copied to clipboard

Nested Entries: invalid Entry ID in custom plugin

Open ishetnogferre opened this issue 1 year ago • 0 comments

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

ishetnogferre avatar Jun 28 '24 08:06 ishetnogferre