1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Make sidebars disabled-on-edit by default

This commit is contained in:
Nick O'Leary 2016-05-29 22:31:29 +01:00
parent ada1e624d8
commit 64722da4a7
7 changed files with 30 additions and 31 deletions

View File

@ -24,13 +24,13 @@ RED.sidebar = (function() {
if (tab.onchange) { if (tab.onchange) {
tab.onchange.call(tab); tab.onchange.call(tab);
} }
$(tab.content).show(); $(tab.wrapper).show();
if (tab.toolbar) { if (tab.toolbar) {
$(tab.toolbar).show(); $(tab.toolbar).show();
} }
}, },
onremove: function(tab) { onremove: function(tab) {
$(tab.content).hide(); $(tab.wrapper).hide();
if (tab.onremove) { if (tab.onremove) {
tab.onremove.call(tab); tab.onremove.call(tab);
} }
@ -58,15 +58,18 @@ RED.sidebar = (function() {
options = title; options = title;
} }
options.wrapper = $('<div>',{style:"height:100%"}).appendTo("#sidebar-content")
options.wrapper.append(options.content);
options.wrapper.hide();
if (!options.enableOnEdit) {
options.shade = $('<div>',{class:"sidebar-shade hide"}).appendTo(options.wrapper);
}
$("#sidebar-content").append(options.content);
$(options.content).hide();
if (options.toolbar) { if (options.toolbar) {
$("#sidebar-footer").append(options.toolbar); $("#sidebar-footer").append(options.toolbar);
$(options.toolbar).hide(); $(options.toolbar).hide();
} }
$(options.content).hide();
var id = options.id; var id = options.id;
RED.menu.addItem("menu-item-view-menu",{ RED.menu.addItem("menu-item-view-menu",{
@ -87,7 +90,10 @@ RED.sidebar = (function() {
function removeTab(id) { function removeTab(id) {
sidebar_tabs.removeTab(id); sidebar_tabs.removeTab(id);
$(knownTabs[id].content).remove(); $(knownTabs[id].wrapper).remove();
if (knownTabs[id].footer) {
knownTabs[id].footer.remove();
}
delete knownTabs[id]; delete knownTabs[id];
RED.menu.removeItem("menu-item-view-menu-"+id); RED.menu.removeItem("menu-item-view-menu-"+id);
} }

View File

@ -35,9 +35,6 @@ RED.sidebar.config = (function() {
var flowCategories = $("<div>").appendTo(content); var flowCategories = $("<div>").appendTo(content);
var subflowCategories = $("<div>").appendTo(content); var subflowCategories = $("<div>").appendTo(content);
var shade = $('<div class="sidebar-node-config-shade hide"></div>').appendTo(content);
var showUnusedOnly = false; var showUnusedOnly = false;
var categories = {}; var categories = {};
@ -291,12 +288,6 @@ RED.sidebar.config = (function() {
return { return {
init:init, init:init,
show:show, show:show,
refresh:refreshConfigNodeList, refresh:refreshConfigNodeList
disable: function() {
shade.show();
},
enable: function() {
shade.hide();
}
} }
})(); })();

View File

@ -39,7 +39,8 @@ RED.sidebar.info = (function() {
id: "info", id: "info",
label: RED._("sidebar.info.label"), label: RED._("sidebar.info.label"),
name: RED._("sidebar.info.name"), name: RED._("sidebar.info.name"),
content: content content: content,
enableOnEdit: true
}); });
} }

View File

@ -99,7 +99,8 @@ RED.tray = (function() {
$("#header-shade").show(); $("#header-shade").show();
$("#editor-shade").show(); $("#editor-shade").show();
RED.sidebar.config.disable(); $(".sidebar-shade").show();
tray.preferredWidth = Math.max(el.width(),500); tray.preferredWidth = Math.max(el.width(),500);
body.css({"minWidth":tray.preferredWidth-40}); body.css({"minWidth":tray.preferredWidth-40});
@ -235,8 +236,7 @@ RED.tray = (function() {
if (stack.length === 0) { if (stack.length === 0) {
$("#header-shade").hide(); $("#header-shade").hide();
$("#editor-shade").hide(); $("#editor-shade").hide();
RED.sidebar.config.enable(); $(".sidebar-shade").hide();
} }
} }
} }

View File

@ -95,3 +95,12 @@
.sidebar-header-button:not(:first-child) { .sidebar-header-button:not(:first-child) {
border-left: none; border-left: none;
} }
.sidebar-shade {
position: absolute;
top:0;
bottom:0;
left:0;
right:0;
background: $shade-color;
}

View File

@ -1,5 +1,5 @@
/** /**
* Copyright 2015 IBM Corp. * Copyright 2015, 2016 IBM Corp.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -21,15 +21,6 @@
overflow-y:auto; overflow-y:auto;
@include disable-selection; @include disable-selection;
} }
.sidebar-node-config-shade {
position: absolute;
top:0;
bottom:0;
left:0;
right:0;
background: $shade-color;
}
.config-node-list { .config-node-list {
margin: 0; margin: 0;

View File

@ -143,7 +143,8 @@
id: "debug", id: "debug",
label: this._("debug.sidebar.label"), label: this._("debug.sidebar.label"),
name: this._("debug.sidebar.name"), name: this._("debug.sidebar.name"),
content: content content: content,
enableOnEdit: true
}); });
function getTimestamp() { function getTimestamp() {