1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-14 05:44:50 +00:00
TiddlyWiki5/plugins/tiddlywiki/browser-storage/settings.tid
btheado 86d45f1c3d
Request permission to protect local storage from eviction (#7398)
* Request the browser to never evict the persistent storage

* Store browser storage persisted state in a tiddler

* Factor out some code into helper functions

* Display status of persistence request in the settings page
2023-06-13 10:50:00 +01:00

46 lines
2.4 KiB
Plaintext

title: $:/plugins/tiddlywiki/browser-storage/settings
! Disable
You can disable the browser storage plugin:
<$checkbox tiddler="$:/config/BrowserStorage/Enabled" field="text" checked="yes" unchecked="no" default="yes"> Use browser local storage</$checkbox>
! Clear
Click this button to clear browser storage and disable its use:
<$button message="tm-clear-browser-storage">Clear browser storage</$button>
! Save Filter
This filter determines which tiddlers will be saved to local storage.
* `[prefix[$:/state/]] -[prefix[$:/state/popup/]]` - the default value. Save state tiddlers except popup state tiddlers, thus preserving selected tabs and the open/closed status of table of contents entries. Any other tiddlers created or changed will be lost after reloading the page.
* `[all[]]` - attempt to save all changed tiddlers. This means even popup state tiddlers and temporary tiddlers will be saved.
* `[all[]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]]` - save all tiddlers except popup state tiddlers, temp tiddlers and the history list.
<$link to="$:/config/BrowserStorage/SaveFilter">Browser Storage Save Filter</$link>: <$edit-text tiddler="$:/config/BrowserStorage/SaveFilter" default="" tag="input" size="50"/>
! Custom Quota Exceeded Alert
This setting allows a custom alert message to be displayed when an attempt to store a tiddler fails due to the storage quota being exceeded:
<$link to="$:/config/BrowserStorage/QuotaExceededAlert">Quota Exceeded Alert</$link>: <$edit-text tiddler="$:/config/BrowserStorage/QuotaExceededAlert" default="" tag="input" size="50"/>
! Prevent browser from evicting local storage
Permission for local storage persistence: ''{{$:/info/browser/storage/persisted}}''
The first time a tiddler is saved to local storage a request will be made to prevent automatic eviction of local storage for this site. This means the data will not be cleared unless the user manually clears it.
Old browsers may not support this feature. New browsers might not support the feature if the wiki is hosted on a non-localhost unencrypted http connection.
Some browsers will explicitly prompt the user for permission. Other browsers may automatically grant or deny the request based on site usage or based on whether the site is bookmarked.
! Startup Log
The tiddler $:/temp/BrowserStorage/Log contains a log of the tiddlers that were loaded from local storage at startup:
<<list-links "[enlist{$:/temp/BrowserStorage/Log}sort[]]">>