PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
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 / course-material.js

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

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