From 23dc43cbfbbcc07d36d004b1def099a927a18d5b Mon Sep 17 00:00:00 2001 From: Antoine M Date: Wed, 27 Aug 2025 11:01:16 +0200 Subject: [PATCH] FEATURE Passing a textarea to format type --- plugins/carhop-format-types/build/index-rtl.css | 2 +- plugins/carhop-format-types/build/index.asset.php | 2 +- plugins/carhop-format-types/build/index.css | 2 +- plugins/carhop-format-types/build/index.css.map | 2 +- plugins/carhop-format-types/build/index.js | 2 +- plugins/carhop-format-types/build/index.js.map | 2 +- plugins/carhop-format-types/src/footnote.css | 2 +- plugins/carhop-format-types/src/index.js | 5 +++-- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/plugins/carhop-format-types/build/index-rtl.css b/plugins/carhop-format-types/build/index-rtl.css index cdef6eb..68f187a 100644 --- a/plugins/carhop-format-types/build/index-rtl.css +++ b/plugins/carhop-format-types/build/index-rtl.css @@ -40,7 +40,7 @@ body { .popover_footnote_field { .components-popover__content { padding: 10px !important; - min-width: 300px; + min-width: 500px; } .popover_footnote_field_buttons { display: flex; diff --git a/plugins/carhop-format-types/build/index.asset.php b/plugins/carhop-format-types/build/index.asset.php index 2917f7f..a9227d1 100644 --- a/plugins/carhop-format-types/build/index.asset.php +++ b/plugins/carhop-format-types/build/index.asset.php @@ -1 +1 @@ - array('react-jsx-runtime', 'wp-block-editor', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-rich-text'), 'version' => '2a4a696193922e7ac850'); + array('react-jsx-runtime', 'wp-block-editor', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-rich-text'), 'version' => 'f6950541d590ca633920'); diff --git a/plugins/carhop-format-types/build/index.css b/plugins/carhop-format-types/build/index.css index 8c024ec..3ef0c09 100644 --- a/plugins/carhop-format-types/build/index.css +++ b/plugins/carhop-format-types/build/index.css @@ -40,7 +40,7 @@ body { .popover_footnote_field { .components-popover__content { padding: 10px !important; - min-width: 300px; + min-width: 500px; } .popover_footnote_field_buttons { display: flex; diff --git a/plugins/carhop-format-types/build/index.css.map b/plugins/carhop-format-types/build/index.css.map index 0a7397b..9abaee2 100644 --- a/plugins/carhop-format-types/build/index.css.map +++ b/plugins/carhop-format-types/build/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: 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":""} \ No newline at end of file +{"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: 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":""} \ No newline at end of file diff --git a/plugins/carhop-format-types/build/index.js b/plugins/carhop-format-types/build/index.js index 5e61336..53ce6a7 100644 --- a/plugins/carhop-format-types/build/index.js +++ b/plugins/carhop-format-types/build/index.js @@ -244,7 +244,7 @@ const FootnoteFormatButton = props => { 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__.TextControl, { + 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", diff --git a/plugins/carhop-format-types/build/index.js.map b/plugins/carhop-format-types/build/index.js.map index 2f5c2d3..3295351 100644 --- a/plugins/carhop-format-types/build/index.js.map +++ b/plugins/carhop-format-types/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACkD;AACF;AAChD,oCAAoC,sDAAI,CAAC,sDAAG;AAC5C;AACA;AACA,yBAAyB,sDAAI,CAAC,uDAAI;AAClC;AACA,GAAG;AACH,CAAC;AACD,iEAAe,cAAc,EAAC;AAC9B;;;;;;;;;;;ACbA;;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;;;;;;;;ACNqC;AACkE;AAEL;AAC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EAAED,eAAe,IAAI,EAAG;UACvDZ,QAAQ,EAAES;QAA4B,CACtC,CAAC,eACFjB,uDAAA;UAAKwB,SAAS,EAAC,gCAAgC;UAAAF,QAAA,gBAC9CxB,sDAAA,CAACL,yDAAM;YACNmC,OAAO,EAAC,SAAS;YACjBC,OAAO,EAAEA,CAAA,KAAMnB,gBAAgB,CAAC,KAAK,CAAE;YAAAY,QAAA,EAAC;UAEzC,CAAQ,CAAC,eACTxB,sDAAA,CAACL,yDAAM;YAACqC,aAAa;YAACD,OAAO,EAAEA,CAAA,KAAMV,YAAY,CAAC,CAAE;YAAAG,QAAA,EAAC;UAErD,CAAQ,CAAC;QAAA,CACL,CAAC;MAAA,CACE,CACT,eAEDxB,sDAAA,CAACR,+DAAY;QAAAgC,QAAA,eACZxB,sDAAA,CAACP,gEAAa;UACbe,QAAQ,EAAEA,QAAS;UACnByB,IAAI,EAAEpC,wDAAe;UACrBqC,SAAS,EAAE1B,QAAS;UACpBqB,KAAK,EACJ,CAACrB,QAAQ,GACN,iCAAiC,GACjC,+BACH;UACDuB,OAAO,EAAEA,CAAA,KAAMnB,gBAAgB,CAAC,IAAI;QAAE,CACtC;MAAC,CACW,CAAC;IAAA,CACD;EAAC,CACf,CAAC;AAEL,CAAC;AAED5B,wEAAkB,CAACqB,UAAU,EAAE;EAC9B8B,KAAK,EAAEpD,mDAAE,CAAC,sBAAsB,EAAE,qBAAqB,CAAC;EACxDqD,OAAO,EAAE,GAAG;EACZb,UAAU,EAAE;IACXD,eAAe,EAAE;EAClB,CAAC;EACDI,SAAS,EAAE,oBAAoB;EAC/BW,IAAI,EAAE/B;AACP,CAAC,CAAC,C","sources":["webpack:///./node_modules/@wordpress/icons/build-module/library/custom-post-type.js","webpack:///./src/footnote.css?0d32","webpack:///external window [\"wp\",\"blockEditor\"]","webpack:///external window [\"wp\",\"components\"]","webpack:///external window [\"wp\",\"element\"]","webpack:///external window [\"wp\",\"i18n\"]","webpack:///external window [\"wp\",\"primitives\"]","webpack:///external window [\"wp\",\"richText\"]","webpack:///external window \"ReactJSXRuntime\"","webpack:///webpack/bootstrap","webpack:///webpack/runtime/compat get default export","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///./src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst customPostType = /*#__PURE__*/_jsx(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n children: /*#__PURE__*/_jsx(Path, {\n d: \"M4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4zm.8-4l.7.7 2-2V12h1V9.2l2 2 .7-.7-2-2H12v-1H9.2l2-2-.7-.7-2 2V4h-1v2.8l-2-2-.7.7 2 2H4v1h2.8l-2 2z\"\n })\n});\nexport default customPostType;\n//# sourceMappingURL=custom-post-type.js.map","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"primitives\"];","module.exports = window[\"wp\"][\"richText\"];","module.exports = window[\"ReactJSXRuntime\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { __ } from \"@wordpress/i18n\";\r\nimport { registerFormatType, toggleFormat, applyFormat, getActiveFormats } from \"@wordpress/rich-text\";\r\n\r\nimport { BlockControls, __experimentalLinkControl as LinkControl } from \"@wordpress/block-editor\";\r\nimport { Popover, ToolbarGroup, ToolbarButton, TextControl, Button } from \"@wordpress/components\";\r\nimport { trash, customPostType } from \"@wordpress/icons\";\r\nimport { useState } from \"@wordpress/element\";\r\n\r\nimport \"./footnote.css\";\r\n\r\nconst formatName = \"carhop-format/footnote\";\r\n\r\nconst FootnoteFormatButton = (props) => {\r\n\tconst { isActive, value, onChange } = props;\r\n\tconst [isPopoverOpen, setIsPopoverOpen] = useState(false);\r\n\r\n\tconst activeFormat = getActiveFormats(value).filter((format) => format.type === formatName)[0];\r\n\tconsole.log(activeFormat);\r\n\r\n\tfunction handleFootnoteContentChange(value) {\r\n\t\tsetFormat(value);\r\n\t}\r\n\r\n\tfunction removeFormat() {\r\n\t\tsetIsPopoverOpen(false);\r\n\t\tonChange(\r\n\t\t\ttoggleFormat(value, {\r\n\t\t\t\ttype: formatName,\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\tfunction setFormat(footnoteContent) {\r\n\t\tonChange(\r\n\t\t\tapplyFormat(value, {\r\n\t\t\t\ttype: formatName,\r\n\t\t\t\tattributes: {\r\n\t\t\t\t\tfootnoteContent: footnoteContent,\r\n\t\t\t\t},\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t\r\n\t\t\t\t{isPopoverOpen && (\r\n\t\t\t\t\t setIsPopoverOpen(false)}\r\n\t\t\t\t\t\tclassName='popover_footnote_field'>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t setIsPopoverOpen(false)}>\r\n\t\t\t\t\t\t\t\tOk\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t)}\r\n\r\n\t\t\t\t\r\n\t\t\t\t\t setIsPopoverOpen(true)}\r\n\t\t\t\t\t/>\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t\r\n\t);\r\n};\r\n\r\nregisterFormatType(formatName, {\r\n\ttitle: __(\"Notes de bas de page\", \"carhop-format-types\"),\r\n\ttagName: \"a\",\r\n\tattributes: {\r\n\t\tfootnoteContent: \"footnote-content\",\r\n\t},\r\n\tclassName: \"footnote-reference\",\r\n\tedit: FootnoteFormatButton,\r\n});\r\n"],"names":["__","registerFormatType","toggleFormat","applyFormat","getActiveFormats","BlockControls","__experimentalLinkControl","LinkControl","Popover","ToolbarGroup","ToolbarButton","TextControl","Button","trash","customPostType","useState","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","formatName","FootnoteFormatButton","props","isActive","value","onChange","isPopoverOpen","setIsPopoverOpen","activeFormat","filter","format","type","console","log","handleFootnoteContentChange","setFormat","removeFormat","footnoteContent","attributes","children","onClose","className","__nextHasNoMarginBottom","__next40pxDefaultSize","label","variant","onClick","isDestructive","icon","isPressed","title","tagName","edit"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;AAAA;AAC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wDAAe;UACrBqC,SAAS,EAAE1B,QAAS;UACpBqB,KAAK,EACJ,CAACrB,QAAQ,GACN,iCAAiC,GACjC,+BACH;UACDuB,OAAO,EAAEA,CAAA,KAAMnB,gBAAgB,CAAC,IAAI;QAAE,CACtC;MAAC,CACW,CAAC;IAAA,CACD;EAAC,CACf,CAAC;AAEL,CAAC;AAED7B,wEAAkB,CAACsB,UAAU,EAAE;EAC9B8B,KAAK,EAAErD,mDAAE,CAAC,sBAAsB,EAAE,qBAAqB,CAAC;EACxDsD,OAAO,EAAE,GAAG;EACZb,UAAU,EAAE;IACXD,eAAe,EAAE;EAClB,CAAC;EACDI,SAAS,EAAE,oBAAoB;EAC/BW,IAAI,EAAE/B;AACP,CAAC,CAAC,C","sources":["webpack:///./node_modules/@wordpress/icons/build-module/library/custom-post-type.js","webpack:///./src/footnote.css?0d32","webpack:///external window [\"wp\",\"blockEditor\"]","webpack:///external window [\"wp\",\"components\"]","webpack:///external window [\"wp\",\"element\"]","webpack:///external window [\"wp\",\"i18n\"]","webpack:///external window [\"wp\",\"primitives\"]","webpack:///external window [\"wp\",\"richText\"]","webpack:///external window \"ReactJSXRuntime\"","webpack:///webpack/bootstrap","webpack:///webpack/runtime/compat get default export","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///./src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SVG, Path } from '@wordpress/primitives';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst customPostType = /*#__PURE__*/_jsx(SVG, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n children: /*#__PURE__*/_jsx(Path, {\n d: \"M4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4zm.8-4l.7.7 2-2V12h1V9.2l2 2 .7-.7-2-2H12v-1H9.2l2-2-.7-.7-2 2V4h-1v2.8l-2-2-.7.7 2 2H4v1h2.8l-2 2z\"\n })\n});\nexport default customPostType;\n//# sourceMappingURL=custom-post-type.js.map","// extracted by mini-css-extract-plugin\nexport {};","module.exports = window[\"wp\"][\"blockEditor\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","module.exports = window[\"wp\"][\"primitives\"];","module.exports = window[\"wp\"][\"richText\"];","module.exports = window[\"ReactJSXRuntime\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { __ } from \"@wordpress/i18n\";\r\nimport { registerFormatType, toggleFormat, applyFormat, getActiveFormats } from \"@wordpress/rich-text\";\r\n\r\nimport { BlockControls, __experimentalLinkControl as LinkControl } from \"@wordpress/block-editor\";\r\nimport { Popover, ToolbarGroup, ToolbarButton, TextControl, TextareaControl, Button } from \"@wordpress/components\";\r\n\r\nimport { trash, customPostType } from \"@wordpress/icons\";\r\nimport { useState } from \"@wordpress/element\";\r\n\r\nimport \"./footnote.css\";\r\n\r\nconst formatName = \"carhop-format/footnote\";\r\n\r\nconst FootnoteFormatButton = (props) => {\r\n\tconst { isActive, value, onChange } = props;\r\n\tconst [isPopoverOpen, setIsPopoverOpen] = useState(false);\r\n\r\n\tconst activeFormat = getActiveFormats(value).filter((format) => format.type === formatName)[0];\r\n\tconsole.log(activeFormat);\r\n\r\n\tfunction handleFootnoteContentChange(value) {\r\n\t\tsetFormat(value);\r\n\t}\r\n\r\n\tfunction removeFormat() {\r\n\t\tsetIsPopoverOpen(false);\r\n\t\tonChange(\r\n\t\t\ttoggleFormat(value, {\r\n\t\t\t\ttype: formatName,\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\tfunction setFormat(footnoteContent) {\r\n\t\tonChange(\r\n\t\t\tapplyFormat(value, {\r\n\t\t\t\ttype: formatName,\r\n\t\t\t\tattributes: {\r\n\t\t\t\t\tfootnoteContent: footnoteContent,\r\n\t\t\t\t},\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t\r\n\t\t\t\t{isPopoverOpen && (\r\n\t\t\t\t\t setIsPopoverOpen(false)}\r\n\t\t\t\t\t\tclassName='popover_footnote_field'>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t setIsPopoverOpen(false)}>\r\n\t\t\t\t\t\t\t\tOk\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t
\r\n\t\t\t\t\t\r\n\t\t\t\t)}\r\n\r\n\t\t\t\t\r\n\t\t\t\t\t setIsPopoverOpen(true)}\r\n\t\t\t\t\t/>\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t\r\n\t);\r\n};\r\n\r\nregisterFormatType(formatName, {\r\n\ttitle: __(\"Notes de bas de page\", \"carhop-format-types\"),\r\n\ttagName: \"a\",\r\n\tattributes: {\r\n\t\tfootnoteContent: \"footnote-content\",\r\n\t},\r\n\tclassName: \"footnote-reference\",\r\n\tedit: FootnoteFormatButton,\r\n});\r\n"],"names":["__","registerFormatType","toggleFormat","applyFormat","getActiveFormats","BlockControls","__experimentalLinkControl","LinkControl","Popover","ToolbarGroup","ToolbarButton","TextControl","TextareaControl","Button","trash","customPostType","useState","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","formatName","FootnoteFormatButton","props","isActive","value","onChange","isPopoverOpen","setIsPopoverOpen","activeFormat","filter","format","type","console","log","handleFootnoteContentChange","setFormat","removeFormat","footnoteContent","attributes","children","onClose","className","__nextHasNoMarginBottom","__next40pxDefaultSize","label","variant","onClick","isDestructive","icon","isPressed","title","tagName","edit"],"sourceRoot":""} \ No newline at end of file diff --git a/plugins/carhop-format-types/src/footnote.css b/plugins/carhop-format-types/src/footnote.css index b2c39bd..e89c33b 100644 --- a/plugins/carhop-format-types/src/footnote.css +++ b/plugins/carhop-format-types/src/footnote.css @@ -37,7 +37,7 @@ body { .popover_footnote_field { .components-popover__content { padding: 10px !important; - min-width: 300px; + min-width: 500px; } .popover_footnote_field_buttons { display: flex; diff --git a/plugins/carhop-format-types/src/index.js b/plugins/carhop-format-types/src/index.js index db66589..77c8284 100644 --- a/plugins/carhop-format-types/src/index.js +++ b/plugins/carhop-format-types/src/index.js @@ -2,7 +2,8 @@ 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, Button } from "@wordpress/components"; +import { Popover, ToolbarGroup, ToolbarButton, TextControl, TextareaControl, Button } from "@wordpress/components"; + import { trash, customPostType } from "@wordpress/icons"; import { useState } from "@wordpress/element"; @@ -47,7 +48,7 @@ const FootnoteFormatButton = (props) => { setIsPopoverOpen(false)} className='popover_footnote_field'> -