From 4a0f2a5a2f896085a6d4cb45a79085420ce6f0cf Mon Sep 17 00:00:00 2001 From: BurningTreeC Date: Sun, 7 Apr 2024 13:29:53 +0200 Subject: [PATCH] update view widget --- core/modules/widgets/view.js | 42 +++++++++++++----------------------- 1 file changed, 15 insertions(+), 27 deletions(-) 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; };