setting up an independant monoblock block to be used in different block modules

This commit is contained in:
Antoine M 2023-10-19 17:24:27 +02:00
parent 0695af78d3
commit 0cfe209915
25 changed files with 28876 additions and 0 deletions

View File

@ -0,0 +1,20 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "homegrade-content-blocks/box-monoblock",
"version": "0.1.0",
"title": "Monobloc",
"category": "homegrade-blocks",
"description": "Bloc conteneur d'une seule colonne",
"supports": {
"html": false
},
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"attributes": {
"childName": {
"type": "string"
}
}
}

View File

@ -0,0 +1,25 @@
import { __ } from "@wordpress/i18n";
import "./editor.scss";
import { useBlockProps, RichText } from "@wordpress/block-editor";
import { InnerBlocks } from "@wordpress/block-editor";
export default function Edit({ attributes, setAttributes, ...props }) {
let { childName } = attributes;
function onChangeChildName(childName) {
setAttributes({ childName });
}
return (
<>
<div
{...useBlockProps({
className: `box-monoblock card-large-content`,
})}
>
<InnerBlocks allowedBlocks={["core/paragraph"]} />
</div>
</>
);
}

View File

@ -0,0 +1 @@
// THE STYLE IS HANDLED IN PARENT BLOCK (timeline)

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="mascotte" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 60 60">
<defs>
<style>
.cls-1 {
fill: url(#Dégradé_sans_nom_3);
}
.cls-1, .cls-2 {
stroke-width: 0px;
}
.cls-3 {
fill: #fff;
stroke: #000;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 2px;
}
.cls-2 {
fill: url(#Dégradé_sans_nom_3-2);
}
</style>
<linearGradient id="Dégradé_sans_nom_3" data-name="Dégradé sans nom 3" x1="-2280.28" y1="80.03" x2="-2279.29" y2="78.98" gradientTransform="translate(6033.72 622.47) scale(2.63 -7.44)" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#f3281d"/>
<stop offset="1" stop-color="#fe766f"/>
</linearGradient>
<linearGradient id="Dégradé_sans_nom_3-2" data-name="Dégradé sans nom 3" x1="-2276.06" y1="80.02" x2="-2275.06" y2="78.97" gradientTransform="translate(6009.38 619.45) scale(2.62 -7.44)" xlink:href="#Dégradé_sans_nom_3"/>
</defs>
<g id="Groupe_5862" data-name="Groupe 5862">
<g id="Groupe_3195" data-name="Groupe 3195">
<g id="Groupe_de_masques_1" data-name="Groupe de masques 1">
<g id="Groupe_5593" data-name="Groupe 5593">
<g id="Groupe_5595" data-name="Groupe 5595">
<g id="Groupe_5594" data-name="Groupe 5594">
<path id="Tracé_23844" data-name="Tracé 23844" class="cls-3" d="m12.46,54.29c.34-1.09.82-2.53,1.49-4.18,0,0,.36-.88.77-1.79,1.62-3.6,5.34-9.45,5.6-9.85l18.98-6.94.29,7.22c2.01,1.44,3.72,3.25,5.03,5.34,1,1.61,1.76,3.35,2.25,5.18.42,1.65.64,3.34.66,5.03"/>
</g>
</g>
<g id="Groupe_5596" data-name="Groupe 5596">
<path id="Tracé_23846" data-name="Tracé 23846" class="cls-3" d="m47.07,36.61l-14.99,8.65v-17.2l7.49-13.7,7.5,5.05v17.19Z"/>
<path id="Tracé_23847" data-name="Tracé 23847" class="cls-3" d="m32.08,45.26l-14.98-8.65v-17.19l14.98,8.65v17.19Z"/>
<path id="Tracé_23848" data-name="Tracé 23848" class="cls-3" d="m17.1,19.41l7.49-13.7,14.98,8.65-7.49,13.7-14.98-8.65Z"/>
</g>
<path id="Tracé_23849" data-name="Tracé 23849" class="cls-1" d="m36.34,33.91l2.63-1.52v-5.92l-2.63,1.51v5.93Z"/>
<path id="Tracé_23850" data-name="Tracé 23850" class="cls-2" d="m41.32,31.05l2.62-1.51v-5.93l-2.62,1.51v5.93Z"/>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,41 @@
import { registerBlockType } from "@wordpress/blocks";
import "./style.scss";
import metadata from "./block.json";
import Edit from "./edit";
import Save from "./save";
import { navigation } from "@wordpress/icons";
registerBlockType(metadata.name, {
title: metadata.title,
icon: {
foreground: "#DF1E1E",
src: (
<svg version="1.1" x="0px" y="0px" viewBox="0 0 677.3 958.75">
<switch>
<foreignObject
requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/"
x="0"
y="0"
width="1"
height="1"
/>
<g>
<g>
<path d="M652.9,173.9L363.1,6.5c-15.1-8.7-33.7-8.7-48.8,0L24.4,173.9C9.3,182.6,0,198.7,0,216.2v334.7 c0,17.4,9.3,33.6,24.4,42.3l289.8,167.3c15.1,8.7,33.7,8.7,48.8,0l289.8-167.3c15.1-8.7,24.4-24.8,24.4-42.3V216.2 C677.3,198.7,668,182.6,652.9,173.9z M653.3,537c0,17.4-9.3,33.6-24.4,42.3L363.1,732.7c-15.1,8.7-33.7,8.7-48.8,0L48.4,579.3 C33.3,570.5,24,554.4,24,537V230c0-17.4,9.3-33.6,24.4-42.3L314.2,34.3c15.1-8.7,33.7-8.7,48.8,0l265.8,153.5 c15.1,8.7,24.4,24.8,24.4,42.3V537z" />
<path d="M568,256.9L378.8,366.1c-15.1,8.7-24.4,24.8-24.4,42.3c0,0-0.1,90.6-0.1,157.2v4.7c0,32.7,0,58.8,0.1,63.9 c0.2,16.7-3.1,44.3,25.2,29.2l189.1-109.2c15.1-8.7,24.4-24.8,24.4-42.3c0,0,0.1-90.6,0.1-157.2c0-1.6,0-3.2,0-4.7 c0-32.7,0-58.8-0.1-63.9C593,269.5,596.3,241.9,568,256.9z" />
<path d="M108.7,256.9l189.1,109.2c15.1,8.7,24.4,24.8,24.4,42.3c0,0,0.1,90.6,0.1,157.2v4.7c0,32.7,0,58.8-0.1,63.9 c-0.2,16.7,3.1,44.3-25.2,29.2L107.9,554.3c-15.1-8.7-24.4-24.8-24.4-42.3c0,0-0.1-90.6-0.1-157.2c0-1.6,0-3.2,0-4.7 c0-32.7,0-58.8,0.1-63.9C83.7,269.5,80.4,241.9,108.7,256.9z" />
<path d="M338.6,346.1c8.4,0,16.8-2.2,24.3-6.5l182.5-105.4c0.9-0.6,1.7-1.1,2.3-1.5c12.8-8.6,26-18.2-4.7-36.2 c-1.3-0.8-2.8-1.7-4.5-2.6L362.9,92.6c-7.5-4.3-15.9-6.5-24.3-6.5c-8.4,0-16.8,2.2-24.3,6.5L138.6,194c-1.6,0.9-3.1,1.8-4.5,2.6 c-30.7,17.9-17.5,27.6-4.7,36.2c0.6,0.4,1.3,0.9,2.3,1.5l182.5,105.4C321.8,343.9,330.2,346.1,338.6,346.1z" />
</g>
</g>
</switch>
</svg>
),
},
supports: metadata.supports,
attributes: metadata.attributes,
edit: Edit,
save: Save,
});

View File

@ -0,0 +1,14 @@
import { useBlockProps, RichText, InnerBlocks } from "@wordpress/block-editor";
export default function save({ attributes }) {
const { name, position } = attributes;
return (
<div
{...useBlockProps.save({
className: `box-monoblock card-large-content`,
})}
>
<InnerBlocks.Content />
</div>
);
}

View File

@ -0,0 +1 @@
// THE STYLE IS HANDLED IN PARENT BLOCK (timeline)

View File

@ -0,0 +1,18 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
[*.{yml,yaml}]
indent_style = space
indent_size = 2

30
blocks/monoblock/.gitignore vendored Normal file
View File

@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Coverage directory used by tools like istanbul
coverage
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Output of `npm pack`
*.tgz
# Output of `wp-scripts plugin-zip`
*.zip
# dotenv environment variables file
.env

View File

@ -0,0 +1,19 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "homegrade-content-blocks/box-monoblock",
"version": "0.1.0",
"title": "Monobloc",
"category": "homegrade-blocks",
"description": "Bloc conteneur d'une seule colonne",
"supports": {
"html": false
},
"parent": [
"homegrade-content-blocks/grey-box"
],
"textdomain": "homegrade-blocks",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css"
}

View File

@ -0,0 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n'), 'version' => 'e5f461877af67f8ad376');

View File

@ -0,0 +1,13 @@
/*!****************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***!
\****************************************************************************************************************************************************************************************************************************************/
/**
* The following styles get applied inside the editor only.
*
* Replace them with your own styles or remove the file completely.
*/
.wp-block-create-block-multiblocks {
border: 1px dotted #f00;
}
/*# sourceMappingURL=index.css.map*/

View File

@ -0,0 +1 @@
{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACC;AAAD,C","sources":["webpack://multiblocks/./src/editor.scss"],"sourcesContent":["/**\n * The following styles get applied inside the editor only.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.wp-block-create-block-multiblocks {\n\tborder: 1px dotted #f00;\n}\n"],"names":[],"sourceRoot":""}

View File

@ -0,0 +1,356 @@
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/edit.js":
/*!*********************!*\
!*** ./src/edit.js ***!
\*********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ Edit)
/* harmony export */ });
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__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___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 _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__);
function Edit({
attributes,
setAttributes,
...props
}) {
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)("div", {
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)({
className: `box-monoblock card-large-content`
})
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.InnerBlocks, {
allowedBlocks: ["core/paragraph"]
})));
}
/***/ }),
/***/ "./src/index.js":
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss");
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./edit */ "./src/edit.js");
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./save */ "./src/save.js");
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./block.json */ "./src/block.json");
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_5__.name, {
title: _block_json__WEBPACK_IMPORTED_MODULE_5__.title,
icon: {
foreground: "#DF1E1E",
src: (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", {
version: "1.1",
x: "0px",
y: "0px",
viewBox: "0 0 500 625",
"enable-background": "new 0 0 500 500"
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("g", null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("g", null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
d: "M377.1,393.7c-32.8,0-65.6,0-98.4,0c-46.6,0-93.2,0-139.7,0c-4.8,0-9.6,0-14.4,0c-1.5,0-2.9,0-4.4-0.1 c3.4,0.2-0.7-0.2-1.3-0.4c-0.8-0.2-1.7-0.5-2.5-0.8c2.7,0.8,0.2,0.1-0.6-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,5.5,0-2.9,0.1,2.7c0,0.2,0,0.4,0,0.6c0,4,0,8,0,12 c0,45.4,0,90.9,0,136.3c0,35,0.6,70,0,105c0,0.7-0.2,4.1,0,2.3c0.2-2.2-0.5,1.9-0.5,1.9c-0.2,0.9-0.5,1.7-0.8,2.5 c0.9-3.1-0.3,0.6-0.6,1.1c-0.4,0.8-0.9,1.5-1.3,2.2c-2,3.4,1.2-1.2-0.4,0.5c-0.7,0.8-1.5,1.5-2.2,2.3c-1.8,1.9-0.5,0.5,0.1,0.1 c-1,0.8-2.1,1.4-3.3,2.1c-0.7,0.4-1.5,0.8-2.3,1.2c3.2-1.3-0.9,0.1-1.3,0.2c-0.9,0.2-1.7,0.4-2.6,0.6 C381.9,393.2,377.6,393.7,377.1,393.7c-7.8,0.2-15.4,6.8-15,15c0.4,8,6.6,15.2,15,15c24.7-0.5,44.7-19.3,46.5-43.9 c0.3-3.4,0.1-6.9,0.1-10.3c0-18.2,0-36.3,0-54.5c0-51.4,0-102.8,0-154.2c0-12.4,0.2-24.9,0-37.3c-0.2-17.7-9.8-34.7-26.2-42.4 c-7.9-3.7-16.1-4.8-24.7-4.8c-42.6,0-85.3,0-127.9,0c-40,0-80.1,0-120.1,0c-27.6,0-48.6,20.9-48.7,48.5c0,14.3,0,28.6,0,42.9 c0,52,0,103.9,0,155.9c0,16.4,0,32.7,0,49.1c0,8.2,0.9,16.1,4.3,23.7c7.4,16.9,24.6,27.1,42.8,27.4c36.9,0.5,73.8,0,110.7,0 c45,0,90,0,135.1,0c2.7,0,5.3,0,8,0c7.8,0,15.4-6.9,15-15C391.7,400.6,385.5,393.7,377.1,393.7z"
}))))
},
supports: _block_json__WEBPACK_IMPORTED_MODULE_5__.supports,
attributes: _block_json__WEBPACK_IMPORTED_MODULE_5__.attributes,
edit: _edit__WEBPACK_IMPORTED_MODULE_3__["default"],
save: _save__WEBPACK_IMPORTED_MODULE_4__["default"]
});
/***/ }),
/***/ "./src/save.js":
/*!*********************!*\
!*** ./src/save.js ***!
\*********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ save)
/* harmony export */ });
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__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__);
function save() {
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
className: `box-monoblock card-large-content`
})
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InnerBlocks.Content, null));
}
/***/ }),
/***/ "./src/editor.scss":
/*!*************************!*\
!*** ./src/editor.scss ***!
\*************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "./src/style.scss":
/*!************************!*\
!*** ./src/style.scss ***!
\************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "@wordpress/block-editor":
/*!*************************************!*\
!*** external ["wp","blockEditor"] ***!
\*************************************/
/***/ ((module) => {
module.exports = window["wp"]["blockEditor"];
/***/ }),
/***/ "@wordpress/blocks":
/*!********************************!*\
!*** external ["wp","blocks"] ***!
\********************************/
/***/ ((module) => {
module.exports = window["wp"]["blocks"];
/***/ }),
/***/ "@wordpress/element":
/*!*********************************!*\
!*** external ["wp","element"] ***!
\*********************************/
/***/ ((module) => {
module.exports = window["wp"]["element"];
/***/ }),
/***/ "@wordpress/i18n":
/*!******************************!*\
!*** external ["wp","i18n"] ***!
\******************************/
/***/ ((module) => {
module.exports = window["wp"]["i18n"];
/***/ }),
/***/ "./src/block.json":
/*!************************!*\
!*** ./src/block.json ***!
\************************/
/***/ ((module) => {
module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/box-monoblock","version":"0.1.0","title":"Monobloc","category":"homegrade-blocks","description":"Bloc conteneur d\'une seule colonne","supports":{"html":false},"parent":["homegrade-content-blocks/grey-box"],"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css"}');
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/
/******/ /* webpack/runtime/chunk loaded */
/******/ (() => {
/******/ var deferred = [];
/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
/******/ if(chunkIds) {
/******/ priority = priority || 0;
/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ deferred[i] = [chunkIds, fn, priority];
/******/ return;
/******/ }
/******/ var notFulfilled = Infinity;
/******/ for (var i = 0; i < deferred.length; i++) {
/******/ var chunkIds = deferred[i][0];
/******/ var fn = deferred[i][1];
/******/ var priority = deferred[i][2];
/******/ var fulfilled = true;
/******/ 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])))) {
/******/ chunkIds.splice(j--, 1);
/******/ } else {
/******/ fulfilled = false;
/******/ if(priority < notFulfilled) notFulfilled = priority;
/******/ }
/******/ }
/******/ if(fulfilled) {
/******/ deferred.splice(i--, 1)
/******/ var r = fn();
/******/ if (r !== undefined) result = r;
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ // no baseURI
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "index": 0,
/******/ "./style-index": 0
/******/ };
/******/
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
/******/
/******/ // no preloaded
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var chunkIds = data[0];
/******/ var moreModules = data[1];
/******/ var runtime = data[2];
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0;
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
/******/ for(moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) var result = runtime(__webpack_require__);
/******/ }
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunkmultiblocks"] = self["webpackChunkmultiblocks"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["./style-index"], () => (__webpack_require__("./src/index.js")))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/
/******/ })()
;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,16 @@
/*!***************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***!
\***************************************************************************************************************************************************************************************************************************************/
/**
* The following styles get applied both on the front of your site
* and in the editor.
*
* Replace them with your own styles or remove the file completely.
*/
.wp-block-create-block-multiblocks {
background-color: #21759b;
color: #fff;
padding: 2px;
}
/*# sourceMappingURL=style-index.css.map*/

