FEATURE Introducing the new modification date system
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
7f014b07de
commit
a9898919fe
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -9,7 +9,8 @@
|
|||
!plugins/carhop-blocks/**
|
||||
!plugins/carhop-format-types/
|
||||
!plugins/carhop-format-types/**
|
||||
plugins/advanced-custom-fields-pro/
|
||||
!plugins/dynamiques-modification-date/
|
||||
!plugins/dynamiques-modification-date/**
|
||||
plugins/advanced-custom-fields-pro/**
|
||||
!.drone.yml
|
||||
!.gitignore
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-components', 'wp-data', 'wp-date', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '7f901f3fab67f3a48996');
|
||||
311
plugins/dynamiques-modification-date/build/index.js
Normal file
311
plugins/dynamiques-modification-date/build/index.js
Normal file
|
|
@ -0,0 +1,311 @@
|
|||
/******/ (() => { // webpackBootstrap
|
||||
/******/ "use strict";
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ "./src/modification-date.js":
|
||||
/*!**********************************!*\
|
||||
!*** ./src/modification-date.js ***!
|
||||
\**********************************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _wordpress_plugins__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/plugins */ "@wordpress/plugins");
|
||||
/* harmony import */ var _wordpress_plugins__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_plugins__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor");
|
||||
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_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 _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__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_date__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/date */ "@wordpress/date");
|
||||
/* harmony import */ var _wordpress_date__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_date__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__);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const ModificationDatePanel = () => {
|
||||
const {
|
||||
modificationDate
|
||||
} = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_3__.useSelect)(select => {
|
||||
const meta = select("core/editor").getEditedPostAttribute("meta");
|
||||
return {
|
||||
modificationDate: meta?.article_modification_date || ""
|
||||
};
|
||||
});
|
||||
const {
|
||||
editPost
|
||||
} = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_3__.useDispatch)("core/editor");
|
||||
const settings = (0,_wordpress_date__WEBPACK_IMPORTED_MODULE_6__.getSettings)();
|
||||
const updateModificationDate = newDate => {
|
||||
const formattedDate = (0,_wordpress_date__WEBPACK_IMPORTED_MODULE_6__.format)("Y-m-d H:i:s", newDate);
|
||||
editPost({
|
||||
meta: {
|
||||
article_modification_date: formattedDate
|
||||
}
|
||||
});
|
||||
};
|
||||
const clearModificationDate = () => {
|
||||
editPost({
|
||||
meta: {
|
||||
modification_date: ""
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Formater la date pour l'affichage
|
||||
const displayDate = modificationDate ? (0,_wordpress_date__WEBPACK_IMPORTED_MODULE_6__.dateI18n)(settings.formats.datetime, modificationDate) : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)("Non définie", "dynamiques-modification-date");
|
||||
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_wordpress_editor__WEBPACK_IMPORTED_MODULE_2__.PluginDocumentSettingPanel, {
|
||||
name: "modification-date-panel",
|
||||
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)("Dernière mise à jour du papier", "dynamiques-modification-date"),
|
||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
||||
style: {
|
||||
marginBottom: "12px",
|
||||
fontSize: "12px",
|
||||
color: "#757575"
|
||||
},
|
||||
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)("Choisissez ici la dernière date de révision de cet article", "dynamiques-modification-date")
|
||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
||||
style: {
|
||||
marginBottom: "16px"
|
||||
},
|
||||
children: modificationDate ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Dropdown, {
|
||||
popoverProps: {
|
||||
placement: "bottom-start"
|
||||
},
|
||||
contentClassName: "edit-post-post-schedule__dialog",
|
||||
renderToggle: ({
|
||||
isOpen,
|
||||
onToggle
|
||||
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Button, {
|
||||
variant: "secondary",
|
||||
onClick: onToggle,
|
||||
"aria-expanded": isOpen,
|
||||
style: {
|
||||
textAlign: "left",
|
||||
width: "100%",
|
||||
justifyContent: "flex-start",
|
||||
color: "#1e1e1e"
|
||||
},
|
||||
children: displayDate
|
||||
}),
|
||||
renderContent: ({
|
||||
onClose
|
||||
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div", {
|
||||
style: {
|
||||
padding: "16px"
|
||||
},
|
||||
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.DateTimePicker, {
|
||||
currentDate: modificationDate,
|
||||
onChange: newDate => {
|
||||
updateModificationDate(newDate);
|
||||
onClose();
|
||||
},
|
||||
is12Hour: settings.formats.time.includes("a")
|
||||
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
||||
style: {
|
||||
marginTop: "16px",
|
||||
display: "flex",
|
||||
gap: "8px"
|
||||
},
|
||||
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Button, {
|
||||
variant: "secondary",
|
||||
onClick: () => {
|
||||
clearModificationDate();
|
||||
onClose();
|
||||
},
|
||||
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)("Effacer", "dynamiques-modification-date")
|
||||
})
|
||||
})]
|
||||
})
|
||||
}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.Button, {
|
||||
variant: "secondary",
|
||||
onClick: () => updateModificationDate(new Date()),
|
||||
style: {
|
||||
textAlign: "left",
|
||||
width: "100%",
|
||||
justifyContent: "flex-start",
|
||||
color: "#757575"
|
||||
},
|
||||
children: displayDate
|
||||
})
|
||||
})]
|
||||
});
|
||||
};
|
||||
(0,_wordpress_plugins__WEBPACK_IMPORTED_MODULE_0__.registerPlugin)("modification-date-panel", {
|
||||
render: ModificationDatePanel
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/components":
|
||||
/*!************************************!*\
|
||||
!*** external ["wp","components"] ***!
|
||||
\************************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["components"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/data":
|
||||
/*!******************************!*\
|
||||
!*** external ["wp","data"] ***!
|
||||
\******************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["data"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/date":
|
||||
/*!******************************!*\
|
||||
!*** external ["wp","date"] ***!
|
||||
\******************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["date"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/editor":
|
||||
/*!********************************!*\
|
||||
!*** external ["wp","editor"] ***!
|
||||
\********************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["editor"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/element":
|
||||
/*!*********************************!*\
|
||||
!*** external ["wp","element"] ***!
|
||||
\*********************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["element"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/i18n":
|
||||
/*!******************************!*\
|
||||
!*** external ["wp","i18n"] ***!
|
||||
\******************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["i18n"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/plugins":
|
||||
/*!*********************************!*\
|
||||
!*** external ["wp","plugins"] ***!
|
||||
\*********************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["plugins"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "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;
|
||||
/******/ }
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/ /* 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 });
|
||||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
/************************************************************************/
|
||||
var __webpack_exports__ = {};
|
||||
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
|
||||
(() => {
|
||||
/*!**********************!*\
|
||||
!*** ./src/index.js ***!
|
||||
\**********************/
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _modification_date__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modification-date */ "./src/modification-date.js");
|
||||
|
||||
})();
|
||||
|
||||
/******/ })()
|
||||
;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
plugins/dynamiques-modification-date/build/index.js.map
Normal file
1
plugins/dynamiques-modification-date/build/index.js.map
Normal file
File diff suppressed because one or more lines are too long
45
plugins/dynamiques-modification-date/index.php
Normal file
45
plugins/dynamiques-modification-date/index.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Plugin Name: Dynamiques Modification Date
|
||||
* Description: Un plugin pour ajouter une date de modification aux posts
|
||||
* Author: Deligraph
|
||||
* Text Domain: dynamiques-modification-date
|
||||
*/
|
||||
|
||||
if (! defined('ABSPATH')) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
add_action('init', function () {
|
||||
register_post_meta('articles', 'article_modification_date', [
|
||||
'show_in_rest' => true,
|
||||
'single' => true,
|
||||
'type' => 'string', // stockera la date en string (YYYY-MM-DD)
|
||||
'auth_callback' => function (): bool {
|
||||
return current_user_can('edit_posts');
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
add_action('enqueue_block_editor_assets', function () {
|
||||
$asset_file = include(plugin_dir_path(__FILE__) . 'build/index.asset.php');
|
||||
|
||||
wp_enqueue_script(
|
||||
'modification-date-panel',
|
||||
plugin_dir_url(__FILE__) . 'build/index.js',
|
||||
$asset_file['dependencies'],
|
||||
$asset_file['version'],
|
||||
true
|
||||
);
|
||||
|
||||
// Optionnel : Enqueue les styles si nécessaire
|
||||
if (file_exists(plugin_dir_path(__FILE__) . 'build/index.css')) {
|
||||
wp_enqueue_style(
|
||||
'modification-date-panel-style',
|
||||
plugin_dir_url(__FILE__) . 'build/index.css',
|
||||
[],
|
||||
$asset_file['version']
|
||||
);
|
||||
}
|
||||
});
|
||||
20857
plugins/dynamiques-modification-date/package-lock.json
generated
Normal file
20857
plugins/dynamiques-modification-date/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
14
plugins/dynamiques-modification-date/package.json
Normal file
14
plugins/dynamiques-modification-date/package.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "dynamiques-modification-date",
|
||||
"version": "1.0.0",
|
||||
"description": "Un plugin pour ajouter une date de modification aux posts",
|
||||
"scripts": {
|
||||
"build": "wp-scripts build",
|
||||
"start": "wp-scripts start",
|
||||
"lint:js": "wp-scripts lint-js",
|
||||
"format:js": "wp-scripts format-js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wordpress/scripts": "^30.24.0"
|
||||
}
|
||||
}
|
||||
1
plugins/dynamiques-modification-date/src/index.js
Normal file
1
plugins/dynamiques-modification-date/src/index.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
import "./modification-date";
|
||||
128
plugins/dynamiques-modification-date/src/modification-date.js
Normal file
128
plugins/dynamiques-modification-date/src/modification-date.js
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
import { registerPlugin } from "@wordpress/plugins";
|
||||
import { Button, DateTimePicker, Dropdown } from "@wordpress/components";
|
||||
import { PluginDocumentSettingPanel } from "@wordpress/editor";
|
||||
import { useSelect, useDispatch } from "@wordpress/data";
|
||||
import { __ } from "@wordpress/i18n";
|
||||
import { useState } from "@wordpress/element";
|
||||
import { dateI18n, format, getSettings } from "@wordpress/date";
|
||||
|
||||
const ModificationDatePanel = () => {
|
||||
const { modificationDate } = useSelect((select) => {
|
||||
const meta = select("core/editor").getEditedPostAttribute("meta");
|
||||
return {
|
||||
modificationDate: meta?.article_modification_date || "",
|
||||
};
|
||||
});
|
||||
|
||||
const { editPost } = useDispatch("core/editor");
|
||||
const settings = getSettings();
|
||||
|
||||
const updateModificationDate = (newDate) => {
|
||||
const formattedDate = format("Y-m-d H:i:s", newDate);
|
||||
editPost({
|
||||
meta: {
|
||||
article_modification_date: formattedDate,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const clearModificationDate = () => {
|
||||
editPost({
|
||||
meta: {
|
||||
modification_date: "",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// Formater la date pour l'affichage
|
||||
const displayDate = modificationDate
|
||||
? dateI18n(settings.formats.datetime, modificationDate)
|
||||
: __("Non définie", "dynamiques-modification-date");
|
||||
|
||||
return (
|
||||
<PluginDocumentSettingPanel
|
||||
name='modification-date-panel'
|
||||
title={__("Dernière mise à jour du papier", "dynamiques-modification-date")}>
|
||||
<div
|
||||
style={{
|
||||
marginBottom: "12px",
|
||||
fontSize: "12px",
|
||||
color: "#757575",
|
||||
}}>
|
||||
{__(
|
||||
"Choisissez ici la dernière date de révision de cet article",
|
||||
"dynamiques-modification-date"
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div style={{ marginBottom: "16px" }}>
|
||||
{modificationDate ? (
|
||||
<Dropdown
|
||||
popoverProps={{ placement: "bottom-start" }}
|
||||
contentClassName='edit-post-post-schedule__dialog'
|
||||
renderToggle={({ isOpen, onToggle }) => (
|
||||
<Button
|
||||
variant='secondary'
|
||||
onClick={onToggle}
|
||||
aria-expanded={isOpen}
|
||||
style={{
|
||||
textAlign: "left",
|
||||
width: "100%",
|
||||
justifyContent: "flex-start",
|
||||
color: "#1e1e1e",
|
||||
}}>
|
||||
{displayDate}
|
||||
</Button>
|
||||
)}
|
||||
renderContent={({ onClose }) => (
|
||||
<div style={{ padding: "16px" }}>
|
||||
<DateTimePicker
|
||||
currentDate={modificationDate}
|
||||
onChange={(newDate) => {
|
||||
updateModificationDate(newDate);
|
||||
onClose();
|
||||
}}
|
||||
is12Hour={settings.formats.time.includes("a")}
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
marginTop: "16px",
|
||||
display: "flex",
|
||||
gap: "8px",
|
||||
}}>
|
||||
<Button
|
||||
variant='secondary'
|
||||
onClick={() => {
|
||||
clearModificationDate();
|
||||
onClose();
|
||||
}}>
|
||||
{__(
|
||||
"Effacer",
|
||||
"dynamiques-modification-date"
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
) : (
|
||||
<Button
|
||||
variant='secondary'
|
||||
onClick={() => updateModificationDate(new Date())}
|
||||
style={{
|
||||
textAlign: "left",
|
||||
width: "100%",
|
||||
justifyContent: "flex-start",
|
||||
color: "#757575",
|
||||
}}>
|
||||
{displayDate}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</PluginDocumentSettingPanel>
|
||||
);
|
||||
};
|
||||
|
||||
registerPlugin("modification-date-panel", {
|
||||
render: ModificationDatePanel,
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user