Plugin do logowania.
[redakcja.git] / project / templates / explorer / panels / xmleditor.html
index 356b76c..350f6e8 100644 (file)
@@ -1,14 +1,42 @@
-<div class="panel">
-    <textarea name="text" width="480px"><ala><ma></ma></ala></textarea>
+{% load toolbar_tags %}
+
+{% toolbar %}
+<div class="iframe-container" style="position: absolute; top: 48px; left:0px; right:0px; bottom: 0px;">
+       <textarea name="text">{{ text }}</textarea>
 </div>
+
 <script type="text/javascript" charset="utf-8">
+(function() {
+       function xmleditor_onload(event, me) {
+               $.log('loading: ', me);
+               var textareaId = 'xmleditor-' + Math.ceil(Math.random() * 1000000000);
+               $('textarea', panel).attr('id', textareaId);
+               var editor = CodeMirror.fromTextArea(textareaId, {
+                       parserfile: 'parsexml.js',
+                       path: "/static/js/codemirror/",
+                       stylesheet: "/static/css/xmlcolors.css",
+                       parserConfig: {useHTMLKludges: false},
+               })
+               $.log('Frame is: ', editor.frame);
+               var frame = $(editor.frame)
+               frame.css({width: '100%', height: '100%', background: 'yellow'});
+       };
+
+       function xmleditor_onunload(event, me) {}
+
+       panel(xmleditor_onload, xmleditor_onunload);
+})();
+</script>
+
+<!-- <script type="text/javascript" charset="utf-8">
     (function() {
-        var self = null;
-        var id = Math.ceil(Math.random() * 1000000000);
+        function resizeEditor(event, panel) {
+            var panel = panel || event.data.panel;
+            $('iframe', panel).height($(panel).height());
+        }
         
-        var load = function(event, panel) {
-            console.log('loading panel', panel);
-            self = panel;
+        panel(function(event, panel) {
+            $.log('loading panel', panel);
             var textareaId = 'xmleditor-' + Math.ceil(Math.random() * 1000000000);
             $('textarea', panel).attr('id', textareaId);
             var editor = CodeMirror.fromTextArea(textareaId, {
                 parserConfig: {useHTMLKludges: false},
                 initCallback: function() {}
             })
-            $(document).unbind('panel:load.' + id, load);
-        }
-        
-        var unload = function(event, panel) {
-            console.log('unload event!', panel, self);
-            if (panel == self) {
-                console.log('unloading panel', self);
-                $(document).unbind('panel:unload.' + id, unload);
-            }
-        };
-        
-        $(document).bind('panel:load.' + id, load);
-        $(document).bind('panel:unload.' + id, unload);
+            $(window).bind('resize', {'panel': panel}, resizeEditor);
+            resizeEditor(null, panel);
+        }, function(event, panel) {
+            $.log('unloaded xmleditor panel', panel);
+        })
     })();
-</script>
+</script> -->