Plugin library chooser improvements

* Make "Also requires:" translatable
* Clearer styling for sub-plugins
* Documentation tweaks
This commit is contained in:
Jeremy Ruston 2019-09-28 10:06:18 +01:00
parent 0193bfd5e9
commit ded9d4074c
7 changed files with 52 additions and 15 deletions

View File

@ -63,6 +63,7 @@ Parsing/Pragma/Caption: Pragma Parse Rules
Plugins/Add/Caption: Get more plugins
Plugins/Add/Hint: Install plugins from the official library
Plugins/AlreadyInstalled/Hint: This plugin is already installed at version <$text text=<<installedVersion>>/>
Plugins/AlsoRequires: Also requires:
Plugins/Caption: Plugins
Plugins/Disable/Caption: disable
Plugins/Disable/Hint: Disable this plugin when reloading page

View File

@ -67,7 +67,7 @@ $:/state/add-plugin-info/$(connectionTiddler)$/$(assetInfo)$
<$set name="currentTiddler" value=<<assetInfo>>>
<$list filter="[enlist{!!dependents}] [<currentTiddler>get[parent-plugin]] +[limit[1]]" variable="ignore">
<div>
Also requires:
{{$:/language/ControlPanel/Plugins/AlsoRequires}}
<$list filter="[enlist{!!dependents}] [{!!parent-plugin}] +[sort[title]]" variable="dependency">
<$text text=<<dependency>>/>
</$list>

View File

@ -0,0 +1,13 @@
created: 20190928081852771
modified: 20190928082758674
tags: PluginMechanism
title: Plugin Dependencies
type: text/vnd.tiddlywiki
The simplest form of dependency between plugins is that one plugin can declare itself to be a sub-plugin of another plugin by specifying that plugin in the `parent-plugin` [[field|Plugin Fields]]. Sub-plugins are displayed in the control panel plugin chooser within the expandable area of their parent plugin. For example, the official plugin library includes the [[CodeMirror Plugin]] and also more than a dozen sub-plugins that extend the CodeMirror plugin with optional functionality. Note that sub-plugins cannot themselves have further sub-plugins.
Plugins can also use their `dependents` [[field|Plugin Fields]] to list the titles of any other plugins that should also be installed. Note that the list is not resolved recursively: dependents of dependents will not be installed.
When installing a plugin from the plugin library, both the `parent-plugin` and `dependents` fields are used to determine any additional plugins to be installed.
Note that the `dependents` field is also used by the ThemeMechanism and the LanguageMechanism to switch in dependent theme/language plugins.

View File

@ -0,0 +1,18 @@
created: 20190928081810311
modified: 20190928081811355
tags:
title: Plugin Types
type: text/vnd.tiddlywiki
Plugins have a `plugin-type` field that determines how it is treated. The following values are defined by the core:
* `plugin` - an ordinary plugin
* `theme` - a theme plugin (see ThemeMechanism). Only the theme plugin named in the tiddler $:/theme is activated at any one time (along with any dependent theme plugins)
* `language` - a language plugin (see TranslationMechanism). Only the language plugin named in the tiddler $:/language is activated at any one time (along with any dependent language plugins)
The following plugin types are used internally by the core:
* `import` - for the special $:/Import plugin created while importing is in progress
* `info` - for the special $:/temp/info-plugin tiddler created by the InfoMechanism
While not supported by the plugin library, it is also possible to use custom plugin types to build plugin-like behaviour with a custom user interface. Plugins with a custom type will automatically receive the same behaviour as plain plugins but can display a custom user interface using an appropriate [[view template segment|SystemTag: $:/tags/ViewTemplate]].

View File

@ -1,5 +1,5 @@
created: 20130826122000000
modified: 20190927172137277
modified: 20190928082000464
tags: Mechanisms
title: PluginMechanism
type: text/vnd.tiddlywiki
@ -16,20 +16,21 @@ By convention, plugin titles have the form `$:/plugins/<publisher>/<name>`. Plug
When [[running TiddlyWiki under Node.js|TiddlyWiki on Node.js]], plugins can also be stored as individual tiddler files in [[PluginFolders]].
Plugins have a `plugin-type` field that determines how it is treated. The following values are defined by the core:
! Plugin Types
* `plugin` - an ordinary plugin
* `theme` - a theme plugin (see ThemeMechanism). Only the theme plugin named in the tiddler $:/theme is activated at any one time (along with any dependent theme plugins)
* `language` - a language plugin (see TranslationMechanism). Only the language plugin named in the tiddler $:/language is activated at any one time (along with any dependent language plugins)
{{Plugin Types}}
The following plugin types are used internally by the core:
! Plugin Dependencies
* `import` - for the special $:/Import plugin created while importing is in progress
* `info` - for the special $:/temp/info-plugin tiddler created by the InfoMechanism
{{Plugin Dependencies}}
Custom plugin types can also be used. They will automatically receive the same behaviour as plain plugins but can display a custom user interface using an appropriate [[view template segment|SystemTag: $:/tags/ViewTemplate]].
! Plugin Ordering
See [[Plugin Fields]] for details of the other fields used by plugins.
{{Plugin Ordering}}
! Plugin Fields
{{Plugin Fields}}
! More information

View File

@ -1,11 +1,9 @@
created: 20161015122718559
modified: 20190927172655698
modified: 20190928083018378
tags: PluginMechanism
title: Plugin Fields
type: text/vnd.tiddlywiki
! Plugin fields
Plugins are stored as tiddlers with the following fields:
|!Field |!Description |
@ -14,6 +12,7 @@ Plugins are stored as tiddlers with the following fields:
|description |Description of plugin |
|list |Names of exposed plugin information tiddlers (see below) |
|name |Brief name of the plugin |
|plugin-priority |//(optional)// Numerical priority (higher numbers install later, the core plugin has a priority of zero |
|plugin-type |Generally ''plugin'', ''language'' or ''theme''; see PluginMechanism for details |
|parent-plugin |//(optional)// <<.from-version "5.1.22">> Title of the plugin under which this plugin should be displayed as a sub-plugin in the control panel plugin chooser |
|source |//(optional)// Source URL of plugin |

View File

@ -2179,7 +2179,12 @@ a.tc-tiddlylink.tc-plugin-info:hover .tc-plugin-info > .tc-plugin-info-chunk > s
}
.tc-plugin-info-dropdown-body {
padding: 1em 1em 1em 1em;
padding: 1em 1em 0 1em;
}
.tc-plugin-info-sub-plugins {
padding-top: 0.5em;
background: <<colour message-background>>;
}
.tc-plugin-library-listing .tc-install-plugin {