From 81c69c60f3b9d6eea57b6a8814b3b0f6e2923d53 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 26 Dec 2020 11:57:25 +0100 Subject: [PATCH] You tube and link --- Client/WebServer/css/docs.css | 17 +++- Client/WebServer/index.html | 2 + .../Schemas/Docs-Concepts/vaina.json | 12 +++ .../UI/Spaces/Docs-Space/DocsSpace.js | 78 ++++++++++++++++++- 4 files changed, 106 insertions(+), 3 deletions(-) diff --git a/Client/WebServer/css/docs.css b/Client/WebServer/css/docs.css index 2d5dc49ac..9d0051ee5 100644 --- a/Client/WebServer/css/docs.css +++ b/Client/WebServer/css/docs.css @@ -724,6 +724,19 @@ background-color: #f5f5f5; } .docs-hierarchy-table-cell{ - text-align: center; - vertical-align: middle; +text-align: center; +vertical-align: middle; +} + +.docs-link { +text-decoration: none; +color: #31708f; +} + +.docs-youtube-video-container{ +background-color: white; +box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); +margin-bottom: 35px; +max-width: 800px; +max-height: 476px; } \ No newline at end of file diff --git a/Client/WebServer/index.html b/Client/WebServer/index.html index a76ba3406..20fd4cadf 100644 --- a/Client/WebServer/index.html +++ b/Client/WebServer/index.html @@ -124,6 +124,8 @@ + + diff --git a/Projects/Superalgos/Schemas/Docs-Concepts/vaina.json b/Projects/Superalgos/Schemas/Docs-Concepts/vaina.json index 3702dd057..91bfe4d8d 100644 --- a/Projects/Superalgos/Schemas/Docs-Concepts/vaina.json +++ b/Projects/Superalgos/Schemas/Docs-Concepts/vaina.json @@ -6,6 +6,18 @@ "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": "Text", + "text": "Vaina 1" + }, + { + "style": "Youtube", + "text": "fO-CHEEVneI" + }, + { + "style": "Link", + "text": "Google->google.com" + }, { "style": "Block", "text": "Block #1" diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js index 4671bd8ab..48f59aca0 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js @@ -84,7 +84,9 @@ function newSuperalgosDocSpace() { toAnchor: toAnchor, toBlock: toBlock, toInclude: toInclude, - copyLink: copyLink + copyLink: copyLink, + toWebPageLink: toWebPageLink, + toYouTubeVideo: toYouTubeVideo } function editParagraph() { @@ -287,6 +289,20 @@ function newSuperalgosDocSpace() { renderDocumentPage() } + function toWebPageLink() { + let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + docSchemaParagraph.style = 'Link' + contextMenuForceOutClick() + renderDocumentPage() + } + + function toYouTubeVideo() { + let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) + docSchemaParagraph.style = 'Youtube' + contextMenuForceOutClick() + renderDocumentPage() + } + function copyLink() { let docSchemaParagraph = paragraphMap.get(selectedParagraph.id) let clipboard @@ -652,6 +668,12 @@ function newSuperalgosDocSpace() { if (paragraphNode.id.indexOf('-include') >= 0) { selectedParagraphData = paragraphNode.innerText } + if (paragraphNode.id.indexOf('-link') >= 0) { + selectedParagraphData = reverseParseLink(paragraphNode.innerHTML) + } + if (paragraphNode.id.indexOf('-youtube') >= 0) { + selectedParagraphData = reverseParseYoutube(paragraphNode.innerHTML) + } selectedParagraph = paragraphNode selectedParagraphHeight = paragraphNode.getClientRects()[0].height @@ -1518,6 +1540,14 @@ function newSuperalgosDocSpace() { documentPoints = documentPoints + thisPhraseCount * 0 break } + case 'link': { + documentPoints = documentPoints + thisPhraseCount * 1 + break + } + case 'youtube': { + documentPoints = documentPoints + thisPhraseCount * 1 + break + } } } @@ -2908,6 +2938,24 @@ function newSuperalgosDocSpace() { innerHTML = parseHierarchy(paragraph.text) break } + case 'Link': { + styleClass = '' + prefix = '' + sufix = '' + role = '' + key = key + '-link' + innerHTML = parseLink(paragraph.text) + break + } + case 'Youtube': { + styleClass = '' + prefix = '' + sufix = '' + role = '' + key = key + '-youtube' + innerHTML = parseYoutube(paragraph.text) + break + } case 'Gif': { styleClass = '' prefix = '' @@ -3316,6 +3364,34 @@ function newSuperalgosDocSpace() { } } + function parseLink(text) { + let HTML = '' + let splittedText = text.split('->') + if (splittedText.length < 1) { return } + HTML = '' + splittedText[0] + '' + return HTML + } + + function parseYoutube(text) { + let HTML = '' + + HTML = HTML + '
' + HTML = HTML + '' + HTML = HTML + '
' + + return HTML + } + + function reverseParseLink(HTML) { + let splittedHTML = HTML.split('"') + return splittedHTML[1] + } + + function reverseParseYoutube(HTML) { + let splittedHTML = HTML.split('"') + return splittedHTML[1] + } + function reverseParseHierarchy(HTML) { let splittedHTML = HTML.split('"') return splittedHTML[3]