diff --git a/blocks/picture-banner/build/block.json b/blocks/picture-banner/build/block.json index 9ba4a96..1e2c5af 100644 --- a/blocks/picture-banner/build/block.json +++ b/blocks/picture-banner/build/block.json @@ -31,6 +31,14 @@ "selector": "img", "attribute": "src" }, + "coverCaption": { + "type": "string", + "default": "" + }, + "coverDescription": { + "type": "string", + "default": "" + }, "heightFixed": { "type": "boolean", "default": true diff --git a/blocks/picture-banner/build/index.asset.php b/blocks/picture-banner/build/index.asset.php index 90a9225..dde97a6 100644 --- a/blocks/picture-banner/build/index.asset.php +++ b/blocks/picture-banner/build/index.asset.php @@ -1 +1 @@ - array('wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'e5c70dab6e7945fcfd62'); + array('wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '42abcb6ba0556a0f4814'); diff --git a/blocks/picture-banner/build/index.css b/blocks/picture-banner/build/index.css index e189676..d9fb173 100644 --- a/blocks/picture-banner/build/index.css +++ b/blocks/picture-banner/build/index.css @@ -1,6 +1,6 @@ -/*!****************************************************************************************************************************************************************************************************************************************!*\ - !*** 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 ***! - \****************************************************************************************************************************************************************************************************************************************/ +/*!****************************************************************************************************************************************************************************************************************************************************!*\ + !*** 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. * diff --git a/blocks/picture-banner/build/index.js b/blocks/picture-banner/build/index.js index f8814a2..3725845 100644 --- a/blocks/picture-banner/build/index.js +++ b/blocks/picture-banner/build/index.js @@ -42,6 +42,8 @@ function Edit({ coverUrl, coverId, coverAlt, + coverCaption, + coverDescription, heightFixed, imagePosition } = attributes; @@ -54,22 +56,21 @@ function Edit({ setAttributes({ coverUrl: undefined, coverId: undefined, - coverAlt: "" + coverAlt: "", + coverCaption: "", + coverDescription: "" }); } function updateCoverImage(image) { if (!image || !image.url) { - setAttributes({ - coverUrl: undefined, - coverId: undefined, - coverAlt: "" - }); - return; + return removeCoverImg(); } setAttributes({ coverUrl: image.url, coverId: image.id, - coverAlt: image.alt + coverAlt: image.alt, + coverCaption: image.caption, + coverDescription: image.description }); } function onHeightFixedChange(heightFixed) { @@ -154,7 +155,7 @@ function Edit({ icon: "trash", title: "Supprimer l'image", onClick: removeCoverImg - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("figure", { ...(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" : ""} ` }) @@ -164,7 +165,9 @@ function Edit({ style: { objectPosition: `${imagePosition.x * 100}% ${imagePosition.y * 100}%` } - }), (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, { + }), coverCaption && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("figcaption", { + className: "homegrade-content-blocks-picture-banner__caption" + }, coverCaption), (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: updateCoverImage, @@ -229,21 +232,25 @@ function save({ coverUrl, coverId, coverAlt, + coverCaption, + coverDescription, heightFixed, imagePosition } = attributes; - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", { + return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("figure", { ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({ className: `homegrade-content-blocks-picture-banner ${heightFixed ? "fixed-height" : ""}` }) - }, coverUrl && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { + }, 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: { objectPosition: `${imagePosition.x * 100}% ${imagePosition.y * 100}%` }, className: `wp-image-${coverId}` - })); + }), coverCaption && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("figcaption", { + className: "homegrade-content-blocks-picture-banner__caption" + }, coverCaption))); } /***/ }), @@ -338,7 +345,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/picture-banner","version":"0.1.0","title":"Image Bannière","category":"homegrade-blocks","icon":{"background":"#fff","foreground":"#DF1E1E","src":"cover-image"},"description":"Une image de heading utilisable dans les fiches questions pour illustrer un propos. La hauteur et la position de l\'image sont réglable","supports":{"html":false},"attributes":{"coverId":{"type":"number"},"coverAlt":{"type":"string","source":"attribute","selector":"img","attribute":"alt","default":""},"coverUrl":{"type":"string","source":"attribute","selector":"img","attribute":"src"},"heightFixed":{"type":"boolean","default":true},"imagePosition":{"type":"object","default":{"x":0.2,"y":0.4}}},"textdomain":"homegrade-theme__bloks-texte-fonctionnel","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); +module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/picture-banner","version":"0.1.0","title":"Image Bannière","category":"homegrade-blocks","icon":{"background":"#fff","foreground":"#DF1E1E","src":"cover-image"},"description":"Une image de heading utilisable dans les fiches questions pour illustrer un propos. La hauteur et la position de l\'image sont réglable","supports":{"html":false},"attributes":{"coverId":{"type":"number"},"coverAlt":{"type":"string","source":"attribute","selector":"img","attribute":"alt","default":""},"coverUrl":{"type":"string","source":"attribute","selector":"img","attribute":"src"},"coverCaption":{"type":"string","default":""},"coverDescription":{"type":"string","default":""},"heightFixed":{"type":"boolean","default":true},"imagePosition":{"type":"object","default":{"x":0.2,"y":0.4}}},"textdomain":"homegrade-theme__bloks-texte-fonctionnel","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}'); /***/ }) diff --git a/blocks/picture-banner/build/index.js.map b/blocks/picture-banner/build/index.js.map index 2e12cd6..3c0f57d 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;AAWF;AACR;AACoC;AAE3D,SAASqB,IAAIA,CAAC;EACbC,UAAU;EACVC,aAAa;EACbC,gBAAgB;EAChBC,UAAU;EACVC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAE;EACF,MAAM;IAAEC,QAAQ;IAAEC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;;;;;;;;;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?0339","webpack://multiblocks/./src/style.scss?75bd","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\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\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\tfunction onHeightFixedChange(heightFixed) {\n\t\tsetAttributes({ heightFixed });\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\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\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\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\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 onHeightFixedChange(true)}\n\t\t\t\t\t/>\n\t\t\t\t\t onHeightFixedChange(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","ToggleControl","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","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","onHeightFixedChange","createElement","Fragment","title","label","className","isBlock","onChange","value","dimensions","width","height","focalPoint","icon","isActive","onClick","group","name","disableMediaButtons","onSelect","onError","accept","allowedTypes","notices","mediaId","mediaURL","src","style","objectPosition","x","y","registerBlockType","save","metadata","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACoB;AAOxB;AAWF;AACR;AACoC;AAE3D,SAASqB,IAAIA,CAAC;EACbC,UAAU;EACVC,aAAa;EACbC,gBAAgB;EAChBC,UAAU;EACVC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAE;EACF,MAAM;IACLC,QAAQ;IACRC,OAAO;IACPC,QAAQ;IACRC,YAAY;IACZC,gBAAgB;IAChBC,WAAW;IACXC;EACD,CAAC,GAAGZ,UAAU;EACd,MAAM,CAACa,OAAO,EAAEC,UAAU,CAAC,GAAGlC,4DAAQ,CAAC,CAAC;EAExC,SAASmC,aAAaA,CAACC,OAAO,EAAE;IAC/Bd,gBAAgB,CAACe,gBAAgB,CAAC,CAAC;IACnCf,gBAAgB,CAACgB,iBAAiB,CAACF,OAAO,CAAC;EAC5C;EACA,SAASG,cAAcA,CAAA,EAAG;IACzBlB,aAAa,CAAC;MACbK,QAAQ,EAAEc,SAAS;MACnBb,OAAO,EAAEa,SAAS;MAClBZ,QAAQ,EAAE,EAAE;MACZC,YAAY,EAAE,EAAE;MAChBC,gBAAgB,EAAE;IACnB,CAAC,CAAC;EACH;EAEA,SAASW,gBAAgBA,CAACC,KAAK,EAAE;IAChC,IAAI,CAACA,KAAK,IAAI,CAACA,KAAK,CAACC,GAAG,EAAE;MACzB,OAAOJ,cAAc,CAAC,CAAC;IACx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;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?03c3","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\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\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 {\n\t\tcoverUrl,\n\t\tcoverId,\n\t\tcoverAlt,\n\t\tcoverCaption,\n\t\tcoverDescription,\n\t\theightFixed,\n\t\timagePosition,\n\t} = attributes;\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\tcoverCaption: \"\",\n\t\t\tcoverDescription: \"\",\n\t\t});\n\t}\n\n\tfunction updateCoverImage(image) {\n\t\tif (!image || !image.url) {\n\t\t\treturn removeCoverImg();\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\tcoverCaption: image.caption,\n\t\t\tcoverDescription: image.description,\n\t\t});\n\t}\n\n\tfunction onHeightFixedChange(heightFixed) {\n\t\tsetAttributes({ heightFixed });\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\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\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\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\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 onHeightFixedChange(true)}\n\t\t\t\t\t/>\n\t\t\t\t\t onHeightFixedChange(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\t\t\t\t\t\t{coverCaption && (\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t{coverCaption}\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t)}\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 {\n\t\tcoverUrl,\n\t\tcoverId,\n\t\tcoverAlt,\n\t\tcoverCaption,\n\t\tcoverDescription,\n\t\theightFixed,\n\t\timagePosition,\n\t} = attributes;\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\t{coverCaption && (\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t{coverCaption}\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\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","ToggleControl","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","isBlobURL","revokeBlobURL","Edit","attributes","setAttributes","noticeOperations","noticeList","noticeUI","props","coverUrl","coverId","coverAlt","coverCaption","coverDescription","heightFixed","imagePosition","blobUrl","setBlobUrl","onUploadError","message","removeAllNotices","createErrorNotice","removeCoverImg","undefined","updateCoverImage","image","url","id","alt","caption","description","onHeightFixedChange","createElement","Fragment","title","label","className","isBlock","onChange","value","dimensions","width","height","focalPoint","icon","isActive","onClick","group","name","disableMediaButtons","onSelect","onError","accept","allowedTypes","notices","mediaId","mediaURL","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 b35e4ca..9ae9132 100644 --- a/blocks/picture-banner/build/style-index.css +++ b/blocks/picture-banner/build/style-index.css @@ -1,6 +1,6 @@ -/*!***************************************************************************************************************************************************************************************************************************************!*\ - !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***! - \***************************************************************************************************************************************************************************************************************************************/ +/*!***************************************************************************************************************************************************************************************************************************************************!*\ + !*** css ../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!../../node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***! + \***************************************************************************************************************************************************************************************************************************************************/ /** * The following styles get applied both on the front of your site * and in the editor. @@ -10,11 +10,14 @@ .wp-block-homegrade-content-blocks-picture-banner { margin-bottom: 20px; overflow: hidden; - border-radius: 22px; } .wp-block-homegrade-content-blocks-picture-banner img { + border-radius: 22px; width: 100%; } +.wp-block-homegrade-content-blocks-picture-banner figcaption { + padding: 2px 10px; +} .wp-block-homegrade-content-blocks-picture-banner.fixed-height img { 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 0ed48b6..2601d80 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;EACA;EACA;AAAD;AACC;EACC;AACF;AAEE;EACC;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\timg {\n\t\twidth: 100%;\n\t}\n\t&.fixed-height {\n\t\timg {\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 +{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAOA;EACC;EACA;AAAD;AACC;EACC;EACA;AACF;AACC;EACC;AACF;AAEE;EACC;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\timg {\n\t\tborder-radius: 22px;\n\t\twidth: 100%;\n\t}\n\tfigcaption {\n\t\tpadding: 2px 10px;\n\t}\n\t&.fixed-height {\n\t\timg {\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/block.json b/blocks/picture-banner/src/block.json index e1d9028..dc40161 100644 --- a/blocks/picture-banner/src/block.json +++ b/blocks/picture-banner/src/block.json @@ -31,6 +31,14 @@ "selector": "img", "attribute": "src" }, + "coverCaption": { + "type": "string", + "default": "" + }, + "coverDescription": { + "type": "string", + "default": "" + }, "heightFixed": { "type": "boolean", "default": true diff --git a/blocks/picture-banner/src/edit.js b/blocks/picture-banner/src/edit.js index c44f435..cf9de3a 100644 --- a/blocks/picture-banner/src/edit.js +++ b/blocks/picture-banner/src/edit.js @@ -29,8 +29,15 @@ function Edit({ noticeUI, ...props }) { - const { coverUrl, coverId, coverAlt, heightFixed, imagePosition } = - attributes; + const { + coverUrl, + coverId, + coverAlt, + coverCaption, + coverDescription, + heightFixed, + imagePosition, + } = attributes; const [blobUrl, setBlobUrl] = useState(); function onUploadError(message) { @@ -42,22 +49,21 @@ function Edit({ coverUrl: undefined, coverId: undefined, coverAlt: "", + coverCaption: "", + coverDescription: "", }); } function updateCoverImage(image) { if (!image || !image.url) { - setAttributes({ - coverUrl: undefined, - coverId: undefined, - coverAlt: "", - }); - return; + return removeCoverImg(); } setAttributes({ coverUrl: image.url, coverId: image.id, coverAlt: image.alt, + coverCaption: image.caption, + coverDescription: image.description, }); } @@ -152,7 +158,7 @@ function Edit({ )} -
- + {coverCaption && ( +
+ {coverCaption} +
+ )} {isBlobURL(coverUrl) && } )} @@ -184,7 +194,7 @@ function Edit({ allowedTypes={["image"]} // Onlibrary Allow only images notices={noticeUI} // En cas d'erreur d'upload /> -
+ ); } diff --git a/blocks/picture-banner/src/save.js b/blocks/picture-banner/src/save.js index 813874e..7ad11a0 100644 --- a/blocks/picture-banner/src/save.js +++ b/blocks/picture-banner/src/save.js @@ -1,9 +1,16 @@ import { useBlockProps } from "@wordpress/block-editor"; export default function save({ attributes }) { - const { coverUrl, coverId, coverAlt, heightFixed, imagePosition } = - attributes; + const { + coverUrl, + coverId, + coverAlt, + coverCaption, + coverDescription, + heightFixed, + imagePosition, + } = attributes; return ( -
{coverUrl && ( - {coverAlt} + <> + {coverAlt} + {coverCaption && ( +
+ {coverCaption} +
+ )} + )} -
+ ); } diff --git a/blocks/picture-banner/src/style.scss b/blocks/picture-banner/src/style.scss index 196d8f3..c1b08b0 100644 --- a/blocks/picture-banner/src/style.scss +++ b/blocks/picture-banner/src/style.scss @@ -8,10 +8,13 @@ .wp-block-homegrade-content-blocks-picture-banner { margin-bottom: 20px; overflow: hidden; - border-radius: 22px; img { + border-radius: 22px; width: 100%; } + figcaption { + padding: 2px 10px; + } &.fixed-height { img { height: 200px;