mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Hide add-flow options when disabled via editorTheme
This commit is contained in:
		| @@ -183,25 +183,29 @@ RED.workspaces = (function() { | ||||
|             }, | ||||
|             null) | ||||
|         } | ||||
|         menuItems.push( | ||||
|             { | ||||
|                 id:"red-ui-tabs-menu-option-add-flow", | ||||
|                 label: RED._("workspace.addFlow"), | ||||
|                 onselect: "core:add-flow" | ||||
|             } | ||||
|         ) | ||||
|         if (isMenuButton || !!tab) { | ||||
|         if (RED.settings.theme("menu.menu-item-workspace-add", true)) { | ||||
|             menuItems.push( | ||||
|                 { | ||||
|                     id:"red-ui-tabs-menu-option-add-flow-right", | ||||
|                     label: RED._("workspace.addFlowToRight"), | ||||
|                     shortcut: RED.keyboard.getShortcut("core:add-flow-to-right"), | ||||
|                     onselect: function() { | ||||
|                         RED.actions.invoke("core:add-flow-to-right", tab) | ||||
|                     } | ||||
|                 }, | ||||
|                 null | ||||
|                     id:"red-ui-tabs-menu-option-add-flow", | ||||
|                     label: RED._("workspace.addFlow"), | ||||
|                     onselect: "core:add-flow" | ||||
|                 } | ||||
|             ) | ||||
|         } | ||||
|         if (isMenuButton || !!tab) { | ||||
|             if (RED.settings.theme("menu.menu-item-workspace-add", true)) { | ||||
|                 menuItems.push( | ||||
|                     { | ||||
|                         id:"red-ui-tabs-menu-option-add-flow-right", | ||||
|                         label: RED._("workspace.addFlowToRight"), | ||||
|                         shortcut: RED.keyboard.getShortcut("core:add-flow-to-right"), | ||||
|                         onselect: function() { | ||||
|                             RED.actions.invoke("core:add-flow-to-right", tab) | ||||
|                         } | ||||
|                     }, | ||||
|                     null | ||||
|                 ) | ||||
|             } | ||||
|             if (activeWorkspace && activeWorkspace.type === 'tab') { | ||||
|                 menuItems.push( | ||||
|                     isFlowDisabled ? { | ||||
| @@ -255,7 +259,9 @@ RED.workspaces = (function() { | ||||
|                 } | ||||
|             ) | ||||
|         } | ||||
|         menuItems.push(null) | ||||
|         if (menuItems.length > 0) { | ||||
|             menuItems.push(null) | ||||
|         } | ||||
|         if (isMenuButton || !!tab) { | ||||
|             menuItems.push( | ||||
|                 { | ||||
| @@ -299,19 +305,24 @@ RED.workspaces = (function() { | ||||
|             } | ||||
|         ) | ||||
|         if (tab) { | ||||
|             menuItems.push(null) | ||||
|  | ||||
|             if (RED.settings.theme("menu.menu-item-workspace-delete", true)) { | ||||
|                 menuItems.push( | ||||
|                     { | ||||
|                         label: RED._("common.label.delete"), | ||||
|                         onselect: function() { | ||||
|                             if (tab.type === 'tab') { | ||||
|                                 RED.workspaces.delete(tab) | ||||
|                             } else if (tab.type === 'subflow') { | ||||
|                                 RED.subflow.delete(tab.id) | ||||
|                             } | ||||
|                         }, | ||||
|                         disabled: isCurrentLocked || (workspaceTabCount === 1) | ||||
|                     } | ||||
|                 ) | ||||
|             } | ||||
|             menuItems.push( | ||||
|                 null, | ||||
|                 { | ||||
|                     label: RED._("common.label.delete"), | ||||
|                     onselect: function() { | ||||
|                         if (tab.type === 'tab') { | ||||
|                             RED.workspaces.delete(tab) | ||||
|                         } else if (tab.type === 'subflow') { | ||||
|                             RED.subflow.delete(tab.id) | ||||
|                         } | ||||
|                     }, | ||||
|                     disabled: isCurrentLocked || (workspaceTabCount === 1) | ||||
|                 }, | ||||
|                 { | ||||
|                     label: RED._("menu.label.export"), | ||||
|                     shortcut: RED.keyboard.getShortcut("core:show-export-dialog"), | ||||
| @@ -469,6 +480,7 @@ RED.workspaces = (function() { | ||||
|             minimumActiveTabWidth: 150, | ||||
|             scrollable: true, | ||||
|             addButton: "core:add-flow", | ||||
|             addButton: RED.settings.theme("menu.menu-item-workspace-add", true) ? "core:add-flow" : undefined, | ||||
|             addButtonCaption: RED._("workspace.addFlow"), | ||||
|             menu: function() { return getMenuItems(true) }, | ||||
|             contextmenu: function(tab) { return getMenuItems(false, tab) } | ||||
| @@ -525,19 +537,24 @@ RED.workspaces = (function() { | ||||
|         $(window).on("resize", function() { | ||||
|             workspace_tabs.resize(); | ||||
|         }); | ||||
|  | ||||
|         RED.actions.add("core:add-flow",function(opts) { addWorkspace(undefined,undefined,opts?opts.index:undefined)}); | ||||
|         RED.actions.add("core:add-flow-to-right",function(workspace) { | ||||
|             let index | ||||
|             if (workspace) { | ||||
|                 index = workspace_tabs.getTabIndex(workspace.id)+1 | ||||
|             } else { | ||||
|                 index = workspace_tabs.activeIndex()+1 | ||||
|             } | ||||
|             addWorkspace(undefined,undefined,index) | ||||
|         }); | ||||
|         RED.actions.add("core:edit-flow",editWorkspace); | ||||
|         RED.actions.add("core:remove-flow",removeWorkspace); | ||||
|         if (RED.settings.theme("menu.menu-item-workspace-add", true)) { | ||||
|             RED.actions.add("core:add-flow",function(opts) { addWorkspace(undefined,undefined,opts?opts.index:undefined)}); | ||||
|             RED.actions.add("core:add-flow-to-right",function(workspace) { | ||||
|                 let index | ||||
|                 if (workspace) { | ||||
|                     index = workspace_tabs.getTabIndex(workspace.id)+1 | ||||
|                 } else { | ||||
|                     index = workspace_tabs.activeIndex()+1 | ||||
|                 } | ||||
|                 addWorkspace(undefined,undefined,index) | ||||
|             }); | ||||
|         } | ||||
|         if (RED.settings.theme("menu.menu-item-workspace-edit", true)) { | ||||
|             RED.actions.add("core:edit-flow",editWorkspace); | ||||
|         } | ||||
|         if (RED.settings.theme("menu.menu-item-workspace-delete", true)) { | ||||
|             RED.actions.add("core:remove-flow",removeWorkspace); | ||||
|         } | ||||
|         RED.actions.add("core:enable-flow",enableWorkspace); | ||||
|         RED.actions.add("core:disable-flow",disableWorkspace); | ||||
|         RED.actions.add("core:lock-flow",lockWorkspace); | ||||
|   | ||||
| @@ -151,8 +151,9 @@ | ||||
|     &.red-ui-tabs-add { | ||||
|         padding-right: 29px; | ||||
|     } | ||||
|     &.red-ui-tabs-add.red-ui-tabs-scrollable { | ||||
|         padding-right: 53px; | ||||
|     &.red-ui-tabs-add.red-ui-tabs-scrollable, | ||||
|     &.red-ui-tabs-menu.red-ui-tabs-scrollable { | ||||
|             padding-right: 53px; | ||||
|     } | ||||
|     &.red-ui-tabs-add.red-ui-tabs-menu.red-ui-tabs-scrollable, | ||||
|     &.red-ui-tabs-add.red-ui-tabs-search.red-ui-tabs-scrollable { | ||||
| @@ -310,8 +311,9 @@ | ||||
|     } | ||||
|  | ||||
| } | ||||
| .red-ui-tabs.red-ui-tabs-add .red-ui-tab-scroll-right { | ||||
|     right: 32px; | ||||
| .red-ui-tabs.red-ui-tabs-add .red-ui-tab-scroll-right, | ||||
| .red-ui-tabs.red-ui-tabs-menu .red-ui-tab-scroll-right { | ||||
|         right: 32px; | ||||
| } | ||||
|  | ||||
| .red-ui-tabs.red-ui-tabs-add.red-ui-tabs-menu .red-ui-tab-scroll-right, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user