Use native Ctrl+V paste and add media stream status diagnostics

This commit is contained in:
Jage9
2026-02-22 02:08:14 -05:00
parent 460ad08c02
commit 830ad199db
3 changed files with 26 additions and 22 deletions

View File

@@ -178,7 +178,7 @@ let outputMode = localStorage.getItem(AUDIO_OUTPUT_MODE_STORAGE_KEY) === 'mono'
let connecting = false;
const messageBuffer: string[] = [];
let messageCursor = -1;
const radioRuntime = new RadioStationRuntime(audio, getItemSpatialConfig);
const radioRuntime = new RadioStationRuntime(audio, getItemSpatialConfig, (message) => updateStatus(message));
const itemEmitRuntime = new ItemEmitRuntime(audio, resolveIncomingSoundUrl, getItemSpatialConfig);
let internalClipboardText = '';
let replaceTextOnNextType = false;
@@ -629,21 +629,6 @@ function pasteIntoActiveTextInput(raw: string): boolean {
return true;
}
async function handlePasteShortcut(): Promise<void> {
let pasted = internalClipboardText;
try {
const clipboardText = await navigator.clipboard?.readText();
if (typeof clipboardText === 'string') {
pasted = clipboardText;
internalClipboardText = clipboardText;
}
} catch {
// Clipboard read can fail without user gesture/permissions; fallback to internal clipboard.
}
if (!pasteIntoActiveTextInput(pasted)) return;
updateStatus('pasted');
}
function isTextEditingMode(mode: typeof state.mode): boolean {
return mode === 'nickname' || mode === 'chat' || mode === 'itemPropertyEdit';
}
@@ -2398,7 +2383,8 @@ function setupInputHandlers(): void {
if (event.altKey) return;
if (event.ctrlKey && !isTextEditingMode(state.mode)) return;
if (state.mode !== 'normal' || !code.startsWith('Arrow')) {
const isNativePasteShortcut = event.ctrlKey && isTextEditingMode(state.mode) && code === 'KeyV';
if ((state.mode !== 'normal' || !code.startsWith('Arrow')) && !isNativePasteShortcut) {
event.preventDefault();
}
@@ -2420,10 +2406,6 @@ function setupInputHandlers(): void {
updateStatus('cut');
return;
}
if (code === 'KeyV') {
void handlePasteShortcut();
return;
}
}
if (isTypingKey(code) && state.keysPressed[code]) return;