@wordpress/edit-post 8.32.0 → 8.32.1-next.ff1cebbba.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/commands/use-commands.js +54 -47
- package/build/commands/use-commands.js.map +7 -1
- package/build/components/back-button/fullscreen-mode-close.js +127 -118
- package/build/components/back-button/fullscreen-mode-close.js.map +7 -1
- package/build/components/back-button/index.js +56 -54
- package/build/components/back-button/index.js.map +7 -1
- package/build/components/browser-url/index.js +45 -44
- package/build/components/browser-url/index.js.map +7 -1
- package/build/components/editor-initialization/index.js +24 -18
- package/build/components/editor-initialization/index.js.map +7 -1
- package/build/components/editor-initialization/listener-hooks.js +42 -43
- package/build/components/editor-initialization/listener-hooks.js.map +7 -1
- package/build/components/init-pattern-modal/index.js +100 -79
- package/build/components/init-pattern-modal/index.js.map +7 -1
- package/build/components/keyboard-shortcuts/index.js +37 -33
- package/build/components/keyboard-shortcuts/index.js.map +7 -1
- package/build/components/layout/index.js +447 -467
- package/build/components/layout/index.js.map +7 -1
- package/build/components/layout/use-padding-appender.js +66 -59
- package/build/components/layout/use-padding-appender.js.map +7 -1
- package/build/components/layout/use-should-iframe.js +36 -30
- package/build/components/layout/use-should-iframe.js.map +7 -1
- package/build/components/meta-boxes/index.js +46 -33
- package/build/components/meta-boxes/index.js.map +7 -1
- package/build/components/meta-boxes/meta-box-visibility.js +37 -22
- package/build/components/meta-boxes/meta-box-visibility.js.map +7 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js +62 -53
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +7 -1
- package/build/components/meta-boxes/use-meta-box-initialization.js +37 -32
- package/build/components/meta-boxes/use-meta-box-initialization.js.map +7 -1
- package/build/components/more-menu/index.js +64 -44
- package/build/components/more-menu/index.js.map +7 -1
- package/build/components/more-menu/manage-patterns-menu-item.js +39 -37
- package/build/components/more-menu/manage-patterns-menu-item.js.map +7 -1
- package/build/components/more-menu/welcome-guide-menu-item.js +39 -21
- package/build/components/more-menu/welcome-guide-menu-item.js.map +7 -1
- package/build/components/preferences-modal/enable-custom-fields.js +76 -66
- package/build/components/preferences-modal/enable-custom-fields.js.map +7 -1
- package/build/components/preferences-modal/enable-panel.js +47 -43
- package/build/components/preferences-modal/enable-panel.js.map +7 -1
- package/build/components/preferences-modal/index.js +51 -39
- package/build/components/preferences-modal/index.js.map +7 -1
- package/build/components/preferences-modal/meta-boxes-section.js +65 -52
- package/build/components/preferences-modal/meta-boxes-section.js.map +7 -1
- package/build/components/welcome-guide/default.js +134 -97
- package/build/components/welcome-guide/default.js.map +7 -1
- package/build/components/welcome-guide/image.js +34 -23
- package/build/components/welcome-guide/image.js.map +7 -1
- package/build/components/welcome-guide/index.js +51 -38
- package/build/components/welcome-guide/index.js.map +7 -1
- package/build/components/welcome-guide/template.js +65 -45
- package/build/components/welcome-guide/template.js.map +7 -1
- package/build/deprecated.js +84 -110
- package/build/deprecated.js.map +7 -1
- package/build/hooks/use-navigate-to-entity-record.js +60 -78
- package/build/hooks/use-navigate-to-entity-record.js.map +7 -1
- package/build/index.js +101 -136
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -15
- package/build/lock-unlock.js.map +7 -1
- package/build/store/actions.js +239 -431
- package/build/store/actions.js.map +7 -1
- package/build/store/constants.js +33 -26
- package/build/store/constants.js.map +7 -1
- package/build/store/index.js +44 -32
- package/build/store/index.js.map +7 -1
- package/build/store/reducer.js +50 -57
- package/build/store/reducer.js.map +7 -1
- package/build/store/selectors.js +288 -459
- package/build/store/selectors.js.map +7 -1
- package/build/utils/meta-boxes.js +31 -19
- package/build/utils/meta-boxes.js.map +7 -1
- package/build-module/commands/use-commands.js +35 -40
- package/build-module/commands/use-commands.js.map +7 -1
- package/build-module/components/back-button/fullscreen-mode-close.js +102 -110
- package/build-module/components/back-button/fullscreen-mode-close.js.map +7 -1
- package/build-module/components/back-button/index.js +28 -47
- package/build-module/components/back-button/index.js.map +7 -1
- package/build-module/components/browser-url/index.js +23 -38
- package/build-module/components/browser-url/index.js.map +7 -1
- package/build-module/components/editor-initialization/index.js +6 -13
- package/build-module/components/editor-initialization/index.js.map +7 -1
- package/build-module/components/editor-initialization/listener-hooks.js +20 -34
- package/build-module/components/editor-initialization/listener-hooks.js.map +7 -1
- package/build-module/components/init-pattern-modal/index.js +90 -74
- package/build-module/components/init-pattern-modal/index.js.map +7 -1
- package/build-module/components/keyboard-shortcuts/index.js +21 -26
- package/build-module/components/keyboard-shortcuts/index.js.map +7 -1
- package/build-module/components/layout/index.js +439 -448
- package/build-module/components/layout/index.js.map +7 -1
- package/build-module/components/layout/use-padding-appender.js +44 -54
- package/build-module/components/layout/use-padding-appender.js.map +7 -1
- package/build-module/components/layout/use-should-iframe.js +15 -25
- package/build-module/components/layout/use-should-iframe.js.map +7 -1
- package/build-module/components/meta-boxes/index.js +18 -26
- package/build-module/components/meta-boxes/index.js.map +7 -1
- package/build-module/components/meta-boxes/meta-box-visibility.js +18 -15
- package/build-module/components/meta-boxes/meta-box-visibility.js.map +7 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.js +30 -44
- package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +7 -1
- package/build-module/components/meta-boxes/use-meta-box-initialization.js +14 -25
- package/build-module/components/meta-boxes/use-meta-box-initialization.js.map +7 -1
- package/build-module/components/more-menu/index.js +36 -37
- package/build-module/components/more-menu/index.js.map +7 -1
- package/build-module/components/more-menu/manage-patterns-menu-item.js +21 -31
- package/build-module/components/more-menu/manage-patterns-menu-item.js.map +7 -1
- package/build-module/components/more-menu/welcome-guide-menu-item.js +22 -16
- package/build-module/components/more-menu/welcome-guide-menu-item.js.map +7 -1
- package/build-module/components/preferences-modal/enable-custom-fields.js +51 -56
- package/build-module/components/preferences-modal/enable-custom-fields.js.map +7 -1
- package/build-module/components/preferences-modal/enable-panel.js +30 -38
- package/build-module/components/preferences-modal/enable-panel.js.map +7 -1
- package/build-module/components/preferences-modal/index.js +24 -34
- package/build-module/components/preferences-modal/index.js.map +7 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js +34 -45
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +7 -1
- package/build-module/components/welcome-guide/default.js +107 -91
- package/build-module/components/welcome-guide/default.js.map +7 -1
- package/build-module/components/welcome-guide/image.js +16 -18
- package/build-module/components/welcome-guide/image.js.map +7 -1
- package/build-module/components/welcome-guide/index.js +23 -31
- package/build-module/components/welcome-guide/index.js.map +7 -1
- package/build-module/components/welcome-guide/template.js +38 -39
- package/build-module/components/welcome-guide/template.js.map +7 -1
- package/build-module/deprecated.js +62 -103
- package/build-module/deprecated.js.map +7 -1
- package/build-module/hooks/use-navigate-to-entity-record.js +42 -73
- package/build-module/hooks/use-navigate-to-entity-record.js.map +7 -1
- package/build-module/index.js +70 -95
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/store/actions.js +158 -368
- package/build-module/store/actions.js.map +7 -1
- package/build-module/store/constants.js +9 -21
- package/build-module/store/constants.js.map +7 -1
- package/build-module/store/index.js +10 -22
- package/build-module/store/index.js.map +7 -1
- package/build-module/store/reducer.js +28 -51
- package/build-module/store/reducer.js.map +7 -1
- package/build-module/store/selectors.js +232 -442
- package/build-module/store/selectors.js.map +7 -1
- package/build-module/utils/meta-boxes.js +9 -13
- package/build-module/utils/meta-boxes.js.map +7 -1
- package/build-style/classic-rtl.css +0 -154
- package/build-style/classic.css +0 -154
- package/build-style/style-rtl.css +135 -110
- package/build-style/style.css +135 -110
- package/package.json +39 -31
- package/src/classic.scss +3 -0
- package/src/components/back-button/style.scss +3 -0
- package/src/components/layout/index.js +3 -2
- package/src/components/layout/style.scss +4 -0
- package/src/components/meta-boxes/meta-boxes-area/style.scss +3 -0
- package/src/components/welcome-guide/style.scss +3 -0
- package/src/style.scss +8 -4
- package/build/components/header/header-toolbar/index.native.js +0 -204
- package/build/components/header/header-toolbar/index.native.js.map +0 -1
- package/build/components/header/index.native.js +0 -59
- package/build/components/header/index.native.js.map +0 -1
- package/build/components/layout/index.native.js +0 -166
- package/build/components/layout/index.native.js.map +0 -1
- package/build/components/visual-editor/header.native.js +0 -63
- package/build/components/visual-editor/header.native.js.map +0 -1
- package/build/components/visual-editor/index.native.js +0 -44
- package/build/components/visual-editor/index.native.js.map +0 -1
- package/build/editor.native.js +0 -157
- package/build/editor.native.js.map +0 -1
- package/build/index.native.js +0 -58
- package/build/index.native.js.map +0 -1
- package/build-module/components/header/header-toolbar/index.native.js +0 -196
- package/build-module/components/header/header-toolbar/index.native.js.map +0 -1
- package/build-module/components/header/index.native.js +0 -50
- package/build-module/components/header/index.native.js.map +0 -1
- package/build-module/components/layout/index.native.js +0 -158
- package/build-module/components/layout/index.native.js.map +0 -1
- package/build-module/components/visual-editor/header.native.js +0 -56
- package/build-module/components/visual-editor/header.native.js.map +0 -1
- package/build-module/components/visual-editor/index.native.js +0 -35
- package/build-module/components/visual-editor/index.native.js.map +0 -1
- package/build-module/editor.native.js +0 -149
- package/build-module/editor.native.js.map +0 -1
- package/build-module/index.native.js +0 -45
- package/build-module/index.native.js.map +0 -1
|
@@ -1,59 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
import { useRef, useEffect } from '@wordpress/element';
|
|
10
|
-
import { Spinner } from '@wordpress/components';
|
|
11
|
-
import { useSelect } from '@wordpress/data';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
import { store as editPostStore } from '../../../store';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Render metabox area.
|
|
20
|
-
*
|
|
21
|
-
* @param {Object} props Component props.
|
|
22
|
-
* @param {string} props.location metabox location.
|
|
23
|
-
* @return {Component} The component to be rendered.
|
|
24
|
-
*/
|
|
25
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
-
function MetaBoxesArea({
|
|
27
|
-
location
|
|
28
|
-
}) {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { useRef, useEffect } from "@wordpress/element";
|
|
4
|
+
import { Spinner } from "@wordpress/components";
|
|
5
|
+
import { useSelect } from "@wordpress/data";
|
|
6
|
+
import { store as editPostStore } from "../../../store";
|
|
7
|
+
function MetaBoxesArea({ location }) {
|
|
29
8
|
const container = useRef(null);
|
|
30
9
|
const formRef = useRef(null);
|
|
31
10
|
useEffect(() => {
|
|
32
|
-
formRef.current = document.querySelector(
|
|
11
|
+
formRef.current = document.querySelector(
|
|
12
|
+
".metabox-location-" + location
|
|
13
|
+
);
|
|
33
14
|
if (formRef.current) {
|
|
34
15
|
container.current.appendChild(formRef.current);
|
|
35
16
|
}
|
|
36
17
|
return () => {
|
|
37
18
|
if (formRef.current) {
|
|
38
|
-
document.querySelector(
|
|
19
|
+
document.querySelector("#metaboxes").appendChild(formRef.current);
|
|
39
20
|
}
|
|
40
21
|
};
|
|
41
22
|
}, [location]);
|
|
42
|
-
const isSaving = useSelect(select => {
|
|
23
|
+
const isSaving = useSelect((select) => {
|
|
43
24
|
return select(editPostStore).isSavingMetaBoxes();
|
|
44
25
|
}, []);
|
|
45
|
-
const classes = clsx(
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
49
|
-
className: classes,
|
|
50
|
-
children: [isSaving && /*#__PURE__*/_jsx(Spinner, {}), /*#__PURE__*/_jsx("div", {
|
|
51
|
-
className: "edit-post-meta-boxes-area__container",
|
|
52
|
-
ref: container
|
|
53
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
54
|
-
className: "edit-post-meta-boxes-area__clear"
|
|
55
|
-
})]
|
|
26
|
+
const classes = clsx("edit-post-meta-boxes-area", `is-${location}`, {
|
|
27
|
+
"is-loading": isSaving
|
|
56
28
|
});
|
|
29
|
+
return /* @__PURE__ */ jsxs("div", { className: classes, children: [
|
|
30
|
+
isSaving && /* @__PURE__ */ jsx(Spinner, {}),
|
|
31
|
+
/* @__PURE__ */ jsx(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: "edit-post-meta-boxes-area__container",
|
|
35
|
+
ref: container
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ jsx("div", { className: "edit-post-meta-boxes-area__clear" })
|
|
39
|
+
] });
|
|
57
40
|
}
|
|
58
|
-
|
|
59
|
-
|
|
41
|
+
var meta_boxes_area_default = MetaBoxesArea;
|
|
42
|
+
export {
|
|
43
|
+
meta_boxes_area_default as default
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/meta-boxes/meta-boxes-area/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { Spinner } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\n/**\n * Render metabox area.\n *\n * @param {Object} props Component props.\n * @param {string} props.location metabox location.\n * @return {Component} The component to be rendered.\n */\nfunction MetaBoxesArea( { location } ) {\n\tconst container = useRef( null );\n\tconst formRef = useRef( null );\n\n\tuseEffect( () => {\n\t\tformRef.current = document.querySelector(\n\t\t\t'.metabox-location-' + location\n\t\t);\n\n\t\tif ( formRef.current ) {\n\t\t\tcontainer.current.appendChild( formRef.current );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif ( formRef.current ) {\n\t\t\t\tdocument\n\t\t\t\t\t.querySelector( '#metaboxes' )\n\t\t\t\t\t.appendChild( formRef.current );\n\t\t\t}\n\t\t};\n\t}, [ location ] );\n\n\tconst isSaving = useSelect( ( select ) => {\n\t\treturn select( editPostStore ).isSavingMetaBoxes();\n\t}, [] );\n\n\tconst classes = clsx( 'edit-post-meta-boxes-area', `is-${ location }`, {\n\t\t'is-loading': isSaving,\n\t} );\n\n\treturn (\n\t\t<div className={ classes }>\n\t\t\t{ isSaving && <Spinner /> }\n\t\t\t<div\n\t\t\t\tclassName=\"edit-post-meta-boxes-area__container\"\n\t\t\t\tref={ container }\n\t\t\t/>\n\t\t\t<div className=\"edit-post-meta-boxes-area__clear\" />\n\t\t</div>\n\t);\n}\n\nexport default MetaBoxesArea;\n"],
|
|
5
|
+
"mappings": "AAuDE,SACe,KADf;AApDF,OAAO,UAAU;AAKjB,SAAS,QAAQ,iBAAiB;AAClC,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAK1B,SAAS,SAAS,qBAAqB;AASvC,SAAS,cAAe,EAAE,SAAS,GAAI;AACtC,QAAM,YAAY,OAAQ,IAAK;AAC/B,QAAM,UAAU,OAAQ,IAAK;AAE7B,YAAW,MAAM;AAChB,YAAQ,UAAU,SAAS;AAAA,MAC1B,uBAAuB;AAAA,IACxB;AAEA,QAAK,QAAQ,SAAU;AACtB,gBAAU,QAAQ,YAAa,QAAQ,OAAQ;AAAA,IAChD;AAEA,WAAO,MAAM;AACZ,UAAK,QAAQ,SAAU;AACtB,iBACE,cAAe,YAAa,EAC5B,YAAa,QAAQ,OAAQ;AAAA,MAChC;AAAA,IACD;AAAA,EACD,GAAG,CAAE,QAAS,CAAE;AAEhB,QAAM,WAAW,UAAW,CAAE,WAAY;AACzC,WAAO,OAAQ,aAAc,EAAE,kBAAkB;AAAA,EAClD,GAAG,CAAC,CAAE;AAEN,QAAM,UAAU,KAAM,6BAA6B,MAAO,QAAS,IAAI;AAAA,IACtE,cAAc;AAAA,EACf,CAAE;AAEF,SACC,qBAAC,SAAI,WAAY,SACd;AAAA,gBAAY,oBAAC,WAAQ;AAAA,IACvB;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,KAAM;AAAA;AAAA,IACP;AAAA,IACA,oBAAC,SAAI,WAAU,oCAAmC;AAAA,KACnD;AAEF;AAEA,IAAO,0BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import { store as editPostStore } from '../../store';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Initializes WordPress `postboxes` script and the logic for saving meta boxes.
|
|
15
|
-
*
|
|
16
|
-
* @param { boolean } enabled
|
|
17
|
-
*/
|
|
18
|
-
export const useMetaBoxInitialization = enabled => {
|
|
19
|
-
const isEnabledAndEditorReady = useSelect(select => enabled && select(editorStore).__unstableIsEditorReady(), [enabled]);
|
|
20
|
-
const {
|
|
21
|
-
initializeMetaBoxes
|
|
22
|
-
} = useDispatch(editPostStore);
|
|
23
|
-
// The effect has to rerun when the editor is ready because initializeMetaBoxes
|
|
24
|
-
// will noop until then.
|
|
1
|
+
import { useDispatch, useSelect } from "@wordpress/data";
|
|
2
|
+
import { store as editorStore } from "@wordpress/editor";
|
|
3
|
+
import { useEffect } from "@wordpress/element";
|
|
4
|
+
import { store as editPostStore } from "../../store";
|
|
5
|
+
const useMetaBoxInitialization = (enabled) => {
|
|
6
|
+
const isEnabledAndEditorReady = useSelect(
|
|
7
|
+
(select) => enabled && select(editorStore).__unstableIsEditorReady(),
|
|
8
|
+
[enabled]
|
|
9
|
+
);
|
|
10
|
+
const { initializeMetaBoxes } = useDispatch(editPostStore);
|
|
25
11
|
useEffect(() => {
|
|
26
12
|
if (isEnabledAndEditorReady) {
|
|
27
13
|
initializeMetaBoxes();
|
|
28
14
|
}
|
|
29
15
|
}, [isEnabledAndEditorReady, initializeMetaBoxes]);
|
|
30
16
|
};
|
|
31
|
-
|
|
17
|
+
export {
|
|
18
|
+
useMetaBoxInitialization
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=use-meta-box-initialization.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/meta-boxes/use-meta-box-initialization.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\n/**\n * Initializes WordPress `postboxes` script and the logic for saving meta boxes.\n *\n * @param { boolean } enabled\n */\nexport const useMetaBoxInitialization = ( enabled ) => {\n\tconst isEnabledAndEditorReady = useSelect(\n\t\t( select ) =>\n\t\t\tenabled && select( editorStore ).__unstableIsEditorReady(),\n\t\t[ enabled ]\n\t);\n\tconst { initializeMetaBoxes } = useDispatch( editPostStore );\n\t// The effect has to rerun when the editor is ready because initializeMetaBoxes\n\t// will noop until then.\n\tuseEffect( () => {\n\t\tif ( isEnabledAndEditorReady ) {\n\t\t\tinitializeMetaBoxes();\n\t\t}\n\t}, [ isEnabledAndEditorReady, initializeMetaBoxes ] );\n};\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,aAAa,iBAAiB;AACvC,SAAS,SAAS,mBAAmB;AACrC,SAAS,iBAAiB;AAK1B,SAAS,SAAS,qBAAqB;AAOhC,MAAM,2BAA2B,CAAE,YAAa;AACtD,QAAM,0BAA0B;AAAA,IAC/B,CAAE,WACD,WAAW,OAAQ,WAAY,EAAE,wBAAwB;AAAA,IAC1D,CAAE,OAAQ;AAAA,EACX;AACA,QAAM,EAAE,oBAAoB,IAAI,YAAa,aAAc;AAG3D,YAAW,MAAM;AAChB,QAAK,yBAA0B;AAC9B,0BAAoB;AAAA,IACrB;AAAA,EACD,GAAG,CAAE,yBAAyB,mBAAoB,CAAE;AACrD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
import { unlock } from '../../lock-unlock';
|
|
14
|
-
import ManagePatternsMenuItem from './manage-patterns-menu-item';
|
|
15
|
-
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
16
|
-
import EditPostPreferencesModal from '../preferences-modal';
|
|
17
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
-
const {
|
|
19
|
-
ToolsMoreMenuGroup,
|
|
20
|
-
ViewMoreMenuGroup
|
|
21
|
-
} = unlock(editorPrivateApis);
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { __ } from "@wordpress/i18n";
|
|
3
|
+
import { useViewportMatch } from "@wordpress/compose";
|
|
4
|
+
import { privateApis as editorPrivateApis } from "@wordpress/editor";
|
|
5
|
+
import { displayShortcut } from "@wordpress/keycodes";
|
|
6
|
+
import { PreferenceToggleMenuItem } from "@wordpress/preferences";
|
|
7
|
+
import { unlock } from "../../lock-unlock";
|
|
8
|
+
import ManagePatternsMenuItem from "./manage-patterns-menu-item";
|
|
9
|
+
import WelcomeGuideMenuItem from "./welcome-guide-menu-item";
|
|
10
|
+
import EditPostPreferencesModal from "../preferences-modal";
|
|
11
|
+
const { ToolsMoreMenuGroup, ViewMoreMenuGroup } = unlock(editorPrivateApis);
|
|
22
12
|
const MoreMenu = () => {
|
|
23
|
-
const isLargeViewport = useViewportMatch(
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
const isLargeViewport = useViewportMatch("large");
|
|
14
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15
|
+
isLargeViewport && /* @__PURE__ */ jsx(ViewMoreMenuGroup, { children: /* @__PURE__ */ jsx(
|
|
16
|
+
PreferenceToggleMenuItem,
|
|
17
|
+
{
|
|
27
18
|
scope: "core/edit-post",
|
|
28
19
|
name: "fullscreenMode",
|
|
29
|
-
label: __(
|
|
30
|
-
info: __(
|
|
31
|
-
messageActivated: __(
|
|
32
|
-
messageDeactivated: __(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
label: __("Fullscreen mode"),
|
|
21
|
+
info: __("Show and hide the admin user interface"),
|
|
22
|
+
messageActivated: __("Fullscreen mode activated."),
|
|
23
|
+
messageDeactivated: __(
|
|
24
|
+
"Fullscreen mode deactivated."
|
|
25
|
+
),
|
|
26
|
+
shortcut: displayShortcut.secondary("f")
|
|
27
|
+
}
|
|
28
|
+
) }),
|
|
29
|
+
/* @__PURE__ */ jsxs(ToolsMoreMenuGroup, { children: [
|
|
30
|
+
/* @__PURE__ */ jsx(ManagePatternsMenuItem, {}),
|
|
31
|
+
/* @__PURE__ */ jsx(WelcomeGuideMenuItem, {})
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ jsx(EditPostPreferencesModal, {})
|
|
34
|
+
] });
|
|
39
35
|
};
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
var more_menu_default = MoreMenu;
|
|
37
|
+
export {
|
|
38
|
+
more_menu_default as default
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/more-menu/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport ManagePatternsMenuItem from './manage-patterns-menu-item';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\nimport EditPostPreferencesModal from '../preferences-modal';\n\nconst { ToolsMoreMenuGroup, ViewMoreMenuGroup } = unlock( editorPrivateApis );\n\nconst MoreMenu = () => {\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\n\treturn (\n\t\t<>\n\t\t\t{ isLargeViewport && (\n\t\t\t\t<ViewMoreMenuGroup>\n\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\t\t\tname=\"fullscreenMode\"\n\t\t\t\t\t\tlabel={ __( 'Fullscreen mode' ) }\n\t\t\t\t\t\tinfo={ __( 'Show and hide the admin user interface' ) }\n\t\t\t\t\t\tmessageActivated={ __( 'Fullscreen mode activated.' ) }\n\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t'Fullscreen mode deactivated.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tshortcut={ displayShortcut.secondary( 'f' ) }\n\t\t\t\t\t/>\n\t\t\t\t</ViewMoreMenuGroup>\n\t\t\t) }\n\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t<ManagePatternsMenuItem />\n\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t</ToolsMoreMenuGroup>\n\t\t\t<EditPostPreferencesModal />\n\t\t</>\n\t);\n};\n\nexport default MoreMenu;\n"],
|
|
5
|
+
"mappings": "AAuBE,mBAGG,KAaF,YAhBD;AApBF,SAAS,UAAU;AACnB,SAAS,wBAAwB;AACjC,SAAS,eAAe,yBAAyB;AACjD,SAAS,uBAAuB;AAChC,SAAS,gCAAgC;AAKzC,SAAS,cAAc;AACvB,OAAO,4BAA4B;AACnC,OAAO,0BAA0B;AACjC,OAAO,8BAA8B;AAErC,MAAM,EAAE,oBAAoB,kBAAkB,IAAI,OAAQ,iBAAkB;AAE5E,MAAM,WAAW,MAAM;AACtB,QAAM,kBAAkB,iBAAkB,OAAQ;AAElD,SACC,iCACG;AAAA,uBACD,oBAAC,qBACA;AAAA,MAAC;AAAA;AAAA,QACA,OAAM;AAAA,QACN,MAAK;AAAA,QACL,OAAQ,GAAI,iBAAkB;AAAA,QAC9B,MAAO,GAAI,wCAAyC;AAAA,QACpD,kBAAmB,GAAI,4BAA6B;AAAA,QACpD,oBAAqB;AAAA,UACpB;AAAA,QACD;AAAA,QACA,UAAW,gBAAgB,UAAW,GAAI;AAAA;AAAA,IAC3C,GACD;AAAA,IAED,qBAAC,sBACA;AAAA,0BAAC,0BAAuB;AAAA,MACxB,oBAAC,wBAAqB;AAAA,OACvB;AAAA,IACA,oBAAC,4BAAyB;AAAA,KAC3B;AAEF;AAEA,IAAO,oBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,37 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MenuItem } from "@wordpress/components";
|
|
3
|
+
import { store as coreStore } from "@wordpress/core-data";
|
|
4
|
+
import { useSelect } from "@wordpress/data";
|
|
5
|
+
import { __ } from "@wordpress/i18n";
|
|
6
|
+
import { addQueryArgs } from "@wordpress/url";
|
|
10
7
|
function ManagePatternsMenuItem() {
|
|
11
|
-
const url = useSelect(select => {
|
|
12
|
-
const {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const defaultUrl = addQueryArgs('edit.php', {
|
|
16
|
-
post_type: 'wp_block'
|
|
8
|
+
const url = useSelect((select) => {
|
|
9
|
+
const { canUser } = select(coreStore);
|
|
10
|
+
const defaultUrl = addQueryArgs("edit.php", {
|
|
11
|
+
post_type: "wp_block"
|
|
17
12
|
});
|
|
18
|
-
const patternsUrl = addQueryArgs(
|
|
19
|
-
p:
|
|
13
|
+
const patternsUrl = addQueryArgs("site-editor.php", {
|
|
14
|
+
p: "/pattern"
|
|
20
15
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// display the manage patterns link if the user can't access it.
|
|
25
|
-
return canUser('create', {
|
|
26
|
-
kind: 'postType',
|
|
27
|
-
name: 'wp_template'
|
|
16
|
+
return canUser("create", {
|
|
17
|
+
kind: "postType",
|
|
18
|
+
name: "wp_template"
|
|
28
19
|
}) ? patternsUrl : defaultUrl;
|
|
29
20
|
}, []);
|
|
30
|
-
return
|
|
31
|
-
role: "menuitem",
|
|
32
|
-
href: url,
|
|
33
|
-
children: __('Manage patterns')
|
|
34
|
-
});
|
|
21
|
+
return /* @__PURE__ */ jsx(MenuItem, { role: "menuitem", href: url, children: __("Manage patterns") });
|
|
35
22
|
}
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
var manage_patterns_menu_item_default = ManagePatternsMenuItem;
|
|
24
|
+
export {
|
|
25
|
+
manage_patterns_menu_item_default as default
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=manage-patterns-menu-item.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/more-menu/manage-patterns-menu-item.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\n\nfunction ManagePatternsMenuItem() {\n\tconst url = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\tconst defaultUrl = addQueryArgs( 'edit.php', {\n\t\t\tpost_type: 'wp_block',\n\t\t} );\n\t\tconst patternsUrl = addQueryArgs( 'site-editor.php', {\n\t\t\tp: '/pattern',\n\t\t} );\n\n\t\t// The site editor and templates both check whether the user has\n\t\t// edit_theme_options capabilities. We can leverage that here and not\n\t\t// display the manage patterns link if the user can't access it.\n\t\treturn canUser( 'create', {\n\t\t\tkind: 'postType',\n\t\t\tname: 'wp_template',\n\t\t} )\n\t\t\t? patternsUrl\n\t\t\t: defaultUrl;\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem role=\"menuitem\" href={ url }>\n\t\t\t{ __( 'Manage patterns' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default ManagePatternsMenuItem;\n"],
|
|
5
|
+
"mappings": "AA+BE;AA5BF,SAAS,gBAAgB;AACzB,SAAS,SAAS,iBAAiB;AACnC,SAAS,iBAAiB;AAC1B,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAE7B,SAAS,yBAAyB;AACjC,QAAM,MAAM,UAAW,CAAE,WAAY;AACpC,UAAM,EAAE,QAAQ,IAAI,OAAQ,SAAU;AACtC,UAAM,aAAa,aAAc,YAAY;AAAA,MAC5C,WAAW;AAAA,IACZ,CAAE;AACF,UAAM,cAAc,aAAc,mBAAmB;AAAA,MACpD,GAAG;AAAA,IACJ,CAAE;AAKF,WAAO,QAAS,UAAU;AAAA,MACzB,MAAM;AAAA,MACN,MAAM;AAAA,IACP,CAAE,IACC,cACA;AAAA,EACJ,GAAG,CAAC,CAAE;AAEN,SACC,oBAAC,YAAS,MAAK,YAAW,MAAO,KAC9B,aAAI,iBAAkB,GACzB;AAEF;AAEA,IAAO,oCAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useSelect } from "@wordpress/data";
|
|
3
|
+
import { PreferenceToggleMenuItem } from "@wordpress/preferences";
|
|
4
|
+
import { __ } from "@wordpress/i18n";
|
|
5
|
+
import { store as editorStore } from "@wordpress/editor";
|
|
6
|
+
function WelcomeGuideMenuItem() {
|
|
7
|
+
const isEditingTemplate = useSelect(
|
|
8
|
+
(select) => select(editorStore).getCurrentPostType() === "wp_template",
|
|
9
|
+
[]
|
|
10
|
+
);
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
PreferenceToggleMenuItem,
|
|
13
|
+
{
|
|
14
|
+
scope: "core/edit-post",
|
|
15
|
+
name: isEditingTemplate ? "welcomeGuideTemplate" : "welcomeGuide",
|
|
16
|
+
label: __("Welcome Guide")
|
|
17
|
+
}
|
|
18
|
+
);
|
|
16
19
|
}
|
|
17
|
-
|
|
20
|
+
export {
|
|
21
|
+
WelcomeGuideMenuItem as default
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=welcome-guide-menu-item.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/more-menu/welcome-guide-menu-item.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function WelcomeGuideMenuItem() {\n\tconst isEditingTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getCurrentPostType() === 'wp_template',\n\t\t[]\n\t);\n\n\treturn (\n\t\t<PreferenceToggleMenuItem\n\t\t\tscope=\"core/edit-post\"\n\t\t\tname={ isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide' }\n\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AAgBE;AAbF,SAAS,iBAAiB;AAC1B,SAAS,gCAAgC;AACzC,SAAS,UAAU;AACnB,SAAS,SAAS,mBAAmB;AAEtB,SAAR,uBAAwC;AAC9C,QAAM,oBAAoB;AAAA,IACzB,CAAE,WACD,OAAQ,WAAY,EAAE,mBAAmB,MAAM;AAAA,IAChD,CAAC;AAAA,EACF;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAM;AAAA,MACN,MAAO,oBAAoB,yBAAyB;AAAA,MACpD,OAAQ,GAAI,eAAgB;AAAA;AAAA,EAC7B;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,65 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { unlock } from '../../lock-unlock';
|
|
16
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
const {
|
|
18
|
-
PreferenceBaseOption
|
|
19
|
-
} = unlock(preferencesPrivateApis);
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "@wordpress/element";
|
|
3
|
+
import { __ } from "@wordpress/i18n";
|
|
4
|
+
import { Button } from "@wordpress/components";
|
|
5
|
+
import { useSelect } from "@wordpress/data";
|
|
6
|
+
import { store as editorStore } from "@wordpress/editor";
|
|
7
|
+
import { privateApis as preferencesPrivateApis } from "@wordpress/preferences";
|
|
8
|
+
import { getPathAndQueryString } from "@wordpress/url";
|
|
9
|
+
import { unlock } from "../../lock-unlock";
|
|
10
|
+
const { PreferenceBaseOption } = unlock(preferencesPrivateApis);
|
|
20
11
|
function submitCustomFieldsForm() {
|
|
21
|
-
const customFieldsForm = document.getElementById(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
customFieldsForm.querySelector('[name="_wp_http_referer"]').setAttribute(
|
|
12
|
+
const customFieldsForm = document.getElementById(
|
|
13
|
+
"toggle-custom-fields-form"
|
|
14
|
+
);
|
|
15
|
+
customFieldsForm.querySelector('[name="_wp_http_referer"]').setAttribute("value", getPathAndQueryString(window.location.href));
|
|
25
16
|
customFieldsForm.submit();
|
|
26
17
|
}
|
|
27
|
-
|
|
28
|
-
willEnable
|
|
29
|
-
}) {
|
|
18
|
+
function CustomFieldsConfirmation({ willEnable }) {
|
|
30
19
|
const [isReloading, setIsReloading] = useState(false);
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
20
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21
|
+
/* @__PURE__ */ jsx("p", { className: "edit-post-preferences-modal__custom-fields-confirmation-message", children: __(
|
|
22
|
+
"A page reload is required for this change. Make sure your content is saved before reloading."
|
|
23
|
+
) }),
|
|
24
|
+
/* @__PURE__ */ jsx(
|
|
25
|
+
Button,
|
|
26
|
+
{
|
|
27
|
+
__next40pxDefaultSize: true,
|
|
28
|
+
variant: "secondary",
|
|
29
|
+
isBusy: isReloading,
|
|
30
|
+
accessibleWhenDisabled: true,
|
|
31
|
+
disabled: isReloading,
|
|
32
|
+
onClick: () => {
|
|
33
|
+
setIsReloading(true);
|
|
34
|
+
submitCustomFieldsForm();
|
|
35
|
+
},
|
|
36
|
+
children: willEnable ? __("Show & Reload Page") : __("Hide & Reload Page")
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
] });
|
|
48
40
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}) {
|
|
52
|
-
const areCustomFieldsEnabled = useSelect(select => {
|
|
41
|
+
function EnableCustomFieldsOption({ label }) {
|
|
42
|
+
const areCustomFieldsEnabled = useSelect((select) => {
|
|
53
43
|
return !!select(editorStore).getEditorSettings().enableCustomFields;
|
|
54
44
|
}, []);
|
|
55
45
|
const [isChecked, setIsChecked] = useState(areCustomFieldsEnabled);
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
PreferenceBaseOption,
|
|
48
|
+
{
|
|
49
|
+
label,
|
|
50
|
+
isChecked,
|
|
51
|
+
onChange: setIsChecked,
|
|
52
|
+
children: isChecked !== areCustomFieldsEnabled && /* @__PURE__ */ jsx(CustomFieldsConfirmation, { willEnable: isChecked })
|
|
53
|
+
}
|
|
54
|
+
);
|
|
64
55
|
}
|
|
65
|
-
|
|
56
|
+
export {
|
|
57
|
+
CustomFieldsConfirmation,
|
|
58
|
+
EnableCustomFieldsOption as default
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=enable-custom-fields.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/preferences-modal/enable-custom-fields.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\nimport { getPathAndQueryString } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { PreferenceBaseOption } = unlock( preferencesPrivateApis );\n\nfunction submitCustomFieldsForm() {\n\tconst customFieldsForm = document.getElementById(\n\t\t'toggle-custom-fields-form'\n\t);\n\n\t// Ensure the referrer values is up to update with any\n\tcustomFieldsForm\n\t\t.querySelector( '[name=\"_wp_http_referer\"]' )\n\t\t.setAttribute( 'value', getPathAndQueryString( window.location.href ) );\n\n\tcustomFieldsForm.submit();\n}\n\nexport function CustomFieldsConfirmation( { willEnable } ) {\n\tconst [ isReloading, setIsReloading ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<p className=\"edit-post-preferences-modal__custom-fields-confirmation-message\">\n\t\t\t\t{ __(\n\t\t\t\t\t'A page reload is required for this change. Make sure your content is saved before reloading.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tisBusy={ isReloading }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ isReloading }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsReloading( true );\n\t\t\t\t\tsubmitCustomFieldsForm();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ willEnable\n\t\t\t\t\t? __( 'Show & Reload Page' )\n\t\t\t\t\t: __( 'Hide & Reload Page' ) }\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n\nexport default function EnableCustomFieldsOption( { label } ) {\n\tconst areCustomFieldsEnabled = useSelect( ( select ) => {\n\t\treturn !! select( editorStore ).getEditorSettings().enableCustomFields;\n\t}, [] );\n\tconst [ isChecked, setIsChecked ] = useState( areCustomFieldsEnabled );\n\n\treturn (\n\t\t<PreferenceBaseOption\n\t\t\tlabel={ label }\n\t\t\tisChecked={ isChecked }\n\t\t\tonChange={ setIsChecked }\n\t\t>\n\t\t\t{ isChecked !== areCustomFieldsEnabled && (\n\t\t\t\t<CustomFieldsConfirmation willEnable={ isChecked } />\n\t\t\t) }\n\t\t</PreferenceBaseOption>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AAkCE,mBACC,KADD;AA/BF,SAAS,gBAAgB;AACzB,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,SAAS,mBAAmB;AACrC,SAAS,eAAe,8BAA8B;AACtD,SAAS,6BAA6B;AAKtC,SAAS,cAAc;AAEvB,MAAM,EAAE,qBAAqB,IAAI,OAAQ,sBAAuB;AAEhE,SAAS,yBAAyB;AACjC,QAAM,mBAAmB,SAAS;AAAA,IACjC;AAAA,EACD;AAGA,mBACE,cAAe,2BAA4B,EAC3C,aAAc,SAAS,sBAAuB,OAAO,SAAS,IAAK,CAAE;AAEvE,mBAAiB,OAAO;AACzB;AAEO,SAAS,yBAA0B,EAAE,WAAW,GAAI;AAC1D,QAAM,CAAE,aAAa,cAAe,IAAI,SAAU,KAAM;AACxD,SACC,iCACC;AAAA,wBAAC,OAAE,WAAU,mEACV;AAAA,MACD;AAAA,IACD,GACD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,uBAAqB;AAAA,QACrB,SAAQ;AAAA,QACR,QAAS;AAAA,QACT,wBAAsB;AAAA,QACtB,UAAW;AAAA,QACX,SAAU,MAAM;AACf,yBAAgB,IAAK;AACrB,iCAAuB;AAAA,QACxB;AAAA,QAEE,uBACC,GAAI,oBAAqB,IACzB,GAAI,oBAAqB;AAAA;AAAA,IAC7B;AAAA,KACD;AAEF;AAEe,SAAR,yBAA2C,EAAE,MAAM,GAAI;AAC7D,QAAM,yBAAyB,UAAW,CAAE,WAAY;AACvD,WAAO,CAAC,CAAE,OAAQ,WAAY,EAAE,kBAAkB,EAAE;AAAA,EACrD,GAAG,CAAC,CAAE;AACN,QAAM,CAAE,WAAW,YAAa,IAAI,SAAU,sBAAuB;AAErE,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAW;AAAA,MAET,wBAAc,0BACf,oBAAC,4BAAyB,YAAa,WAAY;AAAA;AAAA,EAErD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|