Adding feature to coloring and check syntaxis on trigger editor.
This commit is contained in:
@@ -35,8 +35,8 @@
|
||||
</div>
|
||||
<div class="boxBottom"><div class="a"></div><div class="b"></div><div class="c"></div></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
<script src="js/codemirror/js/codemirror.js" type="text/javascript">
|
||||
{$form.JS}
|
||||
</script>
|
||||
|
||||
</form>
|
||||
</form>
|
||||
|
||||
@@ -14,11 +14,20 @@
|
||||
<en>Cancel</en>
|
||||
</BTN_CANCEL>
|
||||
|
||||
<SAVE type="button" onclick="triggerSave1(this.form);">
|
||||
<SAVE type="button" onclick="document.getElementById('form[TRI_WEBBOT]').value = triggerEditor.getCode(); triggerSave1(this.form);">
|
||||
<en>Save</en>
|
||||
</SAVE>
|
||||
<JS type="JavaScript"><![CDATA[
|
||||
|
||||
var triggerEditor = CodeMirror.fromTextArea('form[TRI_WEBBOT]', {
|
||||
height: "380px",
|
||||
width: "90%",
|
||||
parserfile: ["parsexml.js", "parsecss.js", "tokenizejavascript.js", "parsejavascript.js",
|
||||
"../contrib/php/js/tokenizephp.js", "../contrib/php/js/parsephp.js",
|
||||
"../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} });
|
||||
|
||||
var _oVarsPanel_;
|
||||
var showDynaformsFormVars = function(sFieldName, sAjaxServer, sProcess, sSymbol) {
|
||||
_oVarsPanel_ = new leimnud.module.panel();
|
||||
@@ -54,27 +63,37 @@ var showDynaformsFormVars = function(sFieldName, sAjaxServer, sProcess, sSymbol)
|
||||
};
|
||||
|
||||
var insertFormVar = function(sFieldName, sValue) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
_oVarsPanel_.remove();
|
||||
//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);
|
||||
} else {
|
||||
triggerEditor.replaceSelection(sValue);
|
||||
}
|
||||
_oVarsPanel_.remove();
|
||||
triggerEditor.focus();
|
||||
triggerEditor.focusIfIE();
|
||||
};
|
||||
|
||||
function cancel(){
|
||||
currentPopupWindow.remove();
|
||||
}
|
||||
|
||||
|
||||
]]></JS>
|
||||
</dynaForm>
|
||||
</dynaForm>
|
||||
|
||||
Reference in New Issue
Block a user