user3032715 user3032715 - 22 days ago 7
HTML Question

codemirror how to install

I am not sure what to do after this:

<link rel="stylesheet" href="lib/codemirror.css">
<script src="lib/codemirror.js"></script>
<script>
var editor = CodeMirror.fromTextArea(myTextarea, {
mode: "text/html"
});
</script>


can someone help me?

Answer Source

does this points you to the right direction?

        <link rel="stylesheet" href="lib/codemirror.css">
        <script src="lib/codemirror.js"></script>
        <script src="mode/javascript/javascript.js"></script>
        <script src="addon/fold/foldcode.js"></script>
    </head>
    <body>
        <form style="width:500px;">
            <textarea id="code" name="code">
alert("HI");
//says HII
            </textarea>
        </form>

        <script>
            window.onload = function() {
                window.editor = CodeMirror.fromTextArea(code, {
                    mode: "javascript",
                    lineNumbers: true,
                    lineWrapping: true,
                    foldGutter: {
                        rangeFinder: new CodeMirror.fold.combine(CodeMirror.fold.brace, CodeMirror.fold.comment)
                    },
                    gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
                });
            };
        </script>
    </body>
</html>