From 5a8c5f74f1ec7a25bf9d096a09b7f65eb7b8fb9f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 23 Dec 2020 11:49:14 +0100 Subject: [PATCH] Anchors --- Client/WebServer/css/docs.css | 11 ++++ Client/WebServer/index.html | 1 + .../Schemas/Docs-Concepts/vaina.json | 50 +++++++++++++++++++ .../UI/Spaces/Docs-Space/DocsSpace.js | 27 +++++++++- 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 Projects/Superalgos/Schemas/Docs-Concepts/vaina.json diff --git a/Client/WebServer/css/docs.css b/Client/WebServer/css/docs.css index 21f332a82..ea0da8991 100644 --- a/Client/WebServer/css/docs.css +++ b/Client/WebServer/css/docs.css @@ -652,4 +652,15 @@ margin-left: -240px; .docs-command-result-message { font-size: 90%; color: #31708f; +} + +.docs-hidden-anchor { + color: #b90d6c; + background-color: #ee6db4; + border-color: #830452; + padding: 15px; + border: 1px solid transparent; + border-radius: 4px; + margin: 20px 0; + width: 95%; } \ No newline at end of file diff --git a/Client/WebServer/index.html b/Client/WebServer/index.html index 7bf26db17..f34b95499 100644 --- a/Client/WebServer/index.html +++ b/Client/WebServer/index.html @@ -125,6 +125,7 @@ + diff --git a/Projects/Superalgos/Schemas/Docs-Concepts/vaina.json b/Projects/Superalgos/Schemas/Docs-Concepts/vaina.json new file mode 100644 index 000000000..8bba3c6f1 --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Concepts/vaina.json @@ -0,0 +1,50 @@ +{ + "type": "Vaina", + "definition": "Write here the definition of this Concept.", + "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." + }, + { + "style": "Anchor", + "text": "Anchor 1" + }, + { + "style": "Text", + "text": "Vaina Paragraph 1" + }, + { + "style": "Note", + "text": "Vaina Paragraph 2" + }, + { + "style": "Text", + "text": "Vaina Paragraph 3" + }, + { + "style": "Anchor", + "text": "Anchor 2" + }, + { + "style": "Text", + "text": "Vaina Paragraph 4" + }, + { + "style": "Callout", + "text": "Vaina Paragraph 5" + }, + { + "style": "Warning", + "text": "Vaina Paragraph 6" + }, + { + "style": "Text", + "text": "Vaina Paragraph 7" + }, + { + "style": "Text", + "text": "Vaina Paragraph 8" + } + ] +} \ 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 57b5fb1a8..b668ed846 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js @@ -78,7 +78,8 @@ function newSuperalgosDocSpace() { toList: toList, toTable: toTable, toGif: toGif, - toPng: toPng + toPng: toPng, + toAnchor: toAnchor } function editParagraph() { @@ -242,6 +243,13 @@ function newSuperalgosDocSpace() { contextMenuForceOutClick() renderDocumentPage() } + + function toAnchor() { + let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + docSchemaParagraph.style = 'Anchor' + contextMenuForceOutClick() + renderDocumentPage() + } } function setUpMenuItemsMap() { @@ -570,6 +578,9 @@ function newSuperalgosDocSpace() { if (paragraphNode.id.indexOf('-summary') >= 0) { selectedParagraphData = paragraphNode.innerText.substring(9, paragraphNode.innerText.length) } + if (paragraphNode.id.indexOf('-anchor') >= 0) { + selectedParagraphData = paragraphNode.innerText + } selectedParagraph = paragraphNode selectedParagraphHeight = paragraphNode.getClientRects()[0].height @@ -1327,6 +1338,10 @@ function newSuperalgosDocSpace() { documentPoints = documentPoints + thisPhraseCount * 1 break } + case 'anchor': { + documentPoints = documentPoints + thisPhraseCount * 1 + break + } } } @@ -2572,6 +2587,14 @@ function newSuperalgosDocSpace() { innerHTML = paragraph.text break } + case 'Anchor': { + styleClass = 'class="docs-hidden-anchor"' + prefix = '' + role = '' + key = key + '-anchor' + innerHTML = paragraph.text + break + } } HTML = HTML + '

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

' @@ -3105,7 +3128,7 @@ function newSuperalgosDocSpace() { if (UI.projects.superalgos.spaces.designSpace.workspace === undefined) { return } if (UI.projects.superalgos.spaces.designSpace.workspace.isInitialized === false) { return } - if (docsIndex.length === 0) { + if (docsIndex && docsIndex.length === 0) { setUpWorkspaceSchemas() setUpSearchEngine() }