diff --git a/src/app/components/editor/Editor.tsx b/src/app/components/editor/Editor.tsx index a461d5ad..d2b44e0f 100644 --- a/src/app/components/editor/Editor.tsx +++ b/src/app/components/editor/Editor.tsx @@ -169,6 +169,9 @@ export const CustomEditor = forwardRef( const isRenderedSingleLine = !layoutIsMultiline; if (isRenderedSingleLine && scroll) { + // Scroll.clientWidth is the width the editable actually gets after padding and + // scrollbar math. Cache that delta while we are rendered single-line so later + // hidden measurements can compare against the same usable width. const renderedSingleLineWidth = scroll.clientWidth; if (renderedSingleLineWidth > 0) { singleLineWidthOffsetRef.current = Math.max( @@ -231,6 +234,9 @@ export const CustomEditor = forwardRef( textMeasurer.style.textTransform = computedStyle.textTransform; textMeasurer.style.textIndent = computedStyle.textIndent; textMeasurer.style.tabSize = computedStyle.tabSize; + // Measure against a hidden clone instead of the live editable so we can ask + // "would this wrap at single-line width?" without the current layout feeding + // back into the answer. const measureHeight = (content: string, width: string): number => { textMeasurer.style.width = width; textMeasurer.textContent = normalizeMeasurementText(content); diff --git a/src/app/features/room/AudioMessageRecorder.tsx b/src/app/features/room/AudioMessageRecorder.tsx index d8904532..136ccb6f 100644 --- a/src/app/features/room/AudioMessageRecorder.tsx +++ b/src/app/features/room/AudioMessageRecorder.tsx @@ -65,6 +65,8 @@ export const AudioMessageRecorder = forwardRef< onAudioLengthUpdateRef.current = onAudioLengthUpdate; const stableOnStop = useCallback((payload: VoiceRecorderStopPayload) => { + // useVoiceRecorder also stops during cancel/teardown paths, so only surface a completed + // recording after an explicit user stop. if (!userRequestedStopRef.current) return; if (isDismissedRef.current) return; onRecordingCompleteRef.current({ diff --git a/src/app/plugins/voice-recorder-kit/useVoiceRecorder.ts b/src/app/plugins/voice-recorder-kit/useVoiceRecorder.ts index bdfb5f83..e623c1b1 100644 --- a/src/app/plugins/voice-recorder-kit/useVoiceRecorder.ts +++ b/src/app/plugins/voice-recorder-kit/useVoiceRecorder.ts @@ -146,11 +146,14 @@ export function useVoiceRecorder(options: UseVoiceRecorderOptions = {}): UseVoic if (!audioContext) return; if (recordingStream) { + // Recording contexts are disposable. Closing them fully releases the capture graph so + // mobile browsers do not keep the mic route or low-quality audio mode alive. if (audioContext.state !== 'closed') { audioContext.close().catch(() => {}); } return; } + // Playback reuses a shared context, so suspend it instead of tearing it down. if (audioContext.state !== 'closed') { audioContext.suspend().catch(() => {}); }