mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-26 04:51:08 -05:00
dynamic loading works. #syntax #highlighting
This commit is contained in:
parent
1342992636
commit
e503c4af89
@ -4,15 +4,12 @@ CM.enabled = false;
|
|||||||
|
|
||||||
CM.init = function() {
|
CM.init = function() {
|
||||||
CM.modes = $.parseJSON($('#codemirror_modes').text());
|
CM.modes = $.parseJSON($('#codemirror_modes').text());
|
||||||
$enable_codemirror = $('#enable_codemirror');
|
$('#enable_codemirror').click(function() {
|
||||||
|
|
||||||
$enable_codemirror.click(function() {
|
|
||||||
|
|
||||||
//todo: no rebind
|
|
||||||
$('#lang').change(function() {
|
$('#lang').change(function() {
|
||||||
CM.set_language();
|
CM.set_language();
|
||||||
});
|
});
|
||||||
CM.toggle();
|
CM.toggle();
|
||||||
|
CM.set_language();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -22,6 +19,7 @@ CM.toggle = function() {
|
|||||||
CM.editor.toTextArea();
|
CM.editor.toTextArea();
|
||||||
CM.editor = undefined;
|
CM.editor = undefined;
|
||||||
$('#lang').unbind();
|
$('#lang').unbind();
|
||||||
|
$('#enable_codemirror').text('Enable syntax highlighting');
|
||||||
CM.enabled = false;
|
CM.enabled = false;
|
||||||
} else {
|
} else {
|
||||||
if (typeof CM.editor == 'undefined') {
|
if (typeof CM.editor == 'undefined') {
|
||||||
@ -30,11 +28,13 @@ CM.toggle = function() {
|
|||||||
lineWrapping: true,
|
lineWrapping: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
$('#enable_codemirror').text('Disable syntax highlighting');
|
||||||
CM.enabled = true;
|
CM.enabled = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CM.set_language = function() {
|
CM.set_language = function() {
|
||||||
|
if (CM.enabled) {
|
||||||
var lang = $('#lang').val();
|
var lang = $('#lang').val();
|
||||||
mode = CM.modes[lang];
|
mode = CM.modes[lang];
|
||||||
|
|
||||||
@ -47,6 +47,7 @@ CM.set_language = function() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'script');
|
'script');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CM.set_syntax = function(mode) {
|
CM.set_syntax = function(mode) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user