Skip to content

Commit

Permalink
updated to work for tabular and stacked inlines
Browse files Browse the repository at this point in the history
  • Loading branch information
cauyeung-wco committed May 11, 2016
1 parent 130185a commit d5994d7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion metadata.py
@@ -1,4 +1,4 @@
name = 'tinymce'
authors = 'Joost Cassee, Aljosa Mohorovic'
version = '1.5.3-post2'
version = '1.5.3-post3'
release = version
23 changes: 17 additions & 6 deletions tinymce/static/django_tinymce/init_tinymce.js
Expand Up @@ -25,14 +25,25 @@
// XXX: We don't use jQuery's click event as it won't work in Django 1.4
document.body.addEventListener("click", function(ev) {

// We always use stacked inlines so use this method instead
// Check for tabular inlines
var $addRow = $(ev.target).closest('tr').prev();
if($addRow.length == 0) {

// Stacked inlines
$addRow = $(ev.target.parentNode);

}

if($addRow.length > 0) {

setTimeout(function() { // We have to wait until the inline is added
$('textarea.tinymce', $addRow.parent()).each(function () {
initTinyMCE($(this));
});
}, 0);

}

setTimeout(function() { // We have to wait until the inline is added
$('textarea.tinymce', $addRow.parent()).each(function () {
initTinyMCE($(this));
});
}, 0);
}, true);
});
}(django.jQuery));

0 comments on commit d5994d7

Please sign in to comment.