Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): keep the composer open while selecting timeline text #9499

Mergedjuliusmarmingemerged 1 commit intofix/composer-paste-expands fromrefs/pull/9499/headmerged by juliusmarminge View on GitHub

Showing 3 changed files with 105 additions and 1 deletion.

x
0 of 3 viewed, 3 left
35 additions and 1 deletionapps/web/src/components/chat/ChatComposer.tsxModified
View file
@@ -206,6 +206,7 @@
resetComposerScrollGesture,
suppressActiveComposerScrollGesture,
} from "./composerScrollGesture";
+import { selectionHoldsComposerOpen } from "./composerSelectionHold";
import { prepareVideoFirstFrame } from "../../lib/videoFirstFrame";
​
function ComposerVideoThumbnail({ file }: { file: File }) {
@@ -4293,9 +4294,42 @@
return;
+ if (
+ !isMobileViewport &&
+ selectionHoldsComposerOpen(window.getSelection(), getTimelineScrollableNode())
+ ) {
+ // The check runs again once the selection clears.
+ return;
+ }
setIsComposerFocused(false);
- }, [isMobileViewport]);
+ }, [getTimelineScrollableNode, isMobileViewport]);
+​
+ // A held collapse settles when the selection goes away, whether the user
+ // clicked elsewhere, pressed Escape, or used the selection toolbar.
+ useEffect(() => {
+ if (isMobileViewport || !isComposerFocused) return;
+ let wasHolding = false;