Add [is[binary]] operator

This commit is contained in:
Jeremy Ruston
2019-09-16 16:15:26 +01:00
parent 36498867d5
commit 1150c87edb
2 changed files with 12 additions and 1 deletions
+10
View File
@@ -221,6 +221,16 @@ exports.isImageTiddler = function(title) {
}
};
exports.isBinaryTiddler = function(title) {
var tiddler = this.getTiddler(title);
if(tiddler) {
var contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || "text/vnd.tiddlywiki"];
return !!contentTypeInfo && contentTypeInfo.encoding === "base64";
} else {
return null;
}
};
/*
Like addTiddler() except it will silently reject any plugin tiddlers that are older than the currently loaded version. Returns true if the tiddler was imported
*/