1
0
forked from mirror/misskey

refactoring

This commit is contained in:
syuilo 2021-02-27 13:16:59 +09:00
parent f29d417b30
commit 10af8c8db7

View File

@ -323,11 +323,9 @@ export async function openEmojiPicker(src?: HTMLElement, opts, initialTextarea:
const observer = new MutationObserver(records => {
for (const record of records) {
for (const node of Array.from(record.addedNodes)) {
if (node instanceof HTMLElement) {
const textareas = node.querySelectorAll('textarea, input');
for (const textarea of Array.from(textareas)) {
if (textarea.dataset.preventEmojiInsert != null) return;
for (const node of Array.from(record.addedNodes).filter(node => node instanceof HTMLElement) as HTMLElement[]) {
const textareas = node.querySelectorAll('textarea, input') as NodeListOf<NonNullable<typeof activeTextarea>>;
for (const textarea of Array.from(textareas).filter(textarea => textarea.dataset.preventEmojiInsert == null)) {
if (document.activeElement === textarea) activeTextarea = textarea;
textarea.addEventListener('focus', () => {
activeTextarea = textarea;
@ -335,7 +333,6 @@ export async function openEmojiPicker(src?: HTMLElement, opts, initialTextarea:
}
}
}
}
});
observer.observe(document.body, {