4 function CodeMirrorPerspective(doc, callback)
6 this.perspective_id = 'CodeMirrorPerspective';
11 $('#source-editor .toolbar button').click(function(event){
12 event.preventDefault();
13 var params = eval("(" + $(this).attr('ui:action-params') + ")");
14 scriptletCenter.scriptlets[$(this).attr('ui:action')](editor, params);
17 $('.toolbar select').change(function(event){
18 var slug = $(this).val();
20 $('.toolbar-buttons-container').hide().filter('[data-group=' + slug + ']').show();
24 $('.toolbar-buttons-container').hide();
25 $('.toolbar select').change();
27 this.codemirror = CodeMirror.fromTextArea('codemirror_placeholder', {
28 parserfile: 'parsexml.js',
29 path: STATIC_URL + "js/lib/codemirror/",
30 stylesheet: STATIC_URL + "css/xmlcolors_15032010.css",
34 iframeClass: 'xml-iframe',
40 initCallback: function() {
41 console.log("Initialized CodeMirror");
48 CodeMirrorPerspective.prototype = new $.wiki.Perspective();
50 CodeMirrorPerspective.prototype.freezeState = function() {
54 CodeMirrorPerspective.prototype.onEnter = function(success, failure) {
55 $.wiki.Perspective.prototype.onEnter.call(this);
57 console.log(this.doc);
58 this.codemirror.setCode(this.doc.text);
59 if(success) success();
62 $.wiki.CodeMirrorPerspective = CodeMirrorPerspective;