MDL-45253 editor_atto: Prevent selection of all nodes when selection is empty
authorFrederic Massart <fred@moodle.com>
Thu, 1 May 2014 09:38:39 +0000 (17:38 +0800)
committerFrederic Massart <fred@moodle.com>
Mon, 5 May 2014 09:46:13 +0000 (17:46 +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/selection.js

index 41e70be..351c557 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 78e612e..25775ee 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 f73e64a..a7d2225 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 99b46b8..f6d10ce 100644 (file)
@@ -252,8 +252,12 @@ EditorSelection.prototype = {
         }
 
         if (range.collapsed) {
-            range = range.cloneRange();
-            range.selectNode(range.commonAncestorContainer);
+            // We do not want to select all the nodes in the editor if we managed to
+            // have a collapsed selection directly in the editor.
+            if (range.commonAncestorContainer !== this.editor.getDOMNode()) {
+                range = range.cloneRange();
+                range.selectNode(range.commonAncestorContainer);
+            }
         }
 
         nodes = range.getNodes();