Skip to content

Commit

Permalink
fixed attribute issue in shortcode
Browse files Browse the repository at this point in the history
  • Loading branch information
iam-pranav committed Nov 28, 2023
1 parent 5b084a4 commit fdff12e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -1507,16 +1507,17 @@ jQuery(function () {
let height = '';

videoAttributePatterns.forEach(pattern => {
if (!src) {
const attrMatch = match.match(pattern);
if (attrMatch) {
const attrMatch = match.match(pattern);
if (attrMatch) {
if (pattern.toString().includes('width')) {
width = attrMatch[1] || '';
} else if (pattern.toString().includes('height')) {
height = attrMatch[1] || '';
} else {
src = attrMatch[1] || '';
if (pattern.toString().includes('width')) width = attrMatch[1] || '';
if (pattern.toString().includes('height')) height = attrMatch[1] || '';
}
}
});

const videoTag = `<video src="${src}" width="${width}" height="${height}" controls>${content}</video>`;
return `<div class="video-content">${videoTag}</div>`;
});
Expand Down

0 comments on commit fdff12e

Please sign in to comment.