From 5a455adbd586ffec17791b52ef133d5be1d8103c Mon Sep 17 00:00:00 2001 From: allen <272970666@qq.com> Date: Thu, 12 May 2022 01:13:29 +0800 Subject: [PATCH 1/3] feat: add copying mode --- src/components/ActionsMenu.vue | 10 +++++++-- src/components/IconDetail.vue | 28 +++++++++++------------- src/components/IconSet.vue | 40 ++++++++++++++++++++++++++-------- src/store/localstorage.ts | 4 +++- 4 files changed, 55 insertions(+), 27 deletions(-) diff --git a/src/components/ActionsMenu.vue b/src/components/ActionsMenu.vue index 2df20ccb..74530aa2 100644 --- a/src/components/ActionsMenu.vue +++ b/src/components/ActionsMenu.vue @@ -1,6 +1,6 @@ @@ -12,14 +15,14 @@ export default defineComponent(() => ({ class=" dragging p-2 relative bg-base z-10 flex border-b border-base flex-none " - :class="$route.path !== '/' ? 'md:hidden' : ''" + :class="showNavPages.includes($route.path) ? '' : 'md:hidden'" > @@ -38,6 +41,12 @@ export default defineComponent(() => ({ > IcĂ´nes + + + +import { userConfig } from '../store' + + + diff --git a/src/store/localstorage.ts b/src/store/localstorage.ts index 9154b1c9..47e54765 100644 --- a/src/store/localstorage.ts +++ b/src/store/localstorage.ts @@ -1,5 +1,6 @@ import type { IdCase } from '../utils/case' import { idCases } from '../utils/case' +import { defaultConfig } from '../utils/config' const RECENT_CAPACITY = 10 @@ -15,6 +16,7 @@ export const recentIds = useStorage('icones-recent-collections', []) export const bags = useStorage('icones-bags', []) export const activeMode = useStorage('active-mode', 'normal') export const preferredCase = useStorage('icones-preferfed-case', 'iconify') +export const userConfig = useStorage('icones-config', defaultConfig) export function getTransformedId(icon: string) { return idCases[preferredCase.value]?.(icon) || icon diff --git a/src/utils/config.ts b/src/utils/config.ts new file mode 100644 index 00000000..3f94cd61 --- /dev/null +++ b/src/utils/config.ts @@ -0,0 +1,5 @@ +export const defaultConfig = { + 'Name copying mode': { + prefix: '', + }, +} diff --git a/src/utils/copy.ts b/src/utils/copy.ts new file mode 100644 index 00000000..3cb2ea4b --- /dev/null +++ b/src/utils/copy.ts @@ -0,0 +1,6 @@ +import copyText from 'copy-text-to-clipboard' +import { userConfig } from '../store' + +export function copyName(icon: string) { + return copyText(userConfig.value['Name copying mode'].prefix + icon) +}