Symbol Menu: Fix closing on iOS; Sticker Tooltip: Fix sticker autocomplete on iOS (#1441)
This commit is contained in:
parent
8192836662
commit
f732a72e60
@ -15,6 +15,7 @@
|
|||||||
padding-right: env(safe-area-inset-right);
|
padding-right: env(safe-area-inset-right);
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
padding-left: env(safe-area-inset-left);
|
padding-left: env(safe-area-inset-left);
|
||||||
|
transform: translate3d(0, calc(var(--symbol-menu-height) + var(--symbol-menu-footer-height) + env(safe-area-inset-bottom)), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.open {
|
&.open {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { useEffect } from '../../../../lib/teact/teact';
|
import { useEffect, useMemo } from '../../../../lib/teact/teact';
|
||||||
import { getDispatch } from '../../../../lib/teact/teactn';
|
import { getDispatch } from '../../../../lib/teact/teactn';
|
||||||
|
|
||||||
import { ApiSticker } from '../../../../api/types';
|
import { ApiSticker } from '../../../../api/types';
|
||||||
@ -6,6 +6,7 @@ import { ApiSticker } from '../../../../api/types';
|
|||||||
import { IS_EMOJI_SUPPORTED } from '../../../../util/environment';
|
import { IS_EMOJI_SUPPORTED } from '../../../../util/environment';
|
||||||
|
|
||||||
import parseEmojiOnlyString from '../../../common/helpers/parseEmojiOnlyString';
|
import parseEmojiOnlyString from '../../../common/helpers/parseEmojiOnlyString';
|
||||||
|
import { prepareForRegExp } from '../helpers/prepareForRegExp';
|
||||||
|
|
||||||
export default function useStickerTooltip(
|
export default function useStickerTooltip(
|
||||||
isAllowed: boolean,
|
isAllowed: boolean,
|
||||||
@ -13,9 +14,10 @@ export default function useStickerTooltip(
|
|||||||
stickers?: ApiSticker[],
|
stickers?: ApiSticker[],
|
||||||
isDisabled = false,
|
isDisabled = false,
|
||||||
) {
|
) {
|
||||||
|
const cleanHtml = useMemo(() => prepareForRegExp(html).trim(), [html]);
|
||||||
const { loadStickersForEmoji, clearStickersForEmoji } = getDispatch();
|
const { loadStickersForEmoji, clearStickersForEmoji } = getDispatch();
|
||||||
const isSingleEmoji = (
|
const isSingleEmoji = (
|
||||||
(IS_EMOJI_SUPPORTED && parseEmojiOnlyString(html) === 1)
|
(IS_EMOJI_SUPPORTED && parseEmojiOnlyString(cleanHtml) === 1)
|
||||||
|| (!IS_EMOJI_SUPPORTED && Boolean(html.match(/^<img.[^>]*?>$/g)))
|
|| (!IS_EMOJI_SUPPORTED && Boolean(html.match(/^<img.[^>]*?>$/g)))
|
||||||
);
|
);
|
||||||
const hasStickers = Boolean(stickers) && isSingleEmoji;
|
const hasStickers = Boolean(stickers) && isSingleEmoji;
|
||||||
@ -24,7 +26,7 @@ export default function useStickerTooltip(
|
|||||||
if (isDisabled) return;
|
if (isDisabled) return;
|
||||||
|
|
||||||
if (isAllowed && isSingleEmoji) {
|
if (isAllowed && isSingleEmoji) {
|
||||||
loadStickersForEmoji({ emoji: html });
|
loadStickersForEmoji({ emoji: cleanHtml });
|
||||||
} else if (hasStickers || !isSingleEmoji) {
|
} else if (hasStickers || !isSingleEmoji) {
|
||||||
clearStickersForEmoji();
|
clearStickersForEmoji();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user