From fabf01371437dc4af09293820036ab222f25bda8 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 2 Mar 2015 22:55:34 +0000 Subject: [PATCH] Allow the main view hold keyboard focus --- public/red/ui/palette.js | 4 +++- public/red/ui/sidebar.js | 31 ++++++++++++++++++++++++++----- public/red/ui/view.js | 23 ++++++++++++++++++----- public/style.css | 4 +++- 4 files changed, 50 insertions(+), 12 deletions(-) diff --git a/public/red/ui/palette.js b/public/red/ui/palette.js index 3efc44824..42bf04af9 100644 --- a/public/red/ui/palette.js +++ b/public/red/ui/palette.js @@ -169,6 +169,7 @@ RED.palette = (function() { container:'body' }); $(d).click(function() { + RED.view.focus(); var help = '
'+($("script[data-help-name|='"+d.type+"']").html()||"")+"
"; $("#tab-info").html(help); }); @@ -176,7 +177,8 @@ RED.palette = (function() { helper: 'clone', appendTo: 'body', revert: true, - revertDuration: 50 + revertDuration: 50, + start: function() {RED.view.focus();} }); setLabel(nt,$(d),label); diff --git a/public/red/ui/sidebar.js b/public/red/ui/sidebar.js index 5e4bfb091..dda7f8d45 100644 --- a/public/red/ui/sidebar.js +++ b/public/red/ui/sidebar.js @@ -1,5 +1,5 @@ /** - * Copyright 2013 IBM Corp. + * Copyright 2013, 2015 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,9 +60,8 @@ RED.sidebar = (function() { $("#sidebar").width(0); RED.menu.setSelected("btn-sidebar",true); RED.view.resize(); + eventHandler.emit("resize"); } - - sidebarSeparator.width = $("#sidebar").width(); }, drag: function(event,ui) { @@ -102,7 +101,7 @@ RED.sidebar = (function() { sidebar_tabs.resize(); RED.view.resize(); - + eventHandler.emit("resize"); }, stop:function(event,ui) { RED.view.resize(); @@ -117,6 +116,7 @@ RED.sidebar = (function() { } $("#sidebar-separator").css("left","auto"); $("#sidebar-separator").css("right",($("#sidebar").width()+13)+"px"); + eventHandler.emit("resize"); } }); @@ -127,6 +127,7 @@ RED.sidebar = (function() { $("#main-container").removeClass("sidebar-closed"); sidebar_tabs.resize(); } + eventHandler.emit("resize"); } function showSidebar(id) { @@ -145,13 +146,33 @@ RED.sidebar = (function() { RED.sidebar.info.show(); } + var eventHandler = (function() { + var handlers = {}; + + return { + on: function(evt,func) { + handlers[evt] = handlers[evt]||[]; + handlers[evt].push(func); + }, + emit: function(evt,arg) { + if (handlers[evt]) { + for (var i=0;i #btn-deploy.disabled + a { left:0px; right:0px; } - +#chart svg:focus { + outline: none; +} #workspace-toolbar { display: none; position: absolute;