From d0b1dc3a3347c5dd1d14a370ac0900e5ce6560fa Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 22 Dec 2020 14:19:17 +0100 Subject: [PATCH] cool --- .../Schemas/Docs-Concepts/referencing.json | 8 +++++- .../UI/Spaces/Docs-Space/DocsSpace.js | 26 ++++++++++++++----- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Projects/Superalgos/Schemas/Docs-Concepts/referencing.json b/Projects/Superalgos/Schemas/Docs-Concepts/referencing.json index 75115953f..f0af3efbb 100644 --- a/Projects/Superalgos/Schemas/Docs-Concepts/referencing.json +++ b/Projects/Superalgos/Schemas/Docs-Concepts/referencing.json @@ -1,4 +1,10 @@ { "type": "Referencing", - "definition": "Nodes can reference other nodes" + "definition": "Nodes can reference other nodes", + "paragraphs": [ + { + "style": "Text", + "text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode." + } + ] } \ No newline at end of file diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js index ccaf26631..0a98810dc 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js @@ -16,6 +16,7 @@ function newSuperalgosDocSpace() { let isInitialized = false 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 @@ -797,7 +798,6 @@ function newSuperalgosDocSpace() { } function detectCommands() { - const newParagraphText = "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode." if (checkHelpCommand() === undefined) { return } if (checkAddCommand() === undefined) { return } @@ -1006,11 +1006,11 @@ function newSuperalgosDocSpace() { for (let j = 0; j < PROJECTS_ARRAY.length; j++) { let docsSchema let project = PROJECTS_ARRAY[j] -/* - docsSchema = SCHEMAS_BY_PROJECT.get(project).array.docsNodeSchema - httpRequest(JSON.stringify(docsSchema), 'Docs/Save-Node-Schema/' + project, onResponse) - requestsSent++ -*/ + /* + docsSchema = SCHEMAS_BY_PROJECT.get(project).array.docsNodeSchema + httpRequest(JSON.stringify(docsSchema), 'Docs/Save-Node-Schema/' + project, onResponse) + requestsSent++ + */ docsSchema = SCHEMAS_BY_PROJECT.get(project).array.docsConceptSchema httpRequest(JSON.stringify(docsSchema), 'Docs/Save-Concept-Schema/' + project, onResponse) requestsSent++ @@ -1025,7 +1025,7 @@ function newSuperalgosDocSpace() { data = JSON.parse(data) if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result && data.result === GLOBAL.DEFAULT_OK_RESPONSE.result) { okResponses++ - } + } responseCount++ if (responseCount === requestsSent) { @@ -1590,6 +1590,18 @@ function newSuperalgosDocSpace() { schemaDocument = template } + /* When for any reason the schema document does not have a paragraphs array */ + if (schemaDocument.paragraphs === undefined) { + schemaDocument.paragraphs = [] + } + /* When the paragraph array is empty. */ + if (schemaDocument.paragraphs.length === 0) { + let paragraph = { + style: 'Text', + text: newParagraphText + } + schemaDocument.paragraphs.push(paragraph) + } } async function repositionWorkspace() {