From bd44f041d5103f8de322dc13f3f292c9356c9a30 Mon Sep 17 00:00:00 2001 From: narcolepticinsomniac Date: Tue, 11 Feb 2020 09:42:05 -0500 Subject: [PATCH] Add reload context menu item --- _locales/en/messages.json | 4 ++++ background/background.js | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index bacb8089..55098a94 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1145,6 +1145,10 @@ "message": "Temporarily applies the changes without saving.\nSave the style to make the changes permanent.", "description": "Tooltip for the checkbox in style editor to enable live preview while editing." }, + "reload": { + "message": "Reload Stylus extension", + "description": "Context menu reload" + }, "replace": { "message": "Replace", "description": "Label before the replace input field in the editor shown on Ctrl-H" diff --git a/background/background.js b/background/background.js index 5b117fcc..6193ba97 100644 --- a/background/background.js +++ b/background/background.js @@ -187,6 +187,7 @@ browserCommands = { styleDisableAll(info) { prefs.set('disableAll', info ? info.checked : !prefs.get('disableAll')); }, + reload: () => chrome.runtime.reload(), }; // ************************************************************************* @@ -208,6 +209,11 @@ contextMenus = { title: 'openOptions', click: browserCommands.openOptions, }, + 'reload': { + presentIf: () => localStorage.installType !== 'normal', + title: 'reload', + click: browserCommands.reload, + }, 'editor.contextDelete': { presentIf: () => !FIREFOX && prefs.get('editor.contextDelete'), title: 'editDeleteText',