diff --git a/blocks/content-page-header/build/block.json b/blocks/content-page-header/build/block.json
index afbd2c2..9ee5d08 100644
--- a/blocks/content-page-header/build/block.json
+++ b/blocks/content-page-header/build/block.json
@@ -22,6 +22,10 @@
"pageHeaderDescription": {
"type": "string"
},
+ "hasCta": {
+ "type": "boolean",
+ "default": false
+ },
"cta": {
"type": "object"
}
diff --git a/blocks/content-page-header/build/index.asset.php b/blocks/content-page-header/build/index.asset.php
index 7295f34..518cb0c 100644
--- a/blocks/content-page-header/build/index.asset.php
+++ b/blocks/content-page-header/build/index.asset.php
@@ -1 +1 @@
- array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '28b0c09903b2dee6748e');
+ array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'c36bb5ed25b531e20cc1');
diff --git a/blocks/content-page-header/build/index.js b/blocks/content-page-header/build/index.js
index 00812d4..8711671 100644
--- a/blocks/content-page-header/build/index.js
+++ b/blocks/content-page-header/build/index.js
@@ -36,6 +36,7 @@ function Edit({
const {
pageHeaderTitle,
pageHeaderDescription,
+ hasCta,
cta
} = attributes;
const pageTitle = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_3__.useSelect)(select => {
@@ -51,17 +52,28 @@ function Edit({
return cover;
}
});
- function handleOnChangeTitle(newTitle) {
+ function onChangeTitle(newTitle) {
setAttributes({
pageHeaderTitle: newTitle
});
}
- function handleOnChangeDescription(newDescription) {
+ function onChangeHasCta(newHasCta) {
+ console.log("newHasCta", newHasCta);
+ setAttributes({
+ hasCta: !hasCta
+ });
+ if (!newHasCta) {
+ setAttributes({
+ cta: undefined
+ });
+ }
+ }
+ function onChangeDescription(newDescription) {
setAttributes({
pageHeaderDescription: newDescription
});
}
- function handleOnChangeCTA(newCtaValue) {
+ function onChangeCTA(newCtaValue) {
setAttributes({
cta: {
title: !cta || !cta.title ? newCtaValue.title : cta.title,
@@ -83,7 +95,11 @@ function Edit({
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.PanelBody, {
className: "homegrade-blocks-content-page-header__panel-cta",
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Call to action", "homegrade-blocks__texte-fonctionnel")
- }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.TextControl, {
+ }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.ToggleControl, {
+ label: "Afficher un call to action",
+ checked: hasCta,
+ onChange: onChangeHasCta
+ }), hasCta && (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_components__WEBPACK_IMPORTED_MODULE_5__.TextControl, {
label: "Titre du cta",
value: cta && cta.title ? cta.title : "",
onChange: onChangeTextControl
@@ -91,11 +107,8 @@ function Edit({
label: "Lien du cta",
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Call to action", "homegrade-blocks__texte-fonctionnel"),
value: cta,
- onChange: e => {
- console.log("loading", e);
- handleOnChangeCTA(e);
- }
- }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", {
+ onChange: onChangeCTA
+ })))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", {
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.useBlockProps)({
className: `homegrade-blocks-content-page-header block-content-page-header`
})
@@ -105,13 +118,13 @@ function Edit({
tagName: "h2",
placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Ajouter ici le Titre du Bloc Header", "homegrade"),
value: pageHeaderTitle,
- onChange: handleOnChangeTitle
+ onChange: onChangeTitle
// style={{ textAlign: props.attributes.alignment }}
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_4__.RichText, {
tagName: "p",
placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Ajouter ici le texte d'introduction de cette page", "homegrade"),
value: pageHeaderDescription,
- onChange: handleOnChangeDescription
+ onChange: onChangeDescription
// style={{ textAlign: props.attributes.alignment }}
}), cta && cta.title && cta.url && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", {
href: cta.url
@@ -254,7 +267,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/content-page-header","version":"0.1.0","title":"Content page header","category":"homegrade-blocks","icon":"smiley","description":"Bloc bannière/header de contenu de premier niveau pour les pages de contenu","supports":{"html":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","attributes":{"pageHeaderTitle":{"type":"string"},"pageHeaderDescription":{"type":"string"},"cta":{"type":"object"}}}');
+module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/content-page-header","version":"0.1.0","title":"Content page header","category":"homegrade-blocks","icon":"smiley","description":"Bloc bannière/header de contenu de premier niveau pour les pages de contenu","supports":{"html":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","attributes":{"pageHeaderTitle":{"type":"string"},"pageHeaderDescription":{"type":"string"},"hasCta":{"type":"boolean","default":false},"cta":{"type":"object"}}}');
/***/ })
diff --git a/blocks/content-page-header/build/index.js.map b/blocks/content-page-header/build/index.js.map
index a9d112e..c4535fd 100644
--- a/blocks/content-page-header/build/index.js.map
+++ b/blocks/content-page-header/build/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACd;AACqB;AAOX;AAC8B;AAEhD,SAASU,IAAIA,CAAC;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAE;EAC3D,MAAM;IAAEC,eAAe;IAAEC,qBAAqB;IAAEC;EAAI,CAAC,GAAGJ,UAAU;EAElE,MAAMK,SAAS,GAAGf,0DAAS,CAAEgB,MAAM,IAAK;IACvC,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAC,aAAa,CAAC;IACxD,OAAOC,sBAAsB,CAAC,OAAO,CAAC;EACvC,CAAC,CAAC;EAEF,MAAMC,QAAQ,GAAGlB,0DAAS,CAAEgB,MAAM,IAAK;IACtC,MAAMG,WAAW,GAAGH,MAAM,CAAC,aAAa,CAAC,CAACI,cAAc,CAAC,CAAC;IAC1D,IAAID,WAAW,IAAIA,WAAW,CAACE,GAAG,IAAIF,WAAW,CAACE,GAAG,CAACC,SAAS,EAAE;MAChE,IAAIC,KAAK,GAAGP,MAAM,CAAC,MAAM,CAAC,CAACQ,QAAQ,CAACL,WAAW,CAACE,GAAG,CAACC,SAAS,CAAC;MAC9D,OAAOC,KAAK;IACb;EACD,CAAC,CAAC;EAEF,SAASE,mBAAmBA,CAACC,QAAQ,EAAE;IACtCf,aAAa,CAAC;MAAEC,eAAe,EAAEc;IAAS,CAAC,CAAC;EAC7C;EACA,SAASC,yBAAyBA,CAACC,cAAc,EAAE;IAClDjB,aAAa,CAAC;MAAEE,qBAAqB,EAAEe;IAAe,CAAC,CAAC;EACzD;EACA,SAASC,iBAAiB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;EACDC,IAAI,EAAErD,6CAAIA;AACX,CAAC,CAAC;;;;;;;;;;;AC3BF;;;;;;;;;;;;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/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\",\"i18n\"]","webpack://multiblocks/webpack/bootstrap","webpack://multiblocks/webpack/runtime/chunk loaded","webpack://multiblocks/webpack/runtime/compat get default export","webpack://multiblocks/webpack/runtime/define property getters","webpack://multiblocks/webpack/runtime/hasOwnProperty shorthand","webpack://multiblocks/webpack/runtime/make namespace object","webpack://multiblocks/webpack/runtime/jsonp chunk loading","webpack://multiblocks/webpack/before-startup","webpack://multiblocks/webpack/startup","webpack://multiblocks/webpack/after-startup"],"sourcesContent":["import { __ } from \"@wordpress/i18n\";\nimport \"./editor.scss\";\nimport { useSelect } from \"@wordpress/data\";\nimport {\n\tuseBlockProps,\n\tRichText,\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalLinkControl as LinkControl,\n} from \"@wordpress/block-editor\";\nimport { PanelBody, TextControl } from \"@wordpress/components\";\n\nexport default function Edit({ attributes, setAttributes }) {\n\tconst { pageHeaderTitle, pageHeaderDescription, cta } = attributes;\n\n\tconst pageTitle = useSelect((select) => {\n\t\tconst { getEditedPostAttribute } = select(\"core/editor\");\n\t\treturn getEditedPostAttribute(\"title\");\n\t});\n\n\tconst pageIcon = useSelect((select) => {\n\t\tconst currentPost = select(\"core/editor\").getCurrentPost();\n\t\tif (currentPost && currentPost.acf && currentPost.acf.page_icon) {\n\t\t\tlet cover = select(\"core\").getMedia(currentPost.acf.page_icon);\n\t\t\treturn cover;\n\t\t}\n\t});\n\n\tfunction handleOnChangeTitle(newTitle) {\n\t\tsetAttributes({ pageHeaderTitle: newTitle });\n\t}\n\tfunction handleOnChangeDescription(newDescription) {\n\t\tsetAttributes({ pageHeaderDescription: newDescription });\n\t}\n\tfunction handleOnChangeCTA(newCtaValue) {\n\t\tsetAttributes({\n\t\t\tcta: {\n\t\t\t\ttitle: !cta || !cta.title ? newCtaValue.title : cta.title,\n\t\t\t\tid: newCtaValue.id,\n\t\t\t\tkind: newCtaValue.kind,\n\t\t\t\ttype: newCtaValue.type,\n\t\t\t\turl: newCtaValue.url,\n\t\t\t},\n\t\t});\n\t}\n\tfunction onChangeTextControl(newCtaTitle) {\n\t\tsetAttributes({\n\t\t\tcta: {\n\t\t\t\t...cta,\n\t\t\t\ttitle: newCtaTitle,\n\t\t\t},\n\t\t});\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t {\n\t\t\t\t\t\t\tconsole.log(\"loading\", e);\n\t\t\t\t\t\t\thandleOnChangeCTA(e);\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{pageIcon && (\n\t\t\t\t\t
\n\t\t\t\t)}\n\t\t\t\n\t\t>\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\nimport \"./style.scss\";\n\nimport Edit from \"./edit\";\nimport metadata from \"./block.json\";\n\nregisterBlockType(metadata.name, {\n\ticon: {\n\t\tforeground: \"#f03\",\n\t\tsrc: (\n\t\t\t\n\t\t),\n\t},\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\"][\"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":["__","useSelect","useBlockProps","RichText","BlockControls","InspectorControls","__experimentalLinkControl","LinkControl","PanelBody","TextControl","Edit","attributes","setAttributes","pageHeaderTitle","pageHeaderDescription","cta","pageTitle","select","getEditedPostAttribute","pageIcon","currentPost","getCurrentPost","acf","page_icon","cover","getMedia","handleOnChangeTitle","newTitle","handleOnChangeDescription","newDescription","handleOnChangeCTA","newCtaValue","title","id","kind","type","url","onChangeTextControl","newCtaTitle","createElement","Fragment","className","label","value","onChange","e","console","log","class","tagName","placeholder","href","src","source_url","alt","registerBlockType","metadata","name","icon","foreground","xmlns","viewBox","d","edit"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACd;AACqB;AAOX;AAC6C;AAE/D,SAASW,IAAIA,CAAC;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAE;EAC3D,MAAM;IAAEC,eAAe;IAAEC,qBAAqB;IAAEC,MAAM;IAAEC;EAAI,CAAC,GAAGL,UAAU;EAE1E,MAAMM,SAAS,GAAGjB,0DAAS,CAAEkB,MAAM,IAAK;IACvC,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAC,aAAa,CAAC;IACxD,OAAOC,sBAAsB,CAAC,OAAO,CAAC;EACvC,CAAC,CAAC;EAEF,MAAMC,QAAQ,GAAGpB,0DAAS,CAAEkB,MAAM,IAAK;IACtC,MAAMG,WAAW,GAAGH,MAAM,CAAC,aAAa,CAAC,CAACI,cAAc,CAAC,CAAC;IAC1D,IAAID,WAAW,IAAIA,WAAW,CAACE,GAAG,IAAIF,WAAW,CAACE,GAAG,CAACC,SAAS,EAAE;MAChE,IAAIC,KAAK,GAAGP,MAAM,CAAC,MAAM,CAAC,CAACQ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WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://multiblocks/./src/edit.js","webpack://multiblocks/./src/index.js","webpack://multiblocks/./src/editor.scss","webpack://multiblocks/./src/style.scss","webpack://multiblocks/external window [\"wp\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"components\"]","webpack://multiblocks/external window [\"wp\",\"data\"]","webpack://multiblocks/external window [\"wp\",\"element\"]","webpack://multiblocks/external window [\"wp\",\"i18n\"]","webpack://multiblocks/webpack/bootstrap","webpack://multiblocks/webpack/runtime/chunk loaded","webpack://multiblocks/webpack/runtime/compat get default export","webpack://multiblocks/webpack/runtime/define property getters","webpack://multiblocks/webpack/runtime/hasOwnProperty shorthand","webpack://multiblocks/webpack/runtime/make namespace object","webpack://multiblocks/webpack/runtime/jsonp chunk loading","webpack://multiblocks/webpack/before-startup","webpack://multiblocks/webpack/startup","webpack://multiblocks/webpack/after-startup"],"sourcesContent":["import { __ } from \"@wordpress/i18n\";\nimport \"./editor.scss\";\nimport { useSelect } from \"@wordpress/data\";\nimport {\n\tuseBlockProps,\n\tRichText,\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalLinkControl as LinkControl,\n} from \"@wordpress/block-editor\";\nimport { PanelBody, TextControl, ToggleControl } from \"@wordpress/components\";\n\nexport default function Edit({ attributes, setAttributes }) {\n\tconst { pageHeaderTitle, pageHeaderDescription, hasCta, cta } = attributes;\n\n\tconst pageTitle = useSelect((select) => {\n\t\tconst { getEditedPostAttribute } = select(\"core/editor\");\n\t\treturn getEditedPostAttribute(\"title\");\n\t});\n\n\tconst pageIcon = useSelect((select) => {\n\t\tconst currentPost = select(\"core/editor\").getCurrentPost();\n\t\tif (currentPost && currentPost.acf && currentPost.acf.page_icon) {\n\t\t\tlet cover = select(\"core\").getMedia(currentPost.acf.page_icon);\n\t\t\treturn cover;\n\t\t}\n\t});\n\n\tfunction onChangeTitle(newTitle) {\n\t\tsetAttributes({ pageHeaderTitle: newTitle });\n\t}\n\tfunction onChangeHasCta(newHasCta) {\n\t\tconsole.log(\"newHasCta\", newHasCta);\n\t\tsetAttributes({ hasCta: !hasCta });\n\t\tif (!newHasCta) {\n\t\t\tsetAttributes({ cta: undefined });\n\t\t}\n\t}\n\tfunction onChangeDescription(newDescription) {\n\t\tsetAttributes({ pageHeaderDescription: newDescription });\n\t}\n\tfunction onChangeCTA(newCtaValue) {\n\t\tsetAttributes({\n\t\t\tcta: {\n\t\t\t\ttitle: !cta || !cta.title ? newCtaValue.title : cta.title,\n\t\t\t\tid: newCtaValue.id,\n\t\t\t\tkind: newCtaValue.kind,\n\t\t\t\ttype: newCtaValue.type,\n\t\t\t\turl: newCtaValue.url,\n\t\t\t},\n\t\t});\n\t}\n\tfunction onChangeTextControl(newCtaTitle) {\n\t\tsetAttributes({\n\t\t\tcta: {\n\t\t\t\t...cta,\n\t\t\t\ttitle: newCtaTitle,\n\t\t\t},\n\t\t});\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\n\t\t\t\t\t{hasCta && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t>\n\t\t\t\t\t)}\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t{pageIcon && (\n\t\t\t\t\t
\n\t\t\t\t)}\n\t\t\t\n\t\t>\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\nimport \"./style.scss\";\n\nimport Edit from \"./edit\";\nimport metadata from \"./block.json\";\n\nregisterBlockType(metadata.name, {\n\ticon: {\n\t\tforeground: \"#f03\",\n\t\tsrc: (\n\t\t\t\n\t\t),\n\t},\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\"][\"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":["__","useSelect","useBlockProps","RichText","BlockControls","InspectorControls","__experimentalLinkControl","LinkControl","PanelBody","TextControl","ToggleControl","Edit","attributes","setAttributes","pageHeaderTitle","pageHeaderDescription","hasCta","cta","pageTitle","select","getEditedPostAttribute","pageIcon","currentPost","getCurrentPost","acf","page_icon","cover","getMedia","onChangeTitle","newTitle","onChangeHasCta","newHasCta","console","log","undefined","onChangeDescription","newDescription","onChangeCTA","newCtaValue","title","id","kind","type","url","onChangeTextControl","newCtaTitle","createElement","Fragment","className","label","checked","onChange","value","class","tagName","placeholder","href","src","source_url","alt","registerBlockType","metadata","name","icon","foreground","xmlns","viewBox","d","edit"],"sourceRoot":""}
\ No newline at end of file
diff --git a/blocks/content-page-header/src/block.json b/blocks/content-page-header/src/block.json
index 5102cf1..0089737 100644
--- a/blocks/content-page-header/src/block.json
+++ b/blocks/content-page-header/src/block.json
@@ -22,6 +22,10 @@
"pageHeaderDescription": {
"type": "string"
},
+ "hasCta": {
+ "type": "boolean",
+ "default": false
+ },
"cta": {
"type": "object"
}
diff --git a/blocks/content-page-header/src/edit.js b/blocks/content-page-header/src/edit.js
index 823099a..e991f8c 100644
--- a/blocks/content-page-header/src/edit.js
+++ b/blocks/content-page-header/src/edit.js
@@ -8,10 +8,10 @@ import {
InspectorControls,
__experimentalLinkControl as LinkControl,
} from "@wordpress/block-editor";
-import { PanelBody, TextControl } from "@wordpress/components";
+import { PanelBody, TextControl, ToggleControl } from "@wordpress/components";
export default function Edit({ attributes, setAttributes }) {
- const { pageHeaderTitle, pageHeaderDescription, cta } = attributes;
+ const { pageHeaderTitle, pageHeaderDescription, hasCta, cta } = attributes;
const pageTitle = useSelect((select) => {
const { getEditedPostAttribute } = select("core/editor");
@@ -26,13 +26,20 @@ export default function Edit({ attributes, setAttributes }) {
}
});
- function handleOnChangeTitle(newTitle) {
+ function onChangeTitle(newTitle) {
setAttributes({ pageHeaderTitle: newTitle });
}
- function handleOnChangeDescription(newDescription) {
+ function onChangeHasCta(newHasCta) {
+ console.log("newHasCta", newHasCta);
+ setAttributes({ hasCta: !hasCta });
+ if (!newHasCta) {
+ setAttributes({ cta: undefined });
+ }
+ }
+ function onChangeDescription(newDescription) {
setAttributes({ pageHeaderDescription: newDescription });
}
- function handleOnChangeCTA(newCtaValue) {
+ function onChangeCTA(newCtaValue) {
setAttributes({
cta: {
title: !cta || !cta.title ? newCtaValue.title : cta.title,
@@ -59,20 +66,30 @@ export default function Edit({ attributes, setAttributes }) {
className="homegrade-blocks-content-page-header__panel-cta"
title={__("Call to action", "homegrade-blocks__texte-fonctionnel")}
>
-
- {
- console.log("loading", e);
- handleOnChangeCTA(e);
- }}
+
+
+ {hasCta && (
+ <>
+
+
+ >
+ )}
{cta && cta.title && cta.url && {cta.title}}