handling deprecation
This commit is contained in:
parent
105ad0a612
commit
aa56bc7bc0
|
|
@ -14,12 +14,6 @@
|
||||||
"editorStyle": "file:./index.css",
|
"editorStyle": "file:./index.css",
|
||||||
"style": "file:./style-index.css",
|
"style": "file:./style-index.css",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"sectionTitle": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"sectionSubtitle": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"textAlign": {
|
"textAlign": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "left"
|
"default": "left"
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'a530ef6e4b300fa39187');
|
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '532929bbc982cc64e979');
|
||||||
|
|
|
||||||
|
|
@ -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/.pnpm/css-loader@6.10.0_webpack@5.90.3/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.4.35_webpack@5.90.3/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@12.6.0_sass@1.71.1_webpack@5.90.3/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***!
|
||||||
\****************************************************************************************************************************************************************************************************************************************/
|
\***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
|
||||||
.homegrade-blocks-staff-list .homegrade-blocks-staff-list__staff-list {
|
.homegrade-blocks-staff-list .homegrade-blocks-staff-list__staff-list {
|
||||||
display: unset;
|
display: unset;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,105 @@
|
||||||
/******/ "use strict";
|
/******/ "use strict";
|
||||||
/******/ var __webpack_modules__ = ({
|
/******/ var __webpack_modules__ = ({
|
||||||
|
|
||||||
|
/***/ "./src/deprecated.js":
|
||||||
|
/*!***************************!*\
|
||||||
|
!*** ./src/deprecated.js ***!
|
||||||
|
\***************************/
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
__webpack_require__.r(__webpack_exports__);
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
||||||
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
||||||
|
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
|
||||||
|
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
|
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
|
||||||
|
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const v2 = {
|
||||||
|
attributes: {
|
||||||
|
sectionTitle: {
|
||||||
|
type: "string"
|
||||||
|
},
|
||||||
|
sectionSubtitle: {
|
||||||
|
type: "string"
|
||||||
|
},
|
||||||
|
textAlign: {
|
||||||
|
type: "string",
|
||||||
|
default: "left"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
save({
|
||||||
|
attributes
|
||||||
|
}) {
|
||||||
|
return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||||
|
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
||||||
|
className: `section_titling section_titling--${attributes.textAlign}`
|
||||||
|
})
|
||||||
|
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, {
|
||||||
|
value: attributes.sectionTitle,
|
||||||
|
tagName: "h3",
|
||||||
|
className: "section_titling__title"
|
||||||
|
}), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, {
|
||||||
|
value: attributes.sectionSubtitle,
|
||||||
|
tagName: "p",
|
||||||
|
className: "section_titling__subtitle"
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
migrate(attributes, innerBlocks) {
|
||||||
|
const textAlign = attributes.textAlign;
|
||||||
|
return [{
|
||||||
|
textAlign: textAlign
|
||||||
|
}, [(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__.createBlock)("core/heading", {
|
||||||
|
content: attributes.sectionTitle,
|
||||||
|
level: 3,
|
||||||
|
className: "section_titling__title"
|
||||||
|
}), (0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_2__.createBlock)("core/paragraph", {
|
||||||
|
content: attributes.sectionSubtitle,
|
||||||
|
className: "section_titling__subtitle"
|
||||||
|
})]];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const v1 = {
|
||||||
|
attributes: {
|
||||||
|
sectionTitle: {
|
||||||
|
type: "string"
|
||||||
|
},
|
||||||
|
sectionSubtitle: {
|
||||||
|
type: "string"
|
||||||
|
},
|
||||||
|
textAlign: {
|
||||||
|
type: "string",
|
||||||
|
default: "left"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
save({
|
||||||
|
attributes
|
||||||
|
}) {
|
||||||
|
return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||||
|
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
||||||
|
className: `section_titling section_titling--${textAlign}`
|
||||||
|
})
|
||||||
|
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, {
|
||||||
|
value: sectionTitle,
|
||||||
|
tagName: "h3",
|
||||||
|
className: "section_titling__title"
|
||||||
|
}), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, {
|
||||||
|
value: sectionSubtitle,
|
||||||
|
tagName: "p",
|
||||||
|
className: "section_titling__subtitle"
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ([v2, v1]);
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ "./src/edit.js":
|
/***/ "./src/edit.js":
|
||||||
/*!*********************!*\
|
/*!*********************!*\
|
||||||
!*** ./src/edit.js ***!
|
!*** ./src/edit.js ***!
|
||||||
|
|
@ -12,8 +111,8 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
/* harmony export */ "default": () => (/* binding */ Edit)
|
/* harmony export */ "default": () => (/* binding */ Edit)
|
||||||
/* harmony export */ });
|
/* harmony export */ });
|
||||||
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
||||||
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
||||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
||||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
|
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss");
|
/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss");
|
||||||
|
|
@ -37,28 +136,17 @@ function Edit({
|
||||||
clientId
|
clientId
|
||||||
}) {
|
}) {
|
||||||
let {
|
let {
|
||||||
sectionTitle,
|
|
||||||
sectionSubtitle,
|
|
||||||
textAlign
|
textAlign
|
||||||
} = attributes;
|
} = attributes;
|
||||||
function onChangeSectionTitle(sectionTitle) {
|
console.log("attributes", attributes);
|
||||||
setAttributes({
|
|
||||||
sectionTitle
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function onChangeSectionSubtitle(sectionSubtitle) {
|
|
||||||
setAttributes({
|
|
||||||
sectionSubtitle
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function onChangeTextAlignment(textAlign) {
|
function onChangeTextAlignment(textAlign) {
|
||||||
setAttributes({
|
setAttributes({
|
||||||
textAlign
|
textAlign
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.BlockControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.Toolbar, {
|
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__.BlockControls, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.Toolbar, {
|
||||||
label: "Options"
|
label: "Options"
|
||||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToolbarDropdownMenu, {
|
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.ToolbarDropdownMenu, {
|
||||||
icon: textAlign === "left" ? _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__["default"] : textAlign === "center" ? _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__["default"] : _wordpress_icons__WEBPACK_IMPORTED_MODULE_7__["default"],
|
icon: textAlign === "left" ? _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__["default"] : textAlign === "center" ? _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__["default"] : _wordpress_icons__WEBPACK_IMPORTED_MODULE_7__["default"],
|
||||||
label: "Alignement du titrage",
|
label: "Alignement du titrage",
|
||||||
controls: [{
|
controls: [{
|
||||||
|
|
@ -74,22 +162,20 @@ function Edit({
|
||||||
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_7__["default"],
|
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_7__["default"],
|
||||||
onClick: () => onChangeTextAlignment("right")
|
onClick: () => onChangeTextAlignment("right")
|
||||||
}]
|
}]
|
||||||
}))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
}))), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||||
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)({
|
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)({
|
||||||
className: `section_titling section_titling--${textAlign}`
|
className: `section_titling section_titling--${textAlign}`
|
||||||
})
|
})
|
||||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, {
|
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InnerBlocks, {
|
||||||
value: sectionTitle,
|
allowedBlocks: ["core/paragraph", "core/list", "core/heading"],
|
||||||
tagName: "h3",
|
templateLock: "contentOnly",
|
||||||
className: "section_titling__title",
|
template: [["core/heading", {
|
||||||
placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Ajouter ici le Titre de Section", "homegrade-blocks__texte-backoffice"),
|
placeholder: "Titre de section",
|
||||||
onChange: onChangeSectionTitle
|
level: 3,
|
||||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, {
|
className: "section_titling__title"
|
||||||
value: sectionSubtitle,
|
}], ["core/paragraph", {
|
||||||
tagName: "p",
|
className: "section_titling__subtitle"
|
||||||
className: "section_titling__subtitle",
|
}]]
|
||||||
placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Ajouter ici le Sous-titre", "homegrade"),
|
|
||||||
onChange: onChangeSectionSubtitle
|
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,21 +193,24 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss");
|
/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss");
|
||||||
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/edit.js");
|
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/edit.js");
|
||||||
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/save.js");
|
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/save.js");
|
||||||
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/block.json");
|
/* harmony import */ var _deprecated__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./deprecated */ "./src/deprecated.js");
|
||||||
/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/@wordpress/icons/build-module/library/header.js");
|
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./block.json */ "./src/block.json");
|
||||||
|
/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/icons */ "../../node_modules/@wordpress/icons/build-module/library/header.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, {
|
|
||||||
|
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_5__.name, {
|
||||||
icon: {
|
icon: {
|
||||||
src: _wordpress_icons__WEBPACK_IMPORTED_MODULE_5__["default"],
|
src: _wordpress_icons__WEBPACK_IMPORTED_MODULE_6__["default"],
|
||||||
foreground: "#DF1E1E"
|
foreground: "#DF1E1E"
|
||||||
},
|
},
|
||||||
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"],
|
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"],
|
||||||
save: _save__WEBPACK_IMPORTED_MODULE_3__["default"]
|
save: _save__WEBPACK_IMPORTED_MODULE_3__["default"],
|
||||||
|
deprecated: _deprecated__WEBPACK_IMPORTED_MODULE_4__["default"]
|
||||||
});
|
});
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
@ -136,8 +225,8 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
/* harmony export */ "default": () => (/* binding */ save)
|
/* harmony export */ "default": () => (/* binding */ save)
|
||||||
/* harmony export */ });
|
/* harmony export */ });
|
||||||
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
||||||
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
||||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
|
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
|
||||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__);
|
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
|
|
||||||
|
|
@ -145,24 +234,16 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
function save({
|
function save({
|
||||||
attributes
|
attributes
|
||||||
}) {
|
}) {
|
||||||
let {
|
const {
|
||||||
sectionTitle,
|
sectionTitle,
|
||||||
sectionSubtitle,
|
sectionSubtitle,
|
||||||
textAlign
|
textAlign
|
||||||
} = attributes;
|
} = attributes;
|
||||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||||
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
||||||
className: `section_titling section_titling--${textAlign}`
|
className: `section_titling section_titling--${textAlign}`
|
||||||
})
|
})
|
||||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, {
|
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks.Content, null));
|
||||||
value: sectionTitle,
|
|
||||||
tagName: "h3",
|
|
||||||
className: "section_titling__title"
|
|
||||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, {
|
|
||||||
value: sectionSubtitle,
|
|
||||||
tagName: "p",
|
|
||||||
className: "section_titling__subtitle"
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
@ -315,6 +396,16 @@ const positionRight = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createE
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "react":
|
||||||
|
/*!************************!*\
|
||||||
|
!*** external "React" ***!
|
||||||
|
\************************/
|
||||||
|
/***/ ((module) => {
|
||||||
|
|
||||||
|
module.exports = window["React"];
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ "@wordpress/block-editor":
|
/***/ "@wordpress/block-editor":
|
||||||
/*!*************************************!*\
|
/*!*************************************!*\
|
||||||
!*** external ["wp","blockEditor"] ***!
|
!*** external ["wp","blockEditor"] ***!
|
||||||
|
|
@ -381,7 +472,7 @@ module.exports = window["wp"]["primitives"];
|
||||||
\************************/
|
\************************/
|
||||||
/***/ ((module) => {
|
/***/ ((module) => {
|
||||||
|
|
||||||
module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/section-titling","version":"0.1.0","title":"Titre de section","category":"homegrade-blocks","description":"Pour insérer un bloc de titrage (dans une grey-box ou une white-box) ","supports":{"html":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"sectionTitle":{"type":"string"},"sectionSubtitle":{"type":"string"},"textAlign":{"type":"string","default":"left"}}}');
|
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/section-titling","version":"0.1.0","title":"Titre de section","category":"homegrade-blocks","description":"Pour insérer un bloc de titrage (dans une grey-box ou une white-box) ","supports":{"html":false},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"textAlign":{"type":"string","default":"left"}}}');
|
||||||
|
|
||||||
/***/ })
|
/***/ })
|
||||||
|
|
||||||
|
|
@ -427,9 +518,7 @@ module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/ var notFulfilled = Infinity;
|
/******/ var notFulfilled = Infinity;
|
||||||
/******/ for (var i = 0; i < deferred.length; i++) {
|
/******/ for (var i = 0; i < deferred.length; i++) {
|
||||||
/******/ var chunkIds = deferred[i][0];
|
/******/ var [chunkIds, fn, priority] = deferred[i];
|
||||||
/******/ var fn = deferred[i][1];
|
|
||||||
/******/ var priority = deferred[i][2];
|
|
||||||
/******/ var fulfilled = true;
|
/******/ var fulfilled = true;
|
||||||
/******/ for (var j = 0; j < chunkIds.length; j++) {
|
/******/ for (var j = 0; j < chunkIds.length; j++) {
|
||||||
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
|
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
|
||||||
|
|
@ -515,9 +604,7 @@ module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json
|
||||||
/******/
|
/******/
|
||||||
/******/ // install a JSONP callback for chunk loading
|
/******/ // install a JSONP callback for chunk loading
|
||||||
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
||||||
/******/ var chunkIds = data[0];
|
/******/ var [chunkIds, moreModules, runtime] = data;
|
||||||
/******/ var moreModules = data[1];
|
|
||||||
/******/ var runtime = data[2];
|
|
||||||
/******/ // add "moreModules" to the modules object,
|
/******/ // add "moreModules" to the modules object,
|
||||||
/******/ // then flag all "chunkIds" as loaded and fire callback
|
/******/ // then flag all "chunkIds" as loaded and fire callback
|
||||||
/******/ var moduleId, chunkId, i = 0;
|
/******/ var moduleId, chunkId, i = 0;
|
||||||
|
|
@ -540,7 +627,7 @@ module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json
|
||||||
/******/ return __webpack_require__.O(result);
|
/******/ return __webpack_require__.O(result);
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/
|
/******/
|
||||||
/******/ var chunkLoadingGlobal = self["webpackChunkmultiblocks"] = self["webpackChunkmultiblocks"] || [];
|
/******/ var chunkLoadingGlobal = globalThis["webpackChunkmultiblocks"] = globalThis["webpackChunkmultiblocks"] || [];
|
||||||
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
||||||
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
||||||
/******/ })();
|
/******/ })();
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
||||||
/*!***************************************************************************************************************************************************************************************************************************************!*\
|
/*!**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
|
||||||
!*** 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/.pnpm/css-loader@6.10.0_webpack@5.90.3/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.4.35_webpack@5.90.3/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@12.6.0_sass@1.71.1_webpack@5.90.3/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***!
|
||||||
\***************************************************************************************************************************************************************************************************************************************/
|
\**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
|
||||||
|
|
||||||
|
|
|
||||||
24
blocks/section-titling/src/_save.js
Normal file
24
blocks/section-titling/src/_save.js
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { useBlockProps, RichText } from "@wordpress/block-editor";
|
||||||
|
|
||||||
|
export default function save({ attributes }) {
|
||||||
|
let { sectionTitle, sectionSubtitle, textAlign } = attributes;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
{...useBlockProps.save({
|
||||||
|
className: `section_titling section_titling--${textAlign}`,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<RichText.Content
|
||||||
|
value={sectionTitle}
|
||||||
|
tagName="h3"
|
||||||
|
className="section_titling__title"
|
||||||
|
/>
|
||||||
|
<RichText.Content
|
||||||
|
value={sectionSubtitle}
|
||||||
|
tagName="p"
|
||||||
|
className="section_titling__subtitle"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -14,12 +14,6 @@
|
||||||
"editorStyle": "file:./index.css",
|
"editorStyle": "file:./index.css",
|
||||||
"style": "file:./style-index.css",
|
"style": "file:./style-index.css",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"sectionTitle": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"sectionSubtitle": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"textAlign": {
|
"textAlign": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "left"
|
"default": "left"
|
||||||
|
|
|
||||||
97
blocks/section-titling/src/deprecated.js
Normal file
97
blocks/section-titling/src/deprecated.js
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
import { useBlockProps } from "@wordpress/block-editor";
|
||||||
|
import { RichText } from "@wordpress/block-editor";
|
||||||
|
import { createBlock } from "@wordpress/blocks";
|
||||||
|
|
||||||
|
const v2 = {
|
||||||
|
attributes: {
|
||||||
|
sectionTitle: {
|
||||||
|
type: "string",
|
||||||
|
},
|
||||||
|
sectionSubtitle: {
|
||||||
|
type: "string",
|
||||||
|
},
|
||||||
|
textAlign: {
|
||||||
|
type: "string",
|
||||||
|
default: "left",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
save({ attributes }) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
{...useBlockProps.save({
|
||||||
|
className: `section_titling section_titling--${attributes.textAlign}`,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<RichText.Content
|
||||||
|
value={attributes.sectionTitle}
|
||||||
|
tagName="h3"
|
||||||
|
className="section_titling__title"
|
||||||
|
/>
|
||||||
|
<RichText.Content
|
||||||
|
value={attributes.sectionSubtitle}
|
||||||
|
tagName="p"
|
||||||
|
className="section_titling__subtitle"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
migrate(attributes, innerBlocks) {
|
||||||
|
const textAlign = attributes.textAlign;
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
textAlign: textAlign,
|
||||||
|
},
|
||||||
|
[
|
||||||
|
createBlock("core/heading", {
|
||||||
|
content: attributes.sectionTitle,
|
||||||
|
level: 3,
|
||||||
|
className: "section_titling__title",
|
||||||
|
}),
|
||||||
|
createBlock("core/paragraph", {
|
||||||
|
content: attributes.sectionSubtitle,
|
||||||
|
className: "section_titling__subtitle",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const v1 = {
|
||||||
|
attributes: {
|
||||||
|
sectionTitle: {
|
||||||
|
type: "string",
|
||||||
|
},
|
||||||
|
sectionSubtitle: {
|
||||||
|
type: "string",
|
||||||
|
},
|
||||||
|
textAlign: {
|
||||||
|
type: "string",
|
||||||
|
default: "left",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
save({ attributes }) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
{...useBlockProps.save({
|
||||||
|
className: `section_titling section_titling--${textAlign}`,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<RichText.Content
|
||||||
|
value={sectionTitle}
|
||||||
|
tagName="h3"
|
||||||
|
className="section_titling__title"
|
||||||
|
/>
|
||||||
|
<RichText.Content
|
||||||
|
value={sectionSubtitle}
|
||||||
|
tagName="p"
|
||||||
|
className="section_titling__subtitle"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default [v2, v1];
|
||||||
|
|
@ -1,19 +1,14 @@
|
||||||
import { __ } from "@wordpress/i18n";
|
import { __ } from "@wordpress/i18n";
|
||||||
import "./editor.scss";
|
import "./editor.scss";
|
||||||
import { BlockControls } from "@wordpress/block-editor";
|
import { BlockControls } from "@wordpress/block-editor";
|
||||||
import { useBlockProps, RichText } from "@wordpress/block-editor";
|
import { useBlockProps, RichText, InnerBlocks } from "@wordpress/block-editor";
|
||||||
import { Toolbar, ToolbarDropdownMenu } from "@wordpress/components";
|
import { Toolbar, ToolbarDropdownMenu } from "@wordpress/components";
|
||||||
import { positionLeft, positionCenter, positionRight } from "@wordpress/icons";
|
import { positionLeft, positionCenter, positionRight } from "@wordpress/icons";
|
||||||
|
|
||||||
export default function Edit({ attributes, setAttributes, clientId }) {
|
export default function Edit({ attributes, setAttributes, clientId }) {
|
||||||
let { sectionTitle, sectionSubtitle, textAlign } = attributes;
|
let { textAlign } = attributes;
|
||||||
|
|
||||||
function onChangeSectionTitle(sectionTitle) {
|
console.log("attributes", attributes);
|
||||||
setAttributes({ sectionTitle });
|
|
||||||
}
|
|
||||||
function onChangeSectionSubtitle(sectionSubtitle) {
|
|
||||||
setAttributes({ sectionSubtitle });
|
|
||||||
}
|
|
||||||
|
|
||||||
function onChangeTextAlignment(textAlign) {
|
function onChangeTextAlignment(textAlign) {
|
||||||
setAttributes({ textAlign });
|
setAttributes({ textAlign });
|
||||||
|
|
@ -57,22 +52,20 @@ export default function Edit({ attributes, setAttributes, clientId }) {
|
||||||
className: `section_titling section_titling--${textAlign}`,
|
className: `section_titling section_titling--${textAlign}`,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<RichText
|
<InnerBlocks
|
||||||
value={sectionTitle}
|
allowedBlocks={["core/paragraph", "core/list", "core/heading"]}
|
||||||
tagName="h3"
|
templateLock="contentOnly"
|
||||||
className="section_titling__title"
|
template={[
|
||||||
placeholder={__(
|
[
|
||||||
"Ajouter ici le Titre de Section",
|
"core/heading",
|
||||||
"homegrade-blocks"
|
{
|
||||||
)}
|
placeholder: "Titre de section",
|
||||||
onChange={onChangeSectionTitle}
|
level: 3,
|
||||||
/>
|
className: "section_titling__title",
|
||||||
<RichText
|
},
|
||||||
value={sectionSubtitle}
|
],
|
||||||
tagName="p"
|
["core/paragraph", { className: "section_titling__subtitle" }],
|
||||||
className="section_titling__subtitle"
|
]}
|
||||||
placeholder={__("Ajouter ici le Sous-titre", "homegrade-blocks")}
|
|
||||||
onChange={onChangeSectionSubtitle}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import "./style.scss";
|
||||||
|
|
||||||
import Edit from "./edit";
|
import Edit from "./edit";
|
||||||
import save from "./save";
|
import save from "./save";
|
||||||
|
import deprecated from "./deprecated";
|
||||||
import metadata from "./block.json";
|
import metadata from "./block.json";
|
||||||
|
|
||||||
import { header } from "@wordpress/icons";
|
import { header } from "@wordpress/icons";
|
||||||
|
|
@ -14,4 +15,5 @@ registerBlockType(metadata.name, {
|
||||||
},
|
},
|
||||||
edit: Edit,
|
edit: Edit,
|
||||||
save,
|
save,
|
||||||
|
deprecated,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { useBlockProps, RichText } from "@wordpress/block-editor";
|
import { useBlockProps, RichText, InnerBlocks } from "@wordpress/block-editor";
|
||||||
|
|
||||||
export default function save({ attributes }) {
|
export default function save({ attributes }) {
|
||||||
let { sectionTitle, sectionSubtitle, textAlign } = attributes;
|
const { sectionTitle, sectionSubtitle, textAlign } = attributes;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
@ -9,16 +9,7 @@ export default function save({ attributes }) {
|
||||||
className: `section_titling section_titling--${textAlign}`,
|
className: `section_titling section_titling--${textAlign}`,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<RichText.Content
|
<InnerBlocks.Content />
|
||||||
value={sectionTitle}
|
|
||||||
tagName="h3"
|
|
||||||
className="section_titling__title"
|
|
||||||
/>
|
|
||||||
<RichText.Content
|
|
||||||
value={sectionSubtitle}
|
|
||||||
tagName="p"
|
|
||||||
className="section_titling__subtitle"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user