X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/a5871ab5512d87a33e7e95451d26ee7d3e789742..1aba836313d1513bbe0ca947e01176806c900233:/modules/sourceEditor.js?ds=sidebyside diff --git a/modules/sourceEditor.js b/modules/sourceEditor.js index 59b663e..787bfb9 100644 --- a/modules/sourceEditor.js +++ b/modules/sourceEditor.js @@ -1,7 +1,31 @@ rng.modules.sourceEditor = function(sandbox) { + var view = $(sandbox.getTemplate('main')()); + var isDirty = false; + + $('textarea', view).on('keyup', function() { + isDirty = true; + }); + return { start: function() { + sandbox.publish('ready'); + }, + getView: function() { + return view; + }, + setDocument: function(document) { + $('textarea', view).val(document); + isDirty = false; + }, + getDocument: function() { + return $('textarea', view).val(); + }, + isDirty: function() { + return isDirty; + }, + setDirty: function(dirty) { + isDirty = dirty; } }