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

Fix a couple css errors in menu/config sidebar

This commit is contained in:
Nick O'Leary 2019-05-20 22:03:05 +01:00
parent 5f5feaed5f
commit c63b8a4ebc
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 31 additions and 13 deletions

View File

@ -53,6 +53,9 @@ RED.sidebar.config = (function() {
} }
$('<span class="red-ui-sidebar-node-config-filter-info"></span>').appendTo(header); $('<span class="red-ui-sidebar-node-config-filter-info"></span>').appendTo(header);
category = $('<ul class="red-ui-palette-content red-ui-sidebar-node-config-list"></ul>').appendTo(container); category = $('<ul class="red-ui-palette-content red-ui-sidebar-node-config-list"></ul>').appendTo(container);
category.on("click", function(e) {
$(content).find(".red-ui-palette-node").removeClass("selected");
});
container.i18n(); container.i18n();
var icon = header.find("i"); var icon = header.find("i");
var result = { var result = {
@ -139,11 +142,12 @@ RED.sidebar.config = (function() {
currentType = node.type; currentType = node.type;
} }
var entry = $('<li class="red-ui-palette-node red-ui-palette-node-config red-ui-palette-node_id_'+node.id.replace(/\./g,"-")+'"></li>').appendTo(list); var entry = $('<li class="red-ui-palette-node_id_'+node.id.replace(/\./g,"-")+'"></li>').appendTo(list);
var nodeDiv = $('<div class="red-ui-palette-node-config red-ui-palette-node"></div>').appendTo(entry);
entry.data('node',node.id); entry.data('node',node.id);
$('<div class="red-ui-palette-label"></div>').text(label).appendTo(entry); $('<div class="red-ui-palette-label"></div>').text(label).appendTo(nodeDiv);
if (node._def.hasUsers !== false) { if (node._def.hasUsers !== false) {
var iconContainer = $('<div/>',{class:"red-ui-palette-icon-container red-ui-palette-icon-container-right"}).appendTo(entry); var iconContainer = $('<div/>',{class:"red-ui-palette-icon-container red-ui-palette-icon-container-right"}).appendTo(nodeDiv);
if (node.users.length === 0) { if (node.users.length === 0) {
iconContainer.text(0); iconContainer.text(0);
} else { } else {
@ -155,10 +159,11 @@ RED.sidebar.config = (function() {
} }
RED.popover.tooltip(iconContainer,RED._('editor.nodesUse',{count:node.users.length})); RED.popover.tooltip(iconContainer,RED._('editor.nodesUse',{count:node.users.length}));
if (node.users.length === 0) { if (node.users.length === 0) {
entry.addClass("red-ui-palette-node-config-unused"); nodeDiv.addClass("red-ui-palette-node-config-unused");
} }
} }
entry.on('click',function(e) { nodeDiv.on('click',function(e) {
e.stopPropagation();
RED.view.select(false); RED.view.select(false);
if (e.metaKey) { if (e.metaKey) {
$(this).toggleClass("selected"); $(this).toggleClass("selected");
@ -168,11 +173,12 @@ RED.sidebar.config = (function() {
} }
RED.sidebar.info.refresh(node); RED.sidebar.info.refresh(node);
}); });
entry.on('dblclick',function(e) { nodeDiv.on('dblclick',function(e) {
e.stopPropagation();
RED.editor.editConfig("", node.type, node.id); RED.editor.editConfig("", node.type, node.id);
}); });
var userArray = node.users.map(function(n) { return n.id }); var userArray = node.users.map(function(n) { return n.id });
entry.on('mouseover',function(e) { nodeDiv.on('mouseover',function(e) {
RED.nodes.eachNode(function(node) { RED.nodes.eachNode(function(node) {
if( userArray.indexOf(node.id) != -1) { if( userArray.indexOf(node.id) != -1) {
node.highlighted = true; node.highlighted = true;
@ -181,7 +187,7 @@ RED.sidebar.config = (function() {
}); });
RED.view.redraw(); RED.view.redraw();
}); });
entry.on('mouseout',function(e) { nodeDiv.on('mouseout',function(e) {
RED.nodes.eachNode(function(node) { RED.nodes.eachNode(function(node) {
if(node.highlighted) { if(node.highlighted) {
node.highlighted = false; node.highlighted = false;

View File

@ -223,9 +223,8 @@
> li:focus > a { > li:focus > a {
background: $header-menu-item-hover !important; background: $header-menu-item-hover !important;
} }
li.divider { li.red-ui-menu-divider {
background: $headerMenuItemDivider; background: $headerMenuItemDivider;
border-bottom-color: $header-menu-item-hover;
} }
li.disabled a { li.disabled a {
color: $header-menu-color-disabled; color: $header-menu-color-disabled;

View File

@ -22,15 +22,28 @@
@include disable-selection; @include disable-selection;
} }
.red-ui-sidebar-node-config-list { ul.red-ui-sidebar-node-config-list {
margin: 0; margin: 0;
padding: 0;
list-style-type: none; list-style-type: none;
li {
padding: 0;
margin: 0;
text-align: center;
}
.red-ui-palette-node { .red-ui-palette-node {
overflow: hidden; overflow: hidden;
&.selected { &.selected {
margin: 10px auto; margin: 4px auto;
border-color: $node-selected-color; border-color: $node-selected-color;
border-width: 2px; border-width: 2px;
&:first-child {
margin-top: 9px;
}
&:last-child {
margin-bottom: 9px;
}
} }
} }
.red-ui-palette-label { .red-ui-palette-label {
@ -68,7 +81,7 @@
color: $primary-text-color; color: $primary-text-color;
cursor: pointer; cursor: pointer;
} }
.red-ui-palette-node-config-type { ul.red-ui-sidebar-node-config-list li.red-ui-palette-node-config-type {
color: $secondary-text-color; color: $secondary-text-color;
text-align: right; text-align: right;
padding-right: 3px; padding-right: 3px;