only update if text is wikified + add docs

This commit is contained in:
BurningTreeC 2024-03-30 12:09:57 +01:00
parent 6e1c9eff28
commit 79167a4afe
2 changed files with 6 additions and 1 deletions

View File

@ -62,15 +62,19 @@ ViewWidget.prototype.execute = function() {
this.viewTemplate = this.getAttribute("template","");
this.viewMode = this.getAttribute("mode","block");
this.viewUpdate = this.getAttribute("update","no") === "yes";
this.viewWikified = false;
switch(this.viewFormat) {
case "htmlwikified":
this.text = this.getValueAsHtmlWikified(this.viewMode);
this.viewWikified = true;
break;
case "plainwikified":
this.text = this.getValueAsPlainWikified(this.viewMode);
this.viewWikified = true;
break;
case "htmlencodedplainwikified":
this.text = this.getValueAsHtmlEncodedPlainWikified(this.viewMode);
this.viewWikified = true;
break;
case "htmlencoded":
this.text = this.getValueAsHtmlEncoded();
@ -228,7 +232,7 @@ ViewWidget.prototype.refresh = function(changedTiddlers) {
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.template || changedAttributes.format || changedAttributes.update || changedTiddlers[this.viewTitle]) {
this.refreshSelf();
return true;
} else if(this.viewUpdate && this.fakeWidget) {
} else if(this.viewUpdate && this.viewWikified) {
var refreshed = this.fakeWidget.refresh(changedTiddlers);
if(refreshed) {
var newText = this.fakeNode.textContent;

View File

@ -21,6 +21,7 @@ The content of the `<$view>` widget is displayed if the field or property is mis
|template |Optional template string used when the `format` attribute is set to "date" |
|subtiddler |Optional SubTiddler title when the target tiddler is a [[plugin|Plugins]] (see below) |
|mode |<<.from-version "5.1.15">> Optional transclusion parsing mode for wikified formats. May be "inline" or "block" (the default) |
|update |<<.from-version "5.3.4">> Optional. If set to "yes", the viewed ''wikified'' text gets updated if its text content changes |
!! Formats