Skip to content

Commit

Permalink
feat: #746 增加自定义视频播放器容器的配置能力
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsonliu committed Apr 25, 2024
1 parent 0cff250 commit 3c9952f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions examples/scripts/index-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ var basicConfig = {
},
},
syntax: {
image: {
videoWrapper: (link, type, defaultWrapper) => {
console.log(type);
return defaultWrapper;
},
},
codeBlock: {
theme: 'twilight',
lineNumber: true, // 默认显示行号
Expand Down
2 changes: 1 addition & 1 deletion src/core/hooks/Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const replacerFactory = function (type, match, leadingChar, alt, link, title, po
const defaultWrapper = `<${type} src="${UrlCache.set(
encodeURIOnce(processedURL),
)}"${attrs} ${extent} ${style} ${classes} controls="controls">${$e(alt || '')}</${type}>`;
return `${leadingChar}${config.videoWrapper ? config.videoWrapper(link) : defaultWrapper}`;
return `${leadingChar}${config.videoWrapper ? config.videoWrapper(link, type, defaultWrapper) : defaultWrapper}`;
}
// should never happen
return match;
Expand Down

0 comments on commit 3c9952f

Please sign in to comment.