笙默考试管理系统-MyExamTest----codemirror(40)
目录
一、 笙默考试管理系统-MyExamTest
二、 笙默考试管理系统-MyExamTest
三、 笙默考试管理系统-MyExamTest
四、 笙默考试管理系统-MyExamTest
五、 笙默考试管理系统-MyExamTest
function lookupKey(name, extraMap, map) {
function lookup(name, map, ft) {
var found = map[name];
if (found != null) return found;
if (ft == null) ft = map.fallthrough;
if (ft == null) return map.catchall;
if (typeof ft == "string") return lookup(name, keyMap[ft]);
for (var i = 0, e = ft.length; i < e; ++i) {
found = lookup(name, keyMap[ft[i]]);
if (found != null) return found;
}
return null;
}
return extraMap ? lookup(name, extraMap, map) : lookup(name, keyMap[map]);
}
function isModifierKey(event) {
var name = keyNames[event.keyCode];
return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod";
}
CodeMirror.fromTextArea = function(textarea, options) {
if (!options) options = {};
options.value = textarea.value;
if (!options.tabindex && textarea.tabindex)
options.tabindex = textarea.tabindex;
function save() {textarea.value = instance.getValue();}
if (textarea.form) {
// Deplorable hack to make the submit method do the right thing.
var rmSubmit = connect(textarea.form, "submit", save, true);
if (typeof textarea.form.submit == "function") {
var realSubmit = textarea.form.submit;
function wrappedSubmit() {
save();
textarea.form.submit = realSubmit;
textarea.form.submit();
textarea.form.submit = wrappedSubmit;
}
textarea.form.submit = wrappedSubmit;
}
}
textarea.style.display = "none";
var instance = CodeMirror(function(node) {
textarea.parentNode.insertBefore(node, textarea.nextSibling);
}, options);
instance.save = save;
instance.getTextArea = function() { return textarea; };
instance.toTextArea = function() {
save();
textarea.parentNode.removeChild(instance.getWrapperElement());
textarea.style.display = "";
if (textarea.form) {
rmSubmit();
if (typeof textarea.form.submit == "function")
textarea.form.submit = realSubmit;
}
};
return instance;
};
// Utility functions for working with state. Exported because modes
// sometimes need to do this.
function copyState(mode, state) {
if (state === true) return state;
if (mode.copyState) return mode.copyState(state);
var nstate = {};
for (var n in state) {
var val = state[n];
if (val instanceof Array) val = val.concat([]);
nstate[n] = val;
}
return nstate;
}