From fa025983908d04d053efd9f93cb6d8203fcb3133 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Wed, 13 Dec 2023 16:35:33 +0100 Subject: [PATCH] reordering words alphabetically + addiong global dynamic accordeon classes --- blocks/vocabulaire-summary/build/block.json | 1 - .../build/frontend.asset.php | 1 - blocks/vocabulaire-summary/build/frontend.js | 51 ---------- .../vocabulaire-summary/build/frontend.js.map | 1 - .../vocabulaire-summary/build/index.asset.php | 2 +- blocks/vocabulaire-summary/build/index.js | 8 +- blocks/vocabulaire-summary/build/index.js.map | 2 +- blocks/vocabulaire-summary/build/render.php | 12 ++- .../vocabulaire-summary/build/style-index.css | 53 ---------- .../build/style-index.css.map | 2 +- blocks/vocabulaire-summary/src/block.json | 1 - blocks/vocabulaire-summary/src/edit.js | 10 +- blocks/vocabulaire-summary/src/frontend.js | 57 ----------- blocks/vocabulaire-summary/src/render.php | 12 ++- blocks/vocabulaire-summary/src/style.scss | 99 +++++++++---------- 15 files changed, 74 insertions(+), 238 deletions(-) delete mode 100644 blocks/vocabulaire-summary/build/frontend.asset.php delete mode 100644 blocks/vocabulaire-summary/build/frontend.js delete mode 100644 blocks/vocabulaire-summary/build/frontend.js.map delete mode 100644 blocks/vocabulaire-summary/src/frontend.js diff --git a/blocks/vocabulaire-summary/build/block.json b/blocks/vocabulaire-summary/build/block.json index 16b11fa..ab775b5 100644 --- a/blocks/vocabulaire-summary/build/block.json +++ b/blocks/vocabulaire-summary/build/block.json @@ -16,7 +16,6 @@ }, "textdomain": "homegrade-blocks", "editorScript": "file:./index.js", - "viewScript": "file:./frontend.js", "editorStyle": "file:./index.css", "style": "file:./style-index.css", "render": "file:./render.php", diff --git a/blocks/vocabulaire-summary/build/frontend.asset.php b/blocks/vocabulaire-summary/build/frontend.asset.php deleted file mode 100644 index 8b1905f..0000000 --- a/blocks/vocabulaire-summary/build/frontend.asset.php +++ /dev/null @@ -1 +0,0 @@ - array(), 'version' => '2d7b588bd723edf3035b'); diff --git a/blocks/vocabulaire-summary/build/frontend.js b/blocks/vocabulaire-summary/build/frontend.js deleted file mode 100644 index 7f6ec8d..0000000 --- a/blocks/vocabulaire-summary/build/frontend.js +++ /dev/null @@ -1,51 +0,0 @@ -/******/ (() => { // webpackBootstrap -var __webpack_exports__ = {}; -/*!*************************!*\ - !*** ./src/frontend.js ***! - \*************************/ -window.addEventListener("DOMContentLoaded", event => { - // GETTING ELEMENTS FROM THE DOM - const vocabulaireSummary = document.querySelector(".homegrade-blocks-vocabulaire-summary"); - const wordsDetails = vocabulaireSummary.querySelectorAll("details"); - function openAccordion(wordDetail) { - let contentDefinitionWrapper = wordDetail.querySelector(".homegrade-blocks-vocabulaire-summary__content-wrapper"); - let contentDefinitionParagraph = wordDetail.querySelector(".homegrade-blocks-vocabulaire-summary__content"); - wordDetail.setAttribute("open", "true"); - wordDetail.setAttribute("is_opening", ""); - contentDefinitionWrapper.style.height = contentDefinitionParagraph.offsetHeight + "px"; - // remove is opening after css transition - - wordDetail.addEventListener("transitionend", () => { - wordDetail.removeAttribute("is_opening"); - }); - } - function closeAccordion(wordDetail) { - let contentDefinitionWrapper = wordDetail.querySelector(".homegrade-blocks-vocabulaire-summary__content-wrapper"); - contentDefinitionWrapper.style.height = "0px"; - setTimeout(() => { - wordDetail.removeAttribute("open"); - }, 300); - } - // HANDLING CLICK - function toggleActive(wordDetail) { - let isOpen = wordDetail.getAttribute("open"); - let isOpening = wordDetail.getAttribute("is_opening"); - if (isOpen == null && isOpening == null) { - openAccordion(wordDetail); - } - if (isOpen == "true") { - closeAccordion(wordDetail); - } - } - - // HANDLING CLICK - Array.from(wordsDetails).forEach(wordDetail => { - wordDetail.addEventListener("click", event => { - event.preventDefault(); - toggleActive(wordDetail); - }); - }); -}); -/******/ })() -; -//# sourceMappingURL=frontend.js.map \ No newline at end of file diff --git a/blocks/vocabulaire-summary/build/frontend.js.map b/blocks/vocabulaire-summary/build/frontend.js.map deleted file mode 100644 index 6b85cc3..0000000 --- a/blocks/vocabulaire-summary/build/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,EAAE;MACxCd,aAAa,CAACC,UAAU,CAAC;IAC1B;IACA,IAAIW,MAAM,IAAI,MAAM,EAAE;MACrBH,cAAc,CAACR,UAAU,CAAC;IAC3B;EACD;;EAEA;EACAc,KAAK,CAACC,IAAI,CAAClB,YAAY,CAAC,CAACmB,OAAO,CAAEhB,UAAU,IAAK;IAChDA,UAAU,CAACR,gBAAgB,CAAC,OAAO,EAAGC,KAAK,IAAK;MAC/CA,KAAK,CAACwB,cAAc,CAAC,CAAC;MACtBP,YAAY,CAACV,UAAU,CAAC;IACzB,CAAC,CAAC;EACH,CAAC,CAAC;AACH,CAAC,CAAC,C","sources":["webpack://vocabulaire-summary/./src/frontend.js"],"sourcesContent":["window.addEventListener(\"DOMContentLoaded\", (event) => {\r\n\t// GETTING ELEMENTS FROM THE DOM\r\n\tconst vocabulaireSummary = document.querySelector(\r\n\t\t\".homegrade-blocks-vocabulaire-summary\"\r\n\t);\r\n\tconst wordsDetails = vocabulaireSummary.querySelectorAll(\"details\");\r\n\r\n\tfunction openAccordion(wordDetail) {\r\n\t\tlet contentDefinitionWrapper = wordDetail.querySelector(\r\n\t\t\t\".homegrade-blocks-vocabulaire-summary__content-wrapper\"\r\n\t\t);\r\n\t\tlet contentDefinitionParagraph = wordDetail.querySelector(\r\n\t\t\t\".homegrade-blocks-vocabulaire-summary__content\"\r\n\t\t);\r\n\t\twordDetail.setAttribute(\"open\", \"true\");\r\n\t\twordDetail.setAttribute(\"is_opening\", \"\");\r\n\r\n\t\tcontentDefinitionWrapper.style.height =\r\n\t\t\tcontentDefinitionParagraph.offsetHeight + \"px\";\r\n\t\t// remove is opening after css transition\r\n\r\n\t\twordDetail.addEventListener(\"transitionend\", () => {\r\n\t\t\twordDetail.removeAttribute(\"is_opening\");\r\n\t\t});\r\n\t}\r\n\tfunction closeAccordion(wordDetail) {\r\n\t\tlet contentDefinitionWrapper = wordDetail.querySelector(\r\n\t\t\t\".homegrade-blocks-vocabulaire-summary__content-wrapper\"\r\n\t\t);\r\n\r\n\t\tcontentDefinitionWrapper.style.height = \"0px\";\r\n\r\n\t\tsetTimeout(() => {\r\n\t\t\twordDetail.removeAttribute(\"open\");\r\n\t\t}, 300);\r\n\t}\r\n\t// HANDLING CLICK\r\n\tfunction toggleActive(wordDetail) {\r\n\t\tlet isOpen = wordDetail.getAttribute(\"open\");\r\n\t\tlet isOpening = wordDetail.getAttribute(\"is_opening\");\r\n\r\n\t\tif (isOpen == null && isOpening == null) {\r\n\t\t\topenAccordion(wordDetail);\r\n\t\t}\r\n\t\tif (isOpen == \"true\") {\r\n\t\t\tcloseAccordion(wordDetail);\r\n\t\t}\r\n\t}\r\n\r\n\t// HANDLING CLICK\r\n\tArray.from(wordsDetails).forEach((wordDetail) => {\r\n\t\twordDetail.addEventListener(\"click\", (event) => {\r\n\t\t\tevent.preventDefault();\r\n\t\t\ttoggleActive(wordDetail);\r\n\t\t});\r\n\t});\r\n});\r\n"],"names":["window","addEventListener","event","vocabulaireSummary","document","querySelector","wordsDetails","querySelectorAll","openAccordion","wordDetail","contentDefinitionWrapper","contentDefinitionParagraph","setAttribute","style","height","offsetHeight","removeAttribute","closeAccordion","setTimeout","toggleActive","isOpen","getAttribute","isOpening","Array","from","forEach","preventDefault"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/vocabulaire-summary/build/index.asset.php b/blocks/vocabulaire-summary/build/index.asset.php index 18bb69f..f01ab24 100644 --- a/blocks/vocabulaire-summary/build/index.asset.php +++ b/blocks/vocabulaire-summary/build/index.asset.php @@ -1 +1 @@ - array('react', 'wp-block-editor', 'wp-blocks', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '4d48acb9717b060f5b98'); + array('react', 'wp-block-editor', 'wp-blocks', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '7dbd2ffcc4b8c84acf7f'); diff --git a/blocks/vocabulaire-summary/build/index.js b/blocks/vocabulaire-summary/build/index.js index 09017ef..92ee839 100644 --- a/blocks/vocabulaire-summary/build/index.js +++ b/blocks/vocabulaire-summary/build/index.js @@ -205,10 +205,12 @@ function Edit({ className: "open-close-cta", alt: "" }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "homegrade-blocks-vocabulaire-summary__content-wrapper" + className: "homegrade-blocks-vocabulaire-summary__content-wrapper homegrade-dynamic-accordeon__content-wrapper" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + class: " homegrade-dynamic-accordeon__content" }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", { className: "homegrade-blocks-vocabulaire-summary__content" - }, elem.tooltipDefinition))))); + }, elem.tooltipDefinition)))))); } /***/ }), @@ -336,7 +338,7 @@ module.exports = window["wp"]["i18n"]; \************************/ /***/ ((module) => { -module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/vocabulaire-summary","version":"0.1.0","title":"Vocabulaire de la fiche","category":"homegrade-blocks","icon":{"foreground":"#DF1E1E","src":"testimonial"},"description":"Pour afficher tout le vocabulaire contenu dans la fiche","supports":{"html":false,"multiple":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","viewScript":"file:./frontend.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","attributes":{"tooltipWords":{"type":"array","default":[]}}}'); +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/vocabulaire-summary","version":"0.1.0","title":"Vocabulaire de la fiche","category":"homegrade-blocks","icon":{"foreground":"#DF1E1E","src":"testimonial"},"description":"Pour afficher tout le vocabulaire contenu dans la fiche","supports":{"html":false,"multiple":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","attributes":{"tooltipWords":{"type":"array","default":[]}}}'); /***/ }) diff --git a/blocks/vocabulaire-summary/build/index.js.map b/blocks/vocabulaire-summary/build/index.js.map index 1c3b122..6b08456 100644 --- a/blocks/vocabulaire-summary/build/index.js.map +++ b/blocks/vocabulaire-summary/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;AAAA;AACA,sBAAsB,sEAAsE,gBAAgB,sBAAsB,OAAO,2BAA2B,0BAA0B,yDAAyD,iCAAiC,kBAAkB;AAC3Q;AAC/B;AACA,sBAAsB,gDAAmB;AACzC;AACA;AACA;AACA,GAAG,yCAAyC,gDAAmB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AAC4C;AAC5C,iEAAe,oBAAoB,wbAAwb;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnBtb;AACmB;AACjC;AACgC;AACT;AACW;AACV;AACM;AACJ;AAElC,SAASS,IAAIA,CAAC;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAE;EAC3D,IAAI;IAAEC;EAAa,CAAC,GAAGF,UAAU;EACjC,IAAI,CAACG,eAAe,EAAEC,kBAAkB,CAAC,GAAGX,4DAAQ,CAAC,KAAK,CAAC;EAE3D,SAASY,wBAAwBA,CAAC;IAAEC;EAAG,CAAC,EAAE;IACzC,MAAM;MAAEC,MAAM;MAAEC;IAAY,CAAC,GAAGhB,qEAAe,CAC9C,UAAU,EACV,aAAa,EACbc,EACD,CAAC;IAED,IAAIE,WAAW,EAAE;MAChB,OAAO,YAAY;IACpB;IACA,IAAI,CAACD,MAAM,EAAE;MACZ,OAAO,YAAY;IACpB;IACA,OAAOA,MAAM,CAACE,IAAI;EACnB;EACA,SAASC,oBAAoBA,CAACJ,EAAE,EAAE;IACjC,MAAM;MAAEC,MAAM;MAAEC;IAAY,CAAC,GAAGhB,qEAAe,CAC9C,UAAU,EACV,aAAa,EACbc,EACD,CAAC;IAED,IAAIE,WAAW,EAAE;MAChB,OAAO,YAAY;IACpB;IACA,IAAI,CAACD,MAAM,EAAE;MACZ,OAAO,YAAY;IACpB;IACA,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;;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://vocabulaire-summary/./src/img/chevron_down.svg","webpack://vocabulaire-summary/./src/edit.js","webpack://vocabulaire-summary/./src/index.js","webpack://vocabulaire-summary/./src/editor.scss","webpack://vocabulaire-summary/./src/style.scss?75bd","webpack://vocabulaire-summary/external window \"React\"","webpack://vocabulaire-summary/external window [\"wp\",\"blockEditor\"]","webpack://vocabulaire-summary/external window [\"wp\",\"blocks\"]","webpack://vocabulaire-summary/external window [\"wp\",\"coreData\"]","webpack://vocabulaire-summary/external window [\"wp\",\"data\"]","webpack://vocabulaire-summary/external window [\"wp\",\"element\"]","webpack://vocabulaire-summary/external window [\"wp\",\"i18n\"]","webpack://vocabulaire-summary/webpack/bootstrap","webpack://vocabulaire-summary/webpack/runtime/chunk loaded","webpack://vocabulaire-summary/webpack/runtime/compat get default export","webpack://vocabulaire-summary/webpack/runtime/define property getters","webpack://vocabulaire-summary/webpack/runtime/hasOwnProperty shorthand","webpack://vocabulaire-summary/webpack/runtime/make namespace object","webpack://vocabulaire-summary/webpack/runtime/jsonp chunk loading","webpack://vocabulaire-summary/webpack/before-startup","webpack://vocabulaire-summary/webpack/startup","webpack://vocabulaire-summary/webpack/after-startup"],"sourcesContent":["var _path;\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nimport * as React from \"react\";\nvar SvgChevronDown = function SvgChevronDown(props) {\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n xmlns: \"http://www.w3.org/2000/svg\",\n width: 11.668,\n height: 7.885\n }, props), _path || (_path = /*#__PURE__*/React.createElement(\"path\", {\n \"data-name\": \"Trac\\\\xE9 3614\",\n d: \"m1.406 1.406 4.428 5.478 4.427-5.478\",\n fill: \"none\",\n stroke: \"#000\",\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2\n })));\n};\nexport { SvgChevronDown as ReactComponent };\nexport default \"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMS42NjgiIGhlaWdodD0iNy44ODUiIHZpZXdCb3g9IjAgMCAxMS42NjggNy44ODUiPgogIDxwYXRoIGlkPSJUcmFjw6lfMzYxNCIgZGF0YS1uYW1lPSJUcmFjw6kgMzYxNCIgZD0iTTAsOC44NTUsNS40NzgsNC40MjcsMCwwIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMC4yNjEgMS40MDYpIHJvdGF0ZSg5MCkiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjIiLz4KPC9zdmc+Cg==\";","import { __ } from \"@wordpress/i18n\";\nimport { useBlockProps } from \"@wordpress/block-editor\";\nimport \"./editor.scss\";\nimport { useEntityRecord } from \"@wordpress/core-data\";\nimport { useState } from \"@wordpress/element\";\nimport { useSelect, useDispatch } from \"@wordpress/data\";\nimport { useEffect } from \"@wordpress/element\";\nimport { useEntityProp } from \"@wordpress/core-data\";\nimport chevronDown from \"./img/chevron_down.svg\";\n\nexport default function Edit({ attributes, setAttributes }) {\n\tlet { tooltipWords } = attributes;\n\tlet [hasFetchedDatas, setHasFetchedDatas] = useState(false);\n\n\tfunction CurrentThematiqueDisplay({ id }) {\n\t\tconst { record, isResolving } = useEntityRecord(\n\t\t\t\"taxonomy\",\n\t\t\t\"thematiques\",\n\t\t\tid\n\t\t);\n\n\t\tif (isResolving) {\n\t\t\treturn \"Loading...\";\n\t\t}\n\t\tif (!record) {\n\t\t\treturn \"no post...\";\n\t\t}\n\t\treturn record.name;\n\t}\n\tfunction getCurrentThematique(id) {\n\t\tconst { record, isResolving } = useEntityRecord(\n\t\t\t\"taxonomy\",\n\t\t\t\"thematiques\",\n\t\t\tid\n\t\t);\n\n\t\tif (isResolving) {\n\t\t\treturn \"Loading...\";\n\t\t}\n\t\tif (!record) {\n\t\t\treturn \"no post...\";\n\t\t}\n\t\treturn record;\n\t}\n\n\tfunction filterToolTipsArray(tooltipWords) {\n\t\tconst filteredTooltipWords = [];\n\n\t\ttooltipWords.forEach((tooltipWord) => {\n\t\t\tconst existingTooltip = filteredTooltipWords.find(\n\t\t\t\t(item) => item.tooltipID === tooltipWord.tooltipID\n\t\t\t);\n\n\t\t\tif (!existingTooltip) {\n\t\t\t\tfilteredTooltipWords.push(tooltipWord);\n\t\t\t}\n\t\t});\n\n\t\treturn filteredTooltipWords;\n\t}\n\tfunction parseContentTooltips(editorContent) {\n\t\tconst parser = new DOMParser();\n\t\tconst doc = parser.parseFromString(editorContent, \"text/html\");\n\t\tconst domTooltipWords = doc.querySelectorAll(\".tooltip-word\");\n\n\t\tconst tooltipWords = [];\n\n\t\t// Looping over tooltip words and filtering duplicates\n\t\tArray.from(domTooltipWords).forEach((tooltipWord) => {\n\t\t\tconst tooltipID = tooltipWord.getAttribute(\"data-definition-id\");\n\t\t\tconst tooltipText = tooltipWord.getAttribute(\"data-tooltip-word\");\n\t\t\tconst tooltipDefinition = tooltipWord.getAttribute(\n\t\t\t\t\"data-tooltip-definition\"\n\t\t\t);\n\n\t\t\ttooltipWords.push({\n\t\t\t\ttooltipID,\n\t\t\t\ttooltipText,\n\t\t\t\ttooltipDefinition,\n\t\t\t});\n\t\t});\n\t\treturn tooltipWords;\n\t}\n\tfunction parseBlocksTooltips(currentBlocks) {\n\t\tconst blocksTooltipWords = [];\n\t\tcurrentBlocks.forEach((block) => {\n\t\t\tif (\n\t\t\t\tblock.name === \"homegrade-content-blocks/questions-container\" &&\n\t\t\t\tblock.attributes &&\n\t\t\t\tblock.attributes.tooltipsWordsUsed &&\n\t\t\t\tblock.attributes.tooltipsWordsUsed.length > 0\n\t\t\t) {\n\t\t\t\tblock.attributes.tooltipsWordsUsed.forEach((tooltipWord) => {\n\t\t\t\t\tblocksTooltipWords.push(tooltipWord);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\treturn blocksTooltipWords;\n\t}\n\tfunction buildTooltipWords() {\n\t\tlet newParsedTooltipWords = parseContentTooltips(currentPost.content);\n\t\tlet newBlocksTooltipWords = parseBlocksTooltips(currentBlocks);\n\t\tlet allTooltipWords = [...newParsedTooltipWords, ...newBlocksTooltipWords];\n\t\tconst filteredTooltipWords = filterToolTipsArray(allTooltipWords);\n\n\t\treturn filteredTooltipWords;\n\t}\n\n\tfunction compareHasNewVocabularyWord(previousWords, newWords) {\n\t\treturn !(JSON.stringify(previousWords) === JSON.stringify(newWords));\n\t}\n\n\tconst currentPost = useSelect((select) =>\n\t\tselect(\"core/editor\").getCurrentPost()\n\t);\n\n\tconst currentBlocks = useSelect((select) =>\n\t\tselect(\"core/block-editor\").getBlocks()\n\t);\n\n\tconst currentTaxonomies = useSelect((select) =>\n\t\tselect(\"core/editor\").getCurrentPostAttribute(\"thematiques\")\n\t);\n\n\tlet currentThematique = useSelect(\n\t\t(select) =>\n\t\t\tselect(\"core\").getEntityRecord(\n\t\t\t\t\"taxonomy\",\n\t\t\t\t\"thematiques\",\n\t\t\t\tcurrentTaxonomies[0] // or currentPost.thematiques[0] works as well\n\t\t\t),\n\t\t[currentTaxonomies]\n\t);\n\tfunction getAdminLanguageFromCookie(c_name) {\n\t\tvar c_value = document.cookie,\n\t\t\tc_start = c_value.indexOf(\" \" + c_name + \"=\");\n\t\tif (c_start == -1) c_start = c_value.indexOf(c_name + \"=\");\n\t\tif (c_start == -1) {\n\t\t\tc_value = null;\n\t\t} else {\n\t\t\tc_start = c_value.indexOf(\"=\", c_start) + 1;\n\t\t\tvar c_end = c_value.indexOf(\";\", c_start);\n\t\t\tif (c_end == -1) {\n\t\t\t\tc_end = c_value.length;\n\t\t\t}\n\t\t\tc_value = unescape(c_value.substring(c_start, c_end));\n\t\t}\n\t\treturn c_value;\n\t}\n\tconst currentLang = getAdminLanguageFromCookie(\"wp-wpml_current_language\");\n\tconst localBlockName = currentLang === \"fr\" ? \"Vocabulaire\" : \"Woordenschat\";\n\tuseEffect(() => {\n\t\tif (currentPost.content && currentBlocks) {\n\t\t\tconst newTooltipWords = buildTooltipWords();\n\n\t\t\tif (compareHasNewVocabularyWord(tooltipWords, newTooltipWords)) {\n\t\t\t\tsetAttributes({ tooltipWords: newTooltipWords });\n\t\t\t}\n\t\t}\n\t}, [currentPost, currentBlocks]);\n\n\tconsole.log(__(\"bonjour\", \"homegrade-blocks\"));\n\treturn (\n\t\t\n\t\t\t

\n\t\t\t\t{localBlockName + \" — \"}\n\t\t\t\t{currentThematique && currentThematique.name\n\t\t\t\t\t? currentThematique.name\n\t\t\t\t\t: \"...pas de thématique\"}\n\t\t\t

\n\t\t\t{tooltipWords &&\n\t\t\t\ttooltipWords.map((elem) => (\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{elem.tooltipText}\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\"\"\n\t\t\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\t\t

\n\t\t\t\t\t\t\t\t{elem.tooltipDefinition}\n\t\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\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\nimport \"./style.scss\";\n\nimport Edit from \"./edit\";\n// import save from \"./save\";\nimport metadata from \"./block.json\";\n\nregisterBlockType(metadata.name, {\n\tedit: Edit,\n});\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"React\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","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[\"webpackChunkvocabulaire_summary\"] = self[\"webpackChunkvocabulaire_summary\"] || [];\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","useEntityRecord","useState","useSelect","useDispatch","useEffect","useEntityProp","chevronDown","Edit","attributes","setAttributes","tooltipWords","hasFetchedDatas","setHasFetchedDatas","CurrentThematiqueDisplay","id","record","isResolving","name","getCurrentThematique","filterToolTipsArray","filteredTooltipWords","forEach","tooltipWord","existingTooltip","find","item","tooltipID","push","parseContentTooltips","editorContent","parser","DOMParser","doc","parseFromString","domTooltipWords","querySelectorAll","Array","from","getAttribute","tooltipText","tooltipDefinition","parseBlocksTooltips","currentBlocks","blocksTooltipWords","block","tooltipsWordsUsed","length","buildTooltipWords","newParsedTooltipWords","currentPost","content","newBlocksTooltipWords","allTooltipWords","compareHasNewVocabularyWord","previousWords","newWords","JSON","stringify","select","getCurrentPost","getBlocks","currentTaxonomies","getCurrentPostAttribute","currentThematique","getEntityRecord","getAdminLanguageFromCookie","c_name","c_value","document","cookie","c_start","indexOf","c_end","unescape","substring","currentLang","localBlockName","newTooltipWords","console","log","createElement","className","map","elem","src","alt","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;AAAA;AACA,sBAAsB,sEAAsE,gBAAgB,sBAAsB,OAAO,2BAA2B,0BAA0B,yDAAyD,iCAAiC,kBAAkB;AAC3Q;AAC/B;AACA,sBAAsB,gDAAmB;AACzC;AACA;AACA;AACA,GAAG,yCAAyC,gDAAmB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AAC4C;AAC5C,iEAAe,oBAAoB,wbAAwb;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnBtb;AACmB;AACjC;AACgC;AACT;AACW;AACV;AACM;AACJ;AAElC,SAASS,IAAIA,CAAC;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAE;EAC3D,IAAI;IAAEC;EAAa,CAAC,GAAGF,UAAU;EACjC,IAAI,CAACG,eAAe,EAAEC,kBAAkB,CAAC,GAAGX,4DAAQ,CAAC,KAAK,CAAC;EAE3D,SAASY,wBAAwBA,CAAC;I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A;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://vocabulaire-summary/./src/img/chevron_down.svg","webpack://vocabulaire-summary/./src/edit.js","webpack://vocabulaire-summary/./src/index.js","webpack://vocabulaire-summary/./src/editor.scss","webpack://vocabulaire-summary/./src/style.scss","webpack://vocabulaire-summary/external window \"React\"","webpack://vocabulaire-summary/external window [\"wp\",\"blockEditor\"]","webpack://vocabulaire-summary/external window [\"wp\",\"blocks\"]","webpack://vocabulaire-summary/external window [\"wp\",\"coreData\"]","webpack://vocabulaire-summary/external window [\"wp\",\"data\"]","webpack://vocabulaire-summary/external window [\"wp\",\"element\"]","webpack://vocabulaire-summary/external window [\"wp\",\"i18n\"]","webpack://vocabulaire-summary/webpack/bootstrap","webpack://vocabulaire-summary/webpack/runtime/chunk loaded","webpack://vocabulaire-summary/webpack/runtime/compat get default export","webpack://vocabulaire-summary/webpack/runtime/define property getters","webpack://vocabulaire-summary/webpack/runtime/hasOwnProperty shorthand","webpack://vocabulaire-summary/webpack/runtime/make namespace object","webpack://vocabulaire-summary/webpack/runtime/jsonp chunk loading","webpack://vocabulaire-summary/webpack/before-startup","webpack://vocabulaire-summary/webpack/startup","webpack://vocabulaire-summary/webpack/after-startup"],"sourcesContent":["var _path;\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nimport * as React from \"react\";\nvar SvgChevronDown = function SvgChevronDown(props) {\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n xmlns: \"http://www.w3.org/2000/svg\",\n width: 11.668,\n height: 7.885\n }, props), _path || (_path = /*#__PURE__*/React.createElement(\"path\", {\n \"data-name\": \"Trac\\\\xE9 3614\",\n d: \"m1.406 1.406 4.428 5.478 4.427-5.478\",\n fill: \"none\",\n stroke: \"#000\",\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2\n })));\n};\nexport { SvgChevronDown as ReactComponent };\nexport default \"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMS42NjgiIGhlaWdodD0iNy44ODUiIHZpZXdCb3g9IjAgMCAxMS42NjggNy44ODUiPgogIDxwYXRoIGlkPSJUcmFjw6lfMzYxNCIgZGF0YS1uYW1lPSJUcmFjw6kgMzYxNCIgZD0iTTAsOC44NTUsNS40NzgsNC40MjcsMCwwIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMC4yNjEgMS40MDYpIHJvdGF0ZSg5MCkiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjIiLz4KPC9zdmc+Cg==\";","import { __ } from \"@wordpress/i18n\";\nimport { useBlockProps } from \"@wordpress/block-editor\";\nimport \"./editor.scss\";\nimport { useEntityRecord } from \"@wordpress/core-data\";\nimport { useState } from \"@wordpress/element\";\nimport { useSelect, useDispatch } from \"@wordpress/data\";\nimport { useEffect } from \"@wordpress/element\";\nimport { useEntityProp } from \"@wordpress/core-data\";\nimport chevronDown from \"./img/chevron_down.svg\";\n\nexport default function Edit({ attributes, setAttributes }) {\n\tlet { tooltipWords } = attributes;\n\tlet [hasFetchedDatas, setHasFetchedDatas] = useState(false);\n\n\tfunction CurrentThematiqueDisplay({ id }) {\n\t\tconst { record, isResolving } = useEntityRecord(\n\t\t\t\"taxonomy\",\n\t\t\t\"thematiques\",\n\t\t\tid\n\t\t);\n\n\t\tif (isResolving) {\n\t\t\treturn \"Loading...\";\n\t\t}\n\t\tif (!record) {\n\t\t\treturn \"no post...\";\n\t\t}\n\t\treturn record.name;\n\t}\n\tfunction getCurrentThematique(id) {\n\t\tconst { record, isResolving } = useEntityRecord(\n\t\t\t\"taxonomy\",\n\t\t\t\"thematiques\",\n\t\t\tid\n\t\t);\n\n\t\tif (isResolving) {\n\t\t\treturn \"Loading...\";\n\t\t}\n\t\tif (!record) {\n\t\t\treturn \"no post...\";\n\t\t}\n\t\treturn record;\n\t}\n\n\tfunction filterToolTipsArray(tooltipWords) {\n\t\tconst filteredTooltipWords = [];\n\n\t\ttooltipWords.forEach((tooltipWord) => {\n\t\t\tconst existingTooltip = filteredTooltipWords.find(\n\t\t\t\t(item) => item.tooltipID === tooltipWord.tooltipID\n\t\t\t);\n\n\t\t\tif (!existingTooltip) {\n\t\t\t\tfilteredTooltipWords.push(tooltipWord);\n\t\t\t}\n\t\t});\n\n\t\treturn filteredTooltipWords;\n\t}\n\tfunction parseContentTooltips(editorContent) {\n\t\tconst parser = new DOMParser();\n\t\tconst doc = parser.parseFromString(editorContent, \"text/html\");\n\t\tconst domTooltipWords = doc.querySelectorAll(\".tooltip-word\");\n\n\t\tconst tooltipWords = [];\n\n\t\t// Looping over tooltip words and filtering duplicates\n\t\tArray.from(domTooltipWords).forEach((tooltipWord) => {\n\t\t\tconst tooltipID = tooltipWord.getAttribute(\"data-definition-id\");\n\t\t\tconst tooltipText = tooltipWord.getAttribute(\"data-tooltip-word\");\n\t\t\tconst tooltipDefinition = tooltipWord.getAttribute(\n\t\t\t\t\"data-tooltip-definition\"\n\t\t\t);\n\n\t\t\ttooltipWords.push({\n\t\t\t\ttooltipID,\n\t\t\t\ttooltipText,\n\t\t\t\ttooltipDefinition,\n\t\t\t});\n\t\t});\n\t\treturn tooltipWords;\n\t}\n\tfunction parseBlocksTooltips(currentBlocks) {\n\t\tconst blocksTooltipWords = [];\n\t\tcurrentBlocks.forEach((block) => {\n\t\t\tif (\n\t\t\t\tblock.name === \"homegrade-content-blocks/questions-container\" &&\n\t\t\t\tblock.attributes &&\n\t\t\t\tblock.attributes.tooltipsWordsUsed &&\n\t\t\t\tblock.attributes.tooltipsWordsUsed.length > 0\n\t\t\t) {\n\t\t\t\tblock.attributes.tooltipsWordsUsed.forEach((tooltipWord) => {\n\t\t\t\t\tblocksTooltipWords.push(tooltipWord);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\treturn blocksTooltipWords;\n\t}\n\tfunction buildTooltipWords() {\n\t\tlet newParsedTooltipWords = parseContentTooltips(currentPost.content);\n\t\tlet newBlocksTooltipWords = parseBlocksTooltips(currentBlocks);\n\t\tlet allTooltipWords = [...newParsedTooltipWords, ...newBlocksTooltipWords];\n\t\tconst filteredTooltipWords = filterToolTipsArray(allTooltipWords);\n\n\t\treturn filteredTooltipWords;\n\t}\n\n\tfunction compareHasNewVocabularyWord(previousWords, newWords) {\n\t\treturn !(JSON.stringify(previousWords) === JSON.stringify(newWords));\n\t}\n\n\tconst currentPost = useSelect((select) =>\n\t\tselect(\"core/editor\").getCurrentPost()\n\t);\n\n\tconst currentBlocks = useSelect((select) =>\n\t\tselect(\"core/block-editor\").getBlocks()\n\t);\n\n\tconst currentTaxonomies = useSelect((select) =>\n\t\tselect(\"core/editor\").getCurrentPostAttribute(\"thematiques\")\n\t);\n\n\tlet currentThematique = useSelect(\n\t\t(select) =>\n\t\t\tselect(\"core\").getEntityRecord(\n\t\t\t\t\"taxonomy\",\n\t\t\t\t\"thematiques\",\n\t\t\t\tcurrentTaxonomies[0] // or currentPost.thematiques[0] works as well\n\t\t\t),\n\t\t[currentTaxonomies]\n\t);\n\tfunction getAdminLanguageFromCookie(c_name) {\n\t\tvar c_value = document.cookie,\n\t\t\tc_start = c_value.indexOf(\" \" + c_name + \"=\");\n\t\tif (c_start == -1) c_start = c_value.indexOf(c_name + \"=\");\n\t\tif (c_start == -1) {\n\t\t\tc_value = null;\n\t\t} else {\n\t\t\tc_start = c_value.indexOf(\"=\", c_start) + 1;\n\t\t\tvar c_end = c_value.indexOf(\";\", c_start);\n\t\t\tif (c_end == -1) {\n\t\t\t\tc_end = c_value.length;\n\t\t\t}\n\t\t\tc_value = unescape(c_value.substring(c_start, c_end));\n\t\t}\n\t\treturn c_value;\n\t}\n\tconst currentLang = getAdminLanguageFromCookie(\"wp-wpml_current_language\");\n\tconst localBlockName = currentLang === \"fr\" ? \"Vocabulaire\" : \"Woordenschat\";\n\tuseEffect(() => {\n\t\tif (currentPost.content && currentBlocks) {\n\t\t\tconst newTooltipWords = buildTooltipWords();\n\n\t\t\tif (compareHasNewVocabularyWord(tooltipWords, newTooltipWords)) {\n\t\t\t\tsetAttributes({ tooltipWords: newTooltipWords });\n\t\t\t}\n\t\t}\n\t}, [currentPost, currentBlocks]);\n\n\tconsole.log(__(\"bonjour\", \"homegrade-blocks\"));\n\treturn (\n\t\t\n\t\t\t

\n\t\t\t\t{localBlockName + \" — \"}\n\t\t\t\t{currentThematique && currentThematique.name\n\t\t\t\t\t? currentThematique.name\n\t\t\t\t\t: \"...pas de thématique\"}\n\t\t\t

\n\t\t\t{tooltipWords &&\n\t\t\t\ttooltipWords.map((elem) => (\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{elem.tooltipText}\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\"\"\n\t\t\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\t\t
\n\t\t\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\t\t{elem.tooltipDefinition}\n\t\t\t\t\t\t\t\t

\n\t\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\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\nimport \"./style.scss\";\n\nimport Edit from \"./edit\";\n// import save from \"./save\";\nimport metadata from \"./block.json\";\n\nregisterBlockType(metadata.name, {\n\tedit: Edit,\n});\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"React\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","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[\"webpackChunkvocabulaire_summary\"] = self[\"webpackChunkvocabulaire_summary\"] || [];\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","useEntityRecord","useState","useSelect","useDispatch","useEffect","useEntityProp","chevronDown","Edit","attributes","setAttributes","tooltipWords","hasFetchedDatas","setHasFetchedDatas","CurrentThematiqueDisplay","id","record","isResolving","name","getCurrentThematique","filterToolTipsArray","filteredTooltipWords","forEach","tooltipWord","existingTooltip","find","item","tooltipID","push","parseContentTooltips","editorContent","parser","DOMParser","doc","parseFromString","domTooltipWords","querySelectorAll","Array","from","getAttribute","tooltipText","tooltipDefinition","parseBlocksTooltips","currentBlocks","blocksTooltipWords","block","tooltipsWordsUsed","length","buildTooltipWords","newParsedTooltipWords","currentPost","content","newBlocksTooltipWords","allTooltipWords","compareHasNewVocabularyWord","previousWords","newWords","JSON","stringify","select","getCurrentPost","getBlocks","currentTaxonomies","getCurrentPostAttribute","currentThematique","getEntityRecord","getAdminLanguageFromCookie","c_name","c_value","document","cookie","c_start","indexOf","c_end","unescape","substring","currentLang","localBlockName","newTooltipWords","console","log","createElement","className","map","elem","src","alt","class","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/vocabulaire-summary/build/render.php b/blocks/vocabulaire-summary/build/render.php index 36c752c..1700aa2 100644 --- a/blocks/vocabulaire-summary/build/render.php +++ b/blocks/vocabulaire-summary/build/render.php @@ -21,17 +21,19 @@ $thematique = get_the_terms($post->ID, 'thematiques')[0]; -
+
-
-

- -

+
+
+

+ +

+
diff --git a/blocks/vocabulaire-summary/build/style-index.css b/blocks/vocabulaire-summary/build/style-index.css index 8befdfd..2488c9e 100644 --- a/blocks/vocabulaire-summary/build/style-index.css +++ b/blocks/vocabulaire-summary/build/style-index.css @@ -1,57 +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/style.scss ***! \***************************************************************************************************************************************************************************************************************************************/ -/** - * 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-vocabulaire-summary { - padding: 20px; -} -.homegrade-blocks-vocabulaire-summary details { - cursor: pointer; - padding: 20px; - background-color: white; -} -.homegrade-blocks-vocabulaire-summary details[open] summary .open-close-icon { - transform: translate(0, -50%) rotate(180deg); -} -.homegrade-blocks-vocabulaire-summary summary { - cursor: pointer; - position: relative; - margin: 0; - font-weight: bold; -} -.homegrade-blocks-vocabulaire-summary summary::marker { - content: none; -} -.homegrade-blocks-vocabulaire-summary summary .open-close-icon { - transition: transform 0.3s ease-in-out; - right: 20px; - top: 50%; - transform: translate(0, -50%); - position: absolute; - display: flex; - border: 2px solid black; - justify-content: center; - align-items: center; - border-radius: 50%; - height: 26px; - width: 26px; -} -.homegrade-blocks-vocabulaire-summary__title { - margin: 0; - padding-bottom: 20px; -} -.homegrade-blocks-vocabulaire-summary__content { - padding-top: 30px; -} -.homegrade-blocks-vocabulaire-summary__content-wrapper { - overflow: hidden; - height: 0; - transition: height 0.3s ease-in-out; -} -/*# sourceMappingURL=style-index.css.map*/ \ No newline at end of file diff --git a/blocks/vocabulaire-summary/build/style-index.css.map b/blocks/vocabulaire-summary/build/style-index.css.map index ed4985e..f3dd332 100644 --- a/blocks/vocabulaire-summary/build/style-index.css.map +++ b/blocks/vocabulaire-summary/build/style-index.css.map @@ -1 +1 @@ -{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAOA;EACC;AAAD;AACC;EACC;EACA;EACA;AACF;AACC;EACC;AACF;AACC;EACC;EACA;EACA;EACA;AACF;AAAE;EACC;AAEH;AAAE;EAEC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AACH;AAEC;EACC;EACA;AAAF;AAEC;EACC;AAAF;AAEC;EACC;EACA;EACA;AAAF,C","sources":["webpack://vocabulaire-summary/./src/style.scss"],"sourcesContent":["/**\n * The following styles get applied both on the front of your site\n * and in the editor.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.homegrade-blocks-vocabulaire-summary {\n\tpadding: 20px;\n\tdetails {\n\t\tcursor: pointer;\n\t\tpadding: 20px;\n\t\tbackground-color: white;\n\t}\n\tdetails[open] summary .open-close-icon {\n\t\ttransform: translate(0, -50%) rotate(180deg);\n\t}\n\tsummary {\n\t\tcursor: pointer;\n\t\tposition: relative;\n\t\tmargin: 0;\n\t\tfont-weight: bold;\n\t\t&::marker {\n\t\t\tcontent: none;\n\t\t}\n\t\t.open-close-icon {\n\t\t\t// transform-origin: center center;\n\t\t\ttransition: transform 0.3s ease-in-out;\n\t\t\tright: 20px;\n\t\t\ttop: 50%;\n\t\t\ttransform: translate(0, -50%);\n\t\t\tposition: absolute;\n\t\t\tdisplay: flex;\n\t\t\tborder: 2px solid black;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\t\t\tborder-radius: 50%;\n\t\t\theight: 26px;\n\t\t\twidth: 26px;\n\t\t}\n\t}\n\t&__title {\n\t\tmargin: 0;\n\t\tpadding-bottom: 20px;\n\t}\n\t&__content {\n\t\tpadding-top: 30px;\n\t}\n\t&__content-wrapper {\n\t\toverflow: hidden;\n\t\theight: 0;\n\t\ttransition: height 0.3s ease-in-out;\n\t}\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAOA;EACC;AAAD;AACC;EACC;EACA;EACA;AACF;AACC;EACC;AACF;AACC;EACC;EACA;EACA;EACA;AACF;AAAE;EACC;AAEH;AAAE;EAEC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AACH;AAEC;EACC;EACA;AAAF;AAEC;EACC;AAAF;AAEC;EACC;EACA;AAAF,C","sources":["webpack://vocabulaire-summary/./src/style.scss"],"sourcesContent":["/**\n * The following styles get applied both on the front of your site\n * and in the editor.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.homegrade-blocks-vocabulaire-summary {\n\tpadding: 20px;\n\tdetails {\n\t\tcursor: pointer;\n\t\tpadding: 20px;\n\t\tbackground-color: white;\n\t}\n\tdetails[open] summary .open-close-icon {\n\t\ttransform: translate(0, -50%) rotate(180deg);\n\t}\n\tsummary {\n\t\tcursor: pointer;\n\t\tposition: relative;\n\t\tmargin: 0;\n\t\tfont-weight: bold;\n\t\t&::marker {\n\t\t\tcontent: none;\n\t\t}\n\t\t.open-close-icon {\n\t\t\t// transform-origin: center center;\n\t\t\ttransition: transform 0.3s ease-in-out;\n\t\t\tright: 20px;\n\t\t\ttop: 50%;\n\t\t\ttransform: translate(0, -50%);\n\t\t\tposition: absolute;\n\t\t\tdisplay: flex;\n\t\t\tborder: 2px solid black;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\t\t\tborder-radius: 50%;\n\t\t\theight: 26px;\n\t\t\twidth: 26px;\n\t\t}\n\t}\n\t&__title {\n\t\tmargin: 0;\n\t\tpadding-bottom: 20px;\n\t}\n\t&__content {\n\t\tpadding-top: 30px;\n\t}\n\t&__content-wrapper {\n\t\toverflow: hidden;\n\t\ttransition: height 0.3s ease-in-out;\n\t}\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/vocabulaire-summary/src/block.json b/blocks/vocabulaire-summary/src/block.json index b4a77df..744739a 100644 --- a/blocks/vocabulaire-summary/src/block.json +++ b/blocks/vocabulaire-summary/src/block.json @@ -16,7 +16,6 @@ }, "textdomain": "homegrade-blocks", "editorScript": "file:./index.js", - "viewScript": "file:./frontend.js", "editorStyle": "file:./index.css", "style": "file:./style-index.css", "render": "file:./render.php", diff --git a/blocks/vocabulaire-summary/src/edit.js b/blocks/vocabulaire-summary/src/edit.js index c4fb0e5..3a64228 100644 --- a/blocks/vocabulaire-summary/src/edit.js +++ b/blocks/vocabulaire-summary/src/edit.js @@ -182,10 +182,12 @@ export default function Edit({ attributes, setAttributes }) { -
-

- {elem.tooltipDefinition} -

+
+
+

+ {elem.tooltipDefinition} +

+
))} diff --git a/blocks/vocabulaire-summary/src/frontend.js b/blocks/vocabulaire-summary/src/frontend.js deleted file mode 100644 index c2e83c3..0000000 --- a/blocks/vocabulaire-summary/src/frontend.js +++ /dev/null @@ -1,57 +0,0 @@ -window.addEventListener("DOMContentLoaded", (event) => { - // GETTING ELEMENTS FROM THE DOM - const vocabulaireSummary = document.querySelector( - ".homegrade-blocks-vocabulaire-summary" - ); - const wordsDetails = vocabulaireSummary.querySelectorAll("details"); - - function openAccordion(wordDetail) { - let contentDefinitionWrapper = wordDetail.querySelector( - ".homegrade-blocks-vocabulaire-summary__content-wrapper" - ); - let contentDefinitionParagraph = wordDetail.querySelector( - ".homegrade-blocks-vocabulaire-summary__content" - ); - wordDetail.setAttribute("open", "true"); - wordDetail.setAttribute("is_opening", ""); - - contentDefinitionWrapper.style.height = - contentDefinitionParagraph.offsetHeight + "px"; - // remove is opening after css transition - - wordDetail.addEventListener("transitionend", () => { - wordDetail.removeAttribute("is_opening"); - }); - } - function closeAccordion(wordDetail) { - let contentDefinitionWrapper = wordDetail.querySelector( - ".homegrade-blocks-vocabulaire-summary__content-wrapper" - ); - - contentDefinitionWrapper.style.height = "0px"; - - setTimeout(() => { - wordDetail.removeAttribute("open"); - }, 300); - } - // HANDLING CLICK - function toggleActive(wordDetail) { - let isOpen = wordDetail.getAttribute("open"); - let isOpening = wordDetail.getAttribute("is_opening"); - - if (isOpen == null && isOpening == null) { - openAccordion(wordDetail); - } - if (isOpen == "true") { - closeAccordion(wordDetail); - } - } - - // HANDLING CLICK - Array.from(wordsDetails).forEach((wordDetail) => { - wordDetail.addEventListener("click", (event) => { - event.preventDefault(); - toggleActive(wordDetail); - }); - }); -}); diff --git a/blocks/vocabulaire-summary/src/render.php b/blocks/vocabulaire-summary/src/render.php index 36c752c..1700aa2 100644 --- a/blocks/vocabulaire-summary/src/render.php +++ b/blocks/vocabulaire-summary/src/render.php @@ -21,17 +21,19 @@ $thematique = get_the_terms($post->ID, 'thematiques')[0]; -
+
-
-

- -

+
+
+

+ +

+
diff --git a/blocks/vocabulaire-summary/src/style.scss b/blocks/vocabulaire-summary/src/style.scss index ca08871..e16fa9a 100644 --- a/blocks/vocabulaire-summary/src/style.scss +++ b/blocks/vocabulaire-summary/src/style.scss @@ -1,54 +1,47 @@ -/** - * 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. - */ +// /** +// * 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-vocabulaire-summary { - padding: 20px; - details { - cursor: pointer; - padding: 20px; - background-color: white; - } - details[open] summary .open-close-icon { - transform: translate(0, -50%) rotate(180deg); - } - summary { - cursor: pointer; - position: relative; - margin: 0; - font-weight: bold; - &::marker { - content: none; - } - .open-close-icon { - // transform-origin: center center; - transition: transform 0.3s ease-in-out; - right: 20px; - top: 50%; - transform: translate(0, -50%); - position: absolute; - display: flex; - border: 2px solid black; - justify-content: center; - align-items: center; - border-radius: 50%; - height: 26px; - width: 26px; - } - } - &__title { - margin: 0; - padding-bottom: 20px; - } - &__content { - padding-top: 30px; - } - &__content-wrapper { - overflow: hidden; - height: 0; - transition: height 0.3s ease-in-out; - } -} +// .homegrade-blocks-vocabulaire-summary { +// padding: 20px; +// details { +// cursor: pointer; +// padding: 20px; +// background-color: white; +// } +// details[open] summary .open-close-icon { +// transform: translate(0, -50%) rotate(180deg); +// } +// summary { +// cursor: pointer; +// position: relative; +// margin: 0; +// font-weight: bold; +// &::marker { +// content: none; +// } +// .open-close-icon { +// // transform-origin: center center; +// transition: transform 0.3s ease-in-out; +// right: 20px; +// top: 50%; +// transform: translate(0, -50%); +// position: absolute; +// display: flex; +// border: 2px solid black; +// justify-content: center; +// align-items: center; +// border-radius: 50%; +// height: 26px; +// width: 26px; +// } +// } +// &__title { +// margin: 0; +// padding-bottom: 20px; +// } + +// }