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 / course-categories.js

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

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