-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[5.4.0] Formalize data tiddlers #9336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for tiddlywiki-previews ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Confirmed: Arlen22 has already signed the Contributor License Agreement (see contributing.md) |
7a8f1c4
to
ff5307c
Compare
- trying to find as many uses of plugins as I can
ff5307c
to
fdaf9f6
Compare
accumulatePlugin(title); | ||
}); | ||
var dependents = $tw.utils.parseStringArray(tiddler.fields.dependents || ""); | ||
$tw.utils.each(dependents,title => { accumulatePlugin(title); }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO each
should be considered deprecated, it should use forEach
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just tightening up the formatting. It's out of scope for this PR because each
could be operating on an object or an array and I'd have to determine which it is before I make that change. So unfortunately I won't be able to do anything with that here. each
may be deprecated, but that doesn't mean we're removing it, and it needs to be handled carefully.
This PR
This is related to #9068 and #9064.
Breaking Changes: 5.4.0
The major breaking change in this PR is that plugins must now be parsed like this.
and stringified like this
This adds the following methods to $tw.utils
It adds the module-type
datatiddlerserializer
with the following interface.Registered serializers are a hashmap on the
$tw.Wiki.dataTiddlerSerializerModules
static property.It registers two data tiddler types
application/json
- the usual format that plugins usex-tiddler-dictionary
- the format used for things like color palettes.Under the hood both of these are data tiddler formats.
Data tiddler types are rarely interchangeable unless they have an explicitly defined relationship.
A plugin qualifies as a data tiddler, which inspired me to just make it official instead of accounting for all the cases of x-tiddler-dictionary. Of course, x-tiddler-dictionary has additional constraints. It cannot be used for a plugin, as it requires the data to be of type
Record<string, string>
(aka a hashmap of strings). But setting the type field is very explicit.