rng.modules.sourceEditor = function(sandbox) {\r
\r
+ var view = $(sandbox.getTemplate('main')());\r
+ var isDirty = false;\r
+ \r
+ $('textarea', view).on('keyup', function() {\r
+ isDirty = true;\r
+ });\r
+ \r
return {\r
start: function() {\r
+ sandbox.publish('ready');\r
+ },\r
+ getView: function() {\r
+ return view;\r
+ },\r
+ setDocument: function(document) {\r
+ $('textarea', view).val(document);\r
+ isDirty = false;\r
+ },\r
+ getDocument: function() {\r
+ return $('textarea', view).val();\r
+ },\r
+ isDirty: function() {\r
+ return isDirty;\r
+ },\r
+ setDirty: function(dirty) {\r
+ isDirty = dirty;\r
}\r
\r
}\r