allow custom control as element
This commit is contained in:
parent
4915cf0120
commit
3c1ba2397b
6
src/js/controls.js
vendored
6
src/js/controls.js
vendored
@ -1263,7 +1263,7 @@ const controls = {
|
|||||||
this.elements.controls = null;
|
this.elements.controls = null;
|
||||||
|
|
||||||
// Larger overlaid play button
|
// Larger overlaid play button
|
||||||
if (this.config.controls.includes('play-large')) {
|
if (is.array(this.config.controls) && this.config.controls.includes('play-large')) {
|
||||||
this.elements.container.appendChild(createButton.call(this, 'play-large'));
|
this.elements.container.appendChild(createButton.call(this, 'play-large'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1275,7 +1275,7 @@ const controls = {
|
|||||||
const defaultAttributes = { class: 'plyr__controls__item' };
|
const defaultAttributes = { class: 'plyr__controls__item' };
|
||||||
|
|
||||||
// Loop through controls in order
|
// Loop through controls in order
|
||||||
dedupe(this.config.controls).forEach(control => {
|
dedupe(is.array(this.config.controls) ? this.config.controls: []).forEach(control => {
|
||||||
// Restart button
|
// Restart button
|
||||||
if (control === 'restart') {
|
if (control === 'restart') {
|
||||||
container.appendChild(createButton.call(this, 'restart', defaultAttributes));
|
container.appendChild(createButton.call(this, 'restart', defaultAttributes));
|
||||||
@ -1675,8 +1675,6 @@ const controls = {
|
|||||||
if (update) {
|
if (update) {
|
||||||
if (is.string(this.config.controls)) {
|
if (is.string(this.config.controls)) {
|
||||||
container = replace(container);
|
container = replace(container);
|
||||||
} else if (is.element(container)) {
|
|
||||||
container.innerHTML = replace(container.innerHTML);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1054,7 +1054,7 @@ class Plyr {
|
|||||||
const hiding = toggleClass(this.elements.container, this.config.classNames.hideControls, force);
|
const hiding = toggleClass(this.elements.container, this.config.classNames.hideControls, force);
|
||||||
|
|
||||||
// Close menu
|
// Close menu
|
||||||
if (hiding && this.config.controls.includes('settings') && !is.empty(this.config.settings)) {
|
if (hiding && is.array(this.config.controls) && this.config.controls.includes('settings') && !is.empty(this.config.settings)) {
|
||||||
controls.toggleMenu.call(this, false);
|
controls.toggleMenu.call(this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user