PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.4
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.4
4.4.9 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 All 140 releases
learnpress / assets / js / dist / blocks / course-featured.js

course-featured.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.4, at assets/js/dist/blocks/course-featured.js

313 lines 13.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/course-elements/course-featured/edit.js"
6 /*!***************************************************************************!*\
7 !*** ./assets/src/apps/js/blocks/course-elements/course-featured/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_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
20 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__);
21
22
23
24 const Edit = props => {
25 const {
26 attributes,
27 setAttributes,
28 context
29 } = props;
30 const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)();
31 const {
32 lpCourseData
33 } = context;
34 const label = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Featured', 'learnpress');
35 return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
36 ...blockProps,
37 style: {
38 ...blockProps.style,
39 display: 'inline-block'
40 }
41 }, label));
42 };
43 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Edit);
44
45 /***/ },
46
47 /***/ "./assets/src/apps/js/blocks/course-elements/course-featured/save.js"
48 /*!***************************************************************************!*\
49 !*** ./assets/src/apps/js/blocks/course-elements/course-featured/save.js ***!
50 \***************************************************************************/
51 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
52
53 __webpack_require__.r(__webpack_exports__);
54 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
55 /* harmony export */ save: () => (/* binding */ save)
56 /* harmony export */ });
57 const save = props => null;
58
59 /***/ },
60
61 /***/ "./assets/src/apps/js/blocks/utilBlock.js"
62 /*!************************************************!*\
63 !*** ./assets/src/apps/js/blocks/utilBlock.js ***!
64 \************************************************/
65 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
66
67 __webpack_require__.r(__webpack_exports__);
68 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
69 /* harmony export */ checkTemplatesCanLoadBlock: () => (/* binding */ checkTemplatesCanLoadBlock)
70 /* harmony export */ });
71 /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
72 /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__);
73 /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
74 /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
75 /**
76 * Check if the block can be loaded in the current template.
77 *
78 * @since 4.2.8.4
79 * @version 1.0.0
80 */
81
82
83 let currentPostIdOld = null;
84 const checkTemplatesCanLoadBlock = (templates, metadata, callBack) => {
85 (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.subscribe)(() => {
86 const metaDataNew = {
87 ...metadata
88 };
89 const store = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('core/editor') || null;
90 if (!store || typeof store.getCurrentPostId !== 'function' || !store.getCurrentPostId()) {
91 return;
92 }
93 const currentPostId = store.getCurrentPostId();
94 if (currentPostId === null) {
95 return;
96 }
97 if (currentPostIdOld === currentPostId) {
98 return;
99 }
100 currentPostIdOld = currentPostId;
101 if ((0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.getBlockType)(metaDataNew.name)) {
102 (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.unregisterBlockType)(metaDataNew.name);
103 if (templates.includes(currentPostId)) {
104 metaDataNew.ancestor = null;
105 callBack(metaDataNew);
106 } else {
107 if (!metaDataNew.ancestor) {
108 metaDataNew.ancestor = [];
109 }
110 callBack(metaDataNew);
111 }
112 }
113 });
114 };
115
116
117 /***/ },
118
119 /***/ "react"
120 /*!************************!*\
121 !*** external "React" ***!
122 \************************/
123 (module) {
124
125 module.exports = window["React"];
126
127 /***/ },
128
129 /***/ "@wordpress/block-editor"
130 /*!*************************************!*\
131 !*** external ["wp","blockEditor"] ***!
132 \*************************************/
133 (module) {
134
135 module.exports = window["wp"]["blockEditor"];
136
137 /***/ },
138
139 /***/ "@wordpress/blocks"
140 /*!********************************!*\
141 !*** external ["wp","blocks"] ***!
142 \********************************/
143 (module) {
144
145 module.exports = window["wp"]["blocks"];
146
147 /***/ },
148
149 /***/ "@wordpress/data"
150 /*!******************************!*\
151 !*** external ["wp","data"] ***!
152 \******************************/
153 (module) {
154
155 module.exports = window["wp"]["data"];
156
157 /***/ },
158
159 /***/ "@wordpress/i18n"
160 /*!******************************!*\
161 !*** external ["wp","i18n"] ***!
162 \******************************/
163 (module) {
164
165 module.exports = window["wp"]["i18n"];
166
167 /***/ },
168
169 /***/ "./assets/src/apps/js/blocks/course-elements/course-featured/block.json"
170 /*!******************************************************************************!*\
171 !*** ./assets/src/apps/js/blocks/course-elements/course-featured/block.json ***!
172 \******************************************************************************/
173 (module) {
174
175 module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"learnpress/course-featured","title":"Course Featured","category":"learnpress-course-elements","icon":"star-empty","description":"Course featured.","textdomain":"learnpress","keywords":["course featured","learnpress"],"ancestor":["learnpress/single-course","learnpress/course-item-template"],"attributes":{},"usesContext":["lpCourseData"],"supports":{"multiple":true,"align":["wide","full"],"html":false,"typography":{"fontSize":true,"lineHeight":false,"fontWeight":true,"textTransform":false,"__experimentalFontFamily":false,"__experimentalTextDecoration":false,"__experimentalFontStyle":true,"__experimentalFontWeight":true,"__experimentalLetterSpacing":false,"__experimentalTextTransform":true,"__experimentalDefaultControls":{"fontSize":true,"textTransform":false}},"color":{"text":true,"background":true,"__experimentalDefaultControls":{"text":true,"background":true}},"__experimentalBorder":{"color":true,"radius":true,"width":true},"spacing":{"padding":true,"margin":true,"__experimentalDefaultControls":{"margin":false,"padding":false}}}}');
176
177 /***/ }
178
179 /******/ });
180 /************************************************************************/
181 /******/ // The module cache
182 /******/ const __webpack_module_cache__ = {};
183 /******/
184 /******/ // The require function
185 /******/ function __webpack_require__(moduleId) {
186 /******/ // Check if module is in cache
187 /******/ const cachedModule = __webpack_module_cache__[moduleId];
188 /******/ if (cachedModule !== undefined) {
189 /******/ return cachedModule.exports;
190 /******/ }
191 /******/ // Create a new module (and put it into the cache)
192 /******/ const module = __webpack_module_cache__[moduleId] = {
193 /******/ // no module.id needed
194 /******/ // no module.loaded needed
195 /******/ exports: {}
196 /******/ };
197 /******/
198 /******/ // Execute the module function
199 /******/ if (!(moduleId in __webpack_modules__)) {
200 /******/ delete __webpack_module_cache__[moduleId];
201 /******/ const e = new Error("Cannot find module '" + moduleId + "'");
202 /******/ e.code = 'MODULE_NOT_FOUND';
203 /******/ throw e;
204 /******/ }
205 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
206 /******/
207 /******/ // Return the exports of the module
208 /******/ return module.exports;
209 /******/ }
210 /******/
211 /************************************************************************/
212 /******/ /* webpack/runtime/compat get default export */
213 /******/ (() => {
214 /******/ // getDefaultExport function for compatibility with non-harmony modules
215 /******/ __webpack_require__.n = (module) => {
216 /******/ const getter = module && module.__esModule ?
217 /******/ () => (module['default']) :
218 /******/ () => (module);
219 /******/ __webpack_require__.d(getter, { a: getter });
220 /******/ return getter;
221 /******/ };
222 /******/ })();
223 /******/
224 /******/ /* webpack/runtime/define property getters */
225 /******/ (() => {
226 /******/ // define getter/value functions for harmony exports
227 /******/ __webpack_require__.d = (exports, definition) => {
228 /******/ if(Array.isArray(definition)) {
229 /******/ var i = 0;
230 /******/ while(i < definition.length) {
231 /******/ var key = definition[i++];
232 /******/ var binding = definition[i++];
233 /******/ if(!__webpack_require__.o(exports, key)) {
234 /******/ if(binding === 0) {
235 /******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
236 /******/ } else {
237 /******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
238 /******/ }
239 /******/ } else if(binding === 0) { i++; }
240 /******/ }
241 /******/ } else {
242 /******/ for(var key in definition) {
243 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
244 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
245 /******/ }
246 /******/ }
247 /******/ }
248 /******/ };
249 /******/ })();
250 /******/
251 /******/ /* webpack/runtime/hasOwnProperty shorthand */
252 /******/ (() => {
253 /******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop))
254 /******/ })();
255 /******/
256 /******/ /* webpack/runtime/make namespace object */
257 /******/ (() => {
258 /******/ // define __esModule on exports
259 /******/ __webpack_require__.r = (exports) => {
260 /******/ if(Symbol.toStringTag) {
261 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
262 /******/ }
263 /******/ Object.defineProperty(exports, '__esModule', { value: true });
264 /******/ };
265 /******/ })();
266 /******/
267 /************************************************************************/
268 let __webpack_exports__ = {};
269 // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
270 (() => {
271 /*!****************************************************************************!*\
272 !*** ./assets/src/apps/js/blocks/course-elements/course-featured/index.js ***!
273 \****************************************************************************/
274 __webpack_require__.r(__webpack_exports__);
275 /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./edit */ "./assets/src/apps/js/blocks/course-elements/course-featured/edit.js");
276 /* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./save */ "./assets/src/apps/js/blocks/course-elements/course-featured/save.js");
277 /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./assets/src/apps/js/blocks/course-elements/course-featured/block.json");
278 /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
279 /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__);
280 /* harmony import */ var _utilBlock_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utilBlock.js */ "./assets/src/apps/js/blocks/utilBlock.js");
281 /**
282 * Register block course featured.
283 */
284
285
286
287
288
289 const templatesName = ['learnpress/learnpress//single-lp_course', 'learnpress/learnpress//single-lp_course-offline'];
290
291 /**
292 * Check if the block can load in the template editor: single-lp_course.
293 * if it is editing on this template, set ancestor to null
294 */
295 (0,_utilBlock_js__WEBPACK_IMPORTED_MODULE_4__.checkTemplatesCanLoadBlock)(templatesName, _block_json__WEBPACK_IMPORTED_MODULE_2__, metadataNew => {
296 (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__.registerBlockType)(metadataNew.name, {
297 ...metadataNew,
298 edit: _edit__WEBPACK_IMPORTED_MODULE_0__["default"],
299 save: _save__WEBPACK_IMPORTED_MODULE_1__.save
300 });
301 });
302
303 // Register the block with the original metadata, ancestor will be set on block.json
304 (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, {
305 ..._block_json__WEBPACK_IMPORTED_MODULE_2__,
306 edit: _edit__WEBPACK_IMPORTED_MODULE_0__["default"],
307 save: _save__WEBPACK_IMPORTED_MODULE_1__.save
308 });
309 })();
310
311 /******/ })()
312 ;
313 //# sourceMappingURL=course-featured.js.map