From 1c0e794f877314ef8494f4f81a521127a2e7bc5c Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 26 Jul 2017 07:46:22 -0700 Subject: [PATCH] Ensure tabs get their definition object properly attached --- editor/js/nodes.js | 20 +++++++++++--------- editor/js/ui/workspaces.js | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/editor/js/nodes.js b/editor/js/nodes.js index d83f162eb..2cd2f62fc 100644 --- a/editor/js/nodes.js +++ b/editor/js/nodes.js @@ -41,6 +41,15 @@ RED.nodes = (function() { var typeToId = {}; var nodeDefinitions = {}; + nodeDefinitions['tab'] = { + defaults: { + label: {value:""}, + disabled: {value: false}, + info: {value: ""} + } + }; + + var exports = { setModulePendingUpdated: function(module,version) { moduleList[module].pending_version = version; @@ -274,14 +283,7 @@ RED.nodes = (function() { function addWorkspace(ws) { workspaces[ws.id] = ws; - ws._def = { - defaults: { - label: {value:""}, - disabled: {value: false}, - info: {value: ""} - } - }; - + ws._def = RED.nodes.getType('tab'); workspacesOrder.push(ws.id); } function getWorkspace(id) { @@ -817,7 +819,7 @@ RED.nodes = (function() { // Add a tab if there isn't one there already if (defaultWorkspace == null) { - defaultWorkspace = { type:"tab", id:getID(), label:RED._('workspace.defaultName',{number:1})}; + defaultWorkspace = { type:"tab", id:getID(), disabled: false, info:"", label:RED._('workspace.defaultName',{number:1})}; addWorkspace(defaultWorkspace); RED.workspaces.add(defaultWorkspace); new_workspaces.push(defaultWorkspace); diff --git a/editor/js/ui/workspaces.js b/editor/js/ui/workspaces.js index 3c08e83f5..3d880e2a2 100644 --- a/editor/js/ui/workspaces.js +++ b/editor/js/ui/workspaces.js @@ -30,7 +30,7 @@ RED.workspaces = (function() { workspaceIndex += 1; } while ($("#workspace-tabs a[title='"+RED._('workspace.defaultName',{number:workspaceIndex})+"']").size() !== 0); - ws = {type:"tab",id:tabId,label:RED._('workspace.defaultName',{number:workspaceIndex})}; + ws = {type:"tab",id:tabId,disabled: false,info:"",label:RED._('workspace.defaultName',{number:workspaceIndex})}; RED.nodes.addWorkspace(ws); workspace_tabs.addTab(ws); workspace_tabs.activateTab(tabId);