summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn McLear <john@mclear.co.uk>2015-03-31 13:21:41 +0100
committerJohn McLear <john@mclear.co.uk>2015-03-31 13:21:41 +0100
commita82e692bdd39feced285b6bd25c3ccb39b63434b (patch)
tree8e3fb528ba250ae9ba3da08fa77a26480fdb0889 /src
parentf9071aebe6deff70e84d38b5508d730edadc4902 (diff)
downloadetherpad-lite-a82e692bdd39feced285b6bd25c3ccb39b63434b.zip
dont use nasty settimeouts use a callback instead for focus
Diffstat (limited to 'src')
-rw-r--r--src/static/js/pad_editbar.js26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js
index aa9f183b..8df6e693 100644
--- a/src/static/js/pad_editbar.js
+++ b/src/static/js/pad_editbar.js
@@ -352,32 +352,30 @@ var padeditbar = (function()
toolbar.registerDropdownCommand("embed");
toolbar.registerCommand("settings", function () {
- setTimeout(function(){
+ toolbar.toggleDropDown("settings", function(){
$('#options-stickychat').focus();
- },100);
- toolbar.toggleDropDown("settings");
+ });
});
toolbar.registerCommand("import_export", function () {
- setTimeout(function(){
- $('#importfileinput').focus();
- },100);
- toolbar.toggleDropDown("import_export");
+ toolbar.toggleDropDown("import_export", function(){
+ setTimeout(function(){
+ $('#importfileinput').focus();
+ }, 100);
+ });
});
toolbar.registerCommand("showusers", function () {
- setTimeout(function(){
- $('#myusernameedit').focus(); // TODO: Not working
- },100);
- toolbar.toggleDropDown("users");
+ toolbar.toggleDropDown("users", function(){
+ $('#myusernameedit').focus();
+ });
});
toolbar.registerCommand("embed", function () {
toolbar.setEmbedLinks();
- setTimeout(function(){
+ toolbar.toggleDropDown("embed", function(){
$('#linkinput').focus().select();
- }, 100);
- toolbar.toggleDropDown("embed");
+ });
});
toolbar.registerCommand("savedRevision", function () {