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:
parent
0003d70132
commit
10b20657cc
27
core/modules/filters/deserializers.js
Normal file
27
core/modules/filters/deserializers.js
Normal 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;
|
||||
};
|
||||
|
||||
})();
|
@ -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");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
14
editions/tw5.com/tiddlers/filters/deserializers Operator.tid
Normal file
14
editions/tw5.com/tiddlers/filters/deserializers Operator.tid
Normal 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">>
|
@ -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[]]">>
|
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user