Cleanup: removing unused code
[fnpeditor.git] / modules / sourceEditor / sourceEditor.js
1 define(function() {\r
2 \r
3 'use strict';\r
4 \r
5 return function(sandbox) {\r
6 \r
7     var view = $(sandbox.getTemplate('main')());\r
8     \r
9     var editor = ace.edit(view.find('#rng-sourceEditor-editor')[0]);\r
10     editor.setTheme("ace/theme/chrome");\r
11     editor.getSession().setMode("ace/mode/xml");\r
12     $('textarea', view).on('keyup', function() {\r
13         sandbox.publish('xmlChanged');\r
14     });\r
15     \r
16     editor.getSession().on('change', function() {\r
17         sandbox.publish('xmlChanged');\r
18     })\r
19     return {\r
20         start: function() {\r
21             sandbox.publish('ready');\r
22         },\r
23         getView: function() {\r
24             return view;\r
25         },\r
26         setDocument: function(document) {\r
27             editor.setValue(document);\r
28             editor.gotoLine(0)\r
29             sandbox.publish('documentSet');\r
30         },\r
31         getDocument: function() {\r
32             return editor.getValue();\r
33         }\r
34     }\r
35 };\r
36 \r
37 });