BUG 10870 "A better trigger editor is needed" SOLVED

- Problema con la identacion cuando se ingresa texto en el editor de triggers
- Problema resuelto, se ha añdo codigo para la identacion, esto para los triggers (PHP)

* Available from version ProcessMaker-2.5.2-testing.1
This commit is contained in:
Victor Saisa Lopez
2013-07-23 15:45:41 -04:00
parent c3cee2be2f
commit 8748bc6509

View File

@@ -11,7 +11,7 @@
return "string"; return "string";
}; };
} }
var PM_keywords = function(){ var PM_keywords = function(){
function PMkey() {return {style: "PMbuiltin"};} function PMkey() {return {style: "PMbuiltin"};}
var PMfunctions = { var PMfunctions = {
@@ -32,7 +32,7 @@
"PMFGetCaseNotes":PMkey()}; "PMFGetCaseNotes":PMkey()};
return PMfunctions; return PMfunctions;
}(); }();
var php_keywords = function(){ var php_keywords = function(){
function phpbuild() {return {style: "builtin"};} function phpbuild() {return {style: "builtin"};}
function phpatom() {return {style: "atom"};} function phpatom() {return {style: "atom"};}
@@ -171,8 +171,8 @@
"__FUNCTION__":phpatom(),"__NAMESPACE__":phpatom()}; "__FUNCTION__":phpatom(),"__NAMESPACE__":phpatom()};
return Phpfunctions; return Phpfunctions;
}(); }();
var phpConfig = { var phpConfig = {
name: "clike", name: "clike",
keywords: keywords("abstract and array as break case catch class clone const continue declare default " + keywords: keywords("abstract and array as break case catch class clone const continue declare default " +
@@ -221,7 +221,7 @@
function dispatch(stream, state) { function dispatch(stream, state) {
var isPHP = state.curMode == phpMode; var isPHP = state.curMode == phpMode;
if (stream.sol() && state.pending != '"') state.pending = null; if (stream.sol() && state.pending != '"') state.pending = null;
if (!isPHP) { if (!isPHP) {
if (stream.match(/^<\?\w*/)) { if (stream.match(/^<\?\w*/)) {
state.curMode = phpMode; state.curMode = phpMode;
@@ -300,7 +300,27 @@
if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) || if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) ||
(state.curMode == phpMode && /^\?>/.test(textAfter))) (state.curMode == phpMode && /^\?>/.test(textAfter)))
return htmlMode.indent(state.html, textAfter); return htmlMode.indent(state.html, textAfter);
return state.curMode.indent(state.curState, textAfter);
var firstChar = textAfter && textAfter.charAt(0);
var lastChar = textAfter && textAfter != "" && textAfter.charAt(textAfter.length - 1);
if (state.curState.context.type == "statement") {
if (state.curState.context.prev.type == "}") { //{
return state.curState.context.indented;
} else {
if (firstChar == "}") {
if (lastChar == "{") {
return state.curState.context.indented - config.indentUnit;
} else {
return state.curState.context.indented - state.curState.context.prev.indented;
}
} else {
return state.curState.context.prev.indented;
}
}
} else {
return state.curMode.indent(state.curState, textAfter);
}
}, },
electricChars: "/{}:", electricChars: "/{}:",