diff --git a/components/publish/PublishLanguagePicker.vue b/components/publish/PublishLanguagePicker.vue
index bd7f139b..d0532cc7 100644
--- a/components/publish/PublishLanguagePicker.vue
+++ b/components/publish/PublishLanguagePicker.vue
@@ -10,17 +10,7 @@ const { t } = useI18n()
const languageKeyword = $ref('')
-const languageList: {
- code: string
- nativeName: string
- name: string
-}[] = ISO6391.getAllCodes().map(code => ({
- code,
- nativeName: ISO6391.getNativeName(code),
- name: ISO6391.getName(code),
-}))
-
-const fuse = new Fuse(languageList, {
+const fuse = new Fuse(languagesNameList, {
keys: ['code', 'nativeName', 'name'],
shouldSort: true,
})
@@ -28,7 +18,7 @@ const fuse = new Fuse(languageList, {
const languages = $computed(() =>
languageKeyword.trim()
? fuse.search(languageKeyword).map(r => r.item)
- : [...languageList].sort(({ code: a }, { code: b }) => {
+ : [...languagesNameList].sort(({ code: a }, { code: b }) => {
return a === modelValue ? -1 : b === modelValue ? 1 : a.localeCompare(b)
}),
)
diff --git a/components/publish/PublishWidget.vue b/components/publish/PublishWidget.vue
index 93eed711..dfbc0c95 100644
--- a/components/publish/PublishWidget.vue
+++ b/components/publish/PublishWidget.vue
@@ -62,6 +62,7 @@ const { editor } = useTiptap({
},
onPaste: handlePaste,
})
+
const characterCount = $computed(() => {
let length = stringLength(htmlToText(editor.value?.getHTML() || ''))
@@ -76,6 +77,8 @@ const characterCount = $computed(() => {
return length
})
+const postLanguageDisplay = $computed(() => languagesNameList.find(i => i.code === draft.params.language)?.nativeName)
+
async function handlePaste(evt: ClipboardEvent) {
const files = evt.clipboardData?.files
if (!files || files.length === 0)
@@ -278,17 +281,11 @@ defineExpose({
{{ characterCount ?? 0 }}/{{ characterLimit }}
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/composables/langugage.ts b/composables/langugage.ts
new file mode 100644
index 00000000..2584afc8
--- /dev/null
+++ b/composables/langugage.ts
@@ -0,0 +1,11 @@
+import ISO6391 from 'iso-639-1'
+
+export const languagesNameList: {
+ code: string
+ nativeName: string
+ name: string
+}[] = ISO6391.getAllCodes().map(code => ({
+ code,
+ nativeName: ISO6391.getNativeName(code),
+ name: ISO6391.getName(code),
+}))