|
@ -6,6 +6,7 @@ var editor = CodeMirror(document.body, { |
|
|
autofocus: true, |
|
|
autofocus: true, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
editor.setOption("theme", "solarized dark"); |
|
|
editor.setOption("theme", "solarized dark"); |
|
|
editor.setOption("indentUnit", 4); |
|
|
editor.setOption("indentUnit", 4); |
|
|
editor.setOption("indentWithTabs", true); |
|
|
editor.setOption("indentWithTabs", true); |
|
@ -18,11 +19,24 @@ editor.on("change", function(eMirror, object) { |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var mac = /Mac/.test(navigator.platform); |
|
|
|
|
|
if (mac === true) { |
|
|
|
|
|
editor.setOption("extraKeys", { |
|
|
|
|
|
"Cmd-V": function(cm) { |
|
|
|
|
|
cm.replaceSelection(clipboard); |
|
|
|
|
|
}, |
|
|
|
|
|
"Cmd-X": function(cm) { |
|
|
|
|
|
window.document.execCommand("cut"); |
|
|
|
|
|
}, |
|
|
|
|
|
"Cmd-C": function(cm) { |
|
|
|
|
|
window.document.execCommand("copy"); |
|
|
|
|
|
}}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
getTextChanged = function() { |
|
|
getTextChanged = function() { |
|
|
return editor.changeRegistered; |
|
|
return editor.changeRegistered; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getText = function() { |
|
|
getText = function() { |
|
|
editor.changeRegistered = false; |
|
|
editor.changeRegistered = false; |
|
|
return editor.getValue(); |
|
|
return editor.getValue(); |
|
@ -42,3 +56,7 @@ setText = function(text) { |
|
|
setMode = function(mode) { |
|
|
setMode = function(mode) { |
|
|
this.editor.setOption("mode", mode); |
|
|
this.editor.setOption("mode", mode); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
setClipboardBase64 = function(text) { |
|
|
|
|
|
clipboard = window.atob(text); |
|
|
|
|
|
}; |
|
|