diff --git a/Frontend Angular 4/src/app/layout/matefun/codemirror/addons/functions_definition_EN.js b/Frontend Angular 4/src/app/layout/matefun/codemirror/addons/functions_definition_EN.js index a1e45b15d9fa40d2d2e9e955e14f65bd32e73d05..aa3c04037d95cae5d0ddc04dfde4a05ac9a42713 100644 --- a/Frontend Angular 4/src/app/layout/matefun/codemirror/addons/functions_definition_EN.js +++ b/Frontend Angular 4/src/app/layout/matefun/codemirror/addons/functions_definition_EN.js @@ -349,7 +349,7 @@ var mac = /Mac/.test(navigator.platform); } function resolveAutoHints(cm, pos) { - var helpers = cm.getHelpers(pos, "functionDefinition"), words + var helpers = cm.getHelpers(pos, "functionDefinitionEN"), words if (helpers.length) { var resolved = function(cm, callback, options) { var app = applicableHelpers(cm, helpers); @@ -374,11 +374,11 @@ var mac = /Mac/.test(navigator.platform); } } - CodeMirror.registerHelper("functionDefinition", "auto", { + CodeMirror.registerHelper("functionDefinitionEN", "auto", { resolve: resolveAutoHints }); - CodeMirror.registerHelper("functionDefinition", "fromList", function(cm, options) { + CodeMirror.registerHelper("functionDefinitionEN", "fromList", function(cm, options) { var cur = cm.getCursor(), token = cm.getTokenAt(cur) var term, from = CodeMirror.Pos(cur.line, token.start), to = cur if (token.start < cur.ch && /\w/.test(token.string.charAt(cur.ch - token.start - 1))) { @@ -416,7 +416,7 @@ var mac = /Mac/.test(navigator.platform); // functions definitions - CodeMirror.defineExtension("functionDefinition", function(filename, archivos, options) { + CodeMirror.defineExtension("functionDefinitionEN", function(filename, archivos, options) { if (options.mode.name == "matefun-EN"){ options = parseOptions(this, this.getCursor("start"), options); if (this.state.completionActive) this.state.completionActive.close(); diff --git a/Frontend Angular 4/src/app/layout/matefun/codemirror/addons/functions_definition_ES.js b/Frontend Angular 4/src/app/layout/matefun/codemirror/addons/functions_definition_ES.js index cc360bf83fc17fc8ffb428719f00b70070ea729a..d85d7b330b142942de39e87acd07c5f8f7130a8c 100644 --- a/Frontend Angular 4/src/app/layout/matefun/codemirror/addons/functions_definition_ES.js +++ b/Frontend Angular 4/src/app/layout/matefun/codemirror/addons/functions_definition_ES.js @@ -349,7 +349,7 @@ var mac = /Mac/.test(navigator.platform); } function resolveAutoHints(cm, pos) { - var helpers = cm.getHelpers(pos, "functionDefinition"), words + var helpers = cm.getHelpers(pos, "functionDefinitionES"), words if (helpers.length) { var resolved = function(cm, callback, options) { var app = applicableHelpers(cm, helpers); @@ -374,11 +374,11 @@ var mac = /Mac/.test(navigator.platform); } } - CodeMirror.registerHelper("functionDefinition", "auto", { + CodeMirror.registerHelper("functionDefinitionES", "auto", { resolve: resolveAutoHints }); - CodeMirror.registerHelper("functionDefinition", "fromList", function(cm, options) { + CodeMirror.registerHelper("functionDefinitionES", "fromList", function(cm, options) { var cur = cm.getCursor(), token = cm.getTokenAt(cur) var term, from = CodeMirror.Pos(cur.line, token.start), to = cur if (token.start < cur.ch && /\w/.test(token.string.charAt(cur.ch - token.start - 1))) { @@ -416,7 +416,7 @@ var mac = /Mac/.test(navigator.platform); // functions definitions - CodeMirror.defineExtension("functionDefinition", function(filename, archivos, options) { + CodeMirror.defineExtension("functionDefinitionES", function(filename, archivos, options) { if (options.mode.name == "matefun-ES"){ options = parseOptions(this, this.getCursor("start"), options); if (this.state.completionActive) this.state.completionActive.close(); diff --git a/Frontend Angular 4/src/app/layout/matefun/matefun.component.ts b/Frontend Angular 4/src/app/layout/matefun/matefun.component.ts index d7ff4324c9aec5e5be6a66913fbc3001fbef99cd..cb59844ae714f610494c42b14cb70f3136cbcfa7 100755 --- a/Frontend Angular 4/src/app/layout/matefun/matefun.component.ts +++ b/Frontend Angular 4/src/app/layout/matefun/matefun.component.ts @@ -462,8 +462,14 @@ export class MateFunComponent { } clickEnEditor(event){ - if (this.typingCheck) - this.codemirror.instance.functionDefinition(this.archivo.nombre, this.archivosTree.archivos, this.codemirror.instance.doc, event); + if (this.typingCheck){ + let currentSession = sessionStorage.getItem("currentUser"); + let langCode = currentSession ? JSON.parse(currentSession).language : 'es'; + if (langCode == 'en') + this.codemirror.instance.functionDefinitionEN(this.archivo.nombre, this.archivosTree.archivos, this.codemirror.instance.doc, event); + else if (langCode == 'es') + this.codemirror.instance.functionDefinitionES(this.archivo.nombre, this.archivosTree.archivos, this.codemirror.instance.doc, event); + } } guardarArchivo(){