Compare commits

...

15 Commits

Author SHA1 Message Date
Antoine M
56dceab6c8 CLEAN Removing unused block include
All checks were successful
continuous-integration/drone/push Build is passing
2025-06-26 17:45:05 +02:00
Antoine M
8887faa3a2 FIX Refining icon 2025-06-26 17:44:36 +02:00
Antoine M
f02facbf9a FIX Refining icon 2025-06-26 17:44:17 +02:00
Antoine M
e4a0b345d6 FEATURE Introducing the component 2025-06-26 17:44:03 +02:00
Antoine M
5e6f557ff0 FIX Refining icon 2025-06-26 17:43:42 +02:00
Antoine M
8f6b88e27d FIX Refining icon 2025-06-26 17:43:23 +02:00
Antoine M
43b4aa4bb8 DELETE Removing unused article-container 2025-06-26 17:43:04 +02:00
Antoine M
45bac1fd78 DELETE Removing unused questions-container 2025-06-26 17:42:44 +02:00
Antoine M
89f7378dc8 FIX Refining icon 2025-06-26 17:41:59 +02:00
Antoine M
2d779a2640 FIX Refining icon 2025-06-26 17:41:44 +02:00
Antoine M
3d6b360db0 FIX Refining icon 2025-06-26 17:41:33 +02:00
Antoine M
2bc542e03d FIX Refining icon 2025-06-26 17:41:09 +02:00
Antoine M
ea8c7f9d0c REFACTOR Moving post-type declaration into mu-plugins 2025-06-26 17:40:41 +02:00
Antoine M
038a1afac8 FEATURE Refining aspect and passing a tag instead of button for better inline behaviour 2025-06-20 15:14:52 +02:00
Antoine M
509d69ff89 FEATURE Passing grabcursor when interacting with component 2025-06-20 09:29:22 +02:00
102 changed files with 13485 additions and 33610 deletions

View File

@ -0,0 +1,71 @@
<?php
/**
* Plugin Name: Carhop Post Types
* Description: Gestion des post types de carhop
* Author: Antoine M. @ Deligraph
* Text Domain: carhop-post-types
*/
/* ------------------------------------------------
##### POST TYPES
--------------------------------------------------*/
function carhop_create_posttype()
{
$current_site = get_current_blog_id();
if ($current_site !== 1) return;
register_post_type(
'dbmob',
// CPT Options
array(
'labels' => array(
'name' => __('DBMOB'),
'singular_name' => __('DBMOB')
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'dictionnaire'),
'show_in_rest' => true,
'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode('<svg width="96" height="74" viewBox="0 0 96 74" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M86.4 2.2C81.6 0.7 76.3 0 71.3 0C62.9 0 53.8 1.7 47.5 6.5C41.2 1.7 32.2 0 23.8 0C15.4 0 6.3 1.7 0 6.5V69.8C0 70.9 1.1 72 2.2 72C3.3 72 2.8 71.8 3.3 71.8C9.1 69 17.6 67 23.8 67C30 67 41.3 68.7 47.6 73.5C53.4 69.8 64 67 71.4 67C78.8 67 85.9 68.3 91.9 71.5C92.3 71.7 92.5 71.7 93 71.7C94.1 71.7 95.2 70.6 95.2 69.5V6.5C92.6 4.6 89.8 3.3 86.6 2.2H86.4ZM86.4 60.5C81.6 59 76.5 58.3 71.3 58.3C64 58.3 53.4 61.1 47.5 64.8V15.1C53.3 11.4 63.9 8.6 71.3 8.6C78.7 8.6 81.7 9.2 86.4 10.8V60.5Z" fill="black"/></svg>'),
'menu_position' => 5,
'supports' => array('title', 'custom-fields'),
'taxonomies' => array('category'),
)
);
}
add_action('init', 'carhop_create_posttype');
/* ------------------------------------------------
##### CHANGE LE NOM DES POSTS PAR ACTUALITES
--------------------------------------------------*/
function carhop_change_post_object()
{
$current_site = get_current_blog_id();
if ($current_site !== 1) return;
$get_post_type = get_post_type_object('post');
$labels = $get_post_type->labels;
$labels->name = 'Actualités';
$labels->singular_name = 'Actualité';
$labels->add_new = 'Ajouter une actualité';
$labels->add_new_item = 'Ajouter une nouvelle actualité';
$labels->edit_item = 'Editer l\'actualité';
$labels->new_item = 'Actualité';
$labels->view_item = 'Voir l\'actualité';
$labels->search_items = 'Chercher une actualité';
$labels->not_found = 'Pas d\'actualité trouvée';
$labels->not_found_in_trash = 'Pas d\'actualité trouvée dans la corbeille';
$labels->all_items = 'Toutes les actualités';
$labels->menu_name = 'Actualités';
$labels->name_admin_bar = 'Actualités';
// remove_post_type_support('post', 'editor');
unregister_taxonomy_for_object_type('category', 'post');
unregister_taxonomy_for_object_type('post_tag', 'post');
}
add_action('init', 'carhop_change_post_object');

View File

@ -0,0 +1,82 @@
<?php
/**
* Plugin Name: Dynamiques Post Types
* Description: Gestion des post types de dynamiques
* Author: Antoine M. @ Deligraph
* Text Domain: dynamiques-post-types
*/
/* ------------------------------------------------
##### POST TYPES
--------------------------------------------------*/
function dynamiques_create_posttype()
{
$current_site = get_current_blog_id();
if ($current_site !== 2) return;
register_post_type(
'revues',
// CPT Options
array(
'labels' => array(
'name' => __('Revues'),
'singular_name' => __('Revue')
),
'public' => true,
'has_archive' => true,
'show_in_rest' => true,
'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode('<svg width="96" height="74" viewBox="0 0 96 74" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M86.4 2.2C81.6 0.7 76.3 0 71.3 0C62.9 0 53.8 1.7 47.5 6.5C41.2 1.7 32.2 0 23.8 0C15.4 0 6.3 1.7 0 6.5V69.8C0 70.9 1.1 72 2.2 72C3.3 72 2.8 71.8 3.3 71.8C9.1 69 17.6 67 23.8 67C30 67 41.3 68.7 47.6 73.5C53.4 69.8 64 67 71.4 67C78.8 67 85.9 68.3 91.9 71.5C92.3 71.7 92.5 71.7 93 71.7C94.1 71.7 95.2 70.6 95.2 69.5V6.5C92.6 4.6 89.8 3.3 86.6 2.2H86.4ZM86.4 60.5C81.6 59 76.5 58.3 71.3 58.3C64 58.3 53.4 61.1 47.5 64.8V15.1C53.3 11.4 63.9 8.6 71.3 8.6C78.7 8.6 81.7 9.2 86.4 10.8V60.5Z" fill="black"/></svg>'),
'menu_position' => 4,
'supports' => array(
'title',
'thumbnail',
'excerpt',
'custom-fields',
'revisions',
'author',
),
)
);
register_post_type(
'articles',
// CPT Options
array(
'labels' => array(
'name' => __('Articles'),
'singular_name' => __('Articles')
),
'public' => true,
'has_archive' => true,
'show_in_rest' => true,
'menu_icon' => 'dashicons-edit-page',
'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode('<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16 2V16H2V2H16ZM16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V2C18 0.9 17.1 0 16 0Z" fill="black"/><path d="M11 14H4V12H11V14ZM14 10H4V8H14V10ZM14 6H4V4H14V6Z" fill="black"/></svg>'),
'menu_position' => 4,
'supports' => array(
'title',
'editor',
'thumbnail',
'excerpt',
'custom-fields',
'revisions',
'author',
),
)
);
}
add_action('init', 'dynamiques_create_posttype');
/* ----------------------------------------------------------------
##### REMOVE FROM ADMIN MENU
------------------------------------------------------------------*/
function dynamiques_custom_menu_page_removing()
{
$current_site = get_current_blog_id();
if ($current_site !== 2) return;
remove_menu_page('edit.php'); // Hide Articles
remove_menu_page('edit-comments.php'); // Hide Commentaires
}
add_action('admin_menu', 'dynamiques_custom_menu_page_removing');

View File

@ -1,9 +1,9 @@
<?php
/**
* Plugin Name: Dynamiques Taxonomies
* Plugin Name: Dynamiques Taxonomies
* Description: Gestion des taxonomies de dynamiques
* Author: Deligraph
* Author: Antoine M. @ Deligraph
* Text Domain: dynamiques-taxonomies
*/

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '75ed85d80e2bf481c1fc');
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => 'ab439be1f5ca3b00f5a3');

View File

@ -145,42 +145,43 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/cta/edit.js");
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/cta/save.js");
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/cta/block.json");
/**
* 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/
*/
/**
* 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
*/
/**
* Internal dependencies
*/
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__);
/**
* Every block starts by registering a new block type definition.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
*/
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, {
/**
* @see ./edit.js
*/
icon: {
src: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("svg", {
width: "32",
height: "32",
viewBox: "0 0 32 32",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("g", {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
d: "M21.15,10.59l-9.38,10.02",
stroke: "#136f63",
fill: "none",
strokeWidth: "3"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
d: "M21.15,21.4v-10.81h-10.32",
stroke: "#136f63",
fill: "none",
strokeWidth: "3"
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("circle", {
cx: "16",
cy: "16",
r: "15",
stroke: "#136f63",
fill: "none",
strokeWidth: "3"
})]
})
},
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"],
/**
* @see ./save.js
*/
save: _save__WEBPACK_IMPORTED_MODULE_3__["default"]
});

File diff suppressed because one or more lines are too long

View File

@ -1,39 +1,39 @@
/**
* 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, {
icon: {
src: (
<svg width="32" height="32" viewBox="0 0 32 32">
<g>
<path
d="M21.15,10.59l-9.38,10.02"
stroke="#136f63"
fill="none"
strokeWidth="3"
/>
<path
d="M21.15,21.4v-10.81h-10.32"
stroke="#136f63"
fill="none"
strokeWidth="3"
/>
</g>
<circle
cx="16"
cy="16"
r="15"
stroke="#136f63"
fill="none"
strokeWidth="3"
/>
</svg>
),
},
edit: Edit,
/**
* @see ./save.js
*/
save,
} );
});

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => 'c84cd4a5c5b7fedbbb21');
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => '92296323c2fd81b0fe26');

View File

