diff --git a/core/modules/widgets/view.js b/core/modules/widgets/view.js index a11151334..8db0b03ae 100755 --- a/core/modules/widgets/view.js +++ b/core/modules/widgets/view.js @@ -83,6 +83,18 @@ ViewHandler.prototype.createFakeWidget = function() { this.fakeWidget.renderChildren(this.fakeNode,null); }; +ViewHandler.prototype.refreshWikified = function(changedTiddlers) { + var refreshed = this.fakeWidget.refresh(changedTiddlers); + if(refreshed) { + var newText = this.getValue(); + if(newText !== this.text) { + this.widget.domNodes[0].textContent = newText; + this.text = newText; + } + } + return refreshed; +}; + /* Base ViewHandler refresh method */ @@ -191,15 +203,7 @@ ViewWidget.prototype.initialiseHTMLWikifiedView = function(View) { }; View.prototype.refresh = function(changedTiddlers) { - var refreshed = this.fakeWidget.refresh(changedTiddlers); - if(refreshed) { - var newText = this.getValue(); - if(newText !== this.text) { - self.domNodes[0].textContent = newText; - this.text = newText; - } - } - return refreshed; + return this.refreshWikified(changedTiddlers); }; return View; }; @@ -219,15 +223,7 @@ ViewWidget.prototype.initialisePlainWikifiedView = function(View) { }; View.prototype.refresh = function(changedTiddlers) { - var refreshed = this.fakeWidget.refresh(changedTiddlers); - if(refreshed) { - var newText = this.getValue(); - if(newText !== this.text) { - self.domNodes[0].textContent = newText; - this.text = newText; - } - } - return refreshed; + return this.refreshWikified(changedTiddlers); }; return View; }; @@ -247,15 +243,7 @@ ViewWidget.prototype.initialiseHTMLEncodedPlainWikifiedView = function(View) { }; View.prototype.refresh = function(changedTiddlers) { - var refreshed = this.fakeWidget.refresh(changedTiddlers); - if(refreshed) { - var newText = this.getValue(); - if(newText !== this.text) { - self.domNodes[0].textContent = newText; - this.text = newText; - } - } - return refreshed; + return this.refreshWikified(changedTiddlers); }; return View; };