summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components
diff options
context:
space:
mode:
authoranatawa12 <anatawa12@icloud.com>2024-05-23 13:15:22 +0900
committerGitHub <noreply@github.com>2024-05-23 13:15:22 +0900
commitaafa669cf59778ed695632b45af0408cc9c3f038 (patch)
tree485336db3792b216ad5e8b014f3fec6818df27e4 /packages/frontend/src/components
parentNew Crowdin updates (#13850) (diff)
downloadmisskey-aafa669cf59778ed695632b45af0408cc9c3f038.tar.gz
misskey-aafa669cf59778ed695632b45af0408cc9c3f038.tar.bz2
misskey-aafa669cf59778ed695632b45af0408cc9c3f038.zip
feat(frontend): 長いテキストをペーストした際にテキストファイルとして添付するかどうかを選択できるように (#13862)
* feat(frontend): ask if attach as file if clipboard text is very long * docs(changelog): 長いテキストをペーストした際にテキストファイルとして添付するかどうかを選択できるように
Diffstat (limited to 'packages/frontend/src/components')
-rw-r--r--packages/frontend/src/components/MkPostForm.vue17
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue
index 41d603e40f..1df9007681 100644
--- a/packages/frontend/src/components/MkPostForm.vue
+++ b/packages/frontend/src/components/MkPostForm.vue
@@ -612,6 +612,23 @@ async function onPaste(ev: ClipboardEvent) {
quoteId.value = paste.substring(url.length).match(/^\/notes\/(.+?)\/?$/)?.[1] ?? null;
});
}
+
+ if (paste.length > 1000) {
+ ev.preventDefault();
+ os.confirm({
+ type: 'info',
+ text: i18n.ts.attachAsFileQuestion,
+ }).then(({ canceled }) => {
+ if (canceled) {
+ insertTextAtCursor(textareaEl.value, paste);
+ return;
+ }
+
+ const fileName = formatTimeString(new Date(), defaultStore.state.pastedFileName).replace(/{{number}}/g, "0");
+ const file = new File([paste], `${fileName}.txt`, { type: "text/plain" });
+ upload(file, `${fileName}.txt`);
+ });
+ }
}
function onDragover(ev) {