mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Add configurable option for showing node label
This commit is contained in:
		| @@ -75,7 +75,8 @@ | ||||
|             "projects": "Projects", | ||||
|             "projects-new": "New", | ||||
|             "projects-open": "Open", | ||||
|             "projects-settings": "Project Settings" | ||||
|             "projects-settings": "Project Settings", | ||||
|             "showNodeLabelDefault": "Show label of newly added nodes" | ||||
|         } | ||||
|     }, | ||||
|     "actions": { | ||||
|   | ||||
| @@ -114,7 +114,8 @@ RED.userSettings = (function() { | ||||
|         { | ||||
|             title: "menu.label.nodes", | ||||
|             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,14 +211,14 @@ RED.userSettings = (function() { | ||||
|                     } | ||||
|                 } | ||||
|                 allSettings[opt.setting] = opt; | ||||
|                 if (opt.onchange) { | ||||
|                     var value = currentEditorSettings.view[opt.setting]; | ||||
|                     if ((value === null || value === undefined) && opt.hasOwnProperty('default')) { | ||||
|                         value = opt.default; | ||||
|                         currentEditorSettings.view[opt.setting] = value; | ||||
|                         editorSettingsChanged = true; | ||||
|                     } | ||||
|                 var value = currentEditorSettings.view[opt.setting]; | ||||
|                 if ((value === null || value === undefined) && opt.hasOwnProperty('default')) { | ||||
|                     value = opt.default; | ||||
|                     currentEditorSettings.view[opt.setting] = value; | ||||
|                     editorSettingsChanged = true; | ||||
|                 } | ||||
|  | ||||
|                 if (opt.onchange) { | ||||
|                     var callback = opt.onchange; | ||||
|                     if (typeof callback === 'string') { | ||||
|                         callback = RED.actions.get(callback); | ||||
|   | ||||
| @@ -365,6 +365,11 @@ RED.view = (function() { | ||||
|                 var historyEvent = result.historyEvent; | ||||
|                 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 mousePos = d3.touches(this)[0]||d3.mouse(this); | ||||
|  | ||||
| @@ -668,6 +673,12 @@ RED.view = (function() { | ||||
|                         var historyEvent = result.historyEvent; | ||||
|                         nn.x = point[0]; | ||||
|                         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 (quickAddLink || drag_lines.length > 0) { | ||||
|                                 var drag_line = quickAddLink||drag_lines[0]; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user