Skip to content

Commit 75ca845

Browse files
authored
Merge pull request #40 from smartfactory-gmbh/feature/multiple_textareas
Add correct editorjs initialisation for multiple editorjs fields in an inline
2 parents d1f4890 + cee3869 commit 75ca845

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

django_editorjs_fields/static/django-editorjs-fields/js/django-editorjs-fields.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,12 @@
163163
// Event
164164
if (typeof django === "object" && django.jQuery) {
165165
django.jQuery(document).on("formset:added", function (event, $row) {
166-
var textarea = $row.find("[data-editorjs-textarea]").get(0)
166+
var areas = $row.find("[data-editorjs-textarea]").get()
167167

168-
if (textarea) {
169-
initEditorJsField(textarea)
168+
if (areas) {
169+
for (let i = 0; i < areas.length; i++) {
170+
initEditorJsField(areas[i])
171+
}
170172
}
171173
})
172174
}

0 commit comments

Comments
 (0)