@ -87,18 +87,49 @@ __webpack_require__.r(__webpack_exports__);
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, {
icon: {
foreground: "#723d46",
src: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 401.94 401.92",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("defs", {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("g", {
id: "Calque_1-2",
"data-name": "Calque 1",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
class: "cls-1",
d: "m378.98,212.46h22.87v-23.16h-22.87v23.16Zm22.88-70.39h-22.8v23.02h22.8v-23.02ZM23.05,284.21H0v22.98h23.05v-22.98Zm0-47.48H.15v22.93h22.9v-22.93ZM.24,354.72h22.81v-23.23H.24v23.23Zm378.76-.18h22.87v-23.18h-22.87v23.18ZM154.05,70.49h188.68v-23.24h-188.68v23.24Zm-94.63.01h46.52v-23.11h-46.52v23.11Zm342.51,213.59h-22.82v23.14h22.82v-23.14Zm.01-284.09H.21v117.71h401.72V0Zm-23.3,92.03c0,.48-.2.95-.45,2.04H23.8c-.16-1.47-.4-2.75-.41-4.02-.02-20.67.06-41.33-.09-62-.03-3.65.91-4.87,4.73-4.87,115.33.09,230.65.08,345.98.05,2.73,0,4.77-.03,4.74,3.8-.15,21.66-.09,43.33-.12,65Zm-236.39,309.65h22.86v-22.83h-22.86v22.83Zm141.95.17h23.06v-22.89h-23.06v22.89Zm-47.24,0h22.85v-22.82h-22.85v22.82Zm94.54.02h23.11v-22.87h-23.11v22.87Zm47.48-22.9v22.78h22.96v-22.78h-22.96Zm22.79-142.11h-22.81v22.91h22.81v-22.91ZM.14,401.73h22.91v-22.88H.14v22.88Zm.07-189.19h22.87v-23.16H.21v23.16Zm-.07-47.59h23.05v-22.76H.15v22.76Zm94.7,236.76h22.98v-22.86h-22.98v22.86Zm94.53,0h23.24v-22.8h-23.24v22.8Zm-141.94.21h23.12v-23.03h-23.12v23.03Z"
foreground: "#136f63",
src: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("svg", {
width: "100",
height: "100",
viewBox: "0 0 100 100",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("g", {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("g", {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
stroke: "null",
id: "svg_2",
d: "m92.2486,13.78691a12.07103,12.07103 0 0 0 -12.07103,-12.07103l-60.35515,0a12.07103,12.07103 0 0 0 -12.07103,12.07103l0,12.07103a12.07103,12.07103 0 0 0 12.07103,12.07103l60.35515,0a12.07103,12.07103 0 0 0 12.07103,-12.07103l0,-12.07103zm-72.42617,12.07103l0,-12.07103l60.35515,0l0,12.07103l-60.35515,0z"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("rect", {
stroke: "null",
id: "svg_3",
height: "18.10654",
width: "12.07103",
y: "46.98224",
x: "7.7514"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("rect", {
stroke: "null",
id: "svg_4",
height: "12.07103",
width: "18.10654",
y: "86.21309",
x: "40.94673"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("rect", {
stroke: "null",
id: "svg_5",
height: "18.10654",
width: "12.07103",
y: "46.98224",
x: "80.17757"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
stroke: "null",
id: "svg_6",
d: "m7.7514,89.23085a9.05327,9.05327 0 0 0 9.05327,9.05327l12.07103,0l0,-12.07103l-9.05327,0l0,-9.05327l-12.07103,0l0,12.07103z"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
stroke: "null",
id: "svg_7",
d: "m80.17757,86.21309l-9.05327,0l0,12.07103l12.07103,0a9.05327,9.05327 0 0 0 9.05327,-9.05327l0,-12.07103l-12.07103,0l0,9.05327z"
})]
})
})]
})
})
},
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"],

File diff suppressed because one or more lines are too long

View File

@ -7,15 +7,51 @@ import metadata from "./block.json";
registerBlockType(metadata.name, {
icon: {
foreground: "#723d46",
foreground: "#136f63",
src: (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 401.94 401.92">
<defs></defs>
<g id="Calque_1-2" data-name="Calque 1">
<path
class="cls-1"
d="m378.98,212.46h22.87v-23.16h-22.87v23.16Zm22.88-70.39h-22.8v23.02h22.8v-23.02ZM23.05,284.21H0v22.98h23.05v-22.98Zm0-47.48H.15v22.93h22.9v-22.93ZM.24,354.72h22.81v-23.23H.24v23.23Zm378.76-.18h22.87v-23.18h-22.87v23.18ZM154.05,70.49h188.68v-23.24h-188.68v23.24Zm-94.63.01h46.52v-23.11h-46.52v23.11Zm342.51,213.59h-22.82v23.14h22.82v-23.14Zm.01-284.09H.21v117.71h401.72V0Zm-23.3,92.03c0,.48-.2.95-.45,2.04H23.8c-.16-1.47-.4-2.75-.41-4.02-.02-20.67.06-41.33-.09-62-.03-3.65.91-4.87,4.73-4.87,115.33.09,230.65.08,345.98.05,2.73,0,4.77-.03,4.74,3.8-.15,21.66-.09,43.33-.12,65Zm-236.39,309.65h22.86v-22.83h-22.86v22.83Zm141.95.17h23.06v-22.89h-23.06v22.89Zm-47.24,0h22.85v-22.82h-22.85v22.82Zm94.54.02h23.11v-22.87h-23.11v22.87Zm47.48-22.9v22.78h22.96v-22.78h-22.96Zm22.79-142.11h-22.81v22.91h22.81v-22.91ZM.14,401.73h22.91v-22.88H.14v22.88Zm.07-189.19h22.87v-23.16H.21v23.16Zm-.07-47.59h23.05v-22.76H.15v22.76Zm94.7,236.76h22.98v-22.86h-22.98v22.86Zm94.53,0h23.24v-22.8h-23.24v22.8Zm-141.94.21h23.12v-23.03h-23.12v23.03Z"
/>
<svg width="100" height="100" viewBox="0 0 100 100">
<g>
<g>
<path
stroke="null"
id="svg_2"
d="m92.2486,13.78691a12.07103,12.07103 0 0 0 -12.07103,-12.07103l-60.35515,0a12.07103,12.07103 0 0 0 -12.07103,12.07103l0,12.07103a12.07103,12.07103 0 0 0 12.07103,12.07103l60.35515,0a12.07103,12.07103 0 0 0 12.07103,-12.07103l0,-12.07103zm-72.42617,12.07103l0,-12.07103l60.35515,0l0,12.07103l-60.35515,0z"
/>
<rect
stroke="null"
id="svg_3"
height="18.10654"
width="12.07103"
y="46.98224"
x="7.7514"
/>
<rect
stroke="null"
id="svg_4"
height="12.07103"
width="18.10654"
y="86.21309"
x="40.94673"
/>
<rect
stroke="null"
id="svg_5"
height="18.10654"
width="12.07103"
y="46.98224"
x="80.17757"
/>
<path
stroke="null"
id="svg_6"
d="m7.7514,89.23085a9.05327,9.05327 0 0 0 9.05327,9.05327l12.07103,0l0,-12.07103l-9.05327,0l0,-9.05327l-12.07103,0l0,12.07103z"
/>
<path
stroke="null"
id="svg_7"
d="m80.17757,86.21309l-9.05327,0l0,12.07103l12.07103,0a9.05327,9.05327 0 0 0 9.05327,-9.05327l0,-12.07103l-12.07103,0l0,9.05327z"
/>
</g>
</g>
</svg>
),

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => '38a0c0a147de580d7cd2');
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => '3ba772c24e530eeafb2d');

View File

@ -66,37 +66,29 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss");
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/edit.js");
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./block.json */ "./src/block.json");
/**
* 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/
*/
/**
* 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
*/
/**
* Internal dependencies
*/
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__);
/**
* Every block starts by registering a new block type definition.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
*/
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_3__.name, {
/**
* @see ./edit.js
*/
icon: {
src: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("svg", {
width: "40",
height: "40",
viewBox: "0 0 40 40",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("g", {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("path", {
d: "m13.6069,24.44496l-12.82407,12.82407a1.40154,1.40154 0 1 0 1.97617,1.97617l12.82407,-12.82407l-1.97617,-1.97617z"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("path", {
d: "m39.19898,9.93905l-9.10999,-9.10999a3.01331,3.01331 0 0 0 -4.20461,4.20461a0.23826,0.23826 0 0 1 0,0.29432l-5.03152,5.03152a3.62998,3.62998 0 0 1 -4.54098,0.60266a6.40503,6.40503 0 0 0 -8.18498,0.74281l-1.62578,1.65381a1.40154,1.40154 0 0 0 0,1.94814l18.21999,18.21999a1.40154,1.40154 0 0 0 1.97617,0l1.65381,-1.65381a6.40503,6.40503 0 0 0 0.71478,-8.15695a3.62998,3.62998 0 0 1 0.60266,-4.54098l4.97546,-4.97546a0.23826,0.23826 0 0 1 0.29432,0a3.01331,3.01331 0 0 0 4.20461,-4.20461l0.05606,-0.05606z"
})]
})
}),
foreground: "#136f63"
},
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"]
});

File diff suppressed because one or more lines are too long

View File

@ -1,33 +1,20 @@
/**
* 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 metadata from "./block.json";
/**
* Internal dependencies
*/
import Edit from './edit';
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, {
icon: {
src: (
<svg width="40" height="40" viewBox="0 0 40 40">
<g>
<path d="m13.6069,24.44496l-12.82407,12.82407a1.40154,1.40154 0 1 0 1.97617,1.97617l12.82407,-12.82407l-1.97617,-1.97617z" />
<path d="m39.19898,9.93905l-9.10999,-9.10999a3.01331,3.01331 0 0 0 -4.20461,4.20461a0.23826,0.23826 0 0 1 0,0.29432l-5.03152,5.03152a3.62998,3.62998 0 0 1 -4.54098,0.60266a6.40503,6.40503 0 0 0 -8.18498,0.74281l-1.62578,1.65381a1.40154,1.40154 0 0 0 0,1.94814l18.21999,18.21999a1.40154,1.40154 0 0 0 1.97617,0l1.65381,-1.65381a6.40503,6.40503 0 0 0 0.71478,-8.15695a3.62998,3.62998 0 0 1 0.60266,-4.54098l4.97546,-4.97546a0.23826,0.23826 0 0 1 0.29432,0a3.01331,3.01331 0 0 0 4.20461,-4.20461l0.05606,-0.05606z" />
</g>
</svg>
),
foreground: "#136f63",
},
edit: Edit,
} );
});

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => '2706590dc5f7986977d7');
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => 'b5b4d35b954210cf99ba');

View File

@ -123,12 +123,28 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/subscribe-infolettre/edit.js");
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/subscribe-infolettre/save.js");
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/subscribe-infolettre/block.json");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__);
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, {
icon: {
src: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 28 32",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
d: "M0,27v-3.87l3.98-3.97V5.61L9.61,0h8.77l5.63,5.61v13.54l3.98,3.97v3.87"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
class: "cls-1",
d: "M9,31h10"
})]
}),
foreground: "#136f63"
},
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"],
save: _save__WEBPACK_IMPORTED_MODULE_3__["default"]
});

View File

@ -7,6 +7,15 @@ 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 28 32">
<path d="M0,27v-3.87l3.98-3.97V5.61L9.61,0h8.77l5.63,5.61v13.54l3.98,3.97v3.87" />
<path class="cls-1" d="M9,31h10" />
</svg>
),
foreground: "#136f63",
},
edit: Edit,
save,
});

View File

