From 33559075814a7eb4c7270de92f199693300a8c01 Mon Sep 17 00:00:00 2001 From: Leilei332 Date: Sun, 15 Sep 2024 17:48:08 +0800 Subject: [PATCH] Seperate clear cookie and disable actions in Browser Storage Plugin (#8602) Added two messages: * `tm-delete-browser-storage` for deleting the cookie saved by the Browser Storage plugin * `tm-disable-browser-storage` for disabling Browser Storage --- plugins/tiddlywiki/browser-storage/startup.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/tiddlywiki/browser-storage/startup.js b/plugins/tiddlywiki/browser-storage/startup.js index e06d7bf48..2d7287971 100644 --- a/plugins/tiddlywiki/browser-storage/startup.js +++ b/plugins/tiddlywiki/browser-storage/startup.js @@ -54,6 +54,13 @@ exports.startup = function() { $tw.wiki.addTiddler({title: ENABLED_TITLE, text: "no"}); $tw.browserStorage.clearLocalStorage(); }); + // Seperate clear cookie and disable action + $tw.rootWidget.addEventListener("tm-delete-browser-storage",function(event) { + $tw.browserStorage.clearLocalStorage(); + }); + $tw.rootWidget.addEventListener("tm-disable-browser-storage",function(event) { + $tw.wiki.addTiddler({title: ENABLED_TITLE, text: "no"}); + }); // Helpers for protecting storage from eviction var setPersistedState = function(state) { $tw.wiki.addTiddler({title: PERSISTED_STATE_TITLE, text: state});