1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Deserializers[] filter operator (#5673)

This commit is contained in:
Saq Imtiaz 2021-05-22 11:50:11 +02:00 committed by GitHub
parent 0003d70132
commit 10b20657cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 54 additions and 2 deletions

View File

@ -0,0 +1,27 @@
/*\
title: $:/core/modules/filters/deserializers.js
type: application/javascript
module-type: filteroperator
Filter operator for returning the names of the deserializers in this wiki
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter function
*/
exports.deserializers = function(source,operator,options) {
var results = [];
$tw.utils.each($tw.Wiki.tiddlerDeserializerModules,function(deserializer,type) {
results.push(type);
});
results.sort();
return results;
};
})();

View File

@ -809,6 +809,10 @@ function runTests(wiki) {
expect(wiki.filterTiddlers("'-' +[escapecss[]]").join(",")).toBe("\\-");
});
it("should handle the deserializers operator", function() {
expect(wiki.filterTiddlers("[deserializers[]]").join(",")).toBe("application/javascript,application/json,application/x-tiddler,application/x-tiddler-html-div,application/x-tiddlers,text/css,text/html,text/plain");
});
}
});

View File

@ -0,0 +1,14 @@
caption: deserializers
created: 20210506115203172
from-version: 5.1.24
modified: 20210506130322593
op-input: ignored
op-output: the title of each available deserializer
op-parameter: none
tags: [[Filter Operators]] [[Special Operators]]
title: deserializers Operator
type: text/vnd.tiddlywiki
<<.tip "You can specify a specific deserializer for a DropzoneWidget to use">>
<<.operator-examples "deserializers">>

View File

@ -0,0 +1,7 @@
created: 20210506115345021
modified: 20210506115402052
tags: [[Operator Examples]] [[deserializer Operator]]
title: deserializers Operator (Examples)
type: text/vnd.tiddlywiki
<<.operator-example 1 "[deserializers[]]">>

View File

@ -1,6 +1,6 @@
caption: dropzone
created: 20131024141900000
modified: 20210519154948743
modified: 20210506115809131
tags: Widgets
title: DropzoneWidget
type: text/vnd.tiddlywiki
@ -25,7 +25,7 @@ It sends a [[WidgetMessage: tm-import-tiddlers]] carrying a JSON representation
<<.tip """Use the `prefix` filter operator to easily accept multiple related content types. For example this filter will accept all image content types: `[prefix[image/]]`""">>
The list of available deserializers can be inspected by executing `Object.keys($tw.Wiki.tiddlerDeserializerModules).sort().join("\n")` in the browser JavaScript console.
<<.tip "The list of available deserializers can be seen by using the filter `[deserializers[]]` in the Filter tab in [[Advanced Search|$:/AdvancedSearch]].">>
The dropzone widget displays any contained content within the dropzone.