PluginProbe ʕ •ᴥ•ʔ
Presto Player / 4.3.1
Presto Player v4.3.1
4.3.1 4.3.0 4.2.4 4.2.3 4.2.2 4.2.0 4.2.1 trunk 1.10.0 1.10.1 1.10.2 1.11.0 1.12.0 1.13.0 1.14.0 1.14.1 1.5.10 1.5.11 1.5.12 1.5.13 1.5.14 1.5.15 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 1.6.13 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3-beta1 2.3.0 2.3.1 2.3.2 2.3.3 3.0.0 3.0.0-beta1 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.1.0 3.1.1 3.1.2 3.1.3 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4
presto-player / src / admin / blocks / shared / presets / Search.js
presto-player / src / admin / blocks / shared / presets Last commit date
parts 2 weeks ago ActionBar.js 2 weeks ago ActionBar.scss 2 weeks ago Behavior.js 2 years ago CTA.js 2 weeks ago CTA.scss 2 weeks ago Controls.js 5 years ago Edit.js 2 weeks ago Edit.scss 2 weeks ago Email.js 2 weeks ago Email.scss 2 weeks ago Preset.js 4 years ago Search.js 3 years ago Style.js 2 weeks ago Style.scss 2 weeks ago Watermark.js 4 years ago index.js 2 weeks ago index.scss 2 weeks ago
Search.js
128 lines
1 /**
2 * WordPress dependencies
3 */
4 import { __ } from "@wordpress/i18n";
5 import {
6 ToggleControl,
7 BaseControl,
8 RangeControl,
9 TextControl,
10 Button,
11 } from "@wordpress/components";
12 import { chevronDown, chevronUp } from "@wordpress/icons";
13 import { useEffect, useState } from "@wordpress/element";
14
15 export default ({ state, updateState, className }) => {
16 const { search } = state;
17 const [showAdvanced, setShowAdvanced] = useState(false);
18
19 const defaults = {
20 enabled: false,
21 minMatchCharLength: 1,
22 threshold: 0.3,
23 placeholder: "Search",
24 };
25 useEffect(() => {
26 Object.keys(defaults).forEach((key) => {
27 if (state?.search?.[key] === undefined) {
28 updateSearchState({
29 [key]: defaults[key],
30 });
31 }
32 });
33 }, [state]);
34
35 const updateSearchState = (updated) => {
36 updateState({
37 ...state,
38 search: {
39 ...search,
40 ...updated,
41 },
42 });
43 };
44
45 return (
46 <div className={className}>
47 <BaseControl>
48 <h3>{__("Searchable Captions", "presto-player")}</h3>
49 </BaseControl>
50 <BaseControl className="presto-player__control--search">
51 <ToggleControl
52 label={__("Enable", "presto-player")}
53 help={__(
54 "Show a search bar on your player which enables searching within the subtitles of the video.",
55 "presto-player"
56 )}
57 onChange={(enabled) => {
58 updateSearchState({
59 enabled,
60 });
61 }}
62 checked={search?.enabled}
63 />
64 </BaseControl>
65 {search?.enabled && (
66 <div>
67 <BaseControl className="presto-player__control--placeholder-text">
68 <TextControl
69 label={__("Placeholder Text", "presto-player")}
70 help=""
71 value={search?.placeholder}
72 onChange={(placeholder) => updateSearchState({ placeholder })}
73 />
74 </BaseControl>
75
76 <BaseControl>
77 <Button
78 onClick={() => setShowAdvanced(!showAdvanced)}
79 iconPosition="right"
80 icon={showAdvanced ? chevronUp : chevronDown}
81 variant="link"
82 >
83 {__("Advanced Settings", "presto-player")}
84 </Button>
85 </BaseControl>
86
87 {!!showAdvanced && (
88 <>
89 <BaseControl>
90 <RangeControl
91 label={__(
92 "Minimum Matching Character Length",
93 "presto-player"
94 )}
95 help={__(
96 "Only the matches whose length exceeds this value will be returned. (For instance, if you want to ignore single character matches in the result, set it to 2",
97 "presto-player"
98 )}
99 value={search?.minMatchCharLength || 1}
100 onChange={(minMatchCharLength) =>
101 updateSearchState({ minMatchCharLength })
102 }
103 min={0}
104 max={10}
105 />
106 </BaseControl>
107 <BaseControl>
108 <RangeControl
109 label={__("Threshold", "presto-player")}
110 help={__(
111 "At what point does the match algorithm give up. A threshold of 0.0 requires a perfect match (of both letters and location), a threshold of 1.0 would match anything.",
112 "presto-player"
113 )}
114 value={search?.threshold || 1}
115 onChange={(threshold) => updateSearchState({ threshold })}
116 min={0}
117 max={1}
118 step={0.1}
119 />
120 </BaseControl>
121 </>
122 )}
123 </div>
124 )}
125 </div>
126 );
127 };
128