PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.0
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.0
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
learnpress / assets / js / dist / blocks / item-search.js

item-search.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.0, at assets/js/dist/blocks/item-search.js

304 lines 12.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (() => { // webpackBootstrap
2 /******/ "use strict";
3 /******/ var __webpack_modules__ = ({
4
5 /***/ "./assets/src/apps/js/blocks/single-course-item/item-search/edit.js"
6 /*!**************************************************************************!*\
7 !*** ./assets/src/apps/js/blocks/single-course-item/item-search/edit.js ***!
8 \**************************************************************************/
9 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
10
11 __webpack_require__.r(__webpack_exports__);
12 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
14 /* harmony export */ });
15 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
16 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
17 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
18 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
19 /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
20 /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__);
21 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
22 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__);
23
24
25
26
27 const Edit = props => {
28 const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)();
29 return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
30 ...blockProps
31 }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
32 class: "search-course"
33 }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("input", {
34 type: "text",
35 name: "s",
36 autocomplete: "off",
37 placeholder: "Search for course content"
38 }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("button", {
39 name: "submit",
40 "aria-label": "Search for course content"
41 }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("i", {
42 class: "lp-icon-search"
43 }))));
44 };
45 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Edit);
46
47 /***/ },
48
49 /***/ "./assets/src/apps/js/blocks/single-course-item/item-search/save.js"
50 /*!**************************************************************************!*\
51 !*** ./assets/src/apps/js/blocks/single-course-item/item-search/save.js ***!
52 \**************************************************************************/
53 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
54
55 __webpack_require__.r(__webpack_exports__);
56 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
57 /* harmony export */ save: () => (/* binding */ save)
58 /* harmony export */ });
59 const save = props => null;
60
61 /***/ },
62
63 /***/ "./assets/src/apps/js/blocks/utilBlock.js"
64 /*!************************************************!*\
65 !*** ./assets/src/apps/js/blocks/utilBlock.js ***!
66 \************************************************/
67 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
68
69 __webpack_require__.r(__webpack_exports__);
70 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
71 /* harmony export */ checkTemplatesCanLoadBlock: () => (/* binding */ checkTemplatesCanLoadBlock)
72 /* harmony export */ });
73 /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
74 /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__);
75 /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
76 /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
77 /**
78 * Check if the block can be loaded in the current template.
79 *
80 * @since 4.2.8.4
81 * @version 1.0.0
82 */
83
84
85 let currentPostIdOld = null;
86 const checkTemplatesCanLoadBlock = (templates, metadata, callBack) => {
87 (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.subscribe)(() => {
88 const metaDataNew = {
89 ...metadata
90 };
91 const store = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/editor') || null;
92 if (!store || typeof store.getCurrentPostId !== 'function' || !store.getCurrentPostId()) {
93 return;
94 }
95 const currentPostId = store.getCurrentPostId();
96 if (currentPostId === null) {
97 return;
98 }
99 if (currentPostIdOld === currentPostId) {
100 return;
101 }
102 currentPostIdOld = currentPostId;
103 if ((0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.getBlockType)(metaDataNew.name)) {
104 (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.unregisterBlockType)(metaDataNew.name);
105 if (templates.includes(currentPostId)) {
106 metaDataNew.ancestor = null;
107 callBack(metaDataNew);
108 } else {
109 if (!metaDataNew.ancestor) {
110 metaDataNew.ancestor = [];
111 }
112 callBack(metaDataNew);
113 }
114 }
115 });
116 };
117
118
119 /***/ },
120
121 /***/ "react"
122 /*!************************!*\
123 !*** external "React" ***!
124 \************************/
125 (module) {
126
127 module.exports = window["React"];
128
129 /***/ },
130
131 /***/ "@wordpress/block-editor"
132 /*!*************************************!*\
133 !*** external ["wp","blockEditor"] ***!
134 \*************************************/
135 (module) {
136
137 module.exports = window["wp"]["blockEditor"];
138
139 /***/ },
140
141 /***/ "@wordpress/blocks"
142 /*!********************************!*\
143 !*** external ["wp","blocks"] ***!
144 \********************************/
145 (module) {
146
147 module.exports = window["wp"]["blocks"];
148
149 /***/ },
150
151 /***/ "@wordpress/components"
152 /*!************************************!*\
153 !*** external ["wp","components"] ***!
154 \************************************/
155 (module) {
156
157 module.exports = window["wp"]["components"];
158
159 /***/ },
160
161 /***/ "@wordpress/data"
162 /*!******************************!*\
163 !*** external ["wp","data"] ***!
164 \******************************/
165 (module) {
166
167 module.exports = window["wp"]["data"];
168
169 /***/ },
170
171 /***/ "@wordpress/i18n"
172 /*!******************************!*\
173 !*** external ["wp","i18n"] ***!
174 \******************************/
175 (module) {
176
177 module.exports = window["wp"]["i18n"];
178
179 /***/ },
180
181 /***/ "./assets/src/apps/js/blocks/single-course-item/item-search/block.json"
182 /*!*****************************************************************************!*\
183 !*** ./assets/src/apps/js/blocks/single-course-item/item-search/block.json ***!
184 \*****************************************************************************/
185 (module) {
186
187 module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"learnpress/item-search","title":"Item Search","category":"learnpress-category","icon":"search","description":"Renders template Single Course Legacy PHP templates.","textdomain":"learnpress","keywords":["item search course","learnpress"],"usesContext":[],"supports":{"align":true}}');
188
189 /***/ }
190
191 /******/ });
192 /************************************************************************/
193 /******/ // The module cache
194 /******/ var __webpack_module_cache__ = {};
195 /******/
196 /******/ // The require function
197 /******/ function __webpack_require__(moduleId) {
198 /******/ // Check if module is in cache
199 /******/ var cachedModule = __webpack_module_cache__[moduleId];
200 /******/ if (cachedModule !== undefined) {
201 /******/ return cachedModule.exports;
202 /******/ }
203 /******/ // Create a new module (and put it into the cache)
204 /******/ var module = __webpack_module_cache__[moduleId] = {
205 /******/ // no module.id needed
206 /******/ // no module.loaded needed
207 /******/ exports: {}
208 /******/ };
209 /******/
210 /******/ // Execute the module function
211 /******/ if (!(moduleId in __webpack_modules__)) {
212 /******/ delete __webpack_module_cache__[moduleId];
213 /******/ var e = new Error("Cannot find module '" + moduleId + "'");
214 /******/ e.code = 'MODULE_NOT_FOUND';
215 /******/ throw e;
216 /******/ }
217 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
218 /******/
219 /******/ // Return the exports of the module
220 /******/ return module.exports;
221 /******/ }
222 /******/
223 /************************************************************************/
224 /******/ /* webpack/runtime/compat get default export */
225 /******/ (() => {
226 /******/ // getDefaultExport function for compatibility with non-harmony modules
227 /******/ __webpack_require__.n = (module) => {
228 /******/ var getter = module && module.__esModule ?
229 /******/ () => (module['default']) :
230 /******/ () => (module);
231 /******/ __webpack_require__.d(getter, { a: getter });
232 /******/ return getter;
233 /******/ };
234 /******/ })();
235 /******/
236 /******/ /* webpack/runtime/define property getters */
237 /******/ (() => {
238 /******/ // define getter functions for harmony exports
239 /******/ __webpack_require__.d = (exports, definition) => {
240 /******/ for(var key in definition) {
241 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
242 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
243 /******/ }
244 /******/ }
245 /******/ };
246 /******/ })();
247 /******/
248 /******/ /* webpack/runtime/hasOwnProperty shorthand */
249 /******/ (() => {
250 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
251 /******/ })();
252 /******/
253 /******/ /* webpack/runtime/make namespace object */
254 /******/ (() => {
255 /******/ // define __esModule on exports
256 /******/ __webpack_require__.r = (exports) => {
257 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
258 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
259 /******/ }
260 /******/ Object.defineProperty(exports, '__esModule', { value: true });
261 /******/ };
262 /******/ })();
263 /******/
264 /************************************************************************/
265 var __webpack_exports__ = {};
266 // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
267 (() => {
268 /*!***************************************************************************!*\
269 !*** ./assets/src/apps/js/blocks/single-course-item/item-search/index.js ***!
270 \***************************************************************************/
271 __webpack_require__.r(__webpack_exports__);
272 /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./edit */ "./assets/src/apps/js/blocks/single-course-item/item-search/edit.js");
273 /* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./save */ "./assets/src/apps/js/blocks/single-course-item/item-search/save.js");
274 /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./assets/src/apps/js/blocks/single-course-item/item-search/block.json");
275 /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
276 /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__);
277 /* harmony import */ var _utilBlock_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utilBlock.js */ "./assets/src/apps/js/blocks/utilBlock.js");
278 /**
279 * Register block item search.
280 */
281
282
283
284
285
286
287 const templatesName = ['learnpress/learnpress//single-lp_course_item'];
288 (0,_utilBlock_js__WEBPACK_IMPORTED_MODULE_4__.checkTemplatesCanLoadBlock)(templatesName, _block_json__WEBPACK_IMPORTED_MODULE_2__, metadataNew => {
289 (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__.registerBlockType)(metadataNew.name, {
290 ...metadataNew,
291 edit: _edit__WEBPACK_IMPORTED_MODULE_0__["default"],
292 save: _save__WEBPACK_IMPORTED_MODULE_1__.save
293 });
294 });
295 (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, {
296 ..._block_json__WEBPACK_IMPORTED_MODULE_2__,
297 edit: _edit__WEBPACK_IMPORTED_MODULE_0__["default"],
298 save: _save__WEBPACK_IMPORTED_MODULE_1__.save
299 });
300 })();
301
302 /******/ })()
303 ;
304 //# sourceMappingURL=item-search.js.map