django-editorjs-fields icon indicating copy to clipboard operation
django-editorjs-fields copied to clipboard

The editor.js is not initiated when used inside of inlines

Open archatas opened this issue 2 years ago • 3 comments

This problem occurs in Django administration and in frontend forms with dynamically addable inlines.

archatas avatar May 05 '22 03:05 archatas

Ideally there could be a custom event to trigger that would reinitiate all widgets that haven't been initiated. Probably where you can pass the container element where to look for the textareas.

Also there should be multiple textareas allowed with the dynamically added formsets.

archatas avatar May 05 '22 05:05 archatas

can you give an example?

plugin in inlines are working in the admin panel, you can see example

2ik avatar May 05 '22 16:05 2ik

If the admin inline has more than one Editor.js fields, only the first one gets initiated, and others are ignored and show textareas with the value "null".

You can see the problem from this line of code, when only the 0th textarea is initiated.

For inlines in the frontend, there is no way to trigger re-initiation, because the initation function initEditorJsField() is within a JavaScript closure – so no access to it at all.

archatas avatar May 05 '22 21:05 archatas