diff --git a/public/tool/add.svg b/public/tool/add.svg new file mode 100644 index 0000000..2df47b0 --- /dev/null +++ b/public/tool/add.svg @@ -0,0 +1 @@ + diff --git a/src/assets/script/storage.ts b/src/assets/script/storage.ts index ce6efa7..cf3a28b 100644 --- a/src/assets/script/storage.ts +++ b/src/assets/script/storage.ts @@ -40,7 +40,6 @@ export const storage = reactive(readDictConfig({ { "type": ToolTypes.BUILTIN, "name": "OpenAI", "link": "https://chat.openai.com", "icon": "/tool/openai.svg" }, { "type": ToolTypes.BUILTIN, "name": "Stack Overflow", "link": "https://stackoverflow.com", "icon": "/tool/stackoverflow.svg" }, { "type": ToolTypes.BUILTIN, "name": "Light Notes", "link": "https://notes.lightxi.com", "icon": "/tool/lightnotes.ico" }, - { "type": ToolTypes.BUILTIN, "name": "Twitter", "link": "https://twitter.com", "icon": "/tool/twitter.svg" }, { "type": ToolTypes.BUILTIN, "name": "Cloudflare", "link": "https://dash.cloudflare.com", "icon": "/tool/cloudflare.svg" }, { "type": ToolTypes.BUILTIN, "name": "Vercel", "link": "https://vercel.com", "icon": "/tool/vercel.svg" }, { "type": ToolTypes.BUILTIN, "name": "Codepen", "link": "https://codepen.io", "icon": "/tool/codepen.svg" }, diff --git a/src/assets/script/utils/base.ts b/src/assets/script/utils/base.ts index b0a6625..dce42cf 100644 --- a/src/assets/script/utils/base.ts +++ b/src/assets/script/utils/base.ts @@ -27,6 +27,10 @@ export function contains(els: Element[], target: HTMLElement): boolean { return els.some((el: Element) => contain(el, target)); } +export function swap(arr: T[], i: number, j: number) { + [arr[i], arr[j]] = [arr[j], arr[i]]; +} + export function clipboard(text: string) { const el = document.createElement("textarea"); el.value = text; diff --git a/src/components/InputBox.vue b/src/components/InputBox.vue index ffe983b..b14bf21 100644 --- a/src/components/InputBox.vue +++ b/src/components/InputBox.vue @@ -63,6 +63,15 @@ window.addEventListener('keydown', function (e) { toggle(); } }); + +window.addEventListener('contextmenu', function (e) { + e.preventDefault(); + const target = e.target as HTMLElement; + const status = contains([ + document.getElementById('input') as HTMLElement, + ], target); + emit('update:modelValue', status); +});