Merge branch 'develop' into a11y-improvements
# Conflicts: # src/js/controls.js
This commit is contained in:
commit
13a54b5dbe
@ -3,7 +3,9 @@
|
|||||||
This is the markup that is rendered for the Plyr controls. You can use the default controls or provide a customized version of markup based on your needs. You can pass the following to the `controls` option:
|
This is the markup that is rendered for the Plyr controls. You can use the default controls or provide a customized version of markup based on your needs. You can pass the following to the `controls` option:
|
||||||
|
|
||||||
- `Array` of options (this builds the default controls based on your choices)
|
- `Array` of options (this builds the default controls based on your choices)
|
||||||
|
- `Element` with the controls
|
||||||
- `String` containing the desired HTML
|
- `String` containing the desired HTML
|
||||||
|
- `false` (or empty string or array) to disable all controls
|
||||||
- `Function` that will be executed and should return one of the above
|
- `Function` that will be executed and should return one of the above
|
||||||
|
|
||||||
## Using default controls
|
## Using default controls
|
||||||
|
26
src/js/controls.js
vendored
26
src/js/controls.js
vendored
@ -1388,11 +1388,6 @@ const controls = {
|
|||||||
// Build the default HTML
|
// Build the default HTML
|
||||||
// TODO: Set order based on order in the config.controls array?
|
// TODO: Set order based on order in the config.controls array?
|
||||||
create(data) {
|
create(data) {
|
||||||
// Do nothing if we want no controls
|
|
||||||
if (is.empty(this.config.controls)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the container
|
// Create the container
|
||||||
const container = createElement(
|
const container = createElement(
|
||||||
'div',
|
'div',
|
||||||
@ -1746,16 +1741,19 @@ const controls = {
|
|||||||
};
|
};
|
||||||
let update = true;
|
let update = true;
|
||||||
|
|
||||||
if (
|
// If function, run it and use output
|
||||||
is.string(this.config.controls) ||
|
if (is.function(this.config.controls)) {
|
||||||
is.element(this.config.controls)
|
this.config.controls = this.config.controls.call(this.props);
|
||||||
) {
|
}
|
||||||
// String or HTMLElement passed as the option
|
|
||||||
|
// Convert falsy controls to empty array (primarily for empty strings)
|
||||||
|
if (!this.config.controls) {
|
||||||
|
this.config.controls = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is.element(this.config.controls) || is.string(this.config.controls)) {
|
||||||
|
// HTMLElement or Non-empty string passed as the option
|
||||||
container = this.config.controls;
|
container = this.config.controls;
|
||||||
} else if (is.function(this.config.controls)) {
|
|
||||||
// A custom function to build controls
|
|
||||||
// The function can return a HTMLElement or String
|
|
||||||
container = this.config.controls.call(this, props);
|
|
||||||
} else {
|
} else {
|
||||||
// Create controls
|
// Create controls
|
||||||
container = controls.create.call(this, {
|
container = controls.create.call(this, {
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
padding: $plyr-control-spacing;
|
padding: $plyr-control-spacing;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
transform: translateY(-($plyr-control-spacing * 4));
|
|
||||||
transition: transform 0.4s ease-in-out;
|
transition: transform 0.4s ease-in-out;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
@ -53,6 +52,8 @@
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.plyr--hide-controls .plyr__captions {
|
// If the lower controls are shown and not empty
|
||||||
transform: translateY(-($plyr-control-spacing * 1.5));
|
.plyr:not(.plyr--hide-controls) .plyr__controls:not(:empty) ~ .plyr__captions {
|
||||||
|
transform: translateY(-($plyr-control-spacing * 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,12 +32,9 @@
|
|||||||
margin-left: ($plyr-control-spacing / 2);
|
margin-left: ($plyr-control-spacing / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hide empty controls
|
||||||
&:empty {
|
&:empty {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
~ .plyr__captions {
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: $plyr-bp-sm) {
|
@media (min-width: $plyr-bp-sm) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user