diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js
index 90603be70..6aa9ca528 100644
--- a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js
+++ b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js
@@ -12,6 +12,7 @@ function newSuperalgosDocSpace() {
commandInterface: undefined,
language: undefined,
command: undefined,
+ menuLabelsMap: undefined,
changeLanguage: changeLanguage,
openSpaceAreaAndNavigateTo: openSpaceAreaAndNavigateTo,
navigateTo: navigateTo,
@@ -25,7 +26,6 @@ function newSuperalgosDocSpace() {
}
let isInitialized = false
- const TAGGING_STRING_SEPARATOR = '~>'
const DEFAULT_LANGUAGE = 'EN'
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."
@@ -53,11 +53,11 @@ function newSuperalgosDocSpace() {
let paragraphMap // Here we will store a map of paragraphs from the Docs Node, Concept or Topics Schema in order to find it when we need to update them.
let appSchemaDocument
let docsSchemaDocument
- let menuLabelsMap = new Map()
return thisObject
function initialize() {
+ thisObject.menuLabelsMap = new Map()
setupSidePanelTab()
setUpContextMenu()
@@ -401,7 +401,7 @@ function newSuperalgosDocSpace() {
if (docsSchemaDocument.menuItems === undefined) { continue }
for (let k = 0; k < docsSchemaDocument.menuItems.length; k++) {
let menuItem = docsSchemaDocument.menuItems[k]
- menuLabelsMap.set(menuItem.label, true)
+ thisObject.menuLabelsMap.set(menuItem.label, true)
}
}
}
@@ -431,7 +431,7 @@ function newSuperalgosDocSpace() {
paragraphMap = undefined
appSchemaDocument = undefined
docsSchemaDocument = undefined
- menuLabelsMap = undefined
+ thisObject.menuLabelsMap = undefined
isInitialized = false
}
@@ -507,7 +507,7 @@ function newSuperalgosDocSpace() {
if (paragraphs.length === 1) {
/* There is no need to add new paragraphs, we just update the one we have. */
if (paragraphs[0] !== '') {
- setTextBasedOnLanguage(docSchemaParagraph, paragraphs[0])
+ UI.projects.superalgos.utilities.docs.setTextBasedOnLanguage(docSchemaParagraph, paragraphs[0])
} else {
/*
Deleting paragarphs is only possible in the default language.
@@ -531,7 +531,7 @@ function newSuperalgosDocSpace() {
/*
We will update the one paragraph we have and we will add the rest.
*/
- setTextBasedOnLanguage(docSchemaParagraph, paragraphs[0])
+ UI.projects.superalgos.utilities.docs.setTextBasedOnLanguage(docSchemaParagraph, paragraphs[0])
for (let i = 1; i < paragraphs.length; i++) {
let newParagraph = {
@@ -550,7 +550,7 @@ function newSuperalgosDocSpace() {
This means that the definition was being edited.
*/
if (textArea.value !== '') {
- setTextBasedOnLanguage(docsSchemaDocument.definition, textArea.value)
+ UI.projects.superalgos.utilities.docs.setTextBasedOnLanguage(docsSchemaDocument.definition, textArea.value)
}
break
}
@@ -707,19 +707,19 @@ function newSuperalgosDocSpace() {
return true
}
if (paragraphNode.id.indexOf('-table') >= 0) {
- selectedParagraphData = reverseParseTable(paragraphNode.innerHTML)
+ selectedParagraphData = UI.projects.superalgos.utilities.docs.reverseParseTable(paragraphNode.innerHTML)
return true
}
if (paragraphNode.id.indexOf('-hierarchy') >= 0) {
- selectedParagraphData = reverseParseHierarchy(paragraphNode.innerHTML)
+ selectedParagraphData = UI.projects.superalgos.utilities.docs.reverseParseHierarchy(paragraphNode.innerHTML)
return true
}
if (paragraphNode.id.indexOf('-gif') >= 0) {
- selectedParagraphData = reverseParseGIF(paragraphNode.innerHTML)
+ selectedParagraphData = UI.projects.superalgos.utilities.docs.reverseParseGIF(paragraphNode.innerHTML)
return true
}
if (paragraphNode.id.indexOf('-png') >= 0) {
- selectedParagraphData = reverseParsePNG(paragraphNode.innerHTML)
+ selectedParagraphData = UI.projects.superalgos.utilities.docs.reverseParsePNG(paragraphNode.innerHTML)
return true
}
if (paragraphNode.id.indexOf('-javascript') >= 0) {
@@ -755,11 +755,11 @@ function newSuperalgosDocSpace() {
return true
}
if (paragraphNode.id.indexOf('-link') >= 0) {
- selectedParagraphData = reverseParseLink(paragraphNode.innerHTML)
+ selectedParagraphData = UI.projects.superalgos.utilities.docs.reverseParseLink(paragraphNode.innerHTML)
return true
}
if (paragraphNode.id.indexOf('-youtube') >= 0) {
- selectedParagraphData = reverseParseYoutube(paragraphNode.innerHTML)
+ selectedParagraphData = UI.projects.superalgos.utilities.docs.reverseParseYoutube(paragraphNode.innerHTML)
return true
}
}
@@ -1083,14 +1083,14 @@ function newSuperalgosDocSpace() {
function addDefinitionTable(docsSchemaDocument, idPrefix, category, project, type) {
if (docsSchemaDocument.definition !== undefined) {
- let definitionText = getTextBasedOnLanguage(docsSchemaDocument.definition)
+ let definitionText = UI.projects.superalgos.utilities.docs.getTextBasedOnLanguage(docsSchemaDocument.definition)
definitionText = definitionText + UI.projects.superalgos.utilities.docs.addWarningIfTranslationIsOutdated(docsSchemaDocument.definition)
/* We will test if we can draw an image here or not*/
let testElement = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndType(project, type)
if ((category === 'Topic' || category === 'Concept') && testElement === undefined) {
- HTML = HTML + '
'
}
}
@@ -1573,7 +1573,7 @@ function newSuperalgosDocSpace() {
let name = UI.projects.superalgos.utilities.strings.fromCamelCaseToUpperWithSpaces(childrenNodesProperty.name)
- HTML = HTML + ''
+ HTML = HTML + ''
HTML = HTML + '
'
}
diff --git a/Projects/Superalgos/UI/Utilities/Docs.js b/Projects/Superalgos/UI/Utilities/Docs.js
index 9c5dc3413..f5af50cb2 100644
--- a/Projects/Superalgos/UI/Utilities/Docs.js
+++ b/Projects/Superalgos/UI/Utilities/Docs.js
@@ -17,10 +17,11 @@ function newSuperalgosUtilitiesDocs() {
addBold: addBold,
addCodeToCamelCase: addCodeToCamelCase,
addItalics: addItalics,
- addToolTips: addToolTips,
- tagDefinedTypes: tagDefinedTypes
+ addToolTips: addToolTips
}
+ const TAGGING_STRING_SEPARATOR = '~>'
+
return thisObject
function addWarningIfTranslationIsOutdated(paragraph) {
@@ -308,25 +309,25 @@ function newSuperalgosUtilitiesDocs() {
let found = false
- if (found === false && menuLabelsMap.get(cleanPhrase4) === true) {
+ if (found === false && UI.projects.superalgos.spaces.docsSpace.menuLabelsMap.get(cleanPhrase4) === true) {
changedText = changedText + phrase4.replace(cleanPhrase4, '' + cleanPhrase4 + '') + ' '
i = i + 3
found = true
}
- if (found === false && menuLabelsMap.get(cleanPhrase3) === true) {
+ if (found === false && UI.projects.superalgos.spaces.docsSpace.menuLabelsMap.get(cleanPhrase3) === true) {
changedText = changedText + phrase3.replace(cleanPhrase3, '' + cleanPhrase3 + '') + ' '
i = i + 2
found = true
}
- if (found === false && menuLabelsMap.get(cleanPhrase2) === true) {
+ if (found === false && UI.projects.superalgos.spaces.docsSpace.menuLabelsMap.get(cleanPhrase2) === true) {
changedText = changedText + phrase2.replace(cleanPhrase2, '' + cleanPhrase2 + '') + ' '
i = i + 1
found = true
}
- if (found === false && menuLabelsMap.get(cleanPhrase1) === true) {
+ if (found === false && UI.projects.superalgos.spaces.docsSpace.menuLabelsMap.get(cleanPhrase1) === true) {
changedText = changedText + phrase1.replace(cleanPhrase1, '' + cleanPhrase1 + '') + ' '
i = i + 0
found = true
@@ -339,13 +340,13 @@ function newSuperalgosUtilitiesDocs() {
return changedText
}
- function addToolTips(text) {
+ function addToolTips(text, excludedType) {
const TOOL_TIP_HTML = '
TYPE_LABELDEFINITION
'
const LINK_ONLY_HTML = '
TYPE_LABEL
'
let resultingText = ''
- text = tagDefinedTypes(text, objectBeingRendered.type)
+ text = tagDefinedTypes(text, excludedType)
let splittedText = text.split(TAGGING_STRING_SEPARATOR)
for (let i = 0; i < splittedText.length; i = i + 2) {
@@ -389,7 +390,7 @@ function newSuperalgosUtilitiesDocs() {
return text
}
- let definition = getTextBasedOnLanguage(docsSchemaDocument.definition)
+ let definition = UI.projects.superalgos.utilities.docs.getTextBasedOnLanguage(docsSchemaDocument.definition)
if (definition === undefined || definition === "") {
let tooltip = LINK_ONLY_HTML
.replace('CATEGORY', category)
@@ -412,6 +413,7 @@ function newSuperalgosUtilitiesDocs() {
return resultingText
}
+ /* Private Functions follow */
function tagDefinedTypes(text, excludedType) {
let words = text.split(' ')
let taggedText = ''