wip
This commit is contained in:
		
							parent
							
								
									0e2a3ebc8d
								
							
						
					
					
						commit
						41032965f1
					
				|  | @ -3053,10 +3053,6 @@ _customEmojisManager: | |||
|       uploadSettingDescription: "この画面で絵文字アップロードを行う際の動作を設定できます。" | ||||
|       directoryToCategoryLabel: "ディレクトリ名を\"category\"に入力する" | ||||
|       directoryToCategoryCaption: "ディレクトリをドラッグ・ドロップした時に、ディレクトリ名を\"category\"に入力します。" | ||||
|       emojiInputAreaCaption: "いずれかの方法で登録する絵文字を選択してください。" | ||||
|       emojiInputAreaList1: "この枠に画像ファイルまたはディレクトリをドラッグ&ドロップ" | ||||
|       emojiInputAreaList2: "このリンクをクリックしてPCから選択する" | ||||
|       emojiInputAreaList3: "このリンクをクリックしてドライブから選択する" | ||||
|       confirmRegisterEmojisDescription: "リストに表示されている絵文字を新たなカスタム絵文字として登録します。よろしいですか?(負荷を避けるため、一度の操作で登録可能な絵文字は{count}件までです)" | ||||
|       confirmClearEmojisDescription: "編集内容を破棄し、リストに表示されている絵文字をクリアします。よろしいですか?" | ||||
|       confirmUploadEmojisDescription: "ドラッグ&ドロップされた{count}個のファイルをドライブにアップロードします。実行しますか?" | ||||
|  |  | |||
|  | @ -18,8 +18,8 @@ SPDX-License-Identifier: AGPL-3.0-only | |||
| 			<MkRadio v-model="radio" value="pleroma">Pleroma</MkRadio> | ||||
| 		</div> | ||||
| 		<div :class="$style.preview__content1__button"> | ||||
| 		<MkButton inline>This is</MkButton> | ||||
| 		<MkButton inline primary>the button</MkButton> | ||||
| 			<MkButton inline>This is</MkButton> | ||||
| 			<MkButton inline primary>the button</MkButton> | ||||
| 		</div> | ||||
| 	</div> | ||||
| 	<div :class="$style.preview__content2" style="pointer-events: none;"> | ||||
|  | @ -36,13 +36,13 @@ SPDX-License-Identifier: AGPL-3.0-only | |||
| 
 | ||||
| <script lang="ts" setup> | ||||
| import { ref } from 'vue'; | ||||
| import * as config from '@@/js/config.js'; | ||||
| import MkButton from '@/components/MkButton.vue'; | ||||
| import MkInput from '@/components/MkInput.vue'; | ||||
| import MkSwitch from '@/components/MkSwitch.vue'; | ||||
| import MkTextarea from '@/components/MkTextarea.vue'; | ||||
| import MkRadio from '@/components/MkRadio.vue'; | ||||
| import * as os from '@/os.js'; | ||||
| import * as config from '@@/js/config.js'; | ||||
| import { $i } from '@/i.js'; | ||||
| 
 | ||||
| const text = ref(''); | ||||
|  | @ -79,7 +79,9 @@ const openForm = async () => { | |||
| }; | ||||
| 
 | ||||
| const openDrive = async () => { | ||||
| 	await os.selectDriveFile(false); | ||||
| 	await os.selectDriveFile({ | ||||
| 		multiple: false, | ||||
| 	}); | ||||
| }; | ||||
| 
 | ||||
| const selectUser = async () => { | ||||
|  |  | |||
|  | @ -37,7 +37,6 @@ import MkInput from '@/components/MkInput.vue'; | |||
| import MkTextarea from '@/components/MkTextarea.vue'; | ||||
| import FormSlot from '@/components/form/slot.vue'; | ||||
| import MkInfo from '@/components/MkInfo.vue'; | ||||
| import { chooseFileFromPcAndUpload } from '@/utility/select-file.js'; | ||||
| import * as os from '@/os.js'; | ||||
| import { ensureSignin } from '@/i.js'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -594,10 +594,10 @@ export async function selectUser(opts: { includeSelf?: boolean; localOnly?: bool | |||
| 	}); | ||||
| } | ||||
| 
 | ||||
