This commit is contained in:
fly_mc 2024-09-18 23:00:06 +08:00
parent 337cae0522
commit 11103527b0
2 changed files with 13 additions and 0 deletions

View file

@ -31,6 +31,7 @@
"@vue/compiler-sfc": "3.4.37",
"aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.1.11",
"astring": "1.8.6",
"autosize": "^6.0.1",
"broadcast-channel": "7.0.0",
"buraha": "0.0.1",
"canvas-confetti": "1.9.3",
@ -96,6 +97,7 @@
"@storybook/vue3": "8.2.6",
"@storybook/vue3-vite": "8.1.11",
"@testing-library/vue": "8.1.0",
"@types/autosize": "^4.0.3",
"@types/escape-regexp": "0.0.3",
"@types/estree": "1.0.5",
"@types/matter-js": "0.19.7",

View file

@ -105,6 +105,7 @@ import * as mfm from 'mfm-js';
import * as Misskey from 'misskey-js';
import insertTextAtCursor from 'insert-text-at-cursor';
import { toASCII } from 'punycode/';
import autosize from 'autosize';
import MkNoteSimple from '@/components/MkNoteSimple.vue';
import MkNotePreview from '@/components/MkNotePreview.vue';
import XPostFormAttaches from '@/components/MkPostFormAttaches.vue';
@ -569,20 +570,28 @@ function clear() {
files.value = [];
poll.value = null;
quoteId.value = null;
nextTick(() => textareaEl.value && autosize.update(textareaEl.value));
}
function onKeydown(ev: KeyboardEvent) {
if (ev.key === 'Enter' && (ev.ctrlKey || ev.metaKey) && canPost.value) post();
if (ev.key === 'Escape') emit('esc');
nextTick(() => textareaEl.value && autosize.update(textareaEl.value));
}
function onCompositionUpdate(ev: CompositionEvent) {
imeText.value = ev.data;
nextTick(() => textareaEl.value && autosize.update(textareaEl.value));
}
function onCompositionEnd(ev: CompositionEvent) {
imeText.value = '';
nextTick(() => textareaEl.value && autosize.update(textareaEl.value));
}
async function onPaste(ev: ClipboardEvent) {
@ -634,6 +643,7 @@ async function onPaste(ev: ClipboardEvent) {
upload(file, `${fileName}.txt`);
});
}
nextTick(() => textareaEl.value && autosize.update(textareaEl.value));
}
function onDragover(ev) {
@ -1042,6 +1052,7 @@ onMounted(() => {
}
nextTick(() => watchForDraft());
nextTick(() => textareaEl.value && autosize(textareaEl.value));
});
});