formfcw / directus-extension-flexible-editor

A rich text editor (WYSIWYG) with JSON output that allows the integration of M2A relations to make it extremely flexible. A truly rich editor for Directus.
https://www.npmjs.com/package/directus-extension-flexible-editor
GNU General Public License v3.0
122 stars 13 forks source link

Related nodes don't work when nested 2 groups deep #26

Closed jdjoshuadavison closed 2 weeks ago

jdjoshuadavison commented 11 months ago

Describe the bug Flexible editors only work up to 1 group deep. When you put a flexible editor field in a group within a group and add a relation node, it immediately gives the error that "the related item does not exist". The item is not created in the junction collection and the M2A reference field doesn't change.

To Reproduce Steps to reproduce the behavior.

  1. Add 2 group fields to your collection and put one inside the other

  2. Add a flexible editor field to your collection, and put it inside both groups Screenshot 2023-09-29 at 09 52 09

  3. Set up at least one relation node for the flexible editor

  4. Create a new item in the collection

  5. Add a related item to the flexible editor field Immediately upon creating the related item, you'll see 'the related item does not exist'

Flexible Editor and Directus Versions:

formfcw commented 7 months ago

Does the bug still occur on your system? I can't reproduce it.

groups

The bug does not occur on my instance. Can you give me some more information?

madc commented 3 weeks ago

We use this all the time and never had any issues: image

sal1n commented 2 weeks ago

Hi.

I can replicate this issue in a clean v11 install: https://github.com/sal1n/flexible-editor-issue

Try adding an Image in the above example, credentials in the dockerfile.

If the editor is in a group under a group then I get the "the related item does not exist" message. If I take the editor out of the group then it works as expected.

formfcw commented 2 weeks ago

Thanks @sal1n, this way I could reproduce the issue.

If you watch the video below, you will see that the problem is not nesting the Flexible Editor field, but losing the connection to its reference field (editor_nodes) when nesting. This may be related to Directus and passing data to groups. However, I would strongly recommend to put your editor_nodes field in the same group as your Flexible Editor field, otherwise they may lose their connection!

https://github.com/user-attachments/assets/f1f3ed06-3a68-40e9-9bd4-914f367476f6

To address this issue, I have added a note in the README:

https://github.com/formfcw/directus-extension-flexible-editor/blob/55368b3eefc9bd83cb42a9180de1ca59f01718a8/README.md?plain=1#L66

Feel free to reopen this issue, if there is an edge case that is not covered by this workaround!