Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

composerEventScope.ts

21 lines781 Bytes

1const COMPOSER_FLOATING_LAYER_SELECTOR = [
2 '[data-composer-drawer-layer="true"]',
3 '[data-chat-composer-floating-layer="true"]',
4].join(",");
5​
6export const composerFloatingLayerProps = {
7 "data-chat-composer-floating-layer": "true",
8} as const;
9​
10export function isInsideComposerFloatingLayer(target: EventTarget | null): boolean {
11 return target instanceof Element && target.closest(COMPOSER_FLOATING_LAYER_SELECTOR) !== null;
13​
14export function isInsideRestingComposerControlScope(target: EventTarget | null): boolean {
15 return (
16 target instanceof Element &&
17 (target.closest('[data-chat-composer-resting-controls="true"]') !== null ||
18 target.closest('[data-chat-composer-resting-images="true"]') !== null ||
19 isInsideComposerFloatingLayer(target))
20 );