From d0846589f1f87b3be03b937f6b75881085ed5949 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 31 Dec 2020 14:04:57 +0100 Subject: [PATCH] All pages moved outside the docs space --- Projects/Superalgos/UI/Globals/Docs.js | 3 + .../UI/Spaces/Docs-Space/CommandInterface.js | 10 +- .../UI/Spaces/Docs-Space/ContextMenu.js | 101 ++++++++--------- .../UI/Spaces/Docs-Space/DocsSpace.js | 69 ++++++------ .../UI/Spaces/Docs-Space/DocumentPage.js | 102 +++++++++--------- Projects/Superalgos/UI/Utilities/Docs.js | 2 +- 6 files changed, 144 insertions(+), 143 deletions(-) diff --git a/Projects/Superalgos/UI/Globals/Docs.js b/Projects/Superalgos/UI/Globals/Docs.js index 75f11d032..0fff2b481 100644 --- a/Projects/Superalgos/UI/Globals/Docs.js +++ b/Projects/Superalgos/UI/Globals/Docs.js @@ -1,5 +1,8 @@ function newSuperalgosGlobalsDocs() { thisObject = { + NEW_PARAGRAPH_TEXT: "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode.", + DEFAULT_LANGUAGE: 'EN', + DOCS_SPACE_WIDTH: 900 } return thisObject } \ No newline at end of file diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js b/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js index b903d0408..b9af08c88 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js @@ -97,7 +97,7 @@ function newSuperalgosDocsCommmandInterface() { } if (UI.projects.superalgos.spaces.docsSpace.commandInterface.command.indexOf('Docs.Add') !== 0 && UI.projects.superalgos.spaces.docsSpace.commandInterface.command.indexOf('docs.add') !== 0) { return 'Not Add Command' } - if (UI.projects.superalgos.spaces.docsSpace.language !== DEFAULT_LANGUAGE) { + if (UI.projects.superalgos.spaces.docsSpace.language !== UI.projects.superalgos.globals.docs.DEFAULT_LANGUAGE) { UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error Only In English', 'Anchor Only In English') return } @@ -162,7 +162,7 @@ function newSuperalgosDocsCommmandInterface() { } if (UI.projects.superalgos.spaces.docsSpace.commandInterface.command.indexOf('Docs.Delete') !== 0 && UI.projects.superalgos.spaces.docsSpace.commandInterface.command.indexOf('docs.delete') !== 0) { return 'Not Delete Command' } - if (UI.projects.superalgos.spaces.docsSpace.language !== DEFAULT_LANGUAGE) { + if (UI.projects.superalgos.spaces.docsSpace.language !== UI.projects.superalgos.globals.docs.DEFAULT_LANGUAGE) { UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'Docs Error Only In English', 'Anchor Only In English') return } @@ -285,7 +285,7 @@ function newSuperalgosDocsCommmandInterface() { paragraphs: [ { style: "Text", - text: newParagraphText + text: UI.projects.superalgos.globals.docs.NEW_PARAGRAPH_TEXT } ] } @@ -311,7 +311,7 @@ function newSuperalgosDocsCommmandInterface() { paragraphs: [ { style: "Text", - text: newParagraphText + text: UI.projects.superalgos.globals.docs.NEW_PARAGRAPH_TEXT } ] } @@ -340,7 +340,7 @@ function newSuperalgosDocsCommmandInterface() { paragraphs: [ { style: "Text", - text: newParagraphText + text: UI.projects.superalgos.globals.docs.NEW_PARAGRAPH_TEXT } ] } diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/ContextMenu.js b/Projects/Superalgos/UI/Spaces/Docs-Space/ContextMenu.js index 8be408977..0a6a78ec5 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/ContextMenu.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/ContextMenu.js @@ -1,5 +1,6 @@ function newSuperalgosDocsContextMenu() { let thisObject = { + selectedParagraph: undefined, getSelection: getSelection, forceOutClick: forceOutClick, initialize: initialize, @@ -9,7 +10,7 @@ function newSuperalgosDocsContextMenu() { let selectedParagraphData = '' let selectedParagraphIndex = '' let selectedParagraphHeight = 0 - + return thisObject function initialize() { @@ -55,7 +56,7 @@ function newSuperalgosDocsContextMenu() { showHTMLTextArea() function showHTMLTextArea() { - if (selectedParagraph === undefined) { return } + if (UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph === undefined) { return } /* When in editing mode, some type of paragraphs need to extend @@ -64,49 +65,49 @@ function newSuperalgosDocsContextMenu() { add an extra style class. */ let extraClassName = '' - if (selectedParagraph.id.indexOf('definition') >= 0) { + if (UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id.indexOf('definition') >= 0) { extraClassName = ' ' + '' } - if (selectedParagraph.id.indexOf('title') >= 0) { + if (UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id.indexOf('title') >= 0) { extraClassName = ' ' + 'docs-h3' } - if (selectedParagraph.id.indexOf('subtitle') >= 0) { + if (UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id.indexOf('subtitle') >= 0) { extraClassName = ' ' + 'docs-h4' } - if (selectedParagraph.id.indexOf('note') >= 0) { + if (UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id.indexOf('note') >= 0) { extraClassName = ' ' + 'docs-alert-note' } - if (selectedParagraph.id.indexOf('success') >= 0) { + if (UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id.indexOf('success') >= 0) { extraClassName = ' ' + 'docs-alert-success' } - if (selectedParagraph.id.indexOf('important') >= 0) { + if (UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id.indexOf('important') >= 0) { extraClassName = ' ' + 'docs-alert-important' } - if (selectedParagraph.id.indexOf('warning') >= 0) { + if (UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id.indexOf('warning') >= 0) { extraClassName = ' ' + 'docs-alert-warning' } - if (selectedParagraph.id.indexOf('error') >= 0) { + if (UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id.indexOf('error') >= 0) { extraClassName = ' ' + 'docs-alert-error' } - if (selectedParagraph.id.indexOf('javascript') >= 0) { + if (UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id.indexOf('javascript') >= 0) { extraClassName = ' ' + 'language-javascript' } - if (selectedParagraph.id.indexOf('json') >= 0) { + if (UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id.indexOf('json') >= 0) { extraClassName = ' ' + 'language-json' } - textArea = document.createElement('textarea'); - textArea.id = "textArea"; - textArea.spellcheck = false; - textArea.className = "docs-text-area" + extraClassName - textArea.style.height = selectedParagraphHeight - textArea.value = selectedParagraphData - selectedParagraph.innerHTML = "" - selectedParagraph.appendChild(textArea) - textArea.style.display = 'block' - textArea.focus() + UI.projects.superalgos.spaces.docsSpace.textArea = document.createElement('textarea'); + UI.projects.superalgos.spaces.docsSpace.textArea.id = "UI.projects.superalgos.spaces.docsSpace.textArea"; + UI.projects.superalgos.spaces.docsSpace.textArea.spellcheck = false; + UI.projects.superalgos.spaces.docsSpace.textArea.className = "docs-text-area" + extraClassName + UI.projects.superalgos.spaces.docsSpace.textArea.style.height = selectedParagraphHeight + UI.projects.superalgos.spaces.docsSpace.textArea.value = selectedParagraphData + UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.innerHTML = "" + UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.appendChild(UI.projects.superalgos.spaces.docsSpace.textArea) + UI.projects.superalgos.spaces.docsSpace.textArea.style.display = 'block' + UI.projects.superalgos.spaces.docsSpace.textArea.focus() forceOutClick() - enterEditMode() + UI.projects.superalgos.spaces.docsSpace.enterEditMode() } } @@ -119,176 +120,176 @@ function newSuperalgosDocsContextMenu() { } function toJavascript() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Javascript' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toJson() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Json' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toText() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Text' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toTitle() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Title' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toSubtitle() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Subtitle' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toNote() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Note' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toWarning() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Warning' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toError() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Error' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toImportant() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Important' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toSuccess() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Success' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toCallout() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Callout' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toSummary() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Summary' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toSection() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Section' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toList() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'List' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toTable() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Table' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toHierarchy() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Hierarchy' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toGif() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Gif' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toPng() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Png' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toAnchor() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Anchor' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toBlock() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Block' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toInclude() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Include' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toWebPageLink() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Link' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function toYouTubeVideo() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) docSchemaParagraph.style = 'Youtube' forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } function copyLink() { - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) let clipboard switch (docSchemaParagraph.style) { case 'Anchor': { - clipboard = "docs.goto " + objectBeingRendered.project + '->' + objectBeingRendered.category + '->' + objectBeingRendered.type + '->' + docSchemaParagraph.text + clipboard = "docs.goto " + UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project + '->' + UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.category + '->' + UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type + '->' + docSchemaParagraph.text break } case 'Block': { - clipboard = objectBeingRendered.project + '->' + objectBeingRendered.category + '->' + objectBeingRendered.type + '->' + docSchemaParagraph.text + clipboard = UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project + '->' + UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.category + '->' + UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type + '->' + docSchemaParagraph.text break } default: { @@ -336,7 +337,7 @@ function newSuperalgosDocsContextMenu() { /* Get the dimenssions of the current paragraph to help us to define the dimenssions of the text area. */ - selectedParagraph = paragraphNode + UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph = paragraphNode selectedParagraphHeight = paragraphNode.getClientRects()[0].height if (selectedParagraphHeight < 30) { selectedParagraphHeight = 30 } /* diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js index 9b57c91a7..057204f0d 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js @@ -13,7 +13,12 @@ function newSuperalgosDocSpace() { contextMenu: undefined, language: undefined, menuLabelsMap: undefined, + objectBeingRendered: undefined, + paragraphMap: undefined, // Here we will store a map of paragraphs from the Docs Node, Concept or Topics Schema in order to find it when we need to update them. + textArea: undefined, changeLanguage: changeLanguage, + enterEditMode: enterEditMode, + exitEditMode: exitEditMode, openSpaceAreaAndNavigateTo: openSpaceAreaAndNavigateTo, navigateTo: navigateTo, scrollToElement: scrollToElement, @@ -26,9 +31,6 @@ function newSuperalgosDocSpace() { } let isInitialized = false - const DEFAULT_LANGUAGE = 'EN' - const DOCS_SPACE_WIDTH = 900 - const newParagraphText = "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode." thisObject.container = newContainer() thisObject.container.name = MODULE_NAME @@ -43,14 +45,7 @@ function newSuperalgosDocSpace() { let browserResizedEventSubscriptionId let openingEventSubscriptionId let closingEventSubscriptionId - - let textArea - let selectedParagraph - let objectBeingRendered - let paragraphMap // Here we will store a map of paragraphs from the Docs Node, Concept or Topics Schema in order to find it when we need to update them. - let appSchemaDocument - let docsSchemaDocument - + return thisObject function initialize() { @@ -85,8 +80,8 @@ function newSuperalgosDocSpace() { if (window.localStorage.getItem('Docs Language') !== null && window.localStorage.getItem('Docs Language') !== undefined && window.localStorage.getItem('Docs Language') !== 'undefined') { UI.projects.superalgos.spaces.docsSpace.language = window.localStorage.getItem('Docs Language') } else { - window.localStorage.setItem('Docs Language', DEFAULT_LANGUAGE) - UI.projects.superalgos.spaces.docsSpace.language = DEFAULT_LANGUAGE + window.localStorage.setItem('Docs Language', UI.projects.superalgos.globals.docs.DEFAULT_LANGUAGE) + UI.projects.superalgos.spaces.docsSpace.language = UI.projects.superalgos.globals.docs.DEFAULT_LANGUAGE } } @@ -145,10 +140,8 @@ function newSuperalgosDocSpace() { thisObject.commandInterface = undefined thisObject.contextMenu = undefined - objectBeingRendered = undefined - paragraphMap = undefined - appSchemaDocument = undefined - docsSchemaDocument = undefined + thisObject.objectBeingRendered = undefined + thisObject.paragraphMap = undefined thisObject.menuLabelsMap = undefined isInitialized = false } @@ -173,7 +166,7 @@ function newSuperalgosDocSpace() { would like to close the editor. */ if (event.key === 'Escape') { - exitEditMode() + UI.projects.superalgos.spaces.docsSpace.exitEditMode() } } @@ -187,7 +180,7 @@ function newSuperalgosDocSpace() { function exitEditMode() { if (EDITOR_ON_FOCUS === true) { let editing - if (selectedParagraph.id.indexOf('definition') >= 0) { + if (UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id.indexOf('definition') >= 0) { editing = "Definition" } else { editing = "Paragraph" @@ -197,7 +190,7 @@ function newSuperalgosDocSpace() { /* In this case we are at a regular paragraph. */ - let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id) /* We will detect if the user has created new paragraphs while editing. For that we will inspect the value of the text area looking for a char @@ -205,19 +198,19 @@ function newSuperalgosDocSpace() { */ let paragraphs = [] let paragraph = '' - let splittedSelectedParagraph = selectedParagraph.id.split('-') + let splittedSelectedParagraph = UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id.split('-') let selectededitableParagraphIndex = Number(splittedSelectedParagraph[2]) let selectedParagraphStyle = splittedSelectedParagraph[3] let style = selectedParagraphStyle.charAt(0).toUpperCase() + selectedParagraphStyle.slice(1); - for (let i = 0; i < textArea.value.length; i++) { - if (textArea.value.charCodeAt(i) === 10 && style !== 'Javascript' && style !== 'Json' && style !== 'Table') { + for (let i = 0; i < UI.projects.superalgos.spaces.docsSpace.textArea.value.length; i++) { + if (UI.projects.superalgos.spaces.docsSpace.textArea.value.charCodeAt(i) === 10 && style !== 'Javascript' && style !== 'Json' && style !== 'Table') { if (paragraph !== '') { paragraphs.push(paragraph) } paragraph = '' } else { - paragraph = paragraph + textArea.value[i] + paragraph = paragraph + UI.projects.superalgos.spaces.docsSpace.textArea.value[i] } } paragraphs.push(paragraph) @@ -230,7 +223,7 @@ function newSuperalgosDocSpace() { /* Deleting paragarphs is only possible in the default language. */ - if (UI.projects.superalgos.spaces.docsSpace.language === DEFAULT_LANGUAGE) { + if (UI.projects.superalgos.spaces.docsSpace.language === UI.projects.superalgos.globals.docs.DEFAULT_LANGUAGE) { docsSchemaDocument.paragraphs.splice(selectededitableParagraphIndex, 1) if (docsSchemaDocument.paragraphs.length === 0) { let newParagraph = { @@ -245,7 +238,7 @@ function newSuperalgosDocSpace() { /* Adding paragarphs is only possible in the default language. */ - if (UI.projects.superalgos.spaces.docsSpace.language === DEFAULT_LANGUAGE) { + if (UI.projects.superalgos.spaces.docsSpace.language === UI.projects.superalgos.globals.docs.DEFAULT_LANGUAGE) { /* We will update the one paragraph we have and we will add the rest. */ @@ -267,8 +260,8 @@ function newSuperalgosDocSpace() { /* This means that the definition was being edited. */ - if (textArea.value !== '') { - UI.projects.superalgos.utilities.docs.setTextBasedOnLanguage(docsSchemaDocument.definition, textArea.value) + if (UI.projects.superalgos.spaces.docsSpace.textArea.value !== '') { + UI.projects.superalgos.utilities.docs.setTextBasedOnLanguage(docsSchemaDocument.definition, UI.projects.superalgos.spaces.docsSpace.textArea.value) } break } @@ -280,12 +273,12 @@ function newSuperalgosDocSpace() { function onOpening() { thisObject.isVisible = true - if (objectBeingRendered === undefined) { + if (UI.projects.superalgos.spaces.docsSpace.objectBeingRendered === undefined) { thisObject.mainSearchPage.render() UI.projects.superalgos.spaces.docsSpace.mainSearchPage.detectEnterOnSearchBox() UI.projects.superalgos.spaces.docsSpace.mainSearchPage.setFocusOnSearchBox() } else { - UI.projects.superalgos.spaces.docsSpace.navigateTo(objectBeingRendered.project, objectBeingRendered.category, objectBeingRendered.type) + UI.projects.superalgos.spaces.docsSpace.navigateTo(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.category, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) } } @@ -357,7 +350,7 @@ function newSuperalgosDocSpace() { } function onClosing() { - objectBeingRendered = undefined + UI.projects.superalgos.spaces.docsSpace.objectBeingRendered = undefined thisObject.isVisible = false } @@ -372,7 +365,7 @@ function newSuperalgosDocSpace() { function openSpaceAreaAndNavigateTo(project, category, type, anchor, nodeId) { - objectBeingRendered = { + UI.projects.superalgos.spaces.docsSpace.objectBeingRendered = { project: project, category: category, type: type.replace('AMPERSAND', '\''), @@ -386,10 +379,10 @@ function newSuperalgosDocSpace() { function navigateTo(project, category, type, anchor, nodeId) { EDITOR_ON_FOCUS = false // forced exit - paragraphMap = new Map() + UI.projects.superalgos.spaces.docsSpace.paragraphMap = new Map() /* Replace the current object with this */ - objectBeingRendered = { + UI.projects.superalgos.spaces.docsSpace.objectBeingRendered = { project: project, category: category, type: type.replace('AMPERSAND', '\''), @@ -402,16 +395,16 @@ function newSuperalgosDocSpace() { /* Here we will check if we need to position the page at a particular anchor or at the top. */ - if (objectBeingRendered.anchor !== undefined) { - scrollToElement('docs-anchor-' + objectBeingRendered.anchor.toLowerCase().replaceAll(' ', '-')) - objectBeingRendered.anchor = undefined + if (UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.anchor !== undefined) { + scrollToElement('docs-anchor-' + UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.anchor.toLowerCase().replaceAll(' ', '-')) + UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.anchor = undefined } else { scrollToElement('docs-space-div') } } function resize() { - thisObject.container.frame.width = DOCS_SPACE_WIDTH + thisObject.container.frame.width = UI.projects.superalgos.globals.docs.DOCS_SPACE_WIDTH thisObject.container.frame.height = browserCanvas.height // - TOP_SPACE_HEIGHT thisObject.container.frame.position.x = browserCanvas.width thisObject.container.frame.position.y = 0 // TOP_SPACE_HEIGHT diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/DocumentPage.js b/Projects/Superalgos/UI/Spaces/Docs-Space/DocumentPage.js index da44a6fde..ad649b46e 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/DocumentPage.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/DocumentPage.js @@ -5,6 +5,9 @@ function newSuperalgosDocsDocumentPage() { finalize: finalize } + let appSchemaDocument + let docsSchemaDocument + return thisObject function initialize() { @@ -12,12 +15,13 @@ function newSuperalgosDocsDocumentPage() { } function finalize() { - + appSchemaDocument = undefined + docsSchemaDocument = undefined } function render() { - appSchemaDocument = SCHEMAS_BY_PROJECT.get(objectBeingRendered.project).map.appSchema.get(objectBeingRendered.type) + appSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project).map.appSchema.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) disableCollapsibleContent() getSchemaDocument() @@ -27,21 +31,21 @@ function newSuperalgosDocsDocumentPage() { enableCollapsibleContent() function getSchemaDocument() { - switch (objectBeingRendered.category) { + switch (UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.category) { case 'Node': { - docsSchemaDocument = SCHEMAS_BY_PROJECT.get(objectBeingRendered.project).map.docsNodeSchema.get(objectBeingRendered.type) + docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project).map.docsNodeSchema.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) break } case 'Concept': { - docsSchemaDocument = SCHEMAS_BY_PROJECT.get(objectBeingRendered.project).map.docsConceptSchema.get(objectBeingRendered.type) + docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project).map.docsConceptSchema.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) break } case 'Topic': { - docsSchemaDocument = SCHEMAS_BY_PROJECT.get(objectBeingRendered.project).map.docsTopicSchema.get(objectBeingRendered.type) + docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project).map.docsTopicSchema.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) break } case 'Workspace': { - docsSchemaDocument = SCHEMAS_BY_PROJECT.get(objectBeingRendered.project).map.workspaceSchema.get(objectBeingRendered.nodeId) + docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project).map.workspaceSchema.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.nodeId) break } } @@ -49,8 +53,8 @@ function newSuperalgosDocsDocumentPage() { if (docsSchemaDocument === undefined) { // Use the New Node Template let template = { - type: objectBeingRendered.type, - definition: { text: "Write here the definition of this " + objectBeingRendered.category + "." }, + type: UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type, + definition: { text: "Write here the definition of this " + UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.category + "." }, paragraphs: [ { style: "Text", @@ -59,15 +63,15 @@ function newSuperalgosDocsDocumentPage() { ] } - switch (objectBeingRendered.category) { + switch (UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.category) { case 'Node': { - SCHEMAS_BY_PROJECT.get(objectBeingRendered.project).array.docsNodeSchema.push(template) - SCHEMAS_BY_PROJECT.get(objectBeingRendered.project).map.docsNodeSchema.set(objectBeingRendered.type, template) + SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project).array.docsNodeSchema.push(template) + SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project).map.docsNodeSchema.set(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type, template) break } case 'Concept': { - SCHEMAS_BY_PROJECT.get(objectBeingRendered.project).array.docsConceptSchema.push(template) - SCHEMAS_BY_PROJECT.get(objectBeingRendered.project).map.docsConceptSchema.set(objectBeingRendered.type, template) + SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project).array.docsConceptSchema.push(template) + SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project).map.docsConceptSchema.set(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type, template) break } } @@ -82,21 +86,21 @@ function newSuperalgosDocsDocumentPage() { if (docsSchemaDocument.paragraphs.length === 0) { let paragraph = { style: 'Text', - text: newParagraphText + text: UI.projects.superalgos.globals.docs.NEW_PARAGRAPH_TEXT } docsSchemaDocument.paragraphs.push(paragraph) } } async function repositionWorkspace() { - if (objectBeingRendered.category !== 'Workspace') { return } + if (UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.category !== 'Workspace') { return } let node = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeById(docsSchemaDocument.nodeId) node.payload.floatingObject.unCollapseParent() setTimeout(positionAtNode, 3000, node) setTimeout(positionAtNode, 5000, node) function positionAtNode(node) { - let xOffset = -DOCS_SPACE_WIDTH / 2 + let xOffset = -UI.projects.superalgos.globals.docs.DOCS_SPACE_WIDTH / 2 UI.projects.superalgos.spaces.floatingSpace.positionAtNode(node, xOffset) } } @@ -121,14 +125,14 @@ function newSuperalgosDocsDocumentPage() { titleLabel = docsSchemaDocument.type } - HTML = HTML + '

' + titleLabel + '

' + HTML = HTML + '

' + titleLabel + '

' - addDefinitionTable(docsSchemaDocument, 'definition-editable-', objectBeingRendered.category, objectBeingRendered.project, objectBeingRendered.type) + addDefinitionTable(docsSchemaDocument, 'definition-editable-', UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.category, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) let editableParagraphIndex = 0 let autoGeneratedParagraphIndex = 0 - if (objectBeingRendered.category === 'Topic') { + if (UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.category === 'Topic') { generateMultiPageIndex() } @@ -162,7 +166,7 @@ function newSuperalgosDocsDocumentPage() { let testElement = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndType(project, type) if ((category === 'Topic' || category === 'Concept') && testElement === undefined) { - HTML = HTML + '
Summary: ' + UI.projects.superalgos.utilities.docs.addToolTips(definitionText, objectBeingRendered.type) + '
' + HTML = HTML + '
Summary: ' + UI.projects.superalgos.utilities.docs.addToolTips(definitionText, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) + '
' } else { HTML = HTML + '
' @@ -175,7 +179,7 @@ function newSuperalgosDocsDocumentPage() { definitionImagesArray.push(imageItem) HTML = HTML + '
' - HTML = HTML + '
' + UI.projects.superalgos.utilities.docs.addToolTips(definitionText, objectBeingRendered.type) + '
' + HTML = HTML + '
' + UI.projects.superalgos.utilities.docs.addToolTips(definitionText, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) + '
' HTML = HTML + '
' } } @@ -196,7 +200,7 @@ function newSuperalgosDocsDocumentPage() { autoGeneratedParagraphIndex++ let orderedIndexArray = [] - let schemaArray = SCHEMAS_BY_PROJECT.get(objectBeingRendered.project).array.docsTopicSchema + let schemaArray = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project).array.docsTopicSchema for (let i = 0; i < schemaArray.length; i++) { let arrayItem = schemaArray[i] @@ -231,7 +235,7 @@ function newSuperalgosDocsDocumentPage() { text: "" + arrayItem.pageNumber + '. ' + arrayItem.type + "" } autoGeneratedParagraphIndex++ - HTML = HTML + '

' + paragraph.text + '

' + HTML = HTML + '

' + paragraph.text + '

' } } @@ -261,7 +265,7 @@ function newSuperalgosDocsDocumentPage() { } } } - if (objectBeingRendered.category === 'Node') { + if (UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.category === 'Node') { autoGeneratedHtml() } HTML = HTML + '' // Content Ends @@ -353,7 +357,7 @@ function newSuperalgosDocsDocumentPage() { addDefinitionImage() addhHerarchyImages() - if (objectBeingRendered.category === 'Node') { + if (UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.category === 'Node') { addMenuItemsImages() addChildrenNodesPropertiesImages() addAttachingAndReferencingRulesImages() @@ -420,8 +424,8 @@ function newSuperalgosDocsDocumentPage() { } function addProjectImage() { - let imageName = objectBeingRendered.project.toLowerCase().replaceAll(' ', '-') - let imageElement = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName(objectBeingRendered.project, imageName) + let imageName = UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project.toLowerCase().replaceAll(' ', '-') + let imageElement = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project, imageName) imageElement.width = "50" imageElement.height = "50" @@ -444,10 +448,10 @@ function newSuperalgosDocsDocumentPage() { function getIcon() { if (menuItem.relatedUiObject !== undefined) { - return UI.projects.superalgos.spaces.designSpace.getIconByProjectAndType(objectBeingRendered.project, menuItem.relatedUiObject) + return UI.projects.superalgos.spaces.designSpace.getIconByProjectAndType(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project, menuItem.relatedUiObject) } else { if (menuItem.iconPathOn !== undefined) { - return UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName(objectBeingRendered.project, menuItem.iconPathOn) + return UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project, menuItem.iconPathOn) } else { return UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName('Superalgos', 'bitcoin') } @@ -473,7 +477,7 @@ function newSuperalgosDocsDocumentPage() { if (childrenNodesProperty.project !== undefined) { return UI.projects.superalgos.spaces.designSpace.getIconByProjectAndType(childrenNodesProperty.project, childrenNodesProperty.childType) } else { - return UI.projects.superalgos.spaces.designSpace.getIconByProjectAndType(objectBeingRendered.project, childrenNodesProperty.childType) + return UI.projects.superalgos.spaces.designSpace.getIconByProjectAndType(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project, childrenNodesProperty.childType) } } } @@ -521,7 +525,7 @@ function newSuperalgosDocsDocumentPage() { function getIcon() { let splittedListItem = listItem.split('|') if (splittedListItem.length === 1) { - return UI.projects.superalgos.spaces.designSpace.getIconByProjectAndType(objectBeingRendered.project, listItem) + return UI.projects.superalgos.spaces.designSpace.getIconByProjectAndType(UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.project, listItem) } else { let project = splittedListItem[0] let nodeType = splittedListItem[1] @@ -645,7 +649,7 @@ function newSuperalgosDocsDocumentPage() { let name = UI.projects.superalgos.utilities.strings.fromCamelCaseToUpperWithSpaces(childrenNodesProperty.name) - HTML = HTML + '' + HTML = HTML + '' HTML = HTML + '
' paragraph = { @@ -718,7 +722,7 @@ function newSuperalgosDocsDocumentPage() { for (let i = 0; i < nodeList.length; i++) { let listItem = nodeList[i] if (listItem === "") { continue } - HTML = HTML + '' + HTML = HTML + '' } } } @@ -773,7 +777,7 @@ function newSuperalgosDocsDocumentPage() { for (let i = 0; i < nodeList.length; i++) { let listItem = nodeList[i] if (listItem === "") { continue } - HTML = HTML + '' + HTML = HTML + '' } } } @@ -1086,7 +1090,7 @@ function newSuperalgosDocsDocumentPage() { key = key + '-text' innerHTML = UI.projects.superalgos.utilities.docs.getTextBasedOnLanguage(paragraph) innerHTML = UI.projects.superalgos.utilities.docs.addCodeToCamelCase(innerHTML) - innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, objectBeingRendered.type) + innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) innerHTML = UI.projects.superalgos.utilities.docs.addItalics(innerHTML) innerHTML = innerHTML + UI.projects.superalgos.utilities.docs.addWarningIfTranslationIsOutdated(paragraph) break @@ -1115,7 +1119,7 @@ function newSuperalgosDocsDocumentPage() { role = 'role="alert"' key = key + '-note' innerHTML = UI.projects.superalgos.utilities.docs.getTextBasedOnLanguage(paragraph) - innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, objectBeingRendered.type) + innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) innerHTML = UI.projects.superalgos.utilities.docs.addItalics(innerHTML) innerHTML = innerHTML + UI.projects.superalgos.utilities.docs.addWarningIfTranslationIsOutdated(paragraph) break @@ -1126,7 +1130,7 @@ function newSuperalgosDocsDocumentPage() { role = 'role="alert"' key = key + '-success' innerHTML = UI.projects.superalgos.utilities.docs.getTextBasedOnLanguage(paragraph) - innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, objectBeingRendered.type) + innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) innerHTML = UI.projects.superalgos.utilities.docs.addItalics(innerHTML) innerHTML = innerHTML + UI.projects.superalgos.utilities.docs.addWarningIfTranslationIsOutdated(paragraph) break @@ -1137,7 +1141,7 @@ function newSuperalgosDocsDocumentPage() { role = 'role="alert"' key = key + '-important' innerHTML = UI.projects.superalgos.utilities.docs.getTextBasedOnLanguage(paragraph) - innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, objectBeingRendered.type) + innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) innerHTML = UI.projects.superalgos.utilities.docs.addItalics(innerHTML) innerHTML = innerHTML + UI.projects.superalgos.utilities.docs.addWarningIfTranslationIsOutdated(paragraph) break @@ -1148,7 +1152,7 @@ function newSuperalgosDocsDocumentPage() { role = 'role="alert"' key = key + '-warning' innerHTML = UI.projects.superalgos.utilities.docs.getTextBasedOnLanguage(paragraph) - innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, objectBeingRendered.type) + innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) innerHTML = UI.projects.superalgos.utilities.docs.addItalics(innerHTML) innerHTML = innerHTML + UI.projects.superalgos.utilities.docs.addWarningIfTranslationIsOutdated(paragraph) break @@ -1159,7 +1163,7 @@ function newSuperalgosDocsDocumentPage() { role = 'role="alert"' key = key + '-error' innerHTML = UI.projects.superalgos.utilities.docs.getTextBasedOnLanguage(paragraph) - innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, objectBeingRendered.type) + innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) innerHTML = innerHTML + UI.projects.superalgos.utilities.docs.addWarningIfTranslationIsOutdated(paragraph) break } @@ -1169,7 +1173,7 @@ function newSuperalgosDocsDocumentPage() { role = '' key = key + '-callout' innerHTML = UI.projects.superalgos.utilities.docs.getTextBasedOnLanguage(paragraph) - innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, objectBeingRendered.type) + innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) innerHTML = UI.projects.superalgos.utilities.docs.addItalics(innerHTML) innerHTML = innerHTML + UI.projects.superalgos.utilities.docs.addWarningIfTranslationIsOutdated(paragraph) break @@ -1180,7 +1184,7 @@ function newSuperalgosDocsDocumentPage() { role = '' key = key + '-summary' innerHTML = UI.projects.superalgos.utilities.docs.getTextBasedOnLanguage(paragraph) - innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, objectBeingRendered.type) + innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) innerHTML = UI.projects.superalgos.utilities.docs.addItalics(innerHTML) innerHTML = innerHTML + UI.projects.superalgos.utilities.docs.addWarningIfTranslationIsOutdated(paragraph) break @@ -1191,7 +1195,7 @@ function newSuperalgosDocsDocumentPage() { role = '' key = key + '-section' innerHTML = UI.projects.superalgos.utilities.docs.getTextBasedOnLanguage(paragraph) - innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, objectBeingRendered.type) + innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) innerHTML = UI.projects.superalgos.utilities.docs.addItalics(innerHTML) innerHTML = innerHTML + UI.projects.superalgos.utilities.docs.addWarningIfTranslationIsOutdated(paragraph) break @@ -1204,7 +1208,7 @@ function newSuperalgosDocsDocumentPage() { key = key + '-list' innerHTML = UI.projects.superalgos.utilities.docs.getTextBasedOnLanguage(paragraph) innerHTML = UI.projects.superalgos.utilities.docs.addCodeToCamelCase(innerHTML) - innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, objectBeingRendered.type) + innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) innerHTML = UI.projects.superalgos.utilities.docs.addBold(innerHTML) innerHTML = UI.projects.superalgos.utilities.docs.addItalics(innerHTML) innerHTML = innerHTML + UI.projects.superalgos.utilities.docs.addWarningIfTranslationIsOutdated(paragraph) @@ -1217,7 +1221,7 @@ function newSuperalgosDocsDocumentPage() { role = '' key = key + '-table' innerHTML = UI.projects.superalgos.utilities.docs.getTextBasedOnLanguage(paragraph) - innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, objectBeingRendered.type) + innerHTML = UI.projects.superalgos.utilities.docs.addToolTips(innerHTML, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) innerHTML = UI.projects.superalgos.utilities.docs.parseTable(innerHTML) innerHTML = UI.projects.superalgos.utilities.docs.addItalics(innerHTML) break @@ -1313,7 +1317,7 @@ function newSuperalgosDocsDocumentPage() { } HTML = HTML + '

' + prefix + ' ' + innerHTML + sufix + '

' - paragraphMap.set(key, paragraph) + UI.projects.superalgos.spaces.docsSpace.paragraphMap.set(key, paragraph) } function hightlightEmbeddedCode() { @@ -1376,7 +1380,7 @@ function newSuperalgosDocsDocumentPage() { let imageContainer = '
' hierarchyImagesArray.push(imageItem) - let matrixValue = '
' + imageContainer + '
' + UI.projects.superalgos.utilities.docs.addToolTips(schemaDocument.type, objectBeingRendered.type) + '
' + let matrixValue = '
' + imageContainer + '
' + UI.projects.superalgos.utilities.docs.addToolTips(schemaDocument.type, UI.projects.superalgos.spaces.docsSpace.objectBeingRendered.type) + '
' let matrixRow = contentMatrix[currentRow] matrixRow[currentColumn] = matrixValue @@ -1523,7 +1527,7 @@ function newSuperalgosDocsDocumentPage() { contextMenuClickablDiv.addEventListener('contextmenu', e => { e.preventDefault() if (EDITOR_ON_FOCUS === true) { - exitEditMode() + UI.projects.superalgos.spaces.docsSpace.exitEditMode() return } if (UI.projects.superalgos.spaces.docsSpace.contextMenu.getSelection() === false) { diff --git a/Projects/Superalgos/UI/Utilities/Docs.js b/Projects/Superalgos/UI/Utilities/Docs.js index f5af50cb2..252ee9344 100644 --- a/Projects/Superalgos/UI/Utilities/Docs.js +++ b/Projects/Superalgos/UI/Utilities/Docs.js @@ -55,7 +55,7 @@ function newSuperalgosUtilitiesDocs() { } function setTextBasedOnLanguage(paragraph, text) { - if (UI.projects.superalgos.spaces.docsSpace.language === DEFAULT_LANGUAGE) { + if (UI.projects.superalgos.spaces.docsSpace.language === UI.projects.superalgos.globals.docs.DEFAULT_LANGUAGE) { if (paragraph.text !== text) { paragraph.text = text paragraph.updated = (new Date()).valueOf()