##// END OF EJS Templates
set edit mode on gists
marcink -
r4027:4eaeae84 default
parent child Browse files
Show More
@@ -7,6 +7,8
7 7
8 8 <%def name="js_extra()">
9 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 12 </%def>
11 13 <%def name="css_extra()">
12 14 <link rel="stylesheet" type="text/css" href="${h.url('/css/codemirror.css')}"/>
@@ -37,11 +39,12
37 39 <textarea style="resize:vertical; width:400px;border: 1px solid #ccc;border-radius: 3px;" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea>
38 40 </div>
39 41 <div id="body" class="codeblock">
40 <div style="padding: 10px 10px 10px 22px;color:#666666">
42 <div style="padding: 10px 10px 10px 26px;color:#666666">
41 43 ##<input type="text" value="" size="30" name="filename" id="filename" placeholder="gistfile1.txt">
42 44 ${h.text('filename', size=30, placeholder='gistfile1.txt')}
43 45 ##<input type="text" value="" size="30" name="filename" id="filename" placeholder="gistfile1.txt">
44 46 ${h.select('lifetime', '', c.lifetime_options)}
47 ${h.select('set_mode','plain',[('plain',_('plain'))])}
45 48 </div>
46 49 <div id="editor_container">
47 50 <pre id="editor_pre"></pre>
@@ -55,7 +58,21
55 58 </div>
56 59 ${h.end_form()}
57 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 76 </script>
60 77 </div>
61 78 </div>
General Comments 0
You need to be logged in to leave comments. Login now