Advertisement
Guest User

Untitled

a guest
Aug 31st, 2021
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.36 KB | None | 0 0
  1. (window["webpackJsonp_sandc"] = window["webpackJsonp_sandc"] || []).push([["style-index"],{
  2.  
  3. /***/ "./src/style.scss":
  4. /*!************************!*\
  5. !*** ./src/style.scss ***!
  6. \************************/
  7. /*! no exports provided */
  8. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9.  
  10. "use strict";
  11. __webpack_require__.r(__webpack_exports__);
  12. // extracted by mini-css-extract-plugin
  13.  
  14.  
  15. /***/ })
  16.  
  17. }]);
  18.  
  19. /******/ (function(modules) { // webpackBootstrap
  20. /******/ // install a JSONP callback for chunk loading
  21. /******/ function webpackJsonpCallback(data) {
  22. /******/ var chunkIds = data[0];
  23. /******/ var moreModules = data[1];
  24. /******/ var executeModules = data[2];
  25. /******/
  26. /******/ // add "moreModules" to the modules object,
  27. /******/ // then flag all "chunkIds" as loaded and fire callback
  28. /******/ var moduleId, chunkId, i = 0, resolves = [];
  29. /******/ for(;i < chunkIds.length; i++) {
  30. /******/ chunkId = chunkIds[i];
  31. /******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {
  32. /******/ resolves.push(installedChunks[chunkId][0]);
  33. /******/ }
  34. /******/ installedChunks[chunkId] = 0;
  35. /******/ }
  36. /******/ for(moduleId in moreModules) {
  37. /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
  38. /******/ modules[moduleId] = moreModules[moduleId];
  39. /******/ }
  40. /******/ }
  41. /******/ if(parentJsonpFunction) parentJsonpFunction(data);
  42. /******/
  43. /******/ while(resolves.length) {
  44. /******/ resolves.shift()();
  45. /******/ }
  46. /******/
  47. /******/ // add entry modules from loaded chunk to deferred list
  48. /******/ deferredModules.push.apply(deferredModules, executeModules || []);
  49. /******/
  50. /******/ // run deferred modules when all chunks ready
  51. /******/ return checkDeferredModules();
  52. /******/ };
  53. /******/ function checkDeferredModules() {
  54. /******/ var result;
  55. /******/ for(var i = 0; i < deferredModules.length; i++) {
  56. /******/ var deferredModule = deferredModules[i];
  57. /******/ var fulfilled = true;
  58. /******/ for(var j = 1; j < deferredModule.length; j++) {
  59. /******/ var depId = deferredModule[j];
  60. /******/ if(installedChunks[depId] !== 0) fulfilled = false;
  61. /******/ }
  62. /******/ if(fulfilled) {
  63. /******/ deferredModules.splice(i--, 1);
  64. /******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
  65. /******/ }
  66. /******/ }
  67. /******/
  68. /******/ return result;
  69. /******/ }
  70. /******/
  71. /******/ // The module cache
  72. /******/ var installedModules = {};
  73. /******/
  74. /******/ // object to store loaded and loading chunks
  75. /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
  76. /******/ // Promise = chunk loading, 0 = chunk loaded
  77. /******/ var installedChunks = {
  78. /******/ "index": 0
  79. /******/ };
  80. /******/
  81. /******/ var deferredModules = [];
  82. /******/
  83. /******/ // The require function
  84. /******/ function __webpack_require__(moduleId) {
  85. /******/
  86. /******/ // Check if module is in cache
  87. /******/ if(installedModules[moduleId]) {
  88. /******/ return installedModules[moduleId].exports;
  89. /******/ }
  90. /******/ // Create a new module (and put it into the cache)
  91. /******/ var module = installedModules[moduleId] = {
  92. /******/ i: moduleId,
  93. /******/ l: false,
  94. /******/ exports: {}
  95. /******/ };
  96. /******/
  97. /******/ // Execute the module function
  98. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  99. /******/
  100. /******/ // Flag the module as loaded
  101. /******/ module.l = true;
  102. /******/
  103. /******/ // Return the exports of the module
  104. /******/ return module.exports;
  105. /******/ }
  106. /******/
  107. /******/
  108. /******/ // expose the modules object (__webpack_modules__)
  109. /******/ __webpack_require__.m = modules;
  110. /******/
  111. /******/ // expose the module cache
  112. /******/ __webpack_require__.c = installedModules;
  113. /******/
  114. /******/ // define getter function for harmony exports
  115. /******/ __webpack_require__.d = function(exports, name, getter) {
  116. /******/ if(!__webpack_require__.o(exports, name)) {
  117. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  118. /******/ }
  119. /******/ };
  120. /******/
  121. /******/ // define __esModule on exports
  122. /******/ __webpack_require__.r = function(exports) {
  123. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  124. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  125. /******/ }
  126. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  127. /******/ };
  128. /******/
  129. /******/ // create a fake namespace object
  130. /******/ // mode & 1: value is a module id, require it
  131. /******/ // mode & 2: merge all properties of value into the ns
  132. /******/ // mode & 4: return value when already ns object
  133. /******/ // mode & 8|1: behave like require
  134. /******/ __webpack_require__.t = function(value, mode) {
  135. /******/ if(mode & 1) value = __webpack_require__(value);
  136. /******/ if(mode & 8) return value;
  137. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  138. /******/ var ns = Object.create(null);
  139. /******/ __webpack_require__.r(ns);
  140. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  141. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  142. /******/ return ns;
  143. /******/ };
  144. /******/
  145. /******/ // getDefaultExport function for compatibility with non-harmony modules
  146. /******/ __webpack_require__.n = function(module) {
  147. /******/ var getter = module && module.__esModule ?
  148. /******/ function getDefault() { return module['default']; } :
  149. /******/ function getModuleExports() { return module; };
  150. /******/ __webpack_require__.d(getter, 'a', getter);
  151. /******/ return getter;
  152. /******/ };
  153. /******/
  154. /******/ // Object.prototype.hasOwnProperty.call
  155. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  156. /******/
  157. /******/ // __webpack_public_path__
  158. /******/ __webpack_require__.p = "";
  159. /******/
  160. /******/ var jsonpArray = window["webpackJsonp_sandc"] = window["webpackJsonp_sandc"] || [];
  161. /******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray);
  162. /******/ jsonpArray.push = webpackJsonpCallback;
  163. /******/ jsonpArray = jsonpArray.slice();
  164. /******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);
  165. /******/ var parentJsonpFunction = oldJsonpFunction;
  166. /******/
  167. /******/
  168. /******/ // add entry module to deferred list
  169. /******/ deferredModules.push(["./src/index.js","style-index"]);
  170. /******/ // run deferred modules when ready
  171. /******/ return checkDeferredModules();
  172. /******/ })
  173. /************************************************************************/
  174. /******/ ({
  175.  
  176. /***/ "./node_modules/@babel/runtime/helpers/extends.js":
  177. /*!********************************************************!*\
  178. !*** ./node_modules/@babel/runtime/helpers/extends.js ***!
  179. \********************************************************/
  180. /*! no static exports found */
  181. /***/ (function(module, exports) {
  182.  
  183. function _extends() {
  184. module.exports = _extends = Object.assign || function (target) {
  185. for (var i = 1; i < arguments.length; i++) {
  186. var source = arguments[i];
  187.  
  188. for (var key in source) {
  189. if (Object.prototype.hasOwnProperty.call(source, key)) {
  190. target[key] = source[key];
  191. }
  192. }
  193. }
  194.  
  195. return target;
  196. };
  197.  
  198. module.exports["default"] = module.exports, module.exports.__esModule = true;
  199. return _extends.apply(this, arguments);
  200. }
  201.  
  202. module.exports = _extends;
  203. module.exports["default"] = module.exports, module.exports.__esModule = true;
  204.  
  205. /***/ }),
  206.  
  207. /***/ "./src/edit.js":
  208. /*!*********************!*\
  209. !*** ./src/edit.js ***!
  210. \*********************/
  211. /*! exports provided: default */
  212. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  213.  
  214. "use strict";
  215. __webpack_require__.r(__webpack_exports__);
  216. /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ "./node_modules/@babel/runtime/helpers/extends.js");
  217. /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
  218. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
  219. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
  220. /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
  221. /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
  222. /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
  223. /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__);
  224. /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
  225. /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__);
  226. /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
  227. /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__);
  228. /* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss");
  229.  
  230.  
  231. // NOTE: I USED (and modified) YOUR EXACT CODE, BUT I REMOVED UNWANTED SPACES AND LINES
  232.  
  233. /**
  234. * Retrieves the translation of text.
  235. *
  236. * @see https://developer.wordpress.org/block-editor/packages/packages-i18n/
  237. */
  238.  
  239. /**
  240. * React hook that is used to mark the block wrapper element.
  241. * It provides all the necessary props like the class name.
  242. *
  243. * @see https://developer.wordpress.org/block-editor/packages/packages-block-editor/#useBlockProps
  244. */
  245.  
  246.  
  247. /**
  248. * Other things needed
  249. *
  250. */
  251.  
  252.  
  253.  
  254.  
  255. /**
  256. * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
  257. * Those files can contain any CSS code that gets applied to the editor.
  258. *
  259. * @see https://www.npmjs.com/package/@wordpress/scripts#using-css
  260. */
  261.  
  262.  
  263.  
  264. function mySelectPosts({
  265. clientId,
  266. attributes,
  267. setAttributes
  268. }) {
  269. // Used to reset inner blocks if we've changed the selected exercise
  270. const {
  271. replaceInnerBlocks
  272. } = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__["useDispatch"])("core/block-editor");
  273. const {
  274. inner_blocks
  275. } = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__["useSelect"])(select => ({
  276. inner_blocks: select("core/block-editor").getBlocks(clientId)
  277. }));
  278. const {
  279. posts,
  280. options
  281. } = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__["useSelect"])(select => {
  282. const {
  283. getEntityRecords
  284. } = select('core'); // Fetch posts from the REST API.
  285.  
  286. const posts = getEntityRecords('postType', 'exercise', {
  287. // Request featured media along with the standard post data.
  288. _embed: 'wp:featuredmedia'
  289. }) || [];
  290. return {
  291. // Options for the post selection dropdown.
  292. options: [...[{
  293. value: 0,
  294. label: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Select an exercise')
  295. }], ...(posts === null || posts === void 0 ? void 0 : posts.map(post => ({
  296. value: post.id,
  297. label: post.title.rendered
  298. })))],
  299. // Now here's the posts list.
  300. posts
  301. };
  302. }, []); // the empty array ([]) means the useSelect callback contains no dependencies.
  303.  
  304. const selectedPost = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__["useSelect"])(select => {
  305. const {
  306. getEntityRecord
  307. } = select('core');
  308. const post_id = attributes.selectedPost; // Fetch the post from the REST API, if we have a valid post ID.
  309.  
  310. return post_id && getEntityRecord('postType', 'exercise', post_id, {
  311. // Request featured media along with the standard post data.
  312. _embed: 'wp:featuredmedia'
  313. }); // This useSelect callback has one dependency - the selected post ID.
  314. }, [attributes.selectedPost]);
  315. /**
  316. * Called when the inspector controls select box is changed
  317. * Saves the value of the selected post to the selectedPost attribute
  318. * and resets the innerblock
  319. **/
  320.  
  321. const onSelectPost = post => {
  322. // reset the inner
  323. let inner_blocks_new = [];
  324. replaceInnerBlocks(clientId, inner_blocks_new, false);
  325. setAttributes({
  326. selectedPost: parseInt(post)
  327. });
  328. }; //* I removed Exercise, Exercises, someExercises and loadPosts. See the
  329. // useSelect above which uses getEntityRecords() or getEntityRecord().
  330.  
  331. /* Set of functions for saving out attributes
  332. * reps, sets, notes
  333. */
  334.  
  335.  
  336. const onChangeReps = reps => {
  337. setAttributes({
  338. reps: reps
  339. });
  340. };
  341.  
  342. const onChangeSets = sets => {
  343. setAttributes({
  344. sets: sets
  345. });
  346. };
  347.  
  348. const onChangeNotes = notes => {
  349. setAttributes({
  350. notes: notes
  351. });
  352. }; // will contain the text output for the edit.
  353.  
  354.  
  355. let output = "";
  356. const blockProps = Object(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__["useBlockProps"])({
  357. className: "sandcexercise"
  358. }); // we've selected a post, so grab the bits from that post to put into the html
  359.  
  360. if (selectedPost) {
  361. var _selectedPost$_embedd, _selectedPost$_embedd2;
  362.  
  363. //1
  364. // grab the things we are putting in the innerblock from the post
  365. let mediaID = (selectedPost === null || selectedPost === void 0 ? void 0 : selectedPost.featured_media) || 0; //2
  366.  
  367. let mediaURL = (selectedPost === null || selectedPost === void 0 ? void 0 : (_selectedPost$_embedd = selectedPost._embedded) === null || _selectedPost$_embedd === void 0 ? void 0 : (_selectedPost$_embedd2 = _selectedPost$_embedd['wp:featuredmedia'][0]) === null || _selectedPost$_embedd2 === void 0 ? void 0 : _selectedPost$_embedd2.source_url) || ''; //3
  368.  
  369. let exerciseLink = selectedPost.link; // remove any html content from the excerpt as it explodes the inner block :/
  370.  
  371. let strippedContent = selectedPost.excerpt.rendered.replace(/(<([^>]+)>)/gi, ""); // create a linked heading
  372.  
  373. let heading = '<a href="' + exerciseLink + '">' + selectedPost.title.rendered + '</a>'; // build the innerblocks template
  374.  
  375. const MY_TEMPLATE = [['core/heading', {
  376. content: heading
  377. }], ['core/image', {
  378. id: mediaID,
  379. url: mediaURL,
  380. href: exerciseLink,
  381. align: "right",
  382. sizeSlug: "medium",
  383. width: "300",
  384. caption: "Click for instructions"
  385. }], ['core/paragraph', {
  386. content: strippedContent
  387. }]];
  388. output = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__["InnerBlocks"], {
  389. template: MY_TEMPLATE,
  390. templateLock: ""
  391. });
  392. } else {
  393. output = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("p", null, "Select an exercise from the right");
  394. } // return the edit html.
  395.  
  396.  
  397. return [Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("div", _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, blockProps, {
  398. key: "sandcexercise"
  399. }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__["InspectorControls"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("div", {
  400. id: "sandcexercise-controls"
  401. }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__["SelectControl"], {
  402. onChange: onSelectPost,
  403. value: attributes.selectedPost,
  404. label: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Select a Post'),
  405. options: options
  406. }))), output, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__["TextControl"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, blockProps, {
  407. label: "Reps:",
  408. type: "number",
  409. className: "thereps",
  410. onChange: onChangeReps,
  411. value: attributes.reps
  412. })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__["TextControl"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, blockProps, {
  413. label: "Sets:",
  414. type: "number",
  415. className: "thesets",
  416. onChange: onChangeSets,
  417. value: attributes.sets
  418. })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__["TextControl"], _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, blockProps, {
  419. label: "Notes:",
  420. type: "text",
  421. className: "thenotes",
  422. onChange: onChangeNotes,
  423. value: attributes.notes
  424. })))];
  425. }
  426.  
  427. /* harmony default export */ __webpack_exports__["default"] = (mySelectPosts);
  428.  
  429. /***/ }),
  430.  
  431. /***/ "./src/editor.scss":
  432. /*!*************************!*\
  433. !*** ./src/editor.scss ***!
  434. \*************************/
  435. /*! no exports provided */
  436. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  437.  
  438. "use strict";
  439. __webpack_require__.r(__webpack_exports__);
  440. // extracted by mini-css-extract-plugin
  441.  
  442.  
  443. /***/ }),
  444.  
  445. /***/ "./src/index.js":
  446. /*!**********************!*\
  447. !*** ./src/index.js ***!
  448. \**********************/
  449. /*! no exports provided */
  450. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  451.  
  452. "use strict";
  453. __webpack_require__.r(__webpack_exports__);
  454. /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ "./node_modules/@babel/runtime/helpers/extends.js");
  455. /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
  456. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
  457. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
  458. /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
  459. /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__);
  460. /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
  461. /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__);
  462. /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
  463. /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
  464. /* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss");
  465. /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./edit */ "./src/edit.js");
  466.  
  467.  
  468. // NOTE: I USED (and modified) YOUR EXACT CODE, BUT I REMOVED UNWANTED SPACES AND LINES
  469.  
  470. /**
  471. * Registers a new block provided a unique name and an object defining its behavior.
  472. *
  473. * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
  474. */
  475.  
  476.  
  477. // Import __() from wp.i18n
  478.  
  479. /**
  480. * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
  481. * All files containing `style` keyword are bundled together. The code used
  482. * gets applied both to the front of your site and to the editor.
  483. *
  484. * @see https://www.npmjs.com/package/@wordpress/scripts#using-css
  485. */
  486.  
  487.  
  488. /**
  489. * Internal dependencies
  490. */
  491.  
  492.  
  493. /**
  494. * Every block starts by registering a new block type definition.
  495. *
  496. * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
  497. */
  498.  
  499. Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__["registerBlockType"])('get-coached/sandc', {
  500. apiVersion: 2,
  501. attributes: {
  502. /*8 don't add this as an attribute - posts: {
  503. type: 'array',
  504. default: [],
  505. },*/
  506.  
  507. /*7 unused attribute - post: {
  508. type: 'object',
  509. },*/
  510. selectedPost: {
  511. type: 'number',
  512. default: 0
  513. },
  514.  
  515. /* 9 don't add this as an attribute - options: {
  516. type: 'array',
  517. default: [ { value: 0, label: __( 'Select a Post' ) } ],
  518. },
  519. */
  520. reps: {
  521. type: 'string',
  522. //2 'number',
  523. source: 'text',
  524. //3 'number',
  525. selector: '.thereps',
  526. default: 15
  527. },
  528. sets: {
  529. type: 'string',
  530. //4 types: 'number',
  531. source: 'text',
  532. //5 'number',
  533. selector: '.thesets',
  534. default: 3
  535. },
  536. notes: {
  537. type: 'string',
  538. //6 types: 'text',
  539. source: 'text',
  540. selector: '.thenotes',
  541. default: ''
  542. }
  543. },
  544. edit: _edit__WEBPACK_IMPORTED_MODULE_6__["default"],
  545. save: function (props) {
  546. const blockProps = _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__["useBlockProps"].save();
  547. const {
  548. attributes
  549. } = props;
  550. return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("div", _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, blockProps, {
  551. key: "sandcexercise"
  552. }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__["InnerBlocks"].Content, null), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("div", {
  553. className: "repsrow"
  554. }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("div", {
  555. className: "repslabel"
  556. }, "Reps:"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("div", {
  557. className: "thereps"
  558. }, attributes.reps)), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("div", {
  559. className: "setsrow"
  560. }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("div", {
  561. className: "setslabel"
  562. }, "Sets:"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("div", {
  563. className: "thesets"
  564. }, attributes.sets)), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("div", {
  565. className: "notesrow"
  566. }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("div", {
  567. className: "noteslabel"
  568. }, "Notes:"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("div", {
  569. className: "thenotes"
  570. }, attributes.notes)));
  571. }
  572. });
  573.  
  574. /***/ }),
  575.  
  576. /***/ "@wordpress/block-editor":
  577. /*!*************************************!*\
  578. !*** external ["wp","blockEditor"] ***!
  579. \*************************************/
  580. /*! no static exports found */
  581. /***/ (function(module, exports) {
  582.  
  583. (function() { module.exports = window["wp"]["blockEditor"]; }());
  584.  
  585. /***/ }),
  586.  
  587. /***/ "@wordpress/blocks":
  588. /*!********************************!*\
  589. !*** external ["wp","blocks"] ***!
  590. \********************************/
  591. /*! no static exports found */
  592. /***/ (function(module, exports) {
  593.  
  594. (function() { module.exports = window["wp"]["blocks"]; }());
  595.  
  596. /***/ }),
  597.  
  598. /***/ "@wordpress/components":
  599. /*!************************************!*\
  600. !*** external ["wp","components"] ***!
  601. \************************************/
  602. /*! no static exports found */
  603. /***/ (function(module, exports) {
  604.  
  605. (function() { module.exports = window["wp"]["components"]; }());
  606.  
  607. /***/ }),
  608.  
  609. /***/ "@wordpress/data":
  610. /*!******************************!*\
  611. !*** external ["wp","data"] ***!
  612. \******************************/
  613. /*! no static exports found */
  614. /***/ (function(module, exports) {
  615.  
  616. (function() { module.exports = window["wp"]["data"]; }());
  617.  
  618. /***/ }),
  619.  
  620. /***/ "@wordpress/element":
  621. /*!*********************************!*\
  622. !*** external ["wp","element"] ***!
  623. \*********************************/
  624. /*! no static exports found */
  625. /***/ (function(module, exports) {
  626.  
  627. (function() { module.exports = window["wp"]["element"]; }());
  628.  
  629. /***/ }),
  630.  
  631. /***/ "@wordpress/i18n":
  632. /*!******************************!*\
  633. !*** external ["wp","i18n"] ***!
  634. \******************************/
  635. /*! no static exports found */
  636. /***/ (function(module, exports) {
  637.  
  638. (function() { module.exports = window["wp"]["i18n"]; }());
  639.  
  640. /***/ })
  641.  
  642. /******/ });
  643. //# sourceMappingURL=index.js.map
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement