mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-10-01 16:30:46 +00:00
ceb2d9f119
Regarding the bulleted tag pills; they should probably also be removed in place of text but I see value in keeping them for the sake of being able to easily peek at what they tag. We should probably have a section under Ctrlpanel>Settings where any startupaction-tiddlers are listed but since we don't yet, then the mentioned tag pills could perhaps remain.... except for the one in the PR.
30 lines
1.4 KiB
Plaintext
30 lines
1.4 KiB
Plaintext
created: 20180323092308399
|
|
modified: 20180323092547312
|
|
tags: Features
|
|
title: StartupActions
|
|
type: text/vnd.tiddlywiki
|
|
|
|
During startup, TiddlyWiki executes any ActionWidgets found in tiddlers with the following system tags:
|
|
|
|
* <<tag "$:/tags/StartupAction">> (executed on all platforms)
|
|
* <<tag "$:/tags/StartupAction/Browser">> (only executed when running in the browser)
|
|
* <<tag "$:/tags/StartupAction/Node">> (only executed when running under Node.js)
|
|
|
|
Startup actions are useful for customising TiddlyWiki according to environmental factors such as the screen size. For example, the following action widgets when placed in a tiddler tagged `$:/tags/StartupAction/Browser` will cause the sidebar to be hidden by default when the screen width is less than 1000 pixels:
|
|
|
|
```
|
|
<$reveal type="lt" state="$:/info/browser/screen/width" text="3000">
|
|
<$action-setfield $tiddler="$:/state/sidebar" $value="no"/>
|
|
</$reveal>
|
|
|
|
<$reveal type="gteq" state="$:/info/browser/screen/width" text="3000">
|
|
<$action-setfield $tiddler="$:/state/sidebar" $value="yes"/>
|
|
</$reveal>
|
|
```
|
|
|
|
Note that global macros are not available within startup action tiddlers by default. If you need to access them then you'll need to explicitly include them with an ''import'' [[pragma|Pragma]] at the top of the tiddler:
|
|
|
|
```
|
|
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
|
```
|