From 64722da4a78d47c48687b80bfaac9b85b5f96514 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sun, 29 May 2016 22:31:29 +0100 Subject: [PATCH] Make sidebars disabled-on-edit by default --- editor/js/ui/sidebar.js | 18 ++++++++++++------ editor/js/ui/tab-config.js | 11 +---------- editor/js/ui/tab-info.js | 3 ++- editor/js/ui/tray.js | 6 +++--- editor/sass/sidebar.scss | 9 +++++++++ editor/sass/tab-config.scss | 11 +---------- nodes/core/core/58-debug.html | 3 ++- 7 files changed, 30 insertions(+), 31 deletions(-) diff --git a/editor/js/ui/sidebar.js b/editor/js/ui/sidebar.js index 2c1cb259c..9a3e75dae 100644 --- a/editor/js/ui/sidebar.js +++ b/editor/js/ui/sidebar.js @@ -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 = $('
',{style:"height:100%"}).appendTo("#sidebar-content") + options.wrapper.append(options.content); + options.wrapper.hide(); + if (!options.enableOnEdit) { + options.shade = $('
',{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); } diff --git a/editor/js/ui/tab-config.js b/editor/js/ui/tab-config.js index 20fafbf03..c22bde1f4 100644 --- a/editor/js/ui/tab-config.js +++ b/editor/js/ui/tab-config.js @@ -35,9 +35,6 @@ RED.sidebar.config = (function() { var flowCategories = $("
").appendTo(content); var subflowCategories = $("
").appendTo(content); - - var shade = $('').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 } })(); diff --git a/editor/js/ui/tab-info.js b/editor/js/ui/tab-info.js index ddee4e26f..52f8ec8eb 100644 --- a/editor/js/ui/tab-info.js +++ b/editor/js/ui/tab-info.js @@ -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 }); } diff --git a/editor/js/ui/tray.js b/editor/js/ui/tray.js index a826067ab..47c8bb0f8 100644 --- a/editor/js/ui/tray.js +++ b/editor/js/ui/tray.js @@ -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(); } } } diff --git a/editor/sass/sidebar.scss b/editor/sass/sidebar.scss index da11d8ba1..0f782e773 100644 --- a/editor/sass/sidebar.scss +++ b/editor/sass/sidebar.scss @@ -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; +} diff --git a/editor/sass/tab-config.scss b/editor/sass/tab-config.scss index 7430c04f4..a38390f86 100644 --- a/editor/sass/tab-config.scss +++ b/editor/sass/tab-config.scss @@ -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; diff --git a/nodes/core/core/58-debug.html b/nodes/core/core/58-debug.html index b496254f8..61d94123e 100644 --- a/nodes/core/core/58-debug.html +++ b/nodes/core/core/58-debug.html @@ -143,7 +143,8 @@ id: "debug", label: this._("debug.sidebar.label"), name: this._("debug.sidebar.name"), - content: content + content: content, + enableOnEdit: true }); function getTimestamp() {