From 3a6b6092ab22c77d69025fb9d1f463d4fb899c0a Mon Sep 17 00:00:00 2001 From: Antoine M Date: Wed, 4 Oct 2023 14:36:15 +0200 Subject: [PATCH] develloping chapitrage thematique --- blocks/chapitrage-thematique/build/block.json | 5 +- .../build/chapitre-thematique/block.json | 38 + .../build/chapitre-thematique/index.asset.php | 1 + .../build/chapitre-thematique/index.css | 8 + .../build/chapitre-thematique/index.js | 883 ++++++++++++++++++ .../build/chapitre-thematique/index.js.map | 1 + .../build/index.asset.php | 2 +- blocks/chapitrage-thematique/build/index.css | 12 + blocks/chapitrage-thematique/build/index.js | 736 ++++++++++++++- .../chapitrage-thematique/build/index.js.map | 2 +- .../build/lien-chapitre/block.json | 31 + .../build/lien-chapitre/index.asset.php | 1 + .../build/lien-chapitre/index.css | 4 + .../build/lien-chapitre/index.js | 597 ++++++++++++ .../build/lien-chapitre/index.js.map | 1 + .../build/lien-chapitre/style-index.css | 4 + .../build/style-index.css | 34 + .../build/style-index.css.map | 1 + blocks/chapitrage-thematique/src/block.json | 5 +- .../src/chapitre-thematique/block.json | 38 + .../src/chapitre-thematique/edit.js | 114 +++ .../src/chapitre-thematique/editor.scss | 1 + .../src/chapitre-thematique/index.js | 25 + .../src/chapitre-thematique/save.js | 22 + .../src/chapitre-thematique/style.scss | 1 + blocks/chapitrage-thematique/src/edit.js | 43 +- blocks/chapitrage-thematique/src/editor.scss | 9 - .../src/lien-chapitre/OptionsSelectControl.js | 158 ++++ .../src/lien-chapitre/block.json | 31 + .../src/lien-chapitre/edit.js | 85 ++ .../src/lien-chapitre/editor.scss | 1 + .../src/lien-chapitre/index.js | 33 + .../src/lien-chapitre/save.js | 28 + .../src/lien-chapitre/style.scss | 1 + blocks/chapitrage-thematique/src/save.js | 7 +- blocks/chapitrage-thematique/src/style.scss | 32 +- 36 files changed, 2919 insertions(+), 76 deletions(-) create mode 100644 blocks/chapitrage-thematique/build/chapitre-thematique/block.json create mode 100644 blocks/chapitrage-thematique/build/chapitre-thematique/index.asset.php create mode 100644 blocks/chapitrage-thematique/build/chapitre-thematique/index.css create mode 100644 blocks/chapitrage-thematique/build/chapitre-thematique/index.js create mode 100644 blocks/chapitrage-thematique/build/chapitre-thematique/index.js.map create mode 100644 blocks/chapitrage-thematique/build/index.css create mode 100644 blocks/chapitrage-thematique/build/lien-chapitre/block.json create mode 100644 blocks/chapitrage-thematique/build/lien-chapitre/index.asset.php create mode 100644 blocks/chapitrage-thematique/build/lien-chapitre/index.css create mode 100644 blocks/chapitrage-thematique/build/lien-chapitre/index.js create mode 100644 blocks/chapitrage-thematique/build/lien-chapitre/index.js.map create mode 100644 blocks/chapitrage-thematique/build/lien-chapitre/style-index.css create mode 100644 blocks/chapitrage-thematique/build/style-index.css create mode 100644 blocks/chapitrage-thematique/build/style-index.css.map create mode 100644 blocks/chapitrage-thematique/src/chapitre-thematique/block.json create mode 100644 blocks/chapitrage-thematique/src/chapitre-thematique/edit.js create mode 100644 blocks/chapitrage-thematique/src/chapitre-thematique/editor.scss create mode 100644 blocks/chapitrage-thematique/src/chapitre-thematique/index.js create mode 100644 blocks/chapitrage-thematique/src/chapitre-thematique/save.js create mode 100644 blocks/chapitrage-thematique/src/chapitre-thematique/style.scss create mode 100644 blocks/chapitrage-thematique/src/lien-chapitre/OptionsSelectControl.js create mode 100644 blocks/chapitrage-thematique/src/lien-chapitre/block.json create mode 100644 blocks/chapitrage-thematique/src/lien-chapitre/edit.js create mode 100644 blocks/chapitrage-thematique/src/lien-chapitre/editor.scss create mode 100644 blocks/chapitrage-thematique/src/lien-chapitre/index.js create mode 100644 blocks/chapitrage-thematique/src/lien-chapitre/save.js create mode 100644 blocks/chapitrage-thematique/src/lien-chapitre/style.scss diff --git a/blocks/chapitrage-thematique/build/block.json b/blocks/chapitrage-thematique/build/block.json index 9c204ce..9b794b2 100644 --- a/blocks/chapitrage-thematique/build/block.json +++ b/blocks/chapitrage-thematique/build/block.json @@ -5,9 +5,10 @@ "version": "0.1.0", "title": "Chapitrage Thématique", "category": "homegrade-blocks", - "description": "Pour insérer un bloc de gestion de chapitres pour une thématique parent", + "description": "(Pour les thématiques parents) Pour insérer un bloc de gestion de chapitres pour une thématique parent", "supports": { - "html": false + "html": false, + "multiple": false }, "textdomain": "homegrade-blocks", "editorScript": "file:./index.js", diff --git a/blocks/chapitrage-thematique/build/chapitre-thematique/block.json b/blocks/chapitrage-thematique/build/chapitre-thematique/block.json new file mode 100644 index 0000000..8565414 --- /dev/null +++ b/blocks/chapitrage-thematique/build/chapitre-thematique/block.json @@ -0,0 +1,38 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 2, + "name": "homegrade-content-blocks/chapitre-thematique", + "version": "0.1.0", + "title": "Chapitre Thématiques ", + "category": "homegrade-blocks", + "description": "Point de légende pour titrer ou décrire un point de légende spécifique sur un Schéma ", + "supports": { + "html": false + }, + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "style": "file:./style-index.css", + "attributes": { + "chapterTitle": { + "type": "string", + "default": "" + }, + "chapterDescription": { + "type": "string", + "default": "" + }, + "chapterImageUrl": { + "type": "string" + }, + "chapterImageId": { + "type": "number" + }, + "chapterImageAlt": { + "type": "string", + "source": "attribute", + "selector": "img", + "attribute": "alt", + "default": "" + } + } +} \ No newline at end of file diff --git a/blocks/chapitrage-thematique/build/chapitre-thematique/index.asset.php b/blocks/chapitrage-thematique/build/chapitre-thematique/index.asset.php new file mode 100644 index 0000000..028f916 --- /dev/null +++ b/blocks/chapitrage-thematique/build/chapitre-thematique/index.asset.php @@ -0,0 +1 @@ + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-primitives'), 'version' => 'd4500b06e4bbf5d42971'); diff --git a/blocks/chapitrage-thematique/build/chapitre-thematique/index.css b/blocks/chapitrage-thematique/build/chapitre-thematique/index.css new file mode 100644 index 0000000..bf62e97 --- /dev/null +++ b/blocks/chapitrage-thematique/build/chapitre-thematique/index.css @@ -0,0 +1,8 @@ +/*!************************************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/chapitre-thematique/editor.scss ***! + \************************************************************************************************************************************************************************************************************************************************************/ + +/*!******************************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/lien-chapitre/editor.scss ***! + \******************************************************************************************************************************************************************************************************************************************************/ + diff --git a/blocks/chapitrage-thematique/build/chapitre-thematique/index.js b/blocks/chapitrage-thematique/build/chapitre-thematique/index.js new file mode 100644 index 0000000..4802c77 --- /dev/null +++ b/blocks/chapitrage-thematique/build/chapitre-thematique/index.js @@ -0,0 +1,883 @@ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/chapitre-thematique/edit.js": +/*!*****************************************!*\ + !*** ./src/chapitre-thematique/edit.js ***! + \*****************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ Edit) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./editor.scss */ "./src/chapitre-thematique/editor.scss"); +/* harmony import */ var _lien_chapitre__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lien-chapitre */ "./src/lien-chapitre/index.js"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/@wordpress/icons/build-module/library/trash.js"); + + + + + + + + +function Edit({ + attributes, + setAttributes, + ...props +}) { + let { + chapterTitle, + chapterDescription + } = attributes; + function onChangeChapterTitle(chapterTitle) { + setAttributes({ + chapterTitle + }); + } + function onChangeChapterDescription(chapterDescription) { + setAttributes({ + chapterDescription + }); + } + let { + chapterImageUrl, + chapterImageId, + chapterImageAlt + } = attributes; + function setImageAttributes(media) { + if (!media || !media.url) { + setAttributes({ + chapterImageUrl: null, + chapterImageId: null, + chapterImageAlt: null + }); + return; + } + setAttributes({ + chapterImageUrl: media.url, + chapterImageId: media.id, + chapterImageAlt: media?.alt + }); + } + function removeImageAttributes() { + setAttributes({ + chapterImageUrl: null, + chapterImageId: null, + chapterImageAlt: null + }); + } + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.BlockControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.ToolbarGroup, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.MediaReplaceFlow, { + mediaId: chapterImageId, + mediaUrl: chapterImageUrl, + allowedTypes: ["image"], + accept: "image/*", + onSelect: setImageAttributes, + name: !chapterImageUrl ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Ajouter une Image") : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Remplacer Image") + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.ToolbarButton, { + title: "Supprimer Image", + icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__["default"], + isActive: chapterImageUrl, + onClick: removeImageAttributes + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.useBlockProps)({ + className: `homegrade-blocks-chapitre-thematique` + }) + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "homegrade-blocks-chapitre-thematique__cover" + }, !chapterImageUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.MediaPlaceholder, { + accept: "image/*", + allowedTypes: ["image"], + onSelect: setImageAttributes, + multiple: false, + handleUpload: true + }), chapterImageUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { + src: chapterImageUrl, + alt: chapterImageAlt + })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "homegrade-blocks-chapitre-thematique__content" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.RichText, { + tagName: "h3", + className: "homegrade-blocks-chapitre-thematique__title", + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Titre du chapitre", "homegrade-blocks"), + value: chapterTitle, + onChange: onChangeChapterTitle + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.RichText, { + tagName: "p", + className: "homegrade-blocks-chapitre-thematique__description", + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Descriptif du chapitre", "homegrade-blocks"), + value: chapterDescription, + onChange: onChangeChapterDescription + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.InnerBlocks, { + allowedBlocks: ["homegrade-content-blocks/lien-chapitre"] + })))); +} + +/***/ }), + +/***/ "./src/chapitre-thematique/index.js": +/*!******************************************!*\ + !*** ./src/chapitre-thematique/index.js ***! + \******************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style.scss */ "./src/chapitre-thematique/style.scss"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./block.json */ "./src/chapitre-thematique/block.json"); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./edit */ "./src/chapitre-thematique/edit.js"); +/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./save */ "./src/chapitre-thematique/save.js"); + + + + + + + +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_3__.name, { + title: _block_json__WEBPACK_IMPORTED_MODULE_3__.title, + icon: { + foreground: "#DF1E1E", + src: (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + d: "M8,7h8a1,1,0,0,1,1,1v8a1,1,0,0,1-1,1H8a1,1,0,0,1-1-1V8A1,1,0,0,1,8,7Zm3-5V4h2V2Zm7,0H16V4h2ZM6,4H8V2H6ZM2,2V4L4,2ZM22,4V2H20ZM13,22V20H11v2Zm3,0h2V20H16ZM6,22H8V20H6Zm14-9h2V11H20Zm0,5h2V16H20ZM20,8h2V6H20ZM4,11H2v2H4Zm0,5H2v2H4ZM4,6H2V8H4ZM2,20v2H4Zm20,2V20l-2,2Z" + })) + }, + supports: _block_json__WEBPACK_IMPORTED_MODULE_3__.supports, + attributes: _block_json__WEBPACK_IMPORTED_MODULE_3__.attributes, + edit: _edit__WEBPACK_IMPORTED_MODULE_4__["default"], + save: _save__WEBPACK_IMPORTED_MODULE_5__["default"] +}); + +/***/ }), + +/***/ "./src/chapitre-thematique/save.js": +/*!*****************************************!*\ + !*** ./src/chapitre-thematique/save.js ***! + \*****************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ save) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); + + +function save({ + attributes +}) { + const { + chapterTitle, + chapterDescription, + chapterImageUrl, + chapterImageAlt + } = attributes; + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({ + className: `homegrade-blocks-chapitre-thematique` + }) + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "homegrade-blocks-chapitre-thematique__cover" + }, chapterImageUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { + src: chapterImageUrl, + alt: chapterImageAlt + })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "homegrade-blocks-chapitre-thematique__content" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, { + tagName: "h3", + value: chapterTitle + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, { + tagName: "p", + value: chapterDescription + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks.Content, null))); +} + +/***/ }), + +/***/ "./src/lien-chapitre/OptionsSelectControl.js": +/*!***************************************************!*\ + !*** ./src/lien-chapitre/OptionsSelectControl.js ***! + \***************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ OptionsSelectControl) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./editor.scss */ "./src/lien-chapitre/editor.scss"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities"); +/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__); + + + + + + + + +function OptionsSelectControl({ + setAttributes, + chapterLinkRelatedPostId +}) { + var _ref; + let [relatedQuestionPages, setRelatedQuestionPages] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + let [childTermsIdArray, setChildTermsIdArray] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const lang = getAdminLanguageFromCookie("wp-wpml_current_language"); + function getAdminLanguageFromCookie(c_name) { + var c_value = document.cookie, + c_start = c_value.indexOf(" " + c_name + "="); + if (c_start == -1) c_start = c_value.indexOf(c_name + "="); + if (c_start == -1) { + c_value = null; + } else { + c_start = c_value.indexOf("=", c_start) + 1; + var c_end = c_value.indexOf(";", c_start); + if (c_end == -1) { + c_end = c_value.length; + } + c_value = unescape(c_value.substring(c_start, c_end)); + } + return c_value; + } + function handleRelatedPostChange(postId) { + setAttributes({ + chapterLinkRelatedPostId: Number(postId) + }); + } + function buildTaxChildrenIdArray(childrenArray) { + return childrenArray.map(item => item.id); + } + function buildSelectOptions(relatedPossiblePages) { + let options = []; + if (relatedPossiblePages) { + options.push({ + value: 0, + label: "Sélectionnez une page" + }); + relatedPossiblePages.forEach(page => { + options.push({ + value: page.id, + label: (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__.decodeEntities)(page.title.rendered) + }); + }); + } else { + options.push({ + value: 0, + label: "Pas encore de questions..." + }); + } + return options; + } + + // GET TAXONOMIES INOFRMATION + let postTaxonomies = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core/editor").getCurrentPostAttribute("thematiques")); + + // GET THE CURRENT TAXONOMY AND FIND THE PARENT OBJECT + let postMainTaxonomy = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core").getEntityRecord("taxonomy", "thematiques", postTaxonomies[0]), [postTaxonomies]); + let postParentTaxonomy = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { + if (postMainTaxonomy && postMainTaxonomy.parent) { + return select("core").getEntityRecord("taxonomy", "thematiques", postMainTaxonomy.parent); + } + return null; + }, [postMainTaxonomy]); + let currentGeneralThematique = (_ref = postParentTaxonomy !== null && postParentTaxonomy !== void 0 ? postParentTaxonomy : postMainTaxonomy) !== null && _ref !== void 0 ? _ref : null; + + // GET THE PARENT TAX CHILDREN + let childTerms = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { + if (currentGeneralThematique) { + return select("core").getEntityRecords("taxonomy", "thematiques", { + parent: currentGeneralThematique.id + }); + } + return null; + }); + + // BUILD AN ARRAY OF CHILDREN TAXONOMIES ID AND PUT IT IN THE STATE + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (childTerms) { + setChildTermsIdArray(buildTaxChildrenIdArray(childTerms)); + } + }, [childTerms]); + + // GET OPTIONS FOR RELATED POSSIBLE PAGES ACCORDING TO CURRENT TAXONOMY CHILDREN ID ARRAY + const relatedPossiblePages = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { + if (childTermsIdArray) { + let query = { + status: "publish", + per_page: -1, + lang: lang, + thematiques: childTermsIdArray + }; + return select("core").getEntityRecords("postType", "conseils", query); + } + return null; + }); + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (relatedPossiblePages) { + setRelatedQuestionPages(buildSelectOptions(relatedPossiblePages)); + } + }, [relatedPossiblePages]); + let panelTitle = postParentTaxonomy ? "Conseils " + postParentTaxonomy.name : postMainTaxonomy ? "Conseils " + postMainTaxonomy.name : null; + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Conseils Relié", "homegrade-blocks__texte-fonctionnel") + }, relatedQuestionPages && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ComboboxControl, { + label: panelTitle, + onChange: e => handleRelatedPostChange(e), + options: relatedQuestionPages, + value: chapterLinkRelatedPostId + }))); +} + +/***/ }), + +/***/ "./src/lien-chapitre/edit.js": +/*!***********************************!*\ + !*** ./src/lien-chapitre/edit.js ***! + \***********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ Edit) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./editor.scss */ "./src/lien-chapitre/editor.scss"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _OptionsSelectControl__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./OptionsSelectControl */ "./src/lien-chapitre/OptionsSelectControl.js"); + + +// import { useBlockProps } from "@wordpress/block-editor"; + + + + + +function Edit({ + attributes, + setAttributes, + ...props +}) { + let { + chapterLinkTitle, + chapterLinkDescription, + chapterLinkRelatedPostId, + chapterLinkRelatedPostUrl + } = attributes; + let currentRelatedPostConseil = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useSelect)(select => select("core").getEntityRecord("postType", "conseils", chapterLinkRelatedPostId)); + if (currentRelatedPostConseil && currentRelatedPostConseil.link !== chapterLinkRelatedPostUrl) { + console.log(chapterLinkRelatedPostUrl); + console.log(currentRelatedPostConseil.link); + setAttributes({ + chapterLinkRelatedPostUrl: currentRelatedPostConseil.link + }); + } + function onChangeChapterLinkTitle(chapterLinkTitle) { + setAttributes({ + chapterLinkTitle + }); + } + function onChangeChapterLinkDescription(chapterLinkDescription) { + setAttributes({ + chapterLinkDescription + }); + } + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_OptionsSelectControl__WEBPACK_IMPORTED_MODULE_6__["default"], { + chapterLinkRelatedPostId: chapterLinkRelatedPostId, + setAttributes: setAttributes + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__.useBlockProps)({ + className: `homegrade-blocks-lien-chapitre` + }) + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__.RichText, { + tagName: "h4", + className: "homegrade-blocks-lien-chapitre__title", + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Titre du chapitre", "homegrade-blocks"), + value: chapterLinkTitle, + onChange: onChangeChapterLinkTitle + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__.RichText, { + tagName: "p", + className: "homegrade-blocks-lien-chapitre__description", + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Descriptif du chapitre", "homegrade-blocks"), + value: chapterLinkDescription, + onChange: onChangeChapterLinkDescription + }), chapterLinkRelatedPostUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: chapterLinkRelatedPostUrl + }, chapterLinkRelatedPostUrl))); +} + +/***/ }), + +/***/ "./src/lien-chapitre/index.js": +/*!************************************!*\ + !*** ./src/lien-chapitre/index.js ***! + \************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style.scss */ "./src/lien-chapitre/style.scss"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./block.json */ "./src/lien-chapitre/block.json"); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./edit */ "./src/lien-chapitre/edit.js"); +/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./save */ "./src/lien-chapitre/save.js"); + + + + + + + +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_3__.name, { + title: _block_json__WEBPACK_IMPORTED_MODULE_3__.title, + icon: { + foreground: "#DF1E1E", + src: (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + id: "Calque_1", + "data-name": "Calque 1", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + class: "cls-1", + d: "m20,20V4c0-1.1-.9-2-2-2H6c-1.1,0-2,.9-2,2v16c0,1.1.9,2,2,2h12c1.1,0,2-.9,2-2Zm-8.71-3.29c-.39-.39-.39-1.02,0-1.41l2.29-2.29h-5.59c-.55,0-1-.45-1-1s.45-1,1-1h5.59l-2.29-2.29c-.4-.38-.41-1.02-.02-1.41.38-.4,1.02-.41,1.41-.02,0,0,.02.02.02.02l4,4c.39.39.39,1.02,0,1.41l-4,4c-.39.39-1.02.4-1.41.02,0,0,0,0,0-.02Z" + })) + }, + supports: _block_json__WEBPACK_IMPORTED_MODULE_3__.supports, + attributes: _block_json__WEBPACK_IMPORTED_MODULE_3__.attributes, + edit: _edit__WEBPACK_IMPORTED_MODULE_4__["default"], + save: _save__WEBPACK_IMPORTED_MODULE_5__["default"] +}); + +/***/ }), + +/***/ "./src/lien-chapitre/save.js": +/*!***********************************!*\ + !*** ./src/lien-chapitre/save.js ***! + \***********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ save) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); + + +function save({ + attributes +}) { + let { + chapterLinkTitle, + chapterLinkDescription, + chapterLinkRelatedPostUrl + } = attributes; + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({ + className: `homegrade-blocks-lien-chapitre` + }) + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, { + tagName: "h4", + value: chapterLinkTitle, + className: "homegrade-blocks-lien-chapitre__title" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, { + tagName: "p", + value: chapterLinkDescription, + className: "homegrade-blocks-lien-chapitre__description" + }), chapterLinkRelatedPostUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: chapterLinkRelatedPostUrl + }, chapterLinkRelatedPostUrl)); +} + +/***/ }), + +/***/ "./src/chapitre-thematique/editor.scss": +/*!*********************************************!*\ + !*** ./src/chapitre-thematique/editor.scss ***! + \*********************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "./src/chapitre-thematique/style.scss": +/*!********************************************!*\ + !*** ./src/chapitre-thematique/style.scss ***! + \********************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "./src/lien-chapitre/editor.scss": +/*!***************************************!*\ + !*** ./src/lien-chapitre/editor.scss ***! + \***************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "./src/lien-chapitre/style.scss": +/*!**************************************!*\ + !*** ./src/lien-chapitre/style.scss ***! + \**************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "../../node_modules/@wordpress/icons/build-module/library/trash.js": +/*!*************************************************************************!*\ + !*** ../../node_modules/@wordpress/icons/build-module/library/trash.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/primitives */ "@wordpress/primitives"); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); + + +/** + * WordPress dependencies + */ + +const trash = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__.Path, { + d: "M20 5h-5.7c0-1.3-1-2.3-2.3-2.3S9.7 3.7 9.7 5H4v2h1.5v.3l1.7 11.1c.1 1 1 1.7 2 1.7h5.7c1 0 1.8-.7 2-1.7l1.7-11.1V7H20V5zm-3.2 2l-1.7 11.1c0 .1-.1.2-.3.2H9.1c-.1 0-.3-.1-.3-.2L7.2 7h9.6z" +})); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (trash); +//# sourceMappingURL=trash.js.map + +/***/ }), + +/***/ "@wordpress/block-editor": +/*!*************************************!*\ + !*** external ["wp","blockEditor"] ***! + \*************************************/ +/***/ ((module) => { + +module.exports = window["wp"]["blockEditor"]; + +/***/ }), + +/***/ "@wordpress/blocks": +/*!********************************!*\ + !*** external ["wp","blocks"] ***! + \********************************/ +/***/ ((module) => { + +module.exports = window["wp"]["blocks"]; + +/***/ }), + +/***/ "@wordpress/components": +/*!************************************!*\ + !*** external ["wp","components"] ***! + \************************************/ +/***/ ((module) => { + +module.exports = window["wp"]["components"]; + +/***/ }), + +/***/ "@wordpress/data": +/*!******************************!*\ + !*** external ["wp","data"] ***! + \******************************/ +/***/ ((module) => { + +module.exports = window["wp"]["data"]; + +/***/ }), + +/***/ "@wordpress/element": +/*!*********************************!*\ + !*** external ["wp","element"] ***! + \*********************************/ +/***/ ((module) => { + +module.exports = window["wp"]["element"]; + +/***/ }), + +/***/ "@wordpress/html-entities": +/*!**************************************!*\ + !*** external ["wp","htmlEntities"] ***! + \**************************************/ +/***/ ((module) => { + +module.exports = window["wp"]["htmlEntities"]; + +/***/ }), + +/***/ "@wordpress/i18n": +/*!******************************!*\ + !*** external ["wp","i18n"] ***! + \******************************/ +/***/ ((module) => { + +module.exports = window["wp"]["i18n"]; + +/***/ }), + +/***/ "@wordpress/primitives": +/*!************************************!*\ + !*** external ["wp","primitives"] ***! + \************************************/ +/***/ ((module) => { + +module.exports = window["wp"]["primitives"]; + +/***/ }), + +/***/ "./src/chapitre-thematique/block.json": +/*!********************************************!*\ + !*** ./src/chapitre-thematique/block.json ***! + \********************************************/ +/***/ ((module) => { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/chapitre-thematique","version":"0.1.0","title":"Chapitre Thématiques ","category":"homegrade-blocks","description":"Point de légende pour titrer ou décrire un point de légende spécifique sur un Schéma ","supports":{"html":false},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"chapterTitle":{"type":"string","default":""},"chapterDescription":{"type":"string","default":""},"chapterImageUrl":{"type":"string"},"chapterImageId":{"type":"number"},"chapterImageAlt":{"type":"string","source":"attribute","selector":"img","attribute":"alt","default":""}}}'); + +/***/ }), + +/***/ "./src/lien-chapitre/block.json": +/*!**************************************!*\ + !*** ./src/lien-chapitre/block.json ***! + \**************************************/ +/***/ ((module) => { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/lien-chapitre","version":"0.1.0","title":"Lien de chapitre","category":"homegrade-blocks","description":"Pour insérer des liens dans un chapitre thématique","supports":{"html":false},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"chapterLinkTitle":{"type":"string","default":""},"chapterLinkDescription":{"type":"string","default":""},"chapterLinkRelatedPostId":{"type":"number"},"chapterLinkRelatedPostUrl":{"type":"string"}}}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = __webpack_modules__; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/chunk loaded */ +/******/ (() => { +/******/ var deferred = []; +/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { +/******/ if(chunkIds) { +/******/ priority = priority || 0; +/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; +/******/ deferred[i] = [chunkIds, fn, priority]; +/******/ return; +/******/ } +/******/ var notFulfilled = Infinity; +/******/ for (var i = 0; i < deferred.length; i++) { +/******/ var chunkIds = deferred[i][0]; +/******/ var fn = deferred[i][1]; +/******/ var priority = deferred[i][2]; +/******/ var fulfilled = true; +/******/ for (var j = 0; j < chunkIds.length; j++) { +/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { +/******/ chunkIds.splice(j--, 1); +/******/ } else { +/******/ fulfilled = false; +/******/ if(priority < notFulfilled) notFulfilled = priority; +/******/ } +/******/ } +/******/ if(fulfilled) { +/******/ deferred.splice(i--, 1) +/******/ var r = fn(); +/******/ if (r !== undefined) result = r; +/******/ } +/******/ } +/******/ return result; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/jsonp chunk loading */ +/******/ (() => { +/******/ // no baseURI +/******/ +/******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded +/******/ var installedChunks = { +/******/ "chapitre-thematique/index": 0, +/******/ "./style-index": 0 +/******/ }; +/******/ +/******/ // no chunk on demand loading +/******/ +/******/ // no prefetching +/******/ +/******/ // no preloaded +/******/ +/******/ // no HMR +/******/ +/******/ // no HMR manifest +/******/ +/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); +/******/ +/******/ // install a JSONP callback for chunk loading +/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { +/******/ var chunkIds = data[0]; +/******/ var moreModules = data[1]; +/******/ var runtime = data[2]; +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { +/******/ installedChunks[chunkId][0](); +/******/ } +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ return __webpack_require__.O(result); +/******/ } +/******/ +/******/ var chunkLoadingGlobal = self["webpackChunkmultiblocks"] = self["webpackChunkmultiblocks"] || []; +/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); +/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module depends on other loaded chunks and execution need to be delayed +/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["./style-index"], () => (__webpack_require__("./src/chapitre-thematique/index.js"))) +/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); +/******/ +/******/ })() +; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/blocks/chapitrage-thematique/build/chapitre-thematique/index.js.map b/blocks/chapitrage-thematique/build/chapitre-thematique/index.js.map new file mode 100644 index 0000000..1589059 --- /dev/null +++ b/blocks/chapitrage-thematique/build/chapitre-thematique/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"chapitre-thematique/index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACd;AACG;AAOO;AACmC;AACS;AACpC;AAC1B,SAASU,IAAIA,CAAC;EAAEC,UAAU;EAAEC,aAAa;EAAE,GAAGC;AAAM,CAAC,EAAE;EACrE,IAAI;IAAEC,YAAY;IAAEC;EAAmB,CAAC,GAAGJ,UAAU;EAErD,SAASK,oBAAoBA,CAACF,YAAY,EAAE;IAC3CF,aAAa,CAAC;MAAEE;IAAa,CAAC,CAAC;EAChC;EACA,SAASG,0BAA0BA,CAACF,kBAAkB,EAAE;IACvDH,aAAa,CAAC;MAAEG;IAAmB,CAAC,CAAC;EACtC;EAEA,IAAI;IAAEG,eAAe;IAAEC,cAAc;IAAEC;EAAgB,CAAC,GAAGT,UAAU;EAErE,SAASU,kBAAkBA,CAACC,KAAK,EAAE;IAClC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AAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://multiblocks/./src/chapitre-thematique/edit.js","webpack://multiblocks/./src/chapitre-thematique/index.js","webpack://multiblocks/./src/chapitre-thematique/save.js","webpack://multiblocks/./src/lien-chapitre/OptionsSelectControl.js","webpack://multiblocks/./src/lien-chapitre/edit.js","webpack://multiblocks/./src/lien-chapitre/index.js","webpack://multiblocks/./src/lien-chapitre/save.js","webpack://multiblocks/./src/chapitre-thematique/editor.scss","webpack://multiblocks/./src/chapitre-thematique/style.scss","webpack://multiblocks/./src/lien-chapitre/editor.scss","webpack://multiblocks/./src/lien-chapitre/style.scss","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/trash.js","webpack://multiblocks/external window [\"wp\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"components\"]","webpack://multiblocks/external window [\"wp\",\"data\"]","webpack://multiblocks/external window [\"wp\",\"element\"]","webpack://multiblocks/external window [\"wp\",\"htmlEntities\"]","webpack://multiblocks/external window [\"wp\",\"i18n\"]","webpack://multiblocks/external window [\"wp\",\"primitives\"]","webpack://multiblocks/webpack/bootstrap","webpack://multiblocks/webpack/runtime/chunk loaded","webpack://multiblocks/webpack/runtime/compat get default export","webpack://multiblocks/webpack/runtime/define property getters","webpack://multiblocks/webpack/runtime/hasOwnProperty shorthand","webpack://multiblocks/webpack/runtime/make namespace object","webpack://multiblocks/webpack/runtime/jsonp chunk loading","webpack://multiblocks/webpack/before-startup","webpack://multiblocks/webpack/startup","webpack://multiblocks/webpack/after-startup"],"sourcesContent":["import { __ } from \"@wordpress/i18n\";\nimport \"./editor.scss\";\nimport \"../lien-chapitre\";\n\nimport {\n\tuseBlockProps,\n\tRichText,\n\tInnerBlocks,\n\tBlockControls,\n} from \"@wordpress/block-editor\";\nimport { ToolbarGroup, ToolbarButton } from \"@wordpress/components\";\nimport { MediaReplaceFlow, MediaPlaceholder } from \"@wordpress/block-editor\";\nimport { trash } from \"@wordpress/icons\";\nexport default function Edit({ attributes, setAttributes, ...props }) {\n\tlet { chapterTitle, chapterDescription } = attributes;\n\n\tfunction onChangeChapterTitle(chapterTitle) {\n\t\tsetAttributes({ chapterTitle });\n\t}\n\tfunction onChangeChapterDescription(chapterDescription) {\n\t\tsetAttributes({ chapterDescription });\n\t}\n\n\tlet { chapterImageUrl, chapterImageId, chapterImageAlt } = attributes;\n\n\tfunction setImageAttributes(media) {\n\t\tif (!media || !media.url) {\n\t\t\tsetAttributes({\n\t\t\t\tchapterImageUrl: null,\n\t\t\t\tchapterImageId: null,\n\t\t\t\tchapterImageAlt: null,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tsetAttributes({\n\t\t\tchapterImageUrl: media.url,\n\t\t\tchapterImageId: media.id,\n\t\t\tchapterImageAlt: media?.alt,\n\t\t});\n\t}\n\n\tfunction removeImageAttributes() {\n\t\tsetAttributes({\n\t\t\tchapterImageUrl: null,\n\t\t\tchapterImageId: null,\n\t\t\tchapterImageAlt: null,\n\t\t});\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t
\n\t\t\t\t\t{!chapterImageUrl && (\n\t\t\t\t\t\t\n\t\t\t\t\t)}\n\n\t\t\t\t\t{chapterImageUrl && (\n\t\t\t\t\t\t{chapterImageAlt}\n\t\t\t\t\t)}\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\n\t\t\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\nimport \"./style.scss\";\nimport metadata from \"./block.json\";\n\nimport Edit from \"./edit\";\nimport Save from \"./save\";\n\nimport { navigation } from \"@wordpress/icons\";\n\nregisterBlockType(metadata.name, {\n\ttitle: metadata.title,\n\ticon: {\n\t\tforeground: \"#DF1E1E\",\n\t\tsrc: (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t),\n\t},\n\n\tsupports: metadata.supports,\n\tattributes: metadata.attributes,\n\tedit: Edit,\n\tsave: Save,\n});\n","import { useBlockProps, RichText, InnerBlocks } from \"@wordpress/block-editor\";\n\nexport default function save({ attributes }) {\n\tconst { chapterTitle, chapterDescription, chapterImageUrl, chapterImageAlt } =\n\t\tattributes;\n\treturn (\n\t\t\n\t\t\t
\n\t\t\t\t{chapterImageUrl && {chapterImageAlt}}\n\t\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\n\t);\n}\n","import { __ } from \"@wordpress/i18n\";\r\nimport { InspectorControls } from \"@wordpress/block-editor\";\r\nimport {\r\n\tPanelBody,\r\n\tSelectControl,\r\n\tComboboxControl,\r\n} from \"@wordpress/components\";\r\nimport \"./editor.scss\";\r\nimport { useSelect } from \"@wordpress/data\";\r\nimport { useEffect, useState } from \"@wordpress/element\";\r\nimport { decodeEntities } from \"@wordpress/html-entities\";\r\n\r\nexport default function OptionsSelectControl({\r\n\tsetAttributes,\r\n\tchapterLinkRelatedPostId,\r\n}) {\r\n\tlet [relatedQuestionPages, setRelatedQuestionPages] = useState(null);\r\n\tlet [childTermsIdArray, setChildTermsIdArray] = useState(null);\r\n\r\n\tconst lang = getAdminLanguageFromCookie(\"wp-wpml_current_language\");\r\n\r\n\tfunction getAdminLanguageFromCookie(c_name) {\r\n\t\tvar c_value = document.cookie,\r\n\t\t\tc_start = c_value.indexOf(\" \" + c_name + \"=\");\r\n\t\tif (c_start == -1) c_start = c_value.indexOf(c_name + \"=\");\r\n\t\tif (c_start == -1) {\r\n\t\t\tc_value = null;\r\n\t\t} else {\r\n\t\t\tc_start = c_value.indexOf(\"=\", c_start) + 1;\r\n\t\t\tvar c_end = c_value.indexOf(\";\", c_start);\r\n\t\t\tif (c_end == -1) {\r\n\t\t\t\tc_end = c_value.length;\r\n\t\t\t}\r\n\t\t\tc_value = unescape(c_value.substring(c_start, c_end));\r\n\t\t}\r\n\t\treturn c_value;\r\n\t}\r\n\r\n\tfunction handleRelatedPostChange(postId) {\r\n\t\tsetAttributes({ chapterLinkRelatedPostId: Number(postId) });\r\n\t}\r\n\r\n\tfunction buildTaxChildrenIdArray(childrenArray) {\r\n\t\treturn childrenArray.map((item) => item.id);\r\n\t}\r\n\r\n\tfunction buildSelectOptions(relatedPossiblePages) {\r\n\t\tlet options = [];\r\n\t\tif (relatedPossiblePages) {\r\n\t\t\toptions.push({ value: 0, label: \"Sélectionnez une page\" });\r\n\t\t\trelatedPossiblePages.forEach((page) => {\r\n\t\t\t\toptions.push({\r\n\t\t\t\t\tvalue: page.id,\r\n\t\t\t\t\tlabel: decodeEntities(page.title.rendered),\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\toptions.push({ value: 0, label: \"Pas encore de questions...\" });\r\n\t\t}\r\n\t\treturn options;\r\n\t}\r\n\r\n\t// GET TAXONOMIES INOFRMATION\r\n\tlet postTaxonomies = useSelect((select) =>\r\n\t\tselect(\"core/editor\").getCurrentPostAttribute(\"thematiques\")\r\n\t);\r\n\r\n\t// GET THE CURRENT TAXONOMY AND FIND THE PARENT OBJECT\r\n\tlet postMainTaxonomy = useSelect(\r\n\t\t(select) =>\r\n\t\t\tselect(\"core\").getEntityRecord(\r\n\t\t\t\t\"taxonomy\",\r\n\t\t\t\t\"thematiques\",\r\n\t\t\t\tpostTaxonomies[0]\r\n\t\t\t),\r\n\t\t[postTaxonomies]\r\n\t);\r\n\tlet postParentTaxonomy = useSelect(\r\n\t\t(select) => {\r\n\t\t\tif (postMainTaxonomy && postMainTaxonomy.parent) {\r\n\t\t\t\treturn select(\"core\").getEntityRecord(\r\n\t\t\t\t\t\"taxonomy\",\r\n\t\t\t\t\t\"thematiques\",\r\n\t\t\t\t\tpostMainTaxonomy.parent\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t},\r\n\t\t[postMainTaxonomy]\r\n\t);\r\n\tlet currentGeneralThematique = postParentTaxonomy ?? postMainTaxonomy ?? null;\r\n\r\n\t// GET THE PARENT TAX CHILDREN\r\n\tlet childTerms = useSelect((select) => {\r\n\t\tif (currentGeneralThematique) {\r\n\t\t\treturn select(\"core\").getEntityRecords(\"taxonomy\", \"thematiques\", {\r\n\t\t\t\tparent: currentGeneralThematique.id,\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn null;\r\n\t});\r\n\r\n\t// BUILD AN ARRAY OF CHILDREN TAXONOMIES ID AND PUT IT IN THE STATE\r\n\tuseEffect(() => {\r\n\t\tif (childTerms) {\r\n\t\t\tsetChildTermsIdArray(buildTaxChildrenIdArray(childTerms));\r\n\t\t}\r\n\t}, [childTerms]);\r\n\r\n\t// GET OPTIONS FOR RELATED POSSIBLE PAGES ACCORDING TO CURRENT TAXONOMY CHILDREN ID ARRAY\r\n\tconst relatedPossiblePages = useSelect((select) => {\r\n\t\tif (childTermsIdArray) {\r\n\t\t\tlet query = {\r\n\t\t\t\tstatus: \"publish\",\r\n\t\t\t\tper_page: -1,\r\n\t\t\t\tlang: lang,\r\n\t\t\t\tthematiques: childTermsIdArray,\r\n\t\t\t};\r\n\t\t\treturn select(\"core\").getEntityRecords(\"postType\", \"conseils\", query);\r\n\t\t}\r\n\t\treturn null;\r\n\t});\r\n\r\n\tuseEffect(() => {\r\n\t\tif (relatedPossiblePages) {\r\n\t\t\tsetRelatedQuestionPages(buildSelectOptions(relatedPossiblePages));\r\n\t\t}\r\n\t}, [relatedPossiblePages]);\r\n\r\n\tlet panelTitle = postParentTaxonomy\r\n\t\t? \"Conseils \" + postParentTaxonomy.name\r\n\t\t: postMainTaxonomy\r\n\t\t? \"Conseils \" + postMainTaxonomy.name\r\n\t\t: null;\r\n\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t{/* handleRelatedPostChange(e)}\r\n\t\t\t\t/> */}\r\n\t\t\t\t{relatedQuestionPages && (\r\n\t\t\t\t\t handleRelatedPostChange(e)}\r\n\t\t\t\t\t\toptions={relatedQuestionPages}\r\n\t\t\t\t\t\tvalue={chapterLinkRelatedPostId}\r\n\t\t\t\t\t/>\r\n\t\t\t\t)}\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n","import { __ } from \"@wordpress/i18n\";\n// import { useBlockProps } from \"@wordpress/block-editor\";\nimport \"./editor.scss\";\nimport {\n\tPanelBody,\n\tFocalPointPicker,\n\tTextControl,\n\tTextareaControl,\n} from \"@wordpress/components\";\nimport { useSelect } from \"@wordpress/data\";\n\nimport {\n\tuseBlockProps,\n\tRichText,\n\tInspectorControls,\n\tInnerBlocks,\n} from \"@wordpress/block-editor\";\n\nimport OptionsSelectControl from \"./OptionsSelectControl\";\n\nexport default function Edit({ attributes, setAttributes, ...props }) {\n\tlet {\n\t\tchapterLinkTitle,\n\t\tchapterLinkDescription,\n\t\tchapterLinkRelatedPostId,\n\t\tchapterLinkRelatedPostUrl,\n\t} = attributes;\n\n\tlet currentRelatedPostConseil = useSelect((select) =>\n\t\tselect(\"core\").getEntityRecord(\n\t\t\t\"postType\",\n\t\t\t\"conseils\",\n\t\t\tchapterLinkRelatedPostId\n\t\t)\n\t);\n\n\tif (\n\t\tcurrentRelatedPostConseil &&\n\t\tcurrentRelatedPostConseil.link !== chapterLinkRelatedPostUrl\n\t) {\n\t\tconsole.log(chapterLinkRelatedPostUrl);\n\t\tconsole.log(currentRelatedPostConseil.link);\n\t\tsetAttributes({\n\t\t\tchapterLinkRelatedPostUrl: currentRelatedPostConseil.link,\n\t\t});\n\t}\n\n\tfunction onChangeChapterLinkTitle(chapterLinkTitle) {\n\t\tsetAttributes({ chapterLinkTitle });\n\t}\n\tfunction onChangeChapterLinkDescription(chapterLinkDescription) {\n\t\tsetAttributes({ chapterLinkDescription });\n\t}\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t{chapterLinkRelatedPostUrl && (\n\t\t\t\t\t{chapterLinkRelatedPostUrl}\n\t\t\t\t)}\n\t\t\t\n\t\t\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\nimport \"./style.scss\";\nimport metadata from \"./block.json\";\n\nimport Edit from \"./edit\";\nimport Save from \"./save\";\n\nimport { navigation } from \"@wordpress/icons\";\n\nregisterBlockType(metadata.name, {\n\ttitle: metadata.title,\n\ticon: {\n\t\tforeground: \"#DF1E1E\",\n\t\tsrc: (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t),\n\t},\n\n\tsupports: metadata.supports,\n\tattributes: metadata.attributes,\n\tedit: Edit,\n\tsave: Save,\n});\n","import { useBlockProps, RichText, InnerBlocks } from \"@wordpress/block-editor\";\n\nexport default function save({ attributes }) {\n\tlet { chapterLinkTitle, chapterLinkDescription, chapterLinkRelatedPostUrl } =\n\t\tattributes;\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t{chapterLinkRelatedPostUrl && (\n\t\t\t\t{chapterLinkRelatedPostUrl}\n\t\t\t)}\n\t\t\n\t);\n}\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst trash = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M20 5h-5.7c0-1.3-1-2.3-2.3-2.3S9.7 3.7 9.7 5H4v2h1.5v.3l1.7 11.1c.1 1 1 1.7 2 1.7h5.7c1 0 1.8-.7 2-1.7l1.7-11.1V7H20V5zm-3.2 2l-1.7 11.1c0 .1-.1.2-.3.2H9.1c-.1 0-.3-.1-.3-.2L7.2 7h9.6z\"\n}));\nexport default trash;\n//# sourceMappingURL=trash.js.map","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"htmlEntities\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"primitives\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"chapitre-thematique/index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkmultiblocks\"] = self[\"webpackChunkmultiblocks\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], () => (__webpack_require__(\"./src/chapitre-thematique/index.js\")))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useBlockProps","RichText","InnerBlocks","BlockControls","ToolbarGroup","ToolbarButton","MediaReplaceFlow","MediaPlaceholder","trash","Edit","attributes","setAttributes","props","chapterTitle","chapterDescription","onChangeChapterTitle","onChangeChapterDescription","chapterImageUrl","chapterImageId","chapterImageAlt","setImageAttributes","media","url","id","alt","removeImageAttributes","createElement","Fragment","mediaId","mediaUrl","allowedTypes","accept","onSelect","name","title","icon","isActive","onClick","className","multiple","handleUpload","src","tagName","placeholder","value","onChange","allowedBlocks","registerBlockType","metadata","Save","navigation","foreground","xmlns","viewBox","d","supports","edit","save","Content","InspectorControls","PanelBody","SelectControl","ComboboxControl","useSelect","useEffect","useState","decodeEntities","OptionsSelectControl","chapterLinkRelatedPostId","_ref","relatedQuestionPages","setRelatedQuestionPages","childTermsIdArray","setChildTermsIdArray","lang","getAdminLanguageFromCookie","c_name","c_value","document","cookie","c_start","indexOf","c_end","length","unescape","substring","handleRelatedPostChange","postId","Number","buildTaxChildrenIdArray","childrenArray","map","item","buildSelectOptions","relatedPossiblePages","options","push","label","forEach","page","rendered","postTaxonomies","select","getCurrentPostAttribute","postMainTaxonomy","getEntityRecord","postParentTaxonomy","parent","currentGeneralThematique","childTerms","getEntityRecords","query","status","per_page","thematiques","panelTitle","e","FocalPointPicker","TextControl","TextareaControl","chapterLinkTitle","chapterLinkDescription","chapterLinkRelatedPostUrl","currentRelatedPostConseil","link","console","log","onChangeChapterLinkTitle","onChangeChapterLinkDescription","href","class"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/chapitrage-thematique/build/index.asset.php b/blocks/chapitrage-thematique/build/index.asset.php index 7ec98d7..7c3d607 100644 --- a/blocks/chapitrage-thematique/build/index.asset.php +++ b/blocks/chapitrage-thematique/build/index.asset.php @@ -1 +1 @@ - array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n'), 'version' => 'e3dde56298e97bb747dc'); + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-primitives'), 'version' => '85f453c22d884235f769'); diff --git a/blocks/chapitrage-thematique/build/index.css b/blocks/chapitrage-thematique/build/index.css new file mode 100644 index 0000000..63820bd --- /dev/null +++ b/blocks/chapitrage-thematique/build/index.css @@ -0,0 +1,12 @@ +/*!****************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***! + \****************************************************************************************************************************************************************************************************************************************/ + +/*!************************************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/chapitre-thematique/editor.scss ***! + \************************************************************************************************************************************************************************************************************************************************************/ + +/*!******************************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/lien-chapitre/editor.scss ***! + \******************************************************************************************************************************************************************************************************************************************************/ + diff --git a/blocks/chapitrage-thematique/build/index.js b/blocks/chapitrage-thematique/build/index.js index 98a3eda..0faf1d9 100644 --- a/blocks/chapitrage-thematique/build/index.js +++ b/blocks/chapitrage-thematique/build/index.js @@ -1,13 +1,224 @@ /******/ (() => { // webpackBootstrap +/******/ "use strict"; /******/ var __webpack_modules__ = ({ +/***/ "./src/chapitre-thematique/edit.js": +/*!*****************************************!*\ + !*** ./src/chapitre-thematique/edit.js ***! + \*****************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ Edit) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./editor.scss */ "./src/chapitre-thematique/editor.scss"); +/* harmony import */ var _lien_chapitre__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lien-chapitre */ "./src/lien-chapitre/index.js"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/@wordpress/icons/build-module/library/trash.js"); + + + + + + + + +function Edit({ + attributes, + setAttributes, + ...props +}) { + let { + chapterTitle, + chapterDescription + } = attributes; + function onChangeChapterTitle(chapterTitle) { + setAttributes({ + chapterTitle + }); + } + function onChangeChapterDescription(chapterDescription) { + setAttributes({ + chapterDescription + }); + } + let { + chapterImageUrl, + chapterImageId, + chapterImageAlt + } = attributes; + function setImageAttributes(media) { + if (!media || !media.url) { + setAttributes({ + chapterImageUrl: null, + chapterImageId: null, + chapterImageAlt: null + }); + return; + } + setAttributes({ + chapterImageUrl: media.url, + chapterImageId: media.id, + chapterImageAlt: media?.alt + }); + } + function removeImageAttributes() { + setAttributes({ + chapterImageUrl: null, + chapterImageId: null, + chapterImageAlt: null + }); + } + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.BlockControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.ToolbarGroup, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.MediaReplaceFlow, { + mediaId: chapterImageId, + mediaUrl: chapterImageUrl, + allowedTypes: ["image"], + accept: "image/*", + onSelect: setImageAttributes, + name: !chapterImageUrl ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Ajouter une Image") : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Remplacer Image") + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.ToolbarButton, { + title: "Supprimer Image", + icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__["default"], + isActive: chapterImageUrl, + onClick: removeImageAttributes + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.useBlockProps)({ + className: `homegrade-blocks-chapitre-thematique` + }) + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "homegrade-blocks-chapitre-thematique__cover" + }, !chapterImageUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.MediaPlaceholder, { + accept: "image/*", + allowedTypes: ["image"], + onSelect: setImageAttributes, + multiple: false, + handleUpload: true + }), chapterImageUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { + src: chapterImageUrl, + alt: chapterImageAlt + })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "homegrade-blocks-chapitre-thematique__content" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.RichText, { + tagName: "h3", + className: "homegrade-blocks-chapitre-thematique__title", + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Titre du chapitre", "homegrade-blocks"), + value: chapterTitle, + onChange: onChangeChapterTitle + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.RichText, { + tagName: "p", + className: "homegrade-blocks-chapitre-thematique__description", + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Descriptif du chapitre", "homegrade-blocks"), + value: chapterDescription, + onChange: onChangeChapterDescription + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.InnerBlocks, { + allowedBlocks: ["homegrade-content-blocks/lien-chapitre"] + })))); +} + +/***/ }), + +/***/ "./src/chapitre-thematique/index.js": +/*!******************************************!*\ + !*** ./src/chapitre-thematique/index.js ***! + \******************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style.scss */ "./src/chapitre-thematique/style.scss"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./block.json */ "./src/chapitre-thematique/block.json"); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./edit */ "./src/chapitre-thematique/edit.js"); +/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./save */ "./src/chapitre-thematique/save.js"); + + + + + + + +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_3__.name, { + title: _block_json__WEBPACK_IMPORTED_MODULE_3__.title, + icon: { + foreground: "#DF1E1E", + src: (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + d: "M8,7h8a1,1,0,0,1,1,1v8a1,1,0,0,1-1,1H8a1,1,0,0,1-1-1V8A1,1,0,0,1,8,7Zm3-5V4h2V2Zm7,0H16V4h2ZM6,4H8V2H6ZM2,2V4L4,2ZM22,4V2H20ZM13,22V20H11v2Zm3,0h2V20H16ZM6,22H8V20H6Zm14-9h2V11H20Zm0,5h2V16H20ZM20,8h2V6H20ZM4,11H2v2H4Zm0,5H2v2H4ZM4,6H2V8H4ZM2,20v2H4Zm20,2V20l-2,2Z" + })) + }, + supports: _block_json__WEBPACK_IMPORTED_MODULE_3__.supports, + attributes: _block_json__WEBPACK_IMPORTED_MODULE_3__.attributes, + edit: _edit__WEBPACK_IMPORTED_MODULE_4__["default"], + save: _save__WEBPACK_IMPORTED_MODULE_5__["default"] +}); + +/***/ }), + +/***/ "./src/chapitre-thematique/save.js": +/*!*****************************************!*\ + !*** ./src/chapitre-thematique/save.js ***! + \*****************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ save) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); + + +function save({ + attributes +}) { + const { + chapterTitle, + chapterDescription, + chapterImageUrl, + chapterImageAlt + } = attributes; + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({ + className: `homegrade-blocks-chapitre-thematique` + }) + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "homegrade-blocks-chapitre-thematique__cover" + }, chapterImageUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { + src: chapterImageUrl, + alt: chapterImageAlt + })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "homegrade-blocks-chapitre-thematique__content" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, { + tagName: "h3", + value: chapterTitle + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, { + tagName: "p", + value: chapterDescription + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks.Content, null))); +} + +/***/ }), + /***/ "./src/edit.js": /*!*********************!*\ !*** ./src/edit.js ***! \*********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -"use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ Edit) @@ -17,26 +228,32 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _chapitre_thematique__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./chapitre-thematique */ "./src/chapitre-thematique/index.js"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__); -function Edit() { - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", { - ...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)({ + + + + +function Edit({ + attributes, + setAttributes, + clientId, + ...props +}) { + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", { + ...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.useBlockProps)({ className: `homegrade-blocks-chapitrage-thematique` }) - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, { - onChange: value => setAttributes({ - textContent: value - }), - value: textContent, - tagName: "p", - className: "aside-content", - placeholder: "Ajoutez votre texte ici" - }), (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Multiblocks – salut from the editor!", "multiblocks")); + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.InnerBlocks, { + allowedBlocks: ["homegrade-content-blocks/chapitre-thematique"] + }))); } /***/ }), @@ -47,7 +264,6 @@ function Edit() { \**********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -"use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); @@ -123,13 +339,373 @@ __webpack_require__.r(__webpack_exports__); /***/ }), +/***/ "./src/lien-chapitre/OptionsSelectControl.js": +/*!***************************************************!*\ + !*** ./src/lien-chapitre/OptionsSelectControl.js ***! + \***************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ OptionsSelectControl) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./editor.scss */ "./src/lien-chapitre/editor.scss"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities"); +/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__); + + + + + + + + +function OptionsSelectControl({ + setAttributes, + chapterLinkRelatedPostId +}) { + var _ref; + let [relatedQuestionPages, setRelatedQuestionPages] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + let [childTermsIdArray, setChildTermsIdArray] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const lang = getAdminLanguageFromCookie("wp-wpml_current_language"); + function getAdminLanguageFromCookie(c_name) { + var c_value = document.cookie, + c_start = c_value.indexOf(" " + c_name + "="); + if (c_start == -1) c_start = c_value.indexOf(c_name + "="); + if (c_start == -1) { + c_value = null; + } else { + c_start = c_value.indexOf("=", c_start) + 1; + var c_end = c_value.indexOf(";", c_start); + if (c_end == -1) { + c_end = c_value.length; + } + c_value = unescape(c_value.substring(c_start, c_end)); + } + return c_value; + } + function handleRelatedPostChange(postId) { + setAttributes({ + chapterLinkRelatedPostId: Number(postId) + }); + } + function buildTaxChildrenIdArray(childrenArray) { + return childrenArray.map(item => item.id); + } + function buildSelectOptions(relatedPossiblePages) { + let options = []; + if (relatedPossiblePages) { + options.push({ + value: 0, + label: "Sélectionnez une page" + }); + relatedPossiblePages.forEach(page => { + options.push({ + value: page.id, + label: (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__.decodeEntities)(page.title.rendered) + }); + }); + } else { + options.push({ + value: 0, + label: "Pas encore de questions..." + }); + } + return options; + } + + // GET TAXONOMIES INOFRMATION + let postTaxonomies = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core/editor").getCurrentPostAttribute("thematiques")); + + // GET THE CURRENT TAXONOMY AND FIND THE PARENT OBJECT + let postMainTaxonomy = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core").getEntityRecord("taxonomy", "thematiques", postTaxonomies[0]), [postTaxonomies]); + let postParentTaxonomy = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { + if (postMainTaxonomy && postMainTaxonomy.parent) { + return select("core").getEntityRecord("taxonomy", "thematiques", postMainTaxonomy.parent); + } + return null; + }, [postMainTaxonomy]); + let currentGeneralThematique = (_ref = postParentTaxonomy !== null && postParentTaxonomy !== void 0 ? postParentTaxonomy : postMainTaxonomy) !== null && _ref !== void 0 ? _ref : null; + + // GET THE PARENT TAX CHILDREN + let childTerms = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { + if (currentGeneralThematique) { + return select("core").getEntityRecords("taxonomy", "thematiques", { + parent: currentGeneralThematique.id + }); + } + return null; + }); + + // BUILD AN ARRAY OF CHILDREN TAXONOMIES ID AND PUT IT IN THE STATE + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (childTerms) { + setChildTermsIdArray(buildTaxChildrenIdArray(childTerms)); + } + }, [childTerms]); + + // GET OPTIONS FOR RELATED POSSIBLE PAGES ACCORDING TO CURRENT TAXONOMY CHILDREN ID ARRAY + const relatedPossiblePages = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { + if (childTermsIdArray) { + let query = { + status: "publish", + per_page: -1, + lang: lang, + thematiques: childTermsIdArray + }; + return select("core").getEntityRecords("postType", "conseils", query); + } + return null; + }); + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (relatedPossiblePages) { + setRelatedQuestionPages(buildSelectOptions(relatedPossiblePages)); + } + }, [relatedPossiblePages]); + let panelTitle = postParentTaxonomy ? "Conseils " + postParentTaxonomy.name : postMainTaxonomy ? "Conseils " + postMainTaxonomy.name : null; + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Conseils Relié", "homegrade-blocks__texte-fonctionnel") + }, relatedQuestionPages && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ComboboxControl, { + label: panelTitle, + onChange: e => handleRelatedPostChange(e), + options: relatedQuestionPages, + value: chapterLinkRelatedPostId + }))); +} + +/***/ }), + +/***/ "./src/lien-chapitre/edit.js": +/*!***********************************!*\ + !*** ./src/lien-chapitre/edit.js ***! + \***********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ Edit) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./editor.scss */ "./src/lien-chapitre/editor.scss"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _OptionsSelectControl__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./OptionsSelectControl */ "./src/lien-chapitre/OptionsSelectControl.js"); + + +// import { useBlockProps } from "@wordpress/block-editor"; + + + + + +function Edit({ + attributes, + setAttributes, + ...props +}) { + let { + chapterLinkTitle, + chapterLinkDescription, + chapterLinkRelatedPostId, + chapterLinkRelatedPostUrl + } = attributes; + let currentRelatedPostConseil = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useSelect)(select => select("core").getEntityRecord("postType", "conseils", chapterLinkRelatedPostId)); + if (currentRelatedPostConseil && currentRelatedPostConseil.link !== chapterLinkRelatedPostUrl) { + console.log(chapterLinkRelatedPostUrl); + console.log(currentRelatedPostConseil.link); + setAttributes({ + chapterLinkRelatedPostUrl: currentRelatedPostConseil.link + }); + } + function onChangeChapterLinkTitle(chapterLinkTitle) { + setAttributes({ + chapterLinkTitle + }); + } + function onChangeChapterLinkDescription(chapterLinkDescription) { + setAttributes({ + chapterLinkDescription + }); + } + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_OptionsSelectControl__WEBPACK_IMPORTED_MODULE_6__["default"], { + chapterLinkRelatedPostId: chapterLinkRelatedPostId, + setAttributes: setAttributes + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__.useBlockProps)({ + className: `homegrade-blocks-lien-chapitre` + }) + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__.RichText, { + tagName: "h4", + className: "homegrade-blocks-lien-chapitre__title", + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Titre du chapitre", "homegrade-blocks"), + value: chapterLinkTitle, + onChange: onChangeChapterLinkTitle + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__.RichText, { + tagName: "p", + className: "homegrade-blocks-lien-chapitre__description", + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Descriptif du chapitre", "homegrade-blocks"), + value: chapterLinkDescription, + onChange: onChangeChapterLinkDescription + }), chapterLinkRelatedPostUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: chapterLinkRelatedPostUrl + }, chapterLinkRelatedPostUrl))); +} + +/***/ }), + +/***/ "./src/lien-chapitre/index.js": +/*!************************************!*\ + !*** ./src/lien-chapitre/index.js ***! + \************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style.scss */ "./src/lien-chapitre/style.scss"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./block.json */ "./src/lien-chapitre/block.json"); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./edit */ "./src/lien-chapitre/edit.js"); +/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./save */ "./src/lien-chapitre/save.js"); + + + + + + + +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_3__.name, { + title: _block_json__WEBPACK_IMPORTED_MODULE_3__.title, + icon: { + foreground: "#DF1E1E", + src: (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + id: "Calque_1", + "data-name": "Calque 1", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + class: "cls-1", + d: "m20,20V4c0-1.1-.9-2-2-2H6c-1.1,0-2,.9-2,2v16c0,1.1.9,2,2,2h12c1.1,0,2-.9,2-2Zm-8.71-3.29c-.39-.39-.39-1.02,0-1.41l2.29-2.29h-5.59c-.55,0-1-.45-1-1s.45-1,1-1h5.59l-2.29-2.29c-.4-.38-.41-1.02-.02-1.41.38-.4,1.02-.41,1.41-.02,0,0,.02.02.02.02l4,4c.39.39.39,1.02,0,1.41l-4,4c-.39.39-1.02.4-1.41.02,0,0,0,0,0-.02Z" + })) + }, + supports: _block_json__WEBPACK_IMPORTED_MODULE_3__.supports, + attributes: _block_json__WEBPACK_IMPORTED_MODULE_3__.attributes, + edit: _edit__WEBPACK_IMPORTED_MODULE_4__["default"], + save: _save__WEBPACK_IMPORTED_MODULE_5__["default"] +}); + +/***/ }), + +/***/ "./src/lien-chapitre/save.js": +/*!***********************************!*\ + !*** ./src/lien-chapitre/save.js ***! + \***********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ save) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); + + +function save({ + attributes +}) { + let { + chapterLinkTitle, + chapterLinkDescription, + chapterLinkRelatedPostUrl + } = attributes; + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({ + className: `homegrade-blocks-lien-chapitre` + }) + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, { + tagName: "h4", + value: chapterLinkTitle, + className: "homegrade-blocks-lien-chapitre__title" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, { + tagName: "p", + value: chapterLinkDescription, + className: "homegrade-blocks-lien-chapitre__description" + }), chapterLinkRelatedPostUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: chapterLinkRelatedPostUrl + }, chapterLinkRelatedPostUrl)); +} + +/***/ }), + /***/ "./src/save.js": /*!*********************!*\ !*** ./src/save.js ***! \*********************/ -/***/ (() => { +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ save) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); + + +function save({ + attributes +}) { + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", { + ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({ + className: `homegrade-blocks-chapitrage-thematique` + }) + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks.Content, null)); +} + +/***/ }), + +/***/ "./src/chapitre-thematique/editor.scss": +/*!*********************************************!*\ + !*** ./src/chapitre-thematique/editor.scss ***! + \*********************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "./src/chapitre-thematique/style.scss": +/*!********************************************!*\ + !*** ./src/chapitre-thematique/style.scss ***! + \********************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin -throw new Error("Module build failed (from ./node_modules/babel-loader/lib/index.js):\nSyntaxError: /Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/src/save.js: Identifier 'useBlockProps' has already been declared. (3:1)\n\n\u001b[0m \u001b[90m 1 |\u001b[39m \u001b[36mimport\u001b[39m { useBlockProps } \u001b[36mfrom\u001b[39m \u001b[32m\"@wordpress/block-editor\"\u001b[39m\u001b[33m;\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 2 |\u001b[39m \u001b[36mimport\u001b[39m {\u001b[0m\n\u001b[0m\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 3 |\u001b[39m \tuseBlockProps\u001b[33m,\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m |\u001b[39m \t\u001b[31m\u001b[1m^\u001b[22m\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 4 |\u001b[39m \t\u001b[33mRichText\u001b[39m\u001b[33m,\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 5 |\u001b[39m \t\u001b[33mBlockControls\u001b[39m\u001b[33m,\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 6 |\u001b[39m } \u001b[36mfrom\u001b[39m \u001b[32m\"@wordpress/block-editor\"\u001b[39m\u001b[33m;\u001b[39m\u001b[0m\n at instantiate (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:63:32)\n at constructor (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:358:12)\n at JSXParserMixin.raise (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:3255:19)\n at ScopeHandler.checkRedeclarationInScope (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:1528:19)\n at ScopeHandler.declareName (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:1499:12)\n at JSXParserMixin.declareNameFromIdentifier (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:7511:16)\n at JSXParserMixin.checkIdentifier (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:7507:12)\n at JSXParserMixin.checkLVal (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:7446:12)\n at JSXParserMixin.finishImportSpecifier (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:14144:10)\n at JSXParserMixin.parseImportSpecifier (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:14321:17)\n at JSXParserMixin.parseNamedImportSpecifiers (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:14299:36)\n at JSXParserMixin.parseImportSpecifiersAndAfter (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:14121:37)\n at JSXParserMixin.parseImport (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:14114:17)\n at JSXParserMixin.parseStatementContent (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:12706:27)\n at JSXParserMixin.parseStatementLike (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:12584:17)\n at JSXParserMixin.parseModuleItem (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:12561:17)\n at JSXParserMixin.parseBlockOrModuleBlockBody (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:13185:36)\n at JSXParserMixin.parseBlockBody (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:13178:10)\n at JSXParserMixin.parseProgram (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:12460:10)\n at JSXParserMixin.parseTopLevel (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:12450:25)\n at JSXParserMixin.parse (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:14345:10)\n at parse (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/parser/lib/index.js:14386:38)\n at parser (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/core/lib/parser/index.js:41:34)\n at parser.next ()\n at normalizeFile (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/core/lib/transformation/normalize-file.js:64:38)\n at normalizeFile.next ()\n at run (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/core/lib/transformation/index.js:21:50)\n at run.next ()\n at transform (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/@babel/core/lib/transform.js:22:41)\n at transform.next ()\n at step (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/gensync/index.js:261:32)\n at /Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/gensync/index.js:273:13\n at async.call.result.err.err (/Users/martoni_sato/Local Sites/homegrade/app/public/wp-content/plugins/homegrade-blocks/blocks/chapitrage-thematique/node_modules/gensync/index.js:223:11)"); /***/ }), @@ -139,7 +715,30 @@ throw new Error("Module build failed (from ./node_modules/babel-loader/lib/index \*************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -"use strict"; +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "./src/lien-chapitre/editor.scss": +/*!***************************************!*\ + !*** ./src/lien-chapitre/editor.scss ***! + \***************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "./src/lien-chapitre/style.scss": +/*!**************************************!*\ + !*** ./src/lien-chapitre/style.scss ***! + \**************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + __webpack_require__.r(__webpack_exports__); // extracted by mini-css-extract-plugin @@ -152,11 +751,41 @@ __webpack_require__.r(__webpack_exports__); \************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -"use strict"; __webpack_require__.r(__webpack_exports__); // extracted by mini-css-extract-plugin +/***/ }), + +/***/ "../../node_modules/@wordpress/icons/build-module/library/trash.js": +/*!*************************************************************************!*\ + !*** ../../node_modules/@wordpress/icons/build-module/library/trash.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/primitives */ "@wordpress/primitives"); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); + + +/** + * WordPress dependencies + */ + +const trash = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__.Path, { + d: "M20 5h-5.7c0-1.3-1-2.3-2.3-2.3S9.7 3.7 9.7 5H4v2h1.5v.3l1.7 11.1c.1 1 1 1.7 2 1.7h5.7c1 0 1.8-.7 2-1.7l1.7-11.1V7H20V5zm-3.2 2l-1.7 11.1c0 .1-.1.2-.3.2H9.1c-.1 0-.3-.1-.3-.2L7.2 7h9.6z" +})); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (trash); +//# sourceMappingURL=trash.js.map + /***/ }), /***/ "@wordpress/block-editor": @@ -165,7 +794,6 @@ __webpack_require__.r(__webpack_exports__); \*************************************/ /***/ ((module) => { -"use strict"; module.exports = window["wp"]["blockEditor"]; /***/ }), @@ -176,41 +804,97 @@ module.exports = window["wp"]["blockEditor"]; \********************************/ /***/ ((module) => { -"use strict"; module.exports = window["wp"]["blocks"]; /***/ }), +/***/ "@wordpress/components": +/*!************************************!*\ + !*** external ["wp","components"] ***! + \************************************/ +/***/ ((module) => { + +module.exports = window["wp"]["components"]; + +/***/ }), + +/***/ "@wordpress/data": +/*!******************************!*\ + !*** external ["wp","data"] ***! + \******************************/ +/***/ ((module) => { + +module.exports = window["wp"]["data"]; + +/***/ }), + /***/ "@wordpress/element": /*!*********************************!*\ !*** external ["wp","element"] ***! \*********************************/ /***/ ((module) => { -"use strict"; module.exports = window["wp"]["element"]; /***/ }), +/***/ "@wordpress/html-entities": +/*!**************************************!*\ + !*** external ["wp","htmlEntities"] ***! + \**************************************/ +/***/ ((module) => { + +module.exports = window["wp"]["htmlEntities"]; + +/***/ }), + /***/ "@wordpress/i18n": /*!******************************!*\ !*** external ["wp","i18n"] ***! \******************************/ /***/ ((module) => { -"use strict"; module.exports = window["wp"]["i18n"]; /***/ }), +/***/ "@wordpress/primitives": +/*!************************************!*\ + !*** external ["wp","primitives"] ***! + \************************************/ +/***/ ((module) => { + +module.exports = window["wp"]["primitives"]; + +/***/ }), + /***/ "./src/block.json": /*!************************!*\ !*** ./src/block.json ***! \************************/ /***/ ((module) => { -"use strict"; -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/chapitrage-thematique","version":"0.1.0","title":"Chapitrage Thématique","category":"homegrade-blocks","description":"Pour insérer un bloc de gestion de chapitres pour une thématique parent","supports":{"html":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/chapitrage-thematique","version":"0.1.0","title":"Chapitrage Thématique","category":"homegrade-blocks","description":"(Pour les thématiques parents) Pour insérer un bloc de gestion de chapitres pour une thématique parent","supports":{"html":false,"multiple":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); + +/***/ }), + +/***/ "./src/chapitre-thematique/block.json": +/*!********************************************!*\ + !*** ./src/chapitre-thematique/block.json ***! + \********************************************/ +/***/ ((module) => { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/chapitre-thematique","version":"0.1.0","title":"Chapitre Thématiques ","category":"homegrade-blocks","description":"Point de légende pour titrer ou décrire un point de légende spécifique sur un Schéma ","supports":{"html":false},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"chapterTitle":{"type":"string","default":""},"chapterDescription":{"type":"string","default":""},"chapterImageUrl":{"type":"string"},"chapterImageId":{"type":"number"},"chapterImageAlt":{"type":"string","source":"attribute","selector":"img","attribute":"alt","default":""}}}'); + +/***/ }), + +/***/ "./src/lien-chapitre/block.json": +/*!**************************************!*\ + !*** ./src/lien-chapitre/block.json ***! + \**************************************/ +/***/ ((module) => { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/lien-chapitre","version":"0.1.0","title":"Lien de chapitre","category":"homegrade-blocks","description":"Pour insérer des liens dans un chapitre thématique","supports":{"html":false},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"chapterLinkTitle":{"type":"string","default":""},"chapterLinkDescription":{"type":"string","default":""},"chapterLinkRelatedPostId":{"type":"number"},"chapterLinkRelatedPostUrl":{"type":"string"}}}'); /***/ }) diff --git a/blocks/chapitrage-thematique/build/index.js.map b/blocks/chapitrage-thematique/build/index.js.map index 8d844cf..325e711 100644 --- a/blocks/chapitrage-thematique/build/index.js.map +++ b/blocks/chapitrage-thematique/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;AAAqC;AACd;AAMU;AAElB,SAASI,IAAIA,CAAA,EAAG;EAC9B,OACCC,iEAAA;IAAA,GACKJ,sEAAa,CAAC;MACjBK,SAAS,EAAG;IACb,CAAC;EAAC,GAEFD,iEAAA,CAACH,6DAAQ;IACRK,QAAQ,EAAGC,KAAK,IAAKC,aAAa,CAAC;MAAEC,WAAW,EAAEF;IAAM,CAAC,CAAE;IAC3DA,KAAK,EAAEE,WAAY;IACnBC,OAAO,EAAC,GAAG;IACXL,SAAS,EAAC,eAAe;IACzBM,WAAW,EAAC;EAAyB,CACrC,CAAC,EACDZ,mDAAE,CAAC,sCAAsC,EAAE,aAAa,CACjD,CAAC;AAEZ;;;;;;;;;;;;;;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AG,CAAE,CAAC,EACZhB,iEAAA;MAAGgB,EAAE,EAAC;IAAG,CAAE,CAAC,EACZhB,iEAAA;MAAGgB,EAAE,EAAC;IAAG,CAAE,CAAC,EACZhB,iEAAA;MAAGgB,EAAE,EAAC;IAAG,CAAE,CACP,CACL;IACDE,UAAU,EAAE;EACb,CAAC;EACDC,IAAI,EAAEpB,6CAAI;EACVU,IAAIA,+CAAAA;AACL,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;AC3CF;;;;;;;;;;;;;ACAA;;;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;UAEA;UACA;;;;;WCzBA;WACA;WACA;WACA;WACA,+BAA+B,wCAAwC;WACvE;WACA;WACA;WACA;WACA,iBAAiB,qBAAqB;WACtC;WACA;WACA;WACA;WACA,kBAAkB,qBAAqB;WACvC;WACA;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC7BA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://multiblocks/./src/edit.js","webpack://multiblocks/./src/index.js","webpack://multiblocks/./src/editor.scss","webpack://multiblocks/./src/style.scss","webpack://multiblocks/external window [\"wp\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"element\"]","webpack://multiblocks/external window [\"wp\",\"i18n\"]","webpack://multiblocks/webpack/bootstrap","webpack://multiblocks/webpack/runtime/chunk loaded","webpack://multiblocks/webpack/runtime/compat get default export","webpack://multiblocks/webpack/runtime/define property getters","webpack://multiblocks/webpack/runtime/hasOwnProperty shorthand","webpack://multiblocks/webpack/runtime/make namespace object","webpack://multiblocks/webpack/runtime/jsonp chunk loading","webpack://multiblocks/webpack/before-startup","webpack://multiblocks/webpack/startup","webpack://multiblocks/webpack/after-startup"],"sourcesContent":["import { __ } from \"@wordpress/i18n\";\nimport \"./editor.scss\";\n\nimport {\n\tuseBlockProps,\n\tRichText,\n\tBlockControls,\n} from \"@wordpress/block-editor\";\n\nexport default function Edit() {\n\treturn (\n\t\t\n\t\t\t setAttributes({ textContent: value })}\n\t\t\t\tvalue={textContent}\n\t\t\t\ttagName=\"p\"\n\t\t\t\tclassName=\"aside-content\"\n\t\t\t\tplaceholder=\"Ajoutez votre texte ici\"\n\t\t\t/>\n\t\t\t{__(\"Multiblocks – salut from the editor!\", \"multiblocks\")}\n\t\t\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\nimport \"./style.scss\";\n\nimport Edit from \"./edit\";\nimport save from \"./save\";\nimport metadata from \"./block.json\";\n\nregisterBlockType(metadata.name, {\n\ticon: {\n\t\tsrc: (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t),\n\t\tforeground: \"#DF1E1E\",\n\t},\n\tedit: Edit,\n\tsave,\n});\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkmultiblocks\"] = self[\"webpackChunkmultiblocks\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], () => (__webpack_require__(\"./src/index.js\")))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useBlockProps","RichText","BlockControls","Edit","createElement","className","onChange","value","setAttributes","textContent","tagName","placeholder","registerBlockType","save","metadata","name","icon","src","xmlns","viewBox","id","d","foreground","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACd;AACG;AAOO;AACmC;AACS;AACpC;AAC1B,SAASU,IAAIA,CAAC;EAAEC,UAAU;EAAEC,aAAa;EAAE,GAAGC;AAAM,CAAC,EAAE;EACrE,IAAI;IAAEC,YAAY;IAAEC;EAAmB,CAAC,GAAGJ,UAAU;EAErD,SAASK,oBAAoBA,CAACF,YAAY,E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CNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://multiblocks/./src/chapitre-thematique/edit.js","webpack://multiblocks/./src/chapitre-thematique/index.js","webpack://multiblocks/./src/chapitre-thematique/save.js","webpack://multiblocks/./src/edit.js","webpack://multiblocks/./src/index.js","webpack://multiblocks/./src/lien-chapitre/OptionsSelectControl.js","webpack://multiblocks/./src/lien-chapitre/edit.js","webpack://multiblocks/./src/lien-chapitre/index.js","webpack://multiblocks/./src/lien-chapitre/save.js","webpack://multiblocks/./src/save.js","webpack://multiblocks/./src/chapitre-thematique/editor.scss","webpack://multiblocks/./src/chapitre-thematique/style.scss","webpack://multiblocks/./src/editor.scss","webpack://multiblocks/./src/lien-chapitre/editor.scss","webpack://multiblocks/./src/lien-chapitre/style.scss","webpack://multiblocks/./src/style.scss","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/trash.js","webpack://multiblocks/external window [\"wp\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"components\"]","webpack://multiblocks/external window [\"wp\",\"data\"]","webpack://multiblocks/external window [\"wp\",\"element\"]","webpack://multiblocks/external window [\"wp\",\"htmlEntities\"]","webpack://multiblocks/external window [\"wp\",\"i18n\"]","webpack://multiblocks/external window [\"wp\",\"primitives\"]","webpack://multiblocks/webpack/bootstrap","webpack://multiblocks/webpack/runtime/chunk loaded","webpack://multiblocks/webpack/runtime/compat get default export","webpack://multiblocks/webpack/runtime/define property getters","webpack://multiblocks/webpack/runtime/hasOwnProperty shorthand","webpack://multiblocks/webpack/runtime/make namespace object","webpack://multiblocks/webpack/runtime/jsonp chunk loading","webpack://multiblocks/webpack/before-startup","webpack://multiblocks/webpack/startup","webpack://multiblocks/webpack/after-startup"],"sourcesContent":["import { __ } from \"@wordpress/i18n\";\nimport \"./editor.scss\";\nimport \"../lien-chapitre\";\n\nimport {\n\tuseBlockProps,\n\tRichText,\n\tInnerBlocks,\n\tBlockControls,\n} from \"@wordpress/block-editor\";\nimport { ToolbarGroup, ToolbarButton } from \"@wordpress/components\";\nimport { MediaReplaceFlow, MediaPlaceholder } from \"@wordpress/block-editor\";\nimport { trash } from \"@wordpress/icons\";\nexport default function Edit({ attributes, setAttributes, ...props }) {\n\tlet { chapterTitle, chapterDescription } = attributes;\n\n\tfunction onChangeChapterTitle(chapterTitle) {\n\t\tsetAttributes({ chapterTitle });\n\t}\n\tfunction onChangeChapterDescription(chapterDescription) {\n\t\tsetAttributes({ chapterDescription });\n\t}\n\n\tlet { chapterImageUrl, chapterImageId, chapterImageAlt } = attributes;\n\n\tfunction setImageAttributes(media) {\n\t\tif (!media || !media.url) {\n\t\t\tsetAttributes({\n\t\t\t\tchapterImageUrl: null,\n\t\t\t\tchapterImageId: null,\n\t\t\t\tchapterImageAlt: null,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tsetAttributes({\n\t\t\tchapterImageUrl: media.url,\n\t\t\tchapterImageId: media.id,\n\t\t\tchapterImageAlt: media?.alt,\n\t\t});\n\t}\n\n\tfunction removeImageAttributes() {\n\t\tsetAttributes({\n\t\t\tchapterImageUrl: null,\n\t\t\tchapterImageId: null,\n\t\t\tchapterImageAlt: null,\n\t\t});\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t
\n\t\t\t\t\t{!chapterImageUrl && (\n\t\t\t\t\t\t\n\t\t\t\t\t)}\n\n\t\t\t\t\t{chapterImageUrl && (\n\t\t\t\t\t\t{chapterImageAlt}\n\t\t\t\t\t)}\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\n\t\t\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\nimport \"./style.scss\";\nimport metadata from \"./block.json\";\n\nimport Edit from \"./edit\";\nimport Save from \"./save\";\n\nimport { navigation } from \"@wordpress/icons\";\n\nregisterBlockType(metadata.name, {\n\ttitle: metadata.title,\n\ticon: {\n\t\tforeground: \"#DF1E1E\",\n\t\tsrc: (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t),\n\t},\n\n\tsupports: metadata.supports,\n\tattributes: metadata.attributes,\n\tedit: Edit,\n\tsave: Save,\n});\n","import { useBlockProps, RichText, InnerBlocks } from \"@wordpress/block-editor\";\n\nexport default function save({ attributes }) {\n\tconst { chapterTitle, chapterDescription, chapterImageUrl, chapterImageAlt } =\n\t\tattributes;\n\treturn (\n\t\t\n\t\t\t
\n\t\t\t\t{chapterImageUrl && {chapterImageAlt}}\n\t\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\n\t);\n}\n","import { __ } from \"@wordpress/i18n\";\nimport \"./editor.scss\";\nimport \"./chapitre-thematique\";\n\nimport { useBlockProps, RichText, InnerBlocks } from \"@wordpress/block-editor\";\nimport { MediaReplaceFlow, MediaPlaceholder } from \"@wordpress/block-editor\";\nimport { ToolbarGroup, ToolbarButton } from \"@wordpress/components\";\nimport { trash } from \"@wordpress/icons\";\nexport default function Edit({\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\t...props\n}) {\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\nimport \"./style.scss\";\n\nimport Edit from \"./edit\";\nimport save from \"./save\";\nimport metadata from \"./block.json\";\n\nregisterBlockType(metadata.name, {\n\ticon: {\n\t\tsrc: (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t),\n\t\tforeground: \"#DF1E1E\",\n\t},\n\tedit: Edit,\n\tsave,\n});\n","import { __ } from \"@wordpress/i18n\";\r\nimport { InspectorControls } from \"@wordpress/block-editor\";\r\nimport {\r\n\tPanelBody,\r\n\tSelectControl,\r\n\tComboboxControl,\r\n} from \"@wordpress/components\";\r\nimport \"./editor.scss\";\r\nimport { useSelect } from \"@wordpress/data\";\r\nimport { useEffect, useState } from \"@wordpress/element\";\r\nimport { decodeEntities } from \"@wordpress/html-entities\";\r\n\r\nexport default function OptionsSelectControl({\r\n\tsetAttributes,\r\n\tchapterLinkRelatedPostId,\r\n}) {\r\n\tlet [relatedQuestionPages, setRelatedQuestionPages] = useState(null);\r\n\tlet [childTermsIdArray, setChildTermsIdArray] = useState(null);\r\n\r\n\tconst lang = getAdminLanguageFromCookie(\"wp-wpml_current_language\");\r\n\r\n\tfunction getAdminLanguageFromCookie(c_name) {\r\n\t\tvar c_value = document.cookie,\r\n\t\t\tc_start = c_value.indexOf(\" \" + c_name + \"=\");\r\n\t\tif (c_start == -1) c_start = c_value.indexOf(c_name + \"=\");\r\n\t\tif (c_start == -1) {\r\n\t\t\tc_value = null;\r\n\t\t} else {\r\n\t\t\tc_start = c_value.indexOf(\"=\", c_start) + 1;\r\n\t\t\tvar c_end = c_value.indexOf(\";\", c_start);\r\n\t\t\tif (c_end == -1) {\r\n\t\t\t\tc_end = c_value.length;\r\n\t\t\t}\r\n\t\t\tc_value = unescape(c_value.substring(c_start, c_end));\r\n\t\t}\r\n\t\treturn c_value;\r\n\t}\r\n\r\n\tfunction handleRelatedPostChange(postId) {\r\n\t\tsetAttributes({ chapterLinkRelatedPostId: Number(postId) });\r\n\t}\r\n\r\n\tfunction buildTaxChildrenIdArray(childrenArray) {\r\n\t\treturn childrenArray.map((item) => item.id);\r\n\t}\r\n\r\n\tfunction buildSelectOptions(relatedPossiblePages) {\r\n\t\tlet options = [];\r\n\t\tif (relatedPossiblePages) {\r\n\t\t\toptions.push({ value: 0, label: \"Sélectionnez une page\" });\r\n\t\t\trelatedPossiblePages.forEach((page) => {\r\n\t\t\t\toptions.push({\r\n\t\t\t\t\tvalue: page.id,\r\n\t\t\t\t\tlabel: decodeEntities(page.title.rendered),\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\toptions.push({ value: 0, label: \"Pas encore de questions...\" });\r\n\t\t}\r\n\t\treturn options;\r\n\t}\r\n\r\n\t// GET TAXONOMIES INOFRMATION\r\n\tlet postTaxonomies = useSelect((select) =>\r\n\t\tselect(\"core/editor\").getCurrentPostAttribute(\"thematiques\")\r\n\t);\r\n\r\n\t// GET THE CURRENT TAXONOMY AND FIND THE PARENT OBJECT\r\n\tlet postMainTaxonomy = useSelect(\r\n\t\t(select) =>\r\n\t\t\tselect(\"core\").getEntityRecord(\r\n\t\t\t\t\"taxonomy\",\r\n\t\t\t\t\"thematiques\",\r\n\t\t\t\tpostTaxonomies[0]\r\n\t\t\t),\r\n\t\t[postTaxonomies]\r\n\t);\r\n\tlet postParentTaxonomy = useSelect(\r\n\t\t(select) => {\r\n\t\t\tif (postMainTaxonomy && postMainTaxonomy.parent) {\r\n\t\t\t\treturn select(\"core\").getEntityRecord(\r\n\t\t\t\t\t\"taxonomy\",\r\n\t\t\t\t\t\"thematiques\",\r\n\t\t\t\t\tpostMainTaxonomy.parent\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t},\r\n\t\t[postMainTaxonomy]\r\n\t);\r\n\tlet currentGeneralThematique = postParentTaxonomy ?? postMainTaxonomy ?? null;\r\n\r\n\t// GET THE PARENT TAX CHILDREN\r\n\tlet childTerms = useSelect((select) => {\r\n\t\tif (currentGeneralThematique) {\r\n\t\t\treturn select(\"core\").getEntityRecords(\"taxonomy\", \"thematiques\", {\r\n\t\t\t\tparent: currentGeneralThematique.id,\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn null;\r\n\t});\r\n\r\n\t// BUILD AN ARRAY OF CHILDREN TAXONOMIES ID AND PUT IT IN THE STATE\r\n\tuseEffect(() => {\r\n\t\tif (childTerms) {\r\n\t\t\tsetChildTermsIdArray(buildTaxChildrenIdArray(childTerms));\r\n\t\t}\r\n\t}, [childTerms]);\r\n\r\n\t// GET OPTIONS FOR RELATED POSSIBLE PAGES ACCORDING TO CURRENT TAXONOMY CHILDREN ID ARRAY\r\n\tconst relatedPossiblePages = useSelect((select) => {\r\n\t\tif (childTermsIdArray) {\r\n\t\t\tlet query = {\r\n\t\t\t\tstatus: \"publish\",\r\n\t\t\t\tper_page: -1,\r\n\t\t\t\tlang: lang,\r\n\t\t\t\tthematiques: childTermsIdArray,\r\n\t\t\t};\r\n\t\t\treturn select(\"core\").getEntityRecords(\"postType\", \"conseils\", query);\r\n\t\t}\r\n\t\treturn null;\r\n\t});\r\n\r\n\tuseEffect(() => {\r\n\t\tif (relatedPossiblePages) {\r\n\t\t\tsetRelatedQuestionPages(buildSelectOptions(relatedPossiblePages));\r\n\t\t}\r\n\t}, [relatedPossiblePages]);\r\n\r\n\tlet panelTitle = postParentTaxonomy\r\n\t\t? \"Conseils \" + postParentTaxonomy.name\r\n\t\t: postMainTaxonomy\r\n\t\t? \"Conseils \" + postMainTaxonomy.name\r\n\t\t: null;\r\n\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t{/* handleRelatedPostChange(e)}\r\n\t\t\t\t/> */}\r\n\t\t\t\t{relatedQuestionPages && (\r\n\t\t\t\t\t handleRelatedPostChange(e)}\r\n\t\t\t\t\t\toptions={relatedQuestionPages}\r\n\t\t\t\t\t\tvalue={chapterLinkRelatedPostId}\r\n\t\t\t\t\t/>\r\n\t\t\t\t)}\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n","import { __ } from \"@wordpress/i18n\";\n// import { useBlockProps } from \"@wordpress/block-editor\";\nimport \"./editor.scss\";\nimport {\n\tPanelBody,\n\tFocalPointPicker,\n\tTextControl,\n\tTextareaControl,\n} from \"@wordpress/components\";\nimport { useSelect } from \"@wordpress/data\";\n\nimport {\n\tuseBlockProps,\n\tRichText,\n\tInspectorControls,\n\tInnerBlocks,\n} from \"@wordpress/block-editor\";\n\nimport OptionsSelectControl from \"./OptionsSelectControl\";\n\nexport default function Edit({ attributes, setAttributes, ...props }) {\n\tlet {\n\t\tchapterLinkTitle,\n\t\tchapterLinkDescription,\n\t\tchapterLinkRelatedPostId,\n\t\tchapterLinkRelatedPostUrl,\n\t} = attributes;\n\n\tlet currentRelatedPostConseil = useSelect((select) =>\n\t\tselect(\"core\").getEntityRecord(\n\t\t\t\"postType\",\n\t\t\t\"conseils\",\n\t\t\tchapterLinkRelatedPostId\n\t\t)\n\t);\n\n\tif (\n\t\tcurrentRelatedPostConseil &&\n\t\tcurrentRelatedPostConseil.link !== chapterLinkRelatedPostUrl\n\t) {\n\t\tconsole.log(chapterLinkRelatedPostUrl);\n\t\tconsole.log(currentRelatedPostConseil.link);\n\t\tsetAttributes({\n\t\t\tchapterLinkRelatedPostUrl: currentRelatedPostConseil.link,\n\t\t});\n\t}\n\n\tfunction onChangeChapterLinkTitle(chapterLinkTitle) {\n\t\tsetAttributes({ chapterLinkTitle });\n\t}\n\tfunction onChangeChapterLinkDescription(chapterLinkDescription) {\n\t\tsetAttributes({ chapterLinkDescription });\n\t}\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t{chapterLinkRelatedPostUrl && (\n\t\t\t\t\t{chapterLinkRelatedPostUrl}\n\t\t\t\t)}\n\t\t\t\n\t\t\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\nimport \"./style.scss\";\nimport metadata from \"./block.json\";\n\nimport Edit from \"./edit\";\nimport Save from \"./save\";\n\nimport { navigation } from \"@wordpress/icons\";\n\nregisterBlockType(metadata.name, {\n\ttitle: metadata.title,\n\ticon: {\n\t\tforeground: \"#DF1E1E\",\n\t\tsrc: (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t),\n\t},\n\n\tsupports: metadata.supports,\n\tattributes: metadata.attributes,\n\tedit: Edit,\n\tsave: Save,\n});\n","import { useBlockProps, RichText, InnerBlocks } from \"@wordpress/block-editor\";\n\nexport default function save({ attributes }) {\n\tlet { chapterLinkTitle, chapterLinkDescription, chapterLinkRelatedPostUrl } =\n\t\tattributes;\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t{chapterLinkRelatedPostUrl && (\n\t\t\t\t{chapterLinkRelatedPostUrl}\n\t\t\t)}\n\t\t\n\t);\n}\n","import { useBlockProps, RichText, InnerBlocks } from \"@wordpress/block-editor\";\n\nexport default function save({ attributes }) {\n\treturn (\n\t\t\n\t\t\t\n\t\t\n\t);\n}\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst trash = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M20 5h-5.7c0-1.3-1-2.3-2.3-2.3S9.7 3.7 9.7 5H4v2h1.5v.3l1.7 11.1c.1 1 1 1.7 2 1.7h5.7c1 0 1.8-.7 2-1.7l1.7-11.1V7H20V5zm-3.2 2l-1.7 11.1c0 .1-.1.2-.3.2H9.1c-.1 0-.3-.1-.3-.2L7.2 7h9.6z\"\n}));\nexport default trash;\n//# sourceMappingURL=trash.js.map","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"htmlEntities\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"primitives\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkmultiblocks\"] = self[\"webpackChunkmultiblocks\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], () => (__webpack_require__(\"./src/index.js\")))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useBlockProps","RichText","InnerBlocks","BlockControls","ToolbarGroup","ToolbarButton","MediaReplaceFlow","MediaPlaceholder","trash","Edit","attributes","setAttributes","props","chapterTitle","chapterDescription","onChangeChapterTitle","onChangeChapterDescription","chapterImageUrl","chapterImageId","chapterImageAlt","setImageAttributes","media","url","id","alt","removeImageAttributes","createElement","Fragment","mediaId","mediaUrl","allowedTypes","accept","onSelect","name","title","icon","isActive","onClick","className","multiple","handleUpload","src","tagName","placeholder","value","onChange","allowedBlocks","registerBlockType","metadata","Save","navigation","foreground","xmlns","viewBox","d","supports","edit","save","Content","clientId","InspectorControls","PanelBody","SelectControl","ComboboxControl","useSelect","useEffect","useState","decodeEntities","OptionsSelectControl","chapterLinkRelatedPostId","_ref","relatedQuestionPages","setRelatedQuestionPages","childTermsIdArray","setChildTermsIdArray","lang","getAdminLanguageFromCookie","c_name","c_value","document","cookie","c_start","indexOf","c_end","length","unescape","substring","handleRelatedPostChange","postId","Number","buildTaxChildrenIdArray","childrenArray","map","item","buildSelectOptions","relatedPossiblePages","options","push","label","forEach","page","rendered","postTaxonomies","select","getCurrentPostAttribute","postMainTaxonomy","getEntityRecord","postParentTaxonomy","parent","currentGeneralThematique","childTerms","getEntityRecords","query","status","per_page","thematiques","panelTitle","e","FocalPointPicker","TextControl","TextareaControl","chapterLinkTitle","chapterLinkDescription","chapterLinkRelatedPostUrl","currentRelatedPostConseil","link","console","log","onChangeChapterLinkTitle","onChangeChapterLinkDescription","href","class"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/chapitrage-thematique/build/lien-chapitre/block.json b/blocks/chapitrage-thematique/build/lien-chapitre/block.json new file mode 100644 index 0000000..c83ed00 --- /dev/null +++ b/blocks/chapitrage-thematique/build/lien-chapitre/block.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 2, + "name": "homegrade-content-blocks/lien-chapitre", + "version": "0.1.0", + "title": "Lien de chapitre", + "category": "homegrade-blocks", + "description": "Pour insérer des liens dans un chapitre thématique", + "supports": { + "html": false + }, + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "style": "file:./style-index.css", + "attributes": { + "chapterLinkTitle": { + "type": "string", + "default": "" + }, + "chapterLinkDescription": { + "type": "string", + "default": "" + }, + "chapterLinkRelatedPostId": { + "type": "number" + }, + "chapterLinkRelatedPostUrl": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/blocks/chapitrage-thematique/build/lien-chapitre/index.asset.php b/blocks/chapitrage-thematique/build/lien-chapitre/index.asset.php new file mode 100644 index 0000000..984855b --- /dev/null +++ b/blocks/chapitrage-thematique/build/lien-chapitre/index.asset.php @@ -0,0 +1 @@ + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => '509129504000b153642d'); diff --git a/blocks/chapitrage-thematique/build/lien-chapitre/index.css b/blocks/chapitrage-thematique/build/lien-chapitre/index.css new file mode 100644 index 0000000..6fdfa2c --- /dev/null +++ b/blocks/chapitrage-thematique/build/lien-chapitre/index.css @@ -0,0 +1,4 @@ +/*!******************************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/lien-chapitre/editor.scss ***! + \******************************************************************************************************************************************************************************************************************************************************/ + diff --git a/blocks/chapitrage-thematique/build/lien-chapitre/index.js b/blocks/chapitrage-thematique/build/lien-chapitre/index.js new file mode 100644 index 0000000..4b590b6 --- /dev/null +++ b/blocks/chapitrage-thematique/build/lien-chapitre/index.js @@ -0,0 +1,597 @@ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/lien-chapitre/OptionsSelectControl.js": +/*!***************************************************!*\ + !*** ./src/lien-chapitre/OptionsSelectControl.js ***! + \***************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ OptionsSelectControl) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./editor.scss */ "./src/lien-chapitre/editor.scss"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities"); +/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__); + + + + + + + + +function OptionsSelectControl({ + setAttributes, + chapterLinkRelatedPostId +}) { + var _ref; + let [relatedQuestionPages, setRelatedQuestionPages] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + let [childTermsIdArray, setChildTermsIdArray] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(null); + const lang = getAdminLanguageFromCookie("wp-wpml_current_language"); + function getAdminLanguageFromCookie(c_name) { + var c_value = document.cookie, + c_start = c_value.indexOf(" " + c_name + "="); + if (c_start == -1) c_start = c_value.indexOf(c_name + "="); + if (c_start == -1) { + c_value = null; + } else { + c_start = c_value.indexOf("=", c_start) + 1; + var c_end = c_value.indexOf(";", c_start); + if (c_end == -1) { + c_end = c_value.length; + } + c_value = unescape(c_value.substring(c_start, c_end)); + } + return c_value; + } + function handleRelatedPostChange(postId) { + setAttributes({ + chapterLinkRelatedPostId: Number(postId) + }); + } + function buildTaxChildrenIdArray(childrenArray) { + return childrenArray.map(item => item.id); + } + function buildSelectOptions(relatedPossiblePages) { + let options = []; + if (relatedPossiblePages) { + options.push({ + value: 0, + label: "Sélectionnez une page" + }); + relatedPossiblePages.forEach(page => { + options.push({ + value: page.id, + label: (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__.decodeEntities)(page.title.rendered) + }); + }); + } else { + options.push({ + value: 0, + label: "Pas encore de questions..." + }); + } + return options; + } + + // GET TAXONOMIES INOFRMATION + let postTaxonomies = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core/editor").getCurrentPostAttribute("thematiques")); + + // GET THE CURRENT TAXONOMY AND FIND THE PARENT OBJECT + let postMainTaxonomy = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core").getEntityRecord("taxonomy", "thematiques", postTaxonomies[0]), [postTaxonomies]); + let postParentTaxonomy = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { + if (postMainTaxonomy && postMainTaxonomy.parent) { + return select("core").getEntityRecord("taxonomy", "thematiques", postMainTaxonomy.parent); + } + return null; + }, [postMainTaxonomy]); + let currentGeneralThematique = (_ref = postParentTaxonomy !== null && postParentTaxonomy !== void 0 ? postParentTaxonomy : postMainTaxonomy) !== null && _ref !== void 0 ? _ref : null; + + // GET THE PARENT TAX CHILDREN + let childTerms = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { + if (currentGeneralThematique) { + return select("core").getEntityRecords("taxonomy", "thematiques", { + parent: currentGeneralThematique.id + }); + } + return null; + }); + + // BUILD AN ARRAY OF CHILDREN TAXONOMIES ID AND PUT IT IN THE STATE + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (childTerms) { + setChildTermsIdArray(buildTaxChildrenIdArray(childTerms)); + } + }, [childTerms]); + + // GET OPTIONS FOR RELATED POSSIBLE PAGES ACCORDING TO CURRENT TAXONOMY CHILDREN ID ARRAY + const relatedPossiblePages = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { + if (childTermsIdArray) { + let query = { + status: "publish", + per_page: -1, + lang: lang, + thematiques: childTermsIdArray + }; + return select("core").getEntityRecords("postType", "conseils", query); + } + return null; + }); + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (relatedPossiblePages) { + setRelatedQuestionPages(buildSelectOptions(relatedPossiblePages)); + } + }, [relatedPossiblePages]); + let panelTitle = postParentTaxonomy ? "Conseils " + postParentTaxonomy.name : postMainTaxonomy ? "Conseils " + postMainTaxonomy.name : null; + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.PanelBody, { + title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Conseils Relié", "homegrade-blocks__texte-fonctionnel") + }, relatedQuestionPages && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ComboboxControl, { + label: panelTitle, + onChange: e => handleRelatedPostChange(e), + options: relatedQuestionPages, + value: chapterLinkRelatedPostId + }))); +} + +/***/ }), + +/***/ "./src/lien-chapitre/edit.js": +/*!***********************************!*\ + !*** ./src/lien-chapitre/edit.js ***! + \***********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ Edit) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./editor.scss */ "./src/lien-chapitre/editor.scss"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _OptionsSelectControl__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./OptionsSelectControl */ "./src/lien-chapitre/OptionsSelectControl.js"); + + +// import { useBlockProps } from "@wordpress/block-editor"; + + + + + +function Edit({ + attributes, + setAttributes, + ...props +}) { + let { + chapterLinkTitle, + chapterLinkDescription, + chapterLinkRelatedPostId, + chapterLinkRelatedPostUrl + } = attributes; + let currentRelatedPostConseil = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useSelect)(select => select("core").getEntityRecord("postType", "conseils", chapterLinkRelatedPostId)); + if (currentRelatedPostConseil && currentRelatedPostConseil.link !== chapterLinkRelatedPostUrl) { + console.log(chapterLinkRelatedPostUrl); + console.log(currentRelatedPostConseil.link); + setAttributes({ + chapterLinkRelatedPostUrl: currentRelatedPostConseil.link + }); + } + function onChangeChapterLinkTitle(chapterLinkTitle) { + setAttributes({ + chapterLinkTitle + }); + } + function onChangeChapterLinkDescription(chapterLinkDescription) { + setAttributes({ + chapterLinkDescription + }); + } + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_OptionsSelectControl__WEBPACK_IMPORTED_MODULE_6__["default"], { + chapterLinkRelatedPostId: chapterLinkRelatedPostId, + setAttributes: setAttributes + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__.useBlockProps)({ + className: `homegrade-blocks-lien-chapitre` + }) + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__.RichText, { + tagName: "h4", + className: "homegrade-blocks-lien-chapitre__title", + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Titre du chapitre", "homegrade-blocks"), + value: chapterLinkTitle, + onChange: onChangeChapterLinkTitle + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_5__.RichText, { + tagName: "p", + className: "homegrade-blocks-lien-chapitre__description", + placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Descriptif du chapitre", "homegrade-blocks"), + value: chapterLinkDescription, + onChange: onChangeChapterLinkDescription + }), chapterLinkRelatedPostUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: chapterLinkRelatedPostUrl + }, chapterLinkRelatedPostUrl))); +} + +/***/ }), + +/***/ "./src/lien-chapitre/index.js": +/*!************************************!*\ + !*** ./src/lien-chapitre/index.js ***! + \************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style.scss */ "./src/lien-chapitre/style.scss"); +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./block.json */ "./src/lien-chapitre/block.json"); +/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./edit */ "./src/lien-chapitre/edit.js"); +/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./save */ "./src/lien-chapitre/save.js"); + + + + + + + +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_3__.name, { + title: _block_json__WEBPACK_IMPORTED_MODULE_3__.title, + icon: { + foreground: "#DF1E1E", + src: (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", { + id: "Calque_1", + "data-name": "Calque 1", + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", { + class: "cls-1", + d: "m20,20V4c0-1.1-.9-2-2-2H6c-1.1,0-2,.9-2,2v16c0,1.1.9,2,2,2h12c1.1,0,2-.9,2-2Zm-8.71-3.29c-.39-.39-.39-1.02,0-1.41l2.29-2.29h-5.59c-.55,0-1-.45-1-1s.45-1,1-1h5.59l-2.29-2.29c-.4-.38-.41-1.02-.02-1.41.38-.4,1.02-.41,1.41-.02,0,0,.02.02.02.02l4,4c.39.39.39,1.02,0,1.41l-4,4c-.39.39-1.02.4-1.41.02,0,0,0,0,0-.02Z" + })) + }, + supports: _block_json__WEBPACK_IMPORTED_MODULE_3__.supports, + attributes: _block_json__WEBPACK_IMPORTED_MODULE_3__.attributes, + edit: _edit__WEBPACK_IMPORTED_MODULE_4__["default"], + save: _save__WEBPACK_IMPORTED_MODULE_5__["default"] +}); + +/***/ }), + +/***/ "./src/lien-chapitre/save.js": +/*!***********************************!*\ + !*** ./src/lien-chapitre/save.js ***! + \***********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ save) +/* harmony export */ }); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); +/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); + + +function save({ + attributes +}) { + let { + chapterLinkTitle, + chapterLinkDescription, + chapterLinkRelatedPostUrl + } = attributes; + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({ + className: `homegrade-blocks-lien-chapitre` + }) + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, { + tagName: "h4", + value: chapterLinkTitle, + className: "homegrade-blocks-lien-chapitre__title" + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, { + tagName: "p", + value: chapterLinkDescription, + className: "homegrade-blocks-lien-chapitre__description" + }), chapterLinkRelatedPostUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { + href: chapterLinkRelatedPostUrl + }, chapterLinkRelatedPostUrl)); +} + +/***/ }), + +/***/ "./src/lien-chapitre/editor.scss": +/*!***************************************!*\ + !*** ./src/lien-chapitre/editor.scss ***! + \***************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "./src/lien-chapitre/style.scss": +/*!**************************************!*\ + !*** ./src/lien-chapitre/style.scss ***! + \**************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +// extracted by mini-css-extract-plugin + + +/***/ }), + +/***/ "@wordpress/block-editor": +/*!*************************************!*\ + !*** external ["wp","blockEditor"] ***! + \*************************************/ +/***/ ((module) => { + +module.exports = window["wp"]["blockEditor"]; + +/***/ }), + +/***/ "@wordpress/blocks": +/*!********************************!*\ + !*** external ["wp","blocks"] ***! + \********************************/ +/***/ ((module) => { + +module.exports = window["wp"]["blocks"]; + +/***/ }), + +/***/ "@wordpress/components": +/*!************************************!*\ + !*** external ["wp","components"] ***! + \************************************/ +/***/ ((module) => { + +module.exports = window["wp"]["components"]; + +/***/ }), + +/***/ "@wordpress/data": +/*!******************************!*\ + !*** external ["wp","data"] ***! + \******************************/ +/***/ ((module) => { + +module.exports = window["wp"]["data"]; + +/***/ }), + +/***/ "@wordpress/element": +/*!*********************************!*\ + !*** external ["wp","element"] ***! + \*********************************/ +/***/ ((module) => { + +module.exports = window["wp"]["element"]; + +/***/ }), + +/***/ "@wordpress/html-entities": +/*!**************************************!*\ + !*** external ["wp","htmlEntities"] ***! + \**************************************/ +/***/ ((module) => { + +module.exports = window["wp"]["htmlEntities"]; + +/***/ }), + +/***/ "@wordpress/i18n": +/*!******************************!*\ + !*** external ["wp","i18n"] ***! + \******************************/ +/***/ ((module) => { + +module.exports = window["wp"]["i18n"]; + +/***/ }), + +/***/ "./src/lien-chapitre/block.json": +/*!**************************************!*\ + !*** ./src/lien-chapitre/block.json ***! + \**************************************/ +/***/ ((module) => { + +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/lien-chapitre","version":"0.1.0","title":"Lien de chapitre","category":"homegrade-blocks","description":"Pour insérer des liens dans un chapitre thématique","supports":{"html":false},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"chapterLinkTitle":{"type":"string","default":""},"chapterLinkDescription":{"type":"string","default":""},"chapterLinkRelatedPostId":{"type":"number"},"chapterLinkRelatedPostUrl":{"type":"string"}}}'); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = __webpack_modules__; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/chunk loaded */ +/******/ (() => { +/******/ var deferred = []; +/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { +/******/ if(chunkIds) { +/******/ priority = priority || 0; +/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; +/******/ deferred[i] = [chunkIds, fn, priority]; +/******/ return; +/******/ } +/******/ var notFulfilled = Infinity; +/******/ for (var i = 0; i < deferred.length; i++) { +/******/ var chunkIds = deferred[i][0]; +/******/ var fn = deferred[i][1]; +/******/ var priority = deferred[i][2]; +/******/ var fulfilled = true; +/******/ for (var j = 0; j < chunkIds.length; j++) { +/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { +/******/ chunkIds.splice(j--, 1); +/******/ } else { +/******/ fulfilled = false; +/******/ if(priority < notFulfilled) notFulfilled = priority; +/******/ } +/******/ } +/******/ if(fulfilled) { +/******/ deferred.splice(i--, 1) +/******/ var r = fn(); +/******/ if (r !== undefined) result = r; +/******/ } +/******/ } +/******/ return result; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/jsonp chunk loading */ +/******/ (() => { +/******/ // no baseURI +/******/ +/******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded +/******/ var installedChunks = { +/******/ "lien-chapitre/index": 0, +/******/ "./style-index": 0 +/******/ }; +/******/ +/******/ // no chunk on demand loading +/******/ +/******/ // no prefetching +/******/ +/******/ // no preloaded +/******/ +/******/ // no HMR +/******/ +/******/ // no HMR manifest +/******/ +/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); +/******/ +/******/ // install a JSONP callback for chunk loading +/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { +/******/ var chunkIds = data[0]; +/******/ var moreModules = data[1]; +/******/ var runtime = data[2]; +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { +/******/ installedChunks[chunkId][0](); +/******/ } +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ return __webpack_require__.O(result); +/******/ } +/******/ +/******/ var chunkLoadingGlobal = self["webpackChunkmultiblocks"] = self["webpackChunkmultiblocks"] || []; +/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); +/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module depends on other loaded chunks and execution need to be delayed +/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["./style-index"], () => (__webpack_require__("./src/lien-chapitre/index.js"))) +/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); +/******/ +/******/ })() +; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/blocks/chapitrage-thematique/build/lien-chapitre/index.js.map b/blocks/chapitrage-thematique/build/lien-chapitre/index.js.map new file mode 100644 index 0000000..9f11dfd --- /dev/null +++ b/blocks/chapitrage-thematique/build/lien-chapitre/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lien-chapitre/index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACuB;AAK7B;AACR;AACqB;AACa;AACC;AAE3C,SAASS,oBAAoBA,CAAC;EAC5CC,aAAa;EACbC;AACD,CAAC,EAAE;EAAA,IAAAC,IAAA;EACF,IAAI,CAACC,oBAAoB,EAAEC,uBAAuB,CAAC,GAAGP,4DAAQ,CAAC,IAAI,CAAC;EACpE,IAAI,CAACQ,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGT,4DAAQ,CAAC,IAAI,CAAC;EAE9D,MAAMU,IAAI,GAAGC,0BAA0B,CAAC,0BAA0B,CAAC;EAEnE,SAASA,0BAA0BA,CAACC,MAAM,EAAE;IAC3C,IAAIC,OAAO,GAAGC,QAAQ,CAACC,MAAM;MAC5BC,OAAO,GAAGH,OAAO,CAACI,OAAO,CAAC,GAAG,GAAGL,MAAM,GAAG,GAAG,CAAC;IAC9C,IAAII,OAAO,IAAI,CAAC,CAAC,EAAEA,OAAO,GAAGH,OAAO,CAACI,OAAO,CAACL,MAAM,GAAG,GAAG,CAAC;IAC1D,IAAII,OAAO,IAAI,CAAC,CAAC,EAAE;MAClBH,OAAO,GAAG,IAAI;IACf,CAAC,MAAM;MACNG,OAAO,GAAGH,OAAO,CAACI,OAAO,CAAC,GAAG,EAAED,OAAO,CAAC,GAAG,CAAC;MAC3C,IAAIE,KAAK,GAAGL,OAAO,CAACI,OAAO,CAAC,GAAG,EAAED,OAAO,CAAC;MACzC,IAAIE,KAAK,IAAI,CAAC,CAAC,EAAE;QAChBA,KAAK,GAAGL,OAAO,CAACM,MAAM;MACvB;MACAN,OAAO,GAAGO,QAAQ,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;;;;;WCzBA;WACA;WACA;WACA;WACA,+BAA+B,wCAAwC;WACvE;WACA;WACA;WACA;WACA,iBAAiB,qBAAqB;WACtC;WACA;WACA;WACA;WACA,kBAAkB,qBAAqB;WACvC;WACA;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC7BA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://multiblocks/./src/lien-chapitre/OptionsSelectControl.js","webpack://multiblocks/./src/lien-chapitre/edit.js","webpack://multiblocks/./src/lien-chapitre/index.js","webpack://multiblocks/./src/lien-chapitre/save.js","webpack://multiblocks/./src/lien-chapitre/editor.scss","webpack://multiblocks/./src/lien-chapitre/style.scss","webpack://multiblocks/external window [\"wp\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"components\"]","webpack://multiblocks/external window [\"wp\",\"data\"]","webpack://multiblocks/external window [\"wp\",\"element\"]","webpack://multiblocks/external window [\"wp\",\"htmlEntities\"]","webpack://multiblocks/external window [\"wp\",\"i18n\"]","webpack://multiblocks/webpack/bootstrap","webpack://multiblocks/webpack/runtime/chunk loaded","webpack://multiblocks/webpack/runtime/compat get default export","webpack://multiblocks/webpack/runtime/define property getters","webpack://multiblocks/webpack/runtime/hasOwnProperty shorthand","webpack://multiblocks/webpack/runtime/make namespace object","webpack://multiblocks/webpack/runtime/jsonp chunk loading","webpack://multiblocks/webpack/before-startup","webpack://multiblocks/webpack/startup","webpack://multiblocks/webpack/after-startup"],"sourcesContent":["import { __ } from \"@wordpress/i18n\";\r\nimport { InspectorControls } from \"@wordpress/block-editor\";\r\nimport {\r\n\tPanelBody,\r\n\tSelectControl,\r\n\tComboboxControl,\r\n} from \"@wordpress/components\";\r\nimport \"./editor.scss\";\r\nimport { useSelect } from \"@wordpress/data\";\r\nimport { useEffect, useState } from \"@wordpress/element\";\r\nimport { decodeEntities } from \"@wordpress/html-entities\";\r\n\r\nexport default function OptionsSelectControl({\r\n\tsetAttributes,\r\n\tchapterLinkRelatedPostId,\r\n}) {\r\n\tlet [relatedQuestionPages, setRelatedQuestionPages] = useState(null);\r\n\tlet [childTermsIdArray, setChildTermsIdArray] = useState(null);\r\n\r\n\tconst lang = getAdminLanguageFromCookie(\"wp-wpml_current_language\");\r\n\r\n\tfunction getAdminLanguageFromCookie(c_name) {\r\n\t\tvar c_value = document.cookie,\r\n\t\t\tc_start = c_value.indexOf(\" \" + c_name + \"=\");\r\n\t\tif (c_start == -1) c_start = c_value.indexOf(c_name + \"=\");\r\n\t\tif (c_start == -1) {\r\n\t\t\tc_value = null;\r\n\t\t} else {\r\n\t\t\tc_start = c_value.indexOf(\"=\", c_start) + 1;\r\n\t\t\tvar c_end = c_value.indexOf(\";\", c_start);\r\n\t\t\tif (c_end == -1) {\r\n\t\t\t\tc_end = c_value.length;\r\n\t\t\t}\r\n\t\t\tc_value = unescape(c_value.substring(c_start, c_end));\r\n\t\t}\r\n\t\treturn c_value;\r\n\t}\r\n\r\n\tfunction handleRelatedPostChange(postId) {\r\n\t\tsetAttributes({ chapterLinkRelatedPostId: Number(postId) });\r\n\t}\r\n\r\n\tfunction buildTaxChildrenIdArray(childrenArray) {\r\n\t\treturn childrenArray.map((item) => item.id);\r\n\t}\r\n\r\n\tfunction buildSelectOptions(relatedPossiblePages) {\r\n\t\tlet options = [];\r\n\t\tif (relatedPossiblePages) {\r\n\t\t\toptions.push({ value: 0, label: \"Sélectionnez une page\" });\r\n\t\t\trelatedPossiblePages.forEach((page) => {\r\n\t\t\t\toptions.push({\r\n\t\t\t\t\tvalue: page.id,\r\n\t\t\t\t\tlabel: decodeEntities(page.title.rendered),\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\toptions.push({ value: 0, label: \"Pas encore de questions...\" });\r\n\t\t}\r\n\t\treturn options;\r\n\t}\r\n\r\n\t// GET TAXONOMIES INOFRMATION\r\n\tlet postTaxonomies = useSelect((select) =>\r\n\t\tselect(\"core/editor\").getCurrentPostAttribute(\"thematiques\")\r\n\t);\r\n\r\n\t// GET THE CURRENT TAXONOMY AND FIND THE PARENT OBJECT\r\n\tlet postMainTaxonomy = useSelect(\r\n\t\t(select) =>\r\n\t\t\tselect(\"core\").getEntityRecord(\r\n\t\t\t\t\"taxonomy\",\r\n\t\t\t\t\"thematiques\",\r\n\t\t\t\tpostTaxonomies[0]\r\n\t\t\t),\r\n\t\t[postTaxonomies]\r\n\t);\r\n\tlet postParentTaxonomy = useSelect(\r\n\t\t(select) => {\r\n\t\t\tif (postMainTaxonomy && postMainTaxonomy.parent) {\r\n\t\t\t\treturn select(\"core\").getEntityRecord(\r\n\t\t\t\t\t\"taxonomy\",\r\n\t\t\t\t\t\"thematiques\",\r\n\t\t\t\t\tpostMainTaxonomy.parent\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t},\r\n\t\t[postMainTaxonomy]\r\n\t);\r\n\tlet currentGeneralThematique = postParentTaxonomy ?? postMainTaxonomy ?? null;\r\n\r\n\t// GET THE PARENT TAX CHILDREN\r\n\tlet childTerms = useSelect((select) => {\r\n\t\tif (currentGeneralThematique) {\r\n\t\t\treturn select(\"core\").getEntityRecords(\"taxonomy\", \"thematiques\", {\r\n\t\t\t\tparent: currentGeneralThematique.id,\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn null;\r\n\t});\r\n\r\n\t// BUILD AN ARRAY OF CHILDREN TAXONOMIES ID AND PUT IT IN THE STATE\r\n\tuseEffect(() => {\r\n\t\tif (childTerms) {\r\n\t\t\tsetChildTermsIdArray(buildTaxChildrenIdArray(childTerms));\r\n\t\t}\r\n\t}, [childTerms]);\r\n\r\n\t// GET OPTIONS FOR RELATED POSSIBLE PAGES ACCORDING TO CURRENT TAXONOMY CHILDREN ID ARRAY\r\n\tconst relatedPossiblePages = useSelect((select) => {\r\n\t\tif (childTermsIdArray) {\r\n\t\t\tlet query = {\r\n\t\t\t\tstatus: \"publish\",\r\n\t\t\t\tper_page: -1,\r\n\t\t\t\tlang: lang,\r\n\t\t\t\tthematiques: childTermsIdArray,\r\n\t\t\t};\r\n\t\t\treturn select(\"core\").getEntityRecords(\"postType\", \"conseils\", query);\r\n\t\t}\r\n\t\treturn null;\r\n\t});\r\n\r\n\tuseEffect(() => {\r\n\t\tif (relatedPossiblePages) {\r\n\t\t\tsetRelatedQuestionPages(buildSelectOptions(relatedPossiblePages));\r\n\t\t}\r\n\t}, [relatedPossiblePages]);\r\n\r\n\tlet panelTitle = postParentTaxonomy\r\n\t\t? \"Conseils \" + postParentTaxonomy.name\r\n\t\t: postMainTaxonomy\r\n\t\t? \"Conseils \" + postMainTaxonomy.name\r\n\t\t: null;\r\n\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t{/* handleRelatedPostChange(e)}\r\n\t\t\t\t/> */}\r\n\t\t\t\t{relatedQuestionPages && (\r\n\t\t\t\t\t handleRelatedPostChange(e)}\r\n\t\t\t\t\t\toptions={relatedQuestionPages}\r\n\t\t\t\t\t\tvalue={chapterLinkRelatedPostId}\r\n\t\t\t\t\t/>\r\n\t\t\t\t)}\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n","import { __ } from \"@wordpress/i18n\";\n// import { useBlockProps } from \"@wordpress/block-editor\";\nimport \"./editor.scss\";\nimport {\n\tPanelBody,\n\tFocalPointPicker,\n\tTextControl,\n\tTextareaControl,\n} from \"@wordpress/components\";\nimport { useSelect } from \"@wordpress/data\";\n\nimport {\n\tuseBlockProps,\n\tRichText,\n\tInspectorControls,\n\tInnerBlocks,\n} from \"@wordpress/block-editor\";\n\nimport OptionsSelectControl from \"./OptionsSelectControl\";\n\nexport default function Edit({ attributes, setAttributes, ...props }) {\n\tlet {\n\t\tchapterLinkTitle,\n\t\tchapterLinkDescription,\n\t\tchapterLinkRelatedPostId,\n\t\tchapterLinkRelatedPostUrl,\n\t} = attributes;\n\n\tlet currentRelatedPostConseil = useSelect((select) =>\n\t\tselect(\"core\").getEntityRecord(\n\t\t\t\"postType\",\n\t\t\t\"conseils\",\n\t\t\tchapterLinkRelatedPostId\n\t\t)\n\t);\n\n\tif (\n\t\tcurrentRelatedPostConseil &&\n\t\tcurrentRelatedPostConseil.link !== chapterLinkRelatedPostUrl\n\t) {\n\t\tconsole.log(chapterLinkRelatedPostUrl);\n\t\tconsole.log(currentRelatedPostConseil.link);\n\t\tsetAttributes({\n\t\t\tchapterLinkRelatedPostUrl: currentRelatedPostConseil.link,\n\t\t});\n\t}\n\n\tfunction onChangeChapterLinkTitle(chapterLinkTitle) {\n\t\tsetAttributes({ chapterLinkTitle });\n\t}\n\tfunction onChangeChapterLinkDescription(chapterLinkDescription) {\n\t\tsetAttributes({ chapterLinkDescription });\n\t}\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t{chapterLinkRelatedPostUrl && (\n\t\t\t\t\t{chapterLinkRelatedPostUrl}\n\t\t\t\t)}\n\t\t\t\n\t\t\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\nimport \"./style.scss\";\nimport metadata from \"./block.json\";\n\nimport Edit from \"./edit\";\nimport Save from \"./save\";\n\nimport { navigation } from \"@wordpress/icons\";\n\nregisterBlockType(metadata.name, {\n\ttitle: metadata.title,\n\ticon: {\n\t\tforeground: \"#DF1E1E\",\n\t\tsrc: (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t),\n\t},\n\n\tsupports: metadata.supports,\n\tattributes: metadata.attributes,\n\tedit: Edit,\n\tsave: Save,\n});\n","import { useBlockProps, RichText, InnerBlocks } from \"@wordpress/block-editor\";\n\nexport default function save({ attributes }) {\n\tlet { chapterLinkTitle, chapterLinkDescription, chapterLinkRelatedPostUrl } =\n\t\tattributes;\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t{chapterLinkRelatedPostUrl && (\n\t\t\t\t{chapterLinkRelatedPostUrl}\n\t\t\t)}\n\t\t\n\t);\n}\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"htmlEntities\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"lien-chapitre/index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkmultiblocks\"] = self[\"webpackChunkmultiblocks\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], () => (__webpack_require__(\"./src/lien-chapitre/index.js\")))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","InspectorControls","PanelBody","SelectControl","ComboboxControl","useSelect","useEffect","useState","decodeEntities","OptionsSelectControl","setAttributes","chapterLinkRelatedPostId","_ref","relatedQuestionPages","setRelatedQuestionPages","childTermsIdArray","setChildTermsIdArray","lang","getAdminLanguageFromCookie","c_name","c_value","document","cookie","c_start","indexOf","c_end","length","unescape","substring","handleRelatedPostChange","postId","Number","buildTaxChildrenIdArray","childrenArray","map","item","id","buildSelectOptions","relatedPossiblePages","options","push","value","label","forEach","page","title","rendered","postTaxonomies","select","getCurrentPostAttribute","postMainTaxonomy","getEntityRecord","postParentTaxonomy","parent","currentGeneralThematique","childTerms","getEntityRecords","query","status","per_page","thematiques","panelTitle","name","createElement","onChange","e","FocalPointPicker","TextControl","TextareaControl","useBlockProps","RichText","InnerBlocks","Edit","attributes","props","chapterLinkTitle","chapterLinkDescription","chapterLinkRelatedPostUrl","currentRelatedPostConseil","link","console","log","onChangeChapterLinkTitle","onChangeChapterLinkDescription","Fragment","className","tagName","placeholder","href","registerBlockType","metadata","Save","navigation","icon","foreground","src","xmlns","viewBox","class","d","supports","edit","save","Content"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/chapitrage-thematique/build/lien-chapitre/style-index.css b/blocks/chapitrage-thematique/build/lien-chapitre/style-index.css new file mode 100644 index 0000000..3111f5c --- /dev/null +++ b/blocks/chapitrage-thematique/build/lien-chapitre/style-index.css @@ -0,0 +1,4 @@ +/*!*****************************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/lien-chapitre/style.scss ***! + \*****************************************************************************************************************************************************************************************************************************************************/ + diff --git a/blocks/chapitrage-thematique/build/style-index.css b/blocks/chapitrage-thematique/build/style-index.css new file mode 100644 index 0000000..bd5b32a --- /dev/null +++ b/blocks/chapitrage-thematique/build/style-index.css @@ -0,0 +1,34 @@ +/*!***************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***! + \***************************************************************************************************************************************************************************************************************************************/ +.homegrade-blocks-chapitrage-thematique .homegrade-blocks-chapitre-thematique { + padding-left: 100px; + display: flex; +} +.homegrade-blocks-chapitrage-thematique .homegrade-blocks-chapitre-thematique__cover { + max-width: 250px; + display: flex; + justify-content: center; + align-items: center; +} +.homegrade-blocks-chapitrage-thematique .homegrade-blocks-chapitre-thematique .block-editor-media-placeholder { + margin-bottom: 30px; +} +.homegrade-blocks-chapitrage-thematique .homegrade-blocks-lien-chapitre { + padding: 20px; + margin: 40px 0; + box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px; +} +.homegrade-blocks-chapitrage-thematique .homegrade-blocks-lien-chapitre__title { + font-weight: 700; +} +/*!***********************************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/chapitre-thematique/style.scss ***! + \***********************************************************************************************************************************************************************************************************************************************************/ + +/*!*****************************************************************************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/lien-chapitre/style.scss ***! + \*****************************************************************************************************************************************************************************************************************************************************/ + + +/*# sourceMappingURL=style-index.css.map*/ \ No newline at end of file diff --git a/blocks/chapitrage-thematique/build/style-index.css.map b/blocks/chapitrage-thematique/build/style-index.css.map new file mode 100644 index 0000000..f4c0675 --- /dev/null +++ b/blocks/chapitrage-thematique/build/style-index.css.map @@ -0,0 +1 @@ +{"version":3,"file":"./style-index.css","mappings":";;;AACC;EACC;EACA;AAAF;AAEE;EACC;EACA;EACA;EACA;AAAH;AAEE;EACC;AAAH;AAGC;EACC;EACA;EACA;AADF;AAEE;EACC;AAAH,C","sources":["webpack://multiblocks/./src/style.scss"],"sourcesContent":[".homegrade-blocks-chapitrage-thematique {\n\t.homegrade-blocks-chapitre-thematique {\n\t\tpadding-left: 100px;\n\t\tdisplay: flex;\n\n\t\t&__cover {\n\t\t\tmax-width: 250px;\n\t\t\tdisplay: flex;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\t\t}\n\t\t.block-editor-media-placeholder {\n\t\t\tmargin-bottom: 30px;\n\t\t}\n\t}\n\t.homegrade-blocks-lien-chapitre {\n\t\tpadding: 20px;\n\t\tmargin: 40px 0;\n\t\tbox-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;\n\t\t&__title {\n\t\t\tfont-weight: 700;\n\t\t}\n\t}\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/chapitrage-thematique/src/block.json b/blocks/chapitrage-thematique/src/block.json index 313670b..0290fdf 100644 --- a/blocks/chapitrage-thematique/src/block.json +++ b/blocks/chapitrage-thematique/src/block.json @@ -5,9 +5,10 @@ "version": "0.1.0", "title": "Chapitrage Thématique", "category": "homegrade-blocks", - "description": "Pour insérer un bloc de gestion de chapitres pour une thématique parent", + "description": "(Pour les thématiques parents) Pour insérer un bloc de gestion de chapitres pour une thématique parent", "supports": { - "html": false + "html": false, + "multiple": false }, "textdomain": "homegrade-blocks", "editorScript": "file:./index.js", diff --git a/blocks/chapitrage-thematique/src/chapitre-thematique/block.json b/blocks/chapitrage-thematique/src/chapitre-thematique/block.json new file mode 100644 index 0000000..e3c4085 --- /dev/null +++ b/blocks/chapitrage-thematique/src/chapitre-thematique/block.json @@ -0,0 +1,38 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 2, + "name": "homegrade-content-blocks/chapitre-thematique", + "version": "0.1.0", + "title": "Chapitre Thématiques ", + "category": "homegrade-blocks", + "description": "Point de légende pour titrer ou décrire un point de légende spécifique sur un Schéma ", + "supports": { + "html": false + }, + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "style": "file:./style-index.css", + "attributes": { + "chapterTitle": { + "type": "string", + "default": "" + }, + "chapterDescription": { + "type": "string", + "default": "" + }, + "chapterImageUrl": { + "type": "string" + }, + "chapterImageId": { + "type": "number" + }, + "chapterImageAlt": { + "type": "string", + "source": "attribute", + "selector": "img", + "attribute": "alt", + "default": "" + } + } +} \ No newline at end of file diff --git a/blocks/chapitrage-thematique/src/chapitre-thematique/edit.js b/blocks/chapitrage-thematique/src/chapitre-thematique/edit.js new file mode 100644 index 0000000..079344e --- /dev/null +++ b/blocks/chapitrage-thematique/src/chapitre-thematique/edit.js @@ -0,0 +1,114 @@ +import { __ } from "@wordpress/i18n"; +import "./editor.scss"; +import "../lien-chapitre"; + +import { + useBlockProps, + RichText, + InnerBlocks, + BlockControls, +} from "@wordpress/block-editor"; +import { ToolbarGroup, ToolbarButton } from "@wordpress/components"; +import { MediaReplaceFlow, MediaPlaceholder } from "@wordpress/block-editor"; +import { trash } from "@wordpress/icons"; +export default function Edit({ attributes, setAttributes, ...props }) { + let { chapterTitle, chapterDescription } = attributes; + + function onChangeChapterTitle(chapterTitle) { + setAttributes({ chapterTitle }); + } + function onChangeChapterDescription(chapterDescription) { + setAttributes({ chapterDescription }); + } + + let { chapterImageUrl, chapterImageId, chapterImageAlt } = attributes; + + function setImageAttributes(media) { + if (!media || !media.url) { + setAttributes({ + chapterImageUrl: null, + chapterImageId: null, + chapterImageAlt: null, + }); + return; + } + setAttributes({ + chapterImageUrl: media.url, + chapterImageId: media.id, + chapterImageAlt: media?.alt, + }); + } + + function removeImageAttributes() { + setAttributes({ + chapterImageUrl: null, + chapterImageId: null, + chapterImageAlt: null, + }); + } + + return ( + <> + + + + + + +
+
+ {!chapterImageUrl && ( + + )} + + {chapterImageUrl && ( + {chapterImageAlt} + )} +
+
+ + + +
+
+ + ); +} diff --git a/blocks/chapitrage-thematique/src/chapitre-thematique/editor.scss b/blocks/chapitrage-thematique/src/chapitre-thematique/editor.scss new file mode 100644 index 0000000..e9d7036 --- /dev/null +++ b/blocks/chapitrage-thematique/src/chapitre-thematique/editor.scss @@ -0,0 +1 @@ +// THE STYLE IS HANDLED IN PARENT CHAPITRAGE THEMATIQUE BLOCK \ No newline at end of file diff --git a/blocks/chapitrage-thematique/src/chapitre-thematique/index.js b/blocks/chapitrage-thematique/src/chapitre-thematique/index.js new file mode 100644 index 0000000..b73b231 --- /dev/null +++ b/blocks/chapitrage-thematique/src/chapitre-thematique/index.js @@ -0,0 +1,25 @@ +import { registerBlockType } from "@wordpress/blocks"; +import "./style.scss"; +import metadata from "./block.json"; + +import Edit from "./edit"; +import Save from "./save"; + +import { navigation } from "@wordpress/icons"; + +registerBlockType(metadata.name, { + title: metadata.title, + icon: { + foreground: "#DF1E1E", + src: ( + + + + ), + }, + + supports: metadata.supports, + attributes: metadata.attributes, + edit: Edit, + save: Save, +}); diff --git a/blocks/chapitrage-thematique/src/chapitre-thematique/save.js b/blocks/chapitrage-thematique/src/chapitre-thematique/save.js new file mode 100644 index 0000000..7975d09 --- /dev/null +++ b/blocks/chapitrage-thematique/src/chapitre-thematique/save.js @@ -0,0 +1,22 @@ +import { useBlockProps, RichText, InnerBlocks } from "@wordpress/block-editor"; + +export default function save({ attributes }) { + const { chapterTitle, chapterDescription, chapterImageUrl, chapterImageAlt } = + attributes; + return ( +
+
+ {chapterImageUrl && {chapterImageAlt}} +
+
+ + + +
+
+ ); +} diff --git a/blocks/chapitrage-thematique/src/chapitre-thematique/style.scss b/blocks/chapitrage-thematique/src/chapitre-thematique/style.scss new file mode 100644 index 0000000..8a508f2 --- /dev/null +++ b/blocks/chapitrage-thematique/src/chapitre-thematique/style.scss @@ -0,0 +1 @@ +// THE STYLE IS HANDLED IN PARENT CHAPITRAGE THEMATIQUE BLOCK diff --git a/blocks/chapitrage-thematique/src/edit.js b/blocks/chapitrage-thematique/src/edit.js index db2a6f9..86268c1 100644 --- a/blocks/chapitrage-thematique/src/edit.js +++ b/blocks/chapitrage-thematique/src/edit.js @@ -1,27 +1,28 @@ import { __ } from "@wordpress/i18n"; import "./editor.scss"; +import "./chapitre-thematique"; -import { - useBlockProps, - RichText, - BlockControls, -} from "@wordpress/block-editor"; - -export default function Edit() { +import { useBlockProps, RichText, InnerBlocks } from "@wordpress/block-editor"; +import { MediaReplaceFlow, MediaPlaceholder } from "@wordpress/block-editor"; +import { ToolbarGroup, ToolbarButton } from "@wordpress/components"; +import { trash } from "@wordpress/icons"; +export default function Edit({ + attributes, + setAttributes, + clientId, + ...props +}) { return ( -
- setAttributes({ textContent: value })} - value={textContent} - tagName="p" - className="aside-content" - placeholder="Ajoutez votre texte ici" - /> - {__("Multiblocks – salut from the editor!", "multiblocks")} -
+ <> +
+ +
+ ); } diff --git a/blocks/chapitrage-thematique/src/editor.scss b/blocks/chapitrage-thematique/src/editor.scss index 0ba9f21..e69de29 100644 --- a/blocks/chapitrage-thematique/src/editor.scss +++ b/blocks/chapitrage-thematique/src/editor.scss @@ -1,9 +0,0 @@ -/** - * The following styles get applied inside the editor only. - * - * Replace them with your own styles or remove the file completely. - */ - -.wp-block-create-block-multiblocks { - border: 1px dotted #f00; -} diff --git a/blocks/chapitrage-thematique/src/lien-chapitre/OptionsSelectControl.js b/blocks/chapitrage-thematique/src/lien-chapitre/OptionsSelectControl.js new file mode 100644 index 0000000..42ba31b --- /dev/null +++ b/blocks/chapitrage-thematique/src/lien-chapitre/OptionsSelectControl.js @@ -0,0 +1,158 @@ +import { __ } from "@wordpress/i18n"; +import { InspectorControls } from "@wordpress/block-editor"; +import { + PanelBody, + SelectControl, + ComboboxControl, +} from "@wordpress/components"; +import "./editor.scss"; +import { useSelect } from "@wordpress/data"; +import { useEffect, useState } from "@wordpress/element"; +import { decodeEntities } from "@wordpress/html-entities"; + +export default function OptionsSelectControl({ + setAttributes, + chapterLinkRelatedPostId, +}) { + let [relatedQuestionPages, setRelatedQuestionPages] = useState(null); + let [childTermsIdArray, setChildTermsIdArray] = useState(null); + + const lang = getAdminLanguageFromCookie("wp-wpml_current_language"); + + function getAdminLanguageFromCookie(c_name) { + var c_value = document.cookie, + c_start = c_value.indexOf(" " + c_name + "="); + if (c_start == -1) c_start = c_value.indexOf(c_name + "="); + if (c_start == -1) { + c_value = null; + } else { + c_start = c_value.indexOf("=", c_start) + 1; + var c_end = c_value.indexOf(";", c_start); + if (c_end == -1) { + c_end = c_value.length; + } + c_value = unescape(c_value.substring(c_start, c_end)); + } + return c_value; + } + + function handleRelatedPostChange(postId) { + setAttributes({ chapterLinkRelatedPostId: Number(postId) }); + } + + function buildTaxChildrenIdArray(childrenArray) { + return childrenArray.map((item) => item.id); + } + + function buildSelectOptions(relatedPossiblePages) { + let options = []; + if (relatedPossiblePages) { + options.push({ value: 0, label: "Sélectionnez une page" }); + relatedPossiblePages.forEach((page) => { + options.push({ + value: page.id, + label: decodeEntities(page.title.rendered), + }); + }); + } else { + options.push({ value: 0, label: "Pas encore de questions..." }); + } + return options; + } + + // GET TAXONOMIES INOFRMATION + let postTaxonomies = useSelect((select) => + select("core/editor").getCurrentPostAttribute("thematiques") + ); + + // GET THE CURRENT TAXONOMY AND FIND THE PARENT OBJECT + let postMainTaxonomy = useSelect( + (select) => + select("core").getEntityRecord( + "taxonomy", + "thematiques", + postTaxonomies[0] + ), + [postTaxonomies] + ); + let postParentTaxonomy = useSelect( + (select) => { + if (postMainTaxonomy && postMainTaxonomy.parent) { + return select("core").getEntityRecord( + "taxonomy", + "thematiques", + postMainTaxonomy.parent + ); + } + return null; + }, + [postMainTaxonomy] + ); + let currentGeneralThematique = postParentTaxonomy ?? postMainTaxonomy ?? null; + + // GET THE PARENT TAX CHILDREN + let childTerms = useSelect((select) => { + if (currentGeneralThematique) { + return select("core").getEntityRecords("taxonomy", "thematiques", { + parent: currentGeneralThematique.id, + }); + } + return null; + }); + + // BUILD AN ARRAY OF CHILDREN TAXONOMIES ID AND PUT IT IN THE STATE + useEffect(() => { + if (childTerms) { + setChildTermsIdArray(buildTaxChildrenIdArray(childTerms)); + } + }, [childTerms]); + + // GET OPTIONS FOR RELATED POSSIBLE PAGES ACCORDING TO CURRENT TAXONOMY CHILDREN ID ARRAY + const relatedPossiblePages = useSelect((select) => { + if (childTermsIdArray) { + let query = { + status: "publish", + per_page: -1, + lang: lang, + thematiques: childTermsIdArray, + }; + return select("core").getEntityRecords("postType", "conseils", query); + } + return null; + }); + + useEffect(() => { + if (relatedPossiblePages) { + setRelatedQuestionPages(buildSelectOptions(relatedPossiblePages)); + } + }, [relatedPossiblePages]); + + let panelTitle = postParentTaxonomy + ? "Conseils " + postParentTaxonomy.name + : postMainTaxonomy + ? "Conseils " + postMainTaxonomy.name + : null; + + return ( + + + {/* handleRelatedPostChange(e)} + /> */} + {relatedQuestionPages && ( + handleRelatedPostChange(e)} + options={relatedQuestionPages} + value={chapterLinkRelatedPostId} + /> + )} + + + ); +} diff --git a/blocks/chapitrage-thematique/src/lien-chapitre/block.json b/blocks/chapitrage-thematique/src/lien-chapitre/block.json new file mode 100644 index 0000000..8441d19 --- /dev/null +++ b/blocks/chapitrage-thematique/src/lien-chapitre/block.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 2, + "name": "homegrade-content-blocks/lien-chapitre", + "version": "0.1.0", + "title": "Lien de chapitre", + "category": "homegrade-blocks", + "description": "Pour insérer des liens dans un chapitre thématique", + "supports": { + "html": false + }, + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "style": "file:./style-index.css", + "attributes": { + "chapterLinkTitle": { + "type": "string", + "default": "" + }, + "chapterLinkDescription": { + "type": "string", + "default": "" + }, + "chapterLinkRelatedPostId": { + "type": "number" + }, + "chapterLinkRelatedPostUrl": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/blocks/chapitrage-thematique/src/lien-chapitre/edit.js b/blocks/chapitrage-thematique/src/lien-chapitre/edit.js new file mode 100644 index 0000000..89ee5a0 --- /dev/null +++ b/blocks/chapitrage-thematique/src/lien-chapitre/edit.js @@ -0,0 +1,85 @@ +import { __ } from "@wordpress/i18n"; +// import { useBlockProps } from "@wordpress/block-editor"; +import "./editor.scss"; +import { + PanelBody, + FocalPointPicker, + TextControl, + TextareaControl, +} from "@wordpress/components"; +import { useSelect } from "@wordpress/data"; + +import { + useBlockProps, + RichText, + InspectorControls, + InnerBlocks, +} from "@wordpress/block-editor"; + +import OptionsSelectControl from "./OptionsSelectControl"; + +export default function Edit({ attributes, setAttributes, ...props }) { + let { + chapterLinkTitle, + chapterLinkDescription, + chapterLinkRelatedPostId, + chapterLinkRelatedPostUrl, + } = attributes; + + let currentRelatedPostConseil = useSelect((select) => + select("core").getEntityRecord( + "postType", + "conseils", + chapterLinkRelatedPostId + ) + ); + + if ( + currentRelatedPostConseil && + currentRelatedPostConseil.link !== chapterLinkRelatedPostUrl + ) { + console.log(chapterLinkRelatedPostUrl); + console.log(currentRelatedPostConseil.link); + setAttributes({ + chapterLinkRelatedPostUrl: currentRelatedPostConseil.link, + }); + } + + function onChangeChapterLinkTitle(chapterLinkTitle) { + setAttributes({ chapterLinkTitle }); + } + function onChangeChapterLinkDescription(chapterLinkDescription) { + setAttributes({ chapterLinkDescription }); + } + return ( + <> + +
+ + + {chapterLinkRelatedPostUrl && ( + {chapterLinkRelatedPostUrl} + )} +
+ + ); +} diff --git a/blocks/chapitrage-thematique/src/lien-chapitre/editor.scss b/blocks/chapitrage-thematique/src/lien-chapitre/editor.scss new file mode 100644 index 0000000..e9d7036 --- /dev/null +++ b/blocks/chapitrage-thematique/src/lien-chapitre/editor.scss @@ -0,0 +1 @@ +// THE STYLE IS HANDLED IN PARENT CHAPITRAGE THEMATIQUE BLOCK \ No newline at end of file diff --git a/blocks/chapitrage-thematique/src/lien-chapitre/index.js b/blocks/chapitrage-thematique/src/lien-chapitre/index.js new file mode 100644 index 0000000..4eeeda2 --- /dev/null +++ b/blocks/chapitrage-thematique/src/lien-chapitre/index.js @@ -0,0 +1,33 @@ +import { registerBlockType } from "@wordpress/blocks"; +import "./style.scss"; +import metadata from "./block.json"; + +import Edit from "./edit"; +import Save from "./save"; + +import { navigation } from "@wordpress/icons"; + +registerBlockType(metadata.name, { + title: metadata.title, + icon: { + foreground: "#DF1E1E", + src: ( + + + + ), + }, + + supports: metadata.supports, + attributes: metadata.attributes, + edit: Edit, + save: Save, +}); diff --git a/blocks/chapitrage-thematique/src/lien-chapitre/save.js b/blocks/chapitrage-thematique/src/lien-chapitre/save.js new file mode 100644 index 0000000..21a190c --- /dev/null +++ b/blocks/chapitrage-thematique/src/lien-chapitre/save.js @@ -0,0 +1,28 @@ +import { useBlockProps, RichText, InnerBlocks } from "@wordpress/block-editor"; + +export default function save({ attributes }) { + let { chapterLinkTitle, chapterLinkDescription, chapterLinkRelatedPostUrl } = + attributes; + + return ( +
+ + + {chapterLinkRelatedPostUrl && ( + {chapterLinkRelatedPostUrl} + )} +
+ ); +} diff --git a/blocks/chapitrage-thematique/src/lien-chapitre/style.scss b/blocks/chapitrage-thematique/src/lien-chapitre/style.scss new file mode 100644 index 0000000..8a508f2 --- /dev/null +++ b/blocks/chapitrage-thematique/src/lien-chapitre/style.scss @@ -0,0 +1 @@ +// THE STYLE IS HANDLED IN PARENT CHAPITRAGE THEMATIQUE BLOCK diff --git a/blocks/chapitrage-thematique/src/save.js b/blocks/chapitrage-thematique/src/save.js index a4b8fa0..0eeb48d 100644 --- a/blocks/chapitrage-thematique/src/save.js +++ b/blocks/chapitrage-thematique/src/save.js @@ -1,14 +1,13 @@ -import { useBlockProps } from "@wordpress/block-editor"; -import { useBlockProps, RichText } from "@wordpress/block-editor"; +import { useBlockProps, RichText, InnerBlocks } from "@wordpress/block-editor"; -export default function save() { +export default function save({ attributes }) { return (
- {"Multiblocks – salut from the saved content!"} +
); } diff --git a/blocks/chapitrage-thematique/src/style.scss b/blocks/chapitrage-thematique/src/style.scss index 7971c73..d3ee6e4 100644 --- a/blocks/chapitrage-thematique/src/style.scss +++ b/blocks/chapitrage-thematique/src/style.scss @@ -1,12 +1,24 @@ -/** - * The following styles get applied both on the front of your site - * and in the editor. - * - * Replace them with your own styles or remove the file completely. - */ +.homegrade-blocks-chapitrage-thematique { + .homegrade-blocks-chapitre-thematique { + padding-left: 100px; + display: flex; -.wp-block-create-block-multiblocks { - background-color: #21759b; - color: #fff; - padding: 2px; + &__cover { + max-width: 250px; + display: flex; + justify-content: center; + align-items: center; + } + .block-editor-media-placeholder { + margin-bottom: 30px; + } + } + .homegrade-blocks-lien-chapitre { + padding: 20px; + margin: 40px 0; + box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px; + &__title { + font-weight: 700; + } + } }