From e9360b6ed2b96e03c68a207e7562a87949e4b87a Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 25 Mar 2015 15:49:41 +0000 Subject: [PATCH] working f9 logic --- src/static/js/ace2_inner.js | 5 +++-- src/static/js/lodash.js | 1 + src/static/js/pad_editbar.js | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 src/static/js/lodash.js diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 4c8c5204..2b7e2d4a 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -3711,11 +3711,12 @@ function Ace2Inner(){ // Alt F9 focuses on the File Menu and/or editbar. // Note that while most editors use Alt F10 this is not desirable // As ubuntu cannot use Alt F10.... - evt.preventDefault(); // Focus on the editbar. -- TODO: Move Focus back to previous state (we know it so we can use it) var firstEditbarElement = parent.parent.$('#editbar').children("ul").first().children().first().children().first().children().first(); - firstEditbarElement.focus(); + // top.console.log("fEE", firstEditbarElement); $(this).blur(); + firstEditbarElement.focus(); + evt.preventDefault(); } if ((!specialHandled) && isTypeForSpecialKey && keyCode == 8) { diff --git a/src/static/js/lodash.js b/src/static/js/lodash.js new file mode 100644 index 00000000..349f9579 --- /dev/null +++ b/src/static/js/lodash.js @@ -0,0 +1 @@ +module.exports = require('lodash'); diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index 92e671c4..70360924 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -63,6 +63,7 @@ ToolbarItem.prototype.bind = function (callback) { if (self.isButton()) { self.$el.click(function (event) { + $(':focus').blur(); callback(self.getCommand(), self); event.preventDefault(); }); @@ -311,6 +312,7 @@ var padeditbar = (function() // Send the users focus back to the pad if(evt.keyCode === 120){ // If we're in the editbar already.. + $(':focus').blur(); // required to do not try to remove! padeditor.ace.focus(); // Sends focus back }