@ -7,6 +7,7 @@ body {
.footnote-reference {
counter-increment: footnote-index;
position: relative;
color: unset;
&::after {
background-color: var(--wp--preset--color--primary);
@ -18,7 +19,7 @@ body {
display: inline-flex;
justify-content: center;
align-items: center;
font-size: 0.8em;
font-size: 16px !important;
font-weight: 600;
margin-right: 3px;
margin-left: 3px;

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-rich-text'), 'version' => '71f06791f6231465e42e');
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-rich-text'), 'version' => '2a4a696193922e7ac850');

View File

@ -7,6 +7,7 @@ body {
.footnote-reference {
counter-increment: footnote-index;
position: relative;
color: unset;
&::after {
background-color: var(--wp--preset--color--primary);
@ -18,7 +19,7 @@ body {
display: inline-flex;
justify-content: center;
align-items: center;
font-size: 0.8em;
font-size: 16px !important;
font-weight: 600;
margin-left: 3px;
margin-right: 3px;

View File

@ -1 +1 @@
{"version":3,"file":"index.css","mappings":";;;AAAA;CACC,6BAA6B;AAC9B;AACA;CACC,iCAAiC;CACjC,kBAAkB;;CAElB;EACC,mDAAmD;EACnD,WAAW;EACX,WAAW;EACX,YAAY;EACZ,kBAAkB;EAClB,gCAAgC;EAChC,oBAAoB;EACpB,uBAAuB;EACvB,mBAAmB;EACnB,gBAAgB;EAChB,gBAAgB;EAChB,gBAAgB;EAChB,iBAAiB;CAClB;AACD;;AAEA;;CAEC;EACC,0BAA0B;EAC1B,6BAA6B;EAC7B,wDAAwD;EACxD,8BAA8B;EAC9B,0BAA0B;CAC3B;AACD;;AAEA;CACC;EACC,wBAAwB;EACxB,gBAAgB;CACjB;CACA;EACC,aAAa;EACb,yBAAyB;EACzB,SAAS;EACT,gBAAgB;;EAEhB;GACC,oCAAoC;GACpC,sBAAsB;EACvB;;EAEA;GACC,8DAA8D;GAC9D,sBAAsB;EACvB;CACD;AACD","sources":["webpack:///./src/footnote.css"],"sourcesContent":["body {\r\n\tcounter-reset: footnote-index;\r\n}\r\n.footnote-reference {\r\n\tcounter-increment: footnote-index;\r\n\tposition: relative;\r\n\r\n\t&::after {\r\n\t\tbackground-color: var(--wp--preset--color--primary);\r\n\t\tcolor: #fff;\r\n\t\twidth: 30px;\r\n\t\theight: 30px;\r\n\t\tborder-radius: 50%;\r\n\t\tcontent: counter(footnote-index);\r\n\t\tdisplay: inline-flex;\r\n\t\tjustify-content: center;\r\n\t\talign-items: center;\r\n\t\tfont-size: 0.8em;\r\n\t\tfont-weight: 600;\r\n\t\tmargin-left: 3px;\r\n\t\tmargin-right: 3px;\r\n\t}\r\n}\r\n\r\n// Editor\r\n.footnote-reference {\r\n\t.wp-block-post-content & {\r\n\t\ttext-decoration: underline;\r\n\t\ttext-decoration-style: dotted;\r\n\t\ttext-decoration-color: var(--wp--preset--color--primary);\r\n\t\ttext-decoration-thickness: 2px;\r\n\t\ttext-underline-offset: 2px;\r\n\t}\r\n}\r\n\r\n.popover_footnote_field {\r\n\t.components-popover__content {\r\n\t\tpadding: 10px !important;\r\n\t\tmin-width: 300px;\r\n\t}\r\n\t.popover_footnote_field_buttons {\r\n\t\tdisplay: flex;\r\n\t\tjustify-content: flex-end;\r\n\t\tgap: 10px;\r\n\t\tmargin-top: 10px;\r\n\r\n\t\tbutton.is-destructive {\r\n\t\t\tbackground-color: #cc1818 !important;\r\n\t\t\tcolor: #fff !important;\r\n\t\t}\r\n\r\n\t\tbutton.is-primary {\r\n\t\t\tbackground-color: var(--wp--preset--color--primary) !important;\r\n\t\t\tcolor: #fff !important;\r\n\t\t}\r\n\t}\r\n}\r\n"],"names":[],"sourceRoot":""}
{"version":3,"file":"index.css","mappings":";;;AAAA;CACC,6BAA6B;AAC9B;AACA;CACC,iCAAiC;CACjC,kBAAkB;CAClB,YAAY;;CAEZ;EACC,mDAAmD;EACnD,WAAW;EACX,WAAW;EACX,YAAY;EACZ,kBAAkB;EAClB,gCAAgC;EAChC,oBAAoB;EACpB,uBAAuB;EACvB,mBAAmB;EACnB,0BAA0B;EAC1B,gBAAgB;EAChB,gBAAgB;EAChB,iBAAiB;CAClB;AACD;;AAEA;;CAEC;EACC,0BAA0B;EAC1B,6BAA6B;EAC7B,wDAAwD;EACxD,8BAA8B;EAC9B,0BAA0B;CAC3B;AACD;;AAEA;CACC;EACC,wBAAwB;EACxB,gBAAgB;CACjB;CACA;EACC,aAAa;EACb,yBAAyB;EACzB,SAAS;EACT,gBAAgB;;EAEhB;GACC,oCAAoC;GACpC,sBAAsB;EACvB;;EAEA;GACC,8DAA8D;GAC9D,sBAAsB;EACvB;CACD;AACD","sources":["webpack:///./src/footnote.css"],"sourcesContent":["body {\r\n\tcounter-reset: footnote-index;\r\n}\r\n.footnote-reference {\r\n\tcounter-increment: footnote-index;\r\n\tposition: relative;\r\n\tcolor: unset;\r\n\r\n\t&::after {\r\n\t\tbackground-color: var(--wp--preset--color--primary);\r\n\t\tcolor: #fff;\r\n\t\twidth: 30px;\r\n\t\theight: 30px;\r\n\t\tborder-radius: 50%;\r\n\t\tcontent: counter(footnote-index);\r\n\t\tdisplay: inline-flex;\r\n\t\tjustify-content: center;\r\n\t\talign-items: center;\r\n\t\tfont-size: 16px !important;\r\n\t\tfont-weight: 600;\r\n\t\tmargin-left: 3px;\r\n\t\tmargin-right: 3px;\r\n\t}\r\n}\r\n\r\n// Editor\r\n.footnote-reference {\r\n\t.wp-block-post-content & {\r\n\t\ttext-decoration: underline;\r\n\t\ttext-decoration-style: dotted;\r\n\t\ttext-decoration-color: var(--wp--preset--color--primary);\r\n\t\ttext-decoration-thickness: 2px;\r\n\t\ttext-underline-offset: 2px;\r\n\t}\r\n}\r\n\r\n.popover_footnote_field {\r\n\t.components-popover__content {\r\n\t\tpadding: 10px !important;\r\n\t\tmin-width: 300px;\r\n\t}\r\n\t.popover_footnote_field_buttons {\r\n\t\tdisplay: flex;\r\n\t\tjustify-content: flex-end;\r\n\t\tgap: 10px;\r\n\t\tmargin-top: 10px;\r\n\r\n\t\tbutton.is-destructive {\r\n\t\t\tbackground-color: #cc1818 !important;\r\n\t\t\tcolor: #fff !important;\r\n\t\t}\r\n\r\n\t\tbutton.is-primary {\r\n\t\t\tbackground-color: var(--wp--preset--color--primary) !important;\r\n\t\t\tcolor: #fff !important;\r\n\t\t}\r\n\t}\r\n}\r\n"],"names":[],"sourceRoot":""}

View File

@ -276,7 +276,7 @@ const FootnoteFormatButton = props => {
};
(0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.registerFormatType)(formatName, {
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Notes de bas de page", "carhop-format-types"),
tagName: "button",
tagName: "a",
attributes: {
footnoteContent: "footnote-content"
},

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,7 @@ body {
.footnote-reference {
counter-increment: footnote-index;
position: relative;
color: unset;
&::after {
background-color: var(--wp--preset--color--primary);
@ -15,7 +16,7 @@ body {
display: inline-flex;
justify-content: center;
align-items: center;
font-size: 0.8em;
font-size: 16px !important;
font-weight: 600;
margin-left: 3px;
margin-right: 3px;

View File

@ -87,7 +87,7 @@ const FootnoteFormatButton = (props) => {
registerFormatType(formatName, {
title: __("Notes de bas de page", "carhop-format-types"),
tagName: "button",
tagName: "a",
attributes: {
footnoteContent: "footnote-content",
},

View File

@ -4,7 +4,7 @@
"category": "dynamiques-blocks",
"multiple": false,
"icon": {
"foreground": "#8B2FF7",
"foreground": "#136f63",
"src": "groups"
},
"keywords": [

View File

@ -1,5 +1,5 @@
{
"name": "multiblocks",
"name": "front-header",
"version": "0.1.0",
"description": "Example block scaffolded with Create Block tool.",
"author": "The WordPress Contributors",
@ -15,6 +15,7 @@
"start": "wp-scripts start"
},
"devDependencies": {
"@wordpress/scripts": "^26.9.0"
}
}
"@wordpress/scripts": "^30.12.0"
},
"packageManager": "pnpm@9.11.0+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b"
}

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +1,20 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "dynamiques-blocks/article-container",
"name": "dynamiques-blocks/a-propos",
"version": "0.1.0",
"title": "Article Container",
"category": "dynamiques-blocks",
"title": "Header",
"category": "carhop-blocks",
"icon": "smiley",
"description": "Example block scaffolded with Create Block tool.",
"example": {},
"supports": {
"html": false
},
"textdomain": "article-container",
"textdomain": "front-header",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": "file:./view.js",
"attributes": {
"relatedPostId": {
"type": "number"
}
}
"viewScript": "file:./view.js"
}

View File

@ -0,0 +1,27 @@
import { __ } from "@wordpress/i18n";
import { useBlockProps, InnerBlocks } from "@wordpress/block-editor";
import "./editor.scss";
export default function Edit() {
return (
<section
{...useBlockProps({
className: "block-front-header",
})}
>
<div className="front-header__innerblocks">
<InnerBlocks
template={[
["core/paragraph", { placeholder: "Ajouter ici le texte" }],
]}
allowedBlocks={[
"core/paragraph",
"core/list",
"core/button",
"core/buttons",
]}
/>
</div>
</section>
);
}

View File

@ -0,0 +1,3 @@
.wp-block-front-header-front-header {
border: 1px dotted #f00;
}

View File

@ -0,0 +1,25 @@
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: {
foreground: "#723d46",
src: (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 401.94 401.92">
<defs></defs>
<g id="Calque_1-2" data-name="Calque 1">
<path
class="cls-1"
d="m378.98,212.46h22.87v-23.16h-22.87v23.16Zm22.88-70.39h-22.8v23.02h22.8v-23.02ZM23.05,284.21H0v22.98h23.05v-22.98Zm0-47.48H.15v22.93h22.9v-22.93ZM.24,354.72h22.81v-23.23H.24v23.23Zm378.76-.18h22.87v-23.18h-22.87v23.18ZM154.05,70.49h188.68v-23.24h-188.68v23.24Zm-94.63.01h46.52v-23.11h-46.52v23.11Zm342.51,213.59h-22.82v23.14h22.82v-23.14Zm.01-284.09H.21v117.71h401.72V0Zm-23.3,92.03c0,.48-.2.95-.45,2.04H23.8c-.16-1.47-.4-2.75-.41-4.02-.02-20.67.06-41.33-.09-62-.03-3.65.91-4.87,4.73-4.87,115.33.09,230.65.08,345.98.05,2.73,0,4.77-.03,4.74,3.8-.15,21.66-.09,43.33-.12,65Zm-236.39,309.65h22.86v-22.83h-22.86v22.83Zm141.95.17h23.06v-22.89h-23.06v22.89Zm-47.24,0h22.85v-22.82h-22.85v22.82Zm94.54.02h23.11v-22.87h-23.11v22.87Zm47.48-22.9v22.78h22.96v-22.78h-22.96Zm22.79-142.11h-22.81v22.91h22.81v-22.91ZM.14,401.73h22.91v-22.88H.14v22.88Zm.07-189.19h22.87v-23.16H.21v23.16Zm-.07-47.59h23.05v-22.76H.15v22.76Zm94.7,236.76h22.98v-22.86h-22.98v22.86Zm94.53,0h23.24v-22.8h-23.24v22.8Zm-141.94.21h23.12v-23.03h-23.12v23.03Z"
/>
</g>
</svg>
),
},
edit: Edit,
save,
});

View File

@ -0,0 +1,15 @@
import { useBlockProps, InnerBlocks } from "@wordpress/block-editor";
export default function save() {
return (
<section
{...useBlockProps.save({
className: "block-front-header",
})}
>
<div className="front-header__innerblocks">
<InnerBlocks.Content />
</div>
</section>
);
}

View File

@ -0,0 +1,5 @@
// .wp-block-front-header-front-header {
// background-color: #21759b;
// color: #fff;
// padding: 2px;
// }

View File

@ -0,0 +1 @@
console.log("Hello World! (from front-header-front-header block)");

View File

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

View File

@ -1,59 +0,0 @@
<?php
/**
* Plugin Name: Article Container
* Description: Example block scaffolded with Create Block tool.
* Version: 0.1.0
* Requires at least: 6.7
* Requires PHP: 7.4
* Author: The WordPress Contributors
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: article-container
*
* @package CreateBlock
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Registers the block using a `blocks-manifest.php` file, which improves the performance of block type registration.
* Behind the scenes, it also registers all assets so they can be enqueued
* through the block editor in the corresponding context.
*
* @see https://make.wordpress.org/core/2025/03/13/more-efficient-block-type-registration-in-6-8/
* @see https://make.wordpress.org/core/2024/10/17/new-block-type-registration-apis-to-improve-performance-in-wordpress-6-7/
*/
function create_block_article_container_block_init() {
/**
* Registers the block(s) metadata from the `blocks-manifest.php` and registers the block type(s)
* based on the registered block metadata.
* Added in WordPress 6.8 to simplify the block metadata registration process added in WordPress 6.7.
*
* @see https://make.wordpress.org/core/2025/03/13/more-efficient-block-type-registration-in-6-8/
*/
if ( function_exists( 'wp_register_block_types_from_metadata_collection' ) ) {
wp_register_block_types_from_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' );
return;
}
/**
* Registers the block(s) metadata from the `blocks-manifest.php` file.
* Added to WordPress 6.7 to improve the performance of block type registration.
*
* @see https://make.wordpress.org/core/2024/10/17/new-block-type-registration-apis-to-improve-performance-in-wordpress-6-7/
*/
if ( function_exists( 'wp_register_block_metadata_collection' ) ) {
wp_register_block_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' );
}
/**
* Registers the block type(s) in the `blocks-manifest.php` file.
*
* @see https://developer.wordpress.org/reference/functions/register_block_type/
*/
$manifest_data = require __DIR__ . '/build/blocks-manifest.php';
foreach ( array_keys( $manifest_data ) as $block_type ) {
register_block_type( __DIR__ . "/build/{$block_type}" );
}
}
add_action( 'init', 'create_block_article_container_block_init' );

View File

@ -1,24 +0,0 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "dynamiques-blocks/article-container",
"version": "0.1.0",
"title": "Article Container",
"category": "dynamiques-blocks",
"icon": "smiley",
"description": "Example block scaffolded with Create Block tool.",
"example": {},
"supports": {
"html": false
},
"textdomain": "article-container",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": "file:./view.js",
"attributes": {
"relatedPostId": {
"type": "number"
}
}
}

View File

@ -1,11 +0,0 @@
/*!**********************************************************************************************************************************************************************************************************************************************************!*\
!*** 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/article-container/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-article-container {
border: 1px dotted #f00;
}

View File

@ -1 +0,0 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => '3a8ee4f74b044fc970d5');

View File

@ -1,13 +0,0 @@
/*!**********************************************************************************************************************************************************************************************************************************************************!*\
!*** 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/article-container/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-article-container {
border: 1px dotted #f00;
}
/*# sourceMappingURL=index.css.map*/

View File

@ -1 +0,0 @@
{"version":3,"file":"article-container/index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACC;AAAD,C","sources":["webpack://article-container/./src/article-container/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-article-container {\n\tborder: 1px dotted #f00;\n}\n"],"names":[],"sourceRoot":""}

View File

@ -1,533 +0,0 @@
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/article-container/OptionsSelectControl.js":
/*!*******************************************************!*\
!*** ./src/article-container/OptionsSelectControl.js ***!
\*******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ OptionsSelectControl)
/* harmony export */ });
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./editor.scss */ "./src/article-container/editor.scss");
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities");
/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__);
function OptionsSelectControl({
setAttributes,
relatedPostId
}) {
let [relatedArticlePages, setRelatedArticlePages] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.useState)(null);
const editUrl = relatedPostId ? `${window.location.origin}/wp-admin/post.php?post=${relatedPostId}&action=edit` : null;
function handleRelatedPostChange(postId) {
setAttributes({
relatedPostId: Number(postId)
});
}
function buildSelectOptions(relatedPossiblePages) {
let options = [];
if (relatedPossiblePages) {
options.push({
value: 0,
label: "Selectionnez une page"
});
relatedPossiblePages.forEach(page => {
options.push({
value: page.id,
label: (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__.decodeEntities)(page.title.rendered)
});
});
} else {
options.push({
value: 0,
label: "Pas encore de questions..."
});
}
return options;
}
const relatedPossiblePages = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useSelect)(select => {
let query = {
status: "publish",
per_page: -1
};
return select("core").getEntityRecords("postType", "articles", query);
return null;
});
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.useEffect)(() => {
if (relatedPossiblePages) {
setRelatedArticlePages(buildSelectOptions(relatedPossiblePages));
}
}, [relatedPossiblePages]);
let panelTitle = "";
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.InspectorControls, {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.PanelBody, {
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Article lié", "dynamiques-blocks"),
children: [relatedArticlePages && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.ComboboxControl, {
label: panelTitle,
value: relatedPostId,
options: relatedArticlePages,
onChange: e => handleRelatedPostChange(e)
}), relatedPostId && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.Tip, {
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Pour modifier le contenu de l'article affiché ici, rendez-vous dans l'article correspondant", "homegrade-blocks")
}), relatedPostId && editUrl && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("a", {
href: editUrl,
className: "edit-question-button",
children: "Editer l'article"
})]
})
});
}
/***/ }),
/***/ "./src/article-container/block.json":
/*!******************************************!*\
!*** ./src/article-container/block.json ***!
\******************************************/
/***/ ((module) => {
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"dynamiques-blocks/article-container","version":"0.1.0","title":"Article Container","category":"dynamiques-blocks","icon":"smiley","description":"Example block scaffolded with Create Block tool.","example":{},"supports":{"html":false},"textdomain":"article-container","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","attributes":{"relatedPostId":{"type":"number"}}}');
/***/ }),
/***/ "./src/article-container/edit.js":
/*!***************************************!*\
!*** ./src/article-container/edit.js ***!
\***************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ Edit)
/* harmony export */ });
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _OptionsSelectControl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./OptionsSelectControl */ "./src/article-container/OptionsSelectControl.js");
/* harmony import */ var _wordpress_block_library__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/block-library */ "@wordpress/block-library");
/* harmony import */ var _wordpress_block_library__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_library__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./editor.scss */ "./src/article-container/editor.scss");
/* 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 react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__);
// import { decodeEntities } from "@wordpress/html-entities";
function Edit({
attributes,
setAttributes
}) {
const {
relatedPostId
} = attributes;
const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps)();
let currentRelatedPost = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core").getEntityRecord("postType", "articles", relatedPostId));
console.log(currentRelatedPost);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.Fragment, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_OptionsSelectControl__WEBPACK_IMPORTED_MODULE_2__["default"], {
setAttributes: setAttributes,
relatedPostId: attributes.relatedPostId
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("section", {
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__.useBlockProps)({
className: `article-container`
}),
children: [!relatedPostId && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.Fragment, {
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("p", {
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Ce bloc n'est relié à aucun article. Rattachez-le à un article dans la barre latérale.", "dynamiques-blocks")
})
}), currentRelatedPost && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.Fragment, {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("h3", {
children: currentRelatedPost.title.rendered
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
dangerouslySetInnerHTML: {
__html: currentRelatedPost.content.rendered
}
})]
})]
})]
});
}
/***/ }),
/***/ "./src/article-container/editor.scss":
/*!*******************************************!*\
!*** ./src/article-container/editor.scss ***!
\*******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "./src/article-container/index.js":
/*!****************************************!*\
!*** ./src/article-container/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/article-container/style.scss");
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/article-container/edit.js");
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/article-container/save.js");
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/article-container/block.json");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__);
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, {
icon: {
src: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("svg", {
width: "18",
height: "18",
viewBox: "0 0 18 18",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
d: "M16 2V16H2V2H16ZM16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V2C18 0.9 17.1 0 16 0Z",
fill: "black"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
d: "M11 14H4V12H11V14ZM14 10H4V8H14V10ZM14 6H4V4H14V6Z",
fill: "black"
})]
}),
foreground: "#000"
},
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"],
save: _save__WEBPACK_IMPORTED_MODULE_3__["default"]
});
/***/ }),
/***/ "./src/article-container/save.js":
/*!***************************************!*\
!*** ./src/article-container/save.js ***!
\***************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ save)
/* harmony export */ });
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
function save() {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("p", {
..._wordpress_block_editor__WEBPACK_IMPORTED_MODULE_0__.useBlockProps.save(),
children: "Article Container hello from the saved content!"
});
}
/***/ }),
/***/ "./src/article-container/style.scss":
/*!******************************************!*\
!*** ./src/article-container/style.scss ***!
\******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "@wordpress/block-editor":
/*!*************************************!*\
!*** external ["wp","blockEditor"] ***!
\*************************************/
/***/ ((module) => {
module.exports = window["wp"]["blockEditor"];
/***/ }),
/***/ "@wordpress/block-library":
/*!**************************************!*\
!*** external ["wp","blockLibrary"] ***!
\**************************************/
/***/ ((module) => {
module.exports = window["wp"]["blockLibrary"];
/***/ }),
/***/ "@wordpress/blocks":
/*!********************************!*\
!*** external ["wp","blocks"] ***!
\********************************/
/***/ ((module) => {
module.exports = window["wp"]["blocks"];
/***/ }),
/***/ "@wordpress/components":
/*!************************************!*\
!*** external ["wp","components"] ***!
\************************************/
/***/ ((module) => {
module.exports = window["wp"]["components"];
/***/ }),
/***/ "@wordpress/data":
/*!******************************!*\
!*** external ["wp","data"] ***!
\******************************/
/***/ ((module) => {
module.exports = window["wp"]["data"];
/***/ }),
/***/ "@wordpress/element":
/*!*********************************!*\
!*** external ["wp","element"] ***!
\*********************************/
/***/ ((module) => {
module.exports = window["wp"]["element"];
/***/ }),
/***/ "@wordpress/html-entities":
/*!**************************************!*\
!*** external ["wp","htmlEntities"] ***!
\**************************************/
/***/ ((module) => {
module.exports = window["wp"]["htmlEntities"];
/***/ }),
/***/ "@wordpress/i18n":
/*!******************************!*\
!*** external ["wp","i18n"] ***!
\******************************/
/***/ ((module) => {
module.exports = window["wp"]["i18n"];
/***/ }),
/***/ "react/jsx-runtime":
/*!**********************************!*\
!*** external "ReactJSXRuntime" ***!
\**********************************/
/***/ ((module) => {
module.exports = window["ReactJSXRuntime"];
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/
/******/ /* webpack/runtime/chunk loaded */
/******/ (() => {
/******/ var deferred = [];
/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
/******/ if(chunkIds) {
/******/ priority = priority || 0;
/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ deferred[i] = [chunkIds, fn, priority];
/******/ return;
/******/ }
/******/ var notFulfilled = Infinity;
/******/ for (var i = 0; i < deferred.length; i++) {
/******/ var [chunkIds, fn, priority] = deferred[i];
/******/ var fulfilled = true;
/******/ for (var j = 0; j < chunkIds.length; j++) {
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
/******/ chunkIds.splice(j--, 1);
/******/ } else {
/******/ fulfilled = false;
/******/ if(priority < notFulfilled) notFulfilled = priority;
/******/ }
/******/ }
/******/ if(fulfilled) {
/******/ deferred.splice(i--, 1)
/******/ var r = fn();
/******/ if (r !== undefined) result = r;
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ // no baseURI
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "article-container/index": 0,
/******/ "article-container/style-index": 0
/******/ };
/******/
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
/******/
/******/ // no preloaded
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0;
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
/******/ for(moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) var result = runtime(__webpack_require__);
/******/ }
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = globalThis["webpackChunkarticle_container"] = globalThis["webpackChunkarticle_container"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["article-container/style-index"], () => (__webpack_require__("./src/article-container/index.js")))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/
/******/ })()
;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,8 +0,0 @@
/*!*********************************************************************************************************************************************************************************************************************************************************!*\
!*** 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/article-container/style.scss ***!
\*********************************************************************************************************************************************************************************************************************************************************/
.wp-block-create-block-article-container {
background-color: #21759b;
color: #fff;
padding: 2px;
}

View File

@ -1,10 +0,0 @@
/*!*********************************************************************************************************************************************************************************************************************************************************!*\
!*** 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/article-container/style.scss ***!
\*********************************************************************************************************************************************************************************************************************************************************/
.wp-block-create-block-article-container {
background-color: #21759b;
color: #fff;
padding: 2px;
}
/*# sourceMappingURL=style-index.css.map*/

View File

@ -1 +0,0 @@
{"version":3,"file":"article-container/style-index.css","mappings":";;;AAAA;EACC;EACA;EACA;AACD,C","sources":["webpack://article-container/./src/article-container/style.scss"],"sourcesContent":[".wp-block-create-block-article-container {\n\tbackground-color: #21759b;\n\tcolor: #fff;\n\tpadding: 2px;\n}\n"],"names":[],"sourceRoot":""}

View File

@ -1 +0,0 @@
<?php return array('dependencies' => array(), 'version' => '73e8da3b7330e58597c3');

View File

@ -1,7 +0,0 @@
/******/ (() => { // webpackBootstrap
/*!***************************************!*\
!*** ./src/article-container/view.js ***!
\***************************************/
/******/ })()
;

View File

@ -1,30 +0,0 @@
<?php
// This file is generated. Do not modify it manually.
return array(
'article-container' => array(
'$schema' => 'https://schemas.wp.org/trunk/block.json',
'apiVersion' => 3,
'name' => 'dynamiques-blocks/article-container',
'version' => '0.1.0',
'title' => 'Article Container',
'category' => 'dynamiques-blocks',
'icon' => 'smiley',
'description' => 'Example block scaffolded with Create Block tool.',
'example' => array(
),
'supports' => array(
'html' => false
),
'textdomain' => 'article-container',
'editorScript' => 'file:./index.js',
'editorStyle' => 'file:./index.css',
'style' => 'file:./style-index.css',
'viewScript' => 'file:./view.js',
'attributes' => array(
'relatedPostId' => array(
'type' => 'number'
)
)
)
);

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +0,0 @@
{
"name": "article-container",
"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 --blocks-manifest",
"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 --blocks-manifest"
},
"devDependencies": {
"@wordpress/scripts": "^30.15.0"
}
}

