Commits

Carl Meyer committed 9f7c4de

Fixed tests and updated changelog.

Comments (0)

Files changed (3)

 tip (unreleased)
 ----------------
 
+- Prevented double application of MarkItUp! editor to an
+  element. Fixes #4. Thanks Rich Leland.
+
 - Added `__len__` to `Markup` object to facilitate length and truthiness checks
-  in templates. Thanks Edmund von der Burg.
+  in templates. Fixes #16. Thanks Edmund von der Burg.
 
 1.0.0 (2011.07.11)
 ------------------

markitup/templates/markitup/editor.html

 <script type="text/javascript">
 (function($) {
 $(document).ready(function() {
-  $("#{{ textarea_id }}").markItUp(mySettings);
+  var element = $("#{{ textarea_id }}");
+  if(!element.hasClass("markItUpEditor")) {
+    element.markItUp(mySettings);
+  }
   {% if AUTO_PREVIEW %}$('a[title="Preview"]').trigger('mouseup');{% endif %}
 });
 })(jQuery);
 
 
 class RenderTests(MIUTestCase):
-    look_for = '$("#my_id").markItUp(mySettings);'
+    look_for = 'var element = $("#my_id");'
     auto_preview_override = True