| export async function selectDriveFile(multiple: boolean): Promise<Misskey.entities.DriveFile[]> { | ||||
| export async function selectDriveFile(options: { multiple?: boolean; } = {}): Promise<Misskey.entities.DriveFile[]> { | ||||
| 	return new Promise(resolve => { | ||||
| 		const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkDriveFileSelectDialog.vue')), { | ||||
| 			multiple, | ||||
| 			multiple: options.multiple, | ||||
| 		}, { | ||||
| 			done: files => { | ||||
| 				if (files) { | ||||
|  |  | |||
|  | @ -300,21 +300,20 @@ async function onClearClicked() { | |||
| } | ||||
| 
 | ||||
| async function onFileSelectClicked() { | ||||
| 	const driveFiles = await chooseFileFromPcAndUpload( | ||||
| 		true, | ||||
| 		{ | ||||
| 			uploadFolder: selectedFolderId.value, | ||||
| 			keepOriginal: true, | ||||
| 			// 拡張子は消す | ||||
| 			nameConverter: (file) => file.name.replace(/\.[a-zA-Z0-9]+$/, ''), | ||||
| 		}, | ||||
| 	); | ||||
| 	const driveFiles = await chooseFileFromPcAndUpload({ | ||||
| 		multiple: true, | ||||
| 		folderId: selectedFolderId.value, | ||||
| 		// 拡張子は消す | ||||
| 		nameConverter: (file) => file.name.replace(/\.[a-zA-Z0-9]+$/, ''), | ||||
| 	}); | ||||
| 
 | ||||
| 	gridItems.value.push(...driveFiles.map(fromDriveFile)); | ||||
| } | ||||
| 
 | ||||
| async function onDriveSelectClicked() { | ||||
| 	const driveFiles = await chooseFileFromDrive(true); | ||||
| 	const driveFiles = await chooseFileFromDrive({ | ||||
| 		multiple: true, | ||||
| 	}); | ||||
| 	gridItems.value.push(...driveFiles.map(fromDriveFile)); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ SPDX-License-Identifier: AGPL-3.0-only | |||
| </template> | ||||
| 
 | ||||
| <script lang="ts" setup> | ||||
| /* eslint-disable vue/no-mutating-props */ | ||||
|   | ||||
| import { onMounted, ref } from 'vue'; | ||||
| import * as Misskey from 'misskey-js'; | ||||
| import XContainer from '../page-editor.container.vue'; | ||||
|  | @ -41,7 +41,7 @@ const emit = defineEmits<{ | |||
| const file = ref<Misskey.entities.DriveFile | null>(null); | ||||
| 
 | ||||
| async function choose() { | ||||
| 	os.selectDriveFile(false).then((fileResponse) => { | ||||
| 	os.selectDriveFile({ multiple: false }).then((fileResponse) => { | ||||
| 		file.value = fileResponse[0]; | ||||
| 		emit('update:modelValue', { | ||||
| 			...props.modelValue, | ||||
|  |  | |||
|  | @ -298,7 +298,7 @@ function changeAvatar(ev) { | |||
| 		text: i18n.ts.fromDrive, | ||||
| 		icon: 'ti ti-cloud', | ||||
| 		action: () => { | ||||
| 			os.selectDriveFile(false).then(files => { | ||||
| 			os.selectDriveFile({ multiple: false }).then(files => { | ||||
| 				done(files[0]); | ||||
| 			}); | ||||
| 		}, | ||||
|  | @ -346,7 +346,7 @@ function changeBanner(ev) { | |||
| 		text: i18n.ts.fromDrive, | ||||
| 		icon: 'ti ti-cloud', | ||||
| 		action: () => { | ||||
| 			os.selectDriveFile(false).then(files => { | ||||
| 			os.selectDriveFile({ multiple: false }).then(files => { | ||||
| 				done(files[0]); | ||||
| 			}); | ||||
| 		}, | ||||
|  |  | |||
|  | @ -29,9 +29,13 @@ export function chooseFileFromPcAndUpload( | |||
| 	}); | ||||
| } | ||||
| 
 | ||||
| export function chooseFileFromDrive(multiple: boolean): Promise<Misskey.entities.DriveFile[]> { | ||||
| export function chooseFileFromDrive(options: { | ||||
| 	multiple?: boolean; | ||||
| } = {}): Promise<Misskey.entities.DriveFile[]> { | ||||
| 	return new Promise((res, rej) => { | ||||
| 		os.selectDriveFile(multiple).then(files => { | ||||
| 		os.selectDriveFile({ | ||||
| 			multiple: options.multiple, | ||||
| 		}).then(files => { | ||||
| 			res(files); | ||||
| 		}); | ||||
| 	}); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue