Skip to content

Commit

Permalink
export JSON data
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcoding810 committed Sep 7, 2024
1 parent 7d28921 commit a22e126
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Binary file added public/json16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/json32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/pages/background/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Tab } from '@src/types';
import { setBadge, setBadgeBackground } from '@src/utils/badge';
import { isProd } from '@src/utils/env';
import { save2Json } from '@src/utils/file';
import { getValue, setValue } from '@src/utils/storage';
import {
createTab,
Expand Down Expand Up @@ -153,6 +154,20 @@ function setupContextMenu() {
},
} as chrome.contextMenus.CreateProperties);
}

chrome.contextMenus.create({
id: 'export_json',
title: 'Export JSON',
contexts: ['browser_action'],
onclick: async () => {
const data = await getValue();
save2Json(data);
},
icons: {
16: '../public/json16.png',
32: '../public/json32.png',
},
} as chrome.contextMenus.CreateProperties);
}

function setupOmnibox() {
Expand Down

0 comments on commit a22e126

Please sign in to comment.