X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/ccd0a4f745a6fab17a228d822e80d8bbb6fa7d5d..969f365b3ee6d3cb54f98b23e1ebb97df9f801dd:/modules/sourceEditor/sourceEditor.js diff --git a/modules/sourceEditor/sourceEditor.js b/modules/sourceEditor/sourceEditor.js index 248c02d..1c18e75 100644 --- a/modules/sourceEditor/sourceEditor.js +++ b/modules/sourceEditor/sourceEditor.js @@ -1,20 +1,21 @@ define(function() { +'use strict'; + return function(sandbox) { var view = $(sandbox.getTemplate('main')()); - var isDirty = false; var editor = ace.edit(view.find('#rng-sourceEditor-editor')[0]); editor.setTheme("ace/theme/chrome"); editor.getSession().setMode("ace/mode/xml"); $('textarea', view).on('keyup', function() { - isDirty = true; + sandbox.publish('xmlChanged'); }); editor.getSession().on('change', function() { - isDirty = true; - }) + sandbox.publish('xmlChanged'); + }); return { start: function() { sandbox.publish('ready'); @@ -24,20 +25,13 @@ return function(sandbox) { }, setDocument: function(document) { editor.setValue(document); - editor.gotoLine(0) - isDirty = false; + editor.gotoLine(0); + sandbox.publish('documentSet'); }, getDocument: function() { return editor.getValue(); - }, - isDirty: function() { - return isDirty; - }, - setDirty: function(dirty) { - isDirty = dirty; } - - } + }; }; }); \ No newline at end of file