View File

@ -0,0 +1 @@
{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAOA;EACC;EACA;EACA;AAAD,C","sources":["webpack://multiblocks/./src/style.scss"],"sourcesContent":["/**\n * The following styles get applied both on the front of your site\n * and in the editor.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.wp-block-create-block-multiblocks {\n\tbackground-color: #21759b;\n\tcolor: #fff;\n\tpadding: 2px;\n}\n"],"names":[],"sourceRoot":""}

28142
blocks/monoblock/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
{
"name": "multiblocks",
"version": "0.1.0",
"description": "Example block scaffolded with Create Block tool.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
"main": "build/index.js",
"scripts": {
"build": "wp-scripts build",
"format": "wp-scripts format",
"lint:css": "wp-scripts lint-style",
"lint:js": "wp-scripts lint-js",
"packages-update": "wp-scripts packages-update",
"plugin-zip": "wp-scripts plugin-zip",
"start": "wp-scripts start"
},
"devDependencies": {
"@wordpress/scripts": "^26.9.0"
}
}

View File

@ -0,0 +1,19 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "homegrade-content-blocks/box-monoblock",
"version": "0.1.0",
"title": "Monobloc",
"category": "homegrade-blocks",
"description": "Bloc conteneur d'une seule colonne",
"supports": {
"html": false
},
"parent": [
"homegrade-content-blocks/grey-box"
],
"textdomain": "homegrade-blocks",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css"
}

View File

@ -0,0 +1,19 @@
import { __ } from "@wordpress/i18n";
import "./editor.scss";
import { useBlockProps, RichText } from "@wordpress/block-editor";
import { InnerBlocks } from "@wordpress/block-editor";
export default function Edit({ attributes, setAttributes, ...props }) {
return (
<>
<div
{...useBlockProps({
className: `box-monoblock card-large-content`,
})}
>
<InnerBlocks allowedBlocks={["core/paragraph"]} />
</div>
</>
);
}

View File

@ -0,0 +1,9 @@
/**
* The following styles get applied inside the editor only.
*
* Replace them with your own styles or remove the file completely.
*/
.wp-block-create-block-multiblocks {
border: 1px dotted #f00;
}

View File

@ -0,0 +1,33 @@
import { registerBlockType } from "@wordpress/blocks";
import "./style.scss";
import Edit from "./edit";
import save from "./save";
import metadata from "./block.json";
registerBlockType(metadata.name, {
title: metadata.title,
icon: {
foreground: "#DF1E1E",
src: (
<svg
version="1.1"
x="0px"
y="0px"
viewBox="0 0 500 625"
enable-background="new 0 0 500 500"
>
<g>
<g>
<path d="M377.1,393.7c-32.8,0-65.6,0-98.4,0c-46.6,0-93.2,0-139.7,0c-4.8,0-9.6,0-14.4,0c-1.5,0-2.9,0-4.4-0.1 c3.4,0.2-0.7-0.2-1.3-0.4c-0.8-0.2-1.7-0.5-2.5-0.8c2.7,0.8,0.2,0.1-0.6-0.3c-0.9-0.5-1.8-1.1-2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.2,0,0.4,0,0.6c0,4,0,8,0,12 c0,45.4,0,90.9,0,136.3c0,35,0.6,70,0,105c0,0.7-0.2,4.1,0,2.3c0.2-2.2-0.5,1.9-0.5,1.9c-0.2,0.9-0.5,1.7-0.8,2.5 c0.9-3.1-0.3,0.6-0.6,1.1c-0.4,0.8-0.9,1.5-1.3,2.2c-2,3.4,1.2-1.2-0.4,0.5c-0.7,0.8-1.5,1.5-2.2,2.3c-1.8,1.9-0.5,0.5,0.1,0.1 c-1,0.8-2.1,1.4-3.3,2.1c-0.7,0.4-1.5,0.8-2.3,1.2c3.2-1.3-0.9,0.1-1.3,0.2c-0.9,0.2-1.7,0.4-2.6,0.6 C381.9,393.2,377.6,393.7,377.1,393.7c-7.8,0.2-15.4,6.8-15,15c0.4,8,6.6,15.2,15,15c24.7-0.5,44.7-19.3,46.5-43.9 c0.3-3.4,0.1-6.9,0.1-10.3c0-18.2,0-36.3,0-54.5c0-51.4,0-102.8,0-154.2c0-12.4,0.2-24.9,0-37.3c-0.2-17.7-9.8-34.7-26.2-42.4 c-7.9-3.7-16.1-4.8-24.7-4.8c-42.6,0-85.3,0-127.9,0c-40,0-80.1,0-120.1,0c-27.6,0-48.6,20.9-48.7,48.5c0,14.3,0,28.6,0,42.9 c0,52,0,103.9,0,155.9c0,16.4,0,32.7,0,49.1c0,8.2,0.9,16.1,4.3,23.7c7.4,16.9,24.6,27.1,42.8,27.4c36.9,0.5,73.8,0,110.7,0 c45,0,90,0,135.1,0c2.7,0,5.3,0,8,0c7.8,0,15.4-6.9,15-15C391.7,400.6,385.5,393.7,377.1,393.7z" />
</g>
</g>
</svg>
),
},
supports: metadata.supports,
attributes: metadata.attributes,
edit: Edit,
save,
});

View File

@ -0,0 +1,13 @@
import { useBlockProps, InnerBlocks } from "@wordpress/block-editor";
export default function save() {
return (
<div
{...useBlockProps.save({
className: `box-monoblock card-large-content`,
})}
>
<InnerBlocks.Content />
</div>
);
}

View File

@ -0,0 +1,12 @@
/**
* The following styles get applied both on the front of your site
* and in the editor.
*
* Replace them with your own styles or remove the file completely.
*/
.wp-block-create-block-multiblocks {
background-color: #21759b;
color: #fff;
padding: 2px;
}