From 3b7ac014de691c6541229f0af0e69c5207283291 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 11 Mar 2013 12:30:13 -0400 Subject: [PATCH] Fixes JSHint error on PageDown. Updated for Uniform Access Principle. --- .../javascripts/discourse/views/pagedown_editor.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/discourse/views/pagedown_editor.js b/app/assets/javascripts/discourse/views/pagedown_editor.js index ca571be1254..30c3fb7fc68 100644 --- a/app/assets/javascripts/discourse/views/pagedown_editor.js +++ b/app/assets/javascripts/discourse/views/pagedown_editor.js @@ -32,15 +32,14 @@ Discourse.PagedownEditor = Ember.ContainerView.extend({ didInsertElement: function() { var $wmdInput = $('#wmd-input'); $wmdInput.data('init', true); - this.editor = Discourse.Markdown.createEditor(); - return this.editor.run(); + this.set('editor', Discourse.Markdown.createEditor()); + return this.get('editor').run(); }, observeValue: (function() { - var _this = this; - Ember.run.next(null, function() { - _this.editor && _this.editor.refreshPreview(); - }); + var editor = this.get('editor'); + if (!editor) return; + Ember.run.next(null, function() { editor.refreshPreview(); }); }).observes('value') });