Commit 1962e505 authored by Franco Pariani's avatar Franco Pariani
Browse files

Fix

parent 9c8e3b75
......@@ -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();
......
......@@ -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();
......
......@@ -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(){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment