ef5976c50156a03e31f04de981380dd882cb855b
[redakcja.git] / project / templates / explorer / panels / xmleditor.html
1 {% load toolbar_tags %}
2
3 <div class="panel">
4     {% toolbar %}
5     <textarea name="text" width="480px">{{ text }}</textarea>
6 </div>
7 <script type="text/javascript" charset="utf-8">
8     (function() {
9         function resizeEditor(event, panel) {
10             var panel = panel || event.data.panel;
11             $('iframe', panel).height($(panel).height());
12         }
13         
14         panel(function(event, panel) {
15             console.log('loading panel', panel);
16             var textareaId = 'xmleditor-' + Math.ceil(Math.random() * 1000000000);
17             $('textarea', panel).attr('id', textareaId);
18             var editor = CodeMirror.fromTextArea(textareaId, {
19                 parserfile: 'parsexml.js',
20                 path: "/static/js/codemirror/",
21                 stylesheet: "/static/css/xmlcolors.css",
22                 parserConfig: {useHTMLKludges: false},
23                 initCallback: function() {}
24             })
25             $(window).bind('resize', {'panel': panel}, resizeEditor);
26             resizeEditor(null, panel);
27         }, function(event, panel) {
28             console.log('unloaded xmleditor panel', panel);
29         })
30     })();
31 </script>