Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/v2/xaction/modules/flow/each.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ legacyContentUpdatedAt: "2023-08-27T23:42:55.000Z"

<ModuleParamPreview moduleKey="sys:each" />

演示视频:[在组合动作中使用循环](https://www.bilibili.com/video/BV1ty4y1S7AK)
<BilibiliPlayer
bvid="BV1ty4y1S7AK"
title="在组合动作中使用循环"
caption="演示视频:在组合动作中使用循环"
/>

## 参数说明

Expand Down
6 changes: 5 additions & 1 deletion docs/v2/xaction/modules/flow/repeat.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ legacyContentUpdatedAt: "2023-06-23T14:05:51.000Z"
/>
</PreviewMarks>

演示视频:[在组合动作中使用循环](https://www.bilibili.com/video/BV1ty4y1S7AK)
<BilibiliPlayer
bvid="BV1ty4y1S7AK"
title="在组合动作中使用循环"
caption="演示视频:在组合动作中使用循环"
/>

## 参数说明

Expand Down
2 changes: 1 addition & 1 deletion docs/v2/xaction/modules/software/uiautomation.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ Quicker 提供两套窗口界面控制:

点右侧定位按钮,可从窗口拾取控件并得到 XPath。

[视频演示](https://player.bilibili.com/player.html?bvid=BV1S54y1J79d)
<BilibiliPlayer bvid="BV1S54y1J79d" title="视频演示" />

更新另存窗口的文件类型:

Expand Down
39 changes: 39 additions & 0 deletions src/components/BilibiliPlayer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import type {ReactNode} from 'react';
import styles from './styles.module.css';

export type BilibiliPlayerProps = {
bvid: string;
page?: number;
title?: string;
caption?: string;
};

export default function BilibiliPlayer({
bvid,
page = 1,
title = 'Bilibili 视频',
caption,
}: BilibiliPlayerProps): ReactNode {
const query = new URLSearchParams({
bvid,
page: String(page),
high_quality: '1',
danmaku: '0',
as_wide: '1',
});

return (
<figure className={styles.root}>
<div className={styles.frameWrap}>
<iframe
className={styles.frame}
src={`https://player.bilibili.com/player.html?${query.toString()}`}
title={title}
loading="lazy"
allowFullScreen
/>
</div>
{caption ? <figcaption className={styles.caption}>{caption}</figcaption> : null}
</figure>
);
}
28 changes: 28 additions & 0 deletions src/components/BilibiliPlayer/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.root {
margin: 1rem 0 1.5rem;
}

.frameWrap {
position: relative;
aspect-ratio: 16 / 9;
overflow: hidden;
border: 1px solid var(--quicker-border-subtle, #e4e9f0);
border-radius: 8px;
background: var(--ifm-color-emphasis-100, #f5f6f7);
}

.frame {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
border: 0;
}

.caption {
margin-top: 6px;
color: var(--quicker-text-muted, #5f6b7a);
font-size: 13px;
line-height: 1.4;
text-align: center;
}
2 changes: 2 additions & 0 deletions src/theme/mdxComponentsMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {ComponentProps} from 'react';
import type {MDXProvider} from '@mdx-js/react';
import ThemeMDXComponents from '@theme-original/MDXComponents';
import NativeImg from '@site/src/theme/MDXComponents/NativeImg';
import BilibiliPlayer from '@site/src/components/BilibiliPlayer';
import FlowChart from '@site/src/components/FlowChart';
import RelatedDocs from '@site/src/components/RelatedDocs';
import ShareLinkCard from '@site/src/components/ShareLinkCard';
Expand All @@ -25,6 +26,7 @@ const mdxComponentsMap = {
RelatedDocs,
ShareLinkCard,
XActionLanding,
BilibiliPlayer,
FlowChart,
XActionModuleMeta: lazyHeavy('XActionModuleMeta'),
StepProgramView: lazyHeavy('StepProgramView'),
Expand Down
Loading