View File

@ -1,55 +0,0 @@
=== Article Container ===
Contributors: The WordPress Contributors
Tags: block
Tested up to: 6.7
Stable tag: 0.1.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Example block scaffolded with Create Block tool.
== Description ==
This is the long description. No limit, and you can use Markdown (as well as in the following sections).
For backwards compatibility, if this section is missing, the full length of the short description will be used, and
Markdown parsed.
== Installation ==
This section describes how to install the plugin and get it working.
e.g.
1. Upload the plugin files to the `/wp-content/plugins/article-container` directory, or install the plugin through the WordPress plugins screen directly.
1. Activate the plugin through the 'Plugins' screen in WordPress
== Frequently Asked Questions ==
= A question that someone might have =
An answer to that question.
= What about foo bar? =
Answer to foo bar dilemma.
== Screenshots ==
1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from
the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets
directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png`
(or jpg, jpeg, gif).
2. This is the second screen shot
== Changelog ==
= 0.1.0 =
* Release
== Arbitrary section ==
You may provide arbitrary sections, in the same format as the ones above. This may be of use for extremely complicated
plugins where more information needs to be conveyed that doesn't fit into the categories of "description" or
"installation." Arbitrary sections will be shown below the built-in sections outlined above.

View File

@ -1,86 +0,0 @@
import { __ } from "@wordpress/i18n";
import { InspectorControls } from "@wordpress/block-editor";
import {
PanelBody,
SelectControl,
ComboboxControl,
} from "@wordpress/components";
import "./editor.scss";
import { Tip } from "@wordpress/components";
import { useSelect } from "@wordpress/data";
import { useEffect, useState } from "@wordpress/element";
import { decodeEntities } from "@wordpress/html-entities";
export default function OptionsSelectControl({ setAttributes, relatedPostId }) {
let [relatedArticlePages, setRelatedArticlePages] = useState(null);
const editUrl = relatedPostId
? `${window.location.origin}/wp-admin/post.php?post=${relatedPostId}&action=edit`
: null;
function handleRelatedPostChange(postId) {
setAttributes({ relatedPostId: Number(postId) });
}
function buildSelectOptions(relatedPossiblePages) {
let options = [];
if (relatedPossiblePages) {
options.push({ value: 0, label: "Selectionnez une page" });
relatedPossiblePages.forEach((page) => {
options.push({
value: page.id,
label: decodeEntities(page.title.rendered),
});
});
} else {
options.push({ value: 0, label: "Pas encore de questions..." });
}
return options;
}
const relatedPossiblePages = useSelect((select) => {
let query = {
status: "publish",
per_page: -1,
};
return select("core").getEntityRecords("postType", "articles", query);
return null;
});
useEffect(() => {
if (relatedPossiblePages) {
setRelatedArticlePages(buildSelectOptions(relatedPossiblePages));
}
}, [relatedPossiblePages]);
let panelTitle = "";
return (
<InspectorControls>
<PanelBody title={__("Article lié", "dynamiques-blocks")}>
{relatedArticlePages && (
<ComboboxControl
label={panelTitle}
value={relatedPostId}
options={relatedArticlePages}
onChange={(e) => handleRelatedPostChange(e)}
/>
)}
{relatedPostId && (
<Tip>
{__(
"Pour modifier le contenu de l'article affiché ici, rendez-vous dans l'article correspondant",
"homegrade-blocks",
)}
</Tip>
)}
{relatedPostId && editUrl && (
<a href={editUrl} className="edit-question-button">
Editer l'article
</a>
)}
</PanelBody>
</InspectorControls>
);
}

View File

@ -1,53 +0,0 @@
import { __ } from "@wordpress/i18n";
import { useBlockProps } from "@wordpress/block-editor";
import OptionsSelectControl from "./OptionsSelectControl";
import { decodeEntities, RawHTML } from "@wordpress/block-library";
import "./editor.scss";
import { useSelect } from "@wordpress/data";
// import { decodeEntities } from "@wordpress/html-entities";
export default function Edit({ attributes, setAttributes }) {
const { relatedPostId } = attributes;
const blockProps = useBlockProps();
let currentRelatedPost = useSelect((select) =>
select("core").getEntityRecord("postType", "articles", relatedPostId),
);
console.log(currentRelatedPost);
return (
<>
<OptionsSelectControl
setAttributes={setAttributes}
relatedPostId={attributes.relatedPostId}
/>
<section
{...useBlockProps({
className: `article-container`,
})}
>
{!relatedPostId && (
<>
<p>
{__(
"Ce bloc n'est relié à aucun article. Rattachez-le à un article dans la barre latérale.",
"dynamiques-blocks",
)}
</p>
</>
)}
{currentRelatedPost && (
<>
<h3>{currentRelatedPost.title.rendered}</h3>
<div
dangerouslySetInnerHTML={{
__html: currentRelatedPost.content.rendered,
}}
/>
{/* <RawHTML>{currentRelatedPost.content.rendered}</RawHTML> */}
</>
)}
</section>
</>
);
}

View File

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

View File

@ -1,32 +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, {
icon: {
src: (
<svg
width="18"
height="18"
viewBox="0 0 18 18"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M16 2V16H2V2H16ZM16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V2C18 0.9 17.1 0 16 0Z"
fill="black"
/>
<path
d="M11 14H4V12H11V14ZM14 10H4V8H14V10ZM14 6H4V4H14V6Z"
fill="black"
/>
</svg>
),
foreground: "#000",
},
edit: Edit,
save,
});

View File

@ -1,9 +0,0 @@
import { useBlockProps } from "@wordpress/block-editor";
export default function save() {
return (
<p {...useBlockProps.save()}>
{"Article Container hello from the saved content!"}
</p>
);
}

View File

@ -1,5 +0,0 @@
.wp-block-create-block-article-container {
background-color: #21759b;
color: #fff;
padding: 2px;
}

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => 'e08b17920300a78b4ba8');
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '09c8a756fa939fe572c6');

View File

@ -101,42 +101,29 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/dernieres-dynamiques/edit.js");
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/dernieres-dynamiques/save.js");
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/dernieres-dynamiques/block.json");
/**
* 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/
*/
/**
* 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
*/
/**
* Internal dependencies
*/
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__);
/**
* Every block starts by registering a new block type definition.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
*/
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, {
/**
* @see ./edit.js
*/
icon: {
src: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("svg", {
width: "96",
height: "74",
viewBox: "0 0 96 74",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
d: "M86.4 2.2C81.6 0.7 76.3 0 71.3 0C62.9 0 53.8 1.7 47.5 6.5C41.2 1.7 32.2 0 23.8 0C15.4 0 6.3 1.7 0 6.5V69.8C0 70.9 1.1 72 2.2 72C3.3 72 2.8 71.8 3.3 71.8C9.1 69 17.6 67 23.8 67C30 67 41.3 68.7 47.6 73.5C53.4 69.8 64 67 71.4 67C78.8 67 85.9 68.3 91.9 71.5C92.3 71.7 92.5 71.7 93 71.7C94.1 71.7 95.2 70.6 95.2 69.5V6.5C92.6 4.6 89.8 3.3 86.6 2.2H86.4ZM86.4 60.5C81.6 59 76.5 58.3 71.3 58.3C64 58.3 53.4 61.1 47.5 64.8V15.1C53.3 11.4 63.9 8.6 71.3 8.6C78.7 8.6 81.7 9.2 86.4 10.8V60.5Z"
})
}),
foreground: "#136f63"
},
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"],
/**
* @see ./save.js
*/
save: _save__WEBPACK_IMPORTED_MODULE_3__["default"]
});

View File

@ -153,7 +153,7 @@ $issue_related_articles = get_field('articles', $last_issue->ID);
<?php get_template_part('template-parts/components/cta--go', null, array(
'url' => get_the_permalink(),
'label' => 'Lire la revue',
'target' => '_blank',
'target' => '_self',
)); ?>
</div>

View File

@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '868f7899d9aaee305c25');
<?php return array('dependencies' => array(), 'version' => 'e2a42947538603e62de3');

View File

@ -13,6 +13,7 @@ document.addEventListener("DOMContentLoaded", function () {
slidesPerView: 2,
spaceBetween: 30,
loop: true,
grabCursor: true,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev"

View File

@ -1 +1 @@
{"version":3,"file":"dernieres-dynamiques/view.js","mappings":";;;;AAAAA,QAAQ,CAACC,gBAAgB,CAAC,kBAAkB,EAAE,YAAY;EACzD,MAAMC,YAAY,GAAGF,QAAQ,CAACG,aAAa,CAAC,6BAA6B,CAAC;EAC1E,IAAI,CAACD,YAAY,EAAE;EAEnB,MAAME,cAAc,GAAGF,YAAY,CAACC,aAAa,CAChD,6BACD,CAAC;EACD,MAAME,MAAM,GAAGH,YAAY,CAACI,gBAAgB,CAAC,eAAe,CAAC;EAC7D,MAAMC,UAAU,GAAGF,MAAM,CAACG,MAAM;EAChCJ,cAAc,CAACK,WAAW,GAAG,mBAAmBF,UAAU,EAAE;EAE5D,IAAIG,MAAM,CAAC,8BAA8B,EAAE;IAC1CC,aAAa,EAAE,CAAC;IAChBC,YAAY,EAAE,EAAE;IAChBC,IAAI,EAAE,IAAI;IACVC,UAAU,EAAE;MACXC,MAAM,EAAE,qBAAqB;MAC7BC,MAAM,EAAE;IACT,CAAC;IACDC,UAAU,EAAE;MACXC,EAAE,EAAE,oBAAoB;MACxBC,SAAS,EAAE,IAAI;MACfC,YAAY,EAAE,SAAAA,CAAUC,KAAK,EAAEC,SAAS,EAAE;QACzC,OAAO,kBAAkBA,SAAS,aAAa;MAChD;IACD,CAAC;IACDC,EAAE,EAAE;MACHC,WAAW,EAAGC,MAAM,IAAK;QACxB,MAAMC,WAAW,GAAGD,MAAM,EAAEpB,MAAM,EAAEG,MAAM;QAC1CJ,cAAc,CAACK,WAAW,GAAG,aAC5BgB,MAAM,CAACE,SAAS,GAAG,CAAC,QACbD,WAAW,EAAE;MACtB;IACD;;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;EACD,CAAC,CAAC;AACH,CAAC,CAAC,C","sources":["webpack://dernieres-dynamiques/./src/dernieres-dynamiques/view.js"],"sourcesContent":["document.addEventListener(\"DOMContentLoaded\", function () {\n\tconst currentBlock = document.querySelector(\".block-dernieres-dynamiques\");\n\tif (!currentBlock) return;\n\n\tconst swiperFraction = currentBlock.querySelector(\n\t\t\".swiper-pagination-fraction\"\n\t);\n\tconst slides = currentBlock.querySelectorAll(\".swiper-slide\");\n\tconst slideCount = slides.length;\n\tswiperFraction.textContent = `Article n°1 sur ${slideCount}`;\n\n\tnew Swiper(\".dernieres-dynamiques-swiper\", {\n\t\tslidesPerView: 2,\n\t\tspaceBetween: 30,\n\t\tloop: true,\n\t\tnavigation: {\n\t\t\tnextEl: \".swiper-button-next\",\n\t\t\tprevEl: \".swiper-button-prev\",\n\t\t},\n\t\tpagination: {\n\t\t\tel: \".swiper-pagination\",\n\t\t\tclickable: true,\n\t\t\trenderBullet: function (index, className) {\n\t\t\t\treturn `<button class=\"${className}\"></button>`;\n\t\t\t},\n\t\t},\n\t\ton: {\n\t\t\tslideChange: (swiper) => {\n\t\t\t\tconst slidesCount = swiper?.slides?.length;\n\t\t\t\tswiperFraction.textContent = `Article n°${\n\t\t\t\t\tswiper.realIndex + 1\n\t\t\t\t} sur ${slidesCount}`;\n\t\t\t},\n\t\t},\n\n\t\t// pagination: [\n\t\t// \t{\n\t\t// \t\tel: \".swiper-pagination\",\n\t\t// \t\ttype: \"bullets\",\n\t\t// \t\tclickable: true,\n\t\t// \t},\n\t\t// \t{\n\t\t// \t\tel: \".swiper-pagination-fraction\",\n\t\t// \t\ttype: \"fraction\",\n\t\t// \t\trenderFraction: function (currentClass, totalClass) {\n\t\t// \t\t\treturn (\n\t\t// \t\t\t\t'<p class=\"swiper-pagination__text\">' +\n\t\t// \t\t\t\t\"<span class='swiper-pagination__text-label'>Article n°</span>\" +\n\t\t// \t\t\t\t'<span class=\"' +\n\t\t// \t\t\t\tcurrentClass +\n\t\t// \t\t\t\t'\"></span>' +\n\t\t// \t\t\t\t\" sur \" +\n\t\t// \t\t\t\t'<span class=\"' +\n\t\t// \t\t\t\ttotalClass +\n\t\t// \t\t\t\t'\"></span>' +\n\t\t// \t\t\t\t\"</p>\"\n\t\t// \t\t\t);\n\t\t// \t\t},\n\t\t// \t},\n\t\t// ],\n\t});\n});\n"],"names":["document","addEventListener","currentBlock","querySelector","swiperFraction","slides","querySelectorAll","slideCount","length","textContent","Swiper","slidesPerView","spaceBetween","loop","navigation","nextEl","prevEl","pagination","el","clickable","renderBullet","index","className","on","slideChange","swiper","slidesCount","realIndex"],"sourceRoot":""}
{"version":3,"file":"dernieres-dynamiques/view.js","mappings":";;;;AAAAA,QAAQ,CAACC,gBAAgB,CAAC,kBAAkB,EAAE,YAAY;EACzD,MAAMC,YAAY,GAAGF,QAAQ,CAACG,aAAa,CAAC,6BAA6B,CAAC;EAC1E,IAAI,CAACD,YAAY,EAAE;EAEnB,MAAME,cAAc,GAAGF,YAAY,CAACC,aAAa,CAChD,6BACD,CAAC;EACD,MAAME,MAAM,GAAGH,YAAY,CAACI,gBAAgB,CAAC,eAAe,CAAC;EAC7D,MAAMC,UAAU,GAAGF,MAAM,CAACG,MAAM;EAChCJ,cAAc,CAACK,WAAW,GAAG,mBAAmBF,UAAU,EAAE;EAE5D,IAAIG,MAAM,CAAC,8BAA8B,EAAE;IAC1CC,aAAa,EAAE,CAAC;IAChBC,YAAY,EAAE,EAAE;IAChBC,IAAI,EAAE,IAAI;IACVC,UAAU,EAAE,IAAI;IAChBC,UAAU,EAAE;MACXC,MAAM,EAAE,qBAAqB;MAC7BC,MAAM,EAAE;IACT,CAAC;IACDC,UAAU,EAAE;MACXC,EAAE,EAAE,oBAAoB;MACxBC,SAAS,EAAE,IAAI;MACfC,YAAY,EAAE,SAAAA,CAAUC,KAAK,EAAEC,SAAS,EAAE;QACzC,OAAO,kBAAkBA,SAAS,aAAa;MAChD;IACD,CAAC;IACDC,EAAE,EAAE;MACHC,WAAW,EAAGC,MAAM,IAAK;QACxB,MAAMC,WAAW,GAAGD,MAAM,EAAErB,MAAM,EAAEG,MAAM;QAC1CJ,cAAc,CAACK,WAAW,GAAG,aAC5BiB,MAAM,CAACE,SAAS,GAAG,CAAC,QACbD,WAAW,EAAE;MACtB;IACD;;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;EACD,CAAC,CAAC;AACH,CAAC,CAAC,C","sources":["webpack://dernieres-dynamiques/./src/dernieres-dynamiques/view.js"],"sourcesContent":["document.addEventListener(\"DOMContentLoaded\", function () {\n\tconst currentBlock = document.querySelector(\".block-dernieres-dynamiques\");\n\tif (!currentBlock) return;\n\n\tconst swiperFraction = currentBlock.querySelector(\n\t\t\".swiper-pagination-fraction\"\n\t);\n\tconst slides = currentBlock.querySelectorAll(\".swiper-slide\");\n\tconst slideCount = slides.length;\n\tswiperFraction.textContent = `Article n°1 sur ${slideCount}`;\n\n\tnew Swiper(\".dernieres-dynamiques-swiper\", {\n\t\tslidesPerView: 2,\n\t\tspaceBetween: 30,\n\t\tloop: true,\n\t\tgrabCursor: true,\n\t\tnavigation: {\n\t\t\tnextEl: \".swiper-button-next\",\n\t\t\tprevEl: \".swiper-button-prev\",\n\t\t},\n\t\tpagination: {\n\t\t\tel: \".swiper-pagination\",\n\t\t\tclickable: true,\n\t\t\trenderBullet: function (index, className) {\n\t\t\t\treturn `<button class=\"${className}\"></button>`;\n\t\t\t},\n\t\t},\n\t\ton: {\n\t\t\tslideChange: (swiper) => {\n\t\t\t\tconst slidesCount = swiper?.slides?.length;\n\t\t\t\tswiperFraction.textContent = `Article n°${\n\t\t\t\t\tswiper.realIndex + 1\n\t\t\t\t} sur ${slidesCount}`;\n\t\t\t},\n\t\t},\n\n\t\t// pagination: [\n\t\t// \t{\n\t\t// \t\tel: \".swiper-pagination\",\n\t\t// \t\ttype: \"bullets\",\n\t\t// \t\tclickable: true,\n\t\t// \t},\n\t\t// \t{\n\t\t// \t\tel: \".swiper-pagination-fraction\",\n\t\t// \t\ttype: \"fraction\",\n\t\t// \t\trenderFraction: function (currentClass, totalClass) {\n\t\t// \t\t\treturn (\n\t\t// \t\t\t\t'<p class=\"swiper-pagination__text\">' +\n\t\t// \t\t\t\t\"<span class='swiper-pagination__text-label'>Article n°</span>\" +\n\t\t// \t\t\t\t'<span class=\"' +\n\t\t// \t\t\t\tcurrentClass +\n\t\t// \t\t\t\t'\"></span>' +\n\t\t// \t\t\t\t\" sur \" +\n\t\t// \t\t\t\t'<span class=\"' +\n\t\t// \t\t\t\ttotalClass +\n\t\t// \t\t\t\t'\"></span>' +\n\t\t// \t\t\t\t\"</p>\"\n\t\t// \t\t\t);\n\t\t// \t\t},\n\t\t// \t},\n\t\t// ],\n\t});\n});\n"],"names":["document","addEventListener","currentBlock","querySelector","swiperFraction","slides","querySelectorAll","slideCount","length","textContent","Swiper","slidesPerView","spaceBetween","loop","grabCursor","navigation","nextEl","prevEl","pagination","el","clickable","renderBullet","index","className","on","slideChange","swiper","slidesCount","realIndex"],"sourceRoot":""}

