mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add configurable option for showing node label
This commit is contained in:
parent
0a98ba6985
commit
c66c5ea53c
@ -75,7 +75,8 @@
|
|||||||
"projects": "Projects",
|
"projects": "Projects",
|
||||||
"projects-new": "New",
|
"projects-new": "New",
|
||||||
"projects-open": "Open",
|
"projects-open": "Open",
|
||||||
"projects-settings": "Project Settings"
|
"projects-settings": "Project Settings",
|
||||||
|
"showNodeLabelDefault": "Show label of newly added nodes"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
|
@ -114,7 +114,8 @@ RED.userSettings = (function() {
|
|||||||
{
|
{
|
||||||
title: "menu.label.nodes",
|
title: "menu.label.nodes",
|
||||||
options: [
|
options: [
|
||||||
{setting:"view-node-status",oldSetting:"menu-menu-item-status",label:"menu.label.displayStatus",default: true, toggle:true,onchange:"core:toggle-status"}
|
{setting:"view-node-status",oldSetting:"menu-menu-item-status",label:"menu.label.displayStatus",default: true, toggle:true,onchange:"core:toggle-status"},
|
||||||
|
{setting:"view-node-show-label",label:"menu.label.showNodeLabelDefault",default: true, toggle:true}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -210,7 +211,6 @@ RED.userSettings = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
allSettings[opt.setting] = opt;
|
allSettings[opt.setting] = opt;
|
||||||
if (opt.onchange) {
|
|
||||||
var value = currentEditorSettings.view[opt.setting];
|
var value = currentEditorSettings.view[opt.setting];
|
||||||
if ((value === null || value === undefined) && opt.hasOwnProperty('default')) {
|
if ((value === null || value === undefined) && opt.hasOwnProperty('default')) {
|
||||||
value = opt.default;
|
value = opt.default;
|
||||||
@ -218,6 +218,7 @@ RED.userSettings = (function() {
|
|||||||
editorSettingsChanged = true;
|
editorSettingsChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opt.onchange) {
|
||||||
var callback = opt.onchange;
|
var callback = opt.onchange;
|
||||||
if (typeof callback === 'string') {
|
if (typeof callback === 'string') {
|
||||||
callback = RED.actions.get(callback);
|
callback = RED.actions.get(callback);
|
||||||
|
@ -365,6 +365,11 @@ RED.view = (function() {
|
|||||||
var historyEvent = result.historyEvent;
|
var historyEvent = result.historyEvent;
|
||||||
var nn = result.node;
|
var nn = result.node;
|
||||||
|
|
||||||
|
var showLabel = RED.utils.getMessageProperty(RED.settings.get('editor'),"view.view-node-show-label");
|
||||||
|
if (showLabel !== undefined && !/^link (in|out)$/.test(nn._def.type) && !nn._def.defaults.hasOwnProperty("l")) {
|
||||||
|
nn.l = showLabel;
|
||||||
|
}
|
||||||
|
|
||||||
var helperOffset = d3.touches(ui.helper.get(0))[0]||d3.mouse(ui.helper.get(0));
|
var helperOffset = d3.touches(ui.helper.get(0))[0]||d3.mouse(ui.helper.get(0));
|
||||||
var mousePos = d3.touches(this)[0]||d3.mouse(this);
|
var mousePos = d3.touches(this)[0]||d3.mouse(this);
|
||||||
|
|
||||||
@ -668,6 +673,12 @@ RED.view = (function() {
|
|||||||
var historyEvent = result.historyEvent;
|
var historyEvent = result.historyEvent;
|
||||||
nn.x = point[0];
|
nn.x = point[0];
|
||||||
nn.y = point[1];
|
nn.y = point[1];
|
||||||
|
|
||||||
|
var showLabel = RED.utils.getMessageProperty(RED.settings.get('editor'),"view.view-node-show-label");
|
||||||
|
if (showLabel !== undefined && !/^link (in|out)$/.test(nn._def.type) && !nn._def.defaults.hasOwnProperty("l")) {
|
||||||
|
nn.l = showLabel;
|
||||||
|
}
|
||||||
|
|
||||||
if (mouse_mode === RED.state.QUICK_JOINING || quickAddLink) {
|
if (mouse_mode === RED.state.QUICK_JOINING || quickAddLink) {
|
||||||
if (quickAddLink || drag_lines.length > 0) {
|
if (quickAddLink || drag_lines.length > 0) {
|
||||||
var drag_line = quickAddLink||drag_lines[0];
|
var drag_line = quickAddLink||drag_lines[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user