Bug fixed
This commit is contained in:
1 parent
55a63d9c88
commit
140f53f181
3 files changed
+60
-16
No files matched your search
+2
-1
@@ -5,12 +5,13 @@ let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment()
|
||||
global.env = ENVIRONMENT_MODULE
|
||||
|
||||
process.on('uncaughtException', function (err) {
|
||||
if (err.message.indexOf("EADDRINUSE") > 0) {
|
||||
if (err.message && err.message.indexOf("EADDRINUSE") > 0) {
|
||||
console.log("A Superalgos Client cannot be started. Reason: the port " + port + " is already in use by another application.")
|
||||
return
|
||||
}
|
||||
console.log('[ERROR] Client -> client-> uncaughtException -> err.message = ' + err.message)
|
||||
console.log('[ERROR] Client -> client-> uncaughtException -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] Client -> client-> uncaughtException -> err = ' + err)
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
|
||||
@@ -4,7 +4,17 @@
|
||||
"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."
|
||||
"text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode.",
|
||||
"translations": [
|
||||
{
|
||||
"language": "RU",
|
||||
"text": "Esto esta escrito en ruso."
|
||||
},
|
||||
{
|
||||
"language": "ES",
|
||||
"text": "Esto esta en espaniol."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
|
||||
@@ -502,29 +502,39 @@ function newSuperalgosDocSpace() {
|
||||
if (paragraphs.length === 1) {
|
||||
/* There is no need to add new paragraphs, we just update the one we have. */
|
||||
if (paragraphs[0] !== '') {
|
||||
docSchemaParagraph.text = paragraphs[0]
|
||||
setTextBasedOnLanguage(docSchemaParagraph, paragraphs[0])
|
||||
} else {
|
||||
docsSchemaDocument.paragraphs.splice(selectededitableParagraphIndex, 1)
|
||||
if (docsSchemaDocument.paragraphs.length === 0) {
|
||||
let newParagraph = {
|
||||
style: 'Text',
|
||||
text: 'Please contribute to the docs by editing this content.'
|
||||
/*
|
||||
Deleting paragarphs is only possible in the default language.
|
||||
*/
|
||||
if (language === DEFAULT_LANGUAGE) {
|
||||
docsSchemaDocument.paragraphs.splice(selectededitableParagraphIndex, 1)
|
||||
if (docsSchemaDocument.paragraphs.length === 0) {
|
||||
let newParagraph = {
|
||||
style: 'Text',
|
||||
text: 'Please contribute to the docs by editing this content.'
|
||||
}
|
||||
docsSchemaDocument.paragraphs.push(newParagraph)
|
||||
}
|
||||
docsSchemaDocument.paragraphs.push(newParagraph)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
We will update the one paragraph we have and we will add the rest.
|
||||
Adding paragarphs is only possible in the default language.
|
||||
*/
|
||||
docSchemaParagraph.text = paragraphs[0]
|
||||
if (language === DEFAULT_LANGUAGE) {
|
||||
/*
|
||||
We will update the one paragraph we have and we will add the rest.
|
||||
*/
|
||||
setTextBasedOnLanguage(docSchemaParagraph, paragraphs[0])
|
||||
|
||||
for (let i = 1; i < paragraphs.length; i++) {
|
||||
let newParagraph = {
|
||||
style: style,
|
||||
text: paragraphs[i]
|
||||
for (let i = 1; i < paragraphs.length; i++) {
|
||||
let newParagraph = {
|
||||
style: style,
|
||||
text: paragraphs[i]
|
||||
}
|
||||
docsSchemaDocument.paragraphs.splice(selectededitableParagraphIndex + i, 0, newParagraph)
|
||||
}
|
||||
docsSchemaDocument.paragraphs.splice(selectededitableParagraphIndex + i, 0, newParagraph)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,6 +552,29 @@ function newSuperalgosDocSpace() {
|
||||
}
|
||||
EDITOR_ON_FOCUS = false
|
||||
renderDocumentPage()
|
||||
|
||||
function setTextBasedOnLanguage(paragraph, text) {
|
||||
if (language === DEFAULT_LANGUAGE) {
|
||||
paragraph.text = text
|
||||
return
|
||||
}
|
||||
if (paragraph.translations === undefined) {
|
||||
paragraph.translations = []
|
||||
}
|
||||
for (let i = 0; i < paragraph.translations.length; i++) {
|
||||
let translation = paragraph.translations[i]
|
||||
if (translation.language === language) {
|
||||
translation.text = text
|
||||
return
|
||||
}
|
||||
}
|
||||
let translation = {
|
||||
language: language,
|
||||
text: text
|
||||
}
|
||||
paragraph.translations.push(translation)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user