X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/5fbecb65c701a7680aae9258ff16df6a1e9f35f5..a09318d74185278fa556af4a997e94b0d6999193:/modules/sourceEditor.js?ds=inline diff --git a/modules/sourceEditor.js b/modules/sourceEditor.js index ea84ee3..787bfb9 100644 --- a/modules/sourceEditor.js +++ b/modules/sourceEditor.js @@ -1,11 +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 $('

source editor

'); + 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; } }