diff --git a/blocks/content-heading/build/index.asset.php b/blocks/content-heading/build/index.asset.php index ae8e7ff..b071298 100644 --- a/blocks/content-heading/build/index.asset.php +++ b/blocks/content-heading/build/index.asset.php @@ -1 +1 @@ - array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'b49bf3cb09cfbfdc4f12'); + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '9d127840849a10578990'); diff --git a/blocks/content-heading/build/index.js b/blocks/content-heading/build/index.js index 38c953c..4f82c01 100644 --- a/blocks/content-heading/build/index.js +++ b/blocks/content-heading/build/index.js @@ -18,12 +18,19 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); -/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/@wordpress/icons/build-module/library/heading-level-3.js"); -/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/@wordpress/icons/build-module/library/heading-level-4.js"); -/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/@wordpress/icons/build-module/library/heading-level-5.js"); -/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); +/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/@wordpress/icons/build-module/library/heading-level-3.js"); +/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/@wordpress/icons/build-module/library/heading-level-4.js"); +/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/@wordpress/icons/build-module/library/heading-level-5.js"); +/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss"); + + + @@ -32,7 +39,9 @@ __webpack_require__.r(__webpack_exports__); function Edit({ attributes, - setAttributes + setAttributes, + clientId, + ...blockProps }) { const { title, @@ -43,36 +52,51 @@ function Edit({ headingLevel: newHeadingLevel }); } - 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_2__.BlockControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ToolbarGroup, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ToolbarButton, { + function insertParagraphOnEnter(e) { + const newBlock = (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_3__.createBlock)("core/paragraph", {}); + (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.dispatch)("core/block-editor").insertBlocks(newBlock, blockIndex + 1); + } + const blockIndex = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useSelect)(select => { + const { + getBlockIndex + } = select("core/block-editor"); + return getBlockIndex(clientId); + }); + 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_2__.BlockControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.ToolbarGroup, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.ToolbarButton, { isActive: headingLevel === "h3", - icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__["default"], + icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_7__["default"], onClick: () => { onChangeHeadingLevel("h3"); } - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ToolbarButton, { + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.ToolbarButton, { isActive: headingLevel === "h4", - icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__["default"], + icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_8__["default"], onClick: () => { onChangeHeadingLevel("h4"); } - }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ToolbarButton, { + }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.ToolbarButton, { isActive: headingLevel === "h5", - icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_7__["default"], + icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_9__["default"], onClick: () => { onChangeHeadingLevel("h5"); } - }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.RichText, { + }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.KeyboardShortcuts, { + shortcuts: { + enter: e => insertParagraphOnEnter(e) + } + }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.RichText, { onChange: value => setAttributes({ title: value }), value: title, + disableLineBreaks: true, placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Insérez votre titre ici", "homegrade-blocks__texte-fonctionnel"), allowedFormats: ["homegrade-format/tooltip"], tagName: headingLevel, ...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)({ className: `homegrade-blocks-custom-heading` }) - })); + }))); } /***/ }), @@ -299,6 +323,16 @@ module.exports = window["wp"]["components"]; /***/ }), +/***/ "@wordpress/data": +/*!******************************!*\ + !*** external ["wp","data"] ***! + \******************************/ +/***/ ((module) => { + +module.exports = window["wp"]["data"]; + +/***/ }), + /***/ "@wordpress/element": /*!*********************************!*\ !*** external ["wp","element"] ***! diff --git a/blocks/content-heading/build/index.js.map b/blocks/content-heading/build/index.js.map index 01d0559..00b1299 100644 --- a/blocks/content-heading/build/index.js.map +++ b/blocks/content-heading/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AAMJ;AACmC;AACW;AAExD;AAER,SAASS,IAAIA,CAAC;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAE;EAC3D,MAAM;IAAEC,KAAK;IAAEC;EAAa,CAAC,GAAGH,UAAU;EAE1C,SAASI,oBAAoBA,CAACC,eAAe,EAAE;IAC9CJ,aAAa,CAAC;MAAEE,YAAY,EAAEE;IAAgB,CAAC,CAAC;EACjD;EAEA,OACCC,iEAAA,CAAAC,wDAAA,QACCD,iEAAA,CAACb,kEAAa,QACba,iEAAA,CAACZ,+DAAY,QACZY,iEAAA,CAACX,gEAAa;IACba,QAAQ,EAAEL,YAAY,KAAK,IAAK;IAChCM,IAAI,EAAEb,wDAAc;IACpBc,OAAO,EAAEA,CAAA,KAAM;MACdN,oBAAoB,CAAC,IAAI,CAAC;IAC3B;EAAE,CACF,CAAC,EACFE,iEAAA,CAACX,gEAAa;IACba,QAAQ,EAAEL,YAAY,KAAK,IAAK;IAChCM,IAAI,EAAEZ,wDAAc;IACpBa,OAAO,EAAEA,CAAA,KAAM;MACdN,oBAAoB,CAAC,IAAI,CAAC;IAC3B;EAAE,CACF,CAAC,EACFE,iEAAA,CAACX,gEAAa;IACba,QAAQ,EAAEL,Y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;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://multiblocks/./src/edit.js","webpack://multiblocks/./src/index.js","webpack://multiblocks/./src/save.js","webpack://multiblocks/./src/editor.scss","webpack://multiblocks/./src/style.scss","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/heading-level-3.js","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/heading-level-4.js","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/heading-level-5.js","webpack://multiblocks/external window [\"wp\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"components\"]","webpack://multiblocks/external window [\"wp\",\"element\"]","webpack://multiblocks/external window [\"wp\",\"i18n\"]","webpack://multiblocks/external window [\"wp\",\"primitives\"]","webpack://multiblocks/webpack/bootstrap","webpack://multiblocks/webpack/runtime/chunk loaded","webpack://multiblocks/webpack/runtime/compat get default export","webpack://multiblocks/webpack/runtime/define property getters","webpack://multiblocks/webpack/runtime/hasOwnProperty shorthand","webpack://multiblocks/webpack/runtime/make namespace object","webpack://multiblocks/webpack/runtime/jsonp chunk loading","webpack://multiblocks/webpack/before-startup","webpack://multiblocks/webpack/startup","webpack://multiblocks/webpack/after-startup"],"sourcesContent":["import { __ } from \"@wordpress/i18n\";\n\nimport {\n\tuseBlockProps,\n\tRichText,\n\tBlockControls,\n} from \"@wordpress/block-editor\";\nimport { ToolbarGroup, ToolbarButton } from \"@wordpress/components\";\nimport { headingLevel3, headingLevel4, headingLevel5 } from \"@wordpress/icons\";\n\nimport \"./editor.scss\";\n\nexport default function Edit({ attributes, setAttributes }) {\n\tconst { title, headingLevel } = attributes;\n\n\tfunction onChangeHeadingLevel(newHeadingLevel) {\n\t\tsetAttributes({ headingLevel: newHeadingLevel });\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t {\n\t\t\t\t\t\t\tonChangeHeadingLevel(\"h3\");\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t {\n\t\t\t\t\t\t\tonChangeHeadingLevel(\"h4\");\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t {\n\t\t\t\t\t\t\tonChangeHeadingLevel(\"h5\");\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\n\t\t\t setAttributes({ title: value })}\n\t\t\t\tvalue={title}\n\t\t\t\tplaceholder={__(\n\t\t\t\t\t\"Insérez votre titre ici\",\n\t\t\t\t\t\"homegrade-blocks__texte-fonctionnel\"\n\t\t\t\t)}\n\t\t\t\tallowedFormats={[\"homegrade-format/tooltip\"]}\n\t\t\t\ttagName={headingLevel}\n\t\t\t\t{...useBlockProps({\n\t\t\t\t\tclassName: `homegrade-blocks-custom-heading`,\n\t\t\t\t})}\n\t\t\t/>\n\t\t\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\n\nimport \"./style.scss\";\n\nimport Edit from \"./edit\";\nimport save from \"./save\";\nimport metadata from \"./block.json\";\n\nregisterBlockType(metadata.name, {\n\ticon: {\n\t\tsrc: (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t),\n\t\tforeground: \"#DF1E1E\",\n\t},\n\tedit: Edit,\n\tsave,\n});\n","import { useBlockProps, RichText } from \"@wordpress/block-editor\";\n\nexport default function save({ attributes }) {\n\tconst { title, headingLevel } = attributes;\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\n\t);\n}\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst headingLevel3 = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.3 1.7c-.4-.4-1-.7-1.6-.8v-.1c.6-.2 1.1-.5 1.5-.9.3-.4.5-.8.5-1.3 0-.4-.1-.8-.3-1.1-.2-.3-.5-.6-.8-.8-.4-.2-.8-.4-1.2-.5-.6-.1-1.1-.2-1.6-.2-.6 0-1.3.1-1.8.3s-1.1.5-1.6.9l1.2 1.4c.4-.2.7-.4 1.1-.6.3-.2.7-.3 1.1-.3.4 0 .8.1 1.1.3.3.2.4.5.4.8 0 .4-.2.7-.6.9-.7.3-1.5.5-2.2.4v1.6c.5 0 1 0 1.5.1.3.1.7.2 1 .3.2.1.4.2.5.4s.1.4.1.6c0 .3-.2.7-.5.8-.4.2-.9.3-1.4.3s-1-.1-1.4-.3c-.4-.2-.8-.4-1.2-.7L13 15.6c.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.6 0 1.1-.1 1.6-.2.4-.1.9-.2 1.3-.5.4-.2.7-.5.9-.9.2-.4.3-.8.3-1.2 0-.6-.3-1.1-.7-1.5z\"\n}));\nexport default headingLevel3;\n//# sourceMappingURL=heading-level-3.js.map","import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst headingLevel4 = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M20 13V7h-3l-4 6v2h5v2h2v-2h1v-2h-1zm-2 0h-2.8L18 9v4zm-9-2H5V7H3v10h2v-4h4v4h2V7H9v4z\"\n}));\nexport default headingLevel4;\n//# sourceMappingURL=heading-level-4.js.map","import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst headingLevel5 = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.7 1.2c-.2-.3-.5-.7-.8-.9-.3-.3-.7-.5-1.1-.6-.5-.1-.9-.2-1.4-.2-.2 0-.5.1-.7.1-.2.1-.5.1-.7.2l.1-1.9h4.3V7H14l-.3 5 1 .6.5-.2.4-.1c.1-.1.3-.1.4-.1h.5c.5 0 1 .1 1.4.4.4.2.6.7.6 1.1 0 .4-.2.8-.6 1.1-.4.3-.9.4-1.4.4-.4 0-.9-.1-1.3-.3-.4-.2-.7-.4-1.1-.7 0 0-1.1 1.4-1 1.5.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.5 0 1-.1 1.5-.3s.9-.4 1.3-.7c.4-.3.7-.7.9-1.1s.3-.9.3-1.4-.1-1-.3-1.4z\"\n}));\nexport default headingLevel5;\n//# sourceMappingURL=heading-level-5.js.map","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"primitives\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkmultiblocks\"] = self[\"webpackChunkmultiblocks\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], () => (__webpack_require__(\"./src/index.js\")))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useBlockProps","RichText","BlockControls","ToolbarGroup","ToolbarButton","headingLevel3","headingLevel4","headingLevel5","Edit","attributes","setAttributes","title","headingLevel","onChangeHeadingLevel","newHeadingLevel","createElement","Fragment","isActive","icon","onClick","onChange","value","placeholder","allowedFormats","tagName","className","registerBlockType","save","metadata","name","src","xmlns","viewBox","width","height","focusable","d","foreground","edit","Content"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqC;AAMJ;AACe;AACM;AAEc;AACW;AACrB;AAEnC;AAER,SAASa,IAAIA,CAAC;EAC5BC,UAAU;EACVC,aAAa;EACbC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAE;EACF,MAAM;IAAEC,KAAK;IAAEC;EAAa,CAAC,GAAGL,UAAU;EAE1C,SAASM,oBAAoBA,CAACC,eAAe,EAAE;IAC9CN,aAAa,CAAC;MAAEI,YAAY,EAAEE;IAAgB,CAAC,CAAC;EACjD;EACA,SAASC,sBAAsBA,CAACC,CAAC,EAAE;IAClC,MAAMC,QAAQ,GAAGpB,8DAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;IAClDC,yDAAQ,CAAC,mBAAmB,CAAC,CAACoB,YAAY,CAACD,QAAQ,EAAEE,UAAU,GAAG,CAAC,CAAC;EACrE;EACA,MAAMA,UAAU,GAAGpB,0DAAS,CAAEqB,MAAM,IAAK;IACxC,MAAM;MAAEC;IAAc,CAAC,GAAGD,MAAM,CAAC,mBAAmB,CAAC;IACrD,OAAOC,aAAa,CAACZ,QAAQ,CAAC;EAC/B,CAAC,CAAC;EAEF,OACCa,iEAAA,CAAAC,wDAAA,QACCD,iEAAA,CAAC1B,kEAAa,QACb0B,iEAAA,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AAe,aAAa,EAAC;AAC7B;;;;;;;;;;ACbA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;UAEA;UACA;;;;;WCzBA;WACA;WACA;WACA;WACA,+BAA+B,wCAAwC;WACvE;WACA;WACA;WACA;WACA,iBAAiB,qBAAqB;WACtC;WACA;WACA;WACA;WACA,kBAAkB,qBAAqB;WACvC;WACA;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC7BA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEnDA;UACA;UACA;UACA;UACA","sources":["webpack://multiblocks/./src/edit.js","webpack://multiblocks/./src/index.js","webpack://multiblocks/./src/save.js","webpack://multiblocks/./src/editor.scss","webpack://multiblocks/./src/style.scss","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/heading-level-3.js","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/heading-level-4.js","webpack://multiblocks/../../node_modules/@wordpress/icons/build-module/library/heading-level-5.js","webpack://multiblocks/external window [\"wp\",\"blockEditor\"]","webpack://multiblocks/external window [\"wp\",\"blocks\"]","webpack://multiblocks/external window [\"wp\",\"components\"]","webpack://multiblocks/external window [\"wp\",\"data\"]","webpack://multiblocks/external window [\"wp\",\"element\"]","webpack://multiblocks/external window [\"wp\",\"i18n\"]","webpack://multiblocks/external window [\"wp\",\"primitives\"]","webpack://multiblocks/webpack/bootstrap","webpack://multiblocks/webpack/runtime/chunk loaded","webpack://multiblocks/webpack/runtime/compat get default export","webpack://multiblocks/webpack/runtime/define property getters","webpack://multiblocks/webpack/runtime/hasOwnProperty shorthand","webpack://multiblocks/webpack/runtime/make namespace object","webpack://multiblocks/webpack/runtime/jsonp chunk loading","webpack://multiblocks/webpack/before-startup","webpack://multiblocks/webpack/startup","webpack://multiblocks/webpack/after-startup"],"sourcesContent":["import { __ } from \"@wordpress/i18n\";\n\nimport {\n\tuseBlockProps,\n\tRichText,\n\tBlockControls,\n} from \"@wordpress/block-editor\";\nimport { createBlock } from \"@wordpress/blocks\";\nimport { dispatch, useSelect } from \"@wordpress/data\";\n\nimport { ToolbarGroup, ToolbarButton } from \"@wordpress/components\";\nimport { headingLevel3, headingLevel4, headingLevel5 } from \"@wordpress/icons\";\nimport { KeyboardShortcuts } from \"@wordpress/components\";\n\nimport \"./editor.scss\";\n\nexport default function Edit({\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\t...blockProps\n}) {\n\tconst { title, headingLevel } = attributes;\n\n\tfunction onChangeHeadingLevel(newHeadingLevel) {\n\t\tsetAttributes({ headingLevel: newHeadingLevel });\n\t}\n\tfunction insertParagraphOnEnter(e) {\n\t\tconst newBlock = createBlock(\"core/paragraph\", {});\n\t\tdispatch(\"core/block-editor\").insertBlocks(newBlock, blockIndex + 1);\n\t}\n\tconst blockIndex = useSelect((select) => {\n\t\tconst { getBlockIndex } = select(\"core/block-editor\");\n\t\treturn getBlockIndex(clientId);\n\t});\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t {\n\t\t\t\t\t\t\tonChangeHeadingLevel(\"h3\");\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t {\n\t\t\t\t\t\t\tonChangeHeadingLevel(\"h4\");\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t {\n\t\t\t\t\t\t\tonChangeHeadingLevel(\"h5\");\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\t\t\t insertParagraphOnEnter(e),\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t setAttributes({ title: value })}\n\t\t\t\t\tvalue={title}\n\t\t\t\t\tdisableLineBreaks\n\t\t\t\t\tplaceholder={__(\n\t\t\t\t\t\t\"Insérez votre titre ici\",\n\t\t\t\t\t\t\"homegrade-blocks__texte-fonctionnel\"\n\t\t\t\t\t)}\n\t\t\t\t\tallowedFormats={[\"homegrade-format/tooltip\"]}\n\t\t\t\t\ttagName={headingLevel}\n\t\t\t\t\t{...useBlockProps({\n\t\t\t\t\t\tclassName: `homegrade-blocks-custom-heading`,\n\t\t\t\t\t})}\n\t\t\t\t/>\n\t\t\t\n\t\t\n\t);\n}\n","import { registerBlockType } from \"@wordpress/blocks\";\n\nimport \"./style.scss\";\n\nimport Edit from \"./edit\";\nimport save from \"./save\";\nimport metadata from \"./block.json\";\n\nregisterBlockType(metadata.name, {\n\ticon: {\n\t\tsrc: (\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t),\n\t\tforeground: \"#DF1E1E\",\n\t},\n\tedit: Edit,\n\tsave,\n});\n","import { useBlockProps, RichText } from \"@wordpress/block-editor\";\n\nexport default function save({ attributes }) {\n\tconst { title, headingLevel } = attributes;\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\n\t);\n}\n","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst headingLevel3 = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.3 1.7c-.4-.4-1-.7-1.6-.8v-.1c.6-.2 1.1-.5 1.5-.9.3-.4.5-.8.5-1.3 0-.4-.1-.8-.3-1.1-.2-.3-.5-.6-.8-.8-.4-.2-.8-.4-1.2-.5-.6-.1-1.1-.2-1.6-.2-.6 0-1.3.1-1.8.3s-1.1.5-1.6.9l1.2 1.4c.4-.2.7-.4 1.1-.6.3-.2.7-.3 1.1-.3.4 0 .8.1 1.1.3.3.2.4.5.4.8 0 .4-.2.7-.6.9-.7.3-1.5.5-2.2.4v1.6c.5 0 1 0 1.5.1.3.1.7.2 1 .3.2.1.4.2.5.4s.1.4.1.6c0 .3-.2.7-.5.8-.4.2-.9.3-1.4.3s-1-.1-1.4-.3c-.4-.2-.8-.4-1.2-.7L13 15.6c.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.6 0 1.1-.1 1.6-.2.4-.1.9-.2 1.3-.5.4-.2.7-.5.9-.9.2-.4.3-.8.3-1.2 0-.6-.3-1.1-.7-1.5z\"\n}));\nexport default headingLevel3;\n//# sourceMappingURL=heading-level-3.js.map","import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst headingLevel4 = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M20 13V7h-3l-4 6v2h5v2h2v-2h1v-2h-1zm-2 0h-2.8L18 9v4zm-9-2H5V7H3v10h2v-4h4v4h2V7H9v4z\"\n}));\nexport default headingLevel4;\n//# sourceMappingURL=heading-level-4.js.map","import { createElement } from \"@wordpress/element\";\n\n/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nconst headingLevel5 = createElement(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\"\n}, createElement(Path, {\n d: \"M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.7 1.2c-.2-.3-.5-.7-.8-.9-.3-.3-.7-.5-1.1-.6-.5-.1-.9-.2-1.4-.2-.2 0-.5.1-.7.1-.2.1-.5.1-.7.2l.1-1.9h4.3V7H14l-.3 5 1 .6.5-.2.4-.1c.1-.1.3-.1.4-.1h.5c.5 0 1 .1 1.4.4.4.2.6.7.6 1.1 0 .4-.2.8-.6 1.1-.4.3-.9.4-1.4.4-.4 0-.9-.1-1.3-.3-.4-.2-.7-.4-1.1-.7 0 0-1.1 1.4-1 1.5.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.5 0 1-.1 1.5-.3s.9-.4 1.3-.7c.4-.3.7-.7.9-1.1s.3-.9.3-1.4-.1-1-.3-1.4z\"\n}));\nexport default headingLevel5;\n//# sourceMappingURL=heading-level-5.js.map","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"blocks\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"primitives\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"index\": 0,\n\t\"./style-index\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkmultiblocks\"] = self[\"webpackChunkmultiblocks\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"./style-index\"], () => (__webpack_require__(\"./src/index.js\")))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":["__","useBlockProps","RichText","BlockControls","createBlock","dispatch","useSelect","ToolbarGroup","ToolbarButton","headingLevel3","headingLevel4","headingLevel5","KeyboardShortcuts","Edit","attributes","setAttributes","clientId","blockProps","title","headingLevel","onChangeHeadingLevel","newHeadingLevel","insertParagraphOnEnter","e","newBlock","insertBlocks","blockIndex","select","getBlockIndex","createElement","Fragment","isActive","icon","onClick","shortcuts","enter","onChange","value","disableLineBreaks","placeholder","allowedFormats","tagName","className","registerBlockType","save","metadata","name","src","xmlns","viewBox","width","height","focusable","d","foreground","edit","Content"],"sourceRoot":""} \ No newline at end of file diff --git a/blocks/content-heading/src/edit.js b/blocks/content-heading/src/edit.js index afb1149..91fa9fe 100644 --- a/blocks/content-heading/src/edit.js +++ b/blocks/content-heading/src/edit.js @@ -5,17 +5,34 @@ import { RichText, BlockControls, } from "@wordpress/block-editor"; +import { createBlock } from "@wordpress/blocks"; +import { dispatch, useSelect } from "@wordpress/data"; + import { ToolbarGroup, ToolbarButton } from "@wordpress/components"; import { headingLevel3, headingLevel4, headingLevel5 } from "@wordpress/icons"; +import { KeyboardShortcuts } from "@wordpress/components"; import "./editor.scss"; -export default function Edit({ attributes, setAttributes }) { +export default function Edit({ + attributes, + setAttributes, + clientId, + ...blockProps +}) { const { title, headingLevel } = attributes; function onChangeHeadingLevel(newHeadingLevel) { setAttributes({ headingLevel: newHeadingLevel }); } + function insertParagraphOnEnter(e) { + const newBlock = createBlock("core/paragraph", {}); + dispatch("core/block-editor").insertBlocks(newBlock, blockIndex + 1); + } + const blockIndex = useSelect((select) => { + const { getBlockIndex } = select("core/block-editor"); + return getBlockIndex(clientId); + }); return ( <> @@ -44,20 +61,26 @@ export default function Edit({ attributes, setAttributes }) { /> - - setAttributes({ title: value })} - value={title} - placeholder={__( - "Insérez votre titre ici", - "homegrade-blocks__texte-fonctionnel" - )} - allowedFormats={["homegrade-format/tooltip"]} - tagName={headingLevel} - {...useBlockProps({ - className: `homegrade-blocks-custom-heading`, - })} - /> + insertParagraphOnEnter(e), + }} + > + setAttributes({ title: value })} + value={title} + disableLineBreaks + placeholder={__( + "Insérez votre titre ici", + "homegrade-blocks__texte-fonctionnel" + )} + allowedFormats={["homegrade-format/tooltip"]} + tagName={headingLevel} + {...useBlockProps({ + className: `homegrade-blocks-custom-heading`, + })} + /> + ); }