1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| <div>
<link rel="stylesheet" href="../ext/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="../ext/codemirror/src/inlet.css">
<link rel="stylesheet" href="../ext/codemirror/theme/monokai.css">
<style type="text/css">
.CodeMirror {
background: #f8f8f8;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
height: auto;
}
.CodeMirror-scroll {
overflow-y: hidden;
overflow-x: auto;
}
</style>
<?php
echo HTML::hiddenField('directory_css', $directory_selected);
echo HTML::hiddenField('filename', $filename_selected);
echo HTML::textAreaField('code', $code, '', '', 'id="code"');
?>
<script src="../ext/codemirror/lib/codemirror.js"></script>
<script src="../ext/codemirror/mode/css/css.js"></script>
<script src="../ext/codemirror/addon/selection/active-line.js"></script>
<script src="../ext/codemirror/src/inlet.js"></script>
<script src="../ext/codemirror/src/thistle/thistle.js"></script>
<script>
(function() {
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
styleActiveLine: true,
lineNumbers: true,
lineWrapping: true,
viewportMargin: Infinity
});
document.getElementsByClassName('CodeMirror')[0].className += ' cm-s-monokai';
editor.on("change", changeFunction)
function changeFunction() {
var value = editor.getValue();
};
changeFunction();
var inlet = Inlet(editor);
})();
</script> |
Partager