mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Add support for startup actions
This commit is contained in:
parent
28e713caac
commit
1c6942402e
@ -87,18 +87,29 @@ exports.startup = function() {
|
||||
});
|
||||
// Kick off the keyboard manager
|
||||
$tw.keyboardManager = new $tw.KeyboardManager();
|
||||
// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers
|
||||
$tw.rootWidget = new widget.widget({
|
||||
type: "widget",
|
||||
children: []
|
||||
},{
|
||||
wiki: $tw.wiki,
|
||||
document: $tw.browser ? document : $tw.fakeDocument
|
||||
});
|
||||
// Execute any startup actions
|
||||
var executeStartupTiddlers = function(tag) {
|
||||
$tw.utils.each($tw.wiki.filterTiddlers("[all[shadows+tiddlers]tag[" + tag + "]!has[draft.of]]"),function(title) {
|
||||
$tw.rootWidget.invokeActionString($tw.wiki.getTiddlerText(title),$tw.rootWidget);
|
||||
});
|
||||
};
|
||||
executeStartupTiddlers("$:/tags/StartupAction");
|
||||
if($tw.browser) {
|
||||
executeStartupTiddlers("$:/tags/StartupAction/Browser");
|
||||
}
|
||||
if($tw.node) {
|
||||
executeStartupTiddlers("$:/tags/StartupAction/Node");
|
||||
}
|
||||
// Clear outstanding tiddler store change events to avoid an unnecessary refresh cycle at startup
|
||||
$tw.wiki.clearTiddlerEventQueue();
|
||||
// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers
|
||||
if($tw.browser) {
|
||||
$tw.rootWidget = new widget.widget({
|
||||
type: "widget",
|
||||
children: []
|
||||
},{
|
||||
wiki: $tw.wiki,
|
||||
document: document
|
||||
});
|
||||
}
|
||||
// Find a working syncadaptor
|
||||
$tw.syncadaptor = undefined;
|
||||
$tw.modules.forEachModuleOfType("syncadaptor",function(title,module) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
created: 20130822080600000
|
||||
modified: 20170516203741329
|
||||
modified: 20180323092909513
|
||||
tags: Concepts
|
||||
title: SystemTags
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -11,50 +11,53 @@ System tags are used to give special behaviour to tiddlers.
|
||||
These are the available system tags
|
||||
|
||||
|<<tag "$:/tags/AboveStory">> |for elements to be placed at the top of the story river |
|
||||
|<<tag "$:/tags/AdvancedSearch>> |for search elements |
|
||||
|<<tag "$:/tags/AdvancedSearch/FilterButton>> |for filter buttons |
|
||||
|<<tag "$:/tags/Alert>> |for alerts |
|
||||
|<<tag "$:/tags/BelowStory>> |for elements to be placed at the bottom of the story river |
|
||||
|<<tag "$:/tags/ControlPanel>> |for control panel tabs |
|
||||
|<<tag "$:/tags/ControlPanel/Advanced>> |for control panel advanced tabs |
|
||||
|<<tag "$:/tags/ControlPanel/Appearance>> |for control panel appearance tabs |
|
||||
|<<tag "$:/tags/ControlPanel/Info>> |for control panel info tabs |
|
||||
|<<tag "$:/tags/ControlPanel/Saving>> |for saving configurations |
|
||||
|<<tag "$:/tags/ControlPanel/Settings>> |for control panel settings tabs |
|
||||
|<<tag "$:/tags/ControlPanel/Toolbars>> |for control panel toolbar customisation tabs |
|
||||
|<<tag "$:/tags/EditorToolbar>> |for the editor toolbar buttons |
|
||||
|<<tag "$:/tags/EditPreview>> |for custom preview panes |
|
||||
|<<tag "$:/tags/EditTemplate>> |for the edit template |
|
||||
|<<tag "$:/tags/EditToolbar>> |for the edit mode tiddler toolbar |
|
||||
|<<tag "$:/tags/Exporter>> |for the exporters |
|
||||
|<<tag "$:/tags/Filter>> |for filters in advanced seach sample filter dropdown |
|
||||
|<<tag "$:/tags/Image>> |for (core) images |
|
||||
|<<tag "$:/tags/Manager/ItemMain>> |for the tiddler manager. $:/Manager |
|
||||
|<<tag "$:/tags/Manager/ItemSidebar>> |for the tiddler manager |
|
||||
|<<tag "$:/tags/Macro>> |for global macros |
|
||||
|<<tag "$:/tags/MoreSideBar>> |for tabs in the "more" sidebar |
|
||||
|<<tag "$:/tags/MoreSideBar/Plugins>> |for Sidebar: More: Plugins tab |
|
||||
|<<tag "$:/tags/PageControls>> |for the page control tools in the sidebar |
|
||||
|<<tag "$:/tags/PageTemplate>> |for the main page elements |
|
||||
|<<tag "$:/tags/Palette>> |for colour palettes |
|
||||
|<<tag "$:/tags/PluginLibrary>> |for the plugin library |
|
||||
|<<tag "$:/tags/RawMarkup>> |for raw markup to be included in the generated HTML file. To activate the tag, TiddlyWiki needs to be reloaded |
|
||||
|<<tag "$:/tags/RawMarkupWikified>> |for raw markup to be included in the generated HTML file. To activate the tag, TiddlyWiki needs to be reloaded |
|
||||
|<<tag "$:/tags/RawStaticContent>> |for "raw" content to be saved into the TW code. Be careful! |
|
||||
|<<tag "$:/tags/RemoteAssetInfo>> |for plugin import handling |
|
||||
|<<tag "$:/tags/SearchResults>> |for customised search results |
|
||||
|<<tag "$:/tags/ServerConnection>> |for plugin import handling |
|
||||
|<<tag "$:/tags/SideBar>> |for sidebar tabs | |
|
||||
|<<tag "$:/tags/Stylesheet>> |to indicate that a tiddler should be applied as a CSS stylesheet | |
|
||||
|<<tag "$:/tags/TagDropdown>> |for tags dropdown sorting |
|
||||
|<<tag "$:/tags/Texteditor/Snippet>> |for text snippets |
|
||||
|<<tag "$:/tags/TiddlerInfo>> |for tiddler info panel tabs |
|
||||
|<<tag "$:/tags/TiddlerInfo/Advanced>> |for tabs under the advanced tiddler tab |
|
||||
|<<tag "$:/tags/ToolbarButtonStyle>> |for the style of the buttons |
|
||||
|<<tag "$:/tags/TopLeftBar>> |for the top left bar |
|
||||
|<<tag "$:/tags/TopRightBar>> |for the top right bar |
|
||||
|<<tag "$:/tags/ViewTemplate>> |for the view template |
|
||||
|<<tag "$:/tags/ViewToolbar>> |for the view mode tiddler toolbar |
|
||||
|<<tag "$:/tags/AdvancedSearch">> |for search elements |
|
||||
|<<tag "$:/tags/AdvancedSearch/FilterButton">> |for filter buttons |
|
||||
|<<tag "$:/tags/Alert">> |for alerts |
|
||||
|<<tag "$:/tags/BelowStory">> |for elements to be placed at the bottom of the story river |
|
||||
|<<tag "$:/tags/ControlPanel">> |for control panel tabs |
|
||||
|<<tag "$:/tags/ControlPanel/Advanced">> |for control panel advanced tabs |
|
||||
|<<tag "$:/tags/ControlPanel/Appearance">> |for control panel appearance tabs |
|
||||
|<<tag "$:/tags/ControlPanel/Info">> |for control panel info tabs |
|
||||
|<<tag "$:/tags/ControlPanel/Saving">> |for saving configurations |
|
||||
|<<tag "$:/tags/ControlPanel/Settings">> |for control panel settings tabs |
|
||||
|<<tag "$:/tags/ControlPanel/Toolbars">> |for control panel toolbar customisation tabs |
|
||||
|<<tag "$:/tags/EditorToolbar">> |for the editor toolbar buttons |
|
||||
|<<tag "$:/tags/EditPreview">> |for custom preview panes |
|
||||
|<<tag "$:/tags/EditTemplate">> |for the edit template |
|
||||
|<<tag "$:/tags/EditToolbar">> |for the edit mode tiddler toolbar |
|
||||
|<<tag "$:/tags/Exporter">> |for the exporters |
|
||||
|<<tag "$:/tags/Filter">> |for filters in advanced seach sample filter dropdown |
|
||||
|<<tag "$:/tags/Image">> |for (core) images |
|
||||
|<<tag "$:/tags/Manager/ItemMain">> |for the tiddler manager. $:/Manager |
|
||||
|<<tag "$:/tags/Manager/ItemSidebar">> |for the tiddler manager |
|
||||
|<<tag "$:/tags/Macro">> |for global macros |
|
||||
|<<tag "$:/tags/MoreSideBar">> |for tabs in the "more" sidebar |
|
||||
|<<tag "$:/tags/MoreSideBar/Plugins">> |for Sidebar: More: Plugins tab |
|
||||
|<<tag "$:/tags/PageControls">> |for the page control tools in the sidebar |
|
||||
|<<tag "$:/tags/PageTemplate">> |for the main page elements |
|
||||
|<<tag "$:/tags/Palette">> |for colour palettes |
|
||||
|<<tag "$:/tags/PluginLibrary">> |for the plugin library |
|
||||
|<<tag "$:/tags/RawMarkup">> |for raw markup to be included in the generated HTML file. To activate the tag, TiddlyWiki needs to be reloaded |
|
||||
|<<tag "$:/tags/RawMarkupWikified">> |for raw markup to be included in the generated HTML file. To activate the tag, TiddlyWiki needs to be reloaded |
|
||||
|<<tag "$:/tags/RawStaticContent">> |for "raw" content to be saved into the TW code. Be careful! |
|
||||
|<<tag "$:/tags/RemoteAssetInfo">> |for plugin import handling |
|
||||
|<<tag "$:/tags/SearchResults">> |for customised search results |
|
||||
|<<tag "$:/tags/ServerConnection">> |for plugin import handling |
|
||||
|<<tag "$:/tags/SideBar">> |for sidebar tabs |
|
||||
|<<tag "$:/tags/StartupAction">> |startup actions executed on all platforms |
|
||||
|<<tag "$:/tags/StartupAction/Browser">> |startup actions only executed when running in the browser |
|
||||
|<<tag "$:/tags/StartupAction/Node">> |startup actions only executed when running under Node.js |
|
||||
|<<tag "$:/tags/Stylesheet">> |to indicate that a tiddler should be applied as a CSS stylesheet |
|
||||
|<<tag "$:/tags/TagDropdown">> |for tags dropdown sorting |
|
||||
|<<tag "$:/tags/Texteditor/Snippet">> |for text snippets |
|
||||
|<<tag "$:/tags/TiddlerInfo">> |for tiddler info panel tabs |
|
||||
|<<tag "$:/tags/TiddlerInfo/Advanced">> |for tabs under the advanced tiddler tab |
|
||||
|<<tag "$:/tags/ToolbarButtonStyle">> |for the style of the buttons |
|
||||
|<<tag "$:/tags/TopLeftBar">> |for the top left bar |
|
||||
|<<tag "$:/tags/TopRightBar">> |for the top right bar |
|
||||
|<<tag "$:/tags/ViewTemplate">> |for the view template |
|
||||
|<<tag "$:/tags/ViewToolbar">> |for the view mode tiddler toolbar |
|
||||
|
||||
! ~TiddlyWiki plugins
|
||||
|
||||
|
23
editions/tw5.com/tiddlers/features/StartupActions.tid
Normal file
23
editions/tw5.com/tiddlers/features/StartupActions.tid
Normal file
@ -0,0 +1,23 @@
|
||||
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)
|
||||
|
||||
For example, the following action widgets when placed in a tiddler tagged <<tag "$:/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>
|
||||
```
|
Loading…
Reference in New Issue
Block a user