Plugin: save any JS module (inc. shadow overrides) to app html, fix #22

Also replace the theme-plugin-lang prefixes in the filter with the type&field
check that matches saveTiddler
This commit is contained in:
Val Packett 2023-08-20 21:10:00 -03:00
parent e97a4451c6
commit e48955e5dc
2 changed files with 6 additions and 3 deletions

View file

@ -1,3 +1,3 @@
title: $:/plugins/valpackett/tiddlypwa/app-filter
-[is[tiddler]] [[$:/core]] [[$:/favicon.ico]] [[$:/SiteTitle]] [[$:/SiteSubtitle]] [[$:/language]] [[$:/theme]] [[$:/palette]] [prefix[$:/themes/]] [prefix[$:/plugins/]] [prefix[$:/languages/]]
-[is[tiddler]] [[$:/core]] [[$:/favicon.ico]] [[$:/SiteTitle]] [[$:/SiteSubtitle]] [[$:/language]] [[$:/theme]] [[$:/palette]] [has[plugin-type]field:type[application/json]] [has[module-type]field:type[application/javascript]] -[prefix[$:/temp/]]

View file

@ -837,14 +837,17 @@ Formatted with `deno fmt`.
saveTiddler(tiddler, cb) {
if (tiddler.fields._is_skinny) {
// Shouldn't get these, but just to be 100% sure.
// This probably has prevented data loss in the Section Editor case #23
return cb(null, '', 1);
}
if (tiddler.fields.title === '$:/Import') {
// For some reason this is not in the default $:/config/SyncFilter but no one would want this actually stored.
return cb(null, '', 1);
}
if (tiddler.fields.type === 'application/json' && tiddler.fields['plugin-type']) {
if (
(tiddler.fields.type === 'application/json' && tiddler.fields['plugin-type']) ||
(tiddler.fields.type === 'application/javascript' && tiddler.fields['module-type'])
) {
// By ignoring the callback we make TW think there's something unsaved now, which there is!
return;
}