history wip - displaying history items
[fnpeditor.git] / modules / sourceEditor / sourceEditor.js
index 248c02d..431fcb8 100644 (file)
@@ -1,19 +1,20 @@
 define(function() {\r
 \r
+'use strict';\r
+\r
 return function(sandbox) {\r
 \r
     var view = $(sandbox.getTemplate('main')());\r
-    var isDirty = false;\r
     \r
     var editor = ace.edit(view.find('#rng-sourceEditor-editor')[0]);\r
     editor.setTheme("ace/theme/chrome");\r
     editor.getSession().setMode("ace/mode/xml");\r
     $('textarea', view).on('keyup', function() {\r
-        isDirty = true;\r
+        sandbox.publish('xmlChanged');\r
     });\r
     \r
     editor.getSession().on('change', function() {\r
-        isDirty = true;\r
+        sandbox.publish('xmlChanged');\r
     })\r
     return {\r
         start: function() {\r
@@ -25,18 +26,11 @@ return function(sandbox) {
         setDocument: function(document) {\r
             editor.setValue(document);\r
             editor.gotoLine(0)\r
-            isDirty = false;\r
+            sandbox.publish('documentSet');\r
         },\r
         getDocument: function() {\r
             return editor.getValue();\r
-        },\r
-        isDirty: function() {\r
-            return isDirty;\r
-        },\r
-        setDirty: function(dirty) {\r
-            isDirty = dirty;\r
         }\r
-    \r
     }\r
 };\r
 \r