From d3be85173b5b902ad38ad4ab6765e1b336f1664f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 4 Jan 2021 16:18:06 +0100 Subject: [PATCH] to book button implemented --- .../UI/Spaces/Docs-Space/DocsSpace.js | 89 +++++++++---------- .../Superalgos/UI/Spaces/Docs-Space/Footer.js | 3 + .../UI/Spaces/Docs-Space/MainSearchPage.js | 1 + 3 files changed, 48 insertions(+), 45 deletions(-) diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js index 7956e897b..088e66322 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js @@ -11,16 +11,17 @@ function newSuperalgosDocSpace() { documentPage: undefined, commandInterface: undefined, contextMenu: undefined, - language: undefined, + language: undefined, menuLabelsMap: undefined, - currentDocumentBeingRendered: undefined, - previousDocumentBeingRendered: undefined, + currentDocumentBeingRendered: undefined, + previousDocumentBeingRendered: undefined, + currentBookBeingRendered: undefined, paragraphMap: undefined, // Here we will store a map of paragraphs from the Docs Node, Concept, Topics or Books Schema in order to find it when we need to update them. textArea: undefined, - setUpWorkspaceSchemas: setUpWorkspaceSchemas, + setUpWorkspaceSchemas: setUpWorkspaceSchemas, changeLanguage: changeLanguage, - enterEditMode: enterEditMode, - exitEditMode: exitEditMode, + enterEditMode: enterEditMode, + exitEditMode: exitEditMode, openSpaceAreaAndNavigateTo: openSpaceAreaAndNavigateTo, navigateTo: navigateTo, scrollToElement: scrollToElement, @@ -47,7 +48,7 @@ function newSuperalgosDocSpace() { let browserResizedEventSubscriptionId let openingEventSubscriptionId let closingEventSubscriptionId - + return thisObject function initialize() { @@ -70,7 +71,7 @@ function newSuperalgosDocSpace() { thisObject.searchResultsPage.initialize() thisObject.documentPage.initialize() thisObject.footer.initialize() - thisObject.commandInterface.initialize() + thisObject.commandInterface.initialize() thisObject.contextMenu.initialize() isInitialized = true @@ -133,13 +134,13 @@ function newSuperalgosDocSpace() { thisObject.footer.finalize() thisObject.commandInterface.finalize() thisObject.contextMenu.finalize() - + thisObject.searchEngine = undefined thisObject.mainSearchPage = undefined thisObject.searchResultsPage = undefined thisObject.documentPage = undefined thisObject.footer = undefined - thisObject.commandInterface = undefined + thisObject.commandInterface = undefined thisObject.contextMenu = undefined thisObject.currentDocumentBeingRendered = undefined @@ -281,23 +282,7 @@ function newSuperalgosDocSpace() { function openSpaceAreaAndNavigateTo(project, category, type, anchor, nodeId) { - if (UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered !== undefined) { - UI.projects.superalgos.spaces.docsSpace.previousDocumentBeingRendered = { - project: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project, - category: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category, - type: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type, - anchor: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.anchor, - nodeId: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.nodeId - } - } - - UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered = { - project: project, - category: category, - type: type.replace('AMPERSAND', '\''), - anchor: anchor, - nodeId: nodeId - } + getReadyToNavigate(project, category, type, anchor, nodeId) thisObject.sidePanelTab.open() } @@ -307,24 +292,7 @@ function newSuperalgosDocSpace() { EDITOR_ON_FOCUS = false // forced exit UI.projects.superalgos.spaces.docsSpace.paragraphMap = new Map() - /* Replace the current object with this */ - if (UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered !== undefined) { - UI.projects.superalgos.spaces.docsSpace.previousDocumentBeingRendered = { - project: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project, - category: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category, - type: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type, - anchor: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.anchor, - nodeId: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.nodeId - } - } - - UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered = { - project: project, - category: category, - type: type.replace('AMPERSAND', '\''), - anchor: anchor, - nodeId: nodeId - } + getReadyToNavigate(project, category, type, anchor, nodeId) UI.projects.superalgos.spaces.docsSpace.documentPage.render() @@ -339,6 +307,37 @@ function newSuperalgosDocSpace() { } } + function getReadyToNavigate(project, category, type, anchor, nodeId) { + /* Replace the current object with this */ + if (UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered !== undefined) { + UI.projects.superalgos.spaces.docsSpace.previousDocumentBeingRendered = { + project: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project, + category: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category, + type: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type, + anchor: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.anchor, + nodeId: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.nodeId + } + } + + if (category === 'Book') { + UI.projects.superalgos.spaces.docsSpace.currentBookBeingRendered = { + project: project, + category: category, + type: type.replace('AMPERSAND', '\''), + anchor: anchor, + nodeId: nodeId + } + } + + UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered = { + project: project, + category: category, + type: type.replace('AMPERSAND', '\''), + anchor: anchor, + nodeId: nodeId + } + } + function resize() { thisObject.container.frame.width = UI.projects.superalgos.globals.docs.DOCS_SPACE_WIDTH thisObject.container.frame.height = browserCanvas.height // - TOP_SPACE_HEIGHT diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/Footer.js b/Projects/Superalgos/UI/Spaces/Docs-Space/Footer.js index c4aba254f..da679058e 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/Footer.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/Footer.js @@ -33,6 +33,9 @@ function newSuperalgosDocsFooter() { if (UI.projects.superalgos.spaces.docsSpace.previousDocumentBeingRendered !== undefined ) { HTML = HTML + '' } + if (UI.projects.superalgos.spaces.docsSpace.currentBookBeingRendered !== undefined ) { + HTML = HTML + '' + } HTML = HTML + '' HTML = HTML + '' HTML = HTML + '' diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/MainSearchPage.js b/Projects/Superalgos/UI/Spaces/Docs-Space/MainSearchPage.js index 20e77a36f..7361caa12 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/MainSearchPage.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/MainSearchPage.js @@ -51,6 +51,7 @@ function newSuperalgosDocsMainSearchPage() { } element.addEventListener("keyup", function (event) { if (event.key === "Enter" || event.keyCode === 13) { + UI.projects.superalgos.spaces.docsSpace.currentBookBeingRendered = undefined UI.projects.superalgos.spaces.docsSpace.contextMenu.forceOutClick() UI.projects.superalgos.spaces.docsSpace.commandInterface.command = element.value UI.projects.superalgos.spaces.docsSpace.commandInterface.detectCommands()