dimitrov-adrian / directus-extension-editorjs-interface

Block editor (Editor.js) interface for Directus 9
https://www.npmjs.com/package/directus-extension-editorjs
GNU General Public License v3.0
180 stars 42 forks source link

Editor.js field within M2A field gives error #32

Open zachNDTC opened 2 years ago

zachNDTC commented 2 years ago

Hello, I have a collection named "courses" and a collection named "lessons." Within courses I have a M2A field I named "syllabus" to add lessons to each course item. I can add lessons and add titles to lessons just fine (input field). When I edit a lesson from within a course and try to use the Editor.js field, I am allowed to enter in all the content, but when I save, the panel goes blank.

When I first enter content, I get the following console error (though it does continue to let me add/edit new blocks):

vendor.ef99adf3.js:5 TypeError: Cannot create property 'content' on string '1'
    at Proxy.A (index.5bac3394.entry.js:43:73072)
    at onUpdate:modelValue (index.5bac3394.entry.js:43:75714)
    at Ph (vendor.ef99adf3.js:5:656)
    at W1 (vendor.ef99adf3.js:5:735)
    at nB (vendor.ef99adf3.js:2:21162)
    at h (index.5bac3394.entry.js:43:64094)
    at o.onUpdate:modelValue.$.<computed>.$.<computed> (index.5bac3394.entry.js:43:66546)
    at Ph (vendor.ef99adf3.js:5:656)
    at W1 (vendor.ef99adf3.js:5:735)
    at nB (vendor.ef99adf3.js:2:21162)

When I try to save, I get the following error:

vendor.ef99adf3.js:5 TypeError: Cannot read properties of undefined (reading 'endsWith')
    at index.5bac3394.entry.js:43:75647
    at Proxy.find (<anonymous>)
    at index.5bac3394.entry.js:43:75612
    at KB (vendor.ef99adf3.js:2:62802)
    at Proxy.lM (index.5bac3394.entry.js:43:74199)
    at v5 (vendor.ef99adf3.js:2:22303)
    at C3.pt [as fn] (vendor.ef99adf3.js:2:50749)
    at C3.run (vendor.ef99adf3.js:2:12019)
    at ut (vendor.ef99adf3.js:2:50415)
    at Oe (vendor.ef99adf3.js:2:50017)

Editor works perfectly fine when natively editing a lesson, but when editing a lesson from within a course, it breaks.

When editing within a course:

Screen Shot 2022-04-05 at 9 50 30 PM

After saving everything disappears:

Screen Shot 2022-04-05 at 9 50 36 PM
dimitrov-adrian commented 2 years ago

@zachNDTC Is it still reproducible? I tried Directus v9.10 and exact setup and creating new and updating existing content from many-to-any related field is working just fine.