nitlight_aas: use codemirror as editor
authorJean Privat <jean@pryen.org>
Thu, 23 Jun 2016 18:04:18 +0000 (14:04 -0400)
committerJean Privat <jean@pryen.org>
Thu, 23 Jun 2016 18:04:18 +0000 (14:04 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/examples/nitlight_as_a_service.nit

index fa95f6c..7e68dc9 100644 (file)
@@ -92,6 +92,7 @@ class HighlightAction
 
                page.add """
                <!doctype html><html><head>{{{hl.head_content}}}
+               <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.16.0/codemirror.css">
                <style>
                        {{{hl.css_content}}}
                        textarea {width:100%;}
@@ -120,7 +121,15 @@ class HighlightAction
                end
 
                page.add hl.foot_content
+
+               # Call codemirror
                page.add """
+               <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.16.0/codemirror.min.js"></script>
+               <script>
+               var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+                       lineNumbers: true
+               });
+               </script>
                </body></html>
                """