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 pos = textareaEl.value?.selectionStart ?? 0;
let posEnd = textareaEl.value?.selectionEnd ?? text.value.length; let posEnd = textareaEl.value?.selectionEnd ?? text.value.length;
emojiPicker.show({ emojiPicker.show({
src: target as HTMLElement, anchorElement: target as HTMLElement,
onChosen: emoji => { onChosen: emoji => {
const textBefore = text.value.substring(0, pos); const textBefore = text.value.substring(0, pos);
const textAfter = text.value.substring(posEnd); const textAfter = text.value.substring(posEnd);

View File

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

View File

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