1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-10-31 23:26:18 +00:00
TiddlyWiki5/plugins/tiddlywiki/browser-storage/settings.tid
btheado 8a9d48e055
Allow browser storage plugin to delete existing tiddlers (#6625)
* Do not remove localstorage items while looping

While looping over all the browser storage items by index, the items
should not be removed because removing alters the index positions. The
item following the removed one will be skipped by the loop.

Instead, accumulate a list of keys to remove and remove them after the
loop.

* Implement full delete support for browser storage plugin

Before, deletes only worked for tiddlers which are only present in the
localstorage. Now deleted tiddlers are marked in localstorage using an
empty string value.

At startup, the localstorage tiddlers with empty strings will be deleted
from the wiki if they are still present. If they are already gone from
the wiki, then the blank localstorage entry will be deleted.

* Document drawbacks to using '[all[]]' and provide an alternative
2022-04-12 22:11:37 +01:00

36 lines
2.1 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. In addition, when a plugin is installed, all the shadow tiddlers are individually "exploded" into local storage. Deleting the plugin requires deleting all the tiddlers individually. Not recommended unless these issues are unimportant.
* `[all[]] -[is[shadow]!is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]]` - save all tiddlers except unmodified shadow tiddlers, popup state tiddlers, temp tiddlers and the history list. Solves the aforementioned issues with `[all[]]`. Recommended.
<$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"/>
! 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[]]">>