diff --git a/package.json b/package.json index e556233..4f78484 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "link-map", "displayName": "Link Map", - "version": "1.0.5", + "version": "1.0.6", "browserslist": "Chrome >= 96", "description": "Vertical Tabs Sidebar, But In Tree Structure", "author": "Garin", diff --git a/public/_locales/zh_CN/messages.json b/public/_locales/zh_CN/messages.json index 81f8d91..6bdc033 100644 --- a/public/_locales/zh_CN/messages.json +++ b/public/_locales/zh_CN/messages.json @@ -126,7 +126,7 @@ "message": "明亮模式" }, "themeDark": { - "message": "暗黑模式" + "message": "黑暗模式" }, "commandTriggerLinkMap": { "message": "打开Link Map" diff --git a/src/background/index.ts b/src/background/index.ts index 51bc523..22c9b68 100644 --- a/src/background/index.ts +++ b/src/background/index.ts @@ -21,7 +21,11 @@ try { if (details.reason === 'install') { await setIsNewUser(true); } - if (details.reason === 'update') { + if ( + details.reason === 'update' && + details.previousVersion !== '1.0.5' && + browser.runtime.getManifest().version === '1.0.5' + ) { // chrome.runtime.getManifest().version await setIsUpdate(true); } diff --git a/src/manifest.ts b/src/manifest.ts index 9db2c41..e7c41b6 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -2,6 +2,11 @@ import type { Manifest } from 'webextension-polyfill'; import pkg from '../package.json'; +// command key enums +export const commandKeyMap = { + openLinkMap: 'openLinkMap', +}; + const manifest: Manifest.WebExtensionManifest = { name: pkg.displayName, version: pkg.version, @@ -38,7 +43,7 @@ const manifest: Manifest.WebExtensionManifest = { // }, // ], commands: { - openLinkMap: { + [commandKeyMap.openLinkMap]: { suggested_key: { default: 'Shift+Ctrl+L', mac: 'Shift+Command+L', diff --git a/src/styles/light-mode.less b/src/styles/light-mode.less index c9682df..65a8718 100644 --- a/src/styles/light-mode.less +++ b/src/styles/light-mode.less @@ -25,8 +25,8 @@ --footer-border-top-color: #1f2022; --content-bg-color: var(--main-bg-color); --title-hover-bg-color: #e4e8ea; - --icon-bg-color: transparent; - --icon-border-color: transparent; + --icon-bg-color: #e4e4e4; + --icon-border-color: #e4e4e4; // search input --search-input-bg-color: rgb(227 229 232); --search-input-border-color: #d9d9d9; diff --git a/src/tree/features/shortcuts/config.ts b/src/tree/features/shortcuts/config.ts index e433cd4..a0ef8bf 100644 --- a/src/tree/features/shortcuts/config.ts +++ b/src/tree/features/shortcuts/config.ts @@ -1,8 +1,10 @@ import { message } from 'antd'; +import log from 'loglevel'; import type { ExtendedKeyboardEvent } from 'mousetrap'; import browser from 'webextension-polyfill'; import { getShortcutSettingUrl } from '../../../config/browser-adapter-config'; +import { commandKeyMap } from '../../../manifest'; import { getOS } from '../../../utils'; import { FancyTabMasterTree } from '../tab-master-tree/fancy-tab-master-tree'; @@ -138,11 +140,18 @@ export const getDisplayName = (keys: string[]) => { .join('/'); }; +const keyDisplayNameByOS = (key: string) => { + return getOS() === 'MacOS' ? [...key].join(' + ') : key.split('+').join(' + '); +}; + export const getShortCutMap = async () => { const shortcuts = await browser.commands.getAll(); - const activeShortCut = shortcuts.find((shortcut) => shortcut.name === 'openLinkMap')!.shortcut; + const activeShortCut = shortcuts.find( + (shortcut) => shortcut.name === commandKeyMap.openLinkMap, + )!.shortcut; + log.debug('activeShortCut', activeShortCut); const key = activeShortCut - ? activeShortCut?.split('').join(' + ') + ? keyDisplayNameByOS(activeShortCut) : browser.i18n.getMessage('commandUnset'); ShortcutMap.activeLinkMap.key = [key]; return ShortcutMap; diff --git a/src/tree/features/tab-master-tree/nodes/tab-node-operations.ts b/src/tree/features/tab-master-tree/nodes/tab-node-operations.ts index 9dd7917..e40e469 100644 --- a/src/tree/features/tab-master-tree/nodes/tab-node-operations.ts +++ b/src/tree/features/tab-master-tree/nodes/tab-node-operations.ts @@ -17,7 +17,6 @@ export interface TabData extends Tabs.Tab, TreeData { export const TabNodeOperations = { createSimple(url: string, title: string, alias = ''): TreeNode { - console.log(getFaviconUrl(url)); const defaultTab = { title, url, diff --git a/src/tree/features/tab-master-tree/style.less b/src/tree/features/tab-master-tree/style.less index 24aa5ae..9b4a802 100644 --- a/src/tree/features/tab-master-tree/style.less +++ b/src/tree/features/tab-master-tree/style.less @@ -54,7 +54,7 @@ body { } ul.fancytree-container { - padding: 8px 0 8px 8px; + padding: 8px 0 50px 8px; background-color: var(--content-bg-color); border: 0; outline: 0;