1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +00:00

Add new "htmlencodedplainwikified" format to view widget

Triggered by the text-slicer plugin, but general purpose.

The clunky implementation shows the shortcomings of the view widget. It
was one of the first widgets to be implemented; subsequently, the
implementation of macros gives us a potentially more flexible way of
implementing these kinds of text transformations.
This commit is contained in:
Jermolene 2015-09-11 13:33:20 +01:00
parent eb9fb6635d
commit 939596bd47

View File

@ -55,6 +55,9 @@ ViewWidget.prototype.execute = function() {
case "htmlwikified":
this.text = this.getValueAsHtmlWikified();
break;
case "htmlencodedplainwikified":
this.text = this.getValueAsHtmlEncodedPlainWikified();
break;
case "htmlencoded":
this.text = this.getValueAsHtmlEncoded();
break;
@ -132,6 +135,10 @@ ViewWidget.prototype.getValueAsHtmlWikified = function() {
return this.wiki.renderText("text/html","text/vnd.tiddlywiki",this.getValueAsText(),{parentWidget: this});
};
ViewWidget.prototype.getValueAsHtmlEncodedPlainWikified = function() {
return $tw.utils.htmlEncode(this.wiki.renderText("text/plain","text/vnd.tiddlywiki",this.getValueAsText(),{parentWidget: this}));
};
ViewWidget.prototype.getValueAsHtmlEncoded = function() {
return $tw.utils.htmlEncode(this.getValueAsText());
};