diff --git a/components/publish/PublishLanguagePicker.vue b/components/publish/PublishLanguagePicker.vue new file mode 100644 index 00000000..57e1a7a3 --- /dev/null +++ b/components/publish/PublishLanguagePicker.vue @@ -0,0 +1,72 @@ + + + diff --git a/components/publish/PublishWidget.vue b/components/publish/PublishWidget.vue index 2eeb909f..4d35d581 100644 --- a/components/publish/PublishWidget.vue +++ b/components/publish/PublishWidget.vue @@ -3,8 +3,6 @@ import type { Attachment, CreateStatusParams, Status, StatusVisibility } from 'm import { fileOpen } from 'browser-fs-access' import { useDropZone } from '@vueuse/core' import { EditorContent } from '@tiptap/vue-3' -import ISO6391 from 'iso-639-1' -import Fuse from 'fuse.js' import { statusVisibilities } from '~/composables/masto/icons' import type { Draft } from '~/types' @@ -138,10 +136,6 @@ function chooseVisibility(visibility: StatusVisibility) { draft.params.visibility = visibility } -function chooseLanguage(language: string | null) { - draft.params.language = language -} - async function publish() { const payload = { ...draft.params, @@ -188,29 +182,6 @@ async function onDrop(files: File[] | null) { const { isOverDropZone } = useDropZone(dropZoneRef, onDrop) -const languageKeyword = $ref('') -const languageList: { - code: string | null - nativeName: string - name?: string -}[] = [{ - code: null, - nativeName: t('language.none'), -}, ...ISO6391.getAllCodes().map(code => ({ - code, - nativeName: ISO6391.getNativeName(code), - name: ISO6391.getName(code), -}))] -const fuse = new Fuse(languageList, { - keys: ['code', 'nativeName', 'name'], - shouldSort: true, -}) -const languages = $computed(() => - languageKeyword.trim() - ? fuse.search(languageKeyword).map(r => r.item) - : languageList, -) - defineExpose({ focusEditor: () => { editor.value?.commands?.focus?.() @@ -363,27 +334,7 @@ defineExpose({