mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-25 20:41:20 -05:00
todo. proof of concept, dynamic loading of various languages #codemirror --> WORKS!
This commit is contained in:
parent
3fe74f810e
commit
cd4d2b676e
@ -1,18 +1,30 @@
|
||||
var CM = window.CM || {}
|
||||
|
||||
CM.on = false;
|
||||
CM.mode = 'php';
|
||||
|
||||
CM.init = function() {
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
|
||||
mode: $('#codemirror_mode').text(),
|
||||
if (CM.on) {
|
||||
CM.editor.toTextArea();
|
||||
CM.on = false;
|
||||
} else {
|
||||
CM.editor = CodeMirror.fromTextArea(document.getElementById('code'), {
|
||||
mode: CM.mode, //$('#codemirror_mode').text(),
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
});
|
||||
CM.on = true;
|
||||
if (CM.mode == 'php') {
|
||||
CM.mode = 'javascript';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
$enable_codemirror = $('#enable_codemirror');
|
||||
$enable_codemirror.click(function() {
|
||||
CM.init();
|
||||
$enable_codemirror.remove();
|
||||
//$enable_codemirror.remove();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user