356b76c19c04af5cbc30e2dd8f19eaaf8080141e
[redakcja.git] / project / templates / explorer / panels / xmleditor.html
1 <div class="panel">
2     <textarea name="text" width="480px"><ala><ma></ma></ala></textarea>
3 </div>
4 <script type="text/javascript" charset="utf-8">
5     (function() {
6         var self = null;
7         var id = Math.ceil(Math.random() * 1000000000);
8         
9         var load = function(event, panel) {
10             console.log('loading panel', panel);
11             self = panel;
12             var textareaId = 'xmleditor-' + Math.ceil(Math.random() * 1000000000);
13             $('textarea', panel).attr('id', textareaId);
14             var editor = CodeMirror.fromTextArea(textareaId, {
15                 parserfile: 'parsexml.js',
16                 path: "/static/js/codemirror/",
17                 stylesheet: "/static/css/xmlcolors.css",
18                 parserConfig: {useHTMLKludges: false},
19                 initCallback: function() {}
20             })
21             $(document).unbind('panel:load.' + id, load);
22         }
23         
24         var unload = function(event, panel) {
25             console.log('unload event!', panel, self);
26             if (panel == self) {
27                 console.log('unloading panel', self);
28                 $(document).unbind('panel:unload.' + id, unload);
29             }
30         };
31         
32         $(document).bind('panel:load.' + id, load);
33         $(document).bind('panel:unload.' + id, unload);
34     })();
35 </script>