diff --git a/Canvas.js b/Canvas.js index 5d41e1bc4..fc63decf1 100644 --- a/Canvas.js +++ b/Canvas.js @@ -261,7 +261,7 @@ function newCanvas () { if (event.keyCode >= 65 && event.keyCode <= 90) { let nodeUsingThisKey = canvas.strategySpace.workspace.getNodeByShortcutKey(event.key) - if (nodeOnFocus === undefined) { + if (nodeOnFocus === undefined && nodeUsingThisKey !== undefined) { /* Then we displace the whole workspace to center it at the node using this key */ nodeUsingThisKey = canvas.floatingSpace.positionAtNode(nodeUsingThisKey) return @@ -271,7 +271,7 @@ function newCanvas () { event.preventDefault() /* If there is a node in focus, we try to assign the key to it. */ - if (nodeUsingThisKey !== undefined) { + if (nodeUsingThisKey !== undefined && nodeOnFocus !== undefined) { if (nodeUsingThisKey.id === nodeOnFocus.id) { nodeOnFocus.payload.uiObject.shortcutKey = '' nodeOnFocus.payload.uiObject.setValue('Shortcut Key Removed ') @@ -281,9 +281,11 @@ function newCanvas () { return } } - - nodeOnFocus.payload.uiObject.shortcutKey = event.key - nodeOnFocus.payload.uiObject.setValue('Shortcut Key: Ctrl + ' + event.key) + /* If there is not node using this key and a node in focus, we assign this key to this node */ + if (nodeUsingThisKey === undefined && nodeOnFocus !== undefined) { + nodeOnFocus.payload.uiObject.shortcutKey = event.key + nodeOnFocus.payload.uiObject.setValue('Shortcut Key: Ctrl + ' + event.key) + } } return } diff --git a/StrategySpace/Workspace/FunctionLibraries/OnFocus.js b/StrategySpace/Workspace/FunctionLibraries/OnFocus.js index 584414cb8..add0f0f78 100644 --- a/StrategySpace/Workspace/FunctionLibraries/OnFocus.js +++ b/StrategySpace/Workspace/FunctionLibraries/OnFocus.js @@ -456,8 +456,8 @@ function newOnFocus () { } case 'Social Bots': { let child - for (let m = 0; m < node.socialBots.length; m++) { - child = getNodeThatIsOnFocus(node.socialBots[m]) + for (let m = 0; m < node.bots.length; m++) { + child = getNodeThatIsOnFocus(node.bots[m]) if (child !== undefined) { return child } @@ -601,6 +601,10 @@ function newOnFocus () { if (child !== undefined) { return child } + child = getNodeThatIsOnFocus(node.socialBots) + if (child !== undefined) { + return child + } if (node.payload.uiObject.isOnFocus === true) { return node } else { @@ -618,6 +622,10 @@ function newOnFocus () { if (child !== undefined) { return child } + child = getNodeThatIsOnFocus(node.socialBots) + if (child !== undefined) { + return child + } if (node.payload.uiObject.isOnFocus === true) { return node } else { @@ -635,6 +643,10 @@ function newOnFocus () { if (child !== undefined) { return child } + child = getNodeThatIsOnFocus(node.socialBots) + if (child !== undefined) { + return child + } if (node.payload.uiObject.isOnFocus === true) { return node } else { @@ -652,6 +664,10 @@ function newOnFocus () { if (child !== undefined) { return child } + child = getNodeThatIsOnFocus(node.socialBots) + if (child !== undefined) { + return child + } if (node.payload.uiObject.isOnFocus === true) { return node } else { diff --git a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js index d72abbc07..1ec385fd4 100644 --- a/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/StringifyNode.js @@ -476,7 +476,7 @@ function newStringifyNode () { savedPayload: getSavedPayload(node) } - if (node.announcements !== undefined) { + if (node.bots !== undefined) { for (let m = 0; m < node.bots.length; m++) { let bot = prepareForStringify(node.bots[m], removePersonalData) object.bots.push(bot) diff --git a/StrategySpace/Workspace/Workspace.js b/StrategySpace/Workspace/Workspace.js index 7b8d5d05d..43b13aa87 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/StrategySpace/Workspace/Workspace.js @@ -48,7 +48,7 @@ function newWorkspace () { let functionLibraryNodeDeleter = newNodeDeleter() let functionLibraryPartsFromNodes = newPartsFromNodes() let functionLibraryProtocolNode = newProtocolNode() - let functionLibraryWorkspaceNodes = newStringifyNode() + let functionLibraryStringifyNodes = newStringifyNode() let functionLibraryTaskFunctions = newTaskFunctions() let functionLibrarySessionFunctions = newSessionFunctions() let functionLibraryShortcutKeys = newShortcutKeys() @@ -132,7 +132,7 @@ function newWorkspace () { let stringifyReadyNodes = [] for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] - let node = functionLibraryWorkspaceNodes.prepareForStringify(rootNode, removePersonalData) + let node = functionLibraryStringifyNodes.prepareForStringify(rootNode, removePersonalData) if (node) { stringifyReadyNodes.push(node) }