Commits

Luke Plant committed 91c9d37

Fixed some bugs with clean_html()

  • Participants
  • Parent commits 3a54cdc

Comments (0)

Files changed (1)

File semanticeditor/media/semanticeditor/javascript/wymeditor/plugins/semantic/wymeditor.semantic.js

 };
 
 PresentationControls.prototype.form_submit = function(event) {
-    // We need to ensure all elements have ids, *and* that command block
-    // elements have correct ids (which is a side effect of the below).
-    this.ensure_all_ids();
-    // this.presentation_info might have old info, if command blocks have
-    // been removed.  Need to clean.
-    this.clean_presentation_info();
-
+    this.prepare_data();
     // Since we are in the middle of submitting the page, an asynchronous
     // request will be too late! So we block instead.
 
 };
 
 PresentationControls.prototype.show_preview = function() {
+    this.prepare_data();
     var self = this;
-    this.ensure_all_ids();
-    this.clean_presentation_info();
     jQuery.post(this.opts.preview_url, { 'html': self.wym.xhtml(),
                                          'presentation': JSON.stringify(this.presentation_info)
                                         },
     return undefined; // shouldn't get here
 };
 
+PresentationControls.prototype.prepare_data = function() {
+    // Prepare data/html for sending server side.
+
+    // We need to ensure all elements have ids, *and* that command block
+    // elements have correct ids (which is a side effect of the below).
+    this.ensure_all_ids();
+    // this.presentation_info might have old info, if command blocks have
+    // been removed.  Need to clean.
+    this.clean_presentation_info();
+};
+
 PresentationControls.prototype.clean_html = function() {
+    this.prepare_data();
     var self = this;
     var html = this.wym.xhtml();
     jQuery.post(this.opts.clean_html_url, {'html':html},