diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/ContextMenu.js b/Projects/Superalgos/UI/Spaces/Docs-Space/ContextMenu.js index d85ed0ccc..85060d10b 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/ContextMenu.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/ContextMenu.js @@ -114,7 +114,7 @@ function newSuperalgosDocsContextMenu() { function deleteParagraph() { if (selectedParagraphIndex === undefined) { return } if (selectedParagraphIndex === 0) { return } - docsSchemaDocument.paragraphs.splice(selectedParagraphIndex, 1) + UI.projects.superalgos.spaces.docsSpace.documentPage.docsSchemaDocument.paragraphs.splice(selectedParagraphIndex, 1) forceOutClick() UI.projects.superalgos.spaces.docsSpace.documentPage.render() } diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/DocumentPage.js b/Projects/Superalgos/UI/Spaces/Docs-Space/DocumentPage.js index 66d5fa035..73135bb87 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/DocumentPage.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/DocumentPage.js @@ -1,5 +1,6 @@ function newSuperalgosDocsDocumentPage() { let thisObject = { + docsSchemaDocument: undefined, exitEditMode: exitEditMode, render: render, initialize: initialize, @@ -7,7 +8,6 @@ function newSuperalgosDocsDocumentPage() { } let appSchemaDocument - let docsSchemaDocument return thisObject @@ -17,7 +17,7 @@ function newSuperalgosDocsDocumentPage() { function finalize() { appSchemaDocument = undefined - docsSchemaDocument = undefined + thisObject.docsSchemaDocument = undefined } function render() { @@ -34,24 +34,24 @@ function newSuperalgosDocsDocumentPage() { function getSchemaDocument() { switch (UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category) { case 'Node': { - docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).map.docsNodeSchema.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type) + thisObject.docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).map.docsNodeSchema.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type) break } case 'Concept': { - docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).map.docsConceptSchema.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type) + thisObject.docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).map.docsConceptSchema.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type) break } case 'Topic': { - docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).map.docsTopicSchema.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type) + thisObject.docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).map.docsTopicSchema.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type) break } case 'Workspace': { - docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).map.workspaceSchema.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.nodeId) + thisObject.docsSchemaDocument = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).map.workspaceSchema.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.nodeId) break } } - if (docsSchemaDocument === undefined) { + if (thisObject.docsSchemaDocument === undefined) { // Use the New Node Template let template = { type: UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type, @@ -77,26 +77,26 @@ function newSuperalgosDocsDocumentPage() { } } - docsSchemaDocument = template + thisObject.docsSchemaDocument = template } /* When for any reason the schema document does not have a paragraphs array */ - if (docsSchemaDocument.paragraphs === undefined) { - docsSchemaDocument.paragraphs = [] + if (thisObject.docsSchemaDocument.paragraphs === undefined) { + thisObject.docsSchemaDocument.paragraphs = [] } /* When the paragraph array is empty. */ - if (docsSchemaDocument.paragraphs.length === 0) { + if (thisObject.docsSchemaDocument.paragraphs.length === 0) { let paragraph = { style: 'Text', text: UI.projects.superalgos.globals.docs.NEW_PARAGRAPH_TEXT } - docsSchemaDocument.paragraphs.push(paragraph) + thisObject.docsSchemaDocument.paragraphs.push(paragraph) } } async function repositionWorkspace() { if (UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category !== 'Workspace') { return } - let node = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeById(docsSchemaDocument.nodeId) + let node = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeById(thisObject.docsSchemaDocument.nodeId) node.payload.floatingObject.unCollapseParent() setTimeout(positionAtNode, 3000, node) setTimeout(positionAtNode, 5000, node) @@ -120,10 +120,10 @@ function newSuperalgosDocsDocumentPage() { HTML = HTML + '
' - addDefinitionTable(docsSchemaDocument, 'definition-editable-', UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category, UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project, UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type) + addDefinitionTable(thisObject.docsSchemaDocument, 'definition-editable-', UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category, UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project, UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.type) let editableParagraphIndex = 0 let autoGeneratedParagraphIndex = 0 @@ -138,7 +138,7 @@ function newSuperalgosDocsDocumentPage() { buildOrderedTopicPageIndex() generatePreviousAndNextPageNavigation() /* Topic Title */ - titleLabel = docsSchemaDocument.topic + ' Topic' + titleLabel = thisObject.docsSchemaDocument.topic + ' Topic' HTML = HTML + '