Behavior.js
2 years ago
Controls.js
4 years ago
Edit.js
2 weeks ago
Edit.scss
2 weeks ago
Preset.js
4 years ago
Preview.js
3 years ago
Style.js
2 weeks ago
Style.scss
2 weeks ago
index.js
2 weeks ago
index.scss
2 weeks ago
Behavior.js
99 lines
| 1 | /** |
| 2 | * WordPress dependencies |
| 3 | */ |
| 4 | const { __ } = wp.i18n; |
| 5 | const { |
| 6 | ToggleControl, |
| 7 | BaseControl, |
| 8 | HorizontalRule, |
| 9 | __experimentalAlignmentMatrixControl: AlignmentMatrixControl, |
| 10 | SelectControl, |
| 11 | } = wp.components; |
| 12 | |
| 13 | export default function ({ state, updateState, className }) { |
| 14 | return ( |
| 15 | <div className={className}> |
| 16 | <BaseControl> |
| 17 | <h3>{__("Behavior", "presto-player")}</h3> |
| 18 | </BaseControl> |
| 19 | <BaseControl> |
| 20 | <ToggleControl |
| 21 | label={__("Save Play Position", "presto-player")} |
| 22 | help={__( |
| 23 | "Saves the user's play position so when they come back to the page they can continue the audio from where they left off.", |
| 24 | "presto-player" |
| 25 | )} |
| 26 | onChange={(save_player_position) => { |
| 27 | updateState({ save_player_position }); |
| 28 | }} |
| 29 | checked={state.save_player_position} |
| 30 | /> |
| 31 | </BaseControl> |
| 32 | <BaseControl> |
| 33 | <ToggleControl |
| 34 | label={__("Show Time Elapsed", "presto-player")} |
| 35 | help={__( |
| 36 | "Show the time elapsed or the time remaining for the audio on the player. By default, the time remaining is shown.", |
| 37 | "presto-player" |
| 38 | )} |
| 39 | onChange={(show_time_elapsed) => { |
| 40 | updateState({ show_time_elapsed }); |
| 41 | }} |
| 42 | checked={state.show_time_elapsed} |
| 43 | /> |
| 44 | </BaseControl> |
| 45 | <BaseControl> |
| 46 | <ToggleControl |
| 47 | label={__("Focus Mode", "presto-player")} |
| 48 | help={__( |
| 49 | "Play only when tab is visible and audio is in viewport.", |
| 50 | "presto-player" |
| 51 | )} |
| 52 | onChange={(play_video_viewport) => { |
| 53 | updateState({ play_video_viewport }); |
| 54 | }} |
| 55 | checked={state.play_video_viewport} |
| 56 | /> |
| 57 | </BaseControl> |
| 58 | |
| 59 | <BaseControl> |
| 60 | <ToggleControl |
| 61 | label={__("Sticky On Scroll", "presto-player")} |
| 62 | help={__( |
| 63 | "Stick audios to the side of the screen when the page is scrolled and the audio is playing.", |
| 64 | "presto-player" |
| 65 | )} |
| 66 | onChange={(sticky_scroll) => { |
| 67 | updateState({ sticky_scroll }); |
| 68 | }} |
| 69 | checked={state.sticky_scroll} |
| 70 | /> |
| 71 | </BaseControl> |
| 72 | |
| 73 | <BaseControl> |
| 74 | <SelectControl |
| 75 | label={__("On Audio End", "presto-player")} |
| 76 | value={state.on_video_end} |
| 77 | options={[ |
| 78 | { |
| 79 | value: "select", |
| 80 | label: __("Select", "presto-player"), |
| 81 | }, |
| 82 | { |
| 83 | value: "loop", |
| 84 | label: __("Loop", "presto-player"), |
| 85 | }, |
| 86 | { |
| 87 | value: "go-to-start", |
| 88 | label: __("Go to start", "presto-player"), |
| 89 | }, |
| 90 | ]} |
| 91 | onChange={(on_video_end) => { |
| 92 | updateState({ on_video_end }); |
| 93 | }} |
| 94 | /> |
| 95 | </BaseControl> |
| 96 | </div> |
| 97 | ); |
| 98 | } |
| 99 |