FEATURE Refactoring format type and introducing new uppercase format
This commit is contained in:
parent
da65a622b4
commit
bbeb97fe2b
|
|
@ -1,6 +1,6 @@
|
|||
/*!**********************************************************************************************************************************************************************!*\
|
||||
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./src/footnote.css ***!
|
||||
\**********************************************************************************************************************************************************************/
|
||||
/*!******************************************************************************************************************************************************************************!*\
|
||||
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./src/formats/footnote.css ***!
|
||||
\******************************************************************************************************************************************************************************/
|
||||
body {
|
||||
counter-reset: footnote-index;
|
||||
}
|
||||
|
|
@ -60,3 +60,10 @@ body {
|
|||
}
|
||||
}
|
||||
|
||||
/*!********************************************************************************************************************************************************************************************!*\
|
||||
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./src/formats/uppercased-small-title.css ***!
|
||||
\********************************************************************************************************************************************************************************************/
|
||||
.uppercased-small-title {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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' => '8e32672f1170d7729a15');
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-rich-text'), 'version' => 'abb02131aeec09fd0594');
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*!**********************************************************************************************************************************************************************!*\
|
||||
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./src/footnote.css ***!
|
||||
\**********************************************************************************************************************************************************************/
|
||||
/*!******************************************************************************************************************************************************************************!*\
|
||||
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./src/formats/footnote.css ***!
|
||||
\******************************************************************************************************************************************************************************/
|
||||
body {
|
||||
counter-reset: footnote-index;
|
||||
}
|
||||
|
|
@ -60,5 +60,12 @@ body {
|
|||
}
|
||||
}
|
||||
|
||||
/*!********************************************************************************************************************************************************************************************!*\
|
||||
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./src/formats/uppercased-small-title.css ***!
|
||||
\********************************************************************************************************************************************************************************************/
|
||||
.uppercased-small-title {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
|
||||
/*# sourceMappingURL=index.css.map*/
|
||||
|
|
@ -1 +1 @@
|
|||
{"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: 22px;\r\n\t\theight: 22px;\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: 11px !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: 500px;\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;;;;;ACzDA;CACC,yBAAyB;AAC1B","sources":["webpack:///./src/formats/footnote.css","webpack:///./src/formats/uppercased-small-title.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: 22px;\r\n\t\theight: 22px;\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: 11px !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: 500px;\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",".uppercased-small-title {\r\n\ttext-transform: uppercase;\r\n}\r\n"],"names":[],"sourceRoot":""}
|
||||
|
|
@ -33,16 +33,245 @@ const customPostType = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODUL
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/footnote.css":
|
||||
/*!**************************!*\
|
||||
!*** ./src/footnote.css ***!
|
||||
\**************************/
|
||||
/***/ "./node_modules/@wordpress/icons/build-module/library/text-color.js":
|
||||
/*!**************************************************************************!*\
|
||||
!*** ./node_modules/@wordpress/icons/build-module/library/text-color.js ***!
|
||||
\**************************************************************************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/primitives */ "@wordpress/primitives");
|
||||
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__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__);
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
|
||||
const textColor = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__.SVG, {
|
||||
xmlns: "http://www.w3.org/2000/svg",
|
||||
viewBox: "0 0 24 24",
|
||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_0__.Path, {
|
||||
d: "M12.9 6h-2l-4 11h1.9l1.1-3h4.2l1.1 3h1.9L12.9 6zm-2.5 6.5l1.5-4.9 1.7 4.9h-3.2z"
|
||||
})
|
||||
});
|
||||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (textColor);
|
||||
//# sourceMappingURL=text-color.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/formats/footnote.css":
|
||||
/*!**********************************!*\
|
||||
!*** ./src/formats/footnote.css ***!
|
||||
\**********************************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
// extracted by mini-css-extract-plugin
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/formats/footnote.js":
|
||||
/*!*********************************!*\
|
||||
!*** ./src/formats/footnote.js ***!
|
||||
\*********************************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* 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_rich_text__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/rich-text */ "@wordpress/rich-text");
|
||||
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
|
||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__);
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__);
|
||||
/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/icons */ "./node_modules/@wordpress/icons/build-module/library/custom-post-type.js");
|
||||
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
||||
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_4__);
|
||||
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
||||
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_5__);
|
||||
/* harmony import */ var _footnote_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./footnote.css */ "./src/formats/footnote.css");
|
||||
/* 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__);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const formatName = "carhop-format/footnote";
|
||||
const FootnoteFormatButton = props => {
|
||||
const {
|
||||
isActive,
|
||||
value,
|
||||
onChange
|
||||
} = props;
|
||||
const [isPopoverOpen, setIsPopoverOpen] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.useState)(false);
|
||||
|
||||
// Vérifier si on est dans un article (post type 'post')
|
||||
const postType = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_5__.useSelect)(select => {
|
||||
return select("core/editor")?.getCurrentPostType();
|
||||
}, []);
|
||||
|
||||
// Ne pas afficher le bouton si ce n'est pas un article
|
||||
if (postType !== "articles") {
|
||||
return null;
|
||||
}
|
||||
const activeFormat = (0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.getActiveFormats)(value).filter(format => format.type === formatName)[0];
|
||||
function handleFootnoteContentChange(value) {
|
||||
setFormat(value);
|
||||
}
|
||||
function removeFormat() {
|
||||
setIsPopoverOpen(false);
|
||||
onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.toggleFormat)(value, {
|
||||
type: formatName
|
||||
}));
|
||||
}
|
||||
function setFormat(footnoteContent) {
|
||||
onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.applyFormat)(value, {
|
||||
type: formatName,
|
||||
attributes: {
|
||||
dataFootnoteContent: footnoteContent
|
||||
}
|
||||
}));
|
||||
}
|
||||
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.Fragment, {
|
||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.BlockControls, {
|
||||
children: [isPopoverOpen && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Popover, {
|
||||
onClose: () => setIsPopoverOpen(false),
|
||||
className: "popover_footnote_field",
|
||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.TextareaControl, {
|
||||
__nextHasNoMarginBottom: true,
|
||||
__next40pxDefaultSize: true,
|
||||
label: "Note de bas de page",
|
||||
value: activeFormat?.attributes?.dataFootnoteContent || "",
|
||||
onChange: handleFootnoteContentChange
|
||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div", {
|
||||
className: "popover_footnote_field_buttons",
|
||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, {
|
||||
variant: "primary",
|
||||
onClick: () => setIsPopoverOpen(false),
|
||||
children: "Ok"
|
||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, {
|
||||
isDestructive: true,
|
||||
onClick: () => removeFormat(),
|
||||
children: "Supprimer"
|
||||
})]
|
||||
})]
|
||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ToolbarGroup, {
|
||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ToolbarButton, {
|
||||
isActive: isActive,
|
||||
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_8__["default"],
|
||||
isPressed: isActive,
|
||||
label: !isActive ? "Ajouter une note de bas de page" : "Éditer la note de bas de page",
|
||||
onClick: () => setIsPopoverOpen(true)
|
||||
})
|
||||
})]
|
||||
})
|
||||
});
|
||||
};
|
||||
(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: "a",
|
||||
attributes: {
|
||||
dataFootnoteContent: "data-footnote-content"
|
||||
},
|
||||
className: "footnote-reference",
|
||||
edit: FootnoteFormatButton
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/formats/uppercased-small-title.css":
|
||||
/*!************************************************!*\
|
||||
!*** ./src/formats/uppercased-small-title.css ***!
|
||||
\************************************************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
// extracted by mini-css-extract-plugin
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/formats/uppercased-small-title.js":
|
||||
/*!***********************************************!*\
|
||||
!*** ./src/formats/uppercased-small-title.js ***!
|
||||
\***********************************************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* 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_rich_text__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/rich-text */ "@wordpress/rich-text");
|
||||
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
|
||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__);
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__);
|
||||
/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/icons */ "./node_modules/@wordpress/icons/build-module/library/text-color.js");
|
||||
/* 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 _uppercased_small_title_css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./uppercased-small-title.css */ "./src/formats/uppercased-small-title.css");
|
||||
/* 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__);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const formatName = "carhop-format/uppercased-small-title";
|
||||
const UppercasedSmallTitleFormatButton = props => {
|
||||
const {
|
||||
isActive,
|
||||
value,
|
||||
onChange
|
||||
} = props;
|
||||
function toggleUppercasedSmallTitle() {
|
||||
onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.toggleFormat)(value, {
|
||||
type: formatName
|
||||
}));
|
||||
}
|
||||
|
||||
// Vérifier si on est dans un article (post type 'post')
|
||||
const postType = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_4__.useSelect)(select => {
|
||||
return select("core/editor")?.getCurrentPostType();
|
||||
}, []);
|
||||
|
||||
// Ne pas afficher le bouton si ce n'est pas un article
|
||||
if (postType !== "page") {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.BlockControls, {
|
||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ToolbarGroup, {
|
||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ToolbarButton, {
|
||||
isActive: isActive,
|
||||
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_7__["default"],
|
||||
title: !isActive ? "Petit titre en majuscules" : "Retirer Petit titre en majuscules",
|
||||
onClick: toggleUppercasedSmallTitle
|
||||
})
|
||||
})
|
||||
});
|
||||
};
|
||||
(0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.registerFormatType)(formatName, {
|
||||
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)("Petit titre en majuscules", "carhop-format-types"),
|
||||
tagName: "span",
|
||||
className: "uppercased-small-title",
|
||||
edit: UppercasedSmallTitleFormatButton
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/block-editor":
|
||||
|
|
@ -65,6 +294,16 @@ module.exports = window["wp"]["components"];
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/data":
|
||||
/*!******************************!*\
|
||||
!*** external ["wp","data"] ***!
|
||||
\******************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["data"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/element":
|
||||
/*!*********************************!*\
|
||||
!*** external ["wp","element"] ***!
|
||||
|
|
@ -190,98 +429,17 @@ var __webpack_exports__ = {};
|
|||
!*** ./src/index.js ***!
|
||||
\**********************/
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* 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_rich_text__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/rich-text */ "@wordpress/rich-text");
|
||||
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
|
||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__);
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__);
|
||||
/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/icons */ "./node_modules/@wordpress/icons/build-module/library/custom-post-type.js");
|
||||
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
||||
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_4__);
|
||||
/* harmony import */ var _footnote_css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./footnote.css */ "./src/footnote.css");
|
||||
/* 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__);
|
||||
/* harmony import */ var _formats_footnote_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./formats/footnote.js */ "./src/formats/footnote.js");
|
||||
/* harmony import */ var _formats_uppercased_small_title_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./formats/uppercased-small-title.js */ "./src/formats/uppercased-small-title.js");
|
||||
/**
|
||||
* Carhop Format Types
|
||||
*
|
||||
* Point d'entrée principal qui importe tous les format types personnalisés
|
||||
*/
|
||||
|
||||
// Import all format types
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const formatName = "carhop-format/footnote";
|
||||
const FootnoteFormatButton = props => {
|
||||
const {
|
||||
isActive,
|
||||
value,
|
||||
onChange
|
||||
} = props;
|
||||
const [isPopoverOpen, setIsPopoverOpen] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.useState)(false);
|
||||
const activeFormat = (0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.getActiveFormats)(value).filter(format => format.type === formatName)[0];
|
||||
function handleFootnoteContentChange(value) {
|
||||
setFormat(value);
|
||||
}
|
||||
function removeFormat() {
|
||||
setIsPopoverOpen(false);
|
||||
onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.toggleFormat)(value, {
|
||||
type: formatName
|
||||
}));
|
||||
}
|
||||
function setFormat(footnoteContent) {
|
||||
onChange((0,_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_1__.applyFormat)(value, {
|
||||
type: formatName,
|
||||
attributes: {
|
||||
dataFootnoteContent: footnoteContent
|
||||
}
|
||||
}));
|
||||
}
|
||||
return /*#__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__.jsxs)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.BlockControls, {
|
||||
children: [isPopoverOpen && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Popover, {
|
||||
onClose: () => setIsPopoverOpen(false),
|
||||
className: "popover_footnote_field",
|
||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.TextareaControl, {
|
||||
__nextHasNoMarginBottom: true,
|
||||
__next40pxDefaultSize: true,
|
||||
label: "Note de bas de page",
|
||||
value: activeFormat?.attributes?.dataFootnoteContent || "",
|
||||
onChange: handleFootnoteContentChange
|
||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", {
|
||||
className: "popover_footnote_field_buttons",
|
||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, {
|
||||
variant: "primary",
|
||||
onClick: () => setIsPopoverOpen(false),
|
||||
children: "Ok"
|
||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.Button, {
|
||||
isDestructive: true,
|
||||
onClick: () => removeFormat(),
|
||||
children: "Supprimer"
|
||||
})]
|
||||
})]
|
||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ToolbarGroup, {
|
||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ToolbarButton, {
|
||||
isActive: isActive,
|
||||
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_7__["default"],
|
||||
isPressed: isActive,
|
||||
label: !isActive ? "Ajouter une note de bas de page" : "Éditer la note de bas de page",
|
||||
onClick: () => setIsPopoverOpen(true)
|
||||
})
|
||||
})]
|
||||
})
|
||||
});
|
||||
};
|
||||
(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: "a",
|
||||
attributes: {
|
||||
dataFootnoteContent: "data-footnote-content"
|
||||
},
|
||||
className: "footnote-reference",
|
||||
edit: FootnoteFormatButton
|
||||
});
|
||||
})();
|
||||
|
||||
/******/ })()
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -25,6 +25,7 @@ add_action('enqueue_block_editor_assets', 'carhop_format_types_enqueue_assets');
|
|||
|
||||
function carhop_format_types_enqueue_front_assets()
|
||||
{
|
||||
wp_enqueue_style('carhop-format-types-style', plugins_url('src/footnote.css', __FILE__));
|
||||
wp_enqueue_style('carhop-format-types-footnote-style', plugins_url('src/formats/footnote.css', __FILE__));
|
||||
wp_enqueue_style('carhop-format-types-uppercased-small-title-style', plugins_url('src/formats/uppercased-small-title.css', __FILE__));
|
||||
}
|
||||
add_action('wp_enqueue_scripts', 'carhop_format_types_enqueue_front_assets');
|
||||
|
|
|
|||
107
plugins/carhop-format-types/src/formats/footnote.js
Normal file
107
plugins/carhop-format-types/src/formats/footnote.js
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
import { __ } from "@wordpress/i18n";
|
||||
import { registerFormatType, toggleFormat, applyFormat, getActiveFormats } from "@wordpress/rich-text";
|
||||
|
||||
import { BlockControls, __experimentalLinkControl as LinkControl } from "@wordpress/block-editor";
|
||||
import { Popover, ToolbarGroup, ToolbarButton, TextControl, TextareaControl, Button } from "@wordpress/components";
|
||||
|
||||
import { trash, customPostType } from "@wordpress/icons";
|
||||
import { useState } from "@wordpress/element";
|
||||
import { useSelect } from "@wordpress/data";
|
||||
|
||||
import "./footnote.css";
|
||||
|
||||
const formatName = "carhop-format/footnote";
|
||||
|
||||
const FootnoteFormatButton = (props) => {
|
||||
const { isActive, value, onChange } = props;
|
||||
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
||||
|
||||
// Vérifier si on est dans un article (post type 'post')
|
||||
const postType = useSelect((select) => {
|
||||
return select("core/editor")?.getCurrentPostType();
|
||||
}, []);
|
||||
|
||||
// Ne pas afficher le bouton si ce n'est pas un article
|
||||
if (postType !== "articles") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const activeFormat = getActiveFormats(value).filter((format) => format.type === formatName)[0];
|
||||
|
||||
function handleFootnoteContentChange(value) {
|
||||
setFormat(value);
|
||||
}
|
||||
|
||||
function removeFormat() {
|
||||
setIsPopoverOpen(false);
|
||||
onChange(
|
||||
toggleFormat(value, {
|
||||
type: formatName,
|
||||
})
|
||||
);
|
||||
}
|
||||
function setFormat(footnoteContent) {
|
||||
onChange(
|
||||
applyFormat(value, {
|
||||
type: formatName,
|
||||
attributes: {
|
||||
dataFootnoteContent: footnoteContent,
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<BlockControls>
|
||||
{isPopoverOpen && (
|
||||
<Popover
|
||||
onClose={() => setIsPopoverOpen(false)}
|
||||
className='popover_footnote_field'>
|
||||
<TextareaControl
|
||||
__nextHasNoMarginBottom
|
||||
__next40pxDefaultSize
|
||||
label='Note de bas de page'
|
||||
value={activeFormat?.attributes?.dataFootnoteContent || ""}
|
||||
onChange={handleFootnoteContentChange}
|
||||
/>
|
||||
<div className='popover_footnote_field_buttons'>
|
||||
<Button
|
||||
variant='primary'
|
||||
onClick={() => setIsPopoverOpen(false)}>
|
||||
Ok
|
||||
</Button>
|
||||
<Button isDestructive onClick={() => removeFormat()}>
|
||||
Supprimer
|
||||
</Button>
|
||||
</div>
|
||||
</Popover>
|
||||
)}
|
||||
|
||||
<ToolbarGroup>
|
||||
<ToolbarButton
|
||||
isActive={isActive}
|
||||
icon={customPostType}
|
||||
isPressed={isActive}
|
||||
label={
|
||||
!isActive
|
||||
? "Ajouter une note de bas de page"
|
||||
: "Éditer la note de bas de page"
|
||||
}
|
||||
onClick={() => setIsPopoverOpen(true)}
|
||||
/>
|
||||
</ToolbarGroup>
|
||||
</BlockControls>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
registerFormatType(formatName, {
|
||||
title: __("Notes de bas de page", "carhop-format-types"),
|
||||
tagName: "a",
|
||||
attributes: {
|
||||
dataFootnoteContent: "data-footnote-content",
|
||||
},
|
||||
className: "footnote-reference",
|
||||
edit: FootnoteFormatButton,
|
||||
});
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
.uppercased-small-title {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
import { __ } from "@wordpress/i18n";
|
||||
import { registerFormatType, toggleFormat } from "@wordpress/rich-text";
|
||||
|
||||
import { RichTextToolbarButton, BlockControls } from "@wordpress/block-editor";
|
||||
import { ToolbarGroup, ToolbarButton } from "@wordpress/components";
|
||||
|
||||
import { textColor } from "@wordpress/icons";
|
||||
import { useSelect } from "@wordpress/data";
|
||||
|
||||
import "./uppercased-small-title.css";
|
||||
|
||||
const formatName = "carhop-format/uppercased-small-title";
|
||||
|
||||
const UppercasedSmallTitleFormatButton = (props) => {
|
||||
const { isActive, value, onChange } = props;
|
||||
|
||||
function toggleUppercasedSmallTitle() {
|
||||
onChange(
|
||||
toggleFormat(value, {
|
||||
type: formatName,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// Vérifier si on est dans un article (post type 'post')
|
||||
const postType = useSelect((select) => {
|
||||
return select("core/editor")?.getCurrentPostType();
|
||||
}, []);
|
||||
|
||||
// Ne pas afficher le bouton si ce n'est pas un article
|
||||
if (postType !== "page") {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<BlockControls>
|
||||
<ToolbarGroup>
|
||||
<ToolbarButton
|
||||
isActive={isActive}
|
||||
icon={textColor}
|
||||
title={
|
||||
!isActive
|
||||
? "Petit titre en majuscules"
|
||||
: "Retirer Petit titre en majuscules"
|
||||
}
|
||||
onClick={toggleUppercasedSmallTitle}
|
||||
/>
|
||||
</ToolbarGroup>
|
||||
</BlockControls>
|
||||
);
|
||||
};
|
||||
|
||||
registerFormatType(formatName, {
|
||||
title: __("Petit titre en majuscules", "carhop-format-types"),
|
||||
tagName: "span",
|
||||
className: "uppercased-small-title",
|
||||
edit: UppercasedSmallTitleFormatButton,
|
||||
});
|
||||
|
|
@ -1,96 +1,9 @@
|
|||
import { __ } from "@wordpress/i18n";
|
||||
import { registerFormatType, toggleFormat, applyFormat, getActiveFormats } from "@wordpress/rich-text";
|
||||
/**
|
||||
* Carhop Format Types
|
||||
*
|
||||
* Point d'entrée principal qui importe tous les format types personnalisés
|
||||
*/
|
||||
|
||||
import { BlockControls, __experimentalLinkControl as LinkControl } from "@wordpress/block-editor";
|
||||
import { Popover, ToolbarGroup, ToolbarButton, TextControl, TextareaControl, Button } from "@wordpress/components";
|
||||
|
||||
import { trash, customPostType } from "@wordpress/icons";
|
||||
import { useState } from "@wordpress/element";
|
||||
|
||||
import "./footnote.css";
|
||||
|
||||
const formatName = "carhop-format/footnote";
|
||||
|
||||
const FootnoteFormatButton = (props) => {
|
||||
const { isActive, value, onChange } = props;
|
||||
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
||||
|
||||
const activeFormat = getActiveFormats(value).filter((format) => format.type === formatName)[0];
|
||||
|
||||
function handleFootnoteContentChange(value) {
|
||||
setFormat(value);
|
||||
}
|
||||
|
||||
function removeFormat() {
|
||||
setIsPopoverOpen(false);
|
||||
onChange(
|
||||
toggleFormat(value, {
|
||||
type: formatName,
|
||||
})
|
||||
);
|
||||
}
|
||||
function setFormat(footnoteContent) {
|
||||
onChange(
|
||||
applyFormat(value, {
|
||||
type: formatName,
|
||||
attributes: {
|
||||
dataFootnoteContent: footnoteContent,
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<BlockControls>
|
||||
{isPopoverOpen && (
|
||||
<Popover
|
||||
onClose={() => setIsPopoverOpen(false)}
|
||||
className='popover_footnote_field'>
|
||||
<TextareaControl
|
||||
__nextHasNoMarginBottom
|
||||
__next40pxDefaultSize
|
||||
label='Note de bas de page'
|
||||
value={activeFormat?.attributes?.dataFootnoteContent || ""}
|
||||
onChange={handleFootnoteContentChange}
|
||||
/>
|
||||
<div className='popover_footnote_field_buttons'>
|
||||
<Button
|
||||
variant='primary'
|
||||
onClick={() => setIsPopoverOpen(false)}>
|
||||
Ok
|
||||
</Button>
|
||||
<Button isDestructive onClick={() => removeFormat()}>
|
||||
Supprimer
|
||||
</Button>
|
||||
</div>
|
||||
</Popover>
|
||||
)}
|
||||
|
||||
<ToolbarGroup>
|
||||
<ToolbarButton
|
||||
isActive={isActive}
|
||||
icon={customPostType}
|
||||
isPressed={isActive}
|
||||
label={
|
||||
!isActive
|
||||
? "Ajouter une note de bas de page"
|
||||
: "Éditer la note de bas de page"
|
||||
}
|
||||
onClick={() => setIsPopoverOpen(true)}
|
||||
/>
|
||||
</ToolbarGroup>
|
||||
</BlockControls>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
registerFormatType(formatName, {
|
||||
title: __("Notes de bas de page", "carhop-format-types"),
|
||||
tagName: "a",
|
||||
attributes: {
|
||||
dataFootnoteContent: "data-footnote-content",
|
||||
},
|
||||
className: "footnote-reference",
|
||||
edit: FootnoteFormatButton,
|
||||
});
|
||||
// Import all format types
|
||||
import "./formats/footnote.js";
|
||||
import "./formats/uppercased-small-title.js";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user