mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-08-25 11:06:45 +00:00
31 lines
596 B
JavaScript
31 lines
596 B
JavaScript
/*\
|
|
title: $:/core/modules/macros/view/viewers/text.js
|
|
type: application/javascript
|
|
module-type: fieldviewer
|
|
|
|
A viewer for viewing tiddler fields as plain text
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
function renderValue(tiddler,field,value,viewMacro) {
|
|
// Get the value as a string
|
|
if(field !== "text" && tiddler) {
|
|
value = tiddler.getFieldString(field);
|
|
}
|
|
// Return the text
|
|
if(value === undefined || value === null) {
|
|
return $tw.Tree.Text("");
|
|
} else {
|
|
return $tw.Tree.Text(value);
|
|
}
|
|
}
|
|
|
|
exports["text"] = renderValue;
|
|
|
|
})();
|