Attachment Modal: Various fixes (#2675)

This commit is contained in:
Alexander Zinchuk 2023-02-25 18:50:33 +01:00
parent e3e2d7d5b5
commit 9ccc7e3ff9
4 changed files with 8 additions and 9 deletions

View File

@ -466,8 +466,7 @@
flex-grow: 1;
.form-control {
padding: calc((3.5rem - var(--composer-text-size, 1rem) * 1.375) / 2 - var(--border-width, 0) * 2)
calc(0.9rem - var(--border-width));
padding: calc((3.5rem - var(--composer-text-size, 1rem) * 1.375) / 2) 0.875rem;
overflow: hidden;
height: auto;
line-height: 1.375;

View File

@ -71,7 +71,7 @@ const MAX_ATTACHMENT_MODAL_INPUT_HEIGHT = 160;
const TAB_INDEX_PRIORITY_TIMEOUT = 2000;
// Heuristics allowing the user to make a triple click
const SELECTION_RECALCULATE_DELAY_MS = 260;
const TEXT_FORMATTER_SAFE_AREA_PX = 90;
const TEXT_FORMATTER_SAFE_AREA_PX = 140;
// For some reason Safari inserts `<br>` after user removes text from input
const SAFARI_BR = '<br>';
const IGNORE_KEYS = [

View File

@ -75,6 +75,7 @@ const TextFormatter: FC<OwnProps> = ({
isOpen,
containerRef,
onClose,
true,
);
useEffect(() => {

View File

@ -9,12 +9,13 @@ export default function useVirtualBackdrop(
isOpen: boolean,
menuRef: RefObject<HTMLElement>,
onClose?: () => void | undefined,
ignoreRightClick?: boolean,
) {
useEffect(() => {
const handleEvent = (e: Event) => {
const handleEvent = (e: MouseEvent) => {
const menu = menuRef.current;
const target = e.target as HTMLElement | null;
if (!menu || !target) {
if (!menu || !target || (ignoreRightClick && e.button === 2)) {
return;
}
@ -24,9 +25,7 @@ export default function useVirtualBackdrop(
) {
e.preventDefault();
e.stopPropagation();
if (onClose) {
onClose();
}
onClose?.();
}
};
@ -37,5 +36,5 @@ export default function useVirtualBackdrop(
return () => {
document.removeEventListener('mousedown', handleEvent);
};
}, [isOpen, menuRef, onClose]);
}, [ignoreRightClick, isOpen, menuRef, onClose]);
}