Fix Ctrl+V paste and split user/item landing tones
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Maintainer-controlled web client version.
|
// Maintainer-controlled web client version.
|
||||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||||
window.CHGRID_WEB_VERSION = "2026.02.21 R92";
|
window.CHGRID_WEB_VERSION = "2026.02.21 R93";
|
||||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||||
|
|||||||
@@ -253,10 +253,14 @@ export class AudioEngine {
|
|||||||
this.playSound({ freq: isDefault ? 659.25 : 440, duration: 0.1, type: 'sine', gain: 0.35 });
|
this.playSound({ freq: isDefault ? 659.25 : 440, duration: 0.1, type: 'sine', gain: 0.35 });
|
||||||
}
|
}
|
||||||
|
|
||||||
sfxTileOccupantPing(): void {
|
sfxTileItemPing(): void {
|
||||||
this.playSound({ freq: 1320, duration: 0.12, type: 'sine', gain: 0.45 });
|
this.playSound({ freq: 1320, duration: 0.12, type: 'sine', gain: 0.45 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sfxTileUserPing(): void {
|
||||||
|
this.playSound({ freq: 880, duration: 0.12, type: 'sine', gain: 0.45 });
|
||||||
|
}
|
||||||
|
|
||||||
async playSpatialSample(url: string, sourcePosition: { x: number; y: number }, gain = 1): Promise<void> {
|
async playSpatialSample(url: string, sourcePosition: { x: number; y: number }, gain = 1): Promise<void> {
|
||||||
await this.ensureContext();
|
await this.ensureContext();
|
||||||
const { audioCtx, sfxGainNode } = this;
|
const { audioCtx, sfxGainNode } = this;
|
||||||
|
|||||||
@@ -572,6 +572,21 @@ function pasteIntoActiveTextInput(raw: string): boolean {
|
|||||||
return true;
|
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 {
|
function isTextEditingMode(mode: typeof state.mode): boolean {
|
||||||
return mode === 'nickname' || mode === 'chat' || mode === 'itemPropertyEdit';
|
return mode === 'nickname' || mode === 'chat' || mode === 'itemPropertyEdit';
|
||||||
}
|
}
|
||||||
@@ -779,13 +794,14 @@ function handleMovement(): void {
|
|||||||
const tileAnnouncements: string[] = [];
|
const tileAnnouncements: string[] = [];
|
||||||
if (namesOnTile.length > 0) {
|
if (namesOnTile.length > 0) {
|
||||||
tileAnnouncements.push(namesOnTile.join(', '));
|
tileAnnouncements.push(namesOnTile.join(', '));
|
||||||
|
audio.sfxTileUserPing();
|
||||||
}
|
}
|
||||||
if (itemsOnTile.length > 0) {
|
if (itemsOnTile.length > 0) {
|
||||||
tileAnnouncements.push(itemsOnTile.map((item) => itemLabel(item)).join(', '));
|
tileAnnouncements.push(itemsOnTile.map((item) => itemLabel(item)).join(', '));
|
||||||
|
audio.sfxTileItemPing();
|
||||||
}
|
}
|
||||||
if (tileAnnouncements.length > 0) {
|
if (tileAnnouncements.length > 0) {
|
||||||
updateStatus(tileAnnouncements.join('. '));
|
updateStatus(tileAnnouncements.join('. '));
|
||||||
audio.sfxTileOccupantPing();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2066,7 +2082,8 @@ function setupInputHandlers(): void {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (code === 'KeyV') {
|
if (code === 'KeyV') {
|
||||||
updateStatus('pasted');
|
void handlePasteShortcut();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user