diff --git a/package.json b/package.json index 2305e62..d31aa2a 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ }, "license": "MIT", "dependencies": { + "@codemirror/commands": "6.8.1", "@codemirror/lang-angular": "^0.1.4", "@codemirror/lang-cpp": "^6.0.3", "@codemirror/lang-css": "^6.3.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index debd5b9..770b6a4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: dependencies: + '@codemirror/commands': + specifier: 6.8.1 + version: 6.8.1 '@codemirror/lang-angular': specifier: ^0.1.4 version: 0.1.4 @@ -239,8 +242,8 @@ packages: '@codemirror/autocomplete@6.20.0': resolution: {integrity: sha512-bOwvTOIJcG5FVo5gUUupiwYh8MioPLQ4UcqbcRf7UQ98X90tCa9E1kZ3Z7tqwpZxYyOvh1YTYbmZE9RTfTp5hg==} - '@codemirror/commands@6.10.1': - resolution: {integrity: sha512-uWDWFypNdQmz2y1LaNJzK7fL7TYKLeUAU0npEC685OKTF3KcQ2Vu3klIM78D7I6wGhktme0lh3CuQLv0ZCrD9Q==} + '@codemirror/commands@6.8.1': + resolution: {integrity: sha512-KlGVYufHMQzxbdQONiLyGQDUW0itrLZwq3CcY7xpv9ZLRHqzkBSoteocBHtMCoY7/Ci4xhzSrToIeLg7FxHuaw==} '@codemirror/lang-angular@0.1.4': resolution: {integrity: sha512-oap+gsltb/fzdlTQWD6BFF4bSLKcDnlxDsLdePiJpCVNKWXSTAbiiQeYI3UmES+BLAdkmIC1WjyztC1pi/bX4g==} @@ -2184,7 +2187,7 @@ snapshots: '@codemirror/view': 6.39.11 '@lezer/common': 1.5.0 - '@codemirror/commands@6.10.1': + '@codemirror/commands@6.8.1': dependencies: '@codemirror/language': 6.12.1 '@codemirror/state': 6.5.4 @@ -3214,7 +3217,7 @@ snapshots: codemirror@6.0.2: dependencies: '@codemirror/autocomplete': 6.20.0 - '@codemirror/commands': 6.10.1 + '@codemirror/commands': 6.8.1 '@codemirror/language': 6.12.1 '@codemirror/lint': 6.9.3 '@codemirror/search': 6.6.0 diff --git a/src/lib/components/InputBar.svelte b/src/lib/components/InputBar.svelte index d798985..a05da28 100644 --- a/src/lib/components/InputBar.svelte +++ b/src/lib/components/InputBar.svelte @@ -30,6 +30,7 @@ import SnippetLibraryPanel from "$lib/components/SnippetLibraryPanel.svelte"; import QuickActionsPanel from "$lib/components/QuickActionsPanel.svelte"; import ClipboardHistoryPanel from "$lib/components/ClipboardHistoryPanel.svelte"; + import TextInputContextMenu from "$lib/components/TextInputContextMenu.svelte"; import type { Attachment } from "$lib/types/messages"; const INPUT_HISTORY_KEY = "hikari-input-history"; @@ -49,6 +50,23 @@ let showClipboardHistory = $state(false); let streamerModeActive = $state(false); + // Context menu state + let textareaElement: HTMLTextAreaElement | undefined = $state(); + let contextMenuShow = $state(false); + let contextMenuX = $state(0); + let contextMenuY = $state(0); + + function handleContextMenu(event: MouseEvent) { + event.preventDefault(); + contextMenuShow = true; + contextMenuX = event.clientX; + contextMenuY = event.clientY; + } + + function closeContextMenu() { + contextMenuShow = false; + } + isStreamerMode.subscribe((value) => { streamerModeActive = value; }); @@ -876,10 +894,12 @@ User: ${formattedMessage}`;