Issue #4 resolved

markitup and inlines causing duplicate markitup buttons

Rob Hudson
created an issue

I'm going to try to share all we've discovered in hopes it helps...

The user side effect is that when a user clicks the "Add another ..." link in the Django admin inline, a textarea is added but contains 2 sets of markitup buttons -- the first set is non-functional (clicking reloads the page), while the second set works.

We dug a little deeper and put an {{{ alert() }}} call in the widget {{{ render() }}} method so we can see when the {{{ .MarkitUp(...) }}} call was happening. It's happening on the initial page render and each click of the "Add another ..." link. The ID that's getting passed includes the {{{ prefix }}} string that the inline JS uses to search/replace.

In inspecting the DOM elements after the fact, we can see that the textarea was double wrapped with the markitup container and buttons.

We were kind of hoping that if it was the first call that made this work, we could add a simple {{{ if ($$.parent().hasClass('markItUpContainer')) }}} check to the markitup JS {{{ init }}} method to avoid the second wrapping. We tried this but the first set of buttons was the one not working.

Comments (3)

  1. Log in to comment