View File

@ -1,39 +1,25 @@
/**
* 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, {
icon: {
src: (
<svg
width="96"
height="74"
viewBox="0 0 96 74"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M86.4 2.2C81.6 0.7 76.3 0 71.3 0C62.9 0 53.8 1.7 47.5 6.5C41.2 1.7 32.2 0 23.8 0C15.4 0 6.3 1.7 0 6.5V69.8C0 70.9 1.1 72 2.2 72C3.3 72 2.8 71.8 3.3 71.8C9.1 69 17.6 67 23.8 67C30 67 41.3 68.7 47.6 73.5C53.4 69.8 64 67 71.4 67C78.8 67 85.9 68.3 91.9 71.5C92.3 71.7 92.5 71.7 93 71.7C94.1 71.7 95.2 70.6 95.2 69.5V6.5C92.6 4.6 89.8 3.3 86.6 2.2H86.4ZM86.4 60.5C81.6 59 76.5 58.3 71.3 58.3C64 58.3 53.4 61.1 47.5 64.8V15.1C53.3 11.4 63.9 8.6 71.3 8.6C78.7 8.6 81.7 9.2 86.4 10.8V60.5Z" />
</svg>
),
foreground: "#136f63",
},
edit: Edit,
/**
* @see ./save.js
*/
save,
} );
});

