MDL-41238 atto - close menu style when clicking anywhere outside it
authorJason Fowler <phalacee@gmail.com>
Tue, 3 Sep 2013 02:16:02 +0000 (10:16 +0800)
committerJason Fowler <phalacee@gmail.com>
Fri, 6 Sep 2013 06:46:45 +0000 (14: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/editor.js

index 9bd1136..f58ff62 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 10ec58e..a0135ca 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 9bd1136..f58ff62 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 4c75cc7..712262f 100644 (file)
@@ -56,13 +56,21 @@ M.editor_atto = M.editor_atto || {
         var disabled = this.getAttribute('disabled');
         var overlayid = this.getAttribute('data-menu');
         var overlay = M.editor_atto.menus[overlayid];
-
+        var menu = overlay.get('bodyContent');
         if (overlay.get('visible') || disabled) {
             overlay.hide();
+            menu.detach('clickoutside');
         } else {
+            menu.on('clickoutside', function(ev) {
+                if (ev.target.ancestor() !== this) {
+                    if (overlay.get('visible')) {
+                        menu.detach('clickoutside');
+                        overlay.hide();
+                    }
+                }
+            }, this);
             overlay.show();
         }
-
     },
 
     /**
@@ -161,7 +169,6 @@ M.editor_atto = M.editor_atto || {
 
         var menu = Y.Node.create('<div class="atto_' + plugin + '_menu' +
                                  ' atto_menu" data-editor="' + Y.Escape.html(elementid) + '"></div>');
-
         var i = 0, entry = {};
 
         for (i = 0; i < entries.length; i++) {