From 4c8f206c594944f0e03096f8ef60e1ce77f61f85 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Thu, 31 Aug 2023 17:22:46 +0200 Subject: [PATCH] refactoring and cleaning blocks --- blocks/content-heading/build/index.asset.php | 2 +- blocks/content-heading/build/index.js | 13 +- blocks/content-heading/build/index.js.map | 2 +- blocks/content-heading/src/edit.js | 34 +-- blocks/content-heading/src/save.js | 3 +- blocks/picture-banner/build/index.asset.php | 2 +- blocks/picture-banner/build/index.js | 75 ++----- blocks/picture-banner/build/index.js.map | 2 +- blocks/picture-banner/build/style-index.css | 4 +- .../picture-banner/build/style-index.css.map | 2 +- blocks/picture-banner/src/edit.js | 44 ++-- blocks/picture-banner/src/index.js | 42 +--- blocks/picture-banner/src/save.js | 40 ++-- blocks/picture-banner/src/style.scss | 18 +- .../questions-container/build/index.asset.php | 2 +- blocks/questions-container/build/index.js | 1 - blocks/questions-container/build/index.js.map | 2 +- .../src/OptionsSelectControl.js | 1 - blocks/vocabulaire-summary/build/block.json | 13 +- .../build/frontend.asset.php | 2 +- blocks/vocabulaire-summary/build/frontend.js | 1 - .../vocabulaire-summary/build/frontend.js.map | 2 +- .../vocabulaire-summary/build/index.asset.php | 2 +- blocks/vocabulaire-summary/build/index.css | 9 - blocks/vocabulaire-summary/build/index.js | 208 +++++------------- blocks/vocabulaire-summary/build/index.js.map | 2 +- blocks/vocabulaire-summary/build/render.php | 27 +++ blocks/vocabulaire-summary/src/block.json | 13 +- blocks/vocabulaire-summary/src/edit.js | 142 ++++++------ blocks/vocabulaire-summary/src/editor.scss | 9 - blocks/vocabulaire-summary/src/frontend.js | 1 - blocks/vocabulaire-summary/src/index.js | 43 +--- blocks/vocabulaire-summary/src/render.php | 27 +++ blocks/vocabulaire-summary/src/save.js | 34 --- build/index.asset.php | 2 +- build/index.css | 40 ++-- build/index.css.map | 2 +- build/index.js | 131 ++++++----- build/index.js.map | 2 +- index.php | 8 +- .../{ => brochure}/brochure-front.js | 6 - src/format-types/{ => brochure}/brochure.css | 0 src/format-types/{ => brochure}/brochure.js | 32 +-- .../{ => tooltip}/tooltip-front.js | 14 +- src/format-types/{ => tooltip}/tooltip.css | 27 ++- src/format-types/{ => tooltip}/tooltip.js | 74 ++++--- src/index.js | 8 +- 47 files changed, 491 insertions(+), 679 deletions(-) create mode 100644 blocks/vocabulaire-summary/build/render.php create mode 100644 blocks/vocabulaire-summary/src/render.php delete mode 100644 blocks/vocabulaire-summary/src/save.js rename src/format-types/{ => brochure}/brochure-front.js (73%) rename src/format-types/{ => brochure}/brochure.css (100%) rename src/format-types/{ => brochure}/brochure.js (74%) rename src/format-types/{ => tooltip}/tooltip-front.js (51%) rename src/format-types/{ => tooltip}/tooltip.css (71%) rename src/format-types/{ => tooltip}/tooltip.js (78%) diff --git a/blocks/content-heading/build/index.asset.php b/blocks/content-heading/build/index.asset.php index 98506b0..ae8e7ff 100644 --- a/blocks/content-heading/build/index.asset.php +++ b/blocks/content-heading/build/index.asset.php @@ -1 +1 @@ - array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '5ef72475853c787148c5'); + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'b49bf3cb09cfbfdc4f12'); diff --git a/blocks/content-heading/build/index.js b/blocks/content-heading/build/index.js index 1ed2ac5..38c953c 100644 --- a/blocks/content-heading/build/index.js +++ b/blocks/content-heading/build/index.js @@ -49,14 +49,6 @@ function Edit({ onClick: () => { onChangeHeadingLevel("h3"); } - // label={ - // !isActive - // ? "Ajouter un lien brochure" - // : "Supprimer le lien brochure" - // } - // onClick={() => - // !isActive ? setIsPopoverOpen(!isPopoverOpen) : removeFormat() - // } }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ToolbarButton, { isActive: headingLevel === "h4", icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__["default"], @@ -70,7 +62,6 @@ function Edit({ onChangeHeadingLevel("h5"); } }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.RichText, { - className: "wp-block-homegrade-content-blocks-content-heading", onChange: value => setAttributes({ title: value }), @@ -152,9 +143,7 @@ function save({ } = attributes; 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_1__.RichText.Content, { tagName: headingLevel, - value: title - // className="homegrade-blocks-custom-heading" - , + value: title, ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({ className: `homegrade-blocks-custom-heading` }) diff --git a/blocks/content-heading/build/index.js.map b/blocks/content-heading/build/index.js.map index e34b37f..01d0559 100644 --- a/blocks/content-heading/build/index.js.map +++ b/blocks/content-heading/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AAYJ;AASF;AAQL;AAEH;AAER,SAASuB,IAAIA,CAAC;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAE;EAC3D,MAAM;IAAEC,KAAK;IAAEC;EAAa,CAAC,GAAGH,UAAU;EAE1C,SAASI,oBAAoBA,CAACC,eAAe,EAAE;IAC9CJ,aAAa,CAAC;MAAEE,YAAY,EAAEE;IAAgB,CAAC,CAAC;EACjD;EAEA,OACCC,iEAAA,CAAAC,wDAAA,QACCD,iEAAA,CAACvB,kEAAa,QACbuB,iEAAA,CAACpB,+DAAY,QACZoB,iEAAA,CAACnB,gEAAa;IACbqB,QAAQ,EAAEL,YAAY,KAAK,IAAK;IAChCM,IAAI,EAAEd,wDAAc;IACpBe,OAAO,EAAEA,CAAA,KAAM;MACdN,oBAAoB,CAAC,IAAI,CA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UACA;;;;;WCzBA;WACA;WACA;WACA;WACA,+BAA+B,wCAAwC;WACvE;WACA;WACA;WACA;WACA,iBAAiB,qBAAqB;WACtC;WACA;WACA;WACA;WACA,kBAAkB,qBAAqB;WACvC;WACA;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC7BA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://multiblocks/./src/edit.js","webpack://multiblocks/./src/index.js","webpack://multiblocks/./src/save.js","webpack://multiblocks/./src/editor.scss","webpack://multiblocks/./src/style.scss","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/heading-level-3.js","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/heading-level-4.js","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/heading-level-5.js","webpack://multiblocks/external window [\"wp\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"components\"]","webpack://multiblocks/external window [\"wp\",\"element\"]","webpack://multiblocks/external window [\"wp\",\"i18n\"]","webpack://multiblocks/external window [\"wp\",\"primitives\"]","webpack://multiblocks/webpack/bootstrap","webpack://multiblocks/webpack/runtime/chunk loaded","webpack://multiblocks/webpack/runtime/compat get default export","webpack://multiblocks/webpack/runtime/define property getters","webpack://multiblocks/webpack/runtime/hasOwnProperty shorthand","webpack://multiblocks/webpack/runtime/make namespace object","webpack://multiblocks/webpack/runtime/jsonp chunk loading","webpack://multiblocks/webpack/before-startup","webpack://multiblocks/webpack/startup","webpack://multiblocks/webpack/after-startup"],"sourcesContent":["import { __ } from \"@wordpress/i18n\";\n\nimport {\n\tuseBlockProps,\n\tHeadingLevelDropdown,\n\tInnerBlocks,\n\tRichText,\n\tInspectorControls,\n\tAlignmentToolbar,\n\tBlockControls,\n\tPanelColorSettings,\n\tContrastChecker,\n} from \"@wordpress/block-editor\";\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tPanelBody,\n\tToggleControl,\n\tTextControl,\n\tColorPalette,\n\tColorPicker,\n} from \"@wordpress/components\";\nimport {\n\tcheck,\n\ttrash,\n\theadingLevel3,\n\theadingLevel4,\n\theadingLevel5,\n\theading,\n} from \"@wordpress/icons\";\n\nimport \"./editor.scss\";\n\nexport default function Edit({ attributes, setAttributes }) {\n\tconst { title, headingLevel } = attributes;\n\n\tfunction onChangeHeadingLevel(newHeadingLevel) {\n\t\tsetAttributes({ headingLevel: newHeadingLevel });\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t {\n\t\t\t\t\t\t\tonChangeHeadingLevel(\"h3\");\n\t\t\t\t\t\t}}\n\t\t\t\t\t\t// label={\n\t\t\t\t\t\t// \t!isActive\n\t\t\t\t\t\t// \t\t? \"Ajouter un lien brochure\"\n\t\t\t\t\t\t// \t\t: \"Supprimer le lien brochure\"\n\t\t\t\t\t\t// }\n\t\t\t\t\t\t// onClick={() =>\n\t\t\t\t\t\t// \t!isActive ? setIsPopoverOpen(!isPopoverOpen) : removeFormat()\n\t\t\t\t\t\t// }\n\t\t\t\t\t/>\n\t\t\t\t\t {\n\t\t\t\t\t\t\tonChangeHeadingLevel(\"h4\");\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t {\n\t\t\t\t\t\t\tonChangeHeadingLevel(\"h5\");\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\n\t\t\t setAttributes({ title: value })}\n\t\t\t\tvalue={title}\n\t\t\t\tplaceholder={__(\n\t\t\t\t\t\"Insérez votre titre ici\",\n\t\t\t\t\t\"homegrade-blocks__texte-fonctionnel\"\n\t\t\t\t)}\n\t\t\t\tallowedFormats={[\"homegrade-format/tooltip\"]}\n\t\t\t\ttagName={headingLevel}\n\t\t\t\t{...useBlockProps({\n\t\t\t\t\tclassName: `homegrade-blocks-custom-heading`,\n\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 save from \"./save\";\nimport metadata from \"./block.json\";\n\nregisterBlockType(metadata.name, {\n\ticon: {\n\t\tsrc: (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t),\n\t\tforeground: \"#DF1E1E\",\n\t},\n\tedit: Edit,\n\tsave,\n});\n","import { useBlockProps, RichText, InnerBlocks } from \"@wordpress/block-editor\";\n\nexport default function save({ attributes }) {\n\tconst { title, headingLevel } = attributes;\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\n\t);\n}\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst headingLevel3 = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.3 1.7c-.4-.4-1-.7-1.6-.8v-.1c.6-.2 1.1-.5 1.5-.9.3-.4.5-.8.5-1.3 0-.4-.1-.8-.3-1.1-.2-.3-.5-.6-.8-.8-.4-.2-.8-.4-1.2-.5-.6-.1-1.1-.2-1.6-.2-.6 0-1.3.1-1.8.3s-1.1.5-1.6.9l1.2 1.4c.4-.2.7-.4 1.1-.6.3-.2.7-.3 1.1-.3.4 0 .8.1 1.1.3.3.2.4.5.4.8 0 .4-.2.7-.6.9-.7.3-1.5.5-2.2.4v1.6c.5 0 1 0 1.5.1.3.1.7.2 1 .3.2.1.4.2.5.4s.1.4.1.6c0 .3-.2.7-.5.8-.4.2-.9.3-1.4.3s-1-.1-1.4-.3c-.4-.2-.8-.4-1.2-.7L13 15.6c.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.6 0 1.1-.1 1.6-.2.4-.1.9-.2 1.3-.5.4-.2.7-.5.9-.9.2-.4.3-.8.3-1.2 0-.6-.3-1.1-.7-1.5z\"\n}));\nexport default headingLevel3;\n//# sourceMappingURL=heading-level-3.js.map","import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst headingLevel4 = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M20 13V7h-3l-4 6v2h5v2h2v-2h1v-2h-1zm-2 0h-2.8L18 9v4zm-9-2H5V7H3v10h2v-4h4v4h2V7H9v4z\"\n}));\nexport default headingLevel4;\n//# sourceMappingURL=heading-level-4.js.map","import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst headingLevel5 = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.7 1.2c-.2-.3-.5-.7-.8-.9-.3-.3-.7-.5-1.1-.6-.5-.1-.9-.2-1.4-.2-.2 0-.5.1-.7.1-.2.1-.5.1-.7.2l.1-1.9h4.3V7H14l-.3 5 1 .6.5-.2.4-.1c.1-.1.3-.1.4-.1h.5c.5 0 1 .1 1.4.4.4.2.6.7.6 1.1 0 .4-.2.8-.6 1.1-.4.3-.9.4-1.4.4-.4 0-.9-.1-1.3-.3-.4-.2-.7-.4-1.1-.7 0 0-1.1 1.4-1 1.5.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.5 0 1-.1 1.5-.3s.9-.4 1.3-.7c.4-.3.7-.7.9-1.1s.3-.9.3-1.4-.1-1-.3-1.4z\"\n}));\nexport default headingLevel5;\n//# sourceMappingURL=heading-level-5.js.map","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"primitives\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkmultiblocks\"] = self[\"webpackChunkmultiblocks\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], () => (__webpack_require__(\"./src/index.js\")))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useBlockProps","HeadingLevelDropdown","InnerBlocks","RichText","InspectorControls","AlignmentToolbar","BlockControls","PanelColorSettings","ContrastChecker","ToolbarGroup","ToolbarButton","PanelBody","ToggleControl","TextControl","ColorPalette","ColorPicker","check","trash","headingLevel3","headingLevel4","headingLevel5","heading","Edit","attributes","setAttributes","title","headingLevel","onChangeHeadingLevel","newHeadingLevel","createElement","Fragment","isActive","icon","onClick","className","onChange","value","placeholder","allowedFormats","tagName","registerBlockType","save","metadata","name","src","xmlns","viewBox","width","height","focusable","d","foreground","edit","Content"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AAMJ;AACmC;AACW;AAExD;AAER,SAASS,IAAIA,CAAC;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAE;EAC3D,MAAM;IAAEC,KAAK;IAAEC;EAAa,CAAC,GAAGH,UAAU;EAE1C,SAASI,oBAAoBA,CAACC,eAAe,EAAE;IAC9CJ,aAAa,CAAC;MAAEE,YAAY,EAAEE;IAAgB,CAAC,CAAC;EACjD;EAEA,OACCC,iEAAA,CAAAC,wDAAA,QACCD,iEAAA,CAACb,kEAAa,QACba,iEAAA,CAACZ,+DAAY,QACZY,iEAAA,CAACX,gEAAa;IACba,QAAQ,EAAEL,YAAY,KAAK,IAAK;IAChCM,IAAI,EAAEb,wDAAc;IACpBc,OAAO,EAAEA,CAAA,KAAM;MACdN,oBAAoB,CAAC,IAAI,CAAC;IAC3B;EAAE,CACF,CAAC,EACFE,iEAAA,CAACX,gEAAa;IACba,QAAQ,EAAEL,YAAY,KAAK,IAAK;IAChCM,IAAI,EAAEZ,wDAAc;IACpBa,OAAO,EAAEA,CAAA,KAAM;MACdN,oBAAoB,CAAC,IAAI,CAAC;IAC3B;EAAE,CACF,CAAC,EACFE,iEAAA,CAACX,gEAAa;IACba,QAAQ,EAAEL,YAAY,KAAK,IAAK;IAChCM,IAAI,EAAEX,wDAAc;IACpBY,OAAO,EAAEA,CAAA,KAAM;MACdN,oBAAoB,CAAC,IAAI,CAAC;IAC3B;EAAE,CACF,CACY,CACA,CAAC,EAEhBE,iEAAA,CAACd,6DAAQ;IACRmB,QAAQ,EAAGC,KAAK,IAAKX,aAAa,CAAC;MAAEC,KAAK,EAAEU;IAAM,CAAC,CAAE;IACrDA,KAAK,EAAEV,KAAM;IACbW,WAAW,EAAEvB,mDAAE,CACd,yBAAyB,E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D;AACA;AACA;AACkD;AAClD,sBAAsB,iEAAa,CAAC,sDAAG;AACvC;AACA;AACA,CAAC,EAAE,iEAAa,CAAC,uDAAI;AACrB;AACA,CAAC;AACD,iEAAe,aAAa,EAAC;AAC7B;;;;;;;;;;;;;;;;;;ACbmD;;AAEnD;AACA;AACA;AACkD;AAClD,sBAAsB,iEAAa,CAAC,sDAAG;AACvC;AACA;AACA,CAAC,EAAE,iEAAa,CAAC,uDAAI;AACrB;AACA,CAAC;AACD,iEAAe,aAAa,EAAC;AAC7B;;;;;;;;;;ACbA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;UAEA;UACA;;;;;WCzBA;WACA;WACA;WACA;WACA,+BAA+B,wCAAwC;WACvE;WACA;WACA;WACA;WACA,iBAAiB,qBAAqB;WACtC;WACA;WACA;WACA;WACA,kBAAkB,qBAAqB;WACvC;WACA;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC7BA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://multiblocks/./src/edit.js","webpack://multiblocks/./src/index.js","webpack://multiblocks/./src/save.js","webpack://multiblocks/./src/editor.scss","webpack://multiblocks/./src/style.scss","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/heading-level-3.js","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/heading-level-4.js","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/heading-level-5.js","webpack://multiblocks/external window [\"wp\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"components\"]","webpack://multiblocks/external window [\"wp\",\"element\"]","webpack://multiblocks/external window [\"wp\",\"i18n\"]","webpack://multiblocks/external window [\"wp\",\"primitives\"]","webpack://multiblocks/webpack/bootstrap","webpack://multiblocks/webpack/runtime/chunk loaded","webpack://multiblocks/webpack/runtime/compat get default export","webpack://multiblocks/webpack/runtime/define property getters","webpack://multiblocks/webpack/runtime/hasOwnProperty shorthand","webpack://multiblocks/webpack/runtime/make namespace object","webpack://multiblocks/webpack/runtime/jsonp chunk loading","webpack://multiblocks/webpack/before-startup","webpack://multiblocks/webpack/startup","webpack://multiblocks/webpack/after-startup"],"sourcesContent":["import { __ } from \"@wordpress/i18n\";\n\nimport {\n\tuseBlockProps,\n\tRichText,\n\tBlockControls,\n} from \"@wordpress/block-editor\";\nimport { ToolbarGroup, ToolbarButton } from \"@wordpress/components\";\nimport { headingLevel3, headingLevel4, headingLevel5 } from \"@wordpress/icons\";\n\nimport \"./editor.scss\";\n\nexport default function Edit({ attributes, setAttributes }) {\n\tconst { title, headingLevel } = attributes;\n\n\tfunction onChangeHeadingLevel(newHeadingLevel) {\n\t\tsetAttributes({ headingLevel: newHeadingLevel });\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t {\n\t\t\t\t\t\t\tonChangeHeadingLevel(\"h3\");\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t {\n\t\t\t\t\t\t\tonChangeHeadingLevel(\"h4\");\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t {\n\t\t\t\t\t\t\tonChangeHeadingLevel(\"h5\");\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\n\t\t\t setAttributes({ title: value })}\n\t\t\t\tvalue={title}\n\t\t\t\tplaceholder={__(\n\t\t\t\t\t\"Insérez votre titre ici\",\n\t\t\t\t\t\"homegrade-blocks__texte-fonctionnel\"\n\t\t\t\t)}\n\t\t\t\tallowedFormats={[\"homegrade-format/tooltip\"]}\n\t\t\t\ttagName={headingLevel}\n\t\t\t\t{...useBlockProps({\n\t\t\t\t\tclassName: `homegrade-blocks-custom-heading`,\n\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 save from \"./save\";\nimport metadata from \"./block.json\";\n\nregisterBlockType(metadata.name, {\n\ticon: {\n\t\tsrc: (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t),\n\t\tforeground: \"#DF1E1E\",\n\t},\n\tedit: Edit,\n\tsave,\n});\n","import { useBlockProps, RichText } from \"@wordpress/block-editor\";\n\nexport default function save({ attributes }) {\n\tconst { title, headingLevel } = attributes;\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\n\t);\n}\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst headingLevel3 = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.3 1.7c-.4-.4-1-.7-1.6-.8v-.1c.6-.2 1.1-.5 1.5-.9.3-.4.5-.8.5-1.3 0-.4-.1-.8-.3-1.1-.2-.3-.5-.6-.8-.8-.4-.2-.8-.4-1.2-.5-.6-.1-1.1-.2-1.6-.2-.6 0-1.3.1-1.8.3s-1.1.5-1.6.9l1.2 1.4c.4-.2.7-.4 1.1-.6.3-.2.7-.3 1.1-.3.4 0 .8.1 1.1.3.3.2.4.5.4.8 0 .4-.2.7-.6.9-.7.3-1.5.5-2.2.4v1.6c.5 0 1 0 1.5.1.3.1.7.2 1 .3.2.1.4.2.5.4s.1.4.1.6c0 .3-.2.7-.5.8-.4.2-.9.3-1.4.3s-1-.1-1.4-.3c-.4-.2-.8-.4-1.2-.7L13 15.6c.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.6 0 1.1-.1 1.6-.2.4-.1.9-.2 1.3-.5.4-.2.7-.5.9-.9.2-.4.3-.8.3-1.2 0-.6-.3-1.1-.7-1.5z\"\n}));\nexport default headingLevel3;\n//# sourceMappingURL=heading-level-3.js.map","import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst headingLevel4 = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M20 13V7h-3l-4 6v2h5v2h2v-2h1v-2h-1zm-2 0h-2.8L18 9v4zm-9-2H5V7H3v10h2v-4h4v4h2V7H9v4z\"\n}));\nexport default headingLevel4;\n//# sourceMappingURL=heading-level-4.js.map","import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst headingLevel5 = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.7 1.2c-.2-.3-.5-.7-.8-.9-.3-.3-.7-.5-1.1-.6-.5-.1-.9-.2-1.4-.2-.2 0-.5.1-.7.1-.2.1-.5.1-.7.2l.1-1.9h4.3V7H14l-.3 5 1 .6.5-.2.4-.1c.1-.1.3-.1.4-.1h.5c.5 0 1 .1 1.4.4.4.2.6.7.6 1.1 0 .4-.2.8-.6 1.1-.4.3-.9.4-1.4.4-.4 0-.9-.1-1.3-.3-.4-.2-.7-.4-1.1-.7 0 0-1.1 1.4-1 1.5.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.5 0 1-.1 1.5-.3s.9-.4 1.3-.7c.4-.3.7-.7.9-1.1s.3-.9.3-1.4-.1-1-.3-1.4z\"\n}));\nexport default headingLevel5;\n//# sourceMappingURL=heading-level-5.js.map","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"primitives\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkmultiblocks\"] = self[\"webpackChunkmultiblocks\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], () => (__webpack_require__(\"./src/index.js\")))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useBlockProps","RichText","BlockControls","ToolbarGroup","ToolbarButton","headingLevel3","headingLevel4","headingLevel5","Edit","attributes","setAttributes","title","headingLevel","onChangeHeadingLevel","newHeadingLevel","createElement","Fragment","isActive","icon","onClick","onChange","value","placeholder","allowedFormats","tagName","className","registerBlockType","save","metadata","name","src","xmlns","viewBox","width","height","focusable","d","foreground","edit","Content"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/content-heading/src/edit.js b/blocks/content-heading/src/edit.js index bae95e1..afb1149 100644 --- a/blocks/content-heading/src/edit.js +++ b/blocks/content-heading/src/edit.js @@ -2,32 +2,11 @@ import { __ } from "@wordpress/i18n"; import { useBlockProps, - HeadingLevelDropdown, - InnerBlocks, RichText, - InspectorControls, - AlignmentToolbar, BlockControls, - PanelColorSettings, - ContrastChecker, } from "@wordpress/block-editor"; -import { - ToolbarGroup, - ToolbarButton, - PanelBody, - ToggleControl, - TextControl, - ColorPalette, - ColorPicker, -} from "@wordpress/components"; -import { - check, - trash, - headingLevel3, - headingLevel4, - headingLevel5, - heading, -} from "@wordpress/icons"; +import { ToolbarGroup, ToolbarButton } from "@wordpress/components"; +import { headingLevel3, headingLevel4, headingLevel5 } from "@wordpress/icons"; import "./editor.scss"; @@ -48,14 +27,6 @@ export default function Edit({ attributes, setAttributes }) { onClick={() => { onChangeHeadingLevel("h3"); }} - // label={ - // !isActive - // ? "Ajouter un lien brochure" - // : "Supprimer le lien brochure" - // } - // onClick={() => - // !isActive ? setIsPopoverOpen(!isPopoverOpen) : removeFormat() - // } /> setAttributes({ title: value })} value={title} placeholder={__( diff --git a/blocks/content-heading/src/save.js b/blocks/content-heading/src/save.js index 2e6609f..708083b 100644 --- a/blocks/content-heading/src/save.js +++ b/blocks/content-heading/src/save.js @@ -1,4 +1,4 @@ -import { useBlockProps, RichText, InnerBlocks } from "@wordpress/block-editor"; +import { useBlockProps, RichText } from "@wordpress/block-editor"; export default function save({ attributes }) { const { title, headingLevel } = attributes; @@ -8,7 +8,6 @@ export default function save({ attributes }) { array('wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '5d8a90ca5c5919d18241'); + array('wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'f073dc5f029a71961853'); diff --git a/blocks/picture-banner/build/index.js b/blocks/picture-banner/build/index.js index 9d081bb..fcb5819 100644 --- a/blocks/picture-banner/build/index.js +++ b/blocks/picture-banner/build/index.js @@ -46,18 +46,18 @@ function Edit({ imagePosition } = attributes; const [blobUrl, setBlobUrl] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(); - const onUploadError = message => { - noticeOperations.removeAllNotices(); // Remove all previous notices + function onUploadError(message) { + noticeOperations.removeAllNotices(); noticeOperations.createErrorNotice(message); - }; - const removeCoverImg = () => { + } + function removeCoverImg() { setAttributes({ coverUrl: undefined, coverId: undefined, coverAlt: "" }); - }; - const updateImage = image => { + } + function updateCoverImage(image) { if (!image || !image.url) { setAttributes({ coverUrl: undefined, @@ -71,7 +71,9 @@ function Edit({ coverId: image.id, coverAlt: image.alt }); - }; + } + + // Si l'upload s'est mal passé -> reset (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { if (!coverId && (0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_5__.isBlobURL)(coverUrl)) { setAttributes({ @@ -80,6 +82,8 @@ function Edit({ }); } }, []); + + // Gestion de l'url temporaire (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { // Fonction de clean du BLOB URL qui se lance à chaque changement de coverUrl if ((0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_5__.isBlobURL)(coverUrl)) { @@ -101,8 +105,6 @@ function Edit({ }, value: imagePosition, onChange: focalPoint => { - // console.log("focalPoint"); - // console.log(focalPoint); setAttributes({ imagePosition: focalPoint }); @@ -126,7 +128,7 @@ function Edit({ name: "Remplacer l'image", disableMediaButtons: coverUrl, icon: "trash", - onSelect: updateImage, + onSelect: updateCoverImage, onError: onUploadError, accept: "image/*" // On upload Allow only images , @@ -140,11 +142,11 @@ function Edit({ icon: "trash", title: "Supprimer l'image", onClick: removeCoverImg - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", { - ...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)() - }, coverUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: `picture-container ${(0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_5__.isBlobURL)(coverUrl) ? "is-loading" : ""} ${heightFixed ? "fixed-height" : ""} ` - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + ...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)({ + className: `homegrade-content-blocks-picture-banner ${(0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_5__.isBlobURL)(coverUrl) ? "is-loading" : ""} ${heightFixed ? "fixed-height" : ""} ` + }) + }, coverUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { src: coverUrl, alt: coverAlt, style: { @@ -153,7 +155,7 @@ function Edit({ }), (0,_wordpress_blob__WEBPACK_IMPORTED_MODULE_5__.isBlobURL)(coverUrl) && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Spinner, null)), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.MediaPlaceholder, { disableMediaButtons: coverUrl, icon: "admin-appearance", - onSelect: updateImage, + onSelect: updateCoverImage, onError: onUploadError, accept: "image/*" // On upload Allow only images , @@ -180,42 +182,13 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/edit.js"); /* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/save.js"); /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/block.json"); -/** - * Registers a new block provided a unique name and an object defining its behavior. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ - - -/** - * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files. - * All files containing `style` keyword are bundled together. The code used - * gets applied both to the front of your site and to the editor. - * - * @see https://www.npmjs.com/package/@wordpress/scripts#using-css - */ - - -/** - * Internal dependencies - */ -/** - * Every block starts by registering a new block type definition. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ + (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, { - /** - * @see ./edit.js - */ edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"], - /** - * @see ./save.js - */ save: _save__WEBPACK_IMPORTED_MODULE_3__["default"] }); @@ -247,20 +220,18 @@ function save({ heightFixed, imagePosition } = attributes; - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", { + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({ - className: `homegrade-content-blocks-picture-banner` + className: `homegrade-content-blocks-picture-banner ${heightFixed ? "fixed-height" : ""}` }) - }, coverUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: `picture-container ${heightFixed ? "fixed-height" : ""}` - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { + }, coverUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { src: coverUrl, alt: coverAlt, style: { objectPosition: `${imagePosition.x * 100}% ${imagePosition.y * 100}%` }, className: `wp-image-${coverId}` - }))); + })); } /***/ }), diff --git a/blocks/picture-banner/build/index.js.map b/blocks/picture-banner/build/index.js.map index c847d38..1ef470b 100644 --- a/blocks/picture-banner/build/index.js.map +++ b/blocks/picture-banner/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACoB;AAOxB;AASF;AACR;AACoC;AAE3D,SAASiB,IAAIA,CAAC;EACbC,UAAU;EACVC,aAAa;EACbC,gBAAgB;EAChBC,UAAU;EACVC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAE;EACF,MAAM;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,WAAW;IAAEC;EAAc,CAAC,GAChEV,UAAU;EACX,MAAM,CAACW,OAAO,EAAEC,UAAU,CAAC,GAAG5B,4DAAQ,CAAC,CAAC;EAExC,MAAM6B,aAAa,GAAIC,OAAO,IAAK;IAClCZ,gBAAgB,CAACa,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACrCb,gBAAgB,CAACc,iBAAiB,CAACF,OAAO,CAAC;EAC5C,CAAC;EACD,MAAMG,cAAc,GAAGA,CAAA,KAAM;IAC5BhB,aAAa,CAAC;MACbK,QAAQ,EAAEY,SAAS;MACnBX,OAAO,EAAEW,SAAS;MAClBV,QAAQ,EAAE;IACX,CAAC,CAAC;EACH,CAAC;EAED,MAAMW,WAAW,GAAIC,KAAK,IAAK;IAC9B,IAAI,CAACA,KAAK,IAAI,CAACA,KAAK,CAACC,GAAG,EAAE;MACzBpB,aAAa,CAAC;QACbK,QAAQ,EAAEY,SAAS;QACnBX,OAAO,EAAEW,SAAS;QAClBV,QAAQ,EAAE;MACX,CAAC,CAAC;MACF;IACD;IACAP,aAAa,CAAC;MACbK,QAAQ,EAAEc,KAAK,CAACC,GAAG;MACnBd,OAAO,EAAEa,KAAK,CAACE,EAAE;MACjBd,QAAQ,EAAEY,KAAK,CAACG;IACjB,CAAC,CAAC;EACH,CAAC;EACDxC,6DAAS,CAAC,MAAM;IACf,IAAI,CAACwB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;;;;;;;;;;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;;UAEA;UACA;;;;;WCzBA;WACA;WACA;WACA;WACA,+BAA+B,wCAAwC;WACvE;WACA;WACA;WACA;WACA,iBAAiB,qBAAqB;WACtC;WACA;WACA;WACA;WACA,kBAAkB,qBAAqB;WACvC;WACA;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC7BA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://multiblocks/./src/edit.js","webpack://multiblocks/./src/index.js","webpack://multiblocks/./src/save.js","webpack://multiblocks/./src/editor.scss","webpack://multiblocks/./src/style.scss","webpack://multiblocks/external window [\"wp\",\"blob\"]","webpack://multiblocks/external window [\"wp\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"components\"]","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 { useEffect, useState } from \"@wordpress/element\";\nimport {\n\tuseBlockProps,\n\tMediaPlaceholder,\n\tBlockControls,\n\tInspectorControls,\n\tMediaReplaceFlow,\n} from \"@wordpress/block-editor\";\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tToolbarDropdownMenu,\n\tSpinner,\n\twithNotices,\n\tFocalPointPicker,\n\tPanelBody,\n} from \"@wordpress/components\";\nimport \"./editor.scss\";\nimport { isBlobURL, revokeBlobURL } from \"@wordpress/blob\";\n\nfunction Edit({\n\tattributes,\n\tsetAttributes,\n\tnoticeOperations,\n\tnoticeList,\n\tnoticeUI,\n\t...props\n}) {\n\tconst { coverUrl, coverId, coverAlt, heightFixed, imagePosition } =\n\t\tattributes;\n\tconst [blobUrl, setBlobUrl] = useState();\n\n\tconst onUploadError = (message) => {\n\t\tnoticeOperations.removeAllNotices(); // Remove all previous notices\n\t\tnoticeOperations.createErrorNotice(message);\n\t};\n\tconst removeCoverImg = () => {\n\t\tsetAttributes({\n\t\t\tcoverUrl: undefined,\n\t\t\tcoverId: undefined,\n\t\t\tcoverAlt: \"\",\n\t\t});\n\t};\n\n\tconst updateImage = (image) => {\n\t\tif (!image || !image.url) {\n\t\t\tsetAttributes({\n\t\t\t\tcoverUrl: undefined,\n\t\t\t\tcoverId: undefined,\n\t\t\t\tcoverAlt: \"\",\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tsetAttributes({\n\t\t\tcoverUrl: image.url,\n\t\t\tcoverId: image.id,\n\t\t\tcoverAlt: image.alt,\n\t\t});\n\t};\n\tuseEffect(() => {\n\t\tif (!coverId && isBlobURL(coverUrl)) {\n\t\t\tsetAttributes({ coverUrl: undefined, coverAlt: \"\" });\n\t\t}\n\t}, []);\n\tuseEffect(() => {\n\t\t// Fonction de clean du BLOB URL qui se lance à chaque changement de coverUrl\n\t\tif (isBlobURL(coverUrl)) {\n\t\t\t// Si la cover est une blob, c'est que ça upload donc on met cette url dans le state\n\t\t\tsetBlobUrl(coverUrl);\n\t\t} else {\n\t\t\t// Si la cover en'est plus une blob, c'est que l'upload est terminé, on revoke la blob et on clean le state\n\t\t\trevokeBlobURL(blobUrl); // On utilise la valeur stocké dans le state pour revoke l'url\n\t\t\tsetBlobUrl();\n\t\t}\n\t}, [coverUrl]);\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t{coverUrl && (\n\t\t\t\t\t\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t// console.log(\"focalPoint\");\n\t\t\t\t\t\t\t\t// console.log(focalPoint);\n\t\t\t\t\t\t\t\tsetAttributes({ imagePosition: focalPoint });\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\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t setAttributes({ heightFixed: true })}\n\t\t\t\t\t/>\n\t\t\t\t\t setAttributes({ heightFixed: false })}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\t{coverUrl && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\n\n\t\t\t
\n\t\t\t\t{coverUrl && (\n\t\t\t\t\t\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t{isBlobURL(coverUrl) && }\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\t\n\t\t\t
\n\t\t\n\t);\n}\n\nexport default withNotices(Edit);\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 {\n\tuseBlockProps,\n\tMediaPlaceholder,\n\tRichText,\n\tBlockControls,\n\tMediaReplaceFlow,\n} from \"@wordpress/block-editor\";\nexport default function save({ attributes }) {\n\tconst { coverUrl, coverId, coverAlt, heightFixed, imagePosition } =\n\t\tattributes;\n\treturn (\n\t\t\n\t\t\t{coverUrl && (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t)}\n\t\t\n\t);\n}\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"blob\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","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":["__","useEffect","useState","useBlockProps","MediaPlaceholder","BlockControls","InspectorControls","MediaReplaceFlow","ToolbarGroup","ToolbarButton","ToolbarDropdownMenu","Spinner","withNotices","FocalPointPicker","PanelBody","isBlobURL","revokeBlobURL","Edit","attributes","setAttributes","noticeOperations","noticeList","noticeUI","props","coverUrl","coverId","coverAlt","heightFixed","imagePosition","blobUrl","setBlobUrl","onUploadError","message","removeAllNotices","createErrorNotice","removeCoverImg","undefined","updateImage","image","url","id","alt","createElement","Fragment","title","dimensions","width","height","value","onChange","focalPoint","icon","label","isActive","onClick","group","name","disableMediaButtons","onSelect","onError","accept","allowedTypes","notices","mediaId","mediaURL","className","src","style","objectPosition","x","y","registerBlockType","save","metadata","edit","RichText"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACoB;AAOxB;AAQF;AACR;AACoC;AAE3D,SAASgB,IAAIA,CAAC;EACbC,UAAU;EACVC,aAAa;EACbC,gBAAgB;EAChBC,UAAU;EACVC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAE;EACF,MAAM;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,WAAW;IAAEC;EAAc,CAAC,GAChEV,UAAU;EACX,MAAM,CAACW,OAAO,EAAEC,UAAU,CAAC,GAAG3B,4DAAQ,CAAC,CAAC;EAExC,SAAS4B,aAAaA,CAACC,OAAO,EAAE;IAC/BZ,gBAAgB,CAACa,gBAAgB,CAAC,CAAC;IACnCb,gBAAgB,CAACc,iBAAiB,CAACF,O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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\",\"blob\"]","webpack://multiblocks/external window [\"wp\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"components\"]","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 { useEffect, useState } from \"@wordpress/element\";\nimport {\n\tuseBlockProps,\n\tMediaPlaceholder,\n\tBlockControls,\n\tInspectorControls,\n\tMediaReplaceFlow,\n} from \"@wordpress/block-editor\";\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tSpinner,\n\twithNotices,\n\tFocalPointPicker,\n\tPanelBody,\n} from \"@wordpress/components\";\nimport \"./editor.scss\";\nimport { isBlobURL, revokeBlobURL } from \"@wordpress/blob\";\n\nfunction Edit({\n\tattributes,\n\tsetAttributes,\n\tnoticeOperations,\n\tnoticeList,\n\tnoticeUI,\n\t...props\n}) {\n\tconst { coverUrl, coverId, coverAlt, heightFixed, imagePosition } =\n\t\tattributes;\n\tconst [blobUrl, setBlobUrl] = useState();\n\n\tfunction onUploadError(message) {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice(message);\n\t}\n\tfunction removeCoverImg() {\n\t\tsetAttributes({\n\t\t\tcoverUrl: undefined,\n\t\t\tcoverId: undefined,\n\t\t\tcoverAlt: \"\",\n\t\t});\n\t}\n\n\tfunction updateCoverImage(image) {\n\t\tif (!image || !image.url) {\n\t\t\tsetAttributes({\n\t\t\t\tcoverUrl: undefined,\n\t\t\t\tcoverId: undefined,\n\t\t\t\tcoverAlt: \"\",\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tsetAttributes({\n\t\t\tcoverUrl: image.url,\n\t\t\tcoverId: image.id,\n\t\t\tcoverAlt: image.alt,\n\t\t});\n\t}\n\n\t// Si l'upload s'est mal passé -> reset\n\tuseEffect(() => {\n\t\tif (!coverId && isBlobURL(coverUrl)) {\n\t\t\tsetAttributes({ coverUrl: undefined, coverAlt: \"\" });\n\t\t}\n\t}, []);\n\n\t// Gestion de l'url temporaire\n\tuseEffect(() => {\n\t\t// Fonction de clean du BLOB URL qui se lance à chaque changement de coverUrl\n\t\tif (isBlobURL(coverUrl)) {\n\t\t\t// Si la cover est une blob, c'est que ça upload donc on met cette url dans le state\n\t\t\tsetBlobUrl(coverUrl);\n\t\t} else {\n\t\t\t// Si la cover en'est plus une blob, c'est que l'upload est terminé, on revoke la blob et on clean le state\n\t\t\trevokeBlobURL(blobUrl); // On utilise la valeur stocké dans le state pour revoke l'url\n\t\t\tsetBlobUrl();\n\t\t}\n\t}, [coverUrl]);\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t{coverUrl && (\n\t\t\t\t\t\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\tsetAttributes({ imagePosition: focalPoint });\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\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t setAttributes({ heightFixed: true })}\n\t\t\t\t\t/>\n\t\t\t\t\t setAttributes({ heightFixed: false })}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\t{coverUrl && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\n\n\t\t\t\n\t\t\t\t{coverUrl && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t{isBlobURL(coverUrl) && }\n\t\t\t\t\t\n\t\t\t\t)}\n\n\t\t\t\t\n\t\t\t\n\t\t\n\t);\n}\n\nexport default withNotices(Edit);\n","import { registerBlockType } from \"@wordpress/blocks\";\nimport \"./style.scss\";\n\nimport Edit from \"./edit\";\nimport save from \"./save\";\nimport metadata from \"./block.json\";\n\nregisterBlockType(metadata.name, {\n\tedit: Edit,\n\tsave,\n});\n","import { useBlockProps } from \"@wordpress/block-editor\";\nexport default function save({ attributes }) {\n\tconst { coverUrl, coverId, coverAlt, heightFixed, imagePosition } =\n\t\tattributes;\n\treturn (\n\t\t\n\t\t\t{coverUrl && (\n\t\t\t\t\n\t\t\t)}\n\t\t\n\t);\n}\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"blob\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","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":["__","useEffect","useState","useBlockProps","MediaPlaceholder","BlockControls","InspectorControls","MediaReplaceFlow","ToolbarGroup","ToolbarButton","Spinner","withNotices","FocalPointPicker","PanelBody","isBlobURL","revokeBlobURL","Edit","attributes","setAttributes","noticeOperations","noticeList","noticeUI","props","coverUrl","coverId","coverAlt","heightFixed","imagePosition","blobUrl","setBlobUrl","onUploadError","message","removeAllNotices","createErrorNotice","removeCoverImg","undefined","updateCoverImage","image","url","id","alt","createElement","Fragment","title","dimensions","width","height","value","onChange","focalPoint","icon","label","isActive","onClick","group","name","disableMediaButtons","onSelect","onError","accept","allowedTypes","notices","mediaId","mediaURL","className","src","style","objectPosition","x","y","registerBlockType","save","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/picture-banner/build/style-index.css b/blocks/picture-banner/build/style-index.css index 9cb6f72..f564c55 100644 --- a/blocks/picture-banner/build/style-index.css +++ b/blocks/picture-banner/build/style-index.css @@ -9,12 +9,10 @@ */ .wp-block-homegrade-content-blocks-picture-banner { margin-bottom: 20px; -} -.wp-block-homegrade-content-blocks-picture-banner .picture-container { overflow: hidden; border-radius: 22px; } -.wp-block-homegrade-content-blocks-picture-banner .picture-container.fixed-height img { +.wp-block-homegrade-content-blocks-picture-banner.fixed-height img { width: 100%; height: 200px; -o-object-fit: cover; diff --git a/blocks/picture-banner/build/style-index.css.map b/blocks/picture-banner/build/style-index.css.map index 78f26fe..04920f3 100644 --- a/blocks/picture-banner/build/style-index.css.map +++ b/blocks/picture-banner/build/style-index.css.map @@ -1 +1 @@ -{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAOA;EACC;AAAD;AACC;EACC;EACA;AACF;AACG;EACC;EACA;EACA;KAAA;EACA;KAAA;AACJ,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-homegrade-content-blocks-picture-banner {\n\tmargin-bottom: 20px;\n\t.picture-container {\n\t\toverflow: hidden;\n\t\tborder-radius: 22px;\n\t\t&.fixed-height {\n\t\t\timg {\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 200px;\n\t\t\t\tobject-fit: cover;\n\t\t\t\tobject-position: center;\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAOA;EACC;EACA;EACA;AAAD;AAEE;EACC;EACA;EACA;KAAA;EACA;KAAA;AAAH,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-homegrade-content-blocks-picture-banner {\n\tmargin-bottom: 20px;\n\toverflow: hidden;\n\tborder-radius: 22px;\n\t&.fixed-height {\n\t\timg {\n\t\t\twidth: 100%;\n\t\t\theight: 200px;\n\t\t\tobject-fit: cover;\n\t\t\tobject-position: center;\n\t\t}\n\t}\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/picture-banner/src/edit.js b/blocks/picture-banner/src/edit.js index 4e92d6c..c257fc0 100644 --- a/blocks/picture-banner/src/edit.js +++ b/blocks/picture-banner/src/edit.js @@ -10,7 +10,6 @@ import { import { ToolbarGroup, ToolbarButton, - ToolbarDropdownMenu, Spinner, withNotices, FocalPointPicker, @@ -31,19 +30,19 @@ function Edit({ attributes; const [blobUrl, setBlobUrl] = useState(); - const onUploadError = (message) => { - noticeOperations.removeAllNotices(); // Remove all previous notices + function onUploadError(message) { + noticeOperations.removeAllNotices(); noticeOperations.createErrorNotice(message); - }; - const removeCoverImg = () => { + } + function removeCoverImg() { setAttributes({ coverUrl: undefined, coverId: undefined, coverAlt: "", }); - }; + } - const updateImage = (image) => { + function updateCoverImage(image) { if (!image || !image.url) { setAttributes({ coverUrl: undefined, @@ -57,12 +56,16 @@ function Edit({ coverId: image.id, coverAlt: image.alt, }); - }; + } + + // Si l'upload s'est mal passé -> reset useEffect(() => { if (!coverId && isBlobURL(coverUrl)) { setAttributes({ coverUrl: undefined, coverAlt: "" }); } }, []); + + // Gestion de l'url temporaire useEffect(() => { // Fonction de clean du BLOB URL qui se lance à chaque changement de coverUrl if (isBlobURL(coverUrl)) { @@ -88,8 +91,6 @@ function Edit({ }} value={imagePosition} onChange={(focalPoint) => { - // console.log("focalPoint"); - // console.log(focalPoint); setAttributes({ imagePosition: focalPoint }); }} /> @@ -118,7 +119,7 @@ function Edit({ name="Remplacer l'image" disableMediaButtons={coverUrl} icon="trash" - onSelect={updateImage} + onSelect={updateCoverImage} onError={onUploadError} accept="image/*" // On upload Allow only images allowedTypes={["image"]} // Onlibrary Allow only images @@ -135,13 +136,15 @@ function Edit({ )} -
+
{coverUrl && ( -
+ <> {coverAlt} {isBlobURL(coverUrl) && } -
+ )} + -
+ ); } diff --git a/blocks/picture-banner/src/index.js b/blocks/picture-banner/src/index.js index ade1e47..d537a9d 100644 --- a/blocks/picture-banner/src/index.js +++ b/blocks/picture-banner/src/index.js @@ -1,39 +1,11 @@ -/** - * Registers a new block provided a unique name and an object defining its behavior. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ -import { registerBlockType } from '@wordpress/blocks'; +import { registerBlockType } from "@wordpress/blocks"; +import "./style.scss"; -/** - * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files. - * All files containing `style` keyword are bundled together. The code used - * gets applied both to the front of your site and to the editor. - * - * @see https://www.npmjs.com/package/@wordpress/scripts#using-css - */ -import './style.scss'; +import Edit from "./edit"; +import save from "./save"; +import metadata from "./block.json"; -/** - * Internal dependencies - */ -import Edit from './edit'; -import save from './save'; -import metadata from './block.json'; - -/** - * Every block starts by registering a new block type definition. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ -registerBlockType( metadata.name, { - /** - * @see ./edit.js - */ +registerBlockType(metadata.name, { edit: Edit, - - /** - * @see ./save.js - */ save, -} ); +}); diff --git a/blocks/picture-banner/src/save.js b/blocks/picture-banner/src/save.js index ad54897..813874e 100644 --- a/blocks/picture-banner/src/save.js +++ b/blocks/picture-banner/src/save.js @@ -1,35 +1,27 @@ -import { - useBlockProps, - MediaPlaceholder, - RichText, - BlockControls, - MediaReplaceFlow, -} from "@wordpress/block-editor"; +import { useBlockProps } from "@wordpress/block-editor"; export default function save({ attributes }) { const { coverUrl, coverId, coverAlt, heightFixed, imagePosition } = attributes; return ( -
{coverUrl && ( -
- {coverAlt} -
+ {coverAlt} )} -
+ ); } diff --git a/blocks/picture-banner/src/style.scss b/blocks/picture-banner/src/style.scss index c355204..a3df8c8 100644 --- a/blocks/picture-banner/src/style.scss +++ b/blocks/picture-banner/src/style.scss @@ -7,16 +7,14 @@ .wp-block-homegrade-content-blocks-picture-banner { margin-bottom: 20px; - .picture-container { - overflow: hidden; - border-radius: 22px; - &.fixed-height { - img { - width: 100%; - height: 200px; - object-fit: cover; - object-position: center; - } + overflow: hidden; + border-radius: 22px; + &.fixed-height { + img { + width: 100%; + height: 200px; + object-fit: cover; + object-position: center; } } } diff --git a/blocks/questions-container/build/index.asset.php b/blocks/questions-container/build/index.asset.php index 3cd8f25..cdbd39f 100644 --- a/blocks/questions-container/build/index.asset.php +++ b/blocks/questions-container/build/index.asset.php @@ -1 +1 @@ - array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => '0b6b72dd5b7cf42b9c8a'); + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => 'd119409565df9cba01b5'); diff --git a/blocks/questions-container/build/index.js b/blocks/questions-container/build/index.js index a6d505d..9da3d17 100644 --- a/blocks/questions-container/build/index.js +++ b/blocks/questions-container/build/index.js @@ -107,7 +107,6 @@ function OptionsSelectControl({ return null; }); (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - console.log(relatedPossiblePages); if (relatedPossiblePages) { setRelatedQuestionPages(buildSelectOptions(relatedPossiblePages)); } diff --git a/blocks/questions-container/build/index.js.map b/blocks/questions-container/build/index.js.map index 38bb6fb..65208c2 100644 --- a/blocks/questions-container/build/index.js.map +++ b/blocks/questions-container/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACuB;AACK;AAC1C;AACqB;AACa;AACC;AAE3C,SAASQ,oBAAoBA,CAAC;EAAEC,aAAa;EAAEC;AAAc,CAAC,EAAE;EAAA,IAAAC,IAAA;EAC9E,IAAI,CAACC,oBAAoB,EAAEC,uBAAuB,CAAC,GAAGP,4DAAQ,CAAC,IAAI,CAAC;EAEpE,MAAMQ,IAAI,GAAGC,0BAA0B,CAAC,0BAA0B,CAAC;EAEnE,SAASA,0BAA0BA,CAACC,MAAM,EAAE;IAC3C,IAAIC,OAAO,GAAGC,QAAQ,CAACC,MAAM;MAC5BC,OAAO,GAAGH,OAAO,CAACI,OAAO,CAAC,GAAG,GAAGL,MAAM,GAAG,GAAG,CAAC;IAC9C,IAAII,OAAO,IAAI,CAAC,CAAC,EAAEA,OAAO,GAAGH,OAAO,CAACI,OAAO,CAACL,MAAM,GAAG,GAAG,CAAC;IAC1D,IAAII,OAAO,IAAI,CAAC,CAAC,EAAE;MAClBH,OAAO,GAAG,IAAI;IACf,CAAC,MAAM;MACNG,OAAO,GAAGH,OAAO,CAACI,OAAO,CAAC,GAAG,EAAED,OAAO,CAAC,GAAG,CAAC;MAC3C,IAAIE,KAAK,GAAGL,OAAO,CAACI,OAAO,CAAC,GAAG,EAAED,OAAO,CAAC;MACzC,IAAIE,KAAK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AAER,6CAAIA;AACX,CAAC,CAAC;;;;;;;;;;;ACTF;;;;;;;;;;;;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;;UAEA;UACA;;;;;WCzBA;WACA;WACA;WACA;WACA,+BAA+B,wCAAwC;WACvE;WACA;WACA;WACA;WACA,iBAAiB,qBAAqB;WACtC;WACA;WACA;WACA;WACA,kBAAkB,qBAAqB;WACvC;WACA;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC7BA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://multiblocks/./src/OptionsSelectControl.js","webpack://multiblocks/./src/edit.js","webpack://multiblocks/./src/index.js","webpack://multiblocks/./src/editor.scss","webpack://multiblocks/./src/style.scss","webpack://multiblocks/external window [\"wp\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"components\"]","webpack://multiblocks/external window [\"wp\",\"data\"]","webpack://multiblocks/external window [\"wp\",\"element\"]","webpack://multiblocks/external window [\"wp\",\"htmlEntities\"]","webpack://multiblocks/external window [\"wp\",\"i18n\"]","webpack://multiblocks/webpack/bootstrap","webpack://multiblocks/webpack/runtime/chunk loaded","webpack://multiblocks/webpack/runtime/compat get default export","webpack://multiblocks/webpack/runtime/define property getters","webpack://multiblocks/webpack/runtime/hasOwnProperty shorthand","webpack://multiblocks/webpack/runtime/make namespace object","webpack://multiblocks/webpack/runtime/jsonp chunk loading","webpack://multiblocks/webpack/before-startup","webpack://multiblocks/webpack/startup","webpack://multiblocks/webpack/after-startup"],"sourcesContent":["import { __ } from \"@wordpress/i18n\";\r\nimport { InspectorControls } from \"@wordpress/block-editor\";\r\nimport { PanelBody, SelectControl } from \"@wordpress/components\";\r\nimport \"./editor.scss\";\r\nimport { useSelect } from \"@wordpress/data\";\r\nimport { useEffect, useState } from \"@wordpress/element\";\r\nimport { decodeEntities } from \"@wordpress/html-entities\";\r\n\r\nexport default function OptionsSelectControl({ setAttributes, relatedPostId }) {\r\n\tlet [relatedQuestionPages, setRelatedQuestionPages] = useState(null);\r\n\r\n\tconst lang = getAdminLanguageFromCookie(\"wp-wpml_current_language\");\r\n\r\n\tfunction getAdminLanguageFromCookie(c_name) {\r\n\t\tvar c_value = document.cookie,\r\n\t\t\tc_start = c_value.indexOf(\" \" + c_name + \"=\");\r\n\t\tif (c_start == -1) c_start = c_value.indexOf(c_name + \"=\");\r\n\t\tif (c_start == -1) {\r\n\t\t\tc_value = null;\r\n\t\t} else {\r\n\t\t\tc_start = c_value.indexOf(\"=\", c_start) + 1;\r\n\t\t\tvar c_end = c_value.indexOf(\";\", c_start);\r\n\t\t\tif (c_end == -1) {\r\n\t\t\t\tc_end = c_value.length;\r\n\t\t\t}\r\n\t\t\tc_value = unescape(c_value.substring(c_start, c_end));\r\n\t\t}\r\n\t\treturn c_value;\r\n\t}\r\n\r\n\tfunction handleRelatedPostChange(postId) {\r\n\t\tsetAttributes({ relatedPostId: Number(postId) });\r\n\t}\r\n\tfunction buildSelectOptions(relatedPossiblePages) {\r\n\t\tlet options = [];\r\n\t\tif (relatedPossiblePages) {\r\n\t\t\toptions.push({ value: 0, label: \"Select a page\" });\r\n\t\t\trelatedPossiblePages.forEach((page) => {\r\n\t\t\t\toptions.push({\r\n\t\t\t\t\tvalue: page.id,\r\n\t\t\t\t\tlabel: decodeEntities(page.title.rendered),\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\toptions.push({ value: 0, label: \"Pas encore de questions...\" });\r\n\t\t}\r\n\t\treturn options;\r\n\t}\r\n\r\n\t// GET TAXONOMIES INOFRMATION\r\n\tlet postTaxonomies = useSelect((select) =>\r\n\t\tselect(\"core/editor\").getCurrentPostAttribute(\"thematiques\")\r\n\t);\r\n\tlet postMainTaxonomy = useSelect(\r\n\t\t(select) =>\r\n\t\t\tselect(\"core\").getEntityRecord(\r\n\t\t\t\t\"taxonomy\",\r\n\t\t\t\t\"thematiques\",\r\n\t\t\t\tpostTaxonomies[0]\r\n\t\t\t),\r\n\t\t[postTaxonomies]\r\n\t);\r\n\tlet postParentTaxonomy = useSelect(\r\n\t\t(select) => {\r\n\t\t\tif (postMainTaxonomy && postMainTaxonomy.parent) {\r\n\t\t\t\treturn select(\"core\").getEntityRecord(\r\n\t\t\t\t\t\"taxonomy\",\r\n\t\t\t\t\t\"thematiques\",\r\n\t\t\t\t\tpostMainTaxonomy.parent\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t},\r\n\t\t[postMainTaxonomy]\r\n\t);\r\n\r\n\t// GET RELATED POSSIBLE PAGES ACCORDING TO CURRENT TAXONOMY\r\n\tconst relatedPossiblePages = useSelect((select) => {\r\n\t\tif (postMainTaxonomy) {\r\n\t\t\tlet query = {\r\n\t\t\t\tstatus: \"publish\",\r\n\t\t\t\tper_page: -1,\r\n\t\t\t\tlang: lang,\r\n\t\t\t\tthematiques: postMainTaxonomy ? postMainTaxonomy.id : null,\r\n\t\t\t};\r\n\t\t\treturn select(\"core\").getEntityRecords(\"postType\", \"questions\", query);\r\n\t\t}\r\n\t\treturn null;\r\n\t});\r\n\r\n\tuseEffect(() => {\r\n\t\tconsole.log(relatedPossiblePages);\r\n\t\tif (relatedPossiblePages) {\r\n\t\t\tsetRelatedQuestionPages(buildSelectOptions(relatedPossiblePages));\r\n\t\t}\r\n\t}, [relatedPossiblePages]);\r\n\r\n\tlet currentGeneralThematique = postParentTaxonomy ?? postMainTaxonomy ?? null;\r\n\r\n\tlet panelTitle = postParentTaxonomy\r\n\t\t? \"Questions \" + postParentTaxonomy.name\r\n\t\t: postMainTaxonomy\r\n\t\t? \"Questions \" + postMainTaxonomy.name\r\n\t\t: null;\r\n\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t handleRelatedPostChange(e)}\r\n\t\t\t\t/>\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n","import { __ } from \"@wordpress/i18n\";\nimport { useBlockProps } from \"@wordpress/block-editor\";\n\nimport { useSelect } from \"@wordpress/data\"; // pour les querry\nimport \"./editor.scss\";\nimport { RawHTML } from \"@wordpress/element\";\nimport { decodeEntities } from \"@wordpress/html-entities\";\nimport OptionsSelectControl from \"./OptionsSelectControl\";\n\nexport default function Edit({ attributes, setAttributes }) {\n\tconst { relatedPostId } = attributes;\n\n\tlet currentRelatedPost = useSelect((select) =>\n\t\tselect(\"core\").getEntityRecord(\"postType\", \"questions\", relatedPostId)\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t\n\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

{decodeEntities(currentRelatedPost.title.rendered)}

\n\t\t\t\t\t\t{currentRelatedPost.content.rendered}\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\n\t\t\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\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\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"htmlEntities\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"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":["__","InspectorControls","PanelBody","SelectControl","useSelect","useEffect","useState","decodeEntities","OptionsSelectControl","setAttributes","relatedPostId","_ref","relatedQuestionPages","setRelatedQuestionPages","lang","getAdminLanguageFromCookie","c_name","c_value","document","cookie","c_start","indexOf","c_end","length","unescape","substring","handleRelatedPostChange","postId","Number","buildSelectOptions","relatedPossiblePages","options","push","value","label","forEach","page","id","title","rendered","postTaxonomies","select","getCurrentPostAttribute","postMainTaxonomy","getEntityRecord","postParentTaxonomy","parent","query","status","per_page","thematiques","getEntityRecords","console","log","currentGeneralThematique","panelTitle","name","createElement","onChange","e","useBlockProps","RawHTML","Edit","attributes","currentRelatedPost","Fragment","className","content","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACuB;AACK;AAC1C;AACqB;AACa;AACC;AAE3C,SAASQ,oBAAoBA,CAAC;EAAEC,aAAa;EAAEC;AAAc,CAAC,EAAE;EAAA,IAAAC,IAAA;EAC9E,IAAI,CAACC,oBAAoB,EAAEC,uBAAuB,CAAC,GAAGP,4DAAQ,CAAC,IAAI,CAAC;EAEpE,MAAMQ,IAAI,GAAGC,0BAA0B,CAAC,0BAA0B,CAAC;EAEnE,SAASA,0BAA0BA,CAACC,MAAM,EAAE;IAC3C,IAAIC,OAAO,GAAGC,QAAQ,CAACC,MAAM;MAC5BC,OAAO,GAAGH,OAAO,CAACI,OAAO,CAAC,GAAG,GAAGL,MAAM,GAAG,GAAG,CAAC;IAC9C,IAAII,OAAO,IAAI,CAAC,CAAC,EAAEA,OAAO,GAAGH,OAAO,CAACI,OAAO,CAACL,MAAM,GAAG,GAAG,CAAC;IAC1D,IAAII,OAAO,IAAI,CAAC,CAAC,EAAE;MAClBH,OAAO,GAAG,IAAI;IACf,CAAC,MAAM;MACNG,OAAO,GAAGH,OAAO,CAACI,OAAO,CAAC,GAAG,EAAED,OAAO,CAAC,GAAG,CAAC;MAC3C,IAAIE,KAAK,GAAGL,OAAO,CAACI,OAAO,CAAC,GAAG,EAAED,OAAO,CAAC;MACzC,IAAIE,KAAK,IAAI,CAAC,CAAC,EAAE;QAChBA,KAAK,GAAGL,OAAO,CAACM,MAAM;MACvB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ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;UAEA;UACA;;;;;WCzBA;WACA;WACA;WACA;WACA,+BAA+B,wCAAwC;WACvE;WACA;WACA;WACA;WACA,iBAAiB,qBAAqB;WACtC;WACA;WACA;WACA;WACA,kBAAkB,qBAAqB;WACvC;WACA;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC7BA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://multiblocks/./src/OptionsSelectControl.js","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\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"components\"]","webpack://multiblocks/external window [\"wp\",\"data\"]","webpack://multiblocks/external window [\"wp\",\"element\"]","webpack://multiblocks/external window [\"wp\",\"htmlEntities\"]","webpack://multiblocks/external window [\"wp\",\"i18n\"]","webpack://multiblocks/webpack/bootstrap","webpack://multiblocks/webpack/runtime/chunk loaded","webpack://multiblocks/webpack/runtime/compat get default export","webpack://multiblocks/webpack/runtime/define property getters","webpack://multiblocks/webpack/runtime/hasOwnProperty shorthand","webpack://multiblocks/webpack/runtime/make namespace object","webpack://multiblocks/webpack/runtime/jsonp chunk loading","webpack://multiblocks/webpack/before-startup","webpack://multiblocks/webpack/startup","webpack://multiblocks/webpack/after-startup"],"sourcesContent":["import { __ } from \"@wordpress/i18n\";\r\nimport { InspectorControls } from \"@wordpress/block-editor\";\r\nimport { PanelBody, SelectControl } from \"@wordpress/components\";\r\nimport \"./editor.scss\";\r\nimport { useSelect } from \"@wordpress/data\";\r\nimport { useEffect, useState } from \"@wordpress/element\";\r\nimport { decodeEntities } from \"@wordpress/html-entities\";\r\n\r\nexport default function OptionsSelectControl({ setAttributes, relatedPostId }) {\r\n\tlet [relatedQuestionPages, setRelatedQuestionPages] = useState(null);\r\n\r\n\tconst lang = getAdminLanguageFromCookie(\"wp-wpml_current_language\");\r\n\r\n\tfunction getAdminLanguageFromCookie(c_name) {\r\n\t\tvar c_value = document.cookie,\r\n\t\t\tc_start = c_value.indexOf(\" \" + c_name + \"=\");\r\n\t\tif (c_start == -1) c_start = c_value.indexOf(c_name + \"=\");\r\n\t\tif (c_start == -1) {\r\n\t\t\tc_value = null;\r\n\t\t} else {\r\n\t\t\tc_start = c_value.indexOf(\"=\", c_start) + 1;\r\n\t\t\tvar c_end = c_value.indexOf(\";\", c_start);\r\n\t\t\tif (c_end == -1) {\r\n\t\t\t\tc_end = c_value.length;\r\n\t\t\t}\r\n\t\t\tc_value = unescape(c_value.substring(c_start, c_end));\r\n\t\t}\r\n\t\treturn c_value;\r\n\t}\r\n\r\n\tfunction handleRelatedPostChange(postId) {\r\n\t\tsetAttributes({ relatedPostId: Number(postId) });\r\n\t}\r\n\tfunction buildSelectOptions(relatedPossiblePages) {\r\n\t\tlet options = [];\r\n\t\tif (relatedPossiblePages) {\r\n\t\t\toptions.push({ value: 0, label: \"Select a page\" });\r\n\t\t\trelatedPossiblePages.forEach((page) => {\r\n\t\t\t\toptions.push({\r\n\t\t\t\t\tvalue: page.id,\r\n\t\t\t\t\tlabel: decodeEntities(page.title.rendered),\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\toptions.push({ value: 0, label: \"Pas encore de questions...\" });\r\n\t\t}\r\n\t\treturn options;\r\n\t}\r\n\r\n\t// GET TAXONOMIES INOFRMATION\r\n\tlet postTaxonomies = useSelect((select) =>\r\n\t\tselect(\"core/editor\").getCurrentPostAttribute(\"thematiques\")\r\n\t);\r\n\tlet postMainTaxonomy = useSelect(\r\n\t\t(select) =>\r\n\t\t\tselect(\"core\").getEntityRecord(\r\n\t\t\t\t\"taxonomy\",\r\n\t\t\t\t\"thematiques\",\r\n\t\t\t\tpostTaxonomies[0]\r\n\t\t\t),\r\n\t\t[postTaxonomies]\r\n\t);\r\n\tlet postParentTaxonomy = useSelect(\r\n\t\t(select) => {\r\n\t\t\tif (postMainTaxonomy && postMainTaxonomy.parent) {\r\n\t\t\t\treturn select(\"core\").getEntityRecord(\r\n\t\t\t\t\t\"taxonomy\",\r\n\t\t\t\t\t\"thematiques\",\r\n\t\t\t\t\tpostMainTaxonomy.parent\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t},\r\n\t\t[postMainTaxonomy]\r\n\t);\r\n\r\n\t// GET RELATED POSSIBLE PAGES ACCORDING TO CURRENT TAXONOMY\r\n\tconst relatedPossiblePages = useSelect((select) => {\r\n\t\tif (postMainTaxonomy) {\r\n\t\t\tlet query = {\r\n\t\t\t\tstatus: \"publish\",\r\n\t\t\t\tper_page: -1,\r\n\t\t\t\tlang: lang,\r\n\t\t\t\tthematiques: postMainTaxonomy ? postMainTaxonomy.id : null,\r\n\t\t\t};\r\n\t\t\treturn select(\"core\").getEntityRecords(\"postType\", \"questions\", query);\r\n\t\t}\r\n\t\treturn null;\r\n\t});\r\n\r\n\tuseEffect(() => {\r\n\t\tif (relatedPossiblePages) {\r\n\t\t\tsetRelatedQuestionPages(buildSelectOptions(relatedPossiblePages));\r\n\t\t}\r\n\t}, [relatedPossiblePages]);\r\n\r\n\tlet currentGeneralThematique = postParentTaxonomy ?? postMainTaxonomy ?? null;\r\n\r\n\tlet panelTitle = postParentTaxonomy\r\n\t\t? \"Questions \" + postParentTaxonomy.name\r\n\t\t: postMainTaxonomy\r\n\t\t? \"Questions \" + postMainTaxonomy.name\r\n\t\t: null;\r\n\r\n\treturn (\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t handleRelatedPostChange(e)}\r\n\t\t\t\t/>\r\n\t\t\t\r\n\t\t\r\n\t);\r\n}\r\n","import { __ } from \"@wordpress/i18n\";\nimport { useBlockProps } from \"@wordpress/block-editor\";\n\nimport { useSelect } from \"@wordpress/data\"; // pour les querry\nimport \"./editor.scss\";\nimport { RawHTML } from \"@wordpress/element\";\nimport { decodeEntities } from \"@wordpress/html-entities\";\nimport OptionsSelectControl from \"./OptionsSelectControl\";\n\nexport default function Edit({ attributes, setAttributes }) {\n\tconst { relatedPostId } = attributes;\n\n\tlet currentRelatedPost = useSelect((select) =>\n\t\tselect(\"core\").getEntityRecord(\"postType\", \"questions\", relatedPostId)\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t\n\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

{decodeEntities(currentRelatedPost.title.rendered)}

\n\t\t\t\t\t\t{currentRelatedPost.content.rendered}\n\t\t\t\t\t\n\t\t\t\t)}\n\t\t\t\n\t\t\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\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\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"htmlEntities\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"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":["__","InspectorControls","PanelBody","SelectControl","useSelect","useEffect","useState","decodeEntities","OptionsSelectControl","setAttributes","relatedPostId","_ref","relatedQuestionPages","setRelatedQuestionPages","lang","getAdminLanguageFromCookie","c_name","c_value","document","cookie","c_start","indexOf","c_end","length","unescape","substring","handleRelatedPostChange","postId","Number","buildSelectOptions","relatedPossiblePages","options","push","value","label","forEach","page","id","title","rendered","postTaxonomies","select","getCurrentPostAttribute","postMainTaxonomy","getEntityRecord","postParentTaxonomy","parent","query","status","per_page","thematiques","getEntityRecords","currentGeneralThematique","panelTitle","name","createElement","onChange","e","useBlockProps","RawHTML","Edit","attributes","currentRelatedPost","Fragment","className","content","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/questions-container/src/OptionsSelectControl.js b/blocks/questions-container/src/OptionsSelectControl.js index d5b949e..dee38e8 100644 --- a/blocks/questions-container/src/OptionsSelectControl.js +++ b/blocks/questions-container/src/OptionsSelectControl.js @@ -89,7 +89,6 @@ export default function OptionsSelectControl({ setAttributes, relatedPostId }) { }); useEffect(() => { - console.log(relatedPossiblePages); if (relatedPossiblePages) { setRelatedQuestionPages(buildSelectOptions(relatedPossiblePages)); } diff --git a/blocks/vocabulaire-summary/build/block.json b/blocks/vocabulaire-summary/build/block.json index 4f092cb..16b11fa 100644 --- a/blocks/vocabulaire-summary/build/block.json +++ b/blocks/vocabulaire-summary/build/block.json @@ -5,24 +5,25 @@ "version": "0.1.0", "title": "Vocabulaire de la fiche", "category": "homegrade-blocks", - "icon": "testimonial", + "icon": { + "foreground": "#DF1E1E", + "src": "testimonial" + }, "description": "Pour afficher tout le vocabulaire contenu dans la fiche", "supports": { - "html": false + "html": false, + "multiple": false }, "textdomain": "homegrade-blocks", "editorScript": "file:./index.js", "viewScript": "file:./frontend.js", "editorStyle": "file:./index.css", "style": "file:./style-index.css", + "render": "file:./render.php", "attributes": { "tooltipWords": { "type": "array", "default": [] - }, - "thematiqueName": { - "type": "string", - "default": "" } } } \ No newline at end of file diff --git a/blocks/vocabulaire-summary/build/frontend.asset.php b/blocks/vocabulaire-summary/build/frontend.asset.php index 62becb8..8b1905f 100644 --- a/blocks/vocabulaire-summary/build/frontend.asset.php +++ b/blocks/vocabulaire-summary/build/frontend.asset.php @@ -1 +1 @@ - array(), 'version' => '2e7c7fcf1637e390f7ca'); + array(), 'version' => '2d7b588bd723edf3035b'); diff --git a/blocks/vocabulaire-summary/build/frontend.js b/blocks/vocabulaire-summary/build/frontend.js index a445f2f..7f6ec8d 100644 --- a/blocks/vocabulaire-summary/build/frontend.js +++ b/blocks/vocabulaire-summary/build/frontend.js @@ -20,7 +20,6 @@ window.addEventListener("DOMContentLoaded", event => { }); } function closeAccordion(wordDetail) { - console.log("will close"); let contentDefinitionWrapper = wordDetail.querySelector(".homegrade-blocks-vocabulaire-summary__content-wrapper"); contentDefinitionWrapper.style.height = "0px"; setTimeout(() => { diff --git a/blocks/vocabulaire-summary/build/frontend.js.map b/blocks/vocabulaire-summary/build/frontend.js.map index 58bf320..6b85cc3 100644 --- a/blocks/vocabulaire-summary/build/frontend.js.map +++ b/blocks/vocabulaire-summary/build/frontend.js.map @@ -1 +1 @@ -{"version":3,"file":"frontend.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;IACvCH,UAAU,CAACG,YAAY,CAAC,YAAY,EAAE,EAAE,CAAC;IAEzCF,wBAAwB,CAACG,KAAK,CAACC,MAAM,GACpCH,0BAA0B,CAACI,YAAY,GAAG,IAAI;IAC/C;;IAEAN,UAAU,CAACR,gBAAgB,CAAC,eAAe,EAAE,MAAM;MAClDQ,UAAU,CAACO,eAAe,CAAC,YAAY,CAAC;IACzC,CAAC,CAAC;EACH;EACA,SAASC,cAAcA,CAACR,UAAU,EAAE;IACnCS,OAAO,CAACC,GAAG,CAAC,YAAY,CAAC;IACzB,IAAIT,wBAAwB,GAAGD,UAAU,CAACJ,aAAa,CACtD,wDACD,CAAC;IAEDK,wBAAwB,CAACG,KAAK,CAACC,MAAM,GAAG,KAAK;IAE7CM,UAAU,CAAC,MAAM;MAChBX,UAAU,CAACO,eAAe,CAAC,MAAM,CAAC;IACnC,CAAC,EAAE,GAAG,CAAC;EACR;EACA;EACA,SAASK,YAAYA,CAACZ,UAAU,EAAE;IACjC,IAAIa,MAAM,GAAGb,UAAU,CAACc,YAAY,CAAC,MAAM,CAAC;IAC5C,IAAIC,SAAS,GAAGf,UAAU,CAACc,YAAY,CAAC,YAAY,CAAC;IAErD,IAAID,MAAM,IAAI,IAAI,IAAIE,SAAS,IAAI,IAAI,EAAE;MACxChB,aAAa,CAACC,UAAU,CAAC;IAC1B;IACA,IAAIa,MAAM,IAAI,MAAM,EAAE;MACrBL,cAAc,CAACR,UAAU,CAAC;IAC3B;EACD;;EAEA;EACAgB,KAAK,CAACC,IAAI,CAACpB,YAAY,CAAC,CAACqB,OAAO,CAAElB,UAAU,IAAK;IAChDA,UAAU,CAACR,gBAAgB,CAAC,OAAO,EAAGC,KAAK,IAAK;MAC/CA,KAAK,CAAC0B,cAAc,CAAC,CAAC;MACtBP,YAAY,CAACZ,UAAU,CAAC;IACzB,CAAC,CAAC;EACH,CAAC,CAAC;AACH,CAAC,CAAC,C","sources":["webpack://vocabulaire-summary/./src/frontend.js"],"sourcesContent":["window.addEventListener(\"DOMContentLoaded\", (event) => {\r\n\t// GETTING ELEMENTS FROM THE DOM\r\n\tconst vocabulaireSummary = document.querySelector(\r\n\t\t\".homegrade-blocks-vocabulaire-summary\"\r\n\t);\r\n\tconst wordsDetails = vocabulaireSummary.querySelectorAll(\"details\");\r\n\r\n\tfunction openAccordion(wordDetail) {\r\n\t\tlet contentDefinitionWrapper = wordDetail.querySelector(\r\n\t\t\t\".homegrade-blocks-vocabulaire-summary__content-wrapper\"\r\n\t\t);\r\n\t\tlet contentDefinitionParagraph = wordDetail.querySelector(\r\n\t\t\t\".homegrade-blocks-vocabulaire-summary__content\"\r\n\t\t);\r\n\t\twordDetail.setAttribute(\"open\", \"true\");\r\n\t\twordDetail.setAttribute(\"is_opening\", \"\");\r\n\r\n\t\tcontentDefinitionWrapper.style.height =\r\n\t\t\tcontentDefinitionParagraph.offsetHeight + \"px\";\r\n\t\t// remove is opening after css transition\r\n\r\n\t\twordDetail.addEventListener(\"transitionend\", () => {\r\n\t\t\twordDetail.removeAttribute(\"is_opening\");\r\n\t\t});\r\n\t}\r\n\tfunction closeAccordion(wordDetail) {\r\n\t\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\tlet isOpening = wordDetail.getAttribute(\"is_opening\");\r\n\r\n\t\tif (isOpen == null && isOpening == null) {\r\n\t\t\topenAccordion(wordDetail);\r\n\t\t}\r\n\t\tif (isOpen == \"true\") {\r\n\t\t\tcloseAccordion(wordDetail);\r\n\t\t}\r\n\t}\r\n\r\n\t// HANDLING CLICK\r\n\tArray.from(wordsDetails).forEach((wordDetail) => {\r\n\t\twordDetail.addEventListener(\"click\", (event) => {\r\n\t\t\tevent.preventDefault();\r\n\t\t\ttoggleActive(wordDetail);\r\n\t\t});\r\n\t});\r\n});\r\n"],"names":["window","addEventListener","event","vocabulaireSummary","document","querySelector","wordsDetails","querySelectorAll","openAccordion","wordDetail","contentDefinitionWrapper","contentDefinitionParagraph","setAttribute","style","height","offsetHeight","removeAttribute","closeAccordion","console","log","setTimeout","toggleActive","isOpen","getAttribute","isOpening","Array","from","forEach","preventDefault"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"frontend.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;IACvCH,UAAU,CAACG,YAAY,CAAC,YAAY,EAAE,EAAE,CAAC;IAEzCF,wBAAwB,CAACG,KAAK,CAACC,MAAM,GACpCH,0BAA0B,CAACI,YAAY,GAAG,IAAI;IAC/C;;IAEAN,UAAU,CAACR,gBAAgB,CAAC,eAAe,EAAE,MAAM;MAClDQ,UAAU,CAACO,eAAe,CAAC,YAAY,CAAC;IACzC,CAAC,CAAC;EACH;EACA,SAASC,cAAcA,CAACR,UAAU,EAAE;IACnC,IAAIC,wBAAwB,GAAGD,UAAU,CAACJ,aAAa,CACtD,wDACD,CAAC;IAEDK,wBAAwB,CAACG,KAAK,CAACC,MAAM,GAAG,KAAK;IAE7CI,UAAU,CAAC,MAAM;MAChBT,UAAU,CAACO,eAAe,CAAC,MAAM,CAAC;IACnC,CAAC,EAAE,GAAG,CAAC;EACR;EACA;EACA,SAASG,YAAYA,CAACV,UAAU,EAAE;IACjC,IAAIW,MAAM,GAAGX,UAAU,CAACY,YAAY,CAAC,MAAM,CAAC;IAC5C,IAAIC,SAAS,GAAGb,UAAU,CAACY,YAAY,CAAC,YAAY,CAAC;IAErD,IAAID,MAAM,IAAI,IAAI,IAAIE,SAAS,IAAI,IAAI,EAAE;MACxCd,aAAa,CAACC,UAAU,CAAC;IAC1B;IACA,IAAIW,MAAM,IAAI,MAAM,EAAE;MACrBH,cAAc,CAACR,UAAU,CAAC;IAC3B;EACD;;EAEA;EACAc,KAAK,CAACC,IAAI,CAAClB,YAAY,CAAC,CAACmB,OAAO,CAAEhB,UAAU,IAAK;IAChDA,UAAU,CAACR,gBAAgB,CAAC,OAAO,EAAGC,KAAK,IAAK;MAC/CA,KAAK,CAACwB,cAAc,CAAC,CAAC;MACtBP,YAAY,CAACV,UAAU,CAAC;IACzB,CAAC,CAAC;EACH,CAAC,CAAC;AACH,CAAC,CAAC,C","sources":["webpack://vocabulaire-summary/./src/frontend.js"],"sourcesContent":["window.addEventListener(\"DOMContentLoaded\", (event) => {\r\n\t// GETTING ELEMENTS FROM THE DOM\r\n\tconst vocabulaireSummary = document.querySelector(\r\n\t\t\".homegrade-blocks-vocabulaire-summary\"\r\n\t);\r\n\tconst wordsDetails = vocabulaireSummary.querySelectorAll(\"details\");\r\n\r\n\tfunction openAccordion(wordDetail) {\r\n\t\tlet contentDefinitionWrapper = wordDetail.querySelector(\r\n\t\t\t\".homegrade-blocks-vocabulaire-summary__content-wrapper\"\r\n\t\t);\r\n\t\tlet contentDefinitionParagraph = wordDetail.querySelector(\r\n\t\t\t\".homegrade-blocks-vocabulaire-summary__content\"\r\n\t\t);\r\n\t\twordDetail.setAttribute(\"open\", \"true\");\r\n\t\twordDetail.setAttribute(\"is_opening\", \"\");\r\n\r\n\t\tcontentDefinitionWrapper.style.height =\r\n\t\t\tcontentDefinitionParagraph.offsetHeight + \"px\";\r\n\t\t// remove is opening after css transition\r\n\r\n\t\twordDetail.addEventListener(\"transitionend\", () => {\r\n\t\t\twordDetail.removeAttribute(\"is_opening\");\r\n\t\t});\r\n\t}\r\n\tfunction closeAccordion(wordDetail) {\r\n\t\tlet contentDefinitionWrapper = wordDetail.querySelector(\r\n\t\t\t\".homegrade-blocks-vocabulaire-summary__content-wrapper\"\r\n\t\t);\r\n\r\n\t\tcontentDefinitionWrapper.style.height = \"0px\";\r\n\r\n\t\tsetTimeout(() => {\r\n\t\t\twordDetail.removeAttribute(\"open\");\r\n\t\t}, 300);\r\n\t}\r\n\t// HANDLING CLICK\r\n\tfunction toggleActive(wordDetail) {\r\n\t\tlet isOpen = wordDetail.getAttribute(\"open\");\r\n\t\tlet isOpening = wordDetail.getAttribute(\"is_opening\");\r\n\r\n\t\tif (isOpen == null && isOpening == null) {\r\n\t\t\topenAccordion(wordDetail);\r\n\t\t}\r\n\t\tif (isOpen == \"true\") {\r\n\t\t\tcloseAccordion(wordDetail);\r\n\t\t}\r\n\t}\r\n\r\n\t// HANDLING CLICK\r\n\tArray.from(wordsDetails).forEach((wordDetail) => {\r\n\t\twordDetail.addEventListener(\"click\", (event) => {\r\n\t\t\tevent.preventDefault();\r\n\t\t\ttoggleActive(wordDetail);\r\n\t\t});\r\n\t});\r\n});\r\n"],"names":["window","addEventListener","event","vocabulaireSummary","document","querySelector","wordsDetails","querySelectorAll","openAccordion","wordDetail","contentDefinitionWrapper","contentDefinitionParagraph","setAttribute","style","height","offsetHeight","removeAttribute","closeAccordion","setTimeout","toggleActive","isOpen","getAttribute","isOpening","Array","from","forEach","preventDefault"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/vocabulaire-summary/build/index.asset.php b/blocks/vocabulaire-summary/build/index.asset.php index f244ca3..1685dd7 100644 --- a/blocks/vocabulaire-summary/build/index.asset.php +++ b/blocks/vocabulaire-summary/build/index.asset.php @@ -1 +1 @@ - array('react', 'wp-block-editor', 'wp-blocks', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'db2e165aea172016cf17'); + array('react', 'wp-block-editor', 'wp-blocks', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '4da44f9f4582d3fdcce4'); diff --git a/blocks/vocabulaire-summary/build/index.css b/blocks/vocabulaire-summary/build/index.css index efb8ea8..d6689e0 100644 --- a/blocks/vocabulaire-summary/build/index.css +++ b/blocks/vocabulaire-summary/build/index.css @@ -1,13 +1,4 @@ /*!****************************************************************************************************************************************************************************************************************************************!*\ !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***! \****************************************************************************************************************************************************************************************************************************************/ -/** - * The following styles get applied inside the editor only. - * - * Replace them with your own styles or remove the file completely. - */ -.wp-block-create-block-multiblocks { - border: 1px dotted #f00; -} -/*# sourceMappingURL=index.css.map*/ \ No newline at end of file diff --git a/blocks/vocabulaire-summary/build/index.js b/blocks/vocabulaire-summary/build/index.js index 515d34a..38ad82d 100644 --- a/blocks/vocabulaire-summary/build/index.js +++ b/blocks/vocabulaire-summary/build/index.js @@ -70,73 +70,69 @@ __webpack_require__.r(__webpack_exports__); -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, - thematiqueName + tooltipWords } = attributes; let [hasFetchedDatas, setHasFetchedDatas] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + 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; + } 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 + let currentThematique = (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); @@ -145,19 +141,13 @@ function Edit({ }); } }, [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)({ className: `homegrade-blocks-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", { + }, "Vocabulaire \u2014", " ", currentThematique && currentThematique.name ? currentThematique.name : "{...pas de thématique}"), tooltipWords && tooltipWords.map(elem => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("details", { className: "question" }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("summary", null, elem.tooltipText, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { className: "open-close-icon" @@ -185,98 +175,18 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss"); /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/edit.js"); -/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/save.js"); -/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/block.json"); -/** - * Registers a new block provided a unique name and an object defining its behavior. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ - - -/** - * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files. - * All files containing `style` keyword are bundled together. The code used - * gets applied both to the front of your site and to the editor. - * - * @see https://www.npmjs.com/package/@wordpress/scripts#using-css - */ - - -/** - * Internal dependencies - */ +/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./block.json */ "./src/block.json"); +// import save from "./save"; -/** - * Every block starts by registering a new block type definition. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ -(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, { - /** - * @see ./edit.js - */ - edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"], - /** - * @see ./save.js - */ - save: _save__WEBPACK_IMPORTED_MODULE_3__["default"] +(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_3__.name, { + edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"] }); /***/ }), -/***/ "./src/save.js": -/*!*********************!*\ - !*** ./src/save.js ***! - \*********************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (/* binding */ save) -/* harmony export */ }); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); -/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _img_chevron_down_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./img/chevron_down.svg */ "./src/img/chevron_down.svg"); - - - -function save({ - attributes, - setAttributes -}) { - let { - tooltipWords, - thematiqueName - } = attributes; - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", { - ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({ - className: `homegrade-blocks-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", { - className: "question" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("summary", null, elem.tooltipText, " ", (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { - className: "open-close-icon" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { - src: _img_chevron_down_svg__WEBPACK_IMPORTED_MODULE_2__["default"], - className: "open-close-cta", - alt: "" - }))), (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))))); -} - -/***/ }), - /***/ "./src/editor.scss": /*!*************************!*\ !*** ./src/editor.scss ***! @@ -377,7 +287,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","viewScript":"file:./frontend.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"tooltipWords":{"type":"array","default":[]},"thematiqueName":{"type":"string","default":""}}}'); +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/vocabulaire-summary","version":"0.1.0","title":"Vocabulaire de la fiche","category":"homegrade-blocks","icon":{"foreground":"#DF1E1E","src":"testimonial"},"description":"Pour afficher tout le vocabulaire contenu dans la fiche","supports":{"html":false,"multiple":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","viewScript":"file:./frontend.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","attributes":{"tooltipWords":{"type":"array","default":[]}}}'); /***/ }) diff --git a/blocks/vocabulaire-summary/build/index.js.map b/blocks/vocabulaire-summary/build/index.js.map index 2d30be6..add7977 100644 --- a/blocks/vocabulaire-summary/build/index.js.map +++ b/blocks/vocabulaire-summary/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;AAAA;AACA,sBAAsB,sEAAsE,gBAAgB,sBAAs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WACA;WACA;WACA,kBAAkB,qBAAqB;WACvC;WACA;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC7BA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://vocabulaire-summary/./src/img/chevron_down.svg","webpack://vocabulaire-summary/./src/edit.js","webpack://vocabulaire-summary/./src/index.js","webpack://vocabulaire-summary/./src/save.js","webpack://vocabulaire-summary/./src/editor.scss","webpack://vocabulaire-summary/./src/style.scss","webpack://vocabulaire-summary/external window \"React\"","webpack://vocabulaire-summary/external window [\"wp\",\"blockEditor\"]","webpack://vocabulaire-summary/external window [\"wp\",\"blocks\"]","webpack://vocabulaire-summary/external window [\"wp\",\"coreData\"]","webpack://vocabulaire-summary/external window [\"wp\",\"data\"]","webpack://vocabulaire-summary/external window [\"wp\",\"element\"]","webpack://vocabulaire-summary/external window [\"wp\",\"i18n\"]","webpack://vocabulaire-summary/webpack/bootstrap","webpack://vocabulaire-summary/webpack/runtime/chunk loaded","webpack://vocabulaire-summary/webpack/runtime/compat get default export","webpack://vocabulaire-summary/webpack/runtime/define property getters","webpack://vocabulaire-summary/webpack/runtime/hasOwnProperty shorthand","webpack://vocabulaire-summary/webpack/runtime/make namespace object","webpack://vocabulaire-summary/webpack/runtime/jsonp chunk loading","webpack://vocabulaire-summary/webpack/before-startup","webpack://vocabulaire-summary/webpack/startup","webpack://vocabulaire-summary/webpack/after-startup"],"sourcesContent":["var _path;\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nimport * as React from \"react\";\nvar SvgChevronDown = function SvgChevronDown(props) {\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n xmlns: \"http://www.w3.org/2000/svg\",\n width: 11.668,\n height: 7.885\n }, props), _path || (_path = /*#__PURE__*/React.createElement(\"path\", {\n \"data-name\": \"Trac\\\\xE9 3614\",\n d: \"m1.406 1.406 4.428 5.478 4.427-5.478\",\n fill: \"none\",\n stroke: \"#000\",\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2\n })));\n};\nexport { SvgChevronDown as ReactComponent };\nexport default \"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMS42NjgiIGhlaWdodD0iNy44ODUiIHZpZXdCb3g9IjAgMCAxMS42NjggNy44ODUiPgogIDxwYXRoIGlkPSJUcmFjw6lfMzYxNCIgZGF0YS1uYW1lPSJUcmFjw6kgMzYxNCIgZD0iTTAsOC44NTUsNS40NzgsNC40MjcsMCwwIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMC4yNjEgMS40MDYpIHJvdGF0ZSg5MCkiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjIiLz4KPC9zdmc+Cg==\";","import { __ } from \"@wordpress/i18n\";\nimport { useBlockProps } from \"@wordpress/block-editor\";\nimport \"./editor.scss\";\nimport { useEntityRecord } from \"@wordpress/core-data\";\nimport { useState } from \"@wordpress/element\";\nimport { useSelect, useDispatch } from \"@wordpress/data\";\nimport { useEffect } from \"@wordpress/element\";\nimport { useEntityProp } from \"@wordpress/core-data\";\nimport chevronDown from \"./img/chevron_down.svg\";\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{elem.tooltipText}\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t

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

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t))}\n\t\t\n\t);\n}\n","/**\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\";\nimport chevronDown from \"./img/chevron_down.svg\";\n\nexport default function save({ attributes, setAttributes }) {\n\tlet { tooltipWords, thematiqueName } = attributes;\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{elem.tooltipText}{\" \"}\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t

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

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t))}\n\t\t\n\t);\n}\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"React\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkvocabulaire_summary\"] = self[\"webpackChunkvocabulaire_summary\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], () => (__webpack_require__(\"./src/index.js\")))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useBlockProps","useEntityRecord","useState","useSelect","useDispatch","useEffect","useEntityProp","chevronDown","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","src","alt","registerBlockType","save","metadata","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;AAAA;AACA,sBAAsB,sEAAsE,gBAAgB,sBAAsB,OAAO,2BAA2B,0BAA0B,yDAAyD,iCAAiC,kBAAkB;AAC3Q;AAC/B;AACA,sBAAsB,gDAAmB;AACzC;AACA;AACA;AACA,GAAG,yCAAyC,gDAAmB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AAC4C;AAC5C,iEAAe,oBAAoB,wbAAwb;;;;;;;;;;;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;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://vocabulaire-summary/./src/img/chevron_down.svg","webpack://vocabulaire-summary/./src/edit.js","webpack://vocabulaire-summary/./src/index.js","webpack://vocabulaire-summary/./src/editor.scss","webpack://vocabulaire-summary/./src/style.scss","webpack://vocabulaire-summary/external window \"React\"","webpack://vocabulaire-summary/external window [\"wp\",\"blockEditor\"]","webpack://vocabulaire-summary/external window [\"wp\",\"blocks\"]","webpack://vocabulaire-summary/external window [\"wp\",\"coreData\"]","webpack://vocabulaire-summary/external window [\"wp\",\"data\"]","webpack://vocabulaire-summary/external window [\"wp\",\"element\"]","webpack://vocabulaire-summary/external window [\"wp\",\"i18n\"]","webpack://vocabulaire-summary/webpack/bootstrap","webpack://vocabulaire-summary/webpack/runtime/chunk loaded","webpack://vocabulaire-summary/webpack/runtime/compat get default export","webpack://vocabulaire-summary/webpack/runtime/define property getters","webpack://vocabulaire-summary/webpack/runtime/hasOwnProperty shorthand","webpack://vocabulaire-summary/webpack/runtime/make namespace object","webpack://vocabulaire-summary/webpack/runtime/jsonp chunk loading","webpack://vocabulaire-summary/webpack/before-startup","webpack://vocabulaire-summary/webpack/startup","webpack://vocabulaire-summary/webpack/after-startup"],"sourcesContent":["var _path;\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nimport * as React from \"react\";\nvar SvgChevronDown = function SvgChevronDown(props) {\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n xmlns: \"http://www.w3.org/2000/svg\",\n width: 11.668,\n height: 7.885\n }, props), _path || (_path = /*#__PURE__*/React.createElement(\"path\", {\n \"data-name\": \"Trac\\\\xE9 3614\",\n d: \"m1.406 1.406 4.428 5.478 4.427-5.478\",\n fill: \"none\",\n stroke: \"#000\",\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeWidth: 2\n })));\n};\nexport { SvgChevronDown as ReactComponent };\nexport default \"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMS42NjgiIGhlaWdodD0iNy44ODUiIHZpZXdCb3g9IjAgMCAxMS42NjggNy44ODUiPgogIDxwYXRoIGlkPSJUcmFjw6lfMzYxNCIgZGF0YS1uYW1lPSJUcmFjw6kgMzYxNCIgZD0iTTAsOC44NTUsNS40NzgsNC40MjcsMCwwIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMC4yNjEgMS40MDYpIHJvdGF0ZSg5MCkiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjIiLz4KPC9zdmc+Cg==\";","import { __ } from \"@wordpress/i18n\";\nimport { useBlockProps } from \"@wordpress/block-editor\";\nimport \"./editor.scss\";\nimport { useEntityRecord } from \"@wordpress/core-data\";\nimport { useState } from \"@wordpress/element\";\nimport { useSelect, useDispatch } from \"@wordpress/data\";\nimport { useEffect } from \"@wordpress/element\";\nimport { useEntityProp } from \"@wordpress/core-data\";\nimport chevronDown from \"./img/chevron_down.svg\";\n\nexport default function Edit({ attributes, setAttributes }) {\n\tlet { tooltipWords } = attributes;\n\tlet [hasFetchedDatas, setHasFetchedDatas] = useState(false);\n\n\tfunction CurrentThematiqueDisplay({ id }) {\n\t\tconst { record, isResolving } = useEntityRecord(\n\t\t\t\"taxonomy\",\n\t\t\t\"thematiques\",\n\t\t\tid\n\t\t);\n\n\t\tif (isResolving) {\n\t\t\treturn \"Loading...\";\n\t\t}\n\t\tif (!record) {\n\t\t\treturn \"no post...\";\n\t\t}\n\t\treturn record.name;\n\t}\n\tfunction getCurrentThematique(id) {\n\t\tconst { record, isResolving } = useEntityRecord(\n\t\t\t\"taxonomy\",\n\t\t\t\"thematiques\",\n\t\t\tid\n\t\t);\n\n\t\tif (isResolving) {\n\t\t\treturn \"Loading...\";\n\t\t}\n\t\tif (!record) {\n\t\t\treturn \"no post...\";\n\t\t}\n\t\treturn record;\n\t}\n\tfunction buildTooltipWords(editorContent) {\n\t\t// Parsing Content\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\t// Looping over tooltip words and filtering duplicates\n\t\tArray.from(domTooltipWords).forEach((tooltipWord) => {\n\t\t\tconst tooltipID = tooltipWord.getAttribute(\"data-definition-id\");\n\t\t\tconst tooltipText = tooltipWord.getAttribute(\"data-tooltip-word\");\n\t\t\tconst tooltipDefinition = tooltipWord.getAttribute(\n\t\t\t\t\"data-tooltip-definition\"\n\t\t\t);\n\n\t\t\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\treturn filteredTooltipWords;\n\t}\n\n\tconst currentPost = useSelect((select) =>\n\t\tselect(\"core/editor\").getCurrentPost()\n\t);\n\n\tconst currentTaxonomies = useSelect((select) =>\n\t\tselect(\"core/editor\").getCurrentPostAttribute(\"thematiques\")\n\t);\n\n\tlet currentThematique = useSelect(\n\t\t(select) =>\n\t\t\tselect(\"core\").getEntityRecord(\n\t\t\t\t\"taxonomy\",\n\t\t\t\t\"thematiques\",\n\t\t\t\tcurrentTaxonomies[0] // or currentPost.thematiques[0] works as well\n\t\t\t),\n\t\t[currentTaxonomies]\n\t);\n\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\treturn (\n\t\t\n\t\t\t

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

\n\t\t\t{tooltipWords &&\n\t\t\t\ttooltipWords.map((elem) => (\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{elem.tooltipText}\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t

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

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t))}\n\t\t\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\nimport \"./style.scss\";\n\nimport Edit from \"./edit\";\n// import save from \"./save\";\nimport metadata from \"./block.json\";\n\nregisterBlockType(metadata.name, {\n\tedit: Edit,\n});\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"React\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"coreData\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkvocabulaire_summary\"] = self[\"webpackChunkvocabulaire_summary\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], () => (__webpack_require__(\"./src/index.js\")))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useBlockProps","useEntityRecord","useState","useSelect","useDispatch","useEffect","useEntityProp","chevronDown","Edit","attributes","setAttributes","tooltipWords","hasFetchedDatas","setHasFetchedDatas","CurrentThematiqueDisplay","id","record","isResolving","name","getCurrentThematique","buildTooltipWords","editorContent","parser","DOMParser","doc","parseFromString","domTooltipWords","querySelectorAll","filteredTooltipWords","Array","from","forEach","tooltipWord","tooltipID","getAttribute","tooltipText","tooltipDefinition","existingTooltip","find","item","push","currentPost","select","getCurrentPost","currentTaxonomies","getCurrentPostAttribute","currentThematique","getEntityRecord","content","newTooltipWords","createElement","className","map","elem","src","alt","registerBlockType","metadata","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/vocabulaire-summary/build/render.php b/blocks/vocabulaire-summary/build/render.php new file mode 100644 index 0000000..b81add6 --- /dev/null +++ b/blocks/vocabulaire-summary/build/render.php @@ -0,0 +1,27 @@ +ID, 'thematiques')[0]; +?> + +
+

+ Vocabulaire name ? " — " . $thematique->name : ""; ?> +

+ + +
+ + +
+ +
+
+
+

+ +

+
+
+ +
\ No newline at end of file diff --git a/blocks/vocabulaire-summary/src/block.json b/blocks/vocabulaire-summary/src/block.json index d1bf2bf..b4a77df 100644 --- a/blocks/vocabulaire-summary/src/block.json +++ b/blocks/vocabulaire-summary/src/block.json @@ -5,24 +5,25 @@ "version": "0.1.0", "title": "Vocabulaire de la fiche", "category": "homegrade-blocks", - "icon": "testimonial", + "icon": { + "foreground": "#DF1E1E", + "src": "testimonial" + }, "description": "Pour afficher tout le vocabulaire contenu dans la fiche", "supports": { - "html": false + "html": false, + "multiple": false }, "textdomain": "homegrade-blocks", "editorScript": "file:./index.js", "viewScript": "file:./frontend.js", "editorStyle": "file:./index.css", "style": "file:./style-index.css", + "render": "file:./render.php", "attributes": { "tooltipWords": { "type": "array", "default": [] - }, - "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 8256914..caa83f4 100644 --- a/blocks/vocabulaire-summary/src/edit.js +++ b/blocks/vocabulaire-summary/src/edit.js @@ -7,79 +7,81 @@ import { useSelect, useDispatch } from "@wordpress/data"; import { useEffect } from "@wordpress/element"; import { useEntityProp } from "@wordpress/core-data"; import chevronDown from "./img/chevron_down.svg"; -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, thematiqueName } = attributes; + let { tooltipWords } = attributes; let [hasFetchedDatas, setHasFetchedDatas] = useState(false); + 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; + } + const currentPost = useSelect((select) => select("core/editor").getCurrentPost() ); + const currentTaxonomies = useSelect((select) => select("core/editor").getCurrentPostAttribute("thematiques") ); - let fetchedCurrentThematique = useSelect( + + let currentThematique = useSelect( (select) => select("core").getEntityRecord( "taxonomy", @@ -89,10 +91,6 @@ export default function Edit({ attributes, setAttributes }) { [currentTaxonomies] ); - if (!currentPost || !currentPost.content) { - return

Loading...

; - } - useEffect(() => { if (currentPost.content) { let newTooltipWords = buildTooltipWords(currentPost.content); @@ -100,11 +98,6 @@ export default function Edit({ attributes, setAttributes }) { } }, [currentPost]); - useEffect(() => { - if (!fetchedCurrentThematique) return; - setAttributes({ thematiqueName: fetchedCurrentThematique.name }); - }, [fetchedCurrentThematique, currentPost]); - return (

- Vocabulaire — {thematiqueName} + Vocabulaire —{" "} + {currentThematique && currentThematique.name + ? currentThematique.name + : "{...pas de thématique}"}

{tooltipWords && tooltipWords.map((elem) => ( diff --git a/blocks/vocabulaire-summary/src/editor.scss b/blocks/vocabulaire-summary/src/editor.scss index 0ba9f21..e69de29 100644 --- a/blocks/vocabulaire-summary/src/editor.scss +++ b/blocks/vocabulaire-summary/src/editor.scss @@ -1,9 +0,0 @@ -/** - * The following styles get applied inside the editor only. - * - * Replace them with your own styles or remove the file completely. - */ - -.wp-block-create-block-multiblocks { - border: 1px dotted #f00; -} diff --git a/blocks/vocabulaire-summary/src/frontend.js b/blocks/vocabulaire-summary/src/frontend.js index 55cd866..c2e83c3 100644 --- a/blocks/vocabulaire-summary/src/frontend.js +++ b/blocks/vocabulaire-summary/src/frontend.js @@ -24,7 +24,6 @@ window.addEventListener("DOMContentLoaded", (event) => { }); } function closeAccordion(wordDetail) { - console.log("will close"); let contentDefinitionWrapper = wordDetail.querySelector( ".homegrade-blocks-vocabulaire-summary__content-wrapper" ); diff --git a/blocks/vocabulaire-summary/src/index.js b/blocks/vocabulaire-summary/src/index.js index ade1e47..c618a29 100644 --- a/blocks/vocabulaire-summary/src/index.js +++ b/blocks/vocabulaire-summary/src/index.js @@ -1,39 +1,10 @@ -/** - * Registers a new block provided a unique name and an object defining its behavior. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ -import { registerBlockType } from '@wordpress/blocks'; +import { registerBlockType } from "@wordpress/blocks"; +import "./style.scss"; -/** - * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files. - * All files containing `style` keyword are bundled together. The code used - * gets applied both to the front of your site and to the editor. - * - * @see https://www.npmjs.com/package/@wordpress/scripts#using-css - */ -import './style.scss'; +import Edit from "./edit"; +// import save from "./save"; +import metadata from "./block.json"; -/** - * Internal dependencies - */ -import Edit from './edit'; -import save from './save'; -import metadata from './block.json'; - -/** - * Every block starts by registering a new block type definition. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ - */ -registerBlockType( metadata.name, { - /** - * @see ./edit.js - */ +registerBlockType(metadata.name, { edit: Edit, - - /** - * @see ./save.js - */ - save, -} ); +}); diff --git a/blocks/vocabulaire-summary/src/render.php b/blocks/vocabulaire-summary/src/render.php new file mode 100644 index 0000000..b81add6 --- /dev/null +++ b/blocks/vocabulaire-summary/src/render.php @@ -0,0 +1,27 @@ +ID, 'thematiques')[0]; +?> + +
+

+ Vocabulaire name ? " — " . $thematique->name : ""; ?> +

+ + +
+ + +
+ +
+
+
+

+ +

+
+
+ +
\ No newline at end of file diff --git a/blocks/vocabulaire-summary/src/save.js b/blocks/vocabulaire-summary/src/save.js deleted file mode 100644 index 63d6a09..0000000 --- a/blocks/vocabulaire-summary/src/save.js +++ /dev/null @@ -1,34 +0,0 @@ -import { useBlockProps } from "@wordpress/block-editor"; -import chevronDown from "./img/chevron_down.svg"; - -export default function save({ attributes, setAttributes }) { - let { tooltipWords, thematiqueName } = attributes; - - return ( -
-

- Vocabulaire — {thematiqueName} -

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

- {elem.tooltipDefinition} -

-
-
- ))} -
- ); -} diff --git a/build/index.asset.php b/build/index.asset.php index 9fc0f1d..0bb8721 100644 --- a/build/index.asset.php +++ b/build/index.asset.php @@ -1 +1 @@ - array('wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-rich-text'), 'version' => '772a0f124214b8df6636'); + array('wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-rich-text'), 'version' => 'cb157be43098e220ac58'); diff --git a/build/index.css b/build/index.css index da4bad1..db50855 100644 --- a/build/index.css +++ b/build/index.css @@ -1,13 +1,6 @@ -/*!**********************************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./src/format-types/tooltip.css ***! - \**********************************************************************************************************************************************************************************/ -.popover_tooltip_field { - .components-popover__content { - padding: 10px !important; - min-width: 200px; - } -} - +/*!******************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./src/format-types/tooltip/tooltip.css ***! + \******************************************************************************************************************************************************************************************/ .tooltip-word { padding-top: 12px; position: relative; @@ -22,9 +15,12 @@ position: absolute; top: -6px; left: 50%; - text-align: center; + text-align: left; transform: translate(-50%, -100%); padding: 10px; + max-width: 300px; + width: -moz-max-content; + width: max-content; } .tooltip-popup:after { content: ""; @@ -38,13 +34,27 @@ transform: translate(-50%, -50%) rotate(45deg); box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.08); } -.tooltip-popup p { +.tooltip-popup__title { + font-weight: bold; + color: black !important; + padding-bottom: 10px; +} +.tooltip-popup__definition { + color: black !important; margin: 0 !important; } -/*!***********************************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./src/format-types/brochure.css ***! - \***********************************************************************************************************************************************************************************/ +/* FOR THE EDITOR */ +.popover_tooltip_field { + .components-popover__content { + padding: 10px !important; + min-width: 200px; + } +} + +/*!********************************************************************************************************************************************************************************************!*\ + !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./src/format-types/brochure/brochure.css ***! + \********************************************************************************************************************************************************************************************/ .brochure-download-icon { margin: 0 0px 0 6px; display: inline-block; diff --git a/build/index.css.map b/build/index.css.map index 728162f..3461cc9 100644 --- a/build/index.css.map +++ b/build/index.css.map @@ -1 +1 @@ -{"version":3,"file":"index.css","mappings":";;;AAAA;CACC;EACC,wBAAwB;EACxB,gBAAgB;CACjB;AACD;;AAEA;CACC,iBAAiB;CACjB,kBAAkB;CAClB,eAAe;CACf,0BAA0B;CAC1B,6BAA6B;CAC7B,0BAA0B;AAC3B;;AAEA;CACC,wBAAwB;CACxB,kBAAkB;CAClB,SAAS;CACT,SAAS;CACT,kBAAkB;CAClB,iCAAiC;CACjC,aAAa;AACd;AACA;CACC,WAAW;CACX,cAAc;CACd,uBAAuB;CACvB,kBAAkB;CAClB,SAAS;CACT,SAAS;CACT,WAAW;CACX,YAAY;CACZ,8CAA8C;CAC9C,2CAA2C;AAC5C;AACA;CACC,oBAAoB;AACrB;;;;;ACvCA;CACC,mBAAmB;CACnB,qBAAqB;CACrB,2BAA2B;AAC5B","sources":["webpack://multi-blocks/./src/format-types/tooltip.css","webpack://multi-blocks/./src/format-types/brochure.css"],"sourcesContent":[".popover_tooltip_field {\r\n\t.components-popover__content {\r\n\t\tpadding: 10px !important;\r\n\t\tmin-width: 200px;\r\n\t}\r\n}\r\n\r\n.tooltip-word {\r\n\tpadding-top: 12px;\r\n\tposition: relative;\r\n\tcursor: default;\r\n\ttext-underline-offset: 4px;\r\n\ttext-decoration-style: dashed;\r\n\ttext-decoration-color: red;\r\n}\r\n\r\n.tooltip-popup {\r\n\tbackground-color: yellow;\r\n\tposition: absolute;\r\n\ttop: -6px;\r\n\tleft: 50%;\r\n\ttext-align: center;\r\n\ttransform: translate(-50%, -100%);\r\n\tpadding: 10px;\r\n}\r\n.tooltip-popup:after {\r\n\tcontent: \"\";\r\n\tdisplay: block;\r\n\tbackground-color: white;\r\n\tposition: absolute;\r\n\ttop: 100%;\r\n\tleft: 50%;\r\n\twidth: 20px;\r\n\theight: 20px;\r\n\ttransform: translate(-50%, -50%) rotate(45deg);\r\n\tbox-shadow: 4px 4px 4px rgba(0, 0, 0, 0.08);\r\n}\r\n.tooltip-popup p {\r\n\tmargin: 0 !important;\r\n}\r\n",".brochure-download-icon {\r\n\tmargin: 0 0px 0 6px;\r\n\tdisplay: inline-block;\r\n\ttransform: translateY(-1px);\r\n}\r\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.css","mappings":";;;AAAA;CACC,iBAAiB;CACjB,kBAAkB;CAClB,eAAe;CACf,0BAA0B;CAC1B,6BAA6B;CAC7B,0BAA0B;AAC3B;;AAEA;CACC,wBAAwB;CACxB,kBAAkB;CAClB,SAAS;CACT,SAAS;CACT,gBAAgB;CAChB,iCAAiC;CACjC,aAAa;CACb,gBAAgB;CAChB,uBAAkB;CAAlB,kBAAkB;AACnB;AACA;CACC,WAAW;CACX,cAAc;CACd,uBAAuB;CACvB,kBAAkB;CAClB,SAAS;CACT,SAAS;CACT,WAAW;CACX,YAAY;CACZ,8CAA8C;CAC9C,2CAA2C;AAC5C;AACA;CACC,iBAAiB;CACjB,uBAAuB;CACvB,oBAAoB;AACrB;AACA;CACC,uBAAuB;CACvB,oBAAoB;AACrB;;AAEA,mBAAmB;AACnB;CACC;EACC,wBAAwB;EACxB,gBAAgB;CACjB;AACD;;;;;AChDA;CACC,mBAAmB;CACnB,qBAAqB;CACrB,2BAA2B;AAC5B","sources":["webpack://multi-blocks/./src/format-types/tooltip/tooltip.css","webpack://multi-blocks/./src/format-types/brochure/brochure.css"],"sourcesContent":[".tooltip-word {\r\n\tpadding-top: 12px;\r\n\tposition: relative;\r\n\tcursor: default;\r\n\ttext-underline-offset: 4px;\r\n\ttext-decoration-style: dashed;\r\n\ttext-decoration-color: red;\r\n}\r\n\r\n.tooltip-popup {\r\n\tbackground-color: yellow;\r\n\tposition: absolute;\r\n\ttop: -6px;\r\n\tleft: 50%;\r\n\ttext-align: left;\r\n\ttransform: translate(-50%, -100%);\r\n\tpadding: 10px;\r\n\tmax-width: 300px;\r\n\twidth: max-content;\r\n}\r\n.tooltip-popup:after {\r\n\tcontent: \"\";\r\n\tdisplay: block;\r\n\tbackground-color: white;\r\n\tposition: absolute;\r\n\ttop: 100%;\r\n\tleft: 50%;\r\n\twidth: 20px;\r\n\theight: 20px;\r\n\ttransform: translate(-50%, -50%) rotate(45deg);\r\n\tbox-shadow: 4px 4px 4px rgba(0, 0, 0, 0.08);\r\n}\r\n.tooltip-popup__title {\r\n\tfont-weight: bold;\r\n\tcolor: black !important;\r\n\tpadding-bottom: 10px;\r\n}\r\n.tooltip-popup__definition {\r\n\tcolor: black !important;\r\n\tmargin: 0 !important;\r\n}\r\n\r\n/* FOR THE EDITOR */\r\n.popover_tooltip_field {\r\n\t.components-popover__content {\r\n\t\tpadding: 10px !important;\r\n\t\tmin-width: 200px;\r\n\t}\r\n}\r\n",".brochure-download-icon {\r\n\tmargin: 0 0px 0 6px;\r\n\tdisplay: inline-block;\r\n\ttransform: translateY(-1px);\r\n}\r\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/build/index.js b/build/index.js index e1393be..c9cf494 100644 --- a/build/index.js +++ b/build/index.js @@ -98,10 +98,10 @@ function getThematiqueFamilySlug(thematique_slug) { /***/ }), -/***/ "./src/format-types/brochure.js": -/*!**************************************!*\ - !*** ./src/format-types/brochure.js ***! - \**************************************/ +/***/ "./src/format-types/brochure/brochure.js": +/*!***********************************************!*\ + !*** ./src/format-types/brochure/brochure.js ***! + \***********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); @@ -125,6 +125,7 @@ __webpack_require__.r(__webpack_exports__); +const formatName = "homegrade-format/brochure-format"; const BrochureLinkFormatButton = props => { const { isActive, @@ -133,14 +134,11 @@ const BrochureLinkFormatButton = props => { } = props; const [isPopoverOpen, setIsPopoverOpen] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); const [linkValue, setLinkValue] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(""); - const activeFormat = (0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.getActiveFormats)(props.value).filter(format => format.type === "homegrade-format/brochure-format")[0]; - - // console.log(activeFormat); - // console.log(getActiveFormats(props.value)); - function handleFormat() { + const activeFormat = (0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.getActiveFormats)(value).filter(format => format.type === formatName)[0]; + function setFormat() { setIsPopoverOpen(!isPopoverOpen); - onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.toggleFormat)(value, { - type: "homegrade-format/brochure-format", + onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.applyFormat)(value, { + type: formatName, attributes: { href: linkValue.url, target: "_blank", @@ -153,19 +151,21 @@ const BrochureLinkFormatButton = props => { setIsPopoverOpen(false); setLinkValue(""); onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.toggleFormat)(value, { - type: "homegrade-format/brochure-format" + type: formatName })); } 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_3__.BlockControls, null, isPopoverOpen && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.Popover, { onClose: () => setIsPopoverOpen(false), className: "popover_tooltip_field" - }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.__experimentalLinkControl, { + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.__experimentalLinkControl + // prefetch pdf attachment + , { suggestionsQuery: { - type: "attachment" + type: "attachment", + subtype: "pdf" }, value: linkValue, onChange: value => { - // console.log(value); setLinkValue(value); } }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.Button, { @@ -173,9 +173,11 @@ const BrochureLinkFormatButton = props => { variant: "primary", onClick: () => { setIsPopoverOpen(!isPopoverOpen); - handleFormat(); + setFormat(); } - }, "Valider")), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToolbarGroup, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToolbarButton, { + }, "Valider")), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToolbarGroup, { + className: "test" + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToolbarButton, { isActive: isActive, icon: !isActive ? "book" : _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__["default"], label: !isActive ? "Ajouter un lien brochure" : "Supprimer le lien brochure", @@ -183,7 +185,7 @@ const BrochureLinkFormatButton = props => { })))); }; (0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.registerFormatType)("homegrade-format/brochure-format", { - title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)("Brochure", "homegrade-format"), + title: "Lien Brochure", tagName: "a", className: "brochure-link-format", edit: BrochureLinkFormatButton @@ -191,10 +193,10 @@ const BrochureLinkFormatButton = props => { /***/ }), -/***/ "./src/format-types/tooltip.js": -/*!*************************************!*\ - !*** ./src/format-types/tooltip.js ***! - \*************************************/ +/***/ "./src/format-types/tooltip/tooltip.js": +/*!*********************************************!*\ + !*** ./src/format-types/tooltip/tooltip.js ***! + \*********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); @@ -228,29 +230,24 @@ const Edit = props => { onChange } = props; const [isPopoverOpen, setIsPopoverOpen] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - const [popoverText, setPopoverText] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(""); const [pendingDefinition, setPendingDefinition] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false); - const activeFormat = (0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__.getActiveFormats)(props.value).filter(format => format.type === formatName)[0]; - // console.log(activeFormat); - // console.log(value); - - const post = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { - if (activeFormat && activeFormat.attributes.definitionId) { - return select("core").getEntityRecord("postType", "vocabulaire", activeFormat.attributes.definitionId); - } - }); - if (post && pendingDefinition) { - // console.log("#### Retrieved Post"); - // console.log(post); - onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__.applyFormat)(value, { - type: formatName, - attributes: { - dataTooltipDefinition: post.acf.definition, - definitionId: activeFormat.attributes.definitionId, - dataTooltipWord: activeFormat.attributes.dataTooltipWord + const activeFormat = (0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__.getActiveFormats)(value).filter(format => format.type === formatName)[0]; + const lang = getAdminLanguageFromCookie("wp-wpml_current_language"); + function getAdminLanguageFromCookie(c_name) { + var c_value = document.cookie, + c_start = c_value.indexOf(" " + c_name + "="); + if (c_start == -1) c_start = c_value.indexOf(c_name + "="); + if (c_start == -1) { + c_value = null; + } else { + c_start = c_value.indexOf("=", c_start) + 1; + var c_end = c_value.indexOf(";", c_start); + if (c_end == -1) { + c_end = c_value.length; } - })); - setPendingDefinition(false); + c_value = unescape(c_value.substring(c_start, c_end)); + } + return c_value; } function removeFormat() { setIsPopoverOpen(false); @@ -259,7 +256,6 @@ const Edit = props => { })); } function setFormat(postDatas) { - // console.log(postDatas); setPendingDefinition(true); setIsPopoverOpen(false); onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__.applyFormat)(value, { @@ -270,6 +266,22 @@ const Edit = props => { } })); } + const post = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => { + if (activeFormat && activeFormat.attributes.definitionId) { + return select("core").getEntityRecord("postType", "vocabulaire", activeFormat.attributes.definitionId); + } + }); + if (post && pendingDefinition) { + onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__.applyFormat)(value, { + type: formatName, + attributes: { + dataTooltipDefinition: post.acf.definition, + definitionId: activeFormat.attributes.definitionId, + dataTooltipWord: activeFormat.attributes.dataTooltipWord + } + })); + setPendingDefinition(false); + } 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_3__.BlockControls, null, isPopoverOpen && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.Popover, { onClose: () => setIsPopoverOpen(false), className: "popover_tooltip_field" @@ -283,7 +295,8 @@ const Edit = props => { } : "", suggestionsQuery: { type: "post", - subtype: "vocabulaire" + subtype: "vocabulaire", + lang: lang }, isCollapsed: true, onChange: postDatas => setFormat(postDatas) @@ -294,9 +307,7 @@ const Edit = props => { onClick: () => { setIsPopoverOpen(true); } - }), isActive && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToolbarButton - // isActive={isActive} - , { + }), isActive && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToolbarButton, { icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__["default"], label: "Supprimer la tooltip", onClick: () => { @@ -318,10 +329,10 @@ const Edit = props => { /***/ }), -/***/ "./src/format-types/brochure.css": -/*!***************************************!*\ - !*** ./src/format-types/brochure.css ***! - \***************************************/ +/***/ "./src/format-types/brochure/brochure.css": +/*!************************************************!*\ + !*** ./src/format-types/brochure/brochure.css ***! + \************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); @@ -330,10 +341,10 @@ __webpack_require__.r(__webpack_exports__); /***/ }), -/***/ "./src/format-types/tooltip.css": -/*!**************************************!*\ - !*** ./src/format-types/tooltip.css ***! - \**************************************/ +/***/ "./src/format-types/tooltip/tooltip.css": +/*!**********************************************!*\ + !*** ./src/format-types/tooltip/tooltip.css ***! + \**********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); @@ -487,11 +498,11 @@ var __webpack_exports__ = {}; !*** ./src/index.js ***! \**********************/ __webpack_require__.r(__webpack_exports__); -/* harmony import */ var _format_types_tooltip_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./format-types/tooltip.css */ "./src/format-types/tooltip.css"); -/* harmony import */ var _format_types_tooltip_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./format-types/tooltip.js */ "./src/format-types/tooltip.js"); +/* harmony import */ var _format_types_tooltip_tooltip_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./format-types/tooltip/tooltip.css */ "./src/format-types/tooltip/tooltip.css"); +/* harmony import */ var _format_types_tooltip_tooltip_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./format-types/tooltip/tooltip.js */ "./src/format-types/tooltip/tooltip.js"); /* harmony import */ var _blocks_utilities_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../blocks/utilities.js */ "./blocks/utilities.js"); -/* harmony import */ var _format_types_brochure_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./format-types/brochure.css */ "./src/format-types/brochure.css"); -/* harmony import */ var _format_types_brochure_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./format-types/brochure.js */ "./src/format-types/brochure.js"); +/* harmony import */ var _format_types_brochure_brochure_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./format-types/brochure/brochure.css */ "./src/format-types/brochure/brochure.css"); +/* harmony import */ var _format_types_brochure_brochure_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./format-types/brochure/brochure.js */ "./src/format-types/brochure/brochure.js"); diff --git a/build/index.js.map b/build/index.js.map index faae307..a0dd60f 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;IAE5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,KAAK,EAAE,CAAC7B,QAAQ,GAAG,qBAAqB,GAAG,mBAAoB;IAC/D4B,OAAO,EAAEA,CAAA,KAAM;MACdxB,gBAAgB,CAAC,IAAI,CAAC;IACvB;EAAE,CACF,CAAC,EACDJ,QAAQ,IACRqB,iEAAA,CAAC5B,gEAAaA;EACb;EAAA;IACAiC,IAAI,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?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 +{"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,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,CAAC;EACD5B,SAAS,EAAE,cAAc;EACzBS,IAAI,EAAEE;AACP,CAAC,CAAC;;;;;;;;;;;ACnJF;;;;;;;;;;;;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;;;;;;;;;;;;;;;;ACN4C;AACD;AAEX;AACc","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/brochure.js","webpack://multi-blocks/./src/format-types/tooltip/tooltip.js","webpack://multi-blocks/./src/format-types/brochure/brochure.css","webpack://multi-blocks/./src/format-types/tooltip/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, applyFormat, 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 formatName = \"homegrade-format/brochure-format\";\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(value).filter((format) => format.type === formatName)[0];\r\n\r\n\tfunction setFormat() {\r\n\t\tsetIsPopoverOpen(!isPopoverOpen);\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\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: formatName,\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\tsetLinkValue(value);\r\n\t\t\t\t\t\t\t}}\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\tsetFormat();\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: \"Lien Brochure\",\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 } 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 [pendingDefinition, setPendingDefinition] = useState(false);\r\n\r\n\tconst activeFormat = getActiveFormats(value).filter((format) => format.type === formatName)[0];\r\n\tconst lang = getAdminLanguageFromCookie(\"wp-wpml_current_language\");\r\n\tfunction getAdminLanguageFromCookie(c_name) {\r\n\t\tvar c_value = document.cookie,\r\n\t\t\tc_start = c_value.indexOf(\" \" + c_name + \"=\");\r\n\t\tif (c_start == -1) c_start = c_value.indexOf(c_name + \"=\");\r\n\t\tif (c_start == -1) {\r\n\t\t\tc_value = null;\r\n\t\t} else {\r\n\t\t\tc_start = c_value.indexOf(\"=\", c_start) + 1;\r\n\t\t\tvar c_end = c_value.indexOf(\";\", c_start);\r\n\t\t\tif (c_end == -1) {\r\n\t\t\t\tc_end = c_value.length;\r\n\t\t\t}\r\n\t\t\tc_value = unescape(c_value.substring(c_start, c_end));\r\n\t\t}\r\n\t\treturn c_value;\r\n\t}\r\n\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\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\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\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\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/tooltip.css\";\r\nimport \"./format-types/tooltip/tooltip.js\";\r\n\r\nimport \"../blocks/utilities.js\";\r\nimport \"./format-types/brochure/brochure.css\";\r\nimport \"./format-types/brochure/brochure.js\";\r\n"],"names":["getThematiqueFamilySlug","thematique_slug","registerFormatType","toggleFormat","applyFormat","getActiveFormats","__","BlockControls","__experimentalLinkControl","LinkControl","Popover","Button","ToolbarGroup","ToolbarButton","TextareaControl","check","trash","useState","formatName","BrochureLinkFormatButton","props","isActive","value","onChange","isPopoverOpen","setIsPopoverOpen","linkValue","setLinkValue","activeFormat","filter","format","type","setFormat","attributes","href","url","target","dataId","id","toString","style","removeFormat","createElement","Fragment","onClose","className","suggestionsQuery","subtype","icon","variant","onClick","label","title","tagName","edit","useSelect","Edit","pendingDefinition","setPendingDefinition","lang","getAdminLanguageFromCookie","c_name","c_value","document","cookie","c_start","indexOf","c_end","length","unescape","substring","postDatas","definitionId","dataTooltipWord","post","select","getEntityRecord","dataTooltipDefinition","acf","definition","link","tile","kind","isCollapsed"],"sourceRoot":""} \ No newline at end of file diff --git a/index.php b/index.php index b726192..a4c63d9 100644 --- a/index.php +++ b/index.php @@ -79,10 +79,10 @@ add_action('enqueue_block_editor_assets', 'homegrade_blocks_enqueue_editor_asset function blocks_course_plugin_enqueue_assets() { $asset_file = include(plugin_dir_path(__FILE__) . 'build/index.asset.php'); - wp_enqueue_script('homegrade-blocks-tooltipjs', plugin_dir_url(__FILE__) . 'src/format-types/tooltip-front.js'); - wp_enqueue_style('homegrade-blocks-tooltipcss', plugin_dir_url(__FILE__) . 'src/format-types/tooltip.css'); - wp_enqueue_script('homegrade-blocks-brochurejs', plugin_dir_url(__FILE__) . 'src/format-types/brochure-front.js'); - wp_enqueue_style('homegrade-blocks-brochurecss', plugin_dir_url(__FILE__) . 'src/format-types/brochure.css'); + wp_enqueue_script('homegrade-blocks-tooltipjs', plugin_dir_url(__FILE__) . 'src/format-types/tooltip/tooltip-front.js'); + wp_enqueue_style('homegrade-blocks-tooltipcss', plugin_dir_url(__FILE__) . 'src/format-types/tooltip/tooltip.css'); + wp_enqueue_script('homegrade-blocks-brochurejs', plugin_dir_url(__FILE__) . 'src/format-types/brochure/brochure-front.js'); + wp_enqueue_style('homegrade-blocks-brochurecss', plugin_dir_url(__FILE__) . 'src/format-types/brochure/brochure.css'); wp_localize_script('homegrade-blocks-brochurejs', 'img_path_datas', array( 'downloadIconPath' => plugin_dir_url(__FILE__) . '/src/img/icon_brochure_download.svg' diff --git a/src/format-types/brochure-front.js b/src/format-types/brochure/brochure-front.js similarity index 73% rename from src/format-types/brochure-front.js rename to src/format-types/brochure/brochure-front.js index 8220929..256226d 100644 --- a/src/format-types/brochure-front.js +++ b/src/format-types/brochure/brochure-front.js @@ -1,16 +1,10 @@ // import downloadBrochureIcon from "../img/icon_brochure_download.svg"; window.addEventListener("DOMContentLoaded", (event) => { - // let tooltips = document.querySelectorAll(".tooltip-word"); let brochureLinks = document.querySelectorAll(".brochure-link-format"); - // console.log("SALUT"); - // console.log(tooltips); - // alert("SALUT"); const iconSrc = img_path_datas.downloadIconPath; brochureLinks.forEach((brochureLink) => { - // console.log(brochureLink); - const brochureLinkIcon = document.createElement("img"); brochureLinkIcon.src = iconSrc; brochureLinkIcon.classList.add("brochure-download-icon"); diff --git a/src/format-types/brochure.css b/src/format-types/brochure/brochure.css similarity index 100% rename from src/format-types/brochure.css rename to src/format-types/brochure/brochure.css diff --git a/src/format-types/brochure.js b/src/format-types/brochure/brochure.js similarity index 74% rename from src/format-types/brochure.js rename to src/format-types/brochure/brochure.js index ca990bf..eca9b95 100644 --- a/src/format-types/brochure.js +++ b/src/format-types/brochure/brochure.js @@ -1,4 +1,4 @@ -import { registerFormatType, toggleFormat, getActiveFormats } from "@wordpress/rich-text"; +import { registerFormatType, toggleFormat, applyFormat, getActiveFormats } from "@wordpress/rich-text"; import { __ } from "@wordpress/i18n"; import { BlockControls, __experimentalLinkControl as LinkControl } from "@wordpress/block-editor"; import { Popover, Button } from "@wordpress/components"; @@ -8,22 +8,20 @@ import { check, trash } from "@wordpress/icons"; import { useState } from "@wordpress/element"; +const formatName = "homegrade-format/brochure-format"; + const BrochureLinkFormatButton = (props) => { const { isActive, value, onChange } = props; const [isPopoverOpen, setIsPopoverOpen] = useState(false); const [linkValue, setLinkValue] = useState(""); - const activeFormat = getActiveFormats(props.value).filter( - (format) => format.type === "homegrade-format/brochure-format" - )[0]; + const activeFormat = getActiveFormats(value).filter((format) => format.type === formatName)[0]; - // console.log(activeFormat); - // console.log(getActiveFormats(props.value)); - function handleFormat() { + function setFormat() { setIsPopoverOpen(!isPopoverOpen); onChange( - toggleFormat(value, { - type: "homegrade-format/brochure-format", + applyFormat(value, { + type: formatName, attributes: { href: linkValue.url, target: "_blank", @@ -38,7 +36,7 @@ const BrochureLinkFormatButton = (props) => { setLinkValue(""); onChange( toggleFormat(value, { - type: "homegrade-format/brochure-format", + type: formatName, }) ); } @@ -51,28 +49,34 @@ const BrochureLinkFormatButton = (props) => { onClose={() => setIsPopoverOpen(false)} className='popover_tooltip_field'> { - // console.log(value); setLinkValue(value); }} + /> )} - + { }; registerFormatType("homegrade-format/brochure-format", { - title: __("Brochure", "homegrade-format"), + title: "Lien Brochure", tagName: "a", className: "brochure-link-format", edit: BrochureLinkFormatButton, diff --git a/src/format-types/tooltip-front.js b/src/format-types/tooltip/tooltip-front.js similarity index 51% rename from src/format-types/tooltip-front.js rename to src/format-types/tooltip/tooltip-front.js index c1601bc..c613741 100644 --- a/src/format-types/tooltip-front.js +++ b/src/format-types/tooltip/tooltip-front.js @@ -1,5 +1,4 @@ window.addEventListener("DOMContentLoaded", (event) => { - // let tooltips = document.querySelectorAll(".tooltip-word"); let tooltipWords = document.querySelectorAll("[data-tooltip-definition]"); tooltipWords.forEach((tooltipWord) => { @@ -7,11 +6,16 @@ window.addEventListener("DOMContentLoaded", (event) => { const tooltipPopup = document.createElement("div"); tooltipPopup.className = "tooltip-popup"; - const tooltipContent = tooltipWord.getAttribute("data-tooltip-definition"); - const tooltipContentParagraph = document.createElement("p"); - tooltipContentParagraph.textContent = tooltipContent; + const tooltipDefinition = document.createElement("p"); + tooltipDefinition.textContent = tooltipWord.getAttribute("data-tooltip-definition"); + tooltipDefinition.className = "tooltip-popup__definition"; - tooltipPopup.appendChild(tooltipContentParagraph); + const tooltipTitle = document.createElement("h5"); + tooltipTitle.textContent = tooltipWord.getAttribute("data-tooltip-word"); + tooltipTitle.className = "tooltip-popup__title"; + + tooltipPopup.appendChild(tooltipTitle); + tooltipPopup.appendChild(tooltipDefinition); tooltipWord.appendChild(tooltipPopup); }); diff --git a/src/format-types/tooltip.css b/src/format-types/tooltip/tooltip.css similarity index 71% rename from src/format-types/tooltip.css rename to src/format-types/tooltip/tooltip.css index 99b0cac..dd5334f 100644 --- a/src/format-types/tooltip.css +++ b/src/format-types/tooltip/tooltip.css @@ -1,10 +1,3 @@ -.popover_tooltip_field { - .components-popover__content { - padding: 10px !important; - min-width: 200px; - } -} - .tooltip-word { padding-top: 12px; position: relative; @@ -19,9 +12,11 @@ position: absolute; top: -6px; left: 50%; - text-align: center; + text-align: left; transform: translate(-50%, -100%); padding: 10px; + max-width: 300px; + width: max-content; } .tooltip-popup:after { content: ""; @@ -35,6 +30,20 @@ transform: translate(-50%, -50%) rotate(45deg); box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.08); } -.tooltip-popup p { +.tooltip-popup__title { + font-weight: bold; + color: black !important; + padding-bottom: 10px; +} +.tooltip-popup__definition { + color: black !important; margin: 0 !important; } + +/* FOR THE EDITOR */ +.popover_tooltip_field { + .components-popover__content { + padding: 10px !important; + min-width: 200px; + } +} diff --git a/src/format-types/tooltip.js b/src/format-types/tooltip/tooltip.js similarity index 78% rename from src/format-types/tooltip.js rename to src/format-types/tooltip/tooltip.js index 46ab8b0..72def32 100644 --- a/src/format-types/tooltip.js +++ b/src/format-types/tooltip/tooltip.js @@ -4,7 +4,7 @@ import { registerFormatType, toggleFormat, applyFormat, getActiveFormats } from import { BlockControls, __experimentalLinkControl as LinkControl } from "@wordpress/block-editor"; import { Popover, ToolbarGroup, ToolbarButton } from "@wordpress/components"; import { trash } from "@wordpress/icons"; -import { useState, useEffect } from "@wordpress/element"; +import { useState } from "@wordpress/element"; import { useSelect } from "@wordpress/data"; // pour les querry const formatName = "homegrade-format/tooltip"; @@ -12,39 +12,26 @@ const formatName = "homegrade-format/tooltip"; const Edit = (props) => { const { isActive, value, onChange } = props; const [isPopoverOpen, setIsPopoverOpen] = useState(false); - const [popoverText, setPopoverText] = useState(""); const [pendingDefinition, setPendingDefinition] = useState(false); - const activeFormat = getActiveFormats(props.value).filter((format) => format.type === formatName)[0]; - // console.log(activeFormat); - // console.log(value); - - const post = useSelect((select) => { - if (activeFormat && activeFormat.attributes.definitionId) { - return select("core").getEntityRecord( - "postType", - "vocabulaire", - activeFormat.attributes.definitionId - ); + const activeFormat = getActiveFormats(value).filter((format) => format.type === formatName)[0]; + const lang = getAdminLanguageFromCookie("wp-wpml_current_language"); + function getAdminLanguageFromCookie(c_name) { + var c_value = document.cookie, + c_start = c_value.indexOf(" " + c_name + "="); + if (c_start == -1) c_start = c_value.indexOf(c_name + "="); + if (c_start == -1) { + c_value = null; + } else { + c_start = c_value.indexOf("=", c_start) + 1; + var c_end = c_value.indexOf(";", c_start); + if (c_end == -1) { + c_end = c_value.length; + } + c_value = unescape(c_value.substring(c_start, c_end)); } - }); - - if (post && pendingDefinition) { - // console.log("#### Retrieved Post"); - // console.log(post); - onChange( - applyFormat(value, { - type: formatName, - attributes: { - dataTooltipDefinition: post.acf.definition, - definitionId: activeFormat.attributes.definitionId, - dataTooltipWord: activeFormat.attributes.dataTooltipWord, - }, - }) - ); - setPendingDefinition(false); + return c_value; } - function removeFormat() { setIsPopoverOpen(false); onChange( @@ -54,7 +41,6 @@ const Edit = (props) => { ); } function setFormat(postDatas) { - // console.log(postDatas); setPendingDefinition(true); setIsPopoverOpen(false); @@ -69,6 +55,30 @@ const Edit = (props) => { ); } + const post = useSelect((select) => { + if (activeFormat && activeFormat.attributes.definitionId) { + return select("core").getEntityRecord( + "postType", + "vocabulaire", + activeFormat.attributes.definitionId + ); + } + }); + + if (post && pendingDefinition) { + onChange( + applyFormat(value, { + type: formatName, + attributes: { + dataTooltipDefinition: post.acf.definition, + definitionId: activeFormat.attributes.definitionId, + dataTooltipWord: activeFormat.attributes.dataTooltipWord, + }, + }) + ); + setPendingDefinition(false); + } + return ( <> @@ -93,6 +103,7 @@ const Edit = (props) => { suggestionsQuery={{ type: "post", subtype: "vocabulaire", + lang: lang, }} isCollapsed={true} onChange={(postDatas) => setFormat(postDatas)} @@ -111,7 +122,6 @@ const Edit = (props) => { /> {isActive && ( { diff --git a/src/index.js b/src/index.js index 79cf6b2..b819d0d 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ -import "./format-types/tooltip.css"; -import "./format-types/tooltip.js"; +import "./format-types/tooltip/tooltip.css"; +import "./format-types/tooltip/tooltip.js"; import "../blocks/utilities.js"; -import "./format-types/brochure.css"; -import "./format-types/brochure.js"; +import "./format-types/brochure/brochure.css"; +import "./format-types/brochure/brochure.js";