From b06e0632be911c762396e7849a9e2e7e917ba642 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Tue, 16 Jan 2024 15:00:19 +0100 Subject: [PATCH] enhancing brochures formt system --- build/index.asset.php | 2 +- build/index.js | 41 ++++++++++--------- build/index.js.map | 2 +- src/format-types/brochure/brochure-front.js | 2 +- src/format-types/brochure/brochure.js | 44 ++++++++++----------- 5 files changed, 47 insertions(+), 44 deletions(-) diff --git a/build/index.asset.php b/build/index.asset.php index 8b8bb5b..ab746f2 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' => '617b3841d9e762364fd5'); + array('wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-rich-text'), 'version' => '251b40e555a82eb6d434'); diff --git a/build/index.js b/build/index.js index d936197..e21304a 100644 --- a/build/index.js +++ b/build/index.js @@ -119,12 +119,13 @@ const BrochureLinkFormatButton = props => { } }); function setFormat(postDatas) { + console.log("postdata", postDatas); setIsPopoverOpen(!isPopoverOpen); setPendingBrochure(true); onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.applyFormat)(value, { type: formatName, attributes: { - href: "", + href: postDatas.url, brochurePostID: postDatas.id.toString(), target: "_blank", style: "text-decoration: underline;" @@ -137,28 +138,30 @@ const BrochureLinkFormatButton = props => { type: formatName })); } - console.log(brochurePost); - console.log(brochureAttachedMedia); - if (brochurePost && brochureAttachedMedia && pendingBrochure) { - onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.applyFormat)(value, { - type: formatName, - attributes: { - target: "_blank", - brochurePostID: brochurePost.id.toString(), - brochureID: brochureAttachedMedia.id.toString(), - href: brochureAttachedMedia.source_url, - style: "text-decoration: underline;" - } - })); - setPendingBrochure(false); - } + + // if (brochurePost && brochureAttachedMedia && pendingBrochure) { + // onChange( + // applyFormat(value, { + // type: formatName, + // attributes: { + // target: "_blank", + // brochurePostID: brochurePost.id.toString(), + // brochureID: brochureAttachedMedia.id.toString(), + // href: brochurePost.link, + // style: "text-decoration: underline;", + // }, + // }) + // ); + // setPendingBrochure(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" }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.__experimentalLinkControl, { suggestionsQuery: { type: "post", - subtype: "brochures" + subtype: ["brochures", "fiches-infos"] // subtype: "application/pdf", // Not working // mime_type: "application/pdf", // Not working }, @@ -170,12 +173,12 @@ const BrochureLinkFormatButton = props => { }, (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", + label: !isActive ? "Ajouter un lien Brochure / Fiche-info" : "Supprimer le lien Brochure / Fiche-info", onClick: () => !isActive ? setIsPopoverOpen(!isPopoverOpen) : removeFormat() })))); }; (0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.registerFormatType)("homegrade-format/brochure-format", { - title: "Lien Brochure", + title: "Lien Brochure/Fiche-info", tagName: "a", attributes: { brochureID: "brochure-id", diff --git a/build/index.js.map b/build/index.js.map index 2509d9f..e28ed39 100644 --- a/build/index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,EAAE7C,wDAAM;IACZ8C,KAAK,EAAE,sBAAuB;IAC9BC,OAAO,EAAEA,CAAA,KAAM;MACdb,YAAY,CAAC,CAAC;IACf;EAAE,CACF,CAEW,CACA,CACd,CAAC;AAEL,CAAC;AAEDhD,wEAAkB,CAACiB,UAAU,EAAE;EAC9B6C,KAAK,EAAE1D,mDAAE,CAAC,SAAS,EAAE,kBAAkB,CAAC;EACxC2D,OAAO,EAAE,QAAQ;EACjB5B,UAAU,EAAE;IACX6C,YAAY,EAAE,oBAAoB;IAClCG,qBAAqB,EAAE,yBAAyB;IAChDF,eAAe,EAAE;EAClB,CAAC;EACDzB,SAAS,EAAE,cAAc;EACzBQ,IAAI,EAAEC;AACP,CAAC,CAAC;;;;;;;;;;;ACpJF;;;;;;;;;;;;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/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 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\nimport { useSelect } from \"@wordpress/data\"; // pour les querry\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 [relatedPost, setRelatedPost] = useState(\"\");\r\n\tconst [pendingBrochure, setPendingBrochure] = useState(false);\r\n\r\n\tconst activeFormat = getActiveFormats(value).filter((format) => format.type === formatName)[0];\r\n\r\n\tconst brochurePost = useSelect((select) => {\r\n\t\tif (activeFormat && activeFormat.attributes.brochurePostID) {\r\n\t\t\treturn select(\"core\").getEntityRecord(\r\n\t\t\t\t\"postType\",\r\n\t\t\t\t\"brochures\",\r\n\t\t\t\tactiveFormat.attributes.brochurePostID\r\n\t\t\t);\r\n\t\t}\r\n\t});\r\n\r\n\tconst brochureAttachedMedia = useSelect((select) => {\r\n\t\tif (brochurePost && brochurePost.acf && brochurePost.acf.brochure_pdf) {\r\n\t\t\treturn select(\"core\").getEntityRecord(\"postType\", \"attachment\", brochurePost.acf.brochure_pdf);\r\n\t\t}\r\n\t});\r\n\r\n\tfunction setFormat(postDatas) {\r\n\t\tsetIsPopoverOpen(!isPopoverOpen);\r\n\t\tsetPendingBrochure(true);\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: \"\",\r\n\t\t\t\t\tbrochurePostID: postDatas.id.toString(),\r\n\t\t\t\t\ttarget: \"_blank\",\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\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\tconsole.log(brochurePost);\r\n\tconsole.log(brochureAttachedMedia);\r\n\tif (brochurePost && brochureAttachedMedia && pendingBrochure) {\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\ttarget: \"_blank\",\r\n\t\t\t\t\tbrochurePostID: brochurePost.id.toString(),\r\n\t\t\t\t\tbrochureID: brochureAttachedMedia.id.toString(),\r\n\t\t\t\t\thref: brochureAttachedMedia.source_url,\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\tsetPendingBrochure(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\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\tattributes: {\r\n\t\tbrochureID: \"brochure-id\",\r\n\t\tbrochurePostID: \"brochure-post-id\",\r\n\t},\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\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: \"button\",\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","useSelect","formatName","BrochureLinkFormatButton","props","isActive","value","onChange","isPopoverOpen","setIsPopoverOpen","relatedPost","setRelatedPost","pendingBrochure","setPendingBrochure","activeFormat","filter","format","type","brochurePost","select","attributes","brochurePostID","getEntityRecord","brochureAttachedMedia","acf","brochure_pdf","setFormat","postDatas","href","id","toString","target","style","removeFormat","console","log","brochureID","source_url","createElement","Fragment","onClose","className","suggestionsQuery","subtype","icon","label","onClick","title","tagName","edit","Edit","pendingDefinition","setPendingDefinition","lang","getAdminLanguageFromCookie","c_name","c_value","document","cookie","c_start","indexOf","c_end","length","unescape","substring","definitionId","dataTooltipWord","post","dataTooltipDefinition","definition","url","link","tile","kind","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,E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;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/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 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\nimport { useSelect } from \"@wordpress/data\"; // pour les querry\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 [relatedPost, setRelatedPost] = useState(\"\");\r\n\tconst [pendingBrochure, setPendingBrochure] = useState(false);\r\n\r\n\tconst activeFormat = getActiveFormats(value).filter((format) => format.type === formatName)[0];\r\n\r\n\tconst brochurePost = useSelect((select) => {\r\n\t\tif (activeFormat && activeFormat.attributes.brochurePostID) {\r\n\t\t\treturn select(\"core\").getEntityRecord(\r\n\t\t\t\t\"postType\",\r\n\t\t\t\t\"brochures\",\r\n\t\t\t\tactiveFormat.attributes.brochurePostID\r\n\t\t\t);\r\n\t\t}\r\n\t});\r\n\r\n\tconst brochureAttachedMedia = useSelect((select) => {\r\n\t\tif (brochurePost && brochurePost.acf && brochurePost.acf.brochure_pdf) {\r\n\t\t\treturn select(\"core\").getEntityRecord(\"postType\", \"attachment\", brochurePost.acf.brochure_pdf);\r\n\t\t}\r\n\t});\r\n\r\n\tfunction setFormat(postDatas) {\r\n\t\tconsole.log(\"postdata\", postDatas);\r\n\t\tsetIsPopoverOpen(!isPopoverOpen);\r\n\t\tsetPendingBrochure(true);\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: postDatas.url,\r\n\t\t\t\t\tbrochurePostID: postDatas.id.toString(),\r\n\t\t\t\t\ttarget: \"_blank\",\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\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\r\n\t// if (brochurePost && brochureAttachedMedia && pendingBrochure) {\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\ttarget: \"_blank\",\r\n\t// \t\t\t\tbrochurePostID: brochurePost.id.toString(),\r\n\t// \t\t\t\tbrochureID: brochureAttachedMedia.id.toString(),\r\n\t// \t\t\t\thref: brochurePost.link,\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// \tsetPendingBrochure(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\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/Fiche-info\",\r\n\ttagName: \"a\",\r\n\tattributes: {\r\n\t\tbrochureID: \"brochure-id\",\r\n\t\tbrochurePostID: \"brochure-post-id\",\r\n\t},\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\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: \"button\",\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","useSelect","formatName","BrochureLinkFormatButton","props","isActive","value","onChange","isPopoverOpen","setIsPopoverOpen","relatedPost","setRelatedPost","pendingBrochure","setPendingBrochure","activeFormat","filter","format","type","brochurePost","select","attributes","brochurePostID","getEntityRecord","brochureAttachedMedia","acf","brochure_pdf","setFormat","postDatas","console","log","href","url","id","toString","target","style","removeFormat","createElement","Fragment","onClose","className","suggestionsQuery","subtype","icon","label","onClick","title","tagName","brochureID","edit","Edit","pendingDefinition","setPendingDefinition","lang","getAdminLanguageFromCookie","c_name","c_value","document","cookie","c_start","indexOf","c_end","length","unescape","substring","definitionId","dataTooltipWord","post","dataTooltipDefinition","definition","link","tile","kind","isCollapsed"],"sourceRoot":""} \ No newline at end of file diff --git a/src/format-types/brochure/brochure-front.js b/src/format-types/brochure/brochure-front.js index 4ed173e..8850221 100644 --- a/src/format-types/brochure/brochure-front.js +++ b/src/format-types/brochure/brochure-front.js @@ -43,5 +43,5 @@ async function hydrateBrochuresLinks() { window.addEventListener("DOMContentLoaded", (event) => { buildDownloadIcons(); - hydrateBrochuresLinks(); + // hydrateBrochuresLinks(); // Plus besoin depuis le que single-post-type Brochure redirige automatiquement vers le PDF correspondant }); diff --git a/src/format-types/brochure/brochure.js b/src/format-types/brochure/brochure.js index 4df6934..e1f1e7a 100644 --- a/src/format-types/brochure/brochure.js +++ b/src/format-types/brochure/brochure.js @@ -36,13 +36,14 @@ const BrochureLinkFormatButton = (props) => { }); function setFormat(postDatas) { + console.log("postdata", postDatas); setIsPopoverOpen(!isPopoverOpen); setPendingBrochure(true); onChange( applyFormat(value, { type: formatName, attributes: { - href: "", + href: postDatas.url, brochurePostID: postDatas.id.toString(), target: "_blank", style: "text-decoration: underline;", @@ -59,23 +60,22 @@ const BrochureLinkFormatButton = (props) => { }) ); } - console.log(brochurePost); - console.log(brochureAttachedMedia); - if (brochurePost && brochureAttachedMedia && pendingBrochure) { - onChange( - applyFormat(value, { - type: formatName, - attributes: { - target: "_blank", - brochurePostID: brochurePost.id.toString(), - brochureID: brochureAttachedMedia.id.toString(), - href: brochureAttachedMedia.source_url, - style: "text-decoration: underline;", - }, - }) - ); - setPendingBrochure(false); - } + + // if (brochurePost && brochureAttachedMedia && pendingBrochure) { + // onChange( + // applyFormat(value, { + // type: formatName, + // attributes: { + // target: "_blank", + // brochurePostID: brochurePost.id.toString(), + // brochureID: brochureAttachedMedia.id.toString(), + // href: brochurePost.link, + // style: "text-decoration: underline;", + // }, + // }) + // ); + // setPendingBrochure(false); + // } return ( <> @@ -87,7 +87,7 @@ const BrochureLinkFormatButton = (props) => { { icon={!isActive ? "book" : trash} label={ !isActive - ? "Ajouter un lien brochure" - : "Supprimer le lien brochure" + ? "Ajouter un lien Brochure / Fiche-info" + : "Supprimer le lien Brochure / Fiche-info" } onClick={() => !isActive ? setIsPopoverOpen(!isPopoverOpen) : removeFormat() @@ -117,7 +117,7 @@ const BrochureLinkFormatButton = (props) => { }; registerFormatType("homegrade-format/brochure-format", { - title: "Lien Brochure", + title: "Lien Brochure/Fiche-info", tagName: "a", attributes: { brochureID: "brochure-id",