Skip to content

Commit

Permalink
Merge pull request #14 from GarinZ/v1.0.6
Browse files Browse the repository at this point in the history
V1.0.6
  • Loading branch information
GarinZ authored Mar 31, 2023
2 parents 789490b + 6730749 commit e98ec68
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion public/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"message": "明亮模式"
},
"themeDark": {
"message": "暗黑模式"
"message": "黑暗模式"
},
"commandTriggerLinkMap": {
"message": "打开Link Map"
Expand Down
6 changes: 5 additions & 1 deletion src/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
7 changes: 6 additions & 1 deletion src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -38,7 +43,7 @@ const manifest: Manifest.WebExtensionManifest = {
// },
// ],
commands: {
openLinkMap: {
[commandKeyMap.openLinkMap]: {
suggested_key: {
default: 'Shift+Ctrl+L',
mac: 'Shift+Command+L',
Expand Down
4 changes: 2 additions & 2 deletions src/styles/light-mode.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 11 additions & 2 deletions src/tree/features/shortcuts/config.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export interface TabData extends Tabs.Tab, TreeData {

export const TabNodeOperations = {
createSimple(url: string, title: string, alias = ''): TreeNode<TabData> {
console.log(getFaviconUrl(url));
const defaultTab = {
title,
url,
Expand Down
2 changes: 1 addition & 1 deletion src/tree/features/tab-master-tree/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e98ec68

Please sign in to comment.