View File

@ -153,7 +153,7 @@ $issue_related_articles = get_field('articles', $last_issue->ID);
<?php get_template_part('template-parts/components/cta--go', null, array(
'url' => get_the_permalink(),
'label' => 'Lire la revue',
'target' => '_blank',
'target' => '_self',
)); ?>
</div>

View File

@ -13,6 +13,7 @@ document.addEventListener("DOMContentLoaded", function () {
slidesPerView: 2,
spaceBetween: 30,
loop: true,
grabCursor: true,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => 'f81af659be9b9ce1ef51');
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => '258714a3f3aff6015e13');

View File

@ -67,42 +67,31 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/explore-tags/edit.js");
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/explore-tags/save.js");
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/explore-tags/block.json");
/**
* 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/
*/
/**
* 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
*/
/**
* Internal dependencies
*/
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__);
/**
* Every block starts by registering a new block type definition.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
*/
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, {
/**
* @see ./edit.js
*/
icon: {
src: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("svg", {
width: "100",
height: "100",
viewBox: "0 0 100 100",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("g", {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
d: "m93.4586,23.83625l1.57497,18.94503l0,0.00408c0.24482,2.87252 -0.79157,5.71244 -2.83168,7.75256l-41.89592,41.89592c-0.13057,0.13057 -0.2693,0.26114 -0.40802,0.38355l8.20548,4.73307c3.51721,2.02789 8.00962,0.82421 10.04159,-2.68888l29.6308,-51.32613c1.08539,-1.86881 1.28532,-4.12514 0.55492,-6.16118l-4.87213,-13.53802z"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
d: "m89.93323,10.8859c-0.2897,-3.58657 -3.13365,-6.43047 -6.71615,-6.71615l-32.10325,-2.67666c-0.20401,-0.01633 -0.40802,-0.02448 -0.61204,-0.02448l0,-0.00407c-1.94631,0 -3.81502,0.77526 -5.19017,2.15439l-41.91263,41.90428l-0.00408,0c-1.37912,1.37912 -2.15846,3.252 -2.15846,5.20239c0,1.95039 0.77933,3.82327 2.15846,5.20239l34.77626,34.7679c2.87252,2.87252 7.53216,2.87252 10.40467,0l41.9001,-41.9001c1.53006,-1.53006 2.3094,-3.65186 2.12587,-5.80624l-2.66857,-32.10363zm-10.6492,13.01616c-2.36654,2.35839 -6.06738,2.72565 -8.8461,0.8691s-3.85586,-5.41861 -2.57879,-8.50735c1.28125,-3.08467 4.56177,-4.8392 7.83821,-4.18635c3.27645,0.65284 5.63483,3.52944 5.63483,6.86709l0,0.00408c0.00816,1.85648 -0.73037,3.63964 -2.04826,4.95347l0.0001,-0.00004z"
})]
})
}),
foreground: "#136f63"
},
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"],
/**
* @see ./save.js
*/
save: _save__WEBPACK_IMPORTED_MODULE_3__["default"]
});

File diff suppressed because one or more lines are too long

View File

@ -1,39 +1,22 @@
/**
* 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, {
icon: {
src: (
<svg width="100" height="100" viewBox="0 0 100 100">
<g>
<path d="m93.4586,23.83625l1.57497,18.94503l0,0.00408c0.24482,2.87252 -0.79157,5.71244 -2.83168,7.75256l-41.89592,41.89592c-0.13057,0.13057 -0.2693,0.26114 -0.40802,0.38355l8.20548,4.73307c3.51721,2.02789 8.00962,0.82421 10.04159,-2.68888l29.6308,-51.32613c1.08539,-1.86881 1.28532,-4.12514 0.55492,-6.16118l-4.87213,-13.53802z" />
<path d="m89.93323,10.8859c-0.2897,-3.58657 -3.13365,-6.43047 -6.71615,-6.71615l-32.10325,-2.67666c-0.20401,-0.01633 -0.40802,-0.02448 -0.61204,-0.02448l0,-0.00407c-1.94631,0 -3.81502,0.77526 -5.19017,2.15439l-41.91263,41.90428l-0.00408,0c-1.37912,1.37912 -2.15846,3.252 -2.15846,5.20239c0,1.95039 0.77933,3.82327 2.15846,5.20239l34.77626,34.7679c2.87252,2.87252 7.53216,2.87252 10.40467,0l41.9001,-41.9001c1.53006,-1.53006 2.3094,-3.65186 2.12587,-5.80624l-2.66857,-32.10363zm-10.6492,13.01616c-2.36654,2.35839 -6.06738,2.72565 -8.8461,0.8691s-3.85586,-5.41861 -2.57879,-8.50735c1.28125,-3.08467 4.56177,-4.8392 7.83821,-4.18635c3.27645,0.65284 5.63483,3.52944 5.63483,6.86709l0,0.00408c0.00816,1.85648 -0.73037,3.63964 -2.04826,4.95347l0.0001,-0.00004z" />
</g>
</svg>
),
foreground: "#136f63",
},
edit: Edit,
/**
* @see ./save.js
*/
save,
} );
});

