This commit is contained in:
kakkokari-gtyih 2025-05-23 17:22:40 +09:00
parent bbe1313800
commit 039ac0be65
3 changed files with 9 additions and 7 deletions

View File

@ -980,7 +980,7 @@ async function insertEmoji(ev: MouseEvent) {
let pos = textareaEl.value?.selectionStart ?? 0;
let posEnd = textareaEl.value?.selectionEnd ?? text.value.length;
emojiPicker.show({
src: target as HTMLElement,
anchorElement: target as HTMLElement,
onChosen: emoji => {
const textBefore = text.value.substring(0, pos);
const textAfter = text.value.substring(posEnd);

View File

@ -256,20 +256,20 @@ async function insertEmoji(ev: MouseEvent) {
let pos = textareaEl.value?.selectionStart ?? 0;
let posEnd = textareaEl.value?.selectionEnd ?? text.value.length;
emojiPicker.show(
target as HTMLElement,
emoji => {
emojiPicker.show({
anchorElement: target as HTMLElement,
onChosen: (emoji) => {
const textBefore = text.value.substring(0, pos);
const textAfter = text.value.substring(posEnd);
text.value = textBefore + emoji + textAfter;
pos += emoji.length;
posEnd += emoji.length;
},
() => {
onClosed: () => {
textareaReadOnly.value = false;
nextTick(() => focus());
},
);
});
}
onMounted(() => {

View File

@ -223,7 +223,9 @@ function getHTMLElement(ev: MouseEvent): HTMLElement {
}
function previewPicker(ev: MouseEvent) {
emojiPicker.show(getHTMLElement(ev));
emojiPicker.show({
anchorElement: getHTMLElement(ev),
});
}
watch([