refactoring
This commit is contained in:
parent
f29d417b30
commit
10af8c8db7
|
@ -323,16 +323,13 @@ export async function openEmojiPicker(src?: HTMLElement, opts, initialTextarea:
|
||||||
|
|
||||||
const observer = new MutationObserver(records => {
|
const observer = new MutationObserver(records => {
|
||||||
for (const record of records) {
|
for (const record of records) {
|
||||||
for (const node of Array.from(record.addedNodes)) {
|
for (const node of Array.from(record.addedNodes).filter(node => node instanceof HTMLElement) as HTMLElement[]) {
|
||||||
if (node instanceof HTMLElement) {
|
const textareas = node.querySelectorAll('textarea, input') as NodeListOf<NonNullable<typeof activeTextarea>>;
|
||||||
const textareas = node.querySelectorAll('textarea, input');
|
for (const textarea of Array.from(textareas).filter(textarea => textarea.dataset.preventEmojiInsert == null)) {
|
||||||
for (const textarea of Array.from(textareas)) {
|
if (document.activeElement === textarea) activeTextarea = textarea;
|
||||||
if (textarea.dataset.preventEmojiInsert != null) return;
|
textarea.addEventListener('focus', () => {
|
||||||
if (document.activeElement === textarea) activeTextarea = textarea;
|
activeTextarea = textarea;
|
||||||
textarea.addEventListener('focus', () => {
|
});
|
||||||
activeTextarea = textarea;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue