mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-01 16:13:00 +00:00
Dynamic loading/unloading of plugins (#4259)
* First pass at dynamic loading/unloading * Show warning for changes to plugins containing JS modules * Use $:/config/RegisterPluginType/* for configuring whether a plugin type is automatically registered Where "registered" means "the constituent shadows are loaded". * Fix the info plugin The previous mechanism re-read all plugin info during startup * Don't prettify JSON in the plugin library * Indicate in plugin library whether a plugin requires reloading * Display the highlighted plugin name in the plugin chooser And if there's no name field fall back to the part of the title after the final slash.
This commit is contained in:
@@ -59,7 +59,7 @@ Command.prototype.execute = function() {
|
||||
title: upgradeLibraryTitle,
|
||||
type: "application/json",
|
||||
"plugin-type": "library",
|
||||
"text": JSON.stringify({tiddlers: tiddlers},null,$tw.config.preferences.jsonSpaces)
|
||||
"text": JSON.stringify({tiddlers: tiddlers})
|
||||
};
|
||||
wiki.addTiddler(new $tw.Tiddler(pluginFields));
|
||||
return null;
|
||||
|
||||
@@ -65,10 +65,11 @@ Command.prototype.execute = function() {
|
||||
// Save each JSON file and collect the skinny data
|
||||
var pathname = path.resolve(self.commander.outputPath,basepath + encodeURIComponent(title) + ".json");
|
||||
$tw.utils.createFileDirectories(pathname);
|
||||
fs.writeFileSync(pathname,JSON.stringify(tiddler,null,$tw.config.preferences.jsonSpaces),"utf8");
|
||||
fs.writeFileSync(pathname,JSON.stringify(tiddler),"utf8");
|
||||
// Collect the skinny list data
|
||||
var pluginTiddlers = JSON.parse(tiddler.text),
|
||||
readmeContent = (pluginTiddlers.tiddlers[title + "/readme"] || {}).text,
|
||||
doesContainJavaScript = !!$tw.wiki.doesPluginInfoContainModules(pluginTiddlers),
|
||||
iconTiddler = pluginTiddlers.tiddlers[title + "/icon"] || {},
|
||||
iconType = iconTiddler.type,
|
||||
iconText = iconTiddler.text,
|
||||
@@ -76,7 +77,12 @@ Command.prototype.execute = function() {
|
||||
if(iconType && iconText) {
|
||||
iconContent = $tw.utils.makeDataUri(iconText,iconType);
|
||||
}
|
||||
skinnyList.push($tw.utils.extend({},tiddler,{text: undefined, readme: readmeContent, icon: iconContent}));
|
||||
skinnyList.push($tw.utils.extend({},tiddler,{
|
||||
text: undefined,
|
||||
readme: readmeContent,
|
||||
"contains-javascript": doesContainJavaScript ? "yes" : "no",
|
||||
icon: iconContent
|
||||
}));
|
||||
});
|
||||
// Save the catalogue tiddler
|
||||
if(skinnyListTitle) {
|
||||
|
||||
Reference in New Issue
Block a user