View File

@ -1,18 +0,0 @@
# 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

View File

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

View File

@ -1,31 +0,0 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "homegrade-content-blocks/questions-container",
"version": "0.1.0",
"title": "Bloc Questions",
"category": "homegrade-blocks",
"icon": {
"background": "#fff",
"foreground": "#DF1E1E",
"src": "feedback"
},
"description": "Pour intégrer le contenu d'une fiche de questions dans une page conseils",
"supports": {
"html": false
},
"textdomain": "homegrade-theme__bloks-texte-fonctionnel",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"render": "file:./render.php",
"attributes": {
"relatedPostId": {
"type": "number"
},
"tooltipsWordsUsed": {
"type": "array",
"default": []
}
}
}

View File

@ -1 +0,0 @@
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => '5f8f6154b4f15c318ad9');

View File

@ -1,14 +0,0 @@
/*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.10.0_webpack@5.90.3/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.4.35_webpack@5.90.3/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@12.6.0_sass@1.71.1_webpack@5.90.3/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***!
\***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/**
* The following styles get applied inside the editor only.
*
* Replace them with your own styles or remove the file completely.
*/
.wp-block-homegrade-content-blocks-questions-container {
opacity: 50%;
filter: saturate(90%);
}
/*# sourceMappingURL=index.css.map*/

View File

@ -1 +0,0 @@
{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACC;EACA;AAAD,C","sources":["webpack://multiblocks/./src/editor.scss"],"sourcesContent":["/**\n * The following styles get applied inside the editor only.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.wp-block-homegrade-content-blocks-questions-container {\n\topacity: 50%;\n\tfilter: saturate(90%);\n}\n"],"names":[],"sourceRoot":""}

View File

@ -1,517 +0,0 @@
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/OptionsSelectControl.js":
/*!*************************************!*\
!*** ./src/OptionsSelectControl.js ***!
\*************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ OptionsSelectControl)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_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 _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss");
/* 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_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities");
/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_7__);
function OptionsSelectControl({
setAttributes,
relatedPostId
}) {
var _ref;
let [relatedQuestionPages, setRelatedQuestionPages] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_6__.useState)(null);
const editUrl = relatedPostId ? `${window.location.origin}/wp-admin/post.php?post=${relatedPostId}&action=edit` : null;
const lang = getAdminLanguageFromCookie("wp-wpml_current_language");
function getAdminLanguageFromCookie(c_name) {
var c_value = document.cookie,
c_start = c_value.indexOf(" " + c_name + "=");
if (c_start == -1) c_start = c_value.indexOf(c_name + "=");
if (c_start == -1) {
c_value = null;
} else {
c_start = c_value.indexOf("=", c_start) + 1;
var c_end = c_value.indexOf(";", c_start);
if (c_end == -1) {
c_end = c_value.length;
}
c_value = unescape(c_value.substring(c_start, c_end));
}
return c_value;
}
function handleRelatedPostChange(postId) {
setAttributes({
relatedPostId: Number(postId)
});
}
function buildSelectOptions(relatedPossiblePages) {
let options = [];
if (relatedPossiblePages) {
options.push({
value: 0,
label: "Selectionnez une page"
});
relatedPossiblePages.forEach(page => {
options.push({
value: page.id,
label: (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_7__.decodeEntities)(page.title.rendered)
});
});
} else {
options.push({
value: 0,
label: "Pas encore de questions..."
});
}
return options;
}
// GET TAXONOMIES INOFRMATION
let postTaxonomies = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core/editor").getCurrentPostAttribute("thematiques"));
let postMainTaxonomy = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => select("core").getEntityRecord("taxonomy", "thematiques", postTaxonomies[0]), [postTaxonomies]);
let postParentTaxonomy = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => {
if (postMainTaxonomy && postMainTaxonomy.parent) {
return select("core").getEntityRecord("taxonomy", "thematiques", postMainTaxonomy.parent);
}
return null;
}, [postMainTaxonomy]);
// GET RELATED POSSIBLE PAGES ACCORDING TO CURRENT TAXONOMY
const relatedPossiblePages = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => {
if (postMainTaxonomy) {
let query = {
status: "publish",
per_page: -1,
lang: lang,
thematiques: postMainTaxonomy ? postMainTaxonomy.id : null
};
return select("core").getEntityRecords("postType", "questions", query);
}
return null;
});
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_6__.useEffect)(() => {
if (relatedPossiblePages) {
setRelatedQuestionPages(buildSelectOptions(relatedPossiblePages));
}
}, [relatedPossiblePages]);
let currentGeneralThematique = (_ref = postParentTaxonomy !== null && postParentTaxonomy !== void 0 ? postParentTaxonomy : postMainTaxonomy) !== null && _ref !== void 0 ? _ref : null;
let panelTitle = postParentTaxonomy ? "Questions " + postParentTaxonomy.name : postMainTaxonomy ? "Questions " + postMainTaxonomy.name : null;
return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.InspectorControls, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.PanelBody, {
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Question Relié", "homegrade-blocks")
}, relatedQuestionPages && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ComboboxControl, {
label: panelTitle,
value: relatedPostId,
options: relatedQuestionPages,
onChange: e => handleRelatedPostChange(e)
}), relatedPostId && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Tip, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Pour modifier le contenu de la question affichée ici, rendez-vous dans la fiche question correspondante.", "homegrade-blocks")), relatedPostId && editUrl && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", {
href: editUrl,
className: "edit-question-button"
}, "Editer la question")));
}
/***/ }),
/***/ "./src/edit.js":
/*!*********************!*\
!*** ./src/edit.js ***!
\*********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ Edit)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_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 _wordpress_data__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities");
/* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _OptionsSelectControl__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./OptionsSelectControl */ "./src/OptionsSelectControl.js");
// pour les querry
function parseBlockContentForTooltips(editorContent) {
const parser = new DOMParser();
const doc = parser.parseFromString(editorContent, "text/html");
const domTooltipWords = doc.querySelectorAll(".tooltip-word");
const filteredTooltipWords = [];
// Looping over tooltip words and filtering duplicates
Array.from(domTooltipWords).forEach(tooltipWord => {
const tooltipID = tooltipWord.getAttribute("data-definition-id");
const tooltipText = tooltipWord.getAttribute("data-tooltip-word");
const tooltipDefinition = tooltipWord.getAttribute("data-tooltip-definition");
const existingTooltip = filteredTooltipWords.find(item => item.tooltipID === tooltipID);
if (!existingTooltip) {
filteredTooltipWords.push({
tooltipID,
tooltipText,
tooltipDefinition
});
}
});
return filteredTooltipWords;
}
function Edit({
attributes,
setAttributes
}) {
const {
relatedPostId
} = attributes;
let currentRelatedPost = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_3__.useSelect)(select => select("core").getEntityRecord("postType", "questions", relatedPostId));
(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.useEffect)(() => {
if (currentRelatedPost) {
const currentBlockTooltips = parseBlockContentForTooltips(currentRelatedPost.content.rendered);
setAttributes({
tooltipsWordsUsed: currentBlockTooltips
});
}
}, [currentRelatedPost]);
return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("section", {
...(0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)({
className: `questions-container`
})
}, !relatedPostId && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Ce bloc n'est relié à aucune question. Rattachez-le à une fiche question dans la barre latérale.", "homegrade-blocks__texte-backoffice"))), currentRelatedPost && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("h3", null, (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_6__.decodeEntities)(currentRelatedPost.title.rendered)), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.RawHTML, null, currentRelatedPost.content.rendered))));
}
/***/ }),
/***/ "./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/style.scss");
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/edit.js");
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./block.json */ "./src/block.json");
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_3__.name, {
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"]
});
/***/ }),
/***/ "./src/editor.scss":
/*!*************************!*\
!*** ./src/editor.scss ***!
\*************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "./src/style.scss":
/*!************************!*\
!*** ./src/style.scss ***!
\************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "react":
/*!************************!*\
!*** external "React" ***!
\************************/
/***/ ((module) => {
module.exports = window["React"];
/***/ }),
/***/ "@wordpress/block-editor":
/*!*************************************!*\
!*** external ["wp","blockEditor"] ***!
\*************************************/
/***/ ((module) => {
module.exports = window["wp"]["blockEditor"];
/***/ }),
/***/ "@wordpress/blocks":
/*!********************************!*\
!*** external ["wp","blocks"] ***!
\********************************/
/***/ ((module) => {
module.exports = window["wp"]["blocks"];
/***/ }),
/***/ "@wordpress/components":
/*!************************************!*\
!*** external ["wp","components"] ***!
\************************************/
/***/ ((module) => {
module.exports = window["wp"]["components"];
/***/ }),
/***/ "@wordpress/data":
/*!******************************!*\
!*** external ["wp","data"] ***!
\******************************/
/***/ ((module) => {
module.exports = window["wp"]["data"];
/***/ }),
/***/ "@wordpress/element":
/*!*********************************!*\
!*** external ["wp","element"] ***!
\*********************************/
/***/ ((module) => {
module.exports = window["wp"]["element"];
/***/ }),
/***/ "@wordpress/html-entities":
/*!**************************************!*\
!*** external ["wp","htmlEntities"] ***!
\**************************************/
/***/ ((module) => {
module.exports = window["wp"]["htmlEntities"];
/***/ }),
/***/ "@wordpress/i18n":
/*!******************************!*\
!*** external ["wp","i18n"] ***!
\******************************/
/***/ ((module) => {
module.exports = window["wp"]["i18n"];
/***/ }),
/***/ "./src/block.json":
/*!************************!*\
!*** ./src/block.json ***!
\************************/
/***/ ((module) => {
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"homegrade-content-blocks/questions-container","version":"0.1.0","title":"Bloc Questions","category":"homegrade-blocks","icon":{"background":"#fff","foreground":"#DF1E1E","src":"feedback"},"description":"Pour intégrer le contenu d\'une fiche de questions dans une page conseils","supports":{"html":false},"textdomain":"homegrade-theme__bloks-texte-fonctionnel","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","attributes":{"relatedPostId":{"type":"number"},"tooltipsWordsUsed":{"type":"array","default":[]}}}');
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/
/******/ /* webpack/runtime/chunk loaded */
/******/ (() => {
/******/ var deferred = [];
/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
/******/ if(chunkIds) {
/******/ priority = priority || 0;
/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ deferred[i] = [chunkIds, fn, priority];
/******/ return;
/******/ }
/******/ var notFulfilled = Infinity;
/******/ for (var i = 0; i < deferred.length; i++) {
/******/ var [chunkIds, fn, priority] = deferred[i];
/******/ var fulfilled = true;
/******/ for (var j = 0; j < chunkIds.length; j++) {
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
/******/ chunkIds.splice(j--, 1);
/******/ } else {
/******/ fulfilled = false;
/******/ if(priority < notFulfilled) notFulfilled = priority;
/******/ }
/******/ }
/******/ if(fulfilled) {
/******/ deferred.splice(i--, 1)
/******/ var r = fn();
/******/ if (r !== undefined) result = r;
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ // no baseURI
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "index": 0,
/******/ "./style-index": 0
/******/ };
/******/
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
/******/
/******/ // no preloaded
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0;
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
/******/ for(moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) var result = runtime(__webpack_require__);
/******/ }
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = globalThis["webpackChunkmultiblocks"] = globalThis["webpackChunkmultiblocks"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["./style-index"], () => (__webpack_require__("./src/index.js")))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/
/******/ })()
;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,16 +0,0 @@
<?php
$relatedPostId = $attributes['relatedPostId'] ?? null;
$relatedPost = get_post($relatedPostId);
if (!$relatedPost->post_content || !$relatedPostId) return;
?>
<section id="questions-container-<?php echo $relatedPostId ?>" class="questions-container-block">
<h2 class="questions-container-block__title"><?php echo $relatedPost->post_title ?></h2>
<?php
if ($relatedPost->post_content || $relatedPostId) {
echo do_blocks($relatedPost->post_content);
}
?>
</section>

