MDL-33506 Filepicker: Search box text will be selected on focus
authorRajesh Taneja <rajesh@moodle.com>
Thu, 14 Jun 2012 03:45:01 +0000 (11:45 +0800)
committerRajesh Taneja <rajesh@moodle.com>
Thu, 14 Jun 2012 05:03:08 +0000 (13:03 +0800)
repository/filepicker.js

index 335f4c9..d27375e 100644 (file)
@@ -1743,6 +1743,14 @@ M.core_filepicker.init = function(Y, options) {
                         if (obj.repo_id == scope.active_repo.id && obj.form) {
                             // if we did not jump to another repository meanwhile
                             searchform.setContent(obj.form);
                         if (obj.repo_id == scope.active_repo.id && obj.form) {
                             // if we did not jump to another repository meanwhile
                             searchform.setContent(obj.form);
+                            // Highlight search text when user click for search.
+                            var searchnode = searchform.one('input[name="s"]');
+                            if (searchnode) {
+                                searchnode.once('click', function(e) {
+                                    e.preventDefault();
+                                    this.select();
+                                });
+                            }
                         }
                     }
                 }, false);
                         }
                     }
                 }, false);