diff --git a/packages/editor/examples/check.html b/packages/editor/examples/check.html
index eefc9a3a..4abca8c4 100644
--- a/packages/editor/examples/check.html
+++ b/packages/editor/examples/check.html
@@ -174,7 +174,9 @@
console.log('inserted video', videoNode)
},
- checkVideo(src) {
+ checkVideo(src, poster) {
+ console.log('video src', src)
+ console.log('video poster', poster)
if (src.indexOf('http') !== 0) {
return '视频地址必须以 http/https 开头'
}
diff --git a/packages/video-module/__tests__/helpler.test.ts b/packages/video-module/__tests__/helpler.test.ts
index ef6641c8..77b8f124 100644
--- a/packages/video-module/__tests__/helpler.test.ts
+++ b/packages/video-module/__tests__/helpler.test.ts
@@ -22,7 +22,7 @@ describe('Video module helper', () => {
config: {
MENU_CONF: {
insertVideo: {
- checkVideo: (_src: string) => 'check result',
+ checkVideo: (_src: string, _poster: string) => 'check result',
},
},
},
@@ -40,7 +40,7 @@ describe('Video module helper', () => {
config: {
MENU_CONF: {
insertVideo: {
- checkVideo: (_src: string) => null,
+ checkVideo: (_src: string, _poster: string) => null,
},
},
},
diff --git a/packages/video-module/src/module/helper/insert-video.ts b/packages/video-module/src/module/helper/insert-video.ts
index 100caca9..cbada65d 100644
--- a/packages/video-module/src/module/helper/insert-video.ts
+++ b/packages/video-module/src/module/helper/insert-video.ts
@@ -22,7 +22,7 @@ export default async function (editor: IDomEditor, src: string, poster = '') {
// 校验
const { onInsertedVideo, checkVideo, parseVideoSrc } = editor.getMenuConfig('insertVideo')
- const checkRes = await checkVideo(src)
+ const checkRes = await checkVideo(src, poster)
if (typeof checkRes === 'string') {
// 校验失败,给出提示
editor.alert(checkRes, 'error')
diff --git a/packages/video-module/src/module/menu/config.ts b/packages/video-module/src/module/menu/config.ts
index 2af2a54f..dd4bd501 100644
--- a/packages/video-module/src/module/menu/config.ts
+++ b/packages/video-module/src/module/menu/config.ts
@@ -77,8 +77,9 @@ export function genInsertVideoMenuConfig() {
/**
* 检查 video ,支持 async
* @param src src
+ * @param poster poster
*/
- checkVideo(src: string): boolean | string | undefined {
+ checkVideo(src: string, poster: string): boolean | string | undefined {
// 1. 返回 true ,说明检查通过
// 2. 返回一个字符串,说明检查未通过,编辑器会阻止插入。会 alert 出错误信息(即返回的字符串)
// 3. 返回 undefined(即没有任何返回),说明检查未通过,编辑器会阻止插入