5 return function(sandbox) {
 
   7     var view = $(sandbox.getTemplate('main')());
 
   9     var editor = ace.edit(view.find('#rng-sourceEditor-editor')[0]),
 
  10         session = editor.getSession();
 
  11     editor.setTheme("ace/theme/chrome");
 
  12     session.setMode("ace/mode/xml")
 
  13     session.setUseWrapMode(true);
 
  15     $('textarea', view).on('keyup', function() {
 
  16         sandbox.publish('xmlChanged');
 
  19     editor.getSession().on('change', function() {
 
  20         sandbox.publish('xmlChanged');
 
  24             sandbox.publish('ready');
 
  29         setDocument: function(document) {
 
  30             editor.setValue(document);
 
  32             sandbox.publish('documentSet');
 
  34         getDocument: function() {
 
  35             return editor.getValue();