Skip to content

Commit

Permalink
fix(Video): backward compability between diferent versions of `@diplo…
Browse files Browse the repository at this point in the history
…doc/transform` (#478)
  • Loading branch information
d3m1d0v authored Nov 15, 2024
1 parent 792d3d7 commit 602e2c0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/extensions/yfm/Video/VideoSpecs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ export const VideoSpecs: ExtensionAuto<VideoSpecsOptions> = (builder, opts) => {
const videoId = node.attrs[VideoAttr.VideoID];

if (availableServices.has(service) || !videoId) {
// TODO: remove in next major
// see https://github.com/gravity-ui/markdown-editor/pull/478
let src = '';
if (typeof (options as any).url === 'function')
src = (options as any).url(service, videoId, options);
else if (typeof (options as any).videoUrl === 'function')
src = (options as any).videoUrl(service, videoId, options);
return [
'div',
{
Expand All @@ -69,7 +76,7 @@ export const VideoSpecs: ExtensionAuto<VideoSpecsOptions> = (builder, opts) => {
type: 'text/html',
width: String(options[service as VideoService].width),
height: String(options[service as VideoService].height),
src: options.videoUrl(service, videoId, options),
src: src,
frameborder: '0',
webkitallowfullscreen: '',
mozallowfullscreen: '',
Expand Down

0 comments on commit 602e2c0

Please sign in to comment.