11<script setup lang="ts">
22import type { UploadFileInfo } from ' naive-ui'
3- import { NA , NFlex , NList , NListItem , NUpload , NUploadDragger , useMessage } from ' naive-ui'
3+ import { NA , NFlex , NList , NListItem , NText , NUpload , NUploadDragger , useMessage } from ' naive-ui'
44import { computed , ref } from ' vue'
55import { t } from ' ./i18n'
6+ import MustInstall from ' ./MustInstall.vue'
67
78defineProps <{
89 disabled: boolean
@@ -14,7 +15,7 @@ function getInstalledPlugins() {
1415 return window .fcitx .getInstalledPlugins ().sort ()
1516}
1617
17- const allPlugins = [' anthy' , ' chewing' , ' chinese-addons' , ' hallelujah' , ' hangul' , ' lua' , ' m17n' , ' mozc' , ' rime' , ' sayura' , ' skk' , ' thai' , ' unikey' ]
18+ const allPlugins = [' anthy' , ' chewing' , ' chinese-addons' , ' hallelujah' , ' hangul' , ' jyutping ' , ' lua' , ' m17n' , ' mozc' , ' rime' , ' sayura' , ' skk' , ' thai' , ' unikey' ]
1819const installedPlugins = ref <string []>(getInstalledPlugins ())
1920const availablePlugins = computed (() => allPlugins .filter (plugin => ! installedPlugins .value .includes (plugin )))
2021
@@ -54,17 +55,26 @@ async function onUpload(files: UploadFileInfo[]) {
5455 {{ t('Installed') }}
5556 </template >
5657 <NListItem v-for =" plugin in installedPlugins" :key =" plugin" >
57- {{ plugin }}
58+ <MustInstall v-if =" plugin === 'jyutping' && !installedPlugins.includes('chinese-addons')" plugin =" chinese-addons" >
59+ <NText delete >
60+ {{ plugin }}
61+ </NText >
62+ </MustInstall >
63+ <template v-else >
64+ {{ plugin }}
65+ </template >
5866 </NListItem >
5967 </NList >
6068 <NList style =" min-width : 100px " >
6169 <template #header >
6270 {{ t('Available') }}
6371 </template >
6472 <NListItem v-for =" plugin in availablePlugins" :key =" plugin" >
65- <NA :href =" `https://github.com/fcitx-contrib/fcitx5-plugins/releases/download/js/${plugin}.zip`" >
66- {{ plugin }}
67- </NA >
73+ <MustInstall :plugin =" plugin === 'jyutping' ? 'chinese-addons' : undefined" >
74+ <NA :href =" `https://github.com/fcitx-contrib/fcitx5-plugins/releases/download/js/${plugin}.zip`" >
75+ {{ plugin }}
76+ </NA >
77+ </MustInstall >
6878 </NListItem >
6979 </NList >
7080 </NFlex >
0 commit comments