diff --git a/blocks/questions-container/build/index.asset.php b/blocks/questions-container/build/index.asset.php index 19fddec..55aa2e7 100644 --- a/blocks/questions-container/build/index.asset.php +++ b/blocks/questions-container/build/index.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'f47ee4eb14a532a726cf'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '510a827284e76c648042'); diff --git a/blocks/questions-container/build/index.js b/blocks/questions-container/build/index.js index 40bcfec..0690082 100644 --- a/blocks/questions-container/build/index.js +++ b/blocks/questions-container/build/index.js @@ -142,7 +142,9 @@ function Edit({ if (!relatedPostsOptions) { 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)("p", null, "chargement\u2026")); } - console.log(relatedPostId); + + // console.log(relatedPostId); + 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_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__.__)("Question Relié", "homegrade-blocks__texte-fonctionnel") }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.SelectControl, { diff --git a/blocks/questions-container/build/index.js.map b/blocks/questions-container/build/index.js.map index 477feee..08e4d55 100644 --- a/blocks/questions-container/build/index.js.map +++ b/blocks/questions-container/build/index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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\",\"apiFetch\"]","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\",\"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 {\n\tuseBlockProps,\n\tRichText,\n\tBlockControls,\n\tInspectorControls,\n} from \"@wordpress/block-editor\";\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tDropdownMenu,\n\tToolbarDropdownMenu,\n\tPanelBody,\n\tTextControl,\n\tTextareaControl,\n\tToggleControl,\n\tSelectControl,\n} from \"@wordpress/components\";\nimport { useSelect } from \"@wordpress/data\"; // pour les querry\nimport \"./editor.scss\";\nimport apiFetch from \"@wordpress/api-fetch\";\nimport { useEffect, useState, RawHTML } from \"@wordpress/element\";\nimport { Autocomplete } from \"@wordpress/components\";\n\nexport default function Edit({ attributes, setAttributes }) {\n\tconst { relatedPostId, montexte } = attributes;\n\t// console.log(montexte);\n\n\tconst lang = getAdminLanguageFromCookie(\"wp-wpml_current_language\");\n\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\n\tfunction handleRelatedPostChange(postId) {\n\t\tsetAttributes({ relatedPostId: Number(postId), montexte: \"test\" });\n\t\t// console.log(typeof relatedPostId);\n\t\t// console.log(relatedPostId);\n\t\t// console.log(montexte);\n\t}\n\n\tlet [taxonomiesOptions, setTaxonomiesOptions] = useState(null);\n\tlet postTaxonomies = useSelect((select) =>\n\t\tselect(\"core/editor\").getCurrentPostAttribute(\"thematiques\")\n\t);\n\tlet postMainTaxonomy = 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\tpostTaxonomies[0]\n\t\t\t),\n\t\t[postTaxonomies]\n\t);\n\tlet postParentTaxonomy = useSelect(\n\t\t(select) => {\n\t\t\tif (postMainTaxonomy) {\n\t\t\t\treturn select(\"core\").getEntityRecord(\n\t\t\t\t\t\"taxonomy\",\n\t\t\t\t\t\"thematiques\",\n\t\t\t\t\tpostMainTaxonomy.parent\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[postMainTaxonomy]\n\t);\n\tlet currentGeneralThematique = postParentTaxonomy ?? postMainTaxonomy ?? null;\n\n\tlet relatedPostsOptions = useSelect(\n\t\t(select) => {\n\t\t\tif (postMainTaxonomy) {\n\t\t\t\treturn select(\"core\").getEntityRecords(\"postType\", \"questions\", {\n\t\t\t\t\tper_page: -1,\n\t\t\t\t\t_embed: true,\n\t\t\t\t\tthematiques: postMainTaxonomy.id,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[postMainTaxonomy]\n\t);\n\n\tlet currentRelatedPost = useSelect((select) => {\n\t\treturn select(\"core\").getEntityRecord(\n\t\t\t\"postType\",\n\t\t\t\"questions\",\n\t\t\trelatedPostId\n\t\t);\n\t});\n\n\tconst { pages } = useSelect((select) => {\n\t\tconst { getEntityRecords } = select(\"core\");\n\t\tlet query = {};\n\t\tif (postMainTaxonomy) {\n\t\t\t// Query args\n\t\t\tquery = {\n\t\t\t\tstatus: \"publish\",\n\t\t\t\tper_page: -1,\n\t\t\t\tlang: lang,\n\t\t\t\tthematiques: postMainTaxonomy ? postMainTaxonomy.id : null,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tpages: getEntityRecords(\"postType\", \"questions\", query),\n\t\t};\n\t});\n\n\t// populate options for \n\tlet options = [];\n\tif (pages) {\n\t\toptions.push({ value: 0, label: \"Select a page\" });\n\t\tpages.forEach((page) => {\n\t\t\toptions.push({ value: page.id, label: page.title.rendered });\n\t\t});\n\t} else {\n\t\toptions.push({ value: 0, label: \"Loading...\" });\n\t}\n\n\tif (postMainTaxonomy) {\n\t\t// console.log(postMainTaxonomy.id);\n\t}\n\tif (relatedPostsOptions) {\n\t\t// console.log(relatedPostsOptions);\n\t}\n\n\tif (!relatedPostsOptions) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t

chargement…

\n\t\t\t\n\t\t);\n\t}\n\n\tconsole.log(relatedPostId);\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t handleRelatedPostChange(e)}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\t{!relatedPostId && (\n\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\"Ce bloc n'est relié à aucune question. Rattachez-le à une fiche question dans la barre latérale.\",\n\t\t\t\t\t\t\t\t\"homegrade-blocks__texte-fonctionnel\"\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\n\t\t\t\t{currentRelatedPost && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t

{currentRelatedPost.title.rendered}

\n\t\t\t\t\t\t{currentRelatedPost.content.raw}\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\t{/* {relatedPostsOptions &&\n\t\t\t\t\trelatedPostsOptions.map((post) => {\n\t\t\t\t\t\treturn
  • {post.title.rendered}
  • ;\n\t\t\t\t\t})} */}\n\t\t\t
    \n\t\t\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\n\nimport \"./style.scss\";\n\nimport Edit from \"./edit\";\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[\"wp\"][\"apiFetch\"];","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\"][\"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","InspectorControls","ToolbarGroup","ToolbarButton","DropdownMenu","ToolbarDropdownMenu","PanelBody","TextControl","TextareaControl","ToggleControl","SelectControl","useSelect","apiFetch","useEffect","useState","RawHTML","Autocomplete","Edit","attributes","setAttributes","_ref","relatedPostId","montexte","lang","getAdminLanguageFromCookie","c_name","c_value","document","cookie","c_start","indexOf","c_end","length","unescape","substring","handleRelatedPostChange","postId","Number","taxonomiesOptions","setTaxonomiesOptions","postTaxonomies","select","getCurrentPostAttribute","postMainTaxonomy","getEntityRecord","postParentTaxonomy","parent","currentGeneralThematique","relatedPostsOptions","getEntityRecords","per_page","_embed","thematiques","id","currentRelatedPost","pages","query","status","options","push","value","label","forEach","page","title","rendered","createElement","Fragment","console","log","name","onChange","e","content","raw","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AAMJ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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?0339","webpack://multiblocks/./src/style.scss?75bd","webpack://multiblocks/external window [\"wp\",\"apiFetch\"]","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\",\"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 {\n\tuseBlockProps,\n\tRichText,\n\tBlockControls,\n\tInspectorControls,\n} from \"@wordpress/block-editor\";\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tDropdownMenu,\n\tToolbarDropdownMenu,\n\tPanelBody,\n\tTextControl,\n\tTextareaControl,\n\tToggleControl,\n\tSelectControl,\n} from \"@wordpress/components\";\nimport { useSelect } from \"@wordpress/data\"; // pour les querry\nimport \"./editor.scss\";\nimport apiFetch from \"@wordpress/api-fetch\";\nimport { useEffect, useState, RawHTML } from \"@wordpress/element\";\nimport { Autocomplete } from \"@wordpress/components\";\n\nexport default function Edit({ attributes, setAttributes }) {\n\tconst { relatedPostId, montexte } = attributes;\n\t// console.log(montexte);\n\n\tconst lang = getAdminLanguageFromCookie(\"wp-wpml_current_language\");\n\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\n\tfunction handleRelatedPostChange(postId) {\n\t\tsetAttributes({ relatedPostId: Number(postId), montexte: \"test\" });\n\t\t// console.log(typeof relatedPostId);\n\t\t// console.log(relatedPostId);\n\t\t// console.log(montexte);\n\t}\n\n\tlet [taxonomiesOptions, setTaxonomiesOptions] = useState(null);\n\tlet postTaxonomies = useSelect((select) =>\n\t\tselect(\"core/editor\").getCurrentPostAttribute(\"thematiques\")\n\t);\n\tlet postMainTaxonomy = 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\tpostTaxonomies[0]\n\t\t\t),\n\t\t[postTaxonomies]\n\t);\n\tlet postParentTaxonomy = useSelect(\n\t\t(select) => {\n\t\t\tif (postMainTaxonomy) {\n\t\t\t\treturn select(\"core\").getEntityRecord(\n\t\t\t\t\t\"taxonomy\",\n\t\t\t\t\t\"thematiques\",\n\t\t\t\t\tpostMainTaxonomy.parent\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[postMainTaxonomy]\n\t);\n\tlet currentGeneralThematique = postParentTaxonomy ?? postMainTaxonomy ?? null;\n\n\tlet relatedPostsOptions = useSelect(\n\t\t(select) => {\n\t\t\tif (postMainTaxonomy) {\n\t\t\t\treturn select(\"core\").getEntityRecords(\"postType\", \"questions\", {\n\t\t\t\t\tper_page: -1,\n\t\t\t\t\t_embed: true,\n\t\t\t\t\tthematiques: postMainTaxonomy.id,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[postMainTaxonomy]\n\t);\n\n\tlet currentRelatedPost = useSelect((select) => {\n\t\treturn select(\"core\").getEntityRecord(\n\t\t\t\"postType\",\n\t\t\t\"questions\",\n\t\t\trelatedPostId\n\t\t);\n\t});\n\n\tconst { pages } = useSelect((select) => {\n\t\tconst { getEntityRecords } = select(\"core\");\n\t\tlet query = {};\n\t\tif (postMainTaxonomy) {\n\t\t\t// Query args\n\t\t\tquery = {\n\t\t\t\tstatus: \"publish\",\n\t\t\t\tper_page: -1,\n\t\t\t\tlang: lang,\n\t\t\t\tthematiques: postMainTaxonomy ? postMainTaxonomy.id : null,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tpages: getEntityRecords(\"postType\", \"questions\", query),\n\t\t};\n\t});\n\n\t// populate options for \n\tlet options = [];\n\tif (pages) {\n\t\toptions.push({ value: 0, label: \"Select a page\" });\n\t\tpages.forEach((page) => {\n\t\t\toptions.push({ value: page.id, label: page.title.rendered });\n\t\t});\n\t} else {\n\t\toptions.push({ value: 0, label: \"Loading...\" });\n\t}\n\n\tif (postMainTaxonomy) {\n\t\t// console.log(postMainTaxonomy.id);\n\t}\n\tif (relatedPostsOptions) {\n\t\t// console.log(relatedPostsOptions);\n\t}\n\n\tif (!relatedPostsOptions) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t

    chargement…

    \n\t\t\t\n\t\t);\n\t}\n\n\t// console.log(relatedPostId);\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t handleRelatedPostChange(e)}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\t\t\t
    \n\t\t\t\t{!relatedPostId && (\n\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\"Ce bloc n'est relié à aucune question. Rattachez-le à une fiche question dans la barre latérale.\",\n\t\t\t\t\t\t\t\t\"homegrade-blocks__texte-fonctionnel\"\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\n\t\t\t\t{currentRelatedPost && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t

    {currentRelatedPost.title.rendered}

    \n\t\t\t\t\t\t{currentRelatedPost.content.raw}\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\t{/* {relatedPostsOptions &&\n\t\t\t\t\trelatedPostsOptions.map((post) => {\n\t\t\t\t\t\treturn
  • {post.title.rendered}
  • ;\n\t\t\t\t\t})} */}\n\t\t\t
    \n\t\t\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\n\nimport \"./style.scss\";\n\nimport Edit from \"./edit\";\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[\"wp\"][\"apiFetch\"];","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\"][\"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","InspectorControls","ToolbarGroup","ToolbarButton","DropdownMenu","ToolbarDropdownMenu","PanelBody","TextControl","TextareaControl","ToggleControl","SelectControl","useSelect","apiFetch","useEffect","useState","RawHTML","Autocomplete","Edit","attributes","setAttributes","_ref","relatedPostId","montexte","lang","getAdminLanguageFromCookie","c_name","c_value","document","cookie","c_start","indexOf","c_end","length","unescape","substring","handleRelatedPostChange","postId","Number","taxonomiesOptions","setTaxonomiesOptions","postTaxonomies","select","getCurrentPostAttribute","postMainTaxonomy","getEntityRecord","postParentTaxonomy","parent","currentGeneralThematique","relatedPostsOptions","getEntityRecords","per_page","_embed","thematiques","id","currentRelatedPost","pages","query","status","options","push","value","label","forEach","page","title","rendered","createElement","Fragment","name","onChange","e","content","raw","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/questions-container/src/edit.js b/blocks/questions-container/src/edit.js index 3b61955..e2dc45d 100644 --- a/blocks/questions-container/src/edit.js +++ b/blocks/questions-container/src/edit.js @@ -144,8 +144,6 @@ export default function Edit({ attributes, setAttributes }) { ); } - console.log(relatedPostId); - return ( <> diff --git a/blocks/vocabulaire-summary/build/block.json b/blocks/vocabulaire-summary/build/block.json index 177dc2f..df44634 100644 --- a/blocks/vocabulaire-summary/build/block.json +++ b/blocks/vocabulaire-summary/build/block.json @@ -12,12 +12,17 @@ }, "textdomain": "homegrade-blocks", "editorScript": "file:./index.js", + "script": "file:./frontend-file.js", "editorStyle": "file:./index.css", "style": "file:./style-index.css", "attributes": { "tooltipWords": { "type": "array", "default": [] + }, + "thematiqueName": { + "type": "string", + "default": "" } } } \ No newline at end of file diff --git a/blocks/vocabulaire-summary/build/frontend-file.asset.php b/blocks/vocabulaire-summary/build/frontend-file.asset.php new file mode 100644 index 0000000..ea18c47 --- /dev/null +++ b/blocks/vocabulaire-summary/build/frontend-file.asset.php @@ -0,0 +1 @@ + array(), 'version' => '092cbac030484d267cc4'); diff --git a/blocks/vocabulaire-summary/build/frontend-file.js b/blocks/vocabulaire-summary/build/frontend-file.js new file mode 100644 index 0000000..adab9a9 --- /dev/null +++ b/blocks/vocabulaire-summary/build/frontend-file.js @@ -0,0 +1,45 @@ +/******/ (() => { // webpackBootstrap +var __webpack_exports__ = {}; +/*!******************************!*\ + !*** ./src/frontend-file.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"); + contentDefinitionWrapper.style.height = contentDefinitionParagraph.offsetHeight + "px"; + } + function closeAccordion(wordDetail) { + console.log("will close"); + 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"); + if (isOpen == 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-file.js.map \ No newline at end of file diff --git a/blocks/vocabulaire-summary/build/frontend-file.js.map b/blocks/vocabulaire-summary/build/frontend-file.js.map new file mode 100644 index 0000000..73512ca --- /dev/null +++ b/blocks/vocabulaire-summary/build/frontend-file.js.map @@ -0,0 +1 @@ +{"version":3,"file":"frontend-file.js","mappings":";;;;;AAAAA,MAAM,CAACC,gBAAgB,CAAC,kBAAkB,EAAGC,KAAK,IAAK;EACtD;EACA,MAAMC,kBAAkB,GAAGC,QAAQ,CAACC,aAAa,CAChD,uCACD,CAAC;EACD,MAAMC,YAAY,GAAGH,kBAAkB,CAACI,gBAAgB,CAAC,SAAS,CAAC;EAEnE,SAASC,aAAaA,CAACC,UAAU,EAAE;IAClC,IAAIC,wBAAwB,GAAGD,UAAU,CAACJ,aAAa,CACtD,wDACD,CAAC;IACD,IAAIM,0BAA0B,GAAGF,UAAU,CAACJ,aAAa,CACxD,gDACD,CAAC;IACDI,UAAU,CAACG,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;IAEvCF,wBAAwB,CAACG,KAAK,CAACC,MAAM,GACpCH,0BAA0B,CAACI,YAAY,GAAG,IAAI;EAChD;EACA,SAASC,cAAcA,CAACP,UAAU,EAAE;IACnCQ,OAAO,CAACC,GAAG,CAAC,YAAY,CAAC;IACzB,IAAIR,wBAAwB,GAAGD,UAAU,CAACJ,aAAa,CACtD,wDACD,CAAC;IAEDK,wBAAwB,CAACG,KAAK,CAACC,MAAM,GAAG,KAAK;IAE7CK,UAAU,CAAC,MAAM;MAChBV,UAAU,CAACW,eAAe,CAAC,MAAM,CAAC;IACnC,CAAC,EAAE,GAAG,CAAC;EACR;EACA;EACA,SAASC,YAAYA,CAACZ,UAAU,EAAE;IACjC,IAAIa,MAAM,GAAGb,UAAU,CAACc,YAAY,CAAC,MAAM,CAAC;IAC5C,IAAID,MAAM,IAAI,IAAI,EAAE;MACnBd,aAAa,CAACC,UAAU,CAAC;IAC1B;IACA,IAAIa,MAAM,IAAI,MAAM,EAAE;MACrBN,cAAc,CAACP,UAAU,CAAC;IAC3B;EACD;;EAEA;EACAe,KAAK,CAACC,IAAI,CAACnB,YAAY,CAAC,CAACoB,OAAO,CAAEjB,UAAU,IAAK;IAChDA,UAAU,CAACR,gBAAgB,CAAC,OAAO,EAAGC,KAAK,IAAK;MAC/CA,KAAK,CAACyB,cAAc,CAAC,CAAC;MACtBN,YAAY,CAACZ,UAAU,CAAC;IACzB,CAAC,CAAC;EACH,CAAC,CAAC;AACH,CAAC,CAAC,C","sources":["webpack://vocabulaire-summary/./src/frontend-file.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\r\n\t\tcontentDefinitionWrapper.style.height =\r\n\t\t\tcontentDefinitionParagraph.offsetHeight + \"px\";\r\n\t}\r\n\tfunction closeAccordion(wordDetail) {\r\n\t\tconsole.log(\"will close\");\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\tif (isOpen == 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","closeAccordion","console","log","setTimeout","removeAttribute","toggleActive","isOpen","getAttribute","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 32e9b58..8c22880 100644 --- a/blocks/vocabulaire-summary/build/index.asset.php +++ b/blocks/vocabulaire-summary/build/index.asset.php @@ -1 +1 @@ - array('wp-block-editor', 'wp-blocks', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'eca7f67fbda9a9ec8501'); + array('wp-block-editor', 'wp-blocks', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'b45c406563e1d7762cf6'); diff --git a/blocks/vocabulaire-summary/build/index.css.map b/blocks/vocabulaire-summary/build/index.css.map index 8e53675..6eb2f21 100644 --- a/blocks/vocabulaire-summary/build/index.css.map +++ b/blocks/vocabulaire-summary/build/index.css.map @@ -1 +1 @@ -{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACC;AAAD,C","sources":["webpack://multiblocks/./src/editor.scss"],"sourcesContent":["/**\n * The following styles get applied inside the editor only.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.wp-block-create-block-multiblocks {\n\tborder: 1px dotted #f00;\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACC;AAAD,C","sources":["webpack://vocabulaire-summary/./src/editor.scss"],"sourcesContent":["/**\n * The following styles get applied inside the editor only.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.wp-block-create-block-multiblocks {\n\tborder: 1px dotted #f00;\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/vocabulaire-summary/build/index.js b/blocks/vocabulaire-summary/build/index.js index 58099ea..8fa7450 100644 --- a/blocks/vocabulaire-summary/build/index.js +++ b/blocks/vocabulaire-summary/build/index.js @@ -19,56 +19,115 @@ __webpack_require__.r(__webpack_exports__); /* 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 _editor_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); -/* 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_core_data__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/core-data */ "@wordpress/core-data"); +/* harmony import */ var _wordpress_core_data__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_core_data__WEBPACK_IMPORTED_MODULE_4__); +/* 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__); + + + +function CurrentThematiqueDisplay({ + id +}) { + const { + record, + isResolving + } = (0,_wordpress_core_data__WEBPACK_IMPORTED_MODULE_4__.useEntityRecord)("taxonomy", "thematiques", id); + if (isResolving) { + return "Loading..."; + } + if (!record) { + return "no post..."; + } + return record.name; +} +function getCurrentThematique(id) { + const { + record, + isResolving + } = (0,_wordpress_core_data__WEBPACK_IMPORTED_MODULE_4__.useEntityRecord)("taxonomy", "thematiques", id); + if (isResolving) { + return "Loading..."; + } + if (!record) { + return "no post..."; + } + return record; +} +function buildTooltipWords(editorContent) { + // Parsing Content + const parser = new DOMParser(); + const doc = parser.parseFromString(editorContent, "text/html"); + const domTooltipWords = doc.querySelectorAll(".tooltip-word"); + const filteredTooltipWords = []; + + // Looping over tooltip words and filtering duplicates + Array.from(domTooltipWords).forEach(tooltipWord => { + const tooltipID = tooltipWord.getAttribute("data-definition-id"); + const tooltipText = tooltipWord.getAttribute("data-tooltip-word"); + const tooltipDefinition = tooltipWord.getAttribute("data-tooltip-definition"); + const existingTooltip = filteredTooltipWords.find(item => item.tooltipID === tooltipID); + if (!existingTooltip) { + filteredTooltipWords.push({ + tooltipID, + tooltipText, + tooltipDefinition + }); + } + }); + return filteredTooltipWords; +} function Edit({ attributes, setAttributes }) { let { - tooltipWords + tooltipWords, + thematiqueName } = attributes; let [hasFetchedDatas, setHasFetchedDatas] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - console.log("#### EDITOR"); - const editorContent = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useSelect)(select => select("core/editor").getCurrentPost().content); - if (editorContent) { - const parser = new DOMParser(); - const doc = parser.parseFromString(editorContent, "text/html"); - const domTooltipWords = doc.querySelectorAll(".tooltip-word"); - const filteredTooltipWords = []; - Array.from(domTooltipWords).forEach(tooltipWord => { - const tooltipID = tooltipWord.getAttribute("data-definition-id"); - const tooltipText = tooltipWord.getAttribute("data-tooltip-word"); - const tooltipDefinition = tooltipWord.getAttribute("data-tooltip-definition"); - const existingTooltip = filteredTooltipWords.find(item => item.tooltipID === tooltipID); - if (!existingTooltip) { - filteredTooltipWords.push({ - tooltipID, - tooltipText, - tooltipDefinition - }); - } - }); - if (!hasFetchedDatas) { - setAttributes({ - tooltipWords: filteredTooltipWords - }); - setHasFetchedDatas(true); - } + const currentPost = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core/editor").getCurrentPost()); + const currentTaxonomies = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core/editor").getCurrentPostAttribute("thematiques")); + let fetchedCurrentThematique = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core").getEntityRecord("taxonomy", "thematiques", currentTaxonomies[0] // or currentPost.thematiques[0] works as well + ), [currentTaxonomies]); + if (!currentPost || !currentPost.content) { + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", null, "Loading..."); } + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (currentPost.content) { + let newTooltipWords = buildTooltipWords(currentPost.content); + setAttributes({ + tooltipWords: newTooltipWords + }); + } + }, [currentPost]); + (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!fetchedCurrentThematique) return; + setAttributes({ + thematiqueName: fetchedCurrentThematique.name + }); + }, [fetchedCurrentThematique, currentPost]); return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", { ...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)() - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", null, "Vocabulaire"), tooltipWords && tooltipWords.map(elem => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("details", { - class: " question" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("summary", null, elem.tooltipText, " "), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - class: "content" - }, elem.tooltipDefinition)))); + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", { + className: "homegrade-blocks-vocabulaire-summary__title" + }, "Vocabulaire \u2014 ", thematiqueName), tooltipWords && tooltipWords.map(elem => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("details", { + className: " question" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("summary", { + onClick: () => { + alert("hey"); + } + }, elem.tooltipText, " "), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "homegrade-blocks-vocabulaire-summary__content-wrapper" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", { + className: "homegrade-blocks-vocabulaire-summary__content" + }, elem.tooltipDefinition))))); } /***/ }), @@ -148,15 +207,27 @@ function save({ setAttributes }) { let { - tooltipWords + tooltipWords, + thematiqueName } = attributes; + function handleClick() { + alert("hey"); + } return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", { - ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save() - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", null, "Vocabulaire"), tooltipWords && tooltipWords.map(elem => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("details", { + ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({ + className: `vocabulaire-summary` + }) + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", { + className: "homegrade-blocks-vocabulaire-summary__title" + }, "Vocabulaire \u2014 ", thematiqueName), " ", tooltipWords && tooltipWords.map(elem => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("details", { class: " question" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("summary", null, elem.tooltipText, " "), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - class: "content" - }, elem.tooltipDefinition)))); + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("summary", { + onClick: handleClick + }, elem.tooltipText, " "), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + className: "homegrade-blocks-vocabulaire-summary__content-wrapper" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", { + className: "homegrade-blocks-vocabulaire-summary__content" + }, elem.tooltipDefinition))))); } /***/ }), @@ -205,6 +276,16 @@ module.exports = window["wp"]["blocks"]; /***/ }), +/***/ "@wordpress/core-data": +/*!**********************************!*\ + !*** external ["wp","coreData"] ***! + \**********************************/ +/***/ ((module) => { + +module.exports = window["wp"]["coreData"]; + +/***/ }), + /***/ "@wordpress/data": /*!******************************!*\ !*** external ["wp","data"] ***! @@ -241,7 +322,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":"testimonial","description":"Pour afficher tout le vocabulaire contenu dans la fiche","supports":{"html":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","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":"testimonial","description":"Pour afficher tout le vocabulaire contenu dans la fiche","supports":{"html":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","script":"file:./frontend-file.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"tooltipWords":{"type":"array","default":[]},"thematiqueName":{"type":"string","default":""}}}'); /***/ }) @@ -400,7 +481,7 @@ module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json /******/ return __webpack_require__.O(result); /******/ } /******/ -/******/ var chunkLoadingGlobal = self["webpackChunkmultiblocks"] = self["webpackChunkmultiblocks"] || []; +/******/ var chunkLoadingGlobal = self["webpackChunkvocabulaire_summary"] = self["webpackChunkvocabulaire_summary"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); /******/ })(); diff --git a/blocks/vocabulaire-summary/build/index.js.map b/blocks/vocabulaire-summary/build/index.js.map index 885af6c..d3eb2ae 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":";;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACmB;AACjC;AACuB;AACF;AAE7B,SAASI,IAAIA,CAAC;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAE;EAC3D,IAAI;IAAEC;EAAa,CAAC,GAAGF,UAAU;EACjC,IAAI,CAACG,eAAe,EAAEC,kBAAkB,CAAC,GAAGP,4DAAQ,CAAC,KAAK,CAAC;EAC3DQ,OAAO,CAACC,GAAG,CAAC,aAAa,CAAC;EAE1B,MAAMC,aAAa,GAAGT,0DAAS,CA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ACA;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/save.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\",\"data\"]","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 { useBlockProps } from \"@wordpress/block-editor\";\nimport \"./editor.scss\";\nimport { useState } from \"@wordpress/element\";\nimport { useSelect } from \"@wordpress/data\";\n\nexport default function Edit({ attributes, setAttributes }) {\n\tlet { tooltipWords } = attributes;\n\tlet [hasFetchedDatas, setHasFetchedDatas] = useState(false);\n\tconsole.log(\"#### EDITOR\");\n\n\tconst editorContent = useSelect(\n\t\t(select) => select(\"core/editor\").getCurrentPost().content\n\t);\n\tif (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 filteredTooltipWords = [];\n\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\tconst existingTooltip = filteredTooltipWords.find(\n\t\t\t\t(item) => item.tooltipID === tooltipID\n\t\t\t);\n\n\t\t\tif (!existingTooltip) {\n\t\t\t\tfilteredTooltipWords.push({\n\t\t\t\t\ttooltipID,\n\t\t\t\t\ttooltipText,\n\t\t\t\t\ttooltipDefinition,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\tif (!hasFetchedDatas) {\n\t\t\tsetAttributes({ tooltipWords: filteredTooltipWords });\n\t\t\tsetHasFetchedDatas(true);\n\t\t}\n\t}\n\n\treturn (\n\t\t
    \n\t\t\t

    Vocabulaire

    \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{elem.tooltipText} \n\t\t\t\t\t\t
    {elem.tooltipDefinition}
    \n\t\t\t\t\t
    \n\t\t\t\t))}\n\t\t
    \n\t);\n}\n","/**\n * Registers a new block provided a unique name and an object defining its behavior.\n *\n * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/\n */\nimport { registerBlockType } from '@wordpress/blocks';\n\n/**\n * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.\n * All files containing `style` keyword are bundled together. The code used\n * gets applied both to the front of your site and to the editor.\n *\n * @see https://www.npmjs.com/package/@wordpress/scripts#using-css\n */\nimport './style.scss';\n\n/**\n * Internal dependencies\n */\nimport Edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\n\n/**\n * Every block starts by registering a new block type definition.\n *\n * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/\n */\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n\n\t/**\n\t * @see ./save.js\n\t */\n\tsave,\n} );\n","import { useBlockProps } from \"@wordpress/block-editor\";\n\nexport default function save({ attributes, setAttributes }) {\n\tlet { tooltipWords } = attributes;\n\n\treturn (\n\t\t
    \n\t\t\t

    Vocabulaire

    \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{elem.tooltipText} \n\t\t\t\t\t\t
    {elem.tooltipDefinition}
    \n\t\t\t\t\t
    \n\t\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\"][\"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[\"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","useState","useSelect","Edit","attributes","setAttributes","tooltipWords","hasFetchedDatas","setHasFetchedDatas","console","log","editorContent","select","getCurrentPost","content","parser","DOMParser","doc","parseFromString","domTooltipWords","querySelectorAll","filteredTooltipWords","Array","from","forEach","tooltipWord","tooltipID","getAttribute","tooltipText","tooltipDefinition","existingTooltip","find","item","push","createElement","map","elem","class","registerBlockType","save","metadata","name","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACmB;AACjC;AACgC;AACT;AACW;AACV;AACM;AAErD,SAASQ,wBAAwBA,CAAC;EAAEC;AAAG,CAAC,EAAE;EACzC,MAAM;IAAEC,MAAM;IAAEC;EAAY,CAAC,GAAGT,qEAAe,CAC9C,UAAU,EACV,aAAa,EACbO,EACD,CAAC;EAED,IAAIE,WAAW,EAAE;IAChB,OAAO,YAAY;EACpB;EACA,IAAI,CAACD,MAAM,EAAE;IACZ,OAAO,YAAY;EACpB;EACA,OAAOA,MAAM,CAACE,IAAI;AACnB;AACA,SAASC,oBAAoBA,CAACJ,EAAE,EAAE;EACjC,MAAM;IAAEC,MAAM;IAAEC;EAAY,CAAC,GAAGT,qEAAe,CAC9C,UAAU,EACV,aAAa,EACbO,EACD,CAAC;EAED,IAAIE,WAAW,EAAE;IAChB,OAAO,YAAY;EACpB;EACA,IAAI,CAACD,MAAM,EAAE;IACZ,OAAO,YAAY;EACpB;EACA,OAAOA,MAAM;AACd;AAEA,SAASI,iBAAiBA,CAACC,aAAa,EAAE;EACzC;EACA,MAAMC,MAAM,GAAG,IAAIC,SAAS,CAAC,CAAC;EAC9B,MAAMC,GAAG,GAAGF,MAA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CAAwC;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/edit.js","webpack://vocabulaire-summary/./src/index.js","webpack://vocabulaire-summary/./src/save.js","webpack://vocabulaire-summary/./src/editor.scss","webpack://vocabulaire-summary/./src/style.scss?75bd","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":["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\";\n\nfunction CurrentThematiqueDisplay({ id }) {\n\tconst { record, isResolving } = useEntityRecord(\n\t\t\"taxonomy\",\n\t\t\"thematiques\",\n\t\tid\n\t);\n\n\tif (isResolving) {\n\t\treturn \"Loading...\";\n\t}\n\tif (!record) {\n\t\treturn \"no post...\";\n\t}\n\treturn record.name;\n}\nfunction getCurrentThematique(id) {\n\tconst { record, isResolving } = useEntityRecord(\n\t\t\"taxonomy\",\n\t\t\"thematiques\",\n\t\tid\n\t);\n\n\tif (isResolving) {\n\t\treturn \"Loading...\";\n\t}\n\tif (!record) {\n\t\treturn \"no post...\";\n\t}\n\treturn record;\n}\n\nfunction buildTooltipWords(editorContent) {\n\t// Parsing Content\n\tconst parser = new DOMParser();\n\tconst doc = parser.parseFromString(editorContent, \"text/html\");\n\tconst domTooltipWords = doc.querySelectorAll(\".tooltip-word\");\n\n\tconst filteredTooltipWords = [];\n\n\t// Looping over tooltip words and filtering duplicates\n\tArray.from(domTooltipWords).forEach((tooltipWord) => {\n\t\tconst tooltipID = tooltipWord.getAttribute(\"data-definition-id\");\n\t\tconst tooltipText = tooltipWord.getAttribute(\"data-tooltip-word\");\n\t\tconst tooltipDefinition = tooltipWord.getAttribute(\n\t\t\t\"data-tooltip-definition\"\n\t\t);\n\n\t\tconst existingTooltip = filteredTooltipWords.find(\n\t\t\t(item) => item.tooltipID === tooltipID\n\t\t);\n\n\t\tif (!existingTooltip) {\n\t\t\tfilteredTooltipWords.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});\n\treturn filteredTooltipWords;\n}\n\nexport default function Edit({ attributes, setAttributes }) {\n\tlet { tooltipWords, thematiqueName } = attributes;\n\tlet [hasFetchedDatas, setHasFetchedDatas] = useState(false);\n\n\tconst currentPost = useSelect((select) =>\n\t\tselect(\"core/editor\").getCurrentPost()\n\t);\n\tconst currentTaxonomies = useSelect((select) =>\n\t\tselect(\"core/editor\").getCurrentPostAttribute(\"thematiques\")\n\t);\n\tlet fetchedCurrentThematique = 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\n\tif (!currentPost || !currentPost.content) {\n\t\treturn

    Loading...

    ;\n\t}\n\n\tuseEffect(() => {\n\t\tif (currentPost.content) {\n\t\t\tlet newTooltipWords = buildTooltipWords(currentPost.content);\n\t\t\tsetAttributes({ tooltipWords: newTooltipWords });\n\t\t}\n\t}, [currentPost]);\n\n\tuseEffect(() => {\n\t\tif (!fetchedCurrentThematique) return;\n\t\tsetAttributes({ thematiqueName: fetchedCurrentThematique.name });\n\t}, [fetchedCurrentThematique, currentPost]);\n\n\treturn (\n\t\t
    \n\t\t\t

    \n\t\t\t\tVocabulaire — {thematiqueName}\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\talert(\"hey\");\n\t\t\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\n\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","/**\n * Registers a new block provided a unique name and an object defining its behavior.\n *\n * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/\n */\nimport { registerBlockType } from '@wordpress/blocks';\n\n/**\n * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.\n * All files containing `style` keyword are bundled together. The code used\n * gets applied both to the front of your site and to the editor.\n *\n * @see https://www.npmjs.com/package/@wordpress/scripts#using-css\n */\nimport './style.scss';\n\n/**\n * Internal dependencies\n */\nimport Edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\n\n/**\n * Every block starts by registering a new block type definition.\n *\n * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/\n */\nregisterBlockType( metadata.name, {\n\t/**\n\t * @see ./edit.js\n\t */\n\tedit: Edit,\n\n\t/**\n\t * @see ./save.js\n\t */\n\tsave,\n} );\n","import { useBlockProps } from \"@wordpress/block-editor\";\n\nexport default function save({ attributes, setAttributes }) {\n\tlet { tooltipWords, thematiqueName } = attributes;\n\tfunction handleClick() {\n\t\talert(\"hey\");\n\t}\n\treturn (\n\t\t\n\t\t\t

    \n\t\t\t\tVocabulaire — {thematiqueName}\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{elem.tooltipText} \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","// 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\"][\"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","CurrentThematiqueDisplay","id","record","isResolving","name","getCurrentThematique","buildTooltipWords","editorContent","parser","DOMParser","doc","parseFromString","domTooltipWords","querySelectorAll","filteredTooltipWords","Array","from","forEach","tooltipWord","tooltipID","getAttribute","tooltipText","tooltipDefinition","existingTooltip","find","item","push","Edit","attributes","setAttributes","tooltipWords","thematiqueName","hasFetchedDatas","setHasFetchedDatas","currentPost","select","getCurrentPost","currentTaxonomies","getCurrentPostAttribute","fetchedCurrentThematique","getEntityRecord","content","createElement","newTooltipWords","className","map","elem","onClick","alert","registerBlockType","save","metadata","edit","handleClick","class"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/vocabulaire-summary/build/style-index.css b/blocks/vocabulaire-summary/build/style-index.css index d3562f8..dd9cb23 100644 --- a/blocks/vocabulaire-summary/build/style-index.css +++ b/blocks/vocabulaire-summary/build/style-index.css @@ -7,10 +7,32 @@ * * Replace them with your own styles or remove the file completely. */ -.wp-block-create-block-multiblocks { - background-color: #21759b; - color: #fff; - padding: 2px; +.homegrade-blocks-vocabulaire-summary { + padding: 20px; +} +.homegrade-blocks-vocabulaire-summary details { + cursor: pointer; + padding: 20px; + background-color: white; +} +.homegrade-blocks-vocabulaire-summary summary { + margin: 0; + font-weight: bold; +} +.homegrade-blocks-vocabulaire-summary summary::marker { + content: none; +} +.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 2872df5..9167ac0 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;EACA;EACA;AAAD,C","sources":["webpack://multiblocks/./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.wp-block-create-block-multiblocks {\n\tbackground-color: #21759b;\n\tcolor: #fff;\n\tpadding: 2px;\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;EACA;AACF;AAAE;EACC;AAEH;AACC;EACC;EACA;AACF;AACC;EACC;AACF;AACC;EACC;EACA;EACA;AACF,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\tsummary {\n\t\tmargin: 0;\n\t\tfont-weight: bold;\n\t\t&::marker {\n\t\t\tcontent: none;\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 diff --git a/blocks/vocabulaire-summary/package.json b/blocks/vocabulaire-summary/package.json index 39aa3a1..dcbd8cc 100644 --- a/blocks/vocabulaire-summary/package.json +++ b/blocks/vocabulaire-summary/package.json @@ -1,10 +1,14 @@ { - "name": "multiblocks", + "name": "vocabulaire-summary", "version": "0.1.0", "description": "Example block scaffolded with Create Block tool.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", "main": "build/index.js", + "entry": { + "index": "./src/index.js", + "frontend": "./src/frontend.js" + }, "scripts": { "build": "wp-scripts build", "format": "wp-scripts format", @@ -17,4 +21,4 @@ "devDependencies": { "@wordpress/scripts": "^26.9.0" } -} +} \ No newline at end of file diff --git a/blocks/vocabulaire-summary/src/block.json b/blocks/vocabulaire-summary/src/block.json index 62ff42f..e5e3ff3 100644 --- a/blocks/vocabulaire-summary/src/block.json +++ b/blocks/vocabulaire-summary/src/block.json @@ -12,12 +12,17 @@ }, "textdomain": "homegrade-blocks", "editorScript": "file:./index.js", + "script": "file:./frontend-file.js", "editorStyle": "file:./index.css", "style": "file:./style-index.css", "attributes": { "tooltipWords": { "type": "array", "default": [] + }, + "thematiqueName": { + "type": "string", + "default": "" } } } \ No newline at end of file diff --git a/blocks/vocabulaire-summary/src/edit.js b/blocks/vocabulaire-summary/src/edit.js index a73f163..ac0b984 100644 --- a/blocks/vocabulaire-summary/src/edit.js +++ b/blocks/vocabulaire-summary/src/edit.js @@ -1,57 +1,131 @@ import { __ } from "@wordpress/i18n"; import { useBlockProps } from "@wordpress/block-editor"; import "./editor.scss"; +import { useEntityRecord } from "@wordpress/core-data"; import { useState } from "@wordpress/element"; -import { useSelect } from "@wordpress/data"; +import { useSelect, useDispatch } from "@wordpress/data"; +import { useEffect } from "@wordpress/element"; +import { useEntityProp } from "@wordpress/core-data"; + +function CurrentThematiqueDisplay({ id }) { + const { record, isResolving } = useEntityRecord( + "taxonomy", + "thematiques", + id + ); + + if (isResolving) { + return "Loading..."; + } + if (!record) { + return "no post..."; + } + return record.name; +} +function getCurrentThematique(id) { + const { record, isResolving } = useEntityRecord( + "taxonomy", + "thematiques", + id + ); + + if (isResolving) { + return "Loading..."; + } + if (!record) { + return "no post..."; + } + return record; +} + +function buildTooltipWords(editorContent) { + // Parsing Content + const parser = new DOMParser(); + const doc = parser.parseFromString(editorContent, "text/html"); + const domTooltipWords = doc.querySelectorAll(".tooltip-word"); + + const filteredTooltipWords = []; + + // Looping over tooltip words and filtering duplicates + Array.from(domTooltipWords).forEach((tooltipWord) => { + const tooltipID = tooltipWord.getAttribute("data-definition-id"); + const tooltipText = tooltipWord.getAttribute("data-tooltip-word"); + const tooltipDefinition = tooltipWord.getAttribute( + "data-tooltip-definition" + ); + + const existingTooltip = filteredTooltipWords.find( + (item) => item.tooltipID === tooltipID + ); + + if (!existingTooltip) { + filteredTooltipWords.push({ + tooltipID, + tooltipText, + tooltipDefinition, + }); + } + }); + return filteredTooltipWords; +} export default function Edit({ attributes, setAttributes }) { - let { tooltipWords } = attributes; + let { tooltipWords, thematiqueName } = attributes; let [hasFetchedDatas, setHasFetchedDatas] = useState(false); - console.log("#### EDITOR"); - const editorContent = useSelect( - (select) => select("core/editor").getCurrentPost().content + const currentPost = useSelect((select) => + select("core/editor").getCurrentPost() + ); + const currentTaxonomies = useSelect((select) => + select("core/editor").getCurrentPostAttribute("thematiques") + ); + let fetchedCurrentThematique = useSelect( + (select) => + select("core").getEntityRecord( + "taxonomy", + "thematiques", + currentTaxonomies[0] // or currentPost.thematiques[0] works as well + ), + [currentTaxonomies] ); - if (editorContent) { - const parser = new DOMParser(); - const doc = parser.parseFromString(editorContent, "text/html"); - const domTooltipWords = doc.querySelectorAll(".tooltip-word"); - const filteredTooltipWords = []; - - Array.from(domTooltipWords).forEach((tooltipWord) => { - const tooltipID = tooltipWord.getAttribute("data-definition-id"); - const tooltipText = tooltipWord.getAttribute("data-tooltip-word"); - const tooltipDefinition = tooltipWord.getAttribute( - "data-tooltip-definition" - ); - - const existingTooltip = filteredTooltipWords.find( - (item) => item.tooltipID === tooltipID - ); - - if (!existingTooltip) { - filteredTooltipWords.push({ - tooltipID, - tooltipText, - tooltipDefinition, - }); - } - }); - if (!hasFetchedDatas) { - setAttributes({ tooltipWords: filteredTooltipWords }); - setHasFetchedDatas(true); - } + if (!currentPost || !currentPost.content) { + return

    Loading...

    ; } + useEffect(() => { + if (currentPost.content) { + let newTooltipWords = buildTooltipWords(currentPost.content); + setAttributes({ tooltipWords: newTooltipWords }); + } + }, [currentPost]); + + useEffect(() => { + if (!fetchedCurrentThematique) return; + setAttributes({ thematiqueName: fetchedCurrentThematique.name }); + }, [fetchedCurrentThematique, currentPost]); + return (
    -

    Vocabulaire

    +

    + Vocabulaire — {thematiqueName} +

    {tooltipWords && tooltipWords.map((elem) => ( -
    - {elem.tooltipText} -
    {elem.tooltipDefinition}
    +
    + { + alert("hey"); + }} + > + {elem.tooltipText}{" "} + + +
    +

    + {elem.tooltipDefinition} +

    +
    ))}
    diff --git a/blocks/vocabulaire-summary/src/frontend-file.js b/blocks/vocabulaire-summary/src/frontend-file.js new file mode 100644 index 0000000..ea1e565 --- /dev/null +++ b/blocks/vocabulaire-summary/src/frontend-file.js @@ -0,0 +1,50 @@ +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"); + + contentDefinitionWrapper.style.height = + contentDefinitionParagraph.offsetHeight + "px"; + } + function closeAccordion(wordDetail) { + console.log("will close"); + 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"); + if (isOpen == 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/save.js b/blocks/vocabulaire-summary/src/save.js index b320346..f5972ce 100644 --- a/blocks/vocabulaire-summary/src/save.js +++ b/blocks/vocabulaire-summary/src/save.js @@ -1,16 +1,28 @@ import { useBlockProps } from "@wordpress/block-editor"; export default function save({ attributes, setAttributes }) { - let { tooltipWords } = attributes; - + let { tooltipWords, thematiqueName } = attributes; + function handleClick() { + alert("hey"); + } return ( -
    -

    Vocabulaire

    +
    +

    + Vocabulaire — {thematiqueName} +

    {" "} {tooltipWords && tooltipWords.map((elem) => (
    - {elem.tooltipText} -
    {elem.tooltipDefinition}
    + {elem.tooltipText} +
    +

    + {elem.tooltipDefinition} +

    +
    ))}
    diff --git a/blocks/vocabulaire-summary/src/style.scss b/blocks/vocabulaire-summary/src/style.scss index 7971c73..ad9a14f 100644 --- a/blocks/vocabulaire-summary/src/style.scss +++ b/blocks/vocabulaire-summary/src/style.scss @@ -5,8 +5,30 @@ * Replace them with your own styles or remove the file completely. */ -.wp-block-create-block-multiblocks { - background-color: #21759b; - color: #fff; - padding: 2px; +.homegrade-blocks-vocabulaire-summary { + padding: 20px; + details { + cursor: pointer; + padding: 20px; + background-color: white; + } + summary { + margin: 0; + font-weight: bold; + &::marker {"" + content: none; + } + } + &__title { + margin: 0; + padding-bottom: 20px; + } + &__content { + padding-top: 30px; + } + &__content-wrapper { + overflow: hidden; + height: 0; + transition: height 0.3s ease-in-out; + } } diff --git a/build/index.js.map b/build/index.js.map index 4e54f16..faae307 100644 --- a/build/index.js.map +++ b/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;AAAmD;;AAEnD;AACA;AACA;AACkD;AAClD,cAAc,iEAAa,CAAC,sDAAG;AAC/B;AACA;AACA,CAAC,EAAE,iEAAa,CAAC,uDAAI;AACrB;AACA,CAAC;AACD,iEAAe,KAAK,EAAC;AACrB;;;;;;;;;;;;;;;;;;ACbmD;;AAEnD;AACA;AACA;AACkD;AAClD,cAAc,iEAAa,CAAC,sDAAG;AAC/B;AACA;AACA,CAAC,EAAE,iEAAa,CAAC,uDAAI;AACrB;AACA,CAAC;AACD,iEAAe,KAAK,EAAC;AACrB;;;;;;;;;;;;;;ACbO,SAASA,uBAAuBA,CAACC,eAAe,EAAE;EACxD,QAAQA,eAAe;IACtB,KAAK,SAAS;IACd,KAAK,WAAW;MACf,OAAO,oBAAoB;IAE5B,KAAK,YAAY;IACjB,KAAK,sBAAsB;MAC1B,OAAO,yBAAyB;IAEjC,KAAK,WAAW;IAChB,KAAK,cAAc;MAClB,OAAO,qBAAqB;IAE7B,KAAK,UAAU;IACf,KAAK,WAAW;MACf,OAAO,oBAAoB;IAE5B,KAAK,YAAY;IACjB,KAAK,YAAY;MAChB,OAAO,uBAAuB;IAE/B,KAAK,UAAU;MACd,OAAO,UAAU;EACnB;AACD;;;;;;;;;;;;;;;;;;;;;;;;ACzB0F;AACrD;AAC6D;AAC1C;AAE6B;AACrC;AAEF;AAE9C,MAAMgB,wBAAwB,GAAIC,KAAK,I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AAI,EAAE9B,wDAAM;IACZiC,KAAK,EAAE,sBAAuB;IAC9BD,OAAO,EAAEA,CAAA,KAAM;MACdR,YAAY,CAAC,CAAC;IACf;EAAE,CACF,CAEW,CACA,CACd,CAAC;AAEL,CAAC;AAEDrC,wEAAkB,CAACqD,UAAU,EAAE;EAC9BN,KAAK,EAAE5C,mDAAE,CAAC,SAAS,EAAE,kBAAkB,CAAC;EACxC6C,OAAO,EAAE,MAAM;EACfnB,UAAU,EAAE;IACXgC,YAAY,EAAE,oBAAoB;IAClCE,qBAAqB,EAAE,yBAAyB;IAChDG,eAAe,EAAE;EAClB,CAAC;EACDzB,SAAS,EAAE,cAAc;EACzBQ,IAAI,EAAEK;AACP,CAAC,CAAC;;;;;;;;;;;ACzIF;;;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;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;;;;;WCtBA;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;;;;;;;;;;;;;;;;ACNoC;AACD;AAEH;AACK","sources":["webpack://multi-blocks/./node_modules/@wordpress/icons/build-module/library/check.js","webpack://multi-blocks/./node_modules/@wordpress/icons/build-module/library/trash.js","webpack://multi-blocks/./blocks/utilities.js","webpack://multi-blocks/./src/format-types/brochure.js","webpack://multi-blocks/./src/format-types/tooltip.js","webpack://multi-blocks/./src/format-types/brochure.css","webpack://multi-blocks/./src/format-types/tooltip.css","webpack://multi-blocks/external window [\"wp\",\"blockEditor\"]","webpack://multi-blocks/external window [\"wp\",\"components\"]","webpack://multi-blocks/external window [\"wp\",\"data\"]","webpack://multi-blocks/external window [\"wp\",\"element\"]","webpack://multi-blocks/external window [\"wp\",\"i18n\"]","webpack://multi-blocks/external window [\"wp\",\"primitives\"]","webpack://multi-blocks/external window [\"wp\",\"richText\"]","webpack://multi-blocks/webpack/bootstrap","webpack://multi-blocks/webpack/runtime/compat get default export","webpack://multi-blocks/webpack/runtime/define property getters","webpack://multi-blocks/webpack/runtime/hasOwnProperty shorthand","webpack://multi-blocks/webpack/runtime/make namespace object","webpack://multi-blocks/./src/index.js"],"sourcesContent":["import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst check = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z\"\n}));\nexport default check;\n//# sourceMappingURL=check.js.map","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","export function getThematiqueFamilySlug(thematique_slug) {\r\n\tswitch (thematique_slug) {\r\n\t\tcase \"energie\":\r\n\t\tcase \"urbanisme\":\r\n\t\t\treturn \"energies-urbanisme\";\r\n\r\n\t\tcase \"acoustique\":\r\n\t\tcase \"petites-coproprietes\":\r\n\t\t\treturn \"acoustique-coproprietes\";\r\n\r\n\t\tcase \"isolation\":\r\n\t\tcase \"au-quotidien\":\r\n\t\t\treturn \"isolation-quotidien\";\r\n\r\n\t\tcase \"energies\":\r\n\t\tcase \"urbanisme\":\r\n\t\t\treturn \"energies-urbanisme\";\r\n\r\n\t\tcase \"patrimoine\":\r\n\t\tcase \"renovation\":\r\n\t\t\treturn \"patrimoine-renovation\";\r\n\r\n\t\tcase \"location\":\r\n\t\t\treturn \"location\";\r\n\t}\r\n}\r\n","import { registerFormatType, toggleFormat, getActiveFormats } from \"@wordpress/rich-text\";\r\nimport { __ } from \"@wordpress/i18n\";\r\nimport { BlockControls, __experimentalLinkControl as LinkControl } from \"@wordpress/block-editor\";\r\nimport { Popover, Button } from \"@wordpress/components\";\r\n\r\nimport { ToolbarGroup, ToolbarButton, TextareaControl } from \"@wordpress/components\";\r\nimport { check, trash } from \"@wordpress/icons\";\r\n\r\nimport { useState } from \"@wordpress/element\";\r\n\r\nconst BrochureLinkFormatButton = (props) => {\r\n\tconst { isActive, value, onChange } = props;\r\n\tconst [isPopoverOpen, setIsPopoverOpen] = useState(false);\r\n\tconst [linkValue, setLinkValue] = useState(\"\");\r\n\r\n\tconst activeFormat = getActiveFormats(props.value).filter(\r\n\t\t(format) => format.type === \"homegrade-format/brochure-format\"\r\n\t)[0];\r\n\r\n\t// console.log(activeFormat);\r\n\t// console.log(getActiveFormats(props.value));\r\n\tfunction handleFormat() {\r\n\t\tsetIsPopoverOpen(!isPopoverOpen);\r\n\t\tonChange(\r\n\t\t\ttoggleFormat(value, {\r\n\t\t\t\ttype: \"homegrade-format/brochure-format\",\r\n\t\t\t\tattributes: {\r\n\t\t\t\t\thref: linkValue.url,\r\n\t\t\t\t\ttarget: \"_blank\",\r\n\t\t\t\t\tdataId: linkValue.id.toString(),\r\n\t\t\t\t\tstyle: \"text-decoration: underline;\",\r\n\t\t\t\t},\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\tfunction removeFormat() {\r\n\t\tsetIsPopoverOpen(false);\r\n\t\tsetLinkValue(\"\");\r\n\t\tonChange(\r\n\t\t\ttoggleFormat(value, {\r\n\t\t\t\ttype: \"homegrade-format/brochure-format\",\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t\r\n\t\t\t\t{isPopoverOpen && (\r\n\t\t\t\t\t setIsPopoverOpen(false)}\r\n\t\t\t\t\t\tclassName='popover_tooltip_field'>\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t// console.log(value);\r\n\t\t\t\t\t\t\t\tsetLinkValue(value);\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\tsetIsPopoverOpen(!isPopoverOpen);\r\n\t\t\t\t\t\t\t\thandleFormat();\r\n\t\t\t\t\t\t\t}}>\r\n\t\t\t\t\t\t\tValider\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t)}\r\n\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t!isActive ? setIsPopoverOpen(!isPopoverOpen) : removeFormat()\r\n\t\t\t\t\t\t}\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\r\nregisterFormatType(\"homegrade-format/brochure-format\", {\r\n\ttitle: __(\"Brochure\", \"homegrade-format\"),\r\n\ttagName: \"a\",\r\n\tclassName: \"brochure-link-format\",\r\n\tedit: BrochureLinkFormatButton,\r\n});\r\n","import { __ } from \"@wordpress/i18n\";\r\nimport { registerFormatType, toggleFormat, applyFormat, getActiveFormats } from \"@wordpress/rich-text\";\r\n\r\nimport { BlockControls, __experimentalLinkControl as LinkControl } from \"@wordpress/block-editor\";\r\nimport { Popover, ToolbarGroup, ToolbarButton } from \"@wordpress/components\";\r\nimport { trash } from \"@wordpress/icons\";\r\nimport { useState, useEffect } from \"@wordpress/element\";\r\nimport { useSelect } from \"@wordpress/data\"; // pour les querry\r\n\r\nconst formatName = \"homegrade-format/tooltip\";\r\n\r\nconst Edit = (props) => {\r\n\tconst { isActive, value, onChange } = props;\r\n\tconst [isPopoverOpen, setIsPopoverOpen] = useState(false);\r\n\tconst [popoverText, setPopoverText] = useState(\"\");\r\n\tconst [pendingDefinition, setPendingDefinition] = useState(false);\r\n\r\n\tconst activeFormat = getActiveFormats(props.value).filter((format) => format.type === formatName)[0];\r\n\t// console.log(activeFormat);\r\n\t// console.log(value);\r\n\r\n\tconst post = useSelect((select) => {\r\n\t\tif (activeFormat && activeFormat.attributes.definitionId) {\r\n\t\t\treturn select(\"core\").getEntityRecord(\r\n\t\t\t\t\"postType\",\r\n\t\t\t\t\"vocabulaire\",\r\n\t\t\t\tactiveFormat.attributes.definitionId\r\n\t\t\t);\r\n\t\t}\r\n\t});\r\n\r\n\tif (post && pendingDefinition) {\r\n\t\t// console.log(\"#### Retrieved Post\");\r\n\t\t// console.log(post);\r\n\t\tonChange(\r\n\t\t\tapplyFormat(value, {\r\n\t\t\t\ttype: formatName,\r\n\t\t\t\tattributes: {\r\n\t\t\t\t\tdataTooltipDefinition: post.acf.definition,\r\n\t\t\t\t\tdefinitionId: activeFormat.attributes.definitionId,\r\n\t\t\t\t\tdataTooltipWord: activeFormat.attributes.dataTooltipWord,\r\n\t\t\t\t},\r\n\t\t\t})\r\n\t\t);\r\n\t\tsetPendingDefinition(false);\r\n\t}\r\n\r\n\tfunction removeFormat() {\r\n\t\tsetIsPopoverOpen(false);\r\n\t\tonChange(\r\n\t\t\ttoggleFormat(value, {\r\n\t\t\t\ttype: formatName,\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\tfunction setFormat(postDatas) {\r\n\t\t// console.log(postDatas);\r\n\t\tsetPendingDefinition(true);\r\n\t\tsetIsPopoverOpen(false);\r\n\r\n\t\tonChange(\r\n\t\t\tapplyFormat(value, {\r\n\t\t\t\ttype: formatName,\r\n\t\t\t\tattributes: {\r\n\t\t\t\t\tdefinitionId: postDatas.id.toString(),\r\n\t\t\t\t\tdataTooltipWord: postDatas.title,\r\n\t\t\t\t},\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t\r\n\t\t\t\t{isPopoverOpen && (\r\n\t\t\t\t\t setIsPopoverOpen(false)}\r\n\t\t\t\t\t\tclassName='popover_tooltip_field'>\r\n\t\t\t\t\t\t setFormat(postDatas)}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\r\n\t\t\t\t)}\r\n\r\n\t\t\t\t\r\n\t\t\t\t\t {\r\n\t\t\t\t\t\t\tsetIsPopoverOpen(true);\r\n\t\t\t\t\t\t}}\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t{isActive && (\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\tremoveFormat();\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t/>\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\r\nregisterFormatType(formatName, {\r\n\ttitle: __(\"Tooltip\", \"homegrade-format\"),\r\n\ttagName: \"span\",\r\n\tattributes: {\r\n\t\tdefinitionId: \"data-definition-id\",\r\n\t\tdataTooltipDefinition: \"data-tooltip-definition\",\r\n\t\tdataTooltipWord: \"data-tooltip-word\",\r\n\t},\r\n\tclassName: \"tooltip-word\",\r\n\tedit: Edit,\r\n});\r\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"primitives\"];","module.exports = window[\"wp\"][\"richText\"];","// 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","// 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};","import \"./format-types/tooltip.css\";\r\nimport \"./format-types/tooltip.js\";\r\n\r\nimport \"../blocks/utilities.js\";\r\nimport \"./format-types/brochure.css\";\r\nimport \"./format-types/brochure.js\";\r\n"],"names":["getThematiqueFamilySlug","thematique_slug","registerFormatType","toggleFormat","getActiveFormats","__","BlockControls","__experimentalLinkControl","LinkControl","Popover","Button","ToolbarGroup","ToolbarButton","TextareaControl","check","trash","useState","BrochureLinkFormatButton","props","isActive","value","onChange","isPopoverOpen","setIsPopoverOpen","linkValue","setLinkValue","activeFormat","filter","format","type","handleFormat","attributes","href","url","target","dataId","id","toString","style","removeFormat","createElement","Fragment","onClose","className","suggestionsQuery","icon","variant","onClick","label","title","tagName","edit","applyFormat","useEffect","useSelect","formatName","Edit","popoverText","setPopoverText","pendingDefinition","setPendingDefinition","post","select","definitionId","getEntityRecord","dataTooltipDefinition","acf","definition","dataTooltipWord","setFormat","postDatas","link","tile","kind","subtype","isCollapsed"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;AAAmD;;AAEnD;AACA;AACA;AACkD;AAClD,cAAc,iEAAa,CAAC,sDAAG;AAC/B;AACA;AACA,CAAC,EAAE,iEAAa,CAAC,uDAAI;AACrB;AACA,CAAC;AACD,iEAAe,KAAK,EAAC;AACrB;;;;;;;;;;;;;;;;;;ACbmD;;AAEnD;AACA;AACA;AACkD;AAClD,cAAc,iEAAa,CAAC,sDAAG;AAC/B;AACA;AACA,CAAC,EAAE,iEAAa,CAAC,uDAAI;AACrB;AACA,CAAC;AACD,iEAAe,KAAK,EAAC;AACrB;;;;;;;;;;;;;;ACbO,SAASA,uBAAuBA,CAACC,eAAe,EAAE;EACxD,QAAQA,eAAe;IACtB,KAAK,SAAS;IACd,KAAK,WAAW;MACf,OAAO,oBAAoB;IAE5B,KAAK,YAAY;IACjB,KAAK,sBAAsB;MAC1B,OAAO,yBAAyB;IAEjC,KAAK,WAAW;IAChB,KAAK,cAAc;MAClB,OAAO,qBAAqB;IAE7B,KAAK,UAAU;IACf,KAAK,WAAW;MACf,OAAO,oBAAoB;IAE5B,KAAK,YAAY;IACjB,KAAK,YAAY;MAChB,OAAO,uBAAuB;IAE/B,KAAK,UAAU;MACd,OAAO,UAAU;EACnB;AACD;;;;;;;;;;;;;;;;;;;;;;;;ACzB0F;AACrD;AAC6D;AAC1C;AAE6B;AACrC;AAEF;AAE9C,MAAMgB,wBAAwB,GAAIC,KAAK,IAAK;EAC3C,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAGH,KAAK;EAC3C,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R,YAAY,CAAC,CAAC;IACf;EAAE,CACF,CAEW,CACA,CACd,CAAC;AAEL,CAAC;AAEDrC,wEAAkB,CAACqD,UAAU,EAAE;EAC9BN,KAAK,EAAE5C,mDAAE,CAAC,SAAS,EAAE,kBAAkB,CAAC;EACxC6C,OAAO,EAAE,MAAM;EACfnB,UAAU,EAAE;IACXgC,YAAY,EAAE,oBAAoB;IAClCE,qBAAqB,EAAE,yBAAyB;IAChDG,eAAe,EAAE;EAClB,CAAC;EACDzB,SAAS,EAAE,cAAc;EACzBQ,IAAI,EAAEK;AACP,CAAC,CAAC;;;;;;;;;;;ACzIF;;;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;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;;;;;WCtBA;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;;;;;;;;;;;;;;;;ACNoC;AACD;AAEH;AACK","sources":["webpack://multi-blocks/./node_modules/@wordpress/icons/build-module/library/check.js","webpack://multi-blocks/./node_modules/@wordpress/icons/build-module/library/trash.js","webpack://multi-blocks/./blocks/utilities.js","webpack://multi-blocks/./src/format-types/brochure.js","webpack://multi-blocks/./src/format-types/tooltip.js","webpack://multi-blocks/./src/format-types/brochure.css?0362","webpack://multi-blocks/./src/format-types/tooltip.css?fea4","webpack://multi-blocks/external window [\"wp\",\"blockEditor\"]","webpack://multi-blocks/external window [\"wp\",\"components\"]","webpack://multi-blocks/external window [\"wp\",\"data\"]","webpack://multi-blocks/external window [\"wp\",\"element\"]","webpack://multi-blocks/external window [\"wp\",\"i18n\"]","webpack://multi-blocks/external window [\"wp\",\"primitives\"]","webpack://multi-blocks/external window [\"wp\",\"richText\"]","webpack://multi-blocks/webpack/bootstrap","webpack://multi-blocks/webpack/runtime/compat get default export","webpack://multi-blocks/webpack/runtime/define property getters","webpack://multi-blocks/webpack/runtime/hasOwnProperty shorthand","webpack://multi-blocks/webpack/runtime/make namespace object","webpack://multi-blocks/./src/index.js"],"sourcesContent":["import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst check = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z\"\n}));\nexport default check;\n//# sourceMappingURL=check.js.map","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","export function getThematiqueFamilySlug(thematique_slug) {\r\n\tswitch (thematique_slug) {\r\n\t\tcase \"energie\":\r\n\t\tcase \"urbanisme\":\r\n\t\t\treturn \"energies-urbanisme\";\r\n\r\n\t\tcase \"acoustique\":\r\n\t\tcase \"petites-coproprietes\":\r\n\t\t\treturn \"acoustique-coproprietes\";\r\n\r\n\t\tcase \"isolation\":\r\n\t\tcase \"au-quotidien\":\r\n\t\t\treturn \"isolation-quotidien\";\r\n\r\n\t\tcase \"energies\":\r\n\t\tcase \"urbanisme\":\r\n\t\t\treturn \"energies-urbanisme\";\r\n\r\n\t\tcase \"patrimoine\":\r\n\t\tcase \"renovation\":\r\n\t\t\treturn \"patrimoine-renovation\";\r\n\r\n\t\tcase \"location\":\r\n\t\t\treturn \"location\";\r\n\t}\r\n}\r\n","import { registerFormatType, toggleFormat, getActiveFormats } from \"@wordpress/rich-text\";\r\nimport { __ } from \"@wordpress/i18n\";\r\nimport { BlockControls, __experimentalLinkControl as LinkControl } from \"@wordpress/block-editor\";\r\nimport { Popover, Button } from \"@wordpress/components\";\r\n\r\nimport { ToolbarGroup, ToolbarButton, TextareaControl } from \"@wordpress/components\";\r\nimport { check, trash } from \"@wordpress/icons\";\r\n\r\nimport { useState } from \"@wordpress/element\";\r\n\r\nconst BrochureLinkFormatButton = (props) => {\r\n\tconst { isActive, value, onChange } = props;\r\n\tconst [isPopoverOpen, setIsPopoverOpen] = useState(false);\r\n\tconst [linkValue, setLinkValue] = useState(\"\");\r\n\r\n\tconst activeFormat = getActiveFormats(props.value).filter(\r\n\t\t(format) => format.type === \"homegrade-format/brochure-format\"\r\n\t)[0];\r\n\r\n\t// console.log(activeFormat);\r\n\t// console.log(getActiveFormats(props.value));\r\n\tfunction handleFormat() {\r\n\t\tsetIsPopoverOpen(!isPopoverOpen);\r\n\t\tonChange(\r\n\t\t\ttoggleFormat(value, {\r\n\t\t\t\ttype: \"homegrade-format/brochure-format\",\r\n\t\t\t\tattributes: {\r\n\t\t\t\t\thref: linkValue.url,\r\n\t\t\t\t\ttarget: \"_blank\",\r\n\t\t\t\t\tdataId: linkValue.id.toString(),\r\n\t\t\t\t\tstyle: \"text-decoration: underline;\",\r\n\t\t\t\t},\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\tfunction removeFormat() {\r\n\t\tsetIsPopoverOpen(false);\r\n\t\tsetLinkValue(\"\");\r\n\t\tonChange(\r\n\t\t\ttoggleFormat(value, {\r\n\t\t\t\ttype: \"homegrade-format/brochure-format\",\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t\r\n\t\t\t\t{isPopoverOpen && (\r\n\t\t\t\t\t setIsPopoverOpen(false)}\r\n\t\t\t\t\t\tclassName='popover_tooltip_field'>\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t// console.log(value);\r\n\t\t\t\t\t\t\t\tsetLinkValue(value);\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\tsetIsPopoverOpen(!isPopoverOpen);\r\n\t\t\t\t\t\t\t\thandleFormat();\r\n\t\t\t\t\t\t\t}}>\r\n\t\t\t\t\t\t\tValider\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t)}\r\n\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t!isActive ? setIsPopoverOpen(!isPopoverOpen) : removeFormat()\r\n\t\t\t\t\t\t}\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\r\nregisterFormatType(\"homegrade-format/brochure-format\", {\r\n\ttitle: __(\"Brochure\", \"homegrade-format\"),\r\n\ttagName: \"a\",\r\n\tclassName: \"brochure-link-format\",\r\n\tedit: BrochureLinkFormatButton,\r\n});\r\n","import { __ } from \"@wordpress/i18n\";\r\nimport { registerFormatType, toggleFormat, applyFormat, getActiveFormats } from \"@wordpress/rich-text\";\r\n\r\nimport { BlockControls, __experimentalLinkControl as LinkControl } from \"@wordpress/block-editor\";\r\nimport { Popover, ToolbarGroup, ToolbarButton } from \"@wordpress/components\";\r\nimport { trash } from \"@wordpress/icons\";\r\nimport { useState, useEffect } from \"@wordpress/element\";\r\nimport { useSelect } from \"@wordpress/data\"; // pour les querry\r\n\r\nconst formatName = \"homegrade-format/tooltip\";\r\n\r\nconst Edit = (props) => {\r\n\tconst { isActive, value, onChange } = props;\r\n\tconst [isPopoverOpen, setIsPopoverOpen] = useState(false);\r\n\tconst [popoverText, setPopoverText] = useState(\"\");\r\n\tconst [pendingDefinition, setPendingDefinition] = useState(false);\r\n\r\n\tconst activeFormat = getActiveFormats(props.value).filter((format) => format.type === formatName)[0];\r\n\t// console.log(activeFormat);\r\n\t// console.log(value);\r\n\r\n\tconst post = useSelect((select) => {\r\n\t\tif (activeFormat && activeFormat.attributes.definitionId) {\r\n\t\t\treturn select(\"core\").getEntityRecord(\r\n\t\t\t\t\"postType\",\r\n\t\t\t\t\"vocabulaire\",\r\n\t\t\t\tactiveFormat.attributes.definitionId\r\n\t\t\t);\r\n\t\t}\r\n\t});\r\n\r\n\tif (post && pendingDefinition) {\r\n\t\t// console.log(\"#### Retrieved Post\");\r\n\t\t// console.log(post);\r\n\t\tonChange(\r\n\t\t\tapplyFormat(value, {\r\n\t\t\t\ttype: formatName,\r\n\t\t\t\tattributes: {\r\n\t\t\t\t\tdataTooltipDefinition: post.acf.definition,\r\n\t\t\t\t\tdefinitionId: activeFormat.attributes.definitionId,\r\n\t\t\t\t\tdataTooltipWord: activeFormat.attributes.dataTooltipWord,\r\n\t\t\t\t},\r\n\t\t\t})\r\n\t\t);\r\n\t\tsetPendingDefinition(false);\r\n\t}\r\n\r\n\tfunction removeFormat() {\r\n\t\tsetIsPopoverOpen(false);\r\n\t\tonChange(\r\n\t\t\ttoggleFormat(value, {\r\n\t\t\t\ttype: formatName,\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\tfunction setFormat(postDatas) {\r\n\t\t// console.log(postDatas);\r\n\t\tsetPendingDefinition(true);\r\n\t\tsetIsPopoverOpen(false);\r\n\r\n\t\tonChange(\r\n\t\t\tapplyFormat(value, {\r\n\t\t\t\ttype: formatName,\r\n\t\t\t\tattributes: {\r\n\t\t\t\t\tdefinitionId: postDatas.id.toString(),\r\n\t\t\t\t\tdataTooltipWord: postDatas.title,\r\n\t\t\t\t},\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t\r\n\t\t\t\t{isPopoverOpen && (\r\n\t\t\t\t\t setIsPopoverOpen(false)}\r\n\t\t\t\t\t\tclassName='popover_tooltip_field'>\r\n\t\t\t\t\t\t setFormat(postDatas)}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t\r\n\t\t\t\t)}\r\n\r\n\t\t\t\t\r\n\t\t\t\t\t {\r\n\t\t\t\t\t\t\tsetIsPopoverOpen(true);\r\n\t\t\t\t\t\t}}\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t{isActive && (\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\tremoveFormat();\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t/>\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\r\nregisterFormatType(formatName, {\r\n\ttitle: __(\"Tooltip\", \"homegrade-format\"),\r\n\ttagName: \"span\",\r\n\tattributes: {\r\n\t\tdefinitionId: \"data-definition-id\",\r\n\t\tdataTooltipDefinition: \"data-tooltip-definition\",\r\n\t\tdataTooltipWord: \"data-tooltip-word\",\r\n\t},\r\n\tclassName: \"tooltip-word\",\r\n\tedit: Edit,\r\n});\r\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"primitives\"];","module.exports = window[\"wp\"][\"richText\"];","// 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","// 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};","import \"./format-types/tooltip.css\";\r\nimport \"./format-types/tooltip.js\";\r\n\r\nimport \"../blocks/utilities.js\";\r\nimport \"./format-types/brochure.css\";\r\nimport \"./format-types/brochure.js\";\r\n"],"names":["getThematiqueFamilySlug","thematique_slug","registerFormatType","toggleFormat","getActiveFormats","__","BlockControls","__experimentalLinkControl","LinkControl","Popover","Button","ToolbarGroup","ToolbarButton","TextareaControl","check","trash","useState","BrochureLinkFormatButton","props","isActive","value","onChange","isPopoverOpen","setIsPopoverOpen","linkValue","setLinkValue","activeFormat","filter","format","type","handleFormat","attributes","href","url","target","dataId","id","toString","style","removeFormat","createElement","Fragment","onClose","className","suggestionsQuery","icon","variant","onClick","label","title","tagName","edit","applyFormat","useEffect","useSelect","formatName","Edit","popoverText","setPopoverText","pendingDefinition","setPendingDefinition","post","select","definitionId","getEntityRecord","dataTooltipDefinition","acf","definition","dataTooltipWord","setFormat","postDatas","link","tile","kind","subtype","isCollapsed"],"sourceRoot":""} \ No newline at end of file diff --git a/src/format-types/brochure-front.js b/src/format-types/brochure-front.js index 02d5fe7..8220929 100644 --- a/src/format-types/brochure-front.js +++ b/src/format-types/brochure-front.js @@ -9,7 +9,7 @@ window.addEventListener("DOMContentLoaded", (event) => { // alert("SALUT"); const iconSrc = img_path_datas.downloadIconPath; brochureLinks.forEach((brochureLink) => { - console.log(brochureLink); + // console.log(brochureLink); const brochureLinkIcon = document.createElement("img"); brochureLinkIcon.src = iconSrc;