From d21292600e0adab8ef62963bba0dcdf48aa1d937 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 8 Feb 2021 20:30:47 +0100 Subject: [PATCH] Bug Fixed, search engine never started. --- .../UI/Spaces/Docs-Space/SearchEngine.js | 34 +++++++++++-------- UI/Canvas.js | 2 ++ 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/SearchEngine.js b/Projects/Superalgos/UI/Spaces/Docs-Space/SearchEngine.js index f93b642f4..8cd634a6f 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/SearchEngine.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/SearchEngine.js @@ -18,16 +18,20 @@ function newSuperalgosDocsSearchEngine() { function setUpSearchEngine(callbackFunction) { + /* + This is a way to avoid indexing the docs, if the user does not want to. + */ let docsSpaceNode = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByType('Docs Space') - if (docsSpaceNode === undefined) { return } - if (docsSpaceNode.spaceSettings === undefined) { return } - let indexContent = UI.projects.superalgos.utilities.nodeConfig.loadPropertyFromNodeConfig(docsSpaceNode.spaceSettings.payload, 'indexContent') - - if (indexContent === false) { - callbackFunction() - return + if (docsSpaceNode !== undefined) { + if (docsSpaceNode.spaceSettings !== undefined) { + let indexContent = UI.projects.superalgos.utilities.nodeConfig.loadPropertyFromNodeConfig(docsSpaceNode.spaceSettings.payload, 'indexContent') + if (indexContent === false) { + callbackFunction() + return + } + } } - + let totalAsyncCallsMade = 0 let totalAsyncCallsFinished = 0 @@ -47,13 +51,13 @@ function newSuperalgosDocsSearchEngine() { totalAsyncCallsMade++ totalAsyncCallsMade++ - setTimeout(searchInNodes, 10) - setTimeout(searchInConcepts, 20) - setTimeout(searchInNTopics, 30) - setTimeout(searchInTutorials, 40) - setTimeout(searchInReviews, 50) - setTimeout(searchInBooks, 60) - setTimeout(searchInWorkspaces, 70) + setTimeout(searchInNodes, 10) + setTimeout(searchInConcepts, 20) + setTimeout(searchInNTopics, 30) + setTimeout(searchInTutorials, 40) + setTimeout(searchInReviews, 50) + setTimeout(searchInBooks, 60) + setTimeout(searchInWorkspaces, 70) function searchInNodes() { /* Search in Nodes */ diff --git a/UI/Canvas.js b/UI/Canvas.js index fe1f3ddc6..c153d8dfd 100644 --- a/UI/Canvas.js +++ b/UI/Canvas.js @@ -367,6 +367,8 @@ function newCanvas() { } async function onKeyDown(event) { + if (UI.projects.superalgos.spaces.designSpace.workspace === undefined) { return } + if (EDITOR_ON_FOCUS === true) { /* We will fordward the event to whoever is