From 470de3b144d05f5d3cc530442ffebe37c21c50ca Mon Sep 17 00:00:00 2001 From: zuber Date: Thu, 24 Sep 2009 22:05:15 +0200 Subject: [PATCH 1/1] =?utf8?q?Dzia=C5=82aj=C4=85cy=20edytor=20CodeMirror.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- project/static/css/master.css | 8 ++++++++ project/static/js/views/xml.js | 24 +++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/project/static/css/master.css b/project/static/css/master.css index 6ac36967..1a110b51 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -359,3 +359,11 @@ text#commit-dialog-message { height: 100%; background-color: #CCC; } + +.panel-container { + height: 100%; +} + +.xmlview { + height: 100%; +} diff --git a/project/static/js/views/xml.js b/project/static/js/views/xml.js index 529253b4..4ed9fc0a 100644 --- a/project/static/js/views/xml.js +++ b/project/static/js/views/xml.js @@ -1,12 +1,34 @@ -/*global Class render_template panels */ +/*global Class CodeMirror render_template panels */ var XMLView = Class.extend({ element: null, template: 'xml-view-template', + editor: null, init: function(element, template) { this.element = $(element); this.template = template || this.template; this.element.html(render_template(this.template, {})); + + var self = this; + this.editor = CodeMirror.fromTextArea($('textarea', this.element)[0], { + parserfile: 'parsexml.js', + path: "/static/js/lib/codemirror/", + stylesheet: "/static/css/xmlcolors.css", + parserConfig: {useHTMLKludges: false}, + // onChange: function() { + // self.fireEvent('contentChanged'); + // }, + initCallback: function(editor) { + console.log('whatever'); + // editor.grabKeys( + // $.fbind(self, self.hotkeyPressed), + // $.fbind(self, self.isHotkey) + // ); + editor.setCode('Ala ma kota a kot ma Alę!'); + } + }); + console.log(this.editor); + $(this.editor.frame).css({width: '100%', height: '100%'}); }, dispose: function() { -- 2.20.1