mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-26 04:51:08 -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 || {}
|
var CM = window.CM || {}
|
||||||
|
|
||||||
|
CM.on = false;
|
||||||
|
CM.mode = 'php';
|
||||||
|
|
||||||
CM.init = function() {
|
CM.init = function() {
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
|
if (CM.on) {
|
||||||
mode: $('#codemirror_mode').text(),
|
CM.editor.toTextArea();
|
||||||
lineNumbers: true,
|
CM.on = false;
|
||||||
lineWrapping: true,
|
} 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() {
|
$(document).ready(function() {
|
||||||
$enable_codemirror = $('#enable_codemirror');
|
$enable_codemirror = $('#enable_codemirror');
|
||||||
$enable_codemirror.click(function() {
|
$enable_codemirror.click(function() {
|
||||||
CM.init();
|
CM.init();
|
||||||
$enable_codemirror.remove();
|
//$enable_codemirror.remove();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user