MDL-47060 Atto: Autosave - play nicely with HTML source view.
authorDamyon Wiese <damyon@moodle.com>
Tue, 2 Sep 2014 07:21:33 +0000 (15:21 +0800)
committerDamyon Wiese <damyon@moodle.com>
Wed, 3 Sep 2014 07:00:02 +0000 (15:00 +0800)
There are 2 fixes here:
1. do not overwrite the changes to the HTML source when we do an autosave.
2. Move the Atto notifications alert to the containing div so it aligns properly for either view.

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/autosave.js
lib/editor/atto/yui/src/editor/js/notify.js

index 40cc593..6969164 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 068aab8..5ce80c8 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 cb7326d..d743822 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 33b0b88..07598bc 100644 (file)
@@ -215,7 +215,10 @@ EditorAutosave.prototype = {
      * @chainable
      */
     saveDraft: function() {
-        this.updateOriginal();
+        // Only copy the text from the div to the textarea if the textarea is not currently visible.
+        if (!this.editor.get('hidden')) {
+            this.updateOriginal();
+        }
         var newText = this.textarea.get('value');
 
         if (newText !== this.lastText) {
index 49ebc48..f9881c1 100644 (file)
@@ -84,7 +84,7 @@ EditorNotify.prototype = {
             this.messageOverlay = Y.Node.create('<div class="editor_atto_notification"></div>');
 
             this.messageOverlay.hide(true);
-            this._wrapper.append(this.messageOverlay);
+            this.textarea.get('parentNode').append(this.messageOverlay);
 
             this.messageOverlay.on('click', function() {
                 this.messageOverlay.hide(true);