MDL-41993 Atto: Strip yui ids from generated HTML.
authorDamyon Wiese <damyon@moodle.com>
Tue, 1 Oct 2013 04:05:09 +0000 (12:05 +0800)
committerDamyon Wiese <damyon@moodle.com>
Tue, 8 Oct 2013 01:32:18 +0000 (09:32 +0800)
lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js
lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js
lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js
lib/editor/atto/yui/src/editor/js/editor.js

index cc95695..1afc10f 100644 (file)
Binary files a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js and b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js differ
index b0057cb..e3a8d70 100644 (file)
Binary files a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js and b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js differ
index cc95695..1afc10f 100644 (file)
Binary files a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js and b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js differ
index dce37f6..2de6f81 100644 (file)
@@ -365,8 +365,8 @@ M.editor_atto = M.editor_atto || {
 
         // Copy the current value back to the textarea when focus leaves us.
         atto.on('blur', function() {
-            textarea.set('value', atto.getHTML());
-        });
+            textarea.set('value', this.get_clean_html(params.elementid));
+        }, this);
 
         // Listen for Arrow left and Arrow right keys.
         Y.one(Y.config.doc.body).delegate('key',
@@ -380,6 +380,24 @@ M.editor_atto = M.editor_atto || {
         M.editor_atto.filepickeroptions[params.elementid] = params.filepickeroptions;
     },
 
+    /**
+     * Remove all YUI ids from the generated HTML.
+     * @param string elementid - the id of the textarea we created this editor from.
+     * @return string HTML stripped of YUI ids
+     */
+    get_clean_html : function(elementid) {
+        var atto = Y.one('#' + elementid + 'editable');
+
+        Y.each(atto.all('[id]'), function(node) {
+            var id = node.get('id');
+            if (id.indexOf('yui') === 0) {
+                node.removeAttribute('id');
+            }
+        });
+
+        return atto.getHTML();
+    },
+
     /**
      * Implement arrow key navigation for the buttons in the toolbar.
      * @param Event e - the keyboard event.