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