refactoring before gauthier ok
This commit is contained in:
parent
4c8f206c59
commit
164798e2ae
|
|
@ -2,6 +2,12 @@ import { __ } from "@wordpress/i18n";
|
|||
import { useBlockProps } from "@wordpress/block-editor";
|
||||
import "./editor.scss";
|
||||
|
||||
import {
|
||||
useBlockProps,
|
||||
RichText,
|
||||
BlockControls,
|
||||
} from "@wordpress/block-editor";
|
||||
|
||||
export default function Edit() {
|
||||
return (
|
||||
<p
|
||||
|
|
|
|||
|
|
@ -1,39 +1,11 @@
|
|||
/**
|
||||
* Registers a new block provided a unique name and an object defining its behavior.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
|
||||
*/
|
||||
import { registerBlockType } from '@wordpress/blocks';
|
||||
import { registerBlockType } from "@wordpress/blocks";
|
||||
import "./style.scss";
|
||||
|
||||
/**
|
||||
* Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
|
||||
* All files containing `style` keyword are bundled together. The code used
|
||||
* gets applied both to the front of your site and to the editor.
|
||||
*
|
||||
* @see https://www.npmjs.com/package/@wordpress/scripts#using-css
|
||||
*/
|
||||
import './style.scss';
|
||||
import Edit from "./edit";
|
||||
import save from "./save";
|
||||
import metadata from "./block.json";
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import Edit from './edit';
|
||||
import save from './save';
|
||||
import metadata from './block.json';
|
||||
|
||||
/**
|
||||
* Every block starts by registering a new block type definition.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
|
||||
*/
|
||||
registerBlockType( metadata.name, {
|
||||
/**
|
||||
* @see ./edit.js
|
||||
*/
|
||||
registerBlockType(metadata.name, {
|
||||
edit: Edit,
|
||||
|
||||
/**
|
||||
* @see ./save.js
|
||||
*/
|
||||
save,
|
||||
} );
|
||||
});
|
||||
|
|
|
|||
18
blocks/aside/.editorconfig
Normal file
18
blocks/aside/.editorconfig
Normal 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/aside/.gitignore
vendored
Normal file
30
blocks/aside/.gitignore
vendored
Normal 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
|
||||
29
blocks/aside/build/block.json
Normal file
29
blocks/aside/build/block.json
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2,
|
||||
"name": "homegrade-content-blocks/aside",
|
||||
"version": "0.1.0",
|
||||
"title": "Aside",
|
||||
"category": "homegrade-blocks",
|
||||
"icon": "smiley",
|
||||
"description": "Pour un apparté, un texte secondaire ou un focus particulier",
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"example": {
|
||||
"attributes": {
|
||||
"textContent": "Ceci est un exemple d'apparté"
|
||||
}
|
||||
},
|
||||
"textdomain": "homegrade-blocks",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css",
|
||||
"attributes": {
|
||||
"textContent": {
|
||||
"type": "string",
|
||||
"source": "html",
|
||||
"selector": "p.aside-content"
|
||||
}
|
||||
}
|
||||
}
|
||||
1
blocks/aside/build/index.asset.php
Normal file
1
blocks/aside/build/index.asset.php
Normal file
|
|
@ -0,0 +1 @@
|
|||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n'), 'version' => '3c6d5173541ff87a4f35');
|
||||
|
|
@ -1,13 +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/nested-children/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-blocka {
|
||||
border: 1px dotted #f00;
|
||||
}
|
||||
/*!****************************************************************************************************************************************************************************************************************************************!*\
|
||||
!*** 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 ***!
|
||||
\****************************************************************************************************************************************************************************************************************************************/
|
||||
|
||||
/*# sourceMappingURL=index.css.map*/
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
/******/ "use strict";
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ "./src/nested-children/edit.js":
|
||||
/*!*************************************!*\
|
||||
!*** ./src/nested-children/edit.js ***!
|
||||
\*************************************/
|
||||
/***/ "./src/edit.js":
|
||||
/*!*********************!*\
|
||||
!*** ./src/edit.js ***!
|
||||
\*********************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
|
@ -16,9 +16,9 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* 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 _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 _editor_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./editor.scss */ "./src/nested-children/editor.scss");
|
||||
/* 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__);
|
||||
|
||||
|
||||
|
||||
|
|
@ -28,60 +28,66 @@ function Edit({
|
|||
setAttributes
|
||||
}) {
|
||||
const {
|
||||
userName,
|
||||
userPosition
|
||||
textContent
|
||||
} = attributes;
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", {
|
||||
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.RichText, {
|
||||
className: "user-name",
|
||||
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)("aside", {
|
||||
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.useBlockProps)({
|
||||
className: `homegrade-blocks-aside`
|
||||
})
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__.RichText, {
|
||||
onChange: value => setAttributes({
|
||||
userName: value
|
||||
textContent: value
|
||||
}),
|
||||
value: userName,
|
||||
placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("UserName Here", "text-box"),
|
||||
value: textContent,
|
||||
tagName: "p",
|
||||
allowedFormats: []
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", null, userPosition));
|
||||
className: "aside-content",
|
||||
placeholder: "Ajoutez votre texte ici"
|
||||
})));
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/nested-children/index.js":
|
||||
/*!**************************************!*\
|
||||
!*** ./src/nested-children/index.js ***!
|
||||
\**************************************/
|
||||
/***/ "./src/index.js":
|
||||
/*!**********************!*\
|
||||
!*** ./src/index.js ***!
|
||||
\**********************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
|
||||
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style.scss */ "./src/nested-children/style.scss");
|
||||
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/nested-children/block.json");
|
||||
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./edit */ "./src/nested-children/edit.js");
|
||||
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./save */ "./src/nested-children/save.js");
|
||||
/* 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_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_2__.name, {
|
||||
title: _block_json__WEBPACK_IMPORTED_MODULE_2__.title,
|
||||
icon: "smiley",
|
||||
category: "wpblock-blocks",
|
||||
parent: ["wpblocks-multiple/nested-parent"],
|
||||
supports: _block_json__WEBPACK_IMPORTED_MODULE_2__.supports,
|
||||
attributes: _block_json__WEBPACK_IMPORTED_MODULE_2__.attributes,
|
||||
|
||||
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_5__.name, {
|
||||
icon: {
|
||||
src: (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "M5,15a3,3,0,1,1,2.816-4H11a1,1,0,0,1,0,2H7.816A2.99,2.99,0,0,1,5,15ZM18.707,8.293a1,1,0,0,0-1.414,1.414L18.586,11H14.949A10.013,10.013,0,0,0,5,2,1,1,0,0,0,5,4,8,8,0,0,1,5,20a1,1,0,0,0,0,2,10.013,10.013,0,0,0,9.949-9h3.637l-1.293,1.293a1,1,0,0,0,1.414,1.414l3-3a1,1,0,0,0,0-1.414Z"
|
||||
})),
|
||||
foreground: "#DF1E1E"
|
||||
},
|
||||
edit: _edit__WEBPACK_IMPORTED_MODULE_3__["default"],
|
||||
save: _save__WEBPACK_IMPORTED_MODULE_4__["default"]
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/nested-children/save.js":
|
||||
/*!*************************************!*\
|
||||
!*** ./src/nested-children/save.js ***!
|
||||
\*************************************/
|
||||
/***/ "./src/save.js":
|
||||
/*!*********************!*\
|
||||
!*** ./src/save.js ***!
|
||||
\*********************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
|
@ -94,26 +100,30 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__);
|
||||
|
||||
|
||||
|
||||
function save({
|
||||
attributes
|
||||
}) {
|
||||
const {
|
||||
userName,
|
||||
userPosition
|
||||
textContent
|
||||
} = attributes;
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, {
|
||||
tagName: "h2",
|
||||
value: userName,
|
||||
className: "mydummytext"
|
||||
});
|
||||
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)("aside", {
|
||||
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
||||
className: `homegrade-blocks-aside`
|
||||
})
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.RichText.Content, {
|
||||
value: textContent,
|
||||
tagName: "p",
|
||||
className: "aside-content"
|
||||
})));
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/nested-children/editor.scss":
|
||||
/*!*****************************************!*\
|
||||
!*** ./src/nested-children/editor.scss ***!
|
||||
\*****************************************/
|
||||
/***/ "./src/editor.scss":
|
||||
/*!*************************!*\
|
||||
!*** ./src/editor.scss ***!
|
||||
\*************************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
|
@ -122,10 +132,10 @@ __webpack_require__.r(__webpack_exports__);
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/nested-children/style.scss":
|
||||
/*!****************************************!*\
|
||||
!*** ./src/nested-children/style.scss ***!
|
||||
\****************************************/
|
||||
/***/ "./src/style.scss":
|
||||
/*!************************!*\
|
||||
!*** ./src/style.scss ***!
|
||||
\************************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
|
@ -174,13 +184,13 @@ module.exports = window["wp"]["i18n"];
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/nested-children/block.json":
|
||||
/*!****************************************!*\
|
||||
!*** ./src/nested-children/block.json ***!
|
||||
\****************************************/
|
||||
/***/ "./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/nested-children","version":"0.1.0","title":"Nested Children","category":"homegrade-blocks","icon":{"background":"#0414eb","foreground":"#fff","src":"admin-plugins"},"description":"Children Nested. #ChildrenNested","supports":{"html":false},"textdomain":"nested-parent","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"userName":{"type":"string"},"userPosition":{"type":"string"}}}');
|
||||
module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/aside","version":"0.1.0","title":"Aside","category":"homegrade-blocks","icon":"smiley","description":"Pour un apparté, un texte secondaire ou un focus particulier","supports":{"html":false},"example":{"attributes":{"textContent":"Ceci est un exemple d\'apparté"}},"textdomain":"homegrade-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"textContent":{"type":"string","source":"html","selector":"p.aside-content"}}}');
|
||||
|
||||
/***/ })
|
||||
|
||||
|
|
@ -296,8 +306,8 @@ module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json
|
|||
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
||||
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
||||
/******/ var installedChunks = {
|
||||
/******/ "nested-children/index": 0,
|
||||
/******/ "nested-children/style-index": 0
|
||||
/******/ "index": 0,
|
||||
/******/ "./style-index": 0
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // no chunk on demand loading
|
||||
|
|
@ -349,7 +359,7 @@ module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json
|
|||
/******/ // 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, ["nested-children/style-index"], () => (__webpack_require__("./src/nested-children/index.js")))
|
||||
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["./style-index"], () => (__webpack_require__("./src/index.js")))
|
||||
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
|
||||
/******/
|
||||
/******/ })()
|
||||
1
blocks/aside/build/index.js.map
Normal file
1
blocks/aside/build/index.js.map
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1,16 +1,11 @@
|
|||
/*!*******************************************************************************************************************************************************************************************************************************************************!*\
|
||||
!*** 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/nested-children/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-blocka {
|
||||
background-color: #21759b;
|
||||
color: #fff;
|
||||
padding: 2px;
|
||||
/*!***************************************************************************************************************************************************************************************************************************************!*\
|
||||
!*** 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 ***!
|
||||
\***************************************************************************************************************************************************************************************************************************************/
|
||||
.homegrade-blocks-aside {
|
||||
border-left: 4px solid #000000;
|
||||
}
|
||||
.homegrade-blocks-aside .aside-content {
|
||||
padding: 20px 20px;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=style-index.css.map*/
|
||||
1
blocks/aside/build/style-index.css.map
Normal file
1
blocks/aside/build/style-index.css.map
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"./style-index.css","mappings":";;;AAAA;EACC;AACD;AAAC;EACC;AAEF,C","sources":["webpack://multiblocks/./src/style.scss"],"sourcesContent":[".homegrade-blocks-aside {\n\tborder-left: 4px solid #000000;\n\t.aside-content {\n\t\tpadding: 20px 20px;\n\t}\n}\n"],"names":[],"sourceRoot":""}
|
||||
28142
blocks/aside/package-lock.json
generated
Normal file
28142
blocks/aside/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
20
blocks/aside/package.json
Normal file
20
blocks/aside/package.json
Normal 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"
|
||||
}
|
||||
}
|
||||
29
blocks/aside/src/block.json
Normal file
29
blocks/aside/src/block.json
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2,
|
||||
"name": "homegrade-content-blocks/aside",
|
||||
"version": "0.1.0",
|
||||
"title": "Aside",
|
||||
"category": "homegrade-blocks",
|
||||
"icon": "smiley",
|
||||
"description": "Pour un apparté, un texte secondaire ou un focus particulier",
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"example": {
|
||||
"attributes": {
|
||||
"textContent": "Ceci est un exemple d'apparté"
|
||||
}
|
||||
},
|
||||
"textdomain": "homegrade-blocks",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css",
|
||||
"attributes": {
|
||||
"textContent": {
|
||||
"type": "string",
|
||||
"source": "html",
|
||||
"selector": "p.aside-content"
|
||||
}
|
||||
}
|
||||
}
|
||||
26
blocks/aside/src/edit.js
Normal file
26
blocks/aside/src/edit.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { __ } from "@wordpress/i18n";
|
||||
import "./editor.scss";
|
||||
|
||||
import { useBlockProps, RichText } from "@wordpress/block-editor";
|
||||
|
||||
export default function Edit({ attributes, setAttributes }) {
|
||||
const { textContent } = attributes;
|
||||
|
||||
return (
|
||||
<>
|
||||
<aside
|
||||
{...useBlockProps({
|
||||
className: `homegrade-blocks-aside`,
|
||||
})}
|
||||
>
|
||||
<RichText
|
||||
onChange={(value) => setAttributes({ textContent: value })}
|
||||
value={textContent}
|
||||
tagName="p"
|
||||
className="aside-content"
|
||||
placeholder="Ajoutez votre texte ici"
|
||||
/>
|
||||
</aside>
|
||||
</>
|
||||
);
|
||||
}
|
||||
0
blocks/aside/src/editor.scss
Normal file
0
blocks/aside/src/editor.scss
Normal file
18
blocks/aside/src/index.js
Normal file
18
blocks/aside/src/index.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { registerBlockType } from "@wordpress/blocks";
|
||||
import "./style.scss";
|
||||
|
||||
import Edit from "./edit";
|
||||
import save from "./save";
|
||||
import metadata from "./block.json";
|
||||
registerBlockType(metadata.name, {
|
||||
icon: {
|
||||
src: (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M5,15a3,3,0,1,1,2.816-4H11a1,1,0,0,1,0,2H7.816A2.99,2.99,0,0,1,5,15ZM18.707,8.293a1,1,0,0,0-1.414,1.414L18.586,11H14.949A10.013,10.013,0,0,0,5,2,1,1,0,0,0,5,4,8,8,0,0,1,5,20a1,1,0,0,0,0,2,10.013,10.013,0,0,0,9.949-9h3.637l-1.293,1.293a1,1,0,0,0,1.414,1.414l3-3a1,1,0,0,0,0-1.414Z" />
|
||||
</svg>
|
||||
),
|
||||
foreground: "#DF1E1E",
|
||||
},
|
||||
edit: Edit,
|
||||
save,
|
||||
});
|
||||
21
blocks/aside/src/save.js
Normal file
21
blocks/aside/src/save.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { useBlockProps } from "@wordpress/block-editor";
|
||||
import { RichText } from "@wordpress/block-editor";
|
||||
|
||||
export default function save({ attributes }) {
|
||||
const { textContent } = attributes;
|
||||
return (
|
||||
<>
|
||||
<aside
|
||||
{...useBlockProps.save({
|
||||
className: `homegrade-blocks-aside`,
|
||||
})}
|
||||
>
|
||||
<RichText.Content
|
||||
value={textContent}
|
||||
tagName="p"
|
||||
className="aside-content"
|
||||
/>
|
||||
</aside>
|
||||
</>
|
||||
);
|
||||
}
|
||||
6
blocks/aside/src/style.scss
Normal file
6
blocks/aside/src/style.scss
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
.homegrade-blocks-aside {
|
||||
border-left: 4px solid #000000;
|
||||
.aside-content {
|
||||
padding: 20px 20px;
|
||||
}
|
||||
}
|
||||
18
blocks/chapitrage-thematique/.editorconfig
Normal file
18
blocks/chapitrage-thematique/.editorconfig
Normal 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/chapitrage-thematique/.gitignore
vendored
Normal file
30
blocks/chapitrage-thematique/.gitignore
vendored
Normal 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
|
||||
16
blocks/chapitrage-thematique/build/block.json
Normal file
16
blocks/chapitrage-thematique/build/block.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2,
|
||||
"name": "homegrade-content-blocks/chapitrage-thematique",
|
||||
"version": "0.1.0",
|
||||
"title": "Chapitrage Thématique",
|
||||
"category": "homegrade-blocks",
|
||||
"description": "Pour insérer un bloc de gestion de chapitres pour une thématique parent",
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"textdomain": "homegrade-blocks",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css"
|
||||
}
|
||||
1
blocks/chapitrage-thematique/build/index.asset.php
Normal file
1
blocks/chapitrage-thematique/build/index.asset.php
Normal file
|
|
@ -0,0 +1 @@
|
|||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n'), 'version' => 'e3dde56298e97bb747dc');
|
||||
387
blocks/chapitrage-thematique/build/index.js
Normal file
387
blocks/chapitrage-thematique/build/index.js
Normal file
File diff suppressed because one or more lines are too long
1
blocks/chapitrage-thematique/build/index.js.map
Normal file
1
blocks/chapitrage-thematique/build/index.js.map
Normal file
File diff suppressed because one or more lines are too long
28142
blocks/chapitrage-thematique/package-lock.json
generated
Normal file
28142
blocks/chapitrage-thematique/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
20
blocks/chapitrage-thematique/package.json
Normal file
20
blocks/chapitrage-thematique/package.json
Normal 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"
|
||||
}
|
||||
}
|
||||
16
blocks/chapitrage-thematique/src/block.json
Normal file
16
blocks/chapitrage-thematique/src/block.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2,
|
||||
"name": "homegrade-content-blocks/chapitrage-thematique",
|
||||
"version": "0.1.0",
|
||||
"title": "Chapitrage Thématique",
|
||||
"category": "homegrade-blocks",
|
||||
"description": "Pour insérer un bloc de gestion de chapitres pour une thématique parent",
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"textdomain": "homegrade-blocks",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css"
|
||||
}
|
||||
27
blocks/chapitrage-thematique/src/edit.js
Normal file
27
blocks/chapitrage-thematique/src/edit.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { __ } from "@wordpress/i18n";
|
||||
import "./editor.scss";
|
||||
|
||||
import {
|
||||
useBlockProps,
|
||||
RichText,
|
||||
BlockControls,
|
||||
} from "@wordpress/block-editor";
|
||||
|
||||
export default function Edit() {
|
||||
return (
|
||||
<section
|
||||
{...useBlockProps({
|
||||
className: `homegrade-blocks-chapitrage-thematique`,
|
||||
})}
|
||||
>
|
||||
<RichText
|
||||
onChange={(value) => setAttributes({ textContent: value })}
|
||||
value={textContent}
|
||||
tagName="p"
|
||||
className="aside-content"
|
||||
placeholder="Ajoutez votre texte ici"
|
||||
/>
|
||||
{__("Multiblocks – salut from the editor!", "multiblocks")}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
9
blocks/chapitrage-thematique/src/editor.scss
Normal file
9
blocks/chapitrage-thematique/src/editor.scss
Normal 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;
|
||||
}
|
||||
44
blocks/chapitrage-thematique/src/index.js
Normal file
44
blocks/chapitrage-thematique/src/index.js
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import { registerBlockType } from "@wordpress/blocks";
|
||||
import "./style.scss";
|
||||
|
||||
import Edit from "./edit";
|
||||
import save from "./save";
|
||||
import metadata from "./block.json";
|
||||
|
||||
registerBlockType(metadata.name, {
|
||||
icon: {
|
||||
src: (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<g id="a" />
|
||||
<g id="b" />
|
||||
<g id="c" />
|
||||
<g id="d" />
|
||||
<g id="e">
|
||||
<g>
|
||||
<path d="M2.56,5.55c-.2,.14-.31,.37-.31,.61v11c0,.24,.12,.47,.32,.61,.2,.14,.45,.17,.69,.09,1.05-.38,3.17-.89,5.48,0,.94,.36,1.78,.91,2.52,1.62V6.06c-.72-.66-1.73-1.32-3.08-1.64-2.84-.66-5.01,.69-5.61,1.12Z" />
|
||||
<path d="M21.44,5.55c-.6-.43-2.77-1.78-5.61-1.12-1.35,.31-2.36,.97-3.08,1.64v13.42c.74-.71,1.58-1.26,2.52-1.62,2.31-.88,4.42-.38,5.48,0,.23,.08,.49,.05,.69-.09s.32-.37,.32-.61V6.16c0-.24-.12-.47-.31-.61Z" />
|
||||
</g>
|
||||
</g>
|
||||
<g id="f" />
|
||||
<g id="g" />
|
||||
<g id="h" />
|
||||
<g id="i" />
|
||||
<g id="j" />
|
||||
<g id="k" />
|
||||
<g id="l" />
|
||||
<g id="m" />
|
||||
<g id="n" />
|
||||
<g id="o" />
|
||||
<g id="p" />
|
||||
<g id="q" />
|
||||
<g id="r" />
|
||||
<g id="s" />
|
||||
<g id="t" />
|
||||
<g id="u" />
|
||||
</svg>
|
||||
),
|
||||
foreground: "#DF1E1E",
|
||||
},
|
||||
edit: Edit,
|
||||
save,
|
||||
});
|
||||
14
blocks/chapitrage-thematique/src/save.js
Normal file
14
blocks/chapitrage-thematique/src/save.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { useBlockProps } from "@wordpress/block-editor";
|
||||
import { useBlockProps, RichText } from "@wordpress/block-editor";
|
||||
|
||||
export default function save() {
|
||||
return (
|
||||
<section
|
||||
{...useBlockProps.save({
|
||||
className: `homegrade-blocks-chapitrage-thematique`,
|
||||
})}
|
||||
>
|
||||
{"Multiblocks – salut from the saved content!"}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
12
blocks/chapitrage-thematique/src/style.scss
Normal file
12
blocks/chapitrage-thematique/src/style.scss
Normal 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;
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '7ca17844900678c79555');
|
||||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '90d4bc9cf614ad8ee3ac');
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@
|
|||
position: absolute !important;
|
||||
}
|
||||
|
||||
.homegrade-blocks-focus-point-caption {
|
||||
position: relative !important;
|
||||
}
|
||||
|
||||
.components-panel__body .homegrade-blocks-focus-point-bullet {
|
||||
position: static !important;
|
||||
margin-top: -16px;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"focus-point/index.css","mappings":";;;AAAA;;;;EAAA;AAKA;EACC;AACD;;AAEA;EACC;EACA;EACA;AACD,C","sources":["webpack://multiblocks/./src/focus-point/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.homegrade-blocks-focus-point {\n\tposition: absolute !important;\n}\n\n.components-panel__body .homegrade-blocks-focus-point-bullet {\n\tposition: static !important;\n\tmargin-top: -16px;\n\tmargin-bottom: 10px;\n}\n"],"names":[],"sourceRoot":""}
|
||||
{"version":3,"file":"focus-point/index.css","mappings":";;;AAAA;;;;EAAA;AAKA;EACC;AACD;;AACA;EACC;AAED;;AAAA;EACC;EACA;EACA;AAGD,C","sources":["webpack://multiblocks/./src/focus-point/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.homegrade-blocks-focus-point {\n\tposition: absolute !important;\n}\n.homegrade-blocks-focus-point-caption {\n\tposition: relative !important;\n}\n.components-panel__body .homegrade-blocks-focus-point-bullet {\n\tposition: static !important;\n\tmargin-top: -16px;\n\tmargin-bottom: 10px;\n}\n"],"names":[],"sourceRoot":""}
|
||||
|
|
@ -19,15 +19,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* 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 _editor_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./editor.scss */ "./src/focus-point/editor.scss");
|
||||
/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices");
|
||||
/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_4__);
|
||||
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
||||
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__);
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__);
|
||||
|
||||
|
||||
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__);
|
||||
|
||||
|
||||
|
||||
|
|
@ -62,12 +55,12 @@ function Edit({
|
|||
focusCaptionDescription
|
||||
});
|
||||
}
|
||||
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__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.PanelBody, {
|
||||
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__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.PanelBody, {
|
||||
className: "focus-point-modification-pannel",
|
||||
title: "Gestion du points de focus"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
className: "homegrade-blocks-focus-point-bullet"
|
||||
}, focusIndex), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.TextControl, {
|
||||
}, focusIndex), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.TextControl, {
|
||||
placeholder: "Ins\xE9rer le titre de votre point focus",
|
||||
label: "Titre du point focus",
|
||||
value: focusTitle !== "Légende Sans titre" ? focusTitle : null,
|
||||
|
|
@ -75,14 +68,14 @@ function Edit({
|
|||
onChange: value => {
|
||||
handleChangeTitle(value);
|
||||
}
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.TextareaControl, {
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.TextareaControl, {
|
||||
label: "Description du point focus",
|
||||
value: focusCaptionDescription,
|
||||
rows: 3,
|
||||
onChange: description => {
|
||||
handleChangeCaptionDescription(description);
|
||||
}
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.FocalPointPicker, {
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.FocalPointPicker, {
|
||||
url: coverUrl !== null && coverUrl !== void 0 ? coverUrl : null,
|
||||
dimensions: {
|
||||
width: 400,
|
||||
|
|
@ -173,10 +166,7 @@ function save({
|
|||
attributes
|
||||
}) {
|
||||
const {
|
||||
focusTitle,
|
||||
focusPosition,
|
||||
focusCaptionDescription,
|
||||
focusIndex
|
||||
focusCaptionDescription
|
||||
} = attributes;
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("li", {
|
||||
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
||||
|
|
@ -241,16 +231,6 @@ module.exports = window["wp"]["components"];
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/data":
|
||||
/*!******************************!*\
|
||||
!*** external ["wp","data"] ***!
|
||||
\******************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["data"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/element":
|
||||
/*!*********************************!*\
|
||||
!*** external ["wp","element"] ***!
|
||||
|
|
@ -271,16 +251,6 @@ module.exports = window["wp"]["i18n"];
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/notices":
|
||||
/*!*********************************!*\
|
||||
!*** external ["wp","notices"] ***!
|
||||
\*********************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["notices"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/focus-point/block.json":
|
||||
/*!************************************!*\
|
||||
!*** ./src/focus-point/block.json ***!
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array(), 'version' => '3e90afcff72bc85fad6c');
|
||||
<?php return array('dependencies' => array(), 'version' => '162b809e9bf5c12eacfb');
|
||||
|
|
|
|||
|
|
@ -23,10 +23,7 @@ window.addEventListener("DOMContentLoaded", event => {
|
|||
});
|
||||
focusPoint.addEventListener("mouseout", function () {
|
||||
const focusPointPopupContainer = focusPoint.querySelector(".focus-point-popup-container");
|
||||
// focusPoint.removeAttribute("data-hovered");
|
||||
focusPointPopupContainer.remove();
|
||||
// setTimeout(() => {
|
||||
// }, 200);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"frontend.js","mappings":";;;;;AAAAA,MAAM,CAACC,gBAAgB,CAAC,kBAAkB,EAAGC,KAAK,IAAK;EACtD;EACA,MAAMC,iBAAiB,GAAGC,QAAQ,CAACC,gBAAgB,CAClD,sCACD,CAAC;EACDF,iBAAiB,CAACG,OAAO,CAAEC,UAAU,IAAK;IACzC,MAAMC,oBAAoB,GAAGD,UAAU,CAACE,aAAa;IAErDF,UAAU,CAACN,gBAAgB,CAAC,WAAW,EAAGC,KAAK,IAAK;MACnD,MAAMQ,wBAAwB,GAAGN,QAAQ,CAACO,aAAa,CAAC,gBAAgB,CAAC;MACzEC,OAAO,CAACC,GAAG,CAACH,wBAAwB,CAAC;MAErC,MAAMI,UAAU,GAAGP,UAAU,CAACQ,YAAY,CAAC,yBAAyB,CAAC;MAErE,MAAMC,wBAAwB,GAAGZ,QAAQ,CAACa,aAAa,CAAC,KAAK,CAAC;MAC9DD,wBAAwB,CAACE,SAAS,GAAG,6BAA6B;MAElE,MAAMC,oBAAoB,GAAGf,QAAQ,CAACa,aAAa,CAAC,IAAI,CAAC;MACzDE,oBAAoB,CAACC,WAAW,GAAGN,UAAU;MAC7CK,oBAAoB,CAACD,SAAS,GAAG,oCAAoC;MAErEF,wBAAwB,CAACK,WAAW,CAACF,oBAAoB,CAAC;MAC1DZ,UAAU,CAACc,WAAW,CAACL,wBAAwB,CAAC;MAChDT,UAAU,CAACe,YAAY,CAAC,cAAc,EAAE,EAAE,CAAC;IAC5C,CAAC,CAAC;IAEFf,UAAU,CAACN,gBAAgB,CAAC,UAAU,EAAE,YAAY;MACnD,MAAMe,wBAAwB,GAAGT,UAAU,CAACI,aAAa,CACxD,8BACD,CAAC;MACD;MACAK,wBAAwB,CAACO,MAAM,CAAC,CAAC;MACjC;MACA;IACD,CAAC,CAAC;EACH,CAAC,CAAC;AACH,CAAC,CAAC,C","sources":["webpack://multiblocks/./src/frontend.js"],"sourcesContent":["window.addEventListener(\"DOMContentLoaded\", (event) => {\r\n\t// alert(\"Hello from frontend.js\");\r\n\tconst focusBulletPoints = document.querySelectorAll(\r\n\t\t\".homegrade-blocks-focus-point-bullet\"\r\n\t);\r\n\tfocusBulletPoints.forEach((focusPoint) => {\r\n\t\tconst focusPointsContainer = focusPoint.parentElement;\r\n\r\n\t\tfocusPoint.addEventListener(\"mouseover\", (event) => {\r\n\t\t\tconst aleradyHoveredFocusPoint = document.querySelector(\"[data-hovered]\");\r\n\t\t\tconsole.log(aleradyHoveredFocusPoint);\r\n\r\n\t\t\tconst focusTitle = focusPoint.getAttribute(\"data-focus-bullet-title\");\r\n\r\n\t\t\tconst focusPointPopupContainer = document.createElement(\"div\");\r\n\t\t\tfocusPointPopupContainer.className = \"focus-point-popup-container\";\r\n\r\n\t\t\tconst focusPointPopupTitle = document.createElement(\"h4\");\r\n\t\t\tfocusPointPopupTitle.textContent = focusTitle;\r\n\t\t\tfocusPointPopupTitle.className = \"focus-point-popup-container__title\";\r\n\r\n\t\t\tfocusPointPopupContainer.appendChild(focusPointPopupTitle);\r\n\t\t\tfocusPoint.appendChild(focusPointPopupContainer);\r\n\t\t\tfocusPoint.setAttribute(\"data-hovered\", \"\");\r\n\t\t});\r\n\r\n\t\tfocusPoint.addEventListener(\"mouseout\", function () {\r\n\t\t\tconst focusPointPopupContainer = focusPoint.querySelector(\r\n\t\t\t\t\".focus-point-popup-container\"\r\n\t\t\t);\r\n\t\t\t// focusPoint.removeAttribute(\"data-hovered\");\r\n\t\t\tfocusPointPopupContainer.remove();\r\n\t\t\t// setTimeout(() => {\r\n\t\t\t// }, 200);\r\n\t\t});\r\n\t});\r\n});\r\n"],"names":["window","addEventListener","event","focusBulletPoints","document","querySelectorAll","forEach","focusPoint","focusPointsContainer","parentElement","aleradyHoveredFocusPoint","querySelector","console","log","focusTitle","getAttribute","focusPointPopupContainer","createElement","className","focusPointPopupTitle","textContent","appendChild","setAttribute","remove"],"sourceRoot":""}
|
||||
{"version":3,"file":"frontend.js","mappings":";;;;;AAAAA,MAAM,CAACC,gBAAgB,CAAC,kBAAkB,EAAGC,KAAK,IAAK;EACtD;EACA,MAAMC,iBAAiB,GAAGC,QAAQ,CAACC,gBAAgB,CAClD,sCACD,CAAC;EACDF,iBAAiB,CAACG,OAAO,CAAEC,UAAU,IAAK;IACzC,MAAMC,oBAAoB,GAAGD,UAAU,CAACE,aAAa;IAErDF,UAAU,CAACN,gBAAgB,CAAC,WAAW,EAAGC,KAAK,IAAK;MACnD,MAAMQ,wBAAwB,GAAGN,QAAQ,CAACO,aAAa,CAAC,gBAAgB,CAAC;MACzEC,OAAO,CAACC,GAAG,CAACH,wBAAwB,CAAC;MAErC,MAAMI,UAAU,GAAGP,UAAU,CAACQ,YAAY,CAAC,yBAAyB,CAAC;MAErE,MAAMC,wBAAwB,GAAGZ,QAAQ,CAACa,aAAa,CAAC,KAAK,CAAC;MAC9DD,wBAAwB,CAACE,SAAS,GAAG,6BAA6B;MAElE,MAAMC,oBAAoB,GAAGf,QAAQ,CAACa,aAAa,CAAC,IAAI,CAAC;MACzDE,oBAAoB,CAACC,WAAW,GAAGN,UAAU;MAC7CK,oBAAoB,CAACD,SAAS,GAAG,oCAAoC;MAErEF,wBAAwB,CAACK,WAAW,CAACF,oBAAoB,CAAC;MAC1DZ,UAAU,CAACc,WAAW,CAACL,wBAAwB,CAAC;MAChDT,UAAU,CAACe,YAAY,CAAC,cAAc,EAAE,EAAE,CAAC;IAC5C,CAAC,CAAC;IAEFf,UAAU,CAACN,gBAAgB,CAAC,UAAU,EAAE,YAAY;MACnD,MAAMe,wBAAwB,GAAGT,UAAU,CAACI,aAAa,CACxD,8BACD,CAAC;MACDK,wBAAwB,CAACO,MAAM,CAAC,CAAC;IAClC,CAAC,CAAC;EACH,CAAC,CAAC;AACH,CAAC,CAAC,C","sources":["webpack://multiblocks/./src/frontend.js"],"sourcesContent":["window.addEventListener(\"DOMContentLoaded\", (event) => {\r\n\t// alert(\"Hello from frontend.js\");\r\n\tconst focusBulletPoints = document.querySelectorAll(\r\n\t\t\".homegrade-blocks-focus-point-bullet\"\r\n\t);\r\n\tfocusBulletPoints.forEach((focusPoint) => {\r\n\t\tconst focusPointsContainer = focusPoint.parentElement;\r\n\r\n\t\tfocusPoint.addEventListener(\"mouseover\", (event) => {\r\n\t\t\tconst aleradyHoveredFocusPoint = document.querySelector(\"[data-hovered]\");\r\n\t\t\tconsole.log(aleradyHoveredFocusPoint);\r\n\r\n\t\t\tconst focusTitle = focusPoint.getAttribute(\"data-focus-bullet-title\");\r\n\r\n\t\t\tconst focusPointPopupContainer = document.createElement(\"div\");\r\n\t\t\tfocusPointPopupContainer.className = \"focus-point-popup-container\";\r\n\r\n\t\t\tconst focusPointPopupTitle = document.createElement(\"h4\");\r\n\t\t\tfocusPointPopupTitle.textContent = focusTitle;\r\n\t\t\tfocusPointPopupTitle.className = \"focus-point-popup-container__title\";\r\n\r\n\t\t\tfocusPointPopupContainer.appendChild(focusPointPopupTitle);\r\n\t\t\tfocusPoint.appendChild(focusPointPopupContainer);\r\n\t\t\tfocusPoint.setAttribute(\"data-hovered\", \"\");\r\n\t\t});\r\n\r\n\t\tfocusPoint.addEventListener(\"mouseout\", function () {\r\n\t\t\tconst focusPointPopupContainer = focusPoint.querySelector(\r\n\t\t\t\t\".focus-point-popup-container\"\r\n\t\t\t);\r\n\t\t\tfocusPointPopupContainer.remove();\r\n\t\t});\r\n\t});\r\n});\r\n"],"names":["window","addEventListener","event","focusBulletPoints","document","querySelectorAll","forEach","focusPoint","focusPointsContainer","parentElement","aleradyHoveredFocusPoint","querySelector","console","log","focusTitle","getAttribute","focusPointPopupContainer","createElement","className","focusPointPopupTitle","textContent","appendChild","setAttribute","remove"],"sourceRoot":""}
|
||||
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-notices'), 'version' => '7031e5ac408038627d43');
|
||||
<?php return array('dependencies' => array('wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'e63645d5b16e12b63e0d');
|
||||
|
|
|
|||
|
|
@ -1,11 +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 ***!
|
||||
\****************************************************************************************************************************************************************************************************************************************/
|
||||
/**
|
||||
* The following styles get applied inside the editor only.
|
||||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
.homegrade-blocks-focused-schema .block-editor-block-list__layout,
|
||||
.homegrade-blocks-focused-schema .block-editor-block-list__block {
|
||||
position: unset;
|
||||
|
|
@ -37,6 +32,10 @@
|
|||
position: absolute !important;
|
||||
}
|
||||
|
||||
.homegrade-blocks-focus-point-caption {
|
||||
position: relative !important;
|
||||
}
|
||||
|
||||
.components-panel__body .homegrade-blocks-focus-point-bullet {
|
||||
position: static !important;
|
||||
margin-top: -16px;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AAMC;;EAEC;AAAF;;AAGA;EACC;AAAD;AAEE;EACC;EACA;EACA;EACA;EACA;EACA;AAAH;AAEE;EACC;AAAH,C;;;;ACvBA;;;;EAAA;AAKA;EACC;AACD;;AAEA;EACC;EACA;EACA;AACD,C","sources":["webpack://multiblocks/./src/editor.scss","webpack://multiblocks/./src/focus-point/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.homegrade-blocks-focused-schema {\n\t.block-editor-block-list__layout,\n\t.block-editor-block-list__block {\n\t\tposition: unset;\n\t}\n}\n.wpblock-cover-container {\n\tposition: relative;\n\t&.is-loading {\n\t\t.components-spinner {\n\t\t\tposition: absolute;\n\t\t\tleft: 50%;\n\t\t\tright: 50%;\n\t\t\tbottom: 0;\n\t\t\ttop: 0;\n\t\t\tmargin: auto;\n\t\t}\n\t\timg {\n\t\t\topacity: 10%;\n\t\t}\n\t}\n}\n","/**\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.homegrade-blocks-focus-point {\n\tposition: absolute !important;\n}\n\n.components-panel__body .homegrade-blocks-focus-point-bullet {\n\tposition: static !important;\n\tmargin-top: -16px;\n\tmargin-bottom: 10px;\n}\n"],"names":[],"sourceRoot":""}
|
||||
{"version":3,"file":"index.css","mappings":";;;AACC;;EAEC;AAAF;;AAIA;EACC;AADD;AAGE;EACC;EACA;EACA;EACA;EACA;EACA;AADH;AAGE;EACC;AADH,C;;;;AClBA;;;;EAAA;AAKA;EACC;AACD;;AACA;EACC;AAED;;AAAA;EACC;EACA;EACA;AAGD,C","sources":["webpack://multiblocks/./src/editor.scss","webpack://multiblocks/./src/focus-point/editor.scss"],"sourcesContent":[".homegrade-blocks-focused-schema {\n\t.block-editor-block-list__layout,\n\t.block-editor-block-list__block {\n\t\tposition: unset;\n\t}\n}\n\n.wpblock-cover-container {\n\tposition: relative;\n\t&.is-loading {\n\t\t.components-spinner {\n\t\t\tposition: absolute;\n\t\t\tleft: 50%;\n\t\t\tright: 50%;\n\t\t\tbottom: 0;\n\t\t\ttop: 0;\n\t\t\tmargin: auto;\n\t\t}\n\t\timg {\n\t\t\topacity: 10%;\n\t\t}\n\t}\n}\n","/**\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.homegrade-blocks-focus-point {\n\tposition: absolute !important;\n}\n.homegrade-blocks-focus-point-caption {\n\tposition: relative !important;\n}\n.components-panel__body .homegrade-blocks-focus-point-bullet {\n\tposition: static !important;\n\tmargin-top: -16px;\n\tmargin-bottom: 10px;\n}\n"],"names":[],"sourceRoot":""}
|
||||
|
|
@ -55,6 +55,9 @@ function Edit({
|
|||
focusBullets
|
||||
} = attributes;
|
||||
const [blobUrl, setBlobUrl] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)();
|
||||
const currentBlockDatas = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useSelect)(select => {
|
||||
return select("core/block-editor").getBlocksByClientId(clientId)[0];
|
||||
});
|
||||
let children = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useSelect)(select => select("core/block-editor").getBlocksByClientId(clientId)[0].innerBlocks);
|
||||
function onUploadError(message) {
|
||||
noticeOperations.removeAllNotices(); // Remove all previous notices
|
||||
|
|
@ -120,12 +123,9 @@ function Edit({
|
|||
(0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.dispatch)("core/block-editor").insertBlocks(newBlock, index, clientId);
|
||||
}
|
||||
function handleBulletClick(index) {
|
||||
const editor = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.select)("core/block-editor");
|
||||
const innerBlocks = editor.getBlocks(attributes.clientId)[0].innerBlocks;
|
||||
console.log(innerBlocks);
|
||||
if (innerBlocks && innerBlocks[index]) {
|
||||
const bulletBlock = editor.getBlocks(attributes.clientId)[0].innerBlocks[index];
|
||||
(0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.dispatch)("core/block-editor").selectBlock(bulletBlock.clientId);
|
||||
if (currentBlockDatas && currentBlockDatas.innerBlocks) {
|
||||
console.log(currentBlockDatas.innerBlocks[index].clientId);
|
||||
(0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.dispatch)("core/block-editor").selectBlock(currentBlockDatas.innerBlocks[index].clientId);
|
||||
}
|
||||
}
|
||||
const renderedFocusPointBullets = focusBullets.map((focusBullet, index) => {
|
||||
|
|
@ -137,7 +137,9 @@ function Edit({
|
|||
left: `${focusBullet.x * 100}%`
|
||||
},
|
||||
onClick: () => handleBulletClick(index)
|
||||
}, index + 1);
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", {
|
||||
className: "homegrade-blocks-focus-point-bullet__index"
|
||||
}, index + 1));
|
||||
});
|
||||
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
||||
updateFocusPointBullets();
|
||||
|
|
@ -164,6 +166,9 @@ function Edit({
|
|||
updateFocusPointBullets();
|
||||
passCoverUrlToChildren();
|
||||
}, [children]);
|
||||
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
||||
passIndexToChildren();
|
||||
}, [currentBlockDatas]);
|
||||
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_6__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.PanelBody, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__.Button, {
|
||||
variant: "primary",
|
||||
onClick: () => {
|
||||
|
|
@ -233,15 +238,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* 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 _editor_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./editor.scss */ "./src/focus-point/editor.scss");
|
||||
/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/notices */ "@wordpress/notices");
|
||||
/* harmony import */ var _wordpress_notices__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_notices__WEBPACK_IMPORTED_MODULE_4__);
|
||||
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
||||
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__);
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__);
|
||||
|
||||
|
||||
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__);
|
||||
|
||||
|
||||
|
||||
|
|
@ -276,12 +274,12 @@ function Edit({
|
|||
focusCaptionDescription
|
||||
});
|
||||
}
|
||||
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__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.PanelBody, {
|
||||
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__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.PanelBody, {
|
||||
className: "focus-point-modification-pannel",
|
||||
title: "Gestion du points de focus"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
className: "homegrade-blocks-focus-point-bullet"
|
||||
}, focusIndex), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.TextControl, {
|
||||
}, focusIndex), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.TextControl, {
|
||||
placeholder: "Ins\xE9rer le titre de votre point focus",
|
||||
label: "Titre du point focus",
|
||||
value: focusTitle !== "Légende Sans titre" ? focusTitle : null,
|
||||
|
|
@ -289,14 +287,14 @@ function Edit({
|
|||
onChange: value => {
|
||||
handleChangeTitle(value);
|
||||
}
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.TextareaControl, {
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.TextareaControl, {
|
||||
label: "Description du point focus",
|
||||
value: focusCaptionDescription,
|
||||
rows: 3,
|
||||
onChange: description => {
|
||||
handleChangeCaptionDescription(description);
|
||||
}
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__.FocalPointPicker, {
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__.FocalPointPicker, {
|
||||
url: coverUrl !== null && coverUrl !== void 0 ? coverUrl : null,
|
||||
dimensions: {
|
||||
width: 400,
|
||||
|
|
@ -387,10 +385,7 @@ function save({
|
|||
attributes
|
||||
}) {
|
||||
const {
|
||||
focusTitle,
|
||||
focusPosition,
|
||||
focusCaptionDescription,
|
||||
focusIndex
|
||||
focusCaptionDescription
|
||||
} = attributes;
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("li", {
|
||||
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
||||
|
|
@ -481,7 +476,9 @@ function save({
|
|||
top: `${focusBullet.y * 100}%`,
|
||||
left: `${focusBullet.x * 100}%`
|
||||
}
|
||||
}, index + 1);
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("span", {
|
||||
className: "homegrade-blocks-focus-point-bullet__index"
|
||||
}, index + 1));
|
||||
});
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", {
|
||||
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
||||
|
|
@ -616,16 +613,6 @@ module.exports = window["wp"]["i18n"];
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/notices":
|
||||
/*!*********************************!*\
|
||||
!*** external ["wp","notices"] ***!
|
||||
\*********************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["notices"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/block.json":
|
||||
/*!************************!*\
|
||||
!*** ./src/block.json ***!
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -10,6 +10,34 @@
|
|||
.homegrade-blocks-focused-schema figure {
|
||||
position: relative;
|
||||
}
|
||||
.homegrade-blocks-focused-schema figcaption ol {
|
||||
padding-top: 20px;
|
||||
counter-reset: myOrderedListItemsCounter;
|
||||
}
|
||||
.homegrade-blocks-focused-schema figcaption ol li {
|
||||
list-style-type: none;
|
||||
position: relative;
|
||||
padding: 8px;
|
||||
padding-left: 50px;
|
||||
}
|
||||
.homegrade-blocks-focused-schema figcaption ol li:before {
|
||||
left: 0;
|
||||
top: 0;
|
||||
transform: translateY(3px);
|
||||
position: absolute;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: red;
|
||||
color: white;
|
||||
border-radius: 50%;
|
||||
counter-increment: myOrderedListItemsCounter;
|
||||
content: counter(myOrderedListItemsCounter);
|
||||
margin-right: 0.5em;
|
||||
font-weight: 700;
|
||||
}
|
||||
/*!***************************************************************************************************************************************************************************************************************************************************!*\
|
||||
!*** 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/focus-point/style.scss ***!
|
||||
\***************************************************************************************************************************************************************************************************************************************************/
|
||||
|
|
@ -24,25 +52,27 @@
|
|||
filter: brightness(1.2) hue-rotate(10deg);
|
||||
}
|
||||
|
||||
.homegrade-blocks-focus-point-bullet {
|
||||
background-color: red;
|
||||
.homegrade-blocks-focus-point-bullet__index {
|
||||
border-radius: 50%;
|
||||
font-weight: 700;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
position: absolute !important;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 99;
|
||||
position: relative;
|
||||
color: white;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 16px;
|
||||
transition: scale 0.2s ease-in-out;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.focus-point-popup-container {
|
||||
background-color: white;
|
||||
opacity: 0.9999;
|
||||
border-radius: 14px;
|
||||
padding: 10px;
|
||||
transform: translate(-34%, -110%);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAQC;EACC;AADF,C;;;;ACRA;;;;;EAAA;AAMA;EACC;EACA;AACD;;AACA;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAED;;AAAA;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAGD;AADC;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAGF;AADC;EACC;EACA;AAGF,C","sources":["webpack://multiblocks/./src/style.scss","webpack://multiblocks/./src/focus-point/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.homegrade-blocks-focused-schema {\n\tfigure {\n\t\tposition: relative;\n\t}\n}\n","/**\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.homegrade-blocks-focus-point-bullet:hover {\n\tscale: 1.2;\n\tfilter: brightness(1.2) hue-rotate(10deg);\n}\n.homegrade-blocks-focus-point-bullet {\n\tbackground-color: red;\n\tborder-radius: 50%;\n\twidth: 20px;\n\theight: 20px;\n\tposition: absolute !important;\n\ttop: 0;\n\tleft: 0;\n\tz-index: 99;\n\tcolor: white;\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tpadding: 16px;\n\ttransition: scale 0.2s ease-in-out;\n}\n.focus-point-popup-container {\n\tbackground-color: white;\n\tborder-radius: 14px;\n\tpadding: 10px;\n\ttransform: translate(-34%, -110%);\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\tmax-width: 400px;\n\ttext-align: center;\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);\n\n\t&:after {\n\t\tcontent: \"\";\n\t\tdisplay: block;\n\t\tbackground-color: white;\n\t\tposition: absolute;\n\t\ttop: 100%;\n\t\tleft: 50%;\n\t\twidth: 10px;\n\t\theight: 10px;\n\t\ttransform: translate(-50%, -50%) rotate(45deg);\n\t\tbox-shadow: 4px 4px 4px rgba(0, 0, 0, 0.04);\n\t}\n\t&__title {\n\t\twidth: auto;\n\t\tmin-width: 100px;\n\t}\n}\n"],"names":[],"sourceRoot":""}
|
||||
{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAQC;EACC;AADF;AAIE;EACC;EACA;AAFH;AAIG;EACC;EACA;EACA;EACA;AAFJ;AAIG;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAFJ,C;;;;ACpCA;;;;;EAAA;AAMA;EACC;EACA;AACD;;AAGC;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAAF;;AAIA;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AADD;AAIC;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAFF;AAIC;EACC;EACA;AAFF,C","sources":["webpack://multiblocks/./src/style.scss","webpack://multiblocks/./src/focus-point/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.homegrade-blocks-focused-schema {\n\tfigure {\n\t\tposition: relative;\n\t}\n\tfigcaption {\n\t\tol {\n\t\t\tpadding-top: 20px;\n\t\t\tcounter-reset: myOrderedListItemsCounter;\n\n\t\t\tli {\n\t\t\t\tlist-style-type: none;\n\t\t\t\tposition: relative;\n\t\t\t\tpadding: 8px;\n\t\t\t\tpadding-left: 50px;\n\t\t\t}\n\t\t\tli:before {\n\t\t\t\tleft: 0;\n\t\t\t\ttop: 0;\n\t\t\t\ttransform: translateY(3px);\n\t\t\t\tposition: absolute;\n\t\t\t\twidth: 30px;\n\t\t\t\theight: 30px;\n\t\t\t\tdisplay: flex;\n\t\t\t\tjustify-content: center;\n\t\t\t\talign-items: center;\n\t\t\t\tbackground-color: red;\n\t\t\t\tcolor: white;\n\t\t\t\tborder-radius: 50%;\n\t\t\t\tcounter-increment: myOrderedListItemsCounter;\n\t\t\t\tcontent: counter(myOrderedListItemsCounter);\n\t\t\t\tmargin-right: 0.5em;\n\t\t\t\tfont-weight: 700;\n\t\t\t}\n\t\t}\n\t}\n}\n","/**\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.homegrade-blocks-focus-point-bullet:hover {\n\tscale: 1.2;\n\tfilter: brightness(1.2) hue-rotate(10deg);\n}\n\n.homegrade-blocks-focus-point-bullet {\n\t&__index {\n\t\tborder-radius: 50%;\n\t\tfont-weight: 700;\n\t\twidth: 20px;\n\t\theight: 20px;\n\t\tposition: absolute !important;\n\t\ttop: 0;\n\t\tleft: 0;\n\t\tposition: relative;\n\t\tcolor: white;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\tpadding: 16px;\n\t\ttransition: scale 0.2s ease-in-out;\n\t\tz-index: 1;\n\t\t// display: none;\n\t}\n}\n.focus-point-popup-container {\n\tbackground-color: white;\n\topacity: 0.9999;\n\tborder-radius: 14px;\n\tpadding: 10px;\n\ttransform: translate(-34%, -110%);\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\tmax-width: 400px;\n\ttext-align: center;\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);\n\t// z-index: 99;\n\n\t&:after {\n\t\tcontent: \"\";\n\t\tdisplay: block;\n\t\tbackground-color: white;\n\t\tposition: absolute;\n\t\ttop: 100%;\n\t\tleft: 50%;\n\t\twidth: 10px;\n\t\theight: 10px;\n\t\ttransform: translate(-50%, -50%) rotate(45deg);\n\t\tbox-shadow: 4px 4px 4px rgba(0, 0, 0, 0.04);\n\t}\n\t&__title {\n\t\twidth: auto;\n\t\tmin-width: 100px;\n\t}\n}\n"],"names":[],"sourceRoot":""}
|
||||
|
|
@ -35,6 +35,9 @@ function Edit({
|
|||
}) {
|
||||
const { coverUrl, coverId, coverAlt, focusBullets } = attributes;
|
||||
const [blobUrl, setBlobUrl] = useState();
|
||||
const currentBlockDatas = useSelect((select) => {
|
||||
return select("core/block-editor").getBlocksByClientId(clientId)[0];
|
||||
});
|
||||
|
||||
let children = useSelect(
|
||||
(select) =>
|
||||
|
|
@ -103,7 +106,7 @@ function Edit({
|
|||
setAttributes({ focusBullets });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function insertFocusPointBlock() {
|
||||
const index = children && children.length ? children.length : 0;
|
||||
const newBlock = createBlock("homegrade-content-blocks/focus-point", {});
|
||||
|
|
@ -111,14 +114,11 @@ function Edit({
|
|||
}
|
||||
|
||||
function handleBulletClick(index) {
|
||||
const editor = select("core/block-editor");
|
||||
const innerBlocks = editor.getBlocks(attributes.clientId)[0].innerBlocks;
|
||||
console.log(innerBlocks);
|
||||
if (innerBlocks && innerBlocks[index]) {
|
||||
const bulletBlock = editor.getBlocks(attributes.clientId)[0].innerBlocks[
|
||||
index
|
||||
];
|
||||
dispatch("core/block-editor").selectBlock(bulletBlock.clientId);
|
||||
if (currentBlockDatas && currentBlockDatas.innerBlocks) {
|
||||
console.log(currentBlockDatas.innerBlocks[index].clientId);
|
||||
dispatch("core/block-editor").selectBlock(
|
||||
currentBlockDatas.innerBlocks[index].clientId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +133,9 @@ function Edit({
|
|||
}}
|
||||
onClick={() => handleBulletClick(index)}
|
||||
>
|
||||
{index + 1}
|
||||
<span className="homegrade-blocks-focus-point-bullet__index">
|
||||
{index + 1}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
|
@ -161,6 +163,9 @@ function Edit({
|
|||
updateFocusPointBullets();
|
||||
passCoverUrlToChildren();
|
||||
}, [children]);
|
||||
useEffect(() => {
|
||||
passIndexToChildren();
|
||||
}, [currentBlockDatas]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
/**
|
||||
* The following styles get applied inside the editor only.
|
||||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
.homegrade-blocks-focused-schema {
|
||||
.block-editor-block-list__layout,
|
||||
.block-editor-block-list__block {
|
||||
position: unset;
|
||||
}
|
||||
}
|
||||
|
||||
.wpblock-cover-container {
|
||||
position: relative;
|
||||
&.is-loading {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
import { __ } from "@wordpress/i18n";
|
||||
import { useBlockProps, RichText } from "@wordpress/block-editor";
|
||||
import { useBlockProps } from "@wordpress/block-editor";
|
||||
import "./editor.scss";
|
||||
import { InspectorControls } from "@wordpress/block-editor";
|
||||
import { createErrorNotice, removeNotice } from "@wordpress/notices";
|
||||
import { useDispatch, useSelect } from "@wordpress/data";
|
||||
import { store as noticesStore } from "@wordpress/notices";
|
||||
|
||||
import {
|
||||
PanelBody,
|
||||
FocalPointPicker,
|
||||
|
|
@ -81,18 +79,6 @@ export default function Edit({
|
|||
className: `homegrade-blocks-focus-point-caption`,
|
||||
})}
|
||||
>
|
||||
{/* <div
|
||||
{...useBlockProps({
|
||||
className: `homegrade-blocks-focus-point`,
|
||||
"data-focus-title": focusTitle,
|
||||
style: {
|
||||
top: `${focusPosition.y * 100}%`,
|
||||
left: `${focusPosition.x * 100}%`,
|
||||
},
|
||||
})}
|
||||
>
|
||||
{focusIndex}
|
||||
</div> */}
|
||||
{focusCaptionDescription}
|
||||
</li>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@
|
|||
.homegrade-blocks-focus-point {
|
||||
position: absolute !important;
|
||||
}
|
||||
|
||||
.homegrade-blocks-focus-point-caption {
|
||||
position: relative !important;
|
||||
}
|
||||
.components-panel__body .homegrade-blocks-focus-point-bullet {
|
||||
position: static !important;
|
||||
margin-top: -16px;
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
import { registerBlockType } from "@wordpress/blocks";
|
||||
import "./style.scss";
|
||||
|
||||
import Edit from "./edit";
|
||||
import save from "./save";
|
||||
import metadata from "./block.json";
|
||||
|
||||
registerBlockType(metadata.name, {
|
||||
edit: Edit,
|
||||
save,
|
||||
});
|
||||
|
|
@ -1,26 +1,13 @@
|
|||
import { useBlockProps, RichText, InnerBlocks } from "@wordpress/block-editor";
|
||||
|
||||
export default function save({ attributes }) {
|
||||
const { focusTitle, focusPosition, focusCaptionDescription, focusIndex } =
|
||||
attributes;
|
||||
const { focusCaptionDescription } = attributes;
|
||||
return (
|
||||
<li
|
||||
{...useBlockProps.save({
|
||||
className: `homegrade-blocks-focus-point-caption`,
|
||||
})}
|
||||
>
|
||||
{/* <div
|
||||
{...useBlockProps({
|
||||
className: `homegrade-blocks-focus-point`,
|
||||
"data-focus-title": focusTitle,
|
||||
style: {
|
||||
top: `${focusPosition.y * 100}%`,
|
||||
left: `${focusPosition.x * 100}%`,
|
||||
},
|
||||
})}
|
||||
>
|
||||
{focusIndex}
|
||||
</div> */}
|
||||
{focusCaptionDescription}
|
||||
</li>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -8,24 +8,30 @@
|
|||
scale: 1.2;
|
||||
filter: brightness(1.2) hue-rotate(10deg);
|
||||
}
|
||||
|
||||
.homegrade-blocks-focus-point-bullet {
|
||||
background-color: red;
|
||||
border-radius: 50%;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
position: absolute !important;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 99;
|
||||
color: white;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 16px;
|
||||
transition: scale 0.2s ease-in-out;
|
||||
&__index {
|
||||
border-radius: 50%;
|
||||
font-weight: 700;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
position: absolute !important;
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: relative;
|
||||
color: white;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 16px;
|
||||
transition: scale 0.2s ease-in-out;
|
||||
z-index: 1;
|
||||
// display: none;
|
||||
}
|
||||
}
|
||||
.focus-point-popup-container {
|
||||
background-color: white;
|
||||
opacity: 0.9999;
|
||||
border-radius: 14px;
|
||||
padding: 10px;
|
||||
transform: translate(-34%, -110%);
|
||||
|
|
@ -38,6 +44,7 @@
|
|||
justify-content: center;
|
||||
align-items: center;
|
||||
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
|
||||
// z-index: 99;
|
||||
|
||||
&:after {
|
||||
content: "";
|
||||
|
|
|
|||
|
|
@ -28,10 +28,7 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
|||
const focusPointPopupContainer = focusPoint.querySelector(
|
||||
".focus-point-popup-container"
|
||||
);
|
||||
// focusPoint.removeAttribute("data-hovered");
|
||||
focusPointPopupContainer.remove();
|
||||
// setTimeout(() => {
|
||||
// }, 200);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@ export default function save({ attributes }) {
|
|||
left: `${focusBullet.x * 100}%`,
|
||||
}}
|
||||
>
|
||||
{index + 1}
|
||||
<span className="homegrade-blocks-focus-point-bullet__index">
|
||||
{index + 1}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,4 +9,35 @@
|
|||
figure {
|
||||
position: relative;
|
||||
}
|
||||
figcaption {
|
||||
ol {
|
||||
padding-top: 20px;
|
||||
counter-reset: myOrderedListItemsCounter;
|
||||
|
||||
li {
|
||||
list-style-type: none;
|
||||
position: relative;
|
||||
padding: 8px;
|
||||
padding-left: 50px;
|
||||
}
|
||||
li:before {
|
||||
left: 0;
|
||||
top: 0;
|
||||
transform: translateY(3px);
|
||||
position: absolute;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: red;
|
||||
color: white;
|
||||
border-radius: 50%;
|
||||
counter-increment: myOrderedListItemsCounter;
|
||||
content: counter(myOrderedListItemsCounter);
|
||||
margin-right: 0.5em;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,12 @@
|
|||
"selector": "h3"
|
||||
},
|
||||
"iconName": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"default": "key"
|
||||
},
|
||||
"hasTitle": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.2 KiB |
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '2c95489ed841645d986f');
|
||||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'd1752e8f3a4f050f9e8a');
|
||||
|
|
|
|||
|
|
@ -179,12 +179,10 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/* harmony import */ var _img_icon_block_chain_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./img/icon_block_chain.svg */ "./src/img/icon_block_chain.svg");
|
||||
/* harmony import */ var _img_icon_house_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./img/icon_house.svg */ "./src/img/icon_house.svg");
|
||||
/* harmony import */ var _img_icon_bulb_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./img/icon_bulb.svg */ "./src/img/icon_bulb.svg");
|
||||
/* harmony import */ var _img_icon_feather_key_png__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./img/icon_feather_key.png */ "./src/img/icon_feather_key.png");
|
||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
|
||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_8__);
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__);
|
||||
|
||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
|
||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__);
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__);
|
||||
|
||||
|
||||
|
||||
|
|
@ -200,7 +198,8 @@ function Edit({
|
|||
}) {
|
||||
const {
|
||||
title,
|
||||
iconName
|
||||
iconName,
|
||||
hasTitle
|
||||
} = attributes;
|
||||
const handleIconChange = newIconName => {
|
||||
setAttributes({
|
||||
|
|
@ -231,41 +230,53 @@ function Edit({
|
|||
return "lightbulb";
|
||||
}
|
||||
}
|
||||
function onHasTitleChange() {
|
||||
setAttributes({
|
||||
hasTitle: !hasTitle,
|
||||
title: undefined
|
||||
});
|
||||
}
|
||||
let iconPicture = getIconPicture();
|
||||
let iconDashiconSymbol = getDashiconSymbol();
|
||||
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)("section", {
|
||||
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_8__.useBlockProps)({
|
||||
className: `homegrade-blocks-highlight`
|
||||
})
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_8__.BlockControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__.ToolbarButton, {
|
||||
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_7__.InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.PanelBody, {
|
||||
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Titre", "homegrade-blocks__texte-fonctionnel"),
|
||||
initialOpen: true
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.ToggleControl, {
|
||||
label: "Afficher le titre",
|
||||
checked: hasTitle,
|
||||
onChange: onHasTitleChange
|
||||
}))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.BlockControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.ToolbarButton, {
|
||||
title: "Clé",
|
||||
icon: "admin-network",
|
||||
isActive: iconName === "key",
|
||||
onClick: () => handleIconChange("key")
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__.ToolbarButton, {
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.ToolbarButton, {
|
||||
title: "Lien",
|
||||
icon: "admin-links",
|
||||
isActive: iconName === "chain",
|
||||
onClick: () => handleIconChange("chain")
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__.ToolbarButton, {
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.ToolbarButton, {
|
||||
title: "Homegrade",
|
||||
icon: "admin-home",
|
||||
isActive: iconName === "house",
|
||||
onClick: () => handleIconChange("house")
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__.ToolbarButton, {
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__.ToolbarButton, {
|
||||
title: "Inspiration",
|
||||
icon: "lightbulb",
|
||||
isActive: iconName === "bulb",
|
||||
onClick: () => handleIconChange("bulb")
|
||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", {
|
||||
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.useBlockProps)({
|
||||
className: `homegrade-blocks-highlight`
|
||||
})
|
||||
}, hasTitle && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
className: "homegrade-blocks-highlight__titling"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
className: "icon"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
|
||||
src: iconPicture,
|
||||
alt: ""
|
||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_8__.RichText, {
|
||||
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_8__.useBlockProps)(),
|
||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.RichText, {
|
||||
className: "homegrade-blocks-highlight__block-title",
|
||||
onChange: value => setAttributes({
|
||||
title: value
|
||||
|
|
@ -274,9 +285,9 @@ function Edit({
|
|||
placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Insérez un titre", "homegrade-blocks__texte-fonctionnel"),
|
||||
tagName: "h3",
|
||||
allowedFormats: []
|
||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_8__.InnerBlocks, {
|
||||
allowedBlocks: ["core/list", "core/paragraph", "core/heading", "wpblocks-multiple/nested-children"],
|
||||
template: [["core/paragraph"], ["core/list"]]
|
||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_7__.InnerBlocks, {
|
||||
allowedBlocks: ["core/paragraph", "core/list", "core/buttons", "core/button", "core/colums", "core/colum", "homegrade-content-blocks/content-heading"],
|
||||
template: [["core/paragraph"]]
|
||||
})));
|
||||
}
|
||||
|
||||
|
|
@ -309,22 +320,11 @@ __webpack_require__.r(__webpack_exports__);
|
|||
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_6__.name, {
|
||||
icon: {
|
||||
src: (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", {
|
||||
id: "Calque_2",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 80 77.4"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("g", {
|
||||
id: "Layer_1"
|
||||
viewBox: "0 0 24 24"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m80,66.17v-16.1c0-2.3-2.5-3.8-4.5-2.6l-14,8.1c-.9.5-1.5,1.5-1.5,2.6v16.2c0,2.3,2.5,3.8,4.5,2.6l14-8.1c.9-.6,1.5-1.6,1.5-2.7Z"
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m55.7,13.78l-14.2,8.2c-.9.5-2.1.5-3,0l-14.2-8.2c-2-1.2-2-4,0-5.2L38.5.38c.9-.5,2.1-.5,3,0l14.2,8.2c2,1.1,2,4,0,5.2Z"
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m58.7,19.68l-.7.4c-2,1.2-2,4,0,5.2l7.1,4.1c.9.5,1.5,1.5,1.5,2.6v7.6c0,2.3,2.5,3.8,4.5,2.6l.7-.4c.9-.5,1.5-1.5,1.5-2.6v-11c0-1.1-.6-2.1-1.5-2.6l-10.1-5.8c-.9-.6-2.1-.6-3-.1Z"
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m0,66.17v-16.1c0-2.3,2.5-3.8,4.5-2.6l14,8.1c.9.5,1.5,1.5,1.5,2.6v16.2c0,2.3-2.5,3.8-4.5,2.6l-14-8.1c-.9-.6-1.5-1.6-1.5-2.7Z"
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m21.3,19.68l.7.4c2,1.2,2,4,0,5.2l-7.1,4.1c-.9.5-1.5,1.5-1.5,2.6v7.6c0,2.3-2.5,3.8-4.5,2.6l-.7-.4c-.9-.5-1.5-1.5-1.5-2.6v-11.1c0-1.1.6-2.1,1.5-2.6l10.1-5.8c.9-.5,2.1-.5,3,0Z"
|
||||
}))),
|
||||
d: "M8,7h8a1,1,0,0,1,1,1v8a1,1,0,0,1-1,1H8a1,1,0,0,1-1-1V8A1,1,0,0,1,8,7Zm3-5V4h2V2Zm7,0H16V4h2ZM6,4H8V2H6ZM2,2V4L4,2ZM22,4V2H20ZM13,22V20H11v2Zm3,0h2V20H16ZM6,22H8V20H6Zm14-9h2V11H20Zm0,5h2V16H20ZM20,8h2V6H20ZM4,11H2v2H4Zm0,5H2v2H4ZM4,6H2V8H4ZM2,20v2H4Zm20,2V20l-2,2Z"
|
||||
})),
|
||||
foreground: "#DF1E1E"
|
||||
},
|
||||
edit: _edit__WEBPACK_IMPORTED_MODULE_4__["default"],
|
||||
|
|
@ -369,7 +369,8 @@ function save({
|
|||
}) {
|
||||
const {
|
||||
title,
|
||||
iconName
|
||||
iconName,
|
||||
hasTitle
|
||||
} = attributes;
|
||||
function getIconPicture() {
|
||||
switch (iconName) {
|
||||
|
|
@ -386,9 +387,9 @@ function save({
|
|||
let iconPicture = getIconPicture();
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", {
|
||||
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps.save({
|
||||
className: `homegrade-blocks-highlight test-de-classe`
|
||||
className: `homegrade-blocks-highlight`
|
||||
})
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
}, hasTitle && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
className: "homegrade-blocks-highlight__titling"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
|
||||
className: "icon"
|
||||
|
|
@ -427,16 +428,6 @@ __webpack_require__.r(__webpack_exports__);
|
|||
// extracted by mini-css-extract-plugin
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/img/icon_feather_key.png":
|
||||
/*!**************************************!*\
|
||||
!*** ./src/img/icon_feather_key.png ***!
|
||||
\**************************************/
|
||||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||||
|
||||
module.exports = __webpack_require__.p + "images/icon_feather_key.26c1f367.png";
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "react":
|
||||
|
|
@ -515,7 +506,7 @@ module.exports = window["wp"]["i18n"];
|
|||
\************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/highlight","version":"0.1.0","title":"Mise en avant","category":"homegrade-blocks","description":"Bloc pour mettre en avant des informations importantes","supports":{"html":false},"textdomain":"homegrade-blocks__texte-fonctionnel","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"title":{"type":"string","source":"html","selector":"h3"},"iconName":{"type":"string"}}}');
|
||||
module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/highlight","version":"0.1.0","title":"Mise en avant","category":"homegrade-blocks","description":"Bloc pour mettre en avant des informations importantes","supports":{"html":false},"textdomain":"homegrade-blocks__texte-fonctionnel","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","attributes":{"title":{"type":"string","source":"html","selector":"h3"},"iconName":{"type":"string","default":"key"},"hasTitle":{"type":"boolean","default":true}}}');
|
||||
|
||||
/***/ })
|
||||
|
||||
|
|
@ -607,18 +598,6 @@ module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json
|
|||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/global */
|
||||
/******/ (() => {
|
||||
/******/ __webpack_require__.g = (function() {
|
||||
/******/ if (typeof globalThis === 'object') return globalThis;
|
||||
/******/ try {
|
||||
/******/ return this || new Function('return this')();
|
||||
/******/ } catch (e) {
|
||||
/******/ if (typeof window === 'object') return window;
|
||||
/******/ }
|
||||
/******/ })();
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||||
/******/ (() => {
|
||||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
||||
|
|
@ -635,29 +614,6 @@ module.exports = JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json
|
|||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/publicPath */
|
||||
/******/ (() => {
|
||||
/******/ var scriptUrl;
|
||||
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
||||
/******/ var document = __webpack_require__.g.document;
|
||||
/******/ if (!scriptUrl && document) {
|
||||
/******/ if (document.currentScript)
|
||||
/******/ scriptUrl = document.currentScript.src;
|
||||
/******/ if (!scriptUrl) {
|
||||
/******/ var scripts = document.getElementsByTagName("script");
|
||||
/******/ if(scripts.length) {
|
||||
/******/ var i = scripts.length - 1;
|
||||
/******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
||||
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
||||
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
||||
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
||||
/******/ __webpack_require__.p = scriptUrl;
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/jsonp chunk loading */
|
||||
/******/ (() => {
|
||||
/******/ // no baseURI
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -7,9 +7,13 @@
|
|||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
.homegrade-blocks-highlight__block-title {
|
||||
margin: 0 !important;
|
||||
}
|
||||
.homegrade-blocks-highlight__titling {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.homegrade-blocks-highlight__titling .icon {
|
||||
background-color: black;
|
||||
|
|
@ -31,11 +35,6 @@
|
|||
.homegrade-blocks-highlight__titling h3 {
|
||||
padding-left: 10px;
|
||||
}
|
||||
.homegrade-blocks-highlight ul li {
|
||||
list-style-type: disc;
|
||||
list-style-position: inside;
|
||||
margin-left: 1.5em;
|
||||
}
|
||||
.homegrade-blocks-highlight p + ul {
|
||||
padding-top: 16px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAQC;EACC;EACA;AADF;AAEE;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAAH;AAEG;EACC;EACA;EACA;EACA;AAAJ;AAGE;EACC;AADH;AAKC;EACC;EACA;EAEA;AAJF;AAOC;EACC;AALF;AAOC;EACC;AALF,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.homegrade-blocks-highlight {\n\t&__titling {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\t.icon {\n\t\t\tbackground-color: black;\n\t\t\tborder-radius: 50%;\n\t\t\taspect-ratio: 1/1;\n\t\t\twidth: 40px;\n\t\t\theight: 40px;\n\t\t\tpadding: 10px;\n\t\t\tdisplay: flex;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\n\t\t\timg {\n\t\t\t\twidth: 30px;\n\t\t\t\tmax-width: 80%;\n\t\t\t\tmax-height: 100%;\n\t\t\t\theight: auto;\n\t\t\t}\n\t\t}\n\t\th3 {\n\t\t\tpadding-left: 10px;\n\t\t}\n\t}\n\n\tul li {\n\t\tlist-style-type: disc;\n\t\tlist-style-position: inside;\n\t\t// display: flex;\n\t\tmargin-left: 1.5em;\n\t}\n\n\tp + ul {\n\t\tpadding-top: 16px;\n\t}\n\tul + p {\n\t\tpadding-top: 16px;\n\t}\n}\n"],"names":[],"sourceRoot":""}
|
||||
{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAQC;EACC;AADF;AAGC;EACC;EACA;EACA;AADF;AAEE;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAAH;AAEG;EACC;EACA;EACA;EACA;AAAJ;AAGE;EACC;AADH;AAWC;EACC;AATF;AAWC;EACC;AATF,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.homegrade-blocks-highlight {\n\t&__block-title {\n\t\tmargin: 0 !important;\n\t}\n\t&__titling {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tmargin-bottom: 20px;\n\t\t.icon {\n\t\t\tbackground-color: black;\n\t\t\tborder-radius: 50%;\n\t\t\taspect-ratio: 1/1;\n\t\t\twidth: 40px;\n\t\t\theight: 40px;\n\t\t\tpadding: 10px;\n\t\t\tdisplay: flex;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\n\t\t\timg {\n\t\t\t\twidth: 30px;\n\t\t\t\tmax-width: 80%;\n\t\t\t\tmax-height: 100%;\n\t\t\t\theight: auto;\n\t\t\t}\n\t\t}\n\t\th3 {\n\t\t\tpadding-left: 10px;\n\t\t}\n\t}\n\n\t// ul li {\n\t// \tlist-style-type: disc;\n\t// \tlist-style-position: inside;\n\t// \tmargin-left: 1.5em;\n\t// }\n\n\tp + ul {\n\t\tpadding-top: 16px;\n\t}\n\tul + p {\n\t\tpadding-top: 16px;\n\t}\n}\n"],"names":[],"sourceRoot":""}
|
||||
|
|
@ -20,7 +20,12 @@
|
|||
"selector": "h3"
|
||||
},
|
||||
"iconName": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"default": "key"
|
||||
},
|
||||
"hasTitle": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,21 +4,18 @@ import keyIcon from "./img/icon_feather_key.svg";
|
|||
import chainIcon from "./img/icon_block_chain.svg";
|
||||
import houseIcon from "./img/icon_house.svg";
|
||||
import bulbIcon from "./img/icon_bulb.svg";
|
||||
|
||||
import { ReactComponent as SvgIcon } from "./img/icon_feather_key.png";
|
||||
|
||||
import {
|
||||
RichText,
|
||||
useBlockProps,
|
||||
BlockControls,
|
||||
ToolbarGroup,
|
||||
InnerBlocks,
|
||||
InspectorControls,
|
||||
} from "@wordpress/block-editor";
|
||||
|
||||
import { ToolbarDropdownMenu, ToolbarButton } from "@wordpress/components";
|
||||
import { ToolbarButton, ToggleControl, PanelBody } from "@wordpress/components";
|
||||
|
||||
export default function Edit({ attributes, setAttributes }) {
|
||||
const { title, iconName } = attributes;
|
||||
const { title, iconName, hasTitle } = attributes;
|
||||
|
||||
const handleIconChange = (newIconName) => {
|
||||
setAttributes({ iconName: newIconName });
|
||||
|
|
@ -53,107 +50,91 @@ export default function Edit({ attributes, setAttributes }) {
|
|||
return "lightbulb";
|
||||
}
|
||||
}
|
||||
function onHasTitleChange() {
|
||||
setAttributes({
|
||||
hasTitle: !hasTitle,
|
||||
title: undefined,
|
||||
});
|
||||
}
|
||||
|
||||
let iconPicture = getIconPicture();
|
||||
let iconDashiconSymbol = getDashiconSymbol();
|
||||
|
||||
return (
|
||||
<>
|
||||
<InspectorControls>
|
||||
<PanelBody
|
||||
title={__("Titre", "homegrade-blocks__texte-fonctionnel")}
|
||||
initialOpen={true}
|
||||
>
|
||||
<ToggleControl
|
||||
label="Afficher le titre"
|
||||
checked={hasTitle}
|
||||
onChange={onHasTitleChange}
|
||||
/>
|
||||
</PanelBody>
|
||||
</InspectorControls>
|
||||
<BlockControls>
|
||||
<ToolbarButton
|
||||
title={"Clé"}
|
||||
icon={"admin-network"}
|
||||
isActive={iconName === "key"}
|
||||
onClick={() => handleIconChange("key")}
|
||||
/>
|
||||
<ToolbarButton
|
||||
title={"Lien"}
|
||||
icon={"admin-links"}
|
||||
isActive={iconName === "chain"}
|
||||
onClick={() => handleIconChange("chain")}
|
||||
/>
|
||||
<ToolbarButton
|
||||
title={"Homegrade"}
|
||||
icon={"admin-home"}
|
||||
isActive={iconName === "house"}
|
||||
onClick={() => handleIconChange("house")}
|
||||
/>
|
||||
<ToolbarButton
|
||||
title={"Inspiration"}
|
||||
icon={"lightbulb"}
|
||||
isActive={iconName === "bulb"}
|
||||
onClick={() => handleIconChange("bulb")}
|
||||
/>
|
||||
</BlockControls>
|
||||
<section
|
||||
{...useBlockProps({
|
||||
className: `homegrade-blocks-highlight`,
|
||||
})}
|
||||
>
|
||||
<BlockControls>
|
||||
<ToolbarButton
|
||||
title={"Clé"}
|
||||
icon={"admin-network"}
|
||||
isActive={iconName === "key"}
|
||||
onClick={() => handleIconChange("key")}
|
||||
/>
|
||||
<ToolbarButton
|
||||
title={"Lien"}
|
||||
icon={"admin-links"}
|
||||
isActive={iconName === "chain"}
|
||||
onClick={() => handleIconChange("chain")}
|
||||
/>
|
||||
<ToolbarButton
|
||||
title={"Homegrade"}
|
||||
icon={"admin-home"}
|
||||
isActive={iconName === "house"}
|
||||
onClick={() => handleIconChange("house")}
|
||||
/>
|
||||
<ToolbarButton
|
||||
title={"Inspiration"}
|
||||
icon={"lightbulb"}
|
||||
isActive={iconName === "bulb"}
|
||||
onClick={() => handleIconChange("bulb")}
|
||||
/>
|
||||
{/* <ToolbarDropdownMenu
|
||||
label="Icone"
|
||||
icon={iconDashiconSymbol}
|
||||
controls={[
|
||||
{
|
||||
title: "Clé",
|
||||
icon: "admin-network",
|
||||
isActive: false,
|
||||
onClick: () => {
|
||||
handleIconChange("key");
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Lien",
|
||||
icon: "admin-links",
|
||||
isActive: true,
|
||||
onClick: () => {
|
||||
handleIconChange("chain");
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Homegrade",
|
||||
icon: "admin-home",
|
||||
isActive: false,
|
||||
onClick: () => {
|
||||
handleIconChange("house");
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Inspiration",
|
||||
icon: "lightbulb",
|
||||
isActive: false,
|
||||
onClick: () => {
|
||||
handleIconChange("bulb");
|
||||
},
|
||||
},
|
||||
]}
|
||||
/> */}
|
||||
</BlockControls>
|
||||
<div className="homegrade-blocks-highlight__titling">
|
||||
<div className="icon">
|
||||
<img src={iconPicture} alt="" />
|
||||
{hasTitle && (
|
||||
<div className="homegrade-blocks-highlight__titling">
|
||||
<div className="icon">
|
||||
<img src={iconPicture} alt="" />
|
||||
</div>
|
||||
<RichText
|
||||
className="homegrade-blocks-highlight__block-title"
|
||||
onChange={(value) => setAttributes({ title: value })}
|
||||
value={title}
|
||||
placeholder={__(
|
||||
"Insérez un titre",
|
||||
"homegrade-blocks__texte-fonctionnel"
|
||||
)}
|
||||
tagName="h3"
|
||||
allowedFormats={[]}
|
||||
/>
|
||||
</div>
|
||||
<RichText
|
||||
{...useBlockProps()}
|
||||
className="homegrade-blocks-highlight__block-title"
|
||||
onChange={(value) => setAttributes({ title: value })}
|
||||
value={title}
|
||||
placeholder={__(
|
||||
"Insérez un titre",
|
||||
"homegrade-blocks__texte-fonctionnel"
|
||||
)}
|
||||
tagName="h3"
|
||||
allowedFormats={[]}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<InnerBlocks
|
||||
allowedBlocks={[
|
||||
"core/list",
|
||||
"core/paragraph",
|
||||
"core/heading",
|
||||
"wpblocks-multiple/nested-children",
|
||||
"core/list",
|
||||
"core/buttons",
|
||||
"core/button",
|
||||
"core/colums",
|
||||
"core/colum",
|
||||
"homegrade-content-blocks/content-heading",
|
||||
]}
|
||||
template={[["core/paragraph"], ["core/list"]]}
|
||||
template={[["core/paragraph"]]}
|
||||
/>
|
||||
</section>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -9,18 +9,8 @@ import metadata from "./block.json";
|
|||
registerBlockType(metadata.name, {
|
||||
icon: {
|
||||
src: (
|
||||
<svg
|
||||
id="Calque_2"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 80 77.4"
|
||||
>
|
||||
<g id="Layer_1">
|
||||
<path d="m80,66.17v-16.1c0-2.3-2.5-3.8-4.5-2.6l-14,8.1c-.9.5-1.5,1.5-1.5,2.6v16.2c0,2.3,2.5,3.8,4.5,2.6l14-8.1c.9-.6,1.5-1.6,1.5-2.7Z" />
|
||||
<path d="m55.7,13.78l-14.2,8.2c-.9.5-2.1.5-3,0l-14.2-8.2c-2-1.2-2-4,0-5.2L38.5.38c.9-.5,2.1-.5,3,0l14.2,8.2c2,1.1,2,4,0,5.2Z" />
|
||||
<path d="m58.7,19.68l-.7.4c-2,1.2-2,4,0,5.2l7.1,4.1c.9.5,1.5,1.5,1.5,2.6v7.6c0,2.3,2.5,3.8,4.5,2.6l.7-.4c.9-.5,1.5-1.5,1.5-2.6v-11c0-1.1-.6-2.1-1.5-2.6l-10.1-5.8c-.9-.6-2.1-.6-3-.1Z" />
|
||||
<path d="m0,66.17v-16.1c0-2.3,2.5-3.8,4.5-2.6l14,8.1c.9.5,1.5,1.5,1.5,2.6v16.2c0,2.3-2.5,3.8-4.5,2.6l-14-8.1c-.9-.6-1.5-1.6-1.5-2.7Z" />
|
||||
<path d="m21.3,19.68l.7.4c2,1.2,2,4,0,5.2l-7.1,4.1c-.9.5-1.5,1.5-1.5,2.6v7.6c0,2.3-2.5,3.8-4.5,2.6l-.7-.4c-.9-.5-1.5-1.5-1.5-2.6v-11.1c0-1.1.6-2.1,1.5-2.6l10.1-5.8c.9-.5,2.1-.5,3,0Z" />
|
||||
</g>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M8,7h8a1,1,0,0,1,1,1v8a1,1,0,0,1-1,1H8a1,1,0,0,1-1-1V8A1,1,0,0,1,8,7Zm3-5V4h2V2Zm7,0H16V4h2ZM6,4H8V2H6ZM2,2V4L4,2ZM22,4V2H20ZM13,22V20H11v2Zm3,0h2V20H16ZM6,22H8V20H6Zm14-9h2V11H20Zm0,5h2V16H20ZM20,8h2V6H20ZM4,11H2v2H4Zm0,5H2v2H4ZM4,6H2V8H4ZM2,20v2H4Zm20,2V20l-2,2Z" />
|
||||
</svg>
|
||||
),
|
||||
foreground: "#DF1E1E",
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import houseIcon from "./img/icon_house.svg";
|
|||
import bulbIcon from "./img/icon_bulb.svg";
|
||||
|
||||
export default function save({ attributes, setAttributes }) {
|
||||
const { title, iconName } = attributes;
|
||||
const { title, iconName, hasTitle } = attributes;
|
||||
function getIconPicture() {
|
||||
switch (iconName) {
|
||||
case "key":
|
||||
|
|
@ -28,19 +28,22 @@ export default function save({ attributes, setAttributes }) {
|
|||
return (
|
||||
<section
|
||||
{...useBlockProps.save({
|
||||
className: `homegrade-blocks-highlight test-de-classe`,
|
||||
className: `homegrade-blocks-highlight`,
|
||||
})}
|
||||
>
|
||||
<div className="homegrade-blocks-highlight__titling">
|
||||
<div className="icon">
|
||||
<img clas src={iconPicture} alt="" />
|
||||
{hasTitle && (
|
||||
<div className="homegrade-blocks-highlight__titling">
|
||||
<div className="icon">
|
||||
<img clas src={iconPicture} alt="" />
|
||||
</div>
|
||||
|
||||
<RichText.Content
|
||||
tagName="h3"
|
||||
value={title}
|
||||
className="homegrade-blocks-highlight__block-title"
|
||||
/>
|
||||
</div>
|
||||
<RichText.Content
|
||||
tagName="h3"
|
||||
value={title}
|
||||
className="homegrade-blocks-highlight__block-title"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<InnerBlocks.Content />
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -6,9 +6,13 @@
|
|||
*/
|
||||
|
||||
.homegrade-blocks-highlight {
|
||||
&__block-title {
|
||||
margin: 0 !important;
|
||||
}
|
||||
&__titling {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
.icon {
|
||||
background-color: black;
|
||||
border-radius: 50%;
|
||||
|
|
@ -32,12 +36,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
ul li {
|
||||
list-style-type: disc;
|
||||
list-style-position: inside;
|
||||
// display: flex;
|
||||
margin-left: 1.5em;
|
||||
}
|
||||
// ul li {
|
||||
// list-style-type: disc;
|
||||
// list-style-position: inside;
|
||||
// margin-left: 1.5em;
|
||||
// }
|
||||
|
||||
p + ul {
|
||||
padding-top: 16px;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'c5529e2e38b9f9dbaf49');
|
||||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'b5d480ecf0e594c0f1b6');
|
||||
|
|
|
|||
|
|
@ -110,22 +110,31 @@ __webpack_require__.r(__webpack_exports__);
|
|||
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_6__.name, {
|
||||
icon: {
|
||||
src: (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("svg", {
|
||||
id: "Calque_2",
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 80 77.4"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("g", {
|
||||
id: "Layer_1"
|
||||
}, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m80,66.17v-16.1c0-2.3-2.5-3.8-4.5-2.6l-14,8.1c-.9.5-1.5,1.5-1.5,2.6v16.2c0,2.3,2.5,3.8,4.5,2.6l14-8.1c.9-.6,1.5-1.6,1.5-2.7Z"
|
||||
id: "Capa_1",
|
||||
"enable-background": "new 0 0 512 512",
|
||||
height: "512",
|
||||
viewBox: "0 0 512 512",
|
||||
width: "512",
|
||||
xmlns: "http://www.w3.org/2000/svg"
|
||||
}, (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)("g", null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m0 0h114.076v114.113h-114.076z"
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m55.7,13.78l-14.2,8.2c-.9.5-2.1.5-3,0l-14.2-8.2c-2-1.2-2-4,0-5.2L38.5.38c.9-.5,2.1-.5,3,0l14.2,8.2c2,1.1,2,4,0,5.2Z"
|
||||
d: "m144.076 42.591h235.232v71.521h-235.232z"
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m58.7,19.68l-.7.4c-2,1.2-2,4,0,5.2l7.1,4.1c.9.5,1.5,1.5,1.5,2.6v7.6c0,2.3,2.5,3.8,4.5,2.6l.7-.4c.9-.5,1.5-1.5,1.5-2.6v-11c0-1.1-.6-2.1-1.5-2.6l-10.1-5.8c-.9-.6-2.1-.6-3-.1Z"
|
||||
d: "m409.309 114.113h66.92l35.771-35.75-35.771-35.772h-66.92z"
|
||||
})), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("g", null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m0 397.887h114.076v114.113h-114.076z"
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m0,66.17v-16.1c0-2.3,2.5-3.8,4.5-2.6l14,8.1c.9.5,1.5,1.5,1.5,2.6v16.2c0,2.3-2.5,3.8-4.5,2.6l-14-8.1c-.9-.6-1.5-1.6-1.5-2.7Z"
|
||||
d: "m144.076 440.479h185.232v71.521h-185.232z"
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m21.3,19.68l.7.4c2,1.2,2,4,0,5.2l-7.1,4.1c-.9.5-1.5,1.5-1.5,2.6v7.6c0,2.3-2.5,3.8-4.5,2.6l-.7-.4c-.9-.5-1.5-1.5-1.5-2.6v-11.1c0-1.1.6-2.1,1.5-2.6l10.1-5.8c.9-.5,2.1-.5,3,0Z"
|
||||
}))),
|
||||
d: "m359.309 512h116.92l35.771-35.75-35.771-35.771h-116.92z"
|
||||
}))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("g", null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m0 198.944h114.076v114.113h-114.076z"
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m144.076 241.535h115.585v71.521h-115.585z"
|
||||
}), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("path", {
|
||||
d: "m289.661 313.056h186.568l35.771-35.749-35.771-35.772h-186.568z"
|
||||
})))),
|
||||
foreground: "#DF1E1E"
|
||||
},
|
||||
edit: _edit__WEBPACK_IMPORTED_MODULE_4__["default"],
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,29 +0,0 @@
|
|||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2,
|
||||
"name": "homegrade-content-blocks/nested-children",
|
||||
"version": "0.1.0",
|
||||
"title": "Nested Children",
|
||||
"category": "homegrade-blocks",
|
||||
"icon": {
|
||||
"background": "#0414eb",
|
||||
"foreground": "#fff",
|
||||
"src": "admin-plugins"
|
||||
},
|
||||
"description": "Children Nested. #ChildrenNested",
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"textdomain": "nested-parent",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css",
|
||||
"attributes": {
|
||||
"userName": {
|
||||
"type": "string"
|
||||
},
|
||||
"userPosition": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n'), 'version' => '0ba084f1ab3181643971');
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"nested-children/index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACC;AAAD,C","sources":["webpack://multiblocks/./src/nested-children/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-blocka {\n\tborder: 1px dotted #f00;\n}\n"],"names":[],"sourceRoot":""}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"nested-children/style-index.css","mappings":";;;AAAA;;;;;EAAA;AAOA;EACC;EACA;EACA;AAAD,C","sources":["webpack://multiblocks/./src/nested-children/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-blocka {\n\tbackground-color: #21759b;\n\tcolor: #fff;\n\tpadding: 2px;\n}\n"],"names":[],"sourceRoot":""}
|
||||
|
|
@ -10,16 +10,31 @@ registerBlockType(metadata.name, {
|
|||
icon: {
|
||||
src: (
|
||||
<svg
|
||||
id="Calque_2"
|
||||
id="Capa_1"
|
||||
enable-background="new 0 0 512 512"
|
||||
height="512"
|
||||
viewBox="0 0 512 512"
|
||||
width="512"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 80 77.4"
|
||||
>
|
||||
<g id="Layer_1">
|
||||
<path d="m80,66.17v-16.1c0-2.3-2.5-3.8-4.5-2.6l-14,8.1c-.9.5-1.5,1.5-1.5,2.6v16.2c0,2.3,2.5,3.8,4.5,2.6l14-8.1c.9-.6,1.5-1.6,1.5-2.7Z" />
|
||||
<path d="m55.7,13.78l-14.2,8.2c-.9.5-2.1.5-3,0l-14.2-8.2c-2-1.2-2-4,0-5.2L38.5.38c.9-.5,2.1-.5,3,0l14.2,8.2c2,1.1,2,4,0,5.2Z" />
|
||||
<path d="m58.7,19.68l-.7.4c-2,1.2-2,4,0,5.2l7.1,4.1c.9.5,1.5,1.5,1.5,2.6v7.6c0,2.3,2.5,3.8,4.5,2.6l.7-.4c.9-.5,1.5-1.5,1.5-2.6v-11c0-1.1-.6-2.1-1.5-2.6l-10.1-5.8c-.9-.6-2.1-.6-3-.1Z" />
|
||||
<path d="m0,66.17v-16.1c0-2.3,2.5-3.8,4.5-2.6l14,8.1c.9.5,1.5,1.5,1.5,2.6v16.2c0,2.3-2.5,3.8-4.5,2.6l-14-8.1c-.9-.6-1.5-1.6-1.5-2.7Z" />
|
||||
<path d="m21.3,19.68l.7.4c2,1.2,2,4,0,5.2l-7.1,4.1c-.9.5-1.5,1.5-1.5,2.6v7.6c0,2.3-2.5,3.8-4.5,2.6l-.7-.4c-.9-.5-1.5-1.5-1.5-2.6v-11.1c0-1.1.6-2.1,1.5-2.6l10.1-5.8c.9-.5,2.1-.5,3,0Z" />
|
||||
<g>
|
||||
<g>
|
||||
<g>
|
||||
<path d="m0 0h114.076v114.113h-114.076z" />
|
||||
<path d="m144.076 42.591h235.232v71.521h-235.232z" />
|
||||
<path d="m409.309 114.113h66.92l35.771-35.75-35.771-35.772h-66.92z" />
|
||||
</g>
|
||||
<g>
|
||||
<path d="m0 397.887h114.076v114.113h-114.076z" />
|
||||
<path d="m144.076 440.479h185.232v71.521h-185.232z" />
|
||||
<path d="m359.309 512h116.92l35.771-35.75-35.771-35.771h-116.92z" />
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<path d="m0 198.944h114.076v114.113h-114.076z" />
|
||||
<path d="m144.076 241.535h115.585v71.521h-115.585z" />
|
||||
<path d="m289.661 313.056h186.568l35.771-35.749-35.771-35.772h-186.568z" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '4da44f9f4582d3fdcce4');
|
||||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'b40a3d19c7b63765015f');
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACC;AAAD,C","sources":["webpack://vocabulaire-summary/./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":""}
|
||||
|
|
@ -129,6 +129,9 @@ function Edit({
|
|||
});
|
||||
return filteredTooltipWords;
|
||||
}
|
||||
function compareHasNewVocabularyWord(previousWords, newWords) {
|
||||
return !(JSON.stringify(previousWords) === JSON.stringify(newWords));
|
||||
}
|
||||
const currentPost = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core/editor").getCurrentPost());
|
||||
const currentTaxonomies = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core/editor").getCurrentPostAttribute("thematiques"));
|
||||
let currentThematique = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core").getEntityRecord("taxonomy", "thematiques", currentTaxonomies[0] // or currentPost.thematiques[0] works as well
|
||||
|
|
@ -136,9 +139,11 @@ function Edit({
|
|||
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
||||
if (currentPost.content) {
|
||||
let newTooltipWords = buildTooltipWords(currentPost.content);
|
||||
setAttributes({
|
||||
tooltipWords: newTooltipWords
|
||||
});
|
||||
if (compareHasNewVocabularyWord(tooltipWords, newTooltipWords)) {
|
||||
setAttributes({
|
||||
tooltipWords: newTooltipWords
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [currentPost]);
|
||||
return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -72,6 +72,9 @@ export default function Edit({ attributes, setAttributes }) {
|
|||
});
|
||||
return filteredTooltipWords;
|
||||
}
|
||||
function compareHasNewVocabularyWord(previousWords, newWords) {
|
||||
return !(JSON.stringify(previousWords) === JSON.stringify(newWords));
|
||||
}
|
||||
|
||||
const currentPost = useSelect((select) =>
|
||||
select("core/editor").getCurrentPost()
|
||||
|
|
@ -94,7 +97,9 @@ export default function Edit({ attributes, setAttributes }) {
|
|||
useEffect(() => {
|
||||
if (currentPost.content) {
|
||||
let newTooltipWords = buildTooltipWords(currentPost.content);
|
||||
setAttributes({ tooltipWords: newTooltipWords });
|
||||
if (compareHasNewVocabularyWord(tooltipWords, newTooltipWords)) {
|
||||
setAttributes({ tooltipWords: newTooltipWords });
|
||||
}
|
||||
}
|
||||
}, [currentPost]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user