* Better "motto" display.
[redakcja.git] / platforma / static / js / wiki / view_editor_source.js
index 9dffaf0..0acd2cd 100644 (file)
                                },
                                iframeClass: 'xml-iframe',
                                textWrapping: true,
-                               lineNumbers: false,
+                               lineNumbers: true,
                                width: "100%",
                                tabMode: 'spaces',
                                indentUnit: 0,
                                initCallback: function(){
 
-                                        self.codemirror.grabKeys(function(event) {
+                                       self.codemirror.grabKeys(function(event) {
                                                if (event.button) {
                                                        $(event.button).trigger('click');
                                                        event.button = null;
                                        $('.toolbar select').change();
 
                                        console.log("Initialized CodeMirror");
+                                       
                                        // textarea is no longer needed
                                        $('codemirror_placeholder').remove();
+                                       
                                        old_callback.call(self);
                                }
                        });
        CodeMirrorPerspective.prototype.freezeState = function() {
 
        };
+       
+       
 
        CodeMirrorPerspective.prototype.onEnter = function(success, failure) {
                $.wiki.Perspective.prototype.onEnter.call(this);
 
                console.log('Entering', this.doc);
                this.codemirror.setCode(this.doc.text);
+               
+               /* fix line numbers bar */
+               var $nums = $('.CodeMirror-line-numbers');
+           var barWidth = $nums.width();
+               
+               $(this.codemirror.frame).css('margin-left', barWidth);
+               $nums.css('left', -barWidth);
+               
+               $(this.codemirror.frame.contentWindow).trigger('resize');
                if(success) success();
        }