处理codemirror缩进问题
This commit is contained in:
parent
f7d4fdb984
commit
734e9ad110
@ -366,6 +366,23 @@
|
|||||||
var form = layui.form;
|
var form = layui.form;
|
||||||
var laytpl = layui.laytpl;
|
var laytpl = layui.laytpl;
|
||||||
var viewerObj = {};
|
var viewerObj = {};
|
||||||
|
var codeMirrorConfig = {
|
||||||
|
lineNumbers: true,
|
||||||
|
theme: 'dracula',
|
||||||
|
matchBrackets: true,
|
||||||
|
indentUnit : 4,
|
||||||
|
tabSize : 4,
|
||||||
|
extraKeys: {
|
||||||
|
'Shift-Tab': function (cm) {
|
||||||
|
if (cm.somethingSelected()) {
|
||||||
|
cm.indentSelection('subtract');
|
||||||
|
} else {
|
||||||
|
cm.indentLine(cm.getCursor().line, "subtract");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function closeBox() {
|
function closeBox() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||||
@ -511,54 +528,39 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initFormHtml() {
|
function initFormHtml() {
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById('formHtml'), {
|
var editor = CodeMirror.fromTextArea(document.getElementById('formHtml'), codeMirrorConfig);
|
||||||
lineNumbers: true,
|
|
||||||
theme: 'dracula'
|
|
||||||
});
|
|
||||||
editor.on('change', function(self, changeValue) {
|
editor.on('change', function(self, changeValue) {
|
||||||
$('#formHtml').val(self.getValue());
|
$('#formHtml').val(self.getValue());
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function initFormCss() {
|
function initFormCss() {
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById('formCss'), {
|
codeMirrorConfig.mode = 'css';
|
||||||
lineNumbers: true,
|
var editor = CodeMirror.fromTextArea(document.getElementById('formCss'), codeMirrorConfig);
|
||||||
mode: 'css',
|
|
||||||
theme: 'dracula',
|
|
||||||
});
|
|
||||||
editor.on('change', function(self, changeValue) {
|
editor.on('change', function(self, changeValue) {
|
||||||
$('#formCss').val(self.getValue());
|
$('#formCss').val(self.getValue());
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function initFormLeftCss() {
|
function initFormLeftCss() {
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById('formLeftCss'), {
|
codeMirrorConfig.mode = 'css';
|
||||||
lineNumbers: true,
|
var editor = CodeMirror.fromTextArea(document.getElementById('formLeftCss'), codeMirrorConfig);
|
||||||
mode: 'css',
|
|
||||||
theme: 'dracula'
|
|
||||||
});
|
|
||||||
editor.on('change', function(self, changeValue) {
|
editor.on('change', function(self, changeValue) {
|
||||||
$('#formLeftCss').val(self.getValue());
|
$('#formLeftCss').val(self.getValue());
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function initFormCenterCss() {
|
function initFormCenterCss() {
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById('formCenterCss'), {
|
codeMirrorConfig.mode = 'css';
|
||||||
lineNumbers: true,
|
var editor = CodeMirror.fromTextArea(document.getElementById('formCenterCss'), codeMirrorConfig);
|
||||||
mode: 'css',
|
|
||||||
theme: 'dracula'
|
|
||||||
});
|
|
||||||
editor.on('change', function(self, changeValue) {
|
editor.on('change', function(self, changeValue) {
|
||||||
$('#formCenterCss').val(self.getValue());
|
$('#formCenterCss').val(self.getValue());
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function initFormRightCss() {
|
function initFormRightCss() {
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById('formRightCss'), {
|
codeMirrorConfig.mode = 'css';
|
||||||
lineNumbers: true,
|
var editor = CodeMirror.fromTextArea(document.getElementById('formRightCss'), codeMirrorConfig);
|
||||||
mode: 'css',
|
|
||||||
theme: 'dracula'
|
|
||||||
});
|
|
||||||
editor.on('change', function(self, changeValue) {
|
editor.on('change', function(self, changeValue) {
|
||||||
$('#formRightCss').val(self.getValue());
|
$('#formRightCss').val(self.getValue());
|
||||||
})
|
})
|
||||||
|
@ -368,6 +368,23 @@
|
|||||||
var laytpl = layui.laytpl;
|
var laytpl = layui.laytpl;
|
||||||
var loginFormId = top.restAjax.params(window.location.href).loginFormId;
|
var loginFormId = top.restAjax.params(window.location.href).loginFormId;
|
||||||
var viewerObj = {};
|
var viewerObj = {};
|
||||||
|
var codeMirrorConfig = {
|
||||||
|
lineNumbers: true,
|
||||||
|
theme: 'dracula',
|
||||||
|
matchBrackets: true,
|
||||||
|
indentUnit : 4,
|
||||||
|
tabSize : 4,
|
||||||
|
extraKeys: {
|
||||||
|
'Shift-Tab': function (cm) {
|
||||||
|
if (cm.somethingSelected()) {
|
||||||
|
cm.indentSelection('subtract');
|
||||||
|
} else {
|
||||||
|
cm.indentLine(cm.getCursor().line, "subtract");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function closeBox() {
|
function closeBox() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||||
@ -513,10 +530,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initFormHtml(value) {
|
function initFormHtml(value) {
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById('formHtml'), {
|
var editor = CodeMirror.fromTextArea(document.getElementById('formHtml'), codeMirrorConfig);
|
||||||
lineNumbers: true,
|
|
||||||
theme: 'dracula'
|
|
||||||
});
|
|
||||||
editor.setValue(value);
|
editor.setValue(value);
|
||||||
editor.on('change', function(self, changeValue) {
|
editor.on('change', function(self, changeValue) {
|
||||||
$('#formHtml').val(self.getValue());
|
$('#formHtml').val(self.getValue());
|
||||||
@ -524,11 +538,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initFormCss(value) {
|
function initFormCss(value) {
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById('formCss'), {
|
codeMirrorConfig.mode = 'css';
|
||||||
lineNumbers: true,
|
var editor = CodeMirror.fromTextArea(document.getElementById('formCss'), codeMirrorConfig);
|
||||||
mode: 'css',
|
|
||||||
theme: 'dracula',
|
|
||||||
});
|
|
||||||
editor.setValue(value);
|
editor.setValue(value);
|
||||||
editor.on('change', function(self, changeValue) {
|
editor.on('change', function(self, changeValue) {
|
||||||
$('#formCss').val(self.getValue());
|
$('#formCss').val(self.getValue());
|
||||||
@ -536,11 +547,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initFormLeftCss(value) {
|
function initFormLeftCss(value) {
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById('formLeftCss'), {
|
codeMirrorConfig.mode = 'css';
|
||||||
lineNumbers: true,
|
var editor = CodeMirror.fromTextArea(document.getElementById('formLeftCss'), codeMirrorConfig);
|
||||||
mode: 'css',
|
|
||||||
theme: 'dracula'
|
|
||||||
});
|
|
||||||
editor.setValue(value);
|
editor.setValue(value);
|
||||||
editor.on('change', function(self, changeValue) {
|
editor.on('change', function(self, changeValue) {
|
||||||
$('#formLeftCss').val(self.getValue());
|
$('#formLeftCss').val(self.getValue());
|
||||||
@ -548,11 +556,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initFormCenterCss(value) {
|
function initFormCenterCss(value) {
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById('formCenterCss'), {
|
codeMirrorConfig.mode = 'css';
|
||||||
lineNumbers: true,
|
var editor = CodeMirror.fromTextArea(document.getElementById('formCenterCss'), codeMirrorConfig);
|
||||||
mode: 'css',
|
|
||||||
theme: 'dracula'
|
|
||||||
});
|
|
||||||
editor.setValue(value);
|
editor.setValue(value);
|
||||||
editor.on('change', function(self, changeValue) {
|
editor.on('change', function(self, changeValue) {
|
||||||
$('#formCenterCss').val(self.getValue());
|
$('#formCenterCss').val(self.getValue());
|
||||||
@ -560,11 +565,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initFormRightCss(value) {
|
function initFormRightCss(value) {
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById('formRightCss'), {
|
codeMirrorConfig.mode = 'css';
|
||||||
lineNumbers: true,
|
var editor = CodeMirror.fromTextArea(document.getElementById('formRightCss'), codeMirrorConfig);
|
||||||
mode: 'css',
|
|
||||||
theme: 'dracula'
|
|
||||||
});
|
|
||||||
editor.setValue(value);
|
editor.setValue(value);
|
||||||
editor.on('change', function(self, changeValue) {
|
editor.on('change', function(self, changeValue) {
|
||||||
$('#formRightCss').val(self.getValue());
|
$('#formRightCss').val(self.getValue());
|
||||||
|
Loading…
Reference in New Issue
Block a user