From fcaba15eda161fd69683893074f184f9a35b0ad3 Mon Sep 17 00:00:00 2001 From: the1812 Date: Fri, 10 Dec 2021 22:55:38 +0800 Subject: [PATCH] Update docs --- .../components/touch/double-click-control/index.ts | 2 +- registry/lib/components/video/download/index.ts | 2 +- .../video/player/double-click-fullscreen/index.ts | 1 + registry/lib/docs/plugins-doc.ts | 3 +++ src/core/install-feature.ts | 12 +++++++++--- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/registry/lib/components/touch/double-click-control/index.ts b/registry/lib/components/touch/double-click-control/index.ts index 8a3731289..f4dcb021a 100644 --- a/registry/lib/components/touch/double-click-control/index.ts +++ b/registry/lib/components/touch/double-click-control/index.ts @@ -31,7 +31,7 @@ export const component: ComponentMetadata = { name: 'doubleClickControl', displayName: '启用双击控制', description: { - 'zh-CN': '将视频播放器的操作方式更改为: 单击显示 / 隐藏控制栏, 双击播放 / 暂停.', + 'zh-CN': '将视频播放器的操作方式更改为: 单击显示 / 隐藏控制栏, 双击播放 / 暂停. 请注意不能和 `双击全屏` 一同使用.', }, tags: [ componentsTags.touch, diff --git a/registry/lib/components/video/download/index.ts b/registry/lib/components/video/download/index.ts index 6800b18af..afd677ab1 100644 --- a/registry/lib/components/video/download/index.ts +++ b/registry/lib/components/video/download/index.ts @@ -4,7 +4,7 @@ import { hasVideo } from '@/core/spin-query' export const component: ComponentMetadata = { name: 'downloadVideo', displayName: '下载视频', - description: '在功能面板中添加下载视频支持.', + description: '在功能面板中添加下载视频支持. 请注意不能下载超出账号权限的视频, 例如非大会员下载大会员清晰度视频, 或者大陆地区网络下载港澳台地区番剧, 都是不可以的.', entry: none, reload: none, unload: none, diff --git a/registry/lib/components/video/player/double-click-fullscreen/index.ts b/registry/lib/components/video/player/double-click-fullscreen/index.ts index b80564543..0a2f3d813 100644 --- a/registry/lib/components/video/player/double-click-fullscreen/index.ts +++ b/registry/lib/components/video/player/double-click-fullscreen/index.ts @@ -27,6 +27,7 @@ const entry: ComponentEntry = async ({ settings: { options } }) => { export const component: ComponentMetadata = { name: 'doubleClickFullscreen', displayName: '双击全屏', + description: '为视频播放器启用双击全屏功能, 请注意不能和 `启用双击控制` 一同使用.', entry, tags: [ componentsTags.video, diff --git a/registry/lib/docs/plugins-doc.ts b/registry/lib/docs/plugins-doc.ts index 52fa061ad..cd819e145 100644 --- a/registry/lib/docs/plugins-doc.ts +++ b/registry/lib/docs/plugins-doc.ts @@ -1,3 +1,4 @@ +import { getDescriptionMarkdown } from '@/components/description' import { PluginMetadata } from '@/plugins/plugin' import { DocSource, DocSourceItem } from '.' import { getId } from '../../webpack/id' @@ -27,10 +28,12 @@ export const getPluginsDoc: DocSource = async rootPath => { name, displayName, } = it.plugin + const description = getDescriptionMarkdown(it.plugin) return { type: 'plugin', name, displayName, + description, fullRelativePath, fullAbsolutePath, } as DocSourceItem diff --git a/src/core/install-feature.ts b/src/core/install-feature.ts index 967977086..114df44c2 100644 --- a/src/core/install-feature.ts +++ b/src/core/install-feature.ts @@ -5,9 +5,15 @@ import { installPlugin, PluginMetadata } from '@/plugins/plugin' import { installStyle, UserStyle } from '@/plugins/style' type FeatureType = ComponentMetadata | PluginMetadata | UserStyle -const isComponent = (item: FeatureType): item is ComponentMetadata => 'entry' in item -const isPlugin = (item: FeatureType): item is PluginMetadata => 'setup' in item -const isStyle = (item: FeatureType): item is UserStyle => 'style' in item +const isComponent = (item: FeatureType): item is ComponentMetadata => ( + Boolean((item as ComponentMetadata)?.entry) +) +const isPlugin = (item: FeatureType): item is PluginMetadata => ( + Boolean((item as PluginMetadata)?.setup) +) +const isStyle = (item: FeatureType): item is UserStyle => ( + Boolean((item as UserStyle)?.style) +) /** 如果输入的功能链接是 .zip, 则尝试解压. 仅支持单个功能, 不能批量, 只是为了能方便在 GitHub 直接以 .zip 格式分享功能. */ export const tryParseZip = async (url: string) => {