Show More
@@ -7,6 +7,8 | |||||
7 |
|
7 | |||
8 | <%def name="js_extra()"> |
|
8 | <%def name="js_extra()"> | |
9 | <script type="text/javascript" src="${h.url('/js/codemirror.js')}"></script> |
|
9 | <script type="text/javascript" src="${h.url('/js/codemirror.js')}"></script> | |
|
10 | <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script> | |||
|
11 | <script type="text/javascript" src="${h.url('/js/mode/meta.js')}"></script> | |||
10 | </%def> |
|
12 | </%def> | |
11 | <%def name="css_extra()"> |
|
13 | <%def name="css_extra()"> | |
12 | <link rel="stylesheet" type="text/css" href="${h.url('/css/codemirror.css')}"/> |
|
14 | <link rel="stylesheet" type="text/css" href="${h.url('/css/codemirror.css')}"/> | |
@@ -37,11 +39,12 | |||||
37 | <textarea style="resize:vertical; width:400px;border: 1px solid #ccc;border-radius: 3px;" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea> |
|
39 | <textarea style="resize:vertical; width:400px;border: 1px solid #ccc;border-radius: 3px;" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea> | |
38 | </div> |
|
40 | </div> | |
39 | <div id="body" class="codeblock"> |
|
41 | <div id="body" class="codeblock"> | |
40 |
<div style="padding: 10px 10px 10px 2 |
|
42 | <div style="padding: 10px 10px 10px 26px;color:#666666"> | |
41 | ##<input type="text" value="" size="30" name="filename" id="filename" placeholder="gistfile1.txt"> |
|
43 | ##<input type="text" value="" size="30" name="filename" id="filename" placeholder="gistfile1.txt"> | |
42 | ${h.text('filename', size=30, placeholder='gistfile1.txt')} |
|
44 | ${h.text('filename', size=30, placeholder='gistfile1.txt')} | |
43 | ##<input type="text" value="" size="30" name="filename" id="filename" placeholder="gistfile1.txt"> |
|
45 | ##<input type="text" value="" size="30" name="filename" id="filename" placeholder="gistfile1.txt"> | |
44 | ${h.select('lifetime', '', c.lifetime_options)} |
|
46 | ${h.select('lifetime', '', c.lifetime_options)} | |
|
47 | ${h.select('set_mode','plain',[('plain',_('plain'))])} | |||
45 | </div> |
|
48 | </div> | |
46 | <div id="editor_container"> |
|
49 | <div id="editor_container"> | |
47 | <pre id="editor_pre"></pre> |
|
50 | <pre id="editor_pre"></pre> | |
@@ -55,7 +58,21 | |||||
55 | </div> |
|
58 | </div> | |
56 | ${h.end_form()} |
|
59 | ${h.end_form()} | |
57 | <script type="text/javascript"> |
|
60 | <script type="text/javascript"> | |
58 | initCodeMirror('editor',''); |
|
61 | var myCodeMirror = initCodeMirror('editor', ''); | |
|
62 | CodeMirror.modeURL = "${h.url('/js/mode/%N/%N.js')}"; | |||
|
63 | ||||
|
64 | //inject new modes | |||
|
65 | var modes_select = YUD.get('set_mode'); | |||
|
66 | for(var i=0;i<CodeMirror.modeInfo.length;i++){ | |||
|
67 | var m = CodeMirror.modeInfo[i]; | |||
|
68 | var opt = new Option(m.name, m.mode); | |||
|
69 | modes_select.options[i+1] = opt | |||
|
70 | } | |||
|
71 | YUE.on(modes_select, 'change', function(e){ | |||
|
72 | var selected = e.currentTarget; | |||
|
73 | var new_mode = selected.options[selected.selectedIndex].value; | |||
|
74 | setCodeMirrorMode(myCodeMirror, new_mode); | |||
|
75 | }) | |||
59 | </script> |
|
76 | </script> | |
60 | </div> |
|
77 | </div> | |
61 | </div> |
|
78 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now