diff --git a/blocks/labelled-picture/build/block.json b/blocks/labelled-picture/build/block.json index 8cefcbc..e149866 100644 --- a/blocks/labelled-picture/build/block.json +++ b/blocks/labelled-picture/build/block.json @@ -19,6 +19,14 @@ "type": "boolean", "default": "true" }, + "legendLocation": { + "type": "string", + "default": "after" + }, + "hasLightbox": { + "type": "boolean", + "default": "false" + }, "hasRoundedShadow": { "type": "boolean", "default": "false" diff --git a/blocks/labelled-picture/build/index.asset.php b/blocks/labelled-picture/build/index.asset.php index 02da0c8..9a9ab54 100644 --- a/blocks/labelled-picture/build/index.asset.php +++ b/blocks/labelled-picture/build/index.asset.php @@ -1 +1 @@ - array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '6de2664ba6b7abf8bd92'); + array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'bc58aa87b993f5997c0d'); diff --git a/blocks/labelled-picture/build/index.js b/blocks/labelled-picture/build/index.js index 4b73d00..d65a343 100644 --- a/blocks/labelled-picture/build/index.js +++ b/blocks/labelled-picture/build/index.js @@ -37,6 +37,8 @@ function Edit({ }) { const { hasStickyLegend, + hasLightbox, + legendLocation, hasFixedHeight, hasRoundedShadow, showTitle, @@ -91,8 +93,21 @@ function Edit({ hasRoundedShadow }); } + function handleLegendLocationChange(legendLocation) { + setAttributes({ + legendLocation + }); + } + function handleHasLightbox(hasLightbox) { + setAttributes({ + hasLightbox + }); + } + const renderCaption = () => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("figcaption", null, showTitle && pictureTitle && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { + className: "figcaption-title" + }, pictureTitle), " ", pictureCaption); return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InspectorControls, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.PanelBody, { - title: "L\xE9gende", + title: "Param\xE8tres", className: "homegrade-blocks-components-image__panel-body " }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToggleControl, { label: "L\xE9gende Autocollante", @@ -112,7 +127,23 @@ function Edit({ label: "Rounded & Shadow", checked: hasRoundedShadow, onChange: handleHasRoundedShadow - })), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.PanelBody, { + }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToggleControl, { + label: "Afficher une lightbox", + checked: hasLightbox, + onChange: handleHasLightbox + }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.__experimentalToggleGroupControl, { + label: "Emplacement de la l\xE9gende", + value: "before", + onChange: handleLegendLocationChange, + isBlock: true, + __nextHasNoMarginBottom: true + }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.__experimentalToggleGroupControlOption, { + value: "before", + label: "Avant l'Image" + }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.__experimentalToggleGroupControlOption, { + value: "after", + label: "Apr\xE8s l'image" + }))), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.PanelBody, { title: "Source de l'image", className: "homegrade-blocks-components-image__panel-body " }, pictureUrl && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { @@ -140,12 +171,10 @@ function Edit({ ${showTitle && pictureTitle ? "homegrade-blocks-labelled-picture--legend-has-title" : ""} ${hasRoundedShadow ? "homegrade-blocks-labelled-picture--rounded-shadow" : ""}` }) - }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { + }, legendLocation === "before" && renderCaption(), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { src: pictureUrl, alt: pictureAlt - }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("figcaption", null, showTitle && pictureTitle && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { - className: "figcaption-title" - }, pictureTitle), " ", pictureCaption)), !pictureUrl && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.MediaPlaceholder, { + }), legendLocation === "after" && renderCaption()), !pictureUrl && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.MediaPlaceholder, { disableMediaButtons: pictureUrl, icon: "admin-appearance", onSelect: updatePictureImg, @@ -224,8 +253,10 @@ function save({ attributes }) { const { - hasFixedHeight, hasStickyLegend, + hasLightbox, + legendLocation, + hasFixedHeight, hasRoundedShadow, showTitle, pictureUrl, @@ -233,18 +264,22 @@ function save({ pictureTitle, pictureCaption } = attributes; + const renderCaption = () => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("figcaption", null, showTitle && pictureTitle && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { + className: "figcaption-title" + }, pictureTitle), " ", pictureCaption); return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, pictureUrl && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("figure", { ..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({ className: `homegrade-blocks-labelled-picture homegrade-blocks-labelled-picture--legend-${hasStickyLegend ? "sticky" : "normal"} ${hasFixedHeight ? "homegrade-blocks-labelled-picture--fixed-height" : ""} ${showTitle && pictureTitle ? "homegrade-blocks-labelled-picture--legend-has-title" : ""} - ${hasRoundedShadow ? "homegrade-blocks-labelled-picture--rounded-shadow" : ""} singleLightbox-link` + ${hasRoundedShadow ? "homegrade-blocks-labelled-picture--rounded-shadow" : ""} + + ${hasLightbox ? "singleLightbox-link" : ""} + ` }) - }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { + }, legendLocation === "before" && renderCaption(), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { src: pictureUrl, alt: pictureAlt - }), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("figcaption", null, showTitle && pictureTitle && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", { - className: "figcaption-title" - }, pictureTitle), " ", pictureCaption))); + }), legendLocation === "after" && renderCaption())); } /***/ }), @@ -380,7 +415,7 @@ module.exports = window["wp"]["primitives"]; \************************/ /***/ ((module) => { -module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/labelled-picture","version":"0.1.0","title":"Image + Légende","category":"homegrade-blocks","icon":"smiley","description":"Bloc image contenant une légende autocollante","supports":{"html":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"hasStickyLegend":{"type":"boolean","default":"true"},"hasRoundedShadow":{"type":"boolean","default":"false"},"hasFixedHeight":{"type":"boolean","default":"true"},"showTitle":{"type":"boolean","default":"true"},"pictureUrl":{"type":"string"},"pictureTitle":{"type":"string"},"pictureAlt":{"type":"string"},"pictureId":{"type":"number"},"pictureCaption":{"type":"string"}}}'); +module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/labelled-picture","version":"0.1.0","title":"Image + Légende","category":"homegrade-blocks","icon":"smiley","description":"Bloc image contenant une légende autocollante","supports":{"html":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"hasStickyLegend":{"type":"boolean","default":"true"},"legendLocation":{"type":"string","default":"after"},"hasLightbox":{"type":"boolean","default":"false"},"hasRoundedShadow":{"type":"boolean","default":"false"},"hasFixedHeight":{"type":"boolean","default":"true"},"showTitle":{"type":"boolean","default":"true"},"pictureUrl":{"type":"string"},"pictureTitle":{"type":"string"},"pictureAlt":{"type":"string"},"pictureId":{"type":"number"},"pictureCaption":{"type":"string"}}}'); /***/ }) diff --git a/blocks/labelled-picture/build/index.js.map b/blocks/labelled-picture/build/index.js.map index 761babb..9bbcd6e 100644 --- a/blocks/labelled-picture/build/index.js.map +++ b/blocks/labelled-picture/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACd;AAOU;AASF;AACU;AAE1B,SAASe,IAAIA,CAAC;EAC5BC,UAAU;EACVC,aAAa;EACbC,gBAAgB;EAChBC,UAAU;EACVC;AACD,CAAC,EAAE;EACF,MAAM;IACLC,eAAe;IACfC,cAAc;IACdC,gBAAgB;IAChBC,SAAS;IACTC,UAAU;IACVC,UAAU;IACVC,SAAS;IACTC,YAAY;IACZC;EACD,CAAC,GAAGb,UAAU;EAEd,SAASc,gBAAgBA,CAAA,EAAG;IAC3Bb,aAAa,CAAC;MACbQ,UAAU,EAAEM,SAAS;MACrBJ,SAAS,EAAEI,SAAS;MACpBF,cAAc,EAAEE,SAAS;MACzBL,UAAU,EAAE;IACb,CAAC,CAAC;EACH;EAEA,SAASM,gBAAgBA,CAACC,KAAK,EAAE;IAChCC,OAAO,CAACC,GAAG,CAACF,KAAK,CAAC;IAClB,IAAI,CAACA,KAAK,IAAI,CAACA,KAAK,CAACG,GAAG,EAAE;MACzBN,gBAAgB,CAAC,CAAC;IACnB;IACAb,aAAa,CAAC;MACbW,YAAY,EAAEK,KAAK,CAACI,KAAK;MACzBZ,UAAU,EAAEQ,KAAK,CAACG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;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC3BA;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,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEjDA;UACA;UACA;UACA;UACA","sources":["webpack://multiblocks/./src/edit.js","webpack://multiblocks/./src/index.js","webpack://multiblocks/./src/save.js","webpack://multiblocks/./src/editor.scss","webpack://multiblocks/./src/style.scss","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/trash.js","webpack://multiblocks/external window \"React\"","webpack://multiblocks/external window [\"wp\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"components\"]","webpack://multiblocks/external window [\"wp\",\"element\"]","webpack://multiblocks/external window [\"wp\",\"i18n\"]","webpack://multiblocks/external window [\"wp\",\"primitives\"]","webpack://multiblocks/webpack/bootstrap","webpack://multiblocks/webpack/runtime/chunk loaded","webpack://multiblocks/webpack/runtime/compat get default export","webpack://multiblocks/webpack/runtime/define property getters","webpack://multiblocks/webpack/runtime/hasOwnProperty shorthand","webpack://multiblocks/webpack/runtime/make namespace object","webpack://multiblocks/webpack/runtime/jsonp chunk loading","webpack://multiblocks/webpack/before-startup","webpack://multiblocks/webpack/startup","webpack://multiblocks/webpack/after-startup"],"sourcesContent":["import { __ } from \"@wordpress/i18n\";\nimport \"./editor.scss\";\nimport {\n\tuseBlockProps,\n\tMediaPlaceholder,\n\tBlockControls,\n\tInspectorControls,\n\tMediaReplaceFlow,\n} from \"@wordpress/block-editor\";\n\nimport {\n\tButton,\n\tPanelBody,\n\tTip,\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from \"@wordpress/components\";\nimport { trash } from \"@wordpress/icons\";\n\nexport default function Edit({\n\tattributes,\n\tsetAttributes,\n\tnoticeOperations,\n\tnoticeList,\n\tnoticeUI,\n}) {\n\tconst {\n\t\thasStickyLegend,\n\t\thasFixedHeight,\n\t\thasRoundedShadow,\n\t\tshowTitle,\n\t\tpictureUrl,\n\t\tpictureAlt,\n\t\tpictureId,\n\t\tpictureTitle,\n\t\tpictureCaption,\n\t} = attributes;\n\n\tfunction removePictureImg() {\n\t\tsetAttributes({\n\t\t\tpictureUrl: undefined,\n\t\t\tpictureId: undefined,\n\t\t\tpictureCaption: undefined,\n\t\t\tpictureAlt: \"\",\n\t\t});\n\t}\n\n\tfunction updatePictureImg(image) {\n\t\tconsole.log(image);\n\t\tif (!image || !image.url) {\n\t\t\tremovePictureImg();\n\t\t}\n\t\tsetAttributes({\n\t\t\tpictureTitle: image.title,\n\t\t\tpictureUrl: image.url,\n\t\t\tpictureId: image.id,\n\t\t\tpictureAlt: image.alt,\n\t\t\tpictureCaption: image.caption,\n\t\t});\n\t}\n\tfunction onUploadError(message) {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice(message);\n\t}\n\n\tfunction handleHasStickyLegend(hasStickyLegend) {\n\t\tsetAttributes({ hasStickyLegend });\n\t}\n\tfunction handleHasFixedHeight(hasFixedHeight) {\n\t\tsetAttributes({ hasFixedHeight });\n\t}\n\tfunction handleShowTitle(showTitle) {\n\t\tsetAttributes({ showTitle });\n\t}\n\tfunction handleHasRoundedShadow(hasRoundedShadow) {\n\t\tsetAttributes({ hasRoundedShadow });\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\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t{pictureUrl && {pictureAlt}}\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t{pictureUrl && (\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t)}\n\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\tLe texte de votre Légende est automatiquement attribué depuis le\n\t\t\t\t\t\t\tchamp \"Légende\" de votre image dans la gallerie des médias\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{pictureUrl && (\n\t\t\t\t\t\n\t\t\t\t\t\t{pictureAlt}\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t{showTitle && pictureTitle && (\n\t\t\t\t\t\t\t\t{pictureTitle}\n\t\t\t\t\t\t\t)}{\" \"}\n\t\t\t\t\t\t\t{pictureCaption}\n\t\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t)}\n\n\t\t\t\t{!pictureUrl && (\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 save from \"./save\";\nimport metadata from \"./block.json\";\n\nregisterBlockType(metadata.name, {\n\ticon: {\n\t\tsrc: (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t),\n\t\tforeground: \"#DF1E1E\",\n\t},\n\tedit: Edit,\n\tsave,\n});\n","import { useBlockProps } from \"@wordpress/block-editor\";\n\nexport default function save({ attributes }) {\n\tconst {\n\t\thasFixedHeight,\n\t\thasStickyLegend,\n\t\thasRoundedShadow,\n\t\tshowTitle,\n\t\tpictureUrl,\n\t\tpictureAlt,\n\t\tpictureTitle,\n\t\tpictureCaption,\n\t} = attributes;\n\n\treturn (\n\t\t<>\n\t\t\t{pictureUrl && (\n\t\t\t\t\n\t\t\t\t\t{pictureAlt}\n\t\t\t\t\t
\n\t\t\t\t\t\t{showTitle && pictureTitle && (\n\t\t\t\t\t\t\t{pictureTitle}\n\t\t\t\t\t\t)}{\" \"}\n\t\t\t\t\t\t{pictureCaption}\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 {};","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","module.exports = window[\"React\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"primitives\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\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, moreModules, runtime] = data;\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 = globalThis[\"webpackChunkmultiblocks\"] = globalThis[\"webpackChunkmultiblocks\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], () => (__webpack_require__(\"./src/index.js\")))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useBlockProps","MediaPlaceholder","BlockControls","InspectorControls","MediaReplaceFlow","Button","PanelBody","Tip","ToggleControl","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","trash","Edit","attributes","setAttributes","noticeOperations","noticeList","noticeUI","hasStickyLegend","hasFixedHeight","hasRoundedShadow","showTitle","pictureUrl","pictureAlt","pictureId","pictureTitle","pictureCaption","removePictureImg","undefined","updatePictureImg","image","console","log","url","title","id","alt","caption","onUploadError","message","removeAllNotices","createErrorNotice","handleHasStickyLegend","handleHasFixedHeight","handleShowTitle","handleHasRoundedShadow","createElement","Fragment","className","label","checked","onChange","help","src","mediaId","mediaUrl","allowedTypes","accept","onSelect","name","variant","icon","onClick","disableMediaButtons","notices","onError","registerBlockType","save","metadata","xmlns","viewBox","class","d","foreground","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AACd;AAOU;AASF;AACU;AAE1B,SAASe,IAAIA,CAAC;EAC5BC,UAAU;EACVC,aAAa;EACbC,gBAAgB;EAChBC,UAAU;EACVC;AACD,CAAC,EAAE;EACF,MAAM;IACLC,eAAe;IACfC,WAAW;IACXC,cAAc;IACdC,cAAc;IACdC,gBAAgB;IAChBC,SAAS;IACTC,UAAU;IACVC,UAAU;IACVC,SAAS;IACTC,YAAY;IACZC;EACD,CAAC,GAAGf,UAAU;EAEd,SAASgB,gBAAgBA,CAAA,EAAG;IAC3Bf,aAAa,CAAC;MACbU,UAAU,EAAEM,SAAS;MACrBJ,SAAS,EAAEI,SAAS;MACpBF,cAAc,EAAEE,SAAS;MACzBL,UAAU,EAAE;IACb,CAAC,CAAC;EACH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ACA,kBAAkB,qBAAqB;WACvC;WACA;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC3BA;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,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEjDA;UACA;UACA;UACA;UACA","sources":["webpack://multiblocks/./src/edit.js","webpack://multiblocks/./src/index.js","webpack://multiblocks/./src/save.js","webpack://multiblocks/./src/editor.scss","webpack://multiblocks/./src/style.scss","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/trash.js","webpack://multiblocks/external window \"React\"","webpack://multiblocks/external window [\"wp\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"components\"]","webpack://multiblocks/external window [\"wp\",\"element\"]","webpack://multiblocks/external window [\"wp\",\"i18n\"]","webpack://multiblocks/external window [\"wp\",\"primitives\"]","webpack://multiblocks/webpack/bootstrap","webpack://multiblocks/webpack/runtime/chunk loaded","webpack://multiblocks/webpack/runtime/compat get default export","webpack://multiblocks/webpack/runtime/define property getters","webpack://multiblocks/webpack/runtime/hasOwnProperty shorthand","webpack://multiblocks/webpack/runtime/make namespace object","webpack://multiblocks/webpack/runtime/jsonp chunk loading","webpack://multiblocks/webpack/before-startup","webpack://multiblocks/webpack/startup","webpack://multiblocks/webpack/after-startup"],"sourcesContent":["import { __ } from \"@wordpress/i18n\";\nimport \"./editor.scss\";\nimport {\n\tuseBlockProps,\n\tMediaPlaceholder,\n\tBlockControls,\n\tInspectorControls,\n\tMediaReplaceFlow,\n} from \"@wordpress/block-editor\";\n\nimport {\n\tButton,\n\tPanelBody,\n\tTip,\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from \"@wordpress/components\";\nimport { trash } from \"@wordpress/icons\";\n\nexport default function Edit({\n\tattributes,\n\tsetAttributes,\n\tnoticeOperations,\n\tnoticeList,\n\tnoticeUI,\n}) {\n\tconst {\n\t\thasStickyLegend,\n\t\thasLightbox,\n\t\tlegendLocation,\n\t\thasFixedHeight,\n\t\thasRoundedShadow,\n\t\tshowTitle,\n\t\tpictureUrl,\n\t\tpictureAlt,\n\t\tpictureId,\n\t\tpictureTitle,\n\t\tpictureCaption,\n\t} = attributes;\n\n\tfunction removePictureImg() {\n\t\tsetAttributes({\n\t\t\tpictureUrl: undefined,\n\t\t\tpictureId: undefined,\n\t\t\tpictureCaption: undefined,\n\t\t\tpictureAlt: \"\",\n\t\t});\n\t}\n\n\tfunction updatePictureImg(image) {\n\t\tconsole.log(image);\n\t\tif (!image || !image.url) {\n\t\t\tremovePictureImg();\n\t\t}\n\t\tsetAttributes({\n\t\t\tpictureTitle: image.title,\n\t\t\tpictureUrl: image.url,\n\t\t\tpictureId: image.id,\n\t\t\tpictureAlt: image.alt,\n\t\t\tpictureCaption: image.caption,\n\t\t});\n\t}\n\tfunction onUploadError(message) {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice(message);\n\t}\n\n\tfunction handleHasStickyLegend(hasStickyLegend) {\n\t\tsetAttributes({ hasStickyLegend });\n\t}\n\tfunction handleHasFixedHeight(hasFixedHeight) {\n\t\tsetAttributes({ hasFixedHeight });\n\t}\n\tfunction handleShowTitle(showTitle) {\n\t\tsetAttributes({ showTitle });\n\t}\n\tfunction handleHasRoundedShadow(hasRoundedShadow) {\n\t\tsetAttributes({ hasRoundedShadow });\n\t}\n\tfunction handleLegendLocationChange(legendLocation) {\n\t\tsetAttributes({ legendLocation });\n\t}\n\tfunction handleHasLightbox(hasLightbox) {\n\t\tsetAttributes({ hasLightbox });\n\t}\n\n\tconst renderCaption = () => (\n\t\t
\n\t\t\t{showTitle && pictureTitle && (\n\t\t\t\t{pictureTitle}\n\t\t\t)}{\" \"}\n\t\t\t{pictureCaption}\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\n\t\t\t\t\t\n\t\t\t\t\t\n\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\t\n\t\t\t\t\t{pictureUrl && {pictureAlt}}\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t{pictureUrl && (\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t)}\n\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\tLe texte de votre Légende est automatiquement attribué depuis le\n\t\t\t\t\t\t\tchamp \"Légende\" de votre image dans la gallerie des médias\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{pictureUrl && (\n\t\t\t\t\t\n\t\t\t\t\t\t{legendLocation === \"before\" && renderCaption()}\n\t\t\t\t\t\t{pictureAlt}\n\t\t\t\t\t\t{legendLocation === \"after\" && renderCaption()}\n\t\t\t\t\t\n\t\t\t\t)}\n\n\t\t\t\t{!pictureUrl && (\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 save from \"./save\";\nimport metadata from \"./block.json\";\n\nregisterBlockType(metadata.name, {\n\ticon: {\n\t\tsrc: (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t),\n\t\tforeground: \"#DF1E1E\",\n\t},\n\tedit: Edit,\n\tsave,\n});\n","import { useBlockProps } from \"@wordpress/block-editor\";\n\nexport default function save({ attributes }) {\n\tconst {\n\t\thasStickyLegend,\n\t\thasLightbox,\n\t\tlegendLocation,\n\t\thasFixedHeight,\n\t\thasRoundedShadow,\n\t\tshowTitle,\n\t\tpictureUrl,\n\t\tpictureAlt,\n\t\tpictureTitle,\n\t\tpictureCaption,\n\t} = attributes;\n\n\tconst renderCaption = () => (\n\t\t
\n\t\t\t{showTitle && pictureTitle && (\n\t\t\t\t{pictureTitle}\n\t\t\t)}{\" \"}\n\t\t\t{pictureCaption}\n\t\t
\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{pictureUrl && (\n\t\t\t\t\n\t\t\t\t\t{legendLocation === \"before\" && renderCaption()}\n\t\t\t\t\t{pictureAlt}\n\t\t\t\t\t{legendLocation === \"after\" && renderCaption()}\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 {};","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","module.exports = window[\"React\"];","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"primitives\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\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, moreModules, runtime] = data;\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 = globalThis[\"webpackChunkmultiblocks\"] = globalThis[\"webpackChunkmultiblocks\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], () => (__webpack_require__(\"./src/index.js\")))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useBlockProps","MediaPlaceholder","BlockControls","InspectorControls","MediaReplaceFlow","Button","PanelBody","Tip","ToggleControl","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","trash","Edit","attributes","setAttributes","noticeOperations","noticeList","noticeUI","hasStickyLegend","hasLightbox","legendLocation","hasFixedHeight","hasRoundedShadow","showTitle","pictureUrl","pictureAlt","pictureId","pictureTitle","pictureCaption","removePictureImg","undefined","updatePictureImg","image","console","log","url","title","id","alt","caption","onUploadError","message","removeAllNotices","createErrorNotice","handleHasStickyLegend","handleHasFixedHeight","handleShowTitle","handleHasRoundedShadow","handleLegendLocationChange","handleHasLightbox","renderCaption","createElement","className","Fragment","label","checked","onChange","help","value","isBlock","__nextHasNoMarginBottom","src","mediaId","mediaUrl","allowedTypes","accept","onSelect","name","variant","icon","onClick","disableMediaButtons","notices","onError","registerBlockType","save","metadata","xmlns","viewBox","class","d","foreground","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/labelled-picture/src/block.json b/blocks/labelled-picture/src/block.json index 3964ceb..ff42820 100644 --- a/blocks/labelled-picture/src/block.json +++ b/blocks/labelled-picture/src/block.json @@ -19,6 +19,14 @@ "type": "boolean", "default": "true" }, + "legendLocation": { + "type": "string", + "default": "after" + }, + "hasLightbox": { + "type": "boolean", + "default": "false" + }, "hasRoundedShadow": { "type": "boolean", "default": "false" diff --git a/blocks/labelled-picture/src/edit.js b/blocks/labelled-picture/src/edit.js index ddde88f..ab0b1f0 100644 --- a/blocks/labelled-picture/src/edit.js +++ b/blocks/labelled-picture/src/edit.js @@ -27,6 +27,8 @@ export default function Edit({ }) { const { hasStickyLegend, + hasLightbox, + legendLocation, hasFixedHeight, hasRoundedShadow, showTitle, @@ -76,12 +78,27 @@ export default function Edit({ function handleHasRoundedShadow(hasRoundedShadow) { setAttributes({ hasRoundedShadow }); } + function handleLegendLocationChange(legendLocation) { + setAttributes({ legendLocation }); + } + function handleHasLightbox(hasLightbox) { + setAttributes({ hasLightbox }); + } + + const renderCaption = () => ( +
+ {showTitle && pictureTitle && ( + {pictureTitle} + )}{" "} + {pictureCaption} +
+ ); return ( <> + + + + + + + {legendLocation === "before" && renderCaption()} {pictureAlt} -
- {showTitle && pictureTitle && ( - {pictureTitle} - )}{" "} - {pictureCaption} -
+ {legendLocation === "after" && renderCaption()} )} diff --git a/blocks/labelled-picture/src/save.js b/blocks/labelled-picture/src/save.js index 526f287..d31aeb2 100644 --- a/blocks/labelled-picture/src/save.js +++ b/blocks/labelled-picture/src/save.js @@ -2,8 +2,10 @@ import { useBlockProps } from "@wordpress/block-editor"; export default function save({ attributes }) { const { - hasFixedHeight, hasStickyLegend, + hasLightbox, + legendLocation, + hasFixedHeight, hasRoundedShadow, showTitle, pictureUrl, @@ -12,6 +14,15 @@ export default function save({ attributes }) { pictureCaption, } = attributes; + const renderCaption = () => ( +
+ {showTitle && pictureTitle && ( + {pictureTitle} + )}{" "} + {pictureCaption} +
+ ); + return ( <> {pictureUrl && ( @@ -29,20 +40,15 @@ export default function save({ attributes }) { ? "homegrade-blocks-labelled-picture--legend-has-title" : "" } - ${ - hasRoundedShadow - ? "homegrade-blocks-labelled-picture--rounded-shadow" - : "" - } singleLightbox-link`, + ${hasRoundedShadow ? "homegrade-blocks-labelled-picture--rounded-shadow" : ""} + + ${hasLightbox ? "singleLightbox-link" : ""} + `, })} > + {legendLocation === "before" && renderCaption()} {pictureAlt} -
- {showTitle && pictureTitle && ( - {pictureTitle} - )}{" "} - {pictureCaption} -
+ {legendLocation === "after" && renderCaption()} )}