View File

@ -1,14 +0,0 @@
/*!**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** css ./node_modules/.pnpm/css-loader@6.10.0_webpack@5.90.3/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/.pnpm/postcss-loader@6.2.1_postcss@8.4.35_webpack@5.90.3/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/.pnpm/sass-loader@12.6.0_sass@1.71.1_webpack@5.90.3/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/style.scss ***!
\**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/**
* 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-homegrade-content-blocks-questions-container h2 {
font-weight: 800;
}
/*# sourceMappingURL=style-index.css.map*/

View File

@ -1 +0,0 @@
{"version":3,"file":"./style-index.css","mappings":";;;AAAA;;;;;EAAA;AAQC;EACC;AADF,C","sources":["webpack://multiblocks/./src/style.scss"],"sourcesContent":["/**\n * The following styles get applied both on the front of your site\n * and in the editor.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.wp-block-homegrade-content-blocks-questions-container {\n\th2 {\n\t\tfont-weight: 800;\n\t}\n}\n"],"names":[],"sourceRoot":""}

View File

@ -1,149 +0,0 @@
import { __ } from "@wordpress/i18n";
import { InspectorControls } from "@wordpress/block-editor";
import {
PanelBody,
SelectControl,
ComboboxControl,
} from "@wordpress/components";
import "./editor.scss";
import { Tip } from "@wordpress/components";
import { useSelect } from "@wordpress/data";
import { useEffect, useState } from "@wordpress/element";
import { decodeEntities } from "@wordpress/html-entities";
export default function OptionsSelectControl({ setAttributes, relatedPostId }) {
let [relatedQuestionPages, setRelatedQuestionPages] = useState(null);
const editUrl = relatedPostId
? `${window.location.origin}/wp-admin/post.php?post=${relatedPostId}&action=edit`
: null;
const lang = getAdminLanguageFromCookie("wp-wpml_current_language");
function getAdminLanguageFromCookie(c_name) {
var c_value = document.cookie,
c_start = c_value.indexOf(" " + c_name + "=");
if (c_start == -1) c_start = c_value.indexOf(c_name + "=");
if (c_start == -1) {
c_value = null;
} else {
c_start = c_value.indexOf("=", c_start) + 1;
var c_end = c_value.indexOf(";", c_start);
if (c_end == -1) {
c_end = c_value.length;
}
c_value = unescape(c_value.substring(c_start, c_end));
}
return c_value;
}
function handleRelatedPostChange(postId) {
setAttributes({ relatedPostId: Number(postId) });
}
function buildSelectOptions(relatedPossiblePages) {
let options = [];
if (relatedPossiblePages) {
options.push({ value: 0, label: "Selectionnez une page" });
relatedPossiblePages.forEach((page) => {
options.push({
value: page.id,
label: decodeEntities(page.title.rendered),
});
});
} else {
options.push({ value: 0, label: "Pas encore de questions..." });
}
return options;
}
// GET TAXONOMIES INOFRMATION
let postTaxonomies = useSelect((select) =>
select("core/editor").getCurrentPostAttribute("thematiques"),
);
let postMainTaxonomy = useSelect(
(select) =>
select("core").getEntityRecord(
"taxonomy",
"thematiques",
postTaxonomies[0],
),
[postTaxonomies],
);
let postParentTaxonomy = useSelect(
(select) => {
if (postMainTaxonomy && postMainTaxonomy.parent) {
return select("core").getEntityRecord(
"taxonomy",
"thematiques",
postMainTaxonomy.parent,
);
}
return null;
},
[postMainTaxonomy],
);
// GET RELATED POSSIBLE PAGES ACCORDING TO CURRENT TAXONOMY
const relatedPossiblePages = useSelect((select) => {
if (postMainTaxonomy) {
let query = {
status: "publish",
per_page: -1,
lang: lang,
thematiques: postMainTaxonomy ? postMainTaxonomy.id : null,
};
return select("core").getEntityRecords("postType", "questions", query);
}
return null;
});
useEffect(() => {
if (relatedPossiblePages) {
setRelatedQuestionPages(buildSelectOptions(relatedPossiblePages));
}
}, [relatedPossiblePages]);
let currentGeneralThematique = postParentTaxonomy ?? postMainTaxonomy ?? null;
let panelTitle = postParentTaxonomy
? "Questions " + postParentTaxonomy.name
: postMainTaxonomy
? "Questions " + postMainTaxonomy.name
: null;
return (
<InspectorControls>
<PanelBody title={__("Question Relié", "homegrade-blocks")}>
{/* <SelectControl
label={panelTitle}
value={relatedPostId}
options={relatedQuestionPages}
onChange={(e) => handleRelatedPostChange(e)}
/> */}
{relatedQuestionPages && (
<ComboboxControl
label={panelTitle}
value={relatedPostId}
options={relatedQuestionPages}
onChange={(e) => handleRelatedPostChange(e)}
/>
)}
{relatedPostId && (
<Tip>
{__(
"Pour modifier le contenu de la question affichée ici, rendez-vous dans la fiche question correspondante.",
"homegrade-blocks",
)}
</Tip>
)}
{relatedPostId && editUrl && (
<a href={editUrl} className="edit-question-button">
Editer la question
</a>
)}
</PanelBody>
</InspectorControls>
);
}

View File

@ -1,31 +0,0 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "homegrade-content-blocks/questions-container",
"version": "0.1.0",
"title": "Bloc Questions",
"category": "homegrade-blocks",
"icon": {
"background": "#fff",
"foreground": "#DF1E1E",
"src": "feedback"
},
"description": "Pour intégrer le contenu d'une fiche de questions dans une page conseils",
"supports": {
"html": false
},
"textdomain": "homegrade-theme__bloks-texte-fonctionnel",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"render": "file:./render.php",
"attributes": {
"relatedPostId": {
"type": "number"
},
"tooltipsWordsUsed": {
"type": "array",
"default": []
}
}
}

View File

@ -1,89 +0,0 @@
import { __ } from "@wordpress/i18n";
import { useBlockProps } from "@wordpress/block-editor";
import { useSelect } from "@wordpress/data"; // pour les querry
import "./editor.scss";
import { RawHTML } from "@wordpress/element";
import { useEffect } from "@wordpress/element";
import { decodeEntities } from "@wordpress/html-entities";
import OptionsSelectControl from "./OptionsSelectControl";
function parseBlockContentForTooltips(editorContent) {
const parser = new DOMParser();
const doc = parser.parseFromString(editorContent, "text/html");
const domTooltipWords = doc.querySelectorAll(".tooltip-word");
const filteredTooltipWords = [];
// Looping over tooltip words and filtering duplicates
Array.from(domTooltipWords).forEach((tooltipWord) => {
const tooltipID = tooltipWord.getAttribute("data-definition-id");
const tooltipText = tooltipWord.getAttribute("data-tooltip-word");
const tooltipDefinition = tooltipWord.getAttribute(
"data-tooltip-definition",
);
const existingTooltip = filteredTooltipWords.find(
(item) => item.tooltipID === tooltipID,
);
if (!existingTooltip) {
filteredTooltipWords.push({
tooltipID,
tooltipText,
tooltipDefinition,
});
}
});
return filteredTooltipWords;
}
export default function Edit({ attributes, setAttributes }) {
const { relatedPostId } = attributes;
let currentRelatedPost = useSelect((select) =>
select("core").getEntityRecord("postType", "questions", relatedPostId),
);
useEffect(() => {
if (currentRelatedPost) {
const currentBlockTooltips = parseBlockContentForTooltips(
currentRelatedPost.content.rendered,
);
setAttributes({ tooltipsWordsUsed: currentBlockTooltips });
}
}, [currentRelatedPost]);
return (
<>
{/* <OptionsSelectControl
relatedPostId={relatedPostId}
setAttributes={setAttributes}
/> */}
<section
{...useBlockProps({
className: `questions-container`,
})}
>
{!relatedPostId && (
<>
<p>
{__(
"Ce bloc n'est relié à aucune question. Rattachez-le à une fiche question dans la barre latérale.",
"homegrade-blocks__texte-backoffice",
)}
</p>
</>
)}
{currentRelatedPost && (
<>
<h3>{decodeEntities(currentRelatedPost.title.rendered)}</h3>
<RawHTML>{currentRelatedPost.content.rendered}</RawHTML>
</>
)}
</section>
</>
);
}

View File

@ -1,10 +0,0 @@
/**
* The following styles get applied inside the editor only.
*
* Replace them with your own styles or remove the file completely.
*/
.wp-block-homegrade-content-blocks-questions-container {
opacity: 50%;
filter: saturate(90%);
}

View File

@ -1,10 +0,0 @@
import { registerBlockType } from "@wordpress/blocks";
import "./style.scss";
import Edit from "./edit";
import metadata from "./block.json";
registerBlockType(metadata.name, {
edit: Edit,
});

View File

@ -1,16 +0,0 @@
<?php
$relatedPostId = $attributes['relatedPostId'] ?? null;
$relatedPost = get_post($relatedPostId);
if (!$relatedPost->post_content || !$relatedPostId) return;
?>
<section id="questions-container-<?php echo $relatedPostId ?>" class="questions-container-block">
<h2 class="questions-container-block__title"><?php echo $relatedPost->post_title ?></h2>
<?php
if ($relatedPost->post_content || $relatedPostId) {
echo do_blocks($relatedPost->post_content);
}
?>
</section>

View File

@ -1,12 +0,0 @@
/**
* 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-homegrade-content-blocks-questions-container {
h2 {
font-weight: 800;
}
}

View File

@ -1 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => 'bebf0d6f2b0eb08b7c44');
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => 'd5d54e18643042f504ee');

View File

@ -67,42 +67,37 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/revues-precedentes/edit.js");
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/revues-precedentes/save.js");
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/revues-precedentes/block.json");
/**
* 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/
*/
/**
* 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
*/
/**
* Internal dependencies
*/
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__);
/**
* Every block starts by registering a new block type definition.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
*/
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, {
/**
* @see ./edit.js
*/
icon: {
src: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("svg", {
width: "50",
height: "50",
viewBox: "0 0 50 50",
xmlns: "http://www.w3.org/2000/svg",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("g", {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
stroke: "null",
d: "m28.5139,42.56948l0,-27.28752a10.50655,10.50655 0 0 1 -7.02779,2.69024l-17.56948,0l0,31.62507l17.56948,0a7.03535,7.03535 0 0 0 7.02779,-7.02779zm-15.81254,-15.81254l7.02779,0a1.75695,1.75695 0 0 1 0,3.5139l-7.02779,0a1.75695,1.75695 0 0 1 0,-3.5139zm7.02779,10.54169l-7.02779,0a1.75695,1.75695 0 0 1 0,-3.5139l7.02779,0a1.75695,1.75695 0 0 1 0,3.5139z"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
stroke: "null",
d: "m30.27085,5.67357a1.75695,1.75695 0 0 1 1.75695,1.75695a7.02779,7.02779 0 0 0 14.05049,0.25739l0,-0.00176a6.73509,6.73509 0 0 0 -1.95513,-4.93457a7.67786,7.67786 0 0 0 -5.49134,-2.34886l-20.6596,0l0,14.05559l3.5139,0a7.03535,7.03535 0 0 0 7.02779,-7.02779a1.75695,1.75695 0 0 1 1.75695,-1.75695z"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("path", {
stroke: "null",
d: "m32.02779,15.28197l0,27.28752a7.02779,7.02779 0 0 0 14.05559,0l0,-27.28752a10.52412,10.52412 0 0 1 -14.05559,0z"
})]
})
}),
foreground: "#136f63"
},
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"],
/**
* @see ./save.js
*/
save: _save__WEBPACK_IMPORTED_MODULE_3__["default"]
});

Some files were not shown because too many files have changed in this diff Show More