Merge branch 'lq-editor-refactor'
[redakcja.git] / project / templates / explorer / panels / xmleditor.html
1 {% load toolbar_tags %}
2
3 {% toolbar %}
4 <div class="iframe-container" style="position: absolute; top: 48px; left:0px; right:0px; bottom: 0px;">
5         <textarea name="text">{{ text }}</textarea>
6 </div>
7
8 <script type="text/javascript" charset="utf-8">
9 (function() {
10         function xmleditor_onload(event, me) {
11                 console.log('loading: ', me);
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                 })
20                 console.log('Frame is: ', editor.frame);
21                 var frame = $(editor.frame)
22                 frame.css({width: '100%', height: '100%', background: 'yellow'});
23         };
24
25         function xmleditor_onunload(event, me) {}
26
27         panel(xmleditor_onload, xmleditor_onunload);
28 })();
29 </script>
30
31 <!-- <script type="text/javascript" charset="utf-8">
32     (function() {
33         function resizeEditor(event, panel) {
34             var panel = panel || event.data.panel;
35             $('iframe', panel).height($(panel).height());
36         }
37         
38         panel(function(event, panel) {
39             console.log('loading panel', panel);
40             var textareaId = 'xmleditor-' + Math.ceil(Math.random() * 1000000000);
41             $('textarea', panel).attr('id', textareaId);
42             var editor = CodeMirror.fromTextArea(textareaId, {
43                 parserfile: 'parsexml.js',
44                 path: "/static/js/codemirror/",
45                 stylesheet: "/static/css/xmlcolors.css",
46                 parserConfig: {useHTMLKludges: false},
47                 initCallback: function() {}
48             })
49             $(window).bind('resize', {'panel': panel}, resizeEditor);
50             resizeEditor(null, panel);
51         }, function(event, panel) {
52             console.log('unloaded xmleditor panel', panel);
53         })
54     })();
55 </script> -->