Detecting with wikitext if a plugin is installed and active

102 views
Skip to first unread message

Saq Imtiaz

unread,
Apr 19, 2021, 2:45:34 PM4/19/21
to TiddlyWiki
I am wondering if anyone has a better solution for detecting in wikitext whether a plugin is installed and available.

For example, for detecting if the codemirror editor is available, I am using the following filter:

[[$:/plugins/tiddlywiki/codemirror]!is[missing]] :filter[lookup:no[$:/config/Plugins/Disabled/]match[no]]
  • This checks if the plugin tiddler is present as long as it has not been renamed.
  • It checks whether the plugin has been disabled.
  • However, if the plugin was disabled when the TW loaded and later enabled, this filter will still indicate that codemirror is available even though the editor will not work until the wiki is saved and reloaded.
Any alternative approaches that might work?
Regards,

Saq

Mohammad Rahmani

unread,
Apr 19, 2021, 4:01:05 PM4/19/21
to tiddl...@googlegroups.com
On Mon, Apr 19, 2021 at 11:15 PM Saq Imtiaz <saq.i...@gmail.com> wrote:
I am wondering if anyone has a better solution for detecting in wikitext whether a plugin is installed and available.

For example, for detecting if the codemirror editor is available, I am using the following filter:

[[$:/plugins/tiddlywiki/codemirror]!is[missing]] :filter[lookup:no[$:/config/Plugins/Disabled/]match[no]]
  • This checks if the plugin tiddler is present as long as it has not been renamed.

In Commander, I use the first part to see if Relink is installed or not! but your solution here addresses the disabled status also!
  • It checks whether the plugin has been disabled.
  • However, if the plugin was disabled when the TW loaded and later enabled, this filter will still indicate that codemirror is available even though the editor will not work until the wiki is saved and reloaded.
Any alternative approaches that might work?
Regards,

Saq

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/afa146d8-5308-49b4-8668-f360d86f6dban%40googlegroups.com.

Saq Imtiaz

unread,
Apr 19, 2021, 4:13:19 PM4/19/21
to TiddlyWiki
@Mohammad the problem with this filter is that it doesn't exclude the following situations:
- plugin installed but disabled when the wiki loaded, but later enabled (but still not active).
- plugin freshly installed but wiki has not been saved and reloaded.

Joshua Fontany

unread,
Apr 19, 2021, 8:33:23 PM4/19/21
to TiddlyWiki
If it is a javascript tiddler, you could check the Modules filter:

https://tiddlywiki.com/#modules%20Operator

Mohammad

unread,
Apr 20, 2021, 12:16:02 AM4/20/21
to TiddlyWiki
Yep, that is true! the solution is incomplete!

TW Tones

unread,
Apr 20, 2021, 1:10:09 AM4/20/21
to TiddlyWiki
Saq,

In this case is there not a message at the top to reload? If not perhaps fix that.

If there is a message that suggests a reload, a temporary message tiddler is present, you may be able to test for its existence.

Failing that is there something about the plugin you can test?, although specific this should reduce the number of missing cases to a small number, unless you are playing with a new method of using plugins in general, or a new set of cases, which I have in the past.

Data tiddlers and recently discussed idea of reference tiddlers/libraries.

Regards
Tones

Saq Imtiaz

unread,
Apr 20, 2021, 2:16:43 AM4/20/21
to TiddlyWiki
Thank you Joshua!

I wondered about a widgets[] operator last night but did not realize we had one for modules.

So this works for codemirror:
[[widget]modules[]prefix[$:/plugins/tiddlywiki/codemirror/edit-codemirror.js]]

Since enabling/disabling the plugin does not take effect until after a reload, we can ignore the disabled state.

PMario

unread,
Apr 20, 2021, 2:42:57 AM4/20/21
to TiddlyWiki
Hi,
IMO if [[$:/plugins/tiddlywiki/codemirror/readme]is[shadow]] the plugin has been activated and it has been installed.

-m
Reply all
Reply to author
Forward
0 new messages