Fix setting target on stickers helper
Remove \uFE0F in emoji helper Fix emoji helper layout
This commit is contained in:
parent
dc1bf2d154
commit
671e7140d5
@ -60,7 +60,6 @@ import { MarkdownType, markdownTags } from '../../helpers/dom/getRichElementValu
|
||||
import getRichValueWithCaret from '../../helpers/dom/getRichValueWithCaret';
|
||||
import EmojiHelper from './emojiHelper';
|
||||
import setRichFocus from '../../helpers/dom/setRichFocus';
|
||||
import { toCodePoints } from '../../vendor/emoji';
|
||||
|
||||
const RECORD_MIN_TIME = 500;
|
||||
const POSTING_MEDIA_NOT_ALLOWED = 'Posting media content isn\'t allowed in this group.';
|
||||
@ -1162,12 +1161,7 @@ export default class ChatInput {
|
||||
const hadEntities = RichTextProcessor.parseEntities(fullValue);
|
||||
RichTextProcessor.mergeEntities(entities, hadEntities);
|
||||
|
||||
const emojiEntity: MessageEntity.messageEntityEmoji = {
|
||||
_: 'messageEntityEmoji',
|
||||
offset: 0,
|
||||
length: emoji.length,
|
||||
unicode: toCodePoints(emoji).join('-')
|
||||
};
|
||||
const emojiEntity = RichTextProcessor.getEmojiEntityFromEmoji(emoji);
|
||||
const addEntities: MessageEntity[] = [emojiEntity];
|
||||
emojiEntity.offset = matchIndex;
|
||||
addEntities.push({
|
||||
|
@ -13,7 +13,6 @@ import Config from "../../../lib/config";
|
||||
import { i18n, LangPackKey } from "../../../lib/langPack";
|
||||
import { RichTextProcessor } from "../../../lib/richtextprocessor";
|
||||
import rootScope from "../../../lib/rootScope";
|
||||
import { toCodePoints } from "../../../vendor/emoji";
|
||||
import { putPreloader } from "../../misc";
|
||||
import Scrollable from "../../scrollable";
|
||||
import StickyIntersector from "../../stickyIntersector";
|
||||
@ -29,14 +28,7 @@ export function appendEmoji(emoji: string, container: HTMLElement, prepend = fal
|
||||
|
||||
let kek: string;
|
||||
if(unify) {
|
||||
kek = RichTextProcessor.wrapRichText(emoji, {
|
||||
entities: [{
|
||||
_: 'messageEntityEmoji',
|
||||
offset: 0,
|
||||
length: emoji.length,
|
||||
unicode: toCodePoints(emoji).join('-')
|
||||
}]
|
||||
});
|
||||
kek = RichTextProcessor.wrapSingleEmoji(emoji);
|
||||
} else {
|
||||
kek = RichTextProcessor.wrapEmojiText(emoji);
|
||||
}
|
||||
|
@ -155,6 +155,7 @@ export default function attachListNavigation({list, type, onSelect, once, waitFo
|
||||
onKeyDown = _onKeyDown;
|
||||
document.addEventListener(HANDLE_EVENT, onKeyDown, {capture: true, passive: false});
|
||||
|
||||
waitForKey = undefined;
|
||||
resetTarget();
|
||||
}
|
||||
};
|
||||
|
@ -12,7 +12,7 @@
|
||||
import Config from './config';
|
||||
|
||||
import emojiRegExp from '../vendor/emoji/regex';
|
||||
import { encodeEmoji } from '../vendor/emoji';
|
||||
import { encodeEmoji, toCodePoints } from '../vendor/emoji';
|
||||
import { MessageEntity } from '../layer';
|
||||
import { encodeEntities } from '../helpers/string';
|
||||
import { isSafari } from '../helpers/userAgent';
|
||||
@ -840,6 +840,21 @@ namespace RichTextProcessor {
|
||||
export function isUsernameValid(username: string) {
|
||||
return ((username.length >= 5 && username.length <= 32) || !username.length) && /^[a-zA-Z0-9_]*$/.test(username);
|
||||
}
|
||||
|
||||
export function getEmojiEntityFromEmoji(emoji: string): MessageEntity.messageEntityEmoji {
|
||||
return {
|
||||
_: 'messageEntityEmoji',
|
||||
offset: 0,
|
||||
length: emoji.length,
|
||||
unicode: toCodePoints(emoji).join('-').replace(/-?fe0f/g, '')
|
||||
};
|
||||
}
|
||||
|
||||
export function wrapSingleEmoji(emoji: string) {
|
||||
return wrapRichText(emoji, {
|
||||
entities: [getEmojiEntityFromEmoji(emoji)]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
MOUNT_CLASS_TO.RichTextProcessor = RichTextProcessor;
|
||||
|
@ -7,8 +7,14 @@
|
||||
}
|
||||
|
||||
.super-emojis {
|
||||
display: block;
|
||||
display: flex;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.super-emoji {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.super-emoji:not(.active) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user