Add visual cue as to whether the workspace is focused

This commit is contained in:
Nick O'Leary 2017-01-24 16:14:03 +00:00
parent b10141d71f
commit 128c4fe222
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
4 changed files with 21 additions and 0 deletions

View File

@ -73,6 +73,9 @@ RED.tabs = (function() {
ul.children().addClass("red-ui-tab"); ul.children().addClass("red-ui-tab");
function onTabClick() { function onTabClick() {
if (options.onclick) {
options.onclick(tabs[$(this).attr('href').slice(1)]);
}
activateTab($(this)); activateTab($(this));
return false; return false;
} }

View File

@ -384,6 +384,12 @@ RED.view = (function() {
} }
} }
}); });
$("#chart").focus(function() {
$("#workspace-tabs").addClass("workspace-focussed")
});
$("#chart").blur(function() {
$("#workspace-tabs").removeClass("workspace-focussed")
});
RED.actions.add("core:copy-selection-to-internal-clipboard",copySelection); RED.actions.add("core:copy-selection-to-internal-clipboard",copySelection);
RED.actions.add("core:cut-selection-to-internal-clipboard",function(){copySelection();deleteSelection();}); RED.actions.add("core:cut-selection-to-internal-clipboard",function(){copySelection();deleteSelection();});

View File

@ -39,6 +39,7 @@ RED.workspaces = (function() {
RED.nodes.dirty(true); RED.nodes.dirty(true);
} }
} }
RED.view.focus();
return ws; return ws;
} }
function deleteWorkspace(ws) { function deleteWorkspace(ws) {
@ -139,6 +140,10 @@ RED.workspaces = (function() {
RED.events.emit("workspace:change",event); RED.events.emit("workspace:change",event);
window.location.hash = 'flow/'+tab.id; window.location.hash = 'flow/'+tab.id;
RED.sidebar.config.refresh(); RED.sidebar.config.refresh();
RED.view.focus();
},
onclick: function(tab) {
RED.view.focus();
}, },
ondblclick: function(tab) { ondblclick: function(tab) {
if (tab.type != "subflow") { if (tab.type != "subflow") {

View File

@ -51,3 +51,10 @@
#workspace-footer { #workspace-footer {
@include component-footer; @include component-footer;
} }
#workspace-tabs:not(.workspace-focussed) {
opacity:0.8;
li.red-ui-tab.active a {
color:#666;
}
}