Skip to content

Commit

Permalink
Revert some of the UI changes for downloading external-js
Browse files Browse the repository at this point in the history
  • Loading branch information
Jermolene committed Sep 12, 2021
1 parent 9fae3a9 commit fba9935
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 47 deletions.
2 changes: 0 additions & 2 deletions core/language/en-GB/Buttons.multids
Expand Up @@ -32,8 +32,6 @@ ExportTiddler/Caption: export tiddler
ExportTiddler/Hint: Export tiddler
ExportTiddlers/Caption: export tiddlers
ExportTiddlers/Hint: Export tiddlers
ExportTiddlyWikiCore/Caption: export TiddlyWiki core
ExportTiddlyWikiCore/Hint: Export the ~TiddlyWiki core code for running with external ~JavaScript
SidebarSearch/Hint: Select the sidebar search field
Fold/Caption: fold tiddler
Fold/Hint: Fold the body of this tiddler
Expand Down
22 changes: 22 additions & 0 deletions core/ui/ExportTiddlyWikiCore.tid
@@ -0,0 +1,22 @@
title: $:/core/ui/ExportTiddlyWikiCore

\define jsFileName() tiddlywikicore-$(version)$.js
\define noExportMsg()
It appears that you have a wiki with an external ~TiddlyWiki core. The export action cannot be performed.
<p>You will need to view the page source in your browser. Then go to the very bottom the the source, find the last `<script>`
element, and right-click its `src` URI. Save the link as ''$(jsFileName)$''</p>
\end

''For advanced users''

Export the ~TiddlyWiki core ~JavaScript code for running with external ~JavaScript:

<$button tooltip="Export the ~TiddlyWiki core code for running with external ~JavaScript" aria-label="export TiddlyWiki core" class="tc-btn-big-green">
<$list filter="[[$:/boot/boot.js]is[missing]]" variable="ignore" emptyMessage="""<$action-sendmessage $message="tm-download-file" $param="$:/core/templates/tiddlywiki5.js" filename=<<jsFileName>>/>""" >
<$action-setfield $tiddler=<<qualify "$:/temp/alert">> text=<<noExportMsg>> subtitle="Export ~TiddllyWiki Core"/>
<$action-sendmessage $message="tm-modal" $param=<<qualify "$:/temp/alert">>/>
</$list>
{{$:/core/images/download-button}} Download ~TiddlyWiki core
</$button>

[[Further information|https://tiddlywiki.com/#Using%20the%20external%20JavaScript%20template]]
21 changes: 9 additions & 12 deletions core/ui/PageControls/export-tiddlywikicore.tid
@@ -1,25 +1,22 @@
title: $:/core/ui/Buttons/export-tiddlywikicore
tags: $:/tags/PageControls
caption: {{$:/core/images/star-filled}} {{$:/language/Buttons/ExportTiddlyWikiCore/Caption}}
description: {{$:/language/Buttons/ExportTiddlyWikiCore/Hint}}
title: $:/core/ui/ExportTiddlyWikiCore

\whitespace trim
\define jsFileName() tiddlywikicore-$(version)$.js
\define noExportMsg()
It appears that you have a wiki with an external ~TiddlyWiki core. The export action cannot be performed.
<p>You will need to view the page source in your browser. Then go to the very bottom the the source, find the last `<script>`
element, and right-click its `src` URI. Save the link as ''$(jsFileName)$''</p>
\end

<$button tooltip={{$:/language/Buttons/ExportTiddlyWikiCore/Hint}} aria-label={{$:/language/Buttons/ExportTiddlyWikiCore/Caption}} class=<<tv-config-toolbar-class>>>
''For advanced users''

Export the ~TiddlyWiki core ~JavaScript code for running with external ~JavaScript:

<$button tooltip="Export the ~TiddlyWiki core code for running with external ~JavaScript" aria-label="export TiddlyWiki core" class="tc-btn-big-green">
<$list filter="[[$:/boot/boot.js]is[missing]]" variable="ignore" emptyMessage="""<$action-sendmessage $message="tm-download-file" $param="$:/core/templates/tiddlywiki5.js" filename=<<jsFileName>>/>""" >
<$action-setfield $tiddler=<<qualify "$:/temp/alert">> text=<<noExportMsg>> subtitle="Export ~TiddllyWiki Core"/>
<$action-sendmessage $message="tm-modal" $param=<<qualify "$:/temp/alert">>/>
</$list>
<$list filter="[<tv-config-toolbar-icons>match[yes]]" variable="listItem">
{{$:/core/images/star-filled}}
</$list>
<$list filter="[<tv-config-toolbar-text>match[yes]]">
<span class="tc-btn-text"><$text text={{$:/language/Buttons/ExportTiddlyWikiCore/Caption}}/></span>
</$list>
{{$:/core/images/download-button}} Download ~TiddlyWiki core
</$button>

[[Further information|https://tiddlywiki.com/#Using%20the%20external%20JavaScript%20template]]
1 change: 0 additions & 1 deletion core/wiki/config/PageControlButtons.multids
Expand Up @@ -4,7 +4,6 @@ core/ui/Buttons/advanced-search: hide
core/ui/Buttons/close-all: hide
core/ui/Buttons/encryption: hide
core/ui/Buttons/export-page: hide
core/ui/Buttons/export-tiddlywikicore: hide
core/ui/Buttons/fold-all: hide
core/ui/Buttons/full-screen: hide
core/ui/Buttons/home: hide
Expand Down
2 changes: 1 addition & 1 deletion core/wiki/tags/PageControls.tid
@@ -1,2 +1,2 @@
title: $:/tags/PageControls
list: [[$:/core/ui/Buttons/home]] [[$:/core/ui/Buttons/close-all]] [[$:/core/ui/Buttons/fold-all]] [[$:/core/ui/Buttons/unfold-all]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/new-tiddler]] [[$:/core/ui/Buttons/new-journal]] [[$:/core/ui/Buttons/new-image]] [[$:/core/ui/Buttons/import]] [[$:/core/ui/Buttons/export-page]] [[$:/core/ui/Buttons/control-panel]] [[$:/core/ui/Buttons/advanced-search]] [[$:/core/ui/Buttons/manager]] [[$:/core/ui/Buttons/tag-manager]] [[$:/core/ui/Buttons/language]] [[$:/core/ui/Buttons/palette]] [[$:/core/ui/Buttons/theme]] [[$:/core/ui/Buttons/storyview]] [[$:/core/ui/Buttons/encryption]] [[$:/core/ui/Buttons/timestamp]] [[$:/core/ui/Buttons/full-screen]] [[$:/core/ui/Buttons/print]] [[$:/core/ui/Buttons/save-wiki]] [[$:/core/ui/Buttons/refresh]] [[$:/core/ui/Buttons/export-tiddlywikicore]] [[$:/core/ui/Buttons/more-page-actions]]
list: [[$:/core/ui/Buttons/home]] [[$:/core/ui/Buttons/close-all]] [[$:/core/ui/Buttons/fold-all]] [[$:/core/ui/Buttons/unfold-all]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/new-tiddler]] [[$:/core/ui/Buttons/new-journal]] [[$:/core/ui/Buttons/new-image]] [[$:/core/ui/Buttons/import]] [[$:/core/ui/Buttons/export-page]] [[$:/core/ui/Buttons/control-panel]] [[$:/core/ui/Buttons/advanced-search]] [[$:/core/ui/Buttons/manager]] [[$:/core/ui/Buttons/tag-manager]] [[$:/core/ui/Buttons/language]] [[$:/core/ui/Buttons/palette]] [[$:/core/ui/Buttons/theme]] [[$:/core/ui/Buttons/storyview]] [[$:/core/ui/Buttons/encryption]] [[$:/core/ui/Buttons/timestamp]] [[$:/core/ui/Buttons/full-screen]] [[$:/core/ui/Buttons/print]] [[$:/core/ui/Buttons/save-wiki]] [[$:/core/ui/Buttons/refresh]] [[$:/core/ui/Buttons/more-page-actions]]
Expand Up @@ -14,9 +14,9 @@ However, there is some inefficiency in this arrangement because the core code is

The remaining inefficiency when working in the client server configuration is that the single page wiki that is initially loaded will contain a copy of the entire core code of TiddlyWiki, making it impossible for the browser to cache it.

! A quickstart
! Using the external JavaScript template with the client-server configuration

The mechanism will be activated by setting the [[root-tiddler|WebServer Parameter: root-tiddler]] parameter to `$:/core/save/all-external-js`. This template externalises TiddlyWiki's core JavaScript into a separate file. For example, the following command will start your server with caching enabled. It will transfer the wiki with two GET requests, and the core can be cached by the browser.
The mechanism is activated by setting the [[root-tiddler|WebServer Parameter: root-tiddler]] parameter to `$:/core/save/all-external-js`. This template externalises TiddlyWiki's core JavaScript into a separate file. For example, the following command will start your server with caching enabled. It will transfer the wiki with two GET requests, and the core can be cached by the browser.

```
tiddlywiki YOUR_WIKI_FOLDER --listen 'root-tiddler=$:/core/save/all-external-js' use-browser-cache=yes
Expand All @@ -26,7 +26,7 @@ tiddlywiki YOUR_WIKI_FOLDER --listen 'root-tiddler=$:/core/save/all-external-js'

<<.tip """On Windows, Command Prompt (CMD) users need to replace single quotes `'` with double quotation marks `"`.""">>

! Initializing a new wiki
!! Initializing a new wiki

The provided edition `server-external-js` contains all the configuration necessary to use the external ~JavaScript template. Here is an example:

Expand All @@ -37,35 +37,38 @@ tiddlywiki ./myNewWiki --build listen

The above commands perform the following:

* Create a new wiki with external-js customization included.
* Start the server with external-js enabled. The server listens on port 8080. Visit http://localhost:8080 in your browser.
* Create a new wiki with external JavaScript customization included.
* Start the server with external JavaScript enabled. The server listens on port 8080. Visit http://localhost:8080 in your browser.

To customize your `--build listen` command, see [[tiddlywiki.info Files]] and [[ListenCommand]].

! Standalone wiki with the external-js template
! Using the external JavaScript template with the single file configuration

You can use the "external-js" template with your standalone wiki, but this requires that you have ~TiddlyWiki's core ~JavaScript saved alongside your html file. You may prefer this configuration, for example, if you have several wikis on a ~WebDav server. (See: [[Saving via WebDAV]])
You can use the "external-js" template with your single file wiki, but this requires that you have ~TiddlyWiki's core ~JavaScript saved alongside your HTML file. You may prefer this configuration, for example, if you have several wikis on a ~WebDav server. (See: [[Saving via WebDAV]])

<<.warning "Since working with several files, that belong together, will open up all kinds of synchronisation challenges, this functionality is intended for advanced users.">>
<<.warning "This functionality is intended for advanced users: there are many more ways for things to go wrong than with the standard single file configuration">>

!! Saving your snapshots

If you start your ~TiddlyWiki server in the "external-js" configuration, snapshots you saved from the wiki will also have the external-js configuration:
If you start your ~TiddlyWiki server in the "external-js" configuration, snapshots you save from the wiki will also have the external-js configuration.

* Click on the "cloud" button and choose <<.icon $:/core/images/download-button>> ''Save snapshot for offline use''. The html wiki you saved will have a reduced file size compared to a regular snapshot because the ~TiddlyWiki core code has been externalized. However, to be able to use this wiki, you ''must'' also own a copy of ~TiddlyWiki's core ~JavaScript.
* Click on the "cloud" button and choose <<.icon $:/core/images/download-button>> ''Save ~TiddlyWiki core for offline use'' to download the core ~JavaScript from the server. Save this file in the same folder as your html wiki. <<.from-version "5.2.0">>
You can click on the "cloud" button and choose <<.icon $:/core/images/download-button>> ''Save snapshot for offline use''. The html wiki you saved will have a reduced file size compared to a regular snapshot because the ~TiddlyWiki core code has been externalized. However, to be able to use this wiki, you ''must'' also have a copy of ~TiddlyWiki's core ~JavaScript in the same directory; see below for instructions for obtaining it

The "server-external-js" edition lets you save the snapshot from the command line:

```
tiddlywiki YOUR_WIKI_FOLDER --build index
```

Files "index.html" and "tiddlywikicore-5.x.x.js" will be saved in your wiki folder's `output` directory.
The files `index.html` and `tiddlywikicore-5.x.x.js` will be saved in your wiki folder's `output` directory.

!! Obtaining the ~TiddlyWiki core with tiddlywiki command
!! Obtaining the ~TiddlyWiki core in the browser

You can also run the following command to obtain the core ~JavaScript. The file "tiddlywikicore-5.x.x.js" will be saved in the`output` directory of your wiki folder:
To download a copy of the TiddlyWiki core JavaScript file from any existing TiddlyWiki, visit the system tiddler $:/core/ui/ExportTiddlyWikiCore and click the download button. (You can search for ''~ExportTiddlyWikiCore'' in the ''Shadows'' tab of $:/AdvancedSearch).

!! Obtaining the ~TiddlyWiki core with Node.js

You can also run the following command to obtain the core ~JavaScript. The file `tiddlywikicore-5.x.x.js` will be saved in the`output` directory of your wiki folder:

```
tiddlywiki YOUR_WIKI_FOLDER \
Expand All @@ -74,15 +77,17 @@ tiddlywiki YOUR_WIKI_FOLDER \
'text/plain'
```

The "server-external-js" edition has the shortcut set up for you. Just run:
The "server-external-js" edition has a shortcut for the BuildCommand to do the same thing:

```
tiddlywiki YOUR_WIKI_FOLDER --build tiddlywikicore
```

! Upgrading your standalone wiki <span style="font-size:0.65em">(experimental)</span>
! Upgrading your standalone wiki

<<.warning "This procedure is experimental, please take care to backup your data">>

Before you proceed, backup your wiki first! Follow the steps below to upgrade a single-file wiki with the external-js template:
Before you proceed, backup your wiki first! Follow the steps below to upgrade a single-file wiki with the external JavaScript template:

# Proceed with the [[Upgrade Process for Standalone TiddlyWikis|Upgrading]]. Your wiki will be converted to a full standalone HTML.

Expand Down
2 changes: 0 additions & 2 deletions languages/ca-ES/Buttons.multids
Expand Up @@ -50,8 +50,6 @@ ExportTiddler/Caption: exporta el tiddler
ExportTiddler/Hint: Exporta aquest tiddler
ExportTiddlers/Caption: exporta tiddlers
ExportTiddlers/Hint: Exporta els tiddlers
ExportTiddlyWikiCore/Caption: exporta el nucli del TiddlyWiki
ExportTiddlyWikiCore/Hint: Exporta el codi del nucli del ~TiddlyWiki per tal d'executar-ho amb ~JavaScript extern
Fold/Caption: expandeix el tiddler
Fold/FoldBar/Caption: barra d'expansió
Fold/FoldBar/Hint: Barres opcionals per a contraure i expandir els tiddlers
Expand Down
2 changes: 0 additions & 2 deletions languages/zh-Hans/Buttons.multids
Expand Up @@ -32,8 +32,6 @@ ExportTiddler/Caption: 导出此条目
ExportTiddler/Hint: 导出此条目
ExportTiddlers/Caption: 导出条目
ExportTiddlers/Hint: 导出条目
ExportTiddlyWikiCore/Caption: 导出 TiddlyWiki 核心
ExportTiddlyWikiCore/Hint: 导出 ~TiddlyWiki 核心代码,适用于以外部 ~JavaScript 运行
SidebarSearch/Hint: 选择侧边栏的查找字段
Fold/Caption: 收合条目
Fold/Hint: 收合此条目的内容
Expand Down
2 changes: 0 additions & 2 deletions languages/zh-Hant/Buttons.multids
Expand Up @@ -32,8 +32,6 @@ ExportTiddler/Caption: 導出此條目
ExportTiddler/Hint: 導出此條目
ExportTiddlers/Caption: 導出條目
ExportTiddlers/Hint: 導出條目
ExportTiddlyWikiCore/Caption: 導出 TiddlyWiki 核心
ExportTiddlyWikiCore/Hint: 導出 ~TiddlyWiki 核心程式碼,適用於以外部 ~JavaScript 執行
SidebarSearch/Hint: 選擇側邊欄的搜尋欄位
Fold/Caption: 收合條目
Fold/Hint: 收合此條目的內容
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion plugins/tiddlywiki/tiddlyweb/tags-syncerdropdown.tid
@@ -1,2 +1,2 @@
title: $:/tags/SyncerDropdown
list: $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/login-status $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/login $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/refresh $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/logout $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/save-snapshot $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/download-tiddlywikicore $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/copy-logs
list: $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/login-status $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/login $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/refresh $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/logout $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/save-snapshot $:/plugins/tiddlywiki/tiddlyweb/syncer-actions/copy-logs

0 comments on commit fba9935

Please sign in to comment.