From: Aleksander Ɓukasz Date: Mon, 15 Apr 2013 14:43:56 +0000 (+0200) Subject: Fixing event handling in visual editor X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/70fd8f6118a3e8bf298dd9c48c310f3309b780c3 Fixing event handling in visual editor --- diff --git a/modules/visualEditor.js b/modules/visualEditor.js index d8b30b7..08085de 100644 --- a/modules/visualEditor.js +++ b/modules/visualEditor.js @@ -3,6 +3,16 @@ rng.modules.visualEditor = function(sandbox) { var view = { node: $(sandbox.getTemplate('main')()), + setup: function() { + var node = this.node; + node.find('#rng-visualEditor-content').on('keyup', function() { + isDirty = true; + }); + + node.find('#rng-visualEditor-meta').on('keyup', function() { + isDirty = true; + }); + }, getMetaData: function() { var toret = {}; this.node.find('#rng-visualEditor-meta table tr').each(function() { @@ -25,21 +35,14 @@ rng.modules.visualEditor = function(sandbox) { this.node.find('#rng-visualEditor-content').html(HTMLTree); }, getBody: function() { - return this.find('#rng-visualEditor-content').html(); + return this.node.find('#rng-visualEditor-content').html(); } }; + view.setup(); var isDirty = false; - $('#rng-visualEditor-content', view).on('keyup', function() { - isDirty = true; - }); - - $('#rng-visualEditor-meta', view).on('keyup', function() { - isDirty = true; - }); - return { start: function() { sandbox.publish('ready');