diff --git a/Projects/Superalgos/UI/Spaces/Tutorial-Space/TutorialSpace.js b/Projects/Superalgos/UI/Spaces/Tutorial-Space/TutorialSpace.js
index 61bbbd296..aef7c5461 100644
--- a/Projects/Superalgos/UI/Spaces/Tutorial-Space/TutorialSpace.js
+++ b/Projects/Superalgos/UI/Spaces/Tutorial-Space/TutorialSpace.js
@@ -1332,6 +1332,7 @@ function newSuperalgosTutorialSpace() {
let infoToRender = {}
transformDocsInfoIntoTutorialInfo()
+ createTheHTML()
function transformDocsInfoIntoTutorialInfo() {
if (schemaDocument === undefined) {
@@ -1347,167 +1348,109 @@ function newSuperalgosTutorialSpace() {
} else {
infoToRender.title = splittedType[1]
}
+ }
- infoToRender.summary = getTextFromParagraphStyle('Summary')
- infoToRender.gif = getTextFromParagraphStyle('Gif')
- infoToRender.summary = getTextFromParagraphStyle('Summary')
- infoToRender.callOut = getTextFromParagraphStyle('Callout')
- infoToRender.note = getTextFromParagraphStyle('Note')
- infoToRender.tip = getTextFromParagraphStyle('Tip')
- infoToRender.warning = getTextFromParagraphStyle('Warning')
- infoToRender.important = getTextFromParagraphStyle('Important')
+ function createTheHTML() {
+ let html = ''
+ if (infoToRender.title !== undefined && infoToRender.title !== '') {
+ html = html + '
'
+
+ if (schemaDocument.definition !== undefined && schemaDocument.definition.text !== '') {
+ html = html + '
'
+ html = html + ''
+ html = html + '| '
+ if (schemaDocument.icon !== undefined && schemaDocument.icon.name !== '') {
+ html = html + ''
+ newImageName = schemaDocument.icon.name
+ }
+ html = html + ' | '
+ html = html + ''
+ html = html + '' + UI.projects.superalgos.utilities.docs.addToolTips(schemaDocument.definition.text) + ''
+ html = html + ' | '
+ html = html + '
'
+ html = html + '
'
+ }
- let textsFounds = 0
- let listFound = false
for (let i = 0; i < schemaDocument.paragraphs.length; i++) {
let paragraph = schemaDocument.paragraphs[i]
- if (paragraph.style === 'Text') {
- listFound = true
- }
- if (paragraph.style === 'Text') {
- textsFounds++
- switch (textsFounds) {
- case 1: {
- if (listFound === false) {
- infoToRender.bulletListIntro = paragraph.text
- } else {
- infoToRender.paragraph1 = paragraph.text
- }
- break
- }
- case 2: {
- if (listFound === false) {
- infoToRender.bulletListIntro = paragraph.text
- } else {
- infoToRender.paragraph1 = paragraph.text
- }
- break
- }
+ switch (paragraph.style) {
+ case 'Summary': {
+ let text = paragraph.text
+ text = UI.projects.superalgos.utilities.docs.addToolTips(text)
+ html = html + '
' + text + '
'
+ break
+ }
+ case 'Title': {
+ let text = paragraph.text
+ html = html + '
' + text + '
'
+ break
+ }
+ case 'Gif': {
+ let text = paragraph.text
+ html = html + '
'
+ newGifName = text
+ break
+ }
+ case 'Text': {
+ let text = paragraph.text
+ text = UI.projects.superalgos.utilities.docs.addToolTips(text)
+ html = html + '
' + text + '
'
+ break
+ }
+ case 'List': {
+ let text = paragraph.text
+ text = UI.projects.superalgos.utilities.docs.addToolTips(text)
+ text = UI.projects.superalgos.utilities.docs.addBold(text)
+ html = html + '
'
+ html = html + '' + text + '
'
+ html = html + ''
+ break
+ }
+ case 'Callout': {
+ let text = paragraph.text
+ text = UI.projects.superalgos.utilities.docs.addToolTips(text)
+ html = html + '
' + text + '
'
+ break
+ }
+ case 'Link': {
+ let text = paragraph.text
+ let splittedText = text.split('->')
+ html = html + '
' + splittedText[0] + ''
+ break
+ }
+ case 'Note': {
+ let text = paragraph.text
+ text = UI.projects.superalgos.utilities.docs.addToolTips(text)
+ html = html + '
Note: ' + text + '
'
+ break
+ }
+ case 'Success': {
+ let text = paragraph.text
+ text = UI.projects.superalgos.utilities.docs.addToolTips(text)
+ html = html + '
Tip: ' + text + '
'
+ break
+ }
+ case 'Important': {
+ let text = paragraph.text
+ text = UI.projects.superalgos.utilities.docs.addToolTips(text)
+ html = html + '
Important: ' + text+ '
'
+ break
+ }
+ case 'Warning': {
+ let text = paragraph.text
+ text = UI.projects.superalgos.utilities.docs.addToolTips(text)
+ html = html + '
Warning: ' + text + '
'
+ break
}
}
}
- function getTextFromParagraphStyle(style) {
- for (let i = 0; i < schemaDocument.paragraphs.length; i++) {
- let paragraph = schemaDocument.paragraphs[i]
- if (paragraph.style === style) {
- return paragraph.text
- }
- }
- }
- }
-
- let html = ''
- if (infoToRender.title !== undefined && infoToRender.title !== '') {
- html = html + '
' + infoToRender.title + '
'
- }
- html = html + '
'
- if (infoToRender.summary !== undefined && infoToRender.summary !== '') {
- html = html + '
' + addToolTips(infoToRender.summary) + '
'
- }
- if (infoToRender.subTitle !== undefined && infoToRender.subTitle !== '') {
- html = html + '
' + infoToRender.subTitle + '
'
- }
- if (infoToRender.gif !== undefined && infoToRender.gif !== '') {
- html = html + '
'
- newGifName = infoToRender.gif
- }
-
- if (infoToRender.definition !== undefined && infoToRender.definition !== '') {
- html = html + '
'
- html = html + ''
- html = html + '| '
- if (infoToRender.image !== undefined && infoToRender.image !== '') {
- html = html + ''
- newImageName = infoToRender.image
- }
- html = html + ' | '
- html = html + ''
- html = html + '' + addToolTips(infoToRender.definition) + ''
- html = html + ' | '
- html = html + '
'
- html = html + '
'
- }
- if (infoToRender.bulletListIntro !== undefined && infoToRender.bulletListIntro !== '') {
- html = html + '
' + addToolTips(infoToRender.bulletListIntro) + '
'
- }
- if (infoToRender.bulletArray !== undefined) {
- html = html + '
'
- }
- if (infoToRender.paragraph1 !== undefined && infoToRender.paragraph1 !== '') {
- html = html + '
' + addToolTips(infoToRender.paragraph1) + '
'
- }
- if (infoToRender.callOut !== undefined && infoToRender.callOut !== '') {
- html = html + '
'
- }
- if (infoToRender.paragraph2 !== undefined && infoToRender.paragraph2 !== '') {
- html = html + '
' + addToolTips(infoToRender.paragraph2) + '
'
- }
- if (infoToRender.note !== undefined && infoToRender.note !== '') {
- html = html + '
Note: ' + addToolTips(infoToRender.note) + '
'
- }
- if (infoToRender.tip !== undefined && infoToRender.tip !== '') {
- html = html + '
Tip: ' + addToolTips(infoToRender.tip) + '
'
- }
- if (infoToRender.important !== undefined && infoToRender.important !== '') {
- html = html + '
Important: ' + addToolTips(infoToRender.important) + '
'
- }
- if (infoToRender.warning !== undefined && infoToRender.warning !== '') {
- html = html + '
Warning: ' + addToolTips(infoToRender.warning) + '
'
- }
- html = html + '
'
- tutorialDiv.innerHTML = html
+ tutorialDiv.innerHTML = html
- function addToolTips(text) {
- const TOOL_TIP_HTML = '
NODE_TYPENODE_DEFINITION
'
- let resultingText = ''
- let splittedText = text.split('->')
-
- for (let i = 0; i < splittedText.length; i = i + 2) {
- let firstPart = splittedText[i]
- let nodeType = splittedText[i + 1]
- if (nodeType === undefined) {
- return resultingText + firstPart
- }
- let splittedNodeType = nodeType.split('/')
- let project
- let type
- if (splittedNodeType.length > 1) {
- project = splittedNodeType[0]
- type = splittedNodeType[1]
- } else {
- project = 'Superalgos'
- type = splittedNodeType[0]
- }
- let definitionNode = SCHEMAS_BY_PROJECT.get(project).map.docsNodeSchema.get(type)
- if (definitionNode === undefined) {
- definitionNode = SCHEMAS_BY_PROJECT.get(project).map.docsConceptSchema.get(type)
- if (definitionNode === undefined) {
- currentNode.payload.uiObject.setErrorMessage(type + ' not found at Doc Schema or Concept Schema.')
- return
- }
- }
- let definition = definitionNode.definition
- if (definition === undefined || definition === "") {
- resultingText = resultingText + firstPart + type
- } else {
- let tooltip = TOOL_TIP_HTML.replace('NODE_TYPE', type).replace('NODE_DEFINITION', definition)
- resultingText = resultingText + firstPart + tooltip
- }
- }
- return resultingText
}
}