Replacing codemirror ver 0.93 by ver 3.13 and using it in PM.

This commit is contained in:
ralph
2013-04-02 09:39:03 -04:00
parent 44b4cd860c
commit c869edb305
23 changed files with 704 additions and 479 deletions

View File

@@ -14,12 +14,13 @@
<en>Cancel</en>
</BTN_CANCEL>
<SAVE type="button" onclick="document.getElementById('form[TRI_WEBBOT]').value = triggerEditor.getCode(); triggerSave1(this.form);">
<SAVE type="button" onclick="document.getElementById('form[TRI_WEBBOT]').value = triggerEditor.getValue();
triggerSave1(this.form);">
<en>Save</en>
</SAVE>
<JS type="JavaScript"><![CDATA[
var triggerEditor = CodeMirror.fromTextArea('form[TRI_WEBBOT]', {
/*var triggerEditor = CodeMirror.fromTextArea('form[TRI_WEBBOT]', {
height: "380px",
width: "90%",
parserfile: ["parsexml.js", "parsecss.js", "tokenizejavascript.js", "parsejavascript.js",
@@ -27,6 +28,22 @@ var triggerEditor = CodeMirror.fromTextArea('form[TRI_WEBBOT]', {
"../contrib/php/js/parsephphtmlmixed.js"],
stylesheet: ["css/xmlcolors.css", "css/jscolors.css", "css/csscolors.css", "css/phpcolors.css" ],
path: "js/", lineNumbers: true, continuousScanning: 500, parserConfig: { phpOnly:true} });
*/
CodeMirror.commands.autocomplete = function(cm) {
CodeMirror.showHint(cm, CodeMirror.phpHint);
}
var triggerEditor = CodeMirror.fromTextArea(document.getElementById("form[TRI_WEBBOT]"), {
lineNumbers: true,
matchBrackets: true,
mode: "application/x-httpd-php",
PMEnabled: true,
indentUnit: 2,
indentWithTabs: false,
extraKeys: {"Ctrl-Space": "autocomplete"}
});
triggerEditor.setSize(800,400);
var _oVarsPanel_;
var showDynaformsFormVars = function(sFieldName, sAjaxServer, sProcess, sSymbol) {
@@ -63,32 +80,13 @@ var showDynaformsFormVars = function(sFieldName, sAjaxServer, sProcess, sSymbol)
};
var insertFormVar = function(sFieldName, sValue) {
//DEPRECTED
//oAux = document.getElementById(sFieldName);
//if (oAux.setSelectionRange) {
//var rangeStart = oAux.selectionStart;
//var rangeEnd = oAux.selectionEnd;
//var tempStr1 = oAux.value.substring(0,rangeStart);
//var tempStr2 = oAux.value.substring(rangeEnd);
//oAux.value = tempStr1 + sValue + tempStr2;
//}
//else {
//if (document.selection) {
//oAux.focus();
//document.selection.createRange().text = sValue;
//}
//}
//codeMirror code
if (triggerEditor.selection() == "") {
pos = triggerEditor.cursorPosition();
line = triggerEditor.cursorLine();
triggerEditor.insertIntoLine(line, pos.character, sValue);
if (triggerEditor.getSelection() == "") {
triggerEditor.replaceRange(sValue, triggerEditor.getCursor());
} else {
triggerEditor.replaceSelection(sValue);
}
_oVarsPanel_.remove();
triggerEditor.focus();
triggerEditor.focusIfIE();
};
function cancel(){