You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The editor doesn't work with new inlines in the admin that are created with javascript. If you press the "Add a new row" button, the editor shows up, but it doesn't update the hidden textarea. This happens, because the html is not updated correctly. The javascript produces something like this:
I was able to work around this by making my own copy of static/admin/js/inlines.js and adding a few lines:
var updateElementIndex = function(el, prefix, ndx) {
var id_regex = new RegExp("(" + prefix + "-(\\d+|__prefix__))");
var replacement = prefix + "-" + ndx;
if ($(el).prop("for")) {
$(el).prop("for", $(el).prop("for").replace(id_regex, replacement));
}
if (el.id) {
el.id = el.id.replace(id_regex, replacement);
}
if (el.name) {
el.name = el.name.replace(id_regex, replacement);
}
// @HACK(richard) needed for django trix
if ($(el).attr('input')) {
$(el).attr('input', $(el).attr('input').replace(id_regex, replacement));
}
};
I wonder if there's a way to modify the way this is implemented so it works with django's built-in javascript. If the "for" property is used instead of "input", that could make it work.
The text was updated successfully, but these errors were encountered:
* add setter to name so inline.js in django will work
connects to #2
* Update trix-core.js
* Update trix.js
* Update trix-core.js
* Update trix.js
* Update trix-core.js
The editor doesn't work with new inlines in the admin that are created with javascript. If you press the "Add a new row" button, the editor shows up, but it doesn't update the hidden textarea. This happens, because the html is not updated correctly. The javascript produces something like this:
Notice the "
__prefix__
" is still there.I was able to work around this by making my own copy of
static/admin/js/inlines.js
and adding a few lines:I wonder if there's a way to modify the way this is implemented so it works with django's built-in javascript. If the "for" property is used instead of "input", that could make it work.
The text was updated successfully, but these errors were encountered: