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) {
tab.onchange.call(tab);
}
$(tab.content).show();
$(tab.wrapper).show();
if (tab.toolbar) {
$(tab.toolbar).show();
}
},
onremove: function(tab) {
$(tab.content).hide();
$(tab.wrapper).hide();
if (tab.onremove) {
tab.onremove.call(tab);
}
@ -58,15 +58,18 @@ RED.sidebar = (function() {
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) {
$("#sidebar-footer").append(options.toolbar);
$(options.toolbar).hide();
}
$(options.content).hide();
var id = options.id;
RED.menu.addItem("menu-item-view-menu",{
@ -87,7 +90,10 @@ RED.sidebar = (function() {
function 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];
RED.menu.removeItem("menu-item-view-menu-"+id);
}

View File

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

View File

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

View File

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

View File

@ -95,3 +95,12 @@
.sidebar-header-button:not(:first-child) {
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");
* you may not use this file except in compliance with the License.
@ -21,15 +21,6 @@
overflow-y:auto;
@include disable-selection;
}
.sidebar-node-config-shade {
position: absolute;
top:0;
bottom:0;
left:0;
right:0;
background: $shade-color;
}
.config-node-list {
margin: 0;

View File

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