@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,51 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import FullscreenModeClose from './fullscreen-mode-close';
|
|
11
|
-
import { unlock } from '../../lock-unlock';
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
const {
|
|
14
|
-
BackButton: BackButtonFill
|
|
15
|
-
} = unlock(editorPrivateApis);
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { privateApis as editorPrivateApis } from "@wordpress/editor";
|
|
3
|
+
import { __unstableMotion as motion } from "@wordpress/components";
|
|
4
|
+
import FullscreenModeClose from "./fullscreen-mode-close";
|
|
5
|
+
import { unlock } from "../../lock-unlock";
|
|
6
|
+
const { BackButton: BackButtonFill } = unlock(editorPrivateApis);
|
|
16
7
|
const slideX = {
|
|
17
|
-
hidden: {
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
distractionFreeInactive: {
|
|
21
|
-
x: 0
|
|
22
|
-
},
|
|
23
|
-
hover: {
|
|
24
|
-
x: 0,
|
|
25
|
-
transition: {
|
|
26
|
-
type: 'tween',
|
|
27
|
-
delay: 0.2
|
|
28
|
-
}
|
|
29
|
-
}
|
|
8
|
+
hidden: { x: "-100%" },
|
|
9
|
+
distractionFreeInactive: { x: 0 },
|
|
10
|
+
hover: { x: 0, transition: { type: "tween", delay: 0.2 } }
|
|
30
11
|
};
|
|
31
|
-
function BackButton({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
children: ({
|
|
36
|
-
length
|
|
37
|
-
}) => length <= 1 && /*#__PURE__*/_jsx(motion.div, {
|
|
12
|
+
function BackButton({ initialPost }) {
|
|
13
|
+
return /* @__PURE__ */ jsx(BackButtonFill, { children: ({ length }) => length <= 1 && /* @__PURE__ */ jsx(
|
|
14
|
+
motion.div,
|
|
15
|
+
{
|
|
38
16
|
variants: slideX,
|
|
39
|
-
transition: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
});
|
|
17
|
+
transition: { type: "tween", delay: 0.8 },
|
|
18
|
+
children: /* @__PURE__ */ jsx(
|
|
19
|
+
FullscreenModeClose,
|
|
20
|
+
{
|
|
21
|
+
showTooltip: true,
|
|
22
|
+
initialPost
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
) });
|
|
49
27
|
}
|
|
50
|
-
|
|
51
|
-
|
|
28
|
+
var back_button_default = BackButton;
|
|
29
|
+
export {
|
|
30
|
+
back_button_default as default
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/back-button/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __unstableMotion as motion } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport { unlock } from '../../lock-unlock';\n\nconst { BackButton: BackButtonFill } = unlock( editorPrivateApis );\n\nconst slideX = {\n\thidden: { x: '-100%' },\n\tdistractionFreeInactive: { x: 0 },\n\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nfunction BackButton( { initialPost } ) {\n\treturn (\n\t\t<BackButtonFill>\n\t\t\t{ ( { length } ) =>\n\t\t\t\tlength <= 1 && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ slideX }\n\t\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FullscreenModeClose\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\tinitialPost={ initialPost }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t)\n\t\t\t}\n\t\t</BackButtonFill>\n\t);\n}\n\nexport default BackButton;\n"],
|
|
5
|
+
"mappings": "AA6BM;AA1BN,SAAS,eAAe,yBAAyB;AACjD,SAAS,oBAAoB,cAAc;AAK3C,OAAO,yBAAyB;AAChC,SAAS,cAAc;AAEvB,MAAM,EAAE,YAAY,eAAe,IAAI,OAAQ,iBAAkB;AAEjE,MAAM,SAAS;AAAA,EACd,QAAQ,EAAE,GAAG,QAAQ;AAAA,EACrB,yBAAyB,EAAE,GAAG,EAAE;AAAA,EAChC,OAAO,EAAE,GAAG,GAAG,YAAY,EAAE,MAAM,SAAS,OAAO,IAAI,EAAE;AAC1D;AAEA,SAAS,WAAY,EAAE,YAAY,GAAI;AACtC,SACC,oBAAC,kBACE,WAAE,EAAE,OAAO,MACZ,UAAU,KACT;AAAA,IAAC,OAAO;AAAA,IAAP;AAAA,MACA,UAAW;AAAA,MACX,YAAa,EAAE,MAAM,SAAS,OAAO,IAAI;AAAA,MAEzC;AAAA,QAAC;AAAA;AAAA,UACA,aAAW;AAAA,UACX;AAAA;AAAA,MACD;AAAA;AAAA,EACD,GAGH;AAEF;AAEA,IAAO,sBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,40 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Returns the Post's Edit URL.
|
|
11
|
-
*
|
|
12
|
-
* @param {number} postId Post ID.
|
|
13
|
-
*
|
|
14
|
-
* @return {string} Post edit URL.
|
|
15
|
-
*/
|
|
16
|
-
export function getPostEditURL(postId) {
|
|
17
|
-
return addQueryArgs('post.php', {
|
|
18
|
-
post: postId,
|
|
19
|
-
action: 'edit'
|
|
20
|
-
});
|
|
1
|
+
import { useEffect, useState } from "@wordpress/element";
|
|
2
|
+
import { useSelect } from "@wordpress/data";
|
|
3
|
+
import { addQueryArgs } from "@wordpress/url";
|
|
4
|
+
import { store as editorStore } from "@wordpress/editor";
|
|
5
|
+
function getPostEditURL(postId) {
|
|
6
|
+
return addQueryArgs("post.php", { post: postId, action: "edit" });
|
|
21
7
|
}
|
|
22
|
-
|
|
8
|
+
function BrowserURL() {
|
|
23
9
|
const [historyId, setHistoryId] = useState(null);
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
-
postStatus
|
|
27
|
-
} = useSelect(select => {
|
|
28
|
-
const {
|
|
29
|
-
getCurrentPost
|
|
30
|
-
} = select(editorStore);
|
|
10
|
+
const { postId, postStatus } = useSelect((select) => {
|
|
11
|
+
const { getCurrentPost } = select(editorStore);
|
|
31
12
|
const post = getCurrentPost();
|
|
32
|
-
let {
|
|
33
|
-
|
|
34
|
-
status,
|
|
13
|
+
let { id, status, type } = post;
|
|
14
|
+
const isTemplate = ["wp_template", "wp_template_part"].includes(
|
|
35
15
|
type
|
|
36
|
-
|
|
37
|
-
const isTemplate = ['wp_template', 'wp_template_part'].includes(type);
|
|
16
|
+
);
|
|
38
17
|
if (isTemplate) {
|
|
39
18
|
id = post.wp_id;
|
|
40
19
|
}
|
|
@@ -44,13 +23,19 @@ export default function BrowserURL() {
|
|
|
44
23
|
};
|
|
45
24
|
}, []);
|
|
46
25
|
useEffect(() => {
|
|
47
|
-
if (postId && postId !== historyId && postStatus !==
|
|
48
|
-
window.history.replaceState(
|
|
49
|
-
id: postId
|
|
50
|
-
|
|
26
|
+
if (postId && postId !== historyId && postStatus !== "auto-draft") {
|
|
27
|
+
window.history.replaceState(
|
|
28
|
+
{ id: postId },
|
|
29
|
+
"Post " + postId,
|
|
30
|
+
getPostEditURL(postId)
|
|
31
|
+
);
|
|
51
32
|
setHistoryId(postId);
|
|
52
33
|
}
|
|
53
34
|
}, [postId, postStatus, historyId]);
|
|
54
35
|
return null;
|
|
55
36
|
}
|
|
56
|
-
|
|
37
|
+
export {
|
|
38
|
+
BrowserURL as default,
|
|
39
|
+
getPostEditURL
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/browser-url/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Returns the Post's Edit URL.\n *\n * @param {number} postId Post ID.\n *\n * @return {string} Post edit URL.\n */\nexport function getPostEditURL( postId ) {\n\treturn addQueryArgs( 'post.php', { post: postId, action: 'edit' } );\n}\n\nexport default function BrowserURL() {\n\tconst [ historyId, setHistoryId ] = useState( null );\n\tconst { postId, postStatus } = useSelect( ( select ) => {\n\t\tconst { getCurrentPost } = select( editorStore );\n\t\tconst post = getCurrentPost();\n\t\tlet { id, status, type } = post;\n\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\ttype\n\t\t);\n\t\tif ( isTemplate ) {\n\t\t\tid = post.wp_id;\n\t\t}\n\n\t\treturn {\n\t\t\tpostId: id,\n\t\t\tpostStatus: status,\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( postId && postId !== historyId && postStatus !== 'auto-draft' ) {\n\t\t\twindow.history.replaceState(\n\t\t\t\t{ id: postId },\n\t\t\t\t'Post ' + postId,\n\t\t\t\tgetPostEditURL( postId )\n\t\t\t);\n\t\t\tsetHistoryId( postId );\n\t\t}\n\t}, [ postId, postStatus, historyId ] );\n\n\treturn null;\n}\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,WAAW,gBAAgB;AACpC,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,SAAS,mBAAmB;AAS9B,SAAS,eAAgB,QAAS;AACxC,SAAO,aAAc,YAAY,EAAE,MAAM,QAAQ,QAAQ,OAAO,CAAE;AACnE;AAEe,SAAR,aAA8B;AACpC,QAAM,CAAE,WAAW,YAAa,IAAI,SAAU,IAAK;AACnD,QAAM,EAAE,QAAQ,WAAW,IAAI,UAAW,CAAE,WAAY;AACvD,UAAM,EAAE,eAAe,IAAI,OAAQ,WAAY;AAC/C,UAAM,OAAO,eAAe;AAC5B,QAAI,EAAE,IAAI,QAAQ,KAAK,IAAI;AAC3B,UAAM,aAAa,CAAE,eAAe,kBAAmB,EAAE;AAAA,MACxD;AAAA,IACD;AACA,QAAK,YAAa;AACjB,WAAK,KAAK;AAAA,IACX;AAEA,WAAO;AAAA,MACN,QAAQ;AAAA,MACR,YAAY;AAAA,IACb;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,YAAW,MAAM;AAChB,QAAK,UAAU,WAAW,aAAa,eAAe,cAAe;AACpE,aAAO,QAAQ;AAAA,QACd,EAAE,IAAI,OAAO;AAAA,QACb,UAAU;AAAA,QACV,eAAgB,MAAO;AAAA,MACxB;AACA,mBAAc,MAAO;AAAA,IACtB;AAAA,EACD,GAAG,CAAE,QAAQ,YAAY,SAAU,CAAE;AAErC,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import { useUpdatePostLinkListener } from './listener-hooks';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Data component used for initializing the editor and re-initializes
|
|
8
|
-
* when postId changes or on unmount.
|
|
9
|
-
*
|
|
10
|
-
* @return {null} This is a data component so does not render any ui.
|
|
11
|
-
*/
|
|
12
|
-
export default function EditorInitialization() {
|
|
1
|
+
import { useUpdatePostLinkListener } from "./listener-hooks";
|
|
2
|
+
function EditorInitialization() {
|
|
13
3
|
useUpdatePostLinkListener();
|
|
14
4
|
return null;
|
|
15
5
|
}
|
|
16
|
-
|
|
6
|
+
export {
|
|
7
|
+
EditorInitialization as default
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/editor-initialization/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { useUpdatePostLinkListener } from './listener-hooks';\n\n/**\n * Data component used for initializing the editor and re-initializes\n * when postId changes or on unmount.\n *\n * @return {null} This is a data component so does not render any ui.\n */\nexport default function EditorInitialization() {\n\tuseUpdatePostLinkListener();\n\treturn null;\n}\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,iCAAiC;AAQ3B,SAAR,uBAAwC;AAC9C,4BAA0B;AAC1B,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* This listener hook monitors any change in permalink and updates the view
|
|
16
|
-
* post link in the admin bar.
|
|
17
|
-
*/
|
|
18
|
-
export const useUpdatePostLinkListener = () => {
|
|
19
|
-
const {
|
|
20
|
-
isViewable,
|
|
21
|
-
newPermalink
|
|
22
|
-
} = useSelect(select => {
|
|
23
|
-
const {
|
|
24
|
-
getPostType
|
|
25
|
-
} = select(coreStore);
|
|
26
|
-
const {
|
|
27
|
-
getCurrentPost,
|
|
28
|
-
getEditedPostAttribute
|
|
29
|
-
} = select(editorStore);
|
|
30
|
-
const postType = getPostType(getEditedPostAttribute('type'));
|
|
1
|
+
import { useSelect } from "@wordpress/data";
|
|
2
|
+
import { useEffect, useRef } from "@wordpress/element";
|
|
3
|
+
import { store as editorStore } from "@wordpress/editor";
|
|
4
|
+
import { store as coreStore } from "@wordpress/core-data";
|
|
5
|
+
import {
|
|
6
|
+
VIEW_AS_LINK_SELECTOR,
|
|
7
|
+
VIEW_AS_PREVIEW_LINK_SELECTOR
|
|
8
|
+
} from "../../store/constants";
|
|
9
|
+
const useUpdatePostLinkListener = () => {
|
|
10
|
+
const { isViewable, newPermalink } = useSelect((select) => {
|
|
11
|
+
const { getPostType } = select(coreStore);
|
|
12
|
+
const { getCurrentPost, getEditedPostAttribute } = select(editorStore);
|
|
13
|
+
const postType = getPostType(getEditedPostAttribute("type"));
|
|
31
14
|
return {
|
|
32
15
|
isViewable: postType?.viewable,
|
|
33
16
|
newPermalink: getCurrentPost().link
|
|
@@ -42,11 +25,14 @@ export const useUpdatePostLinkListener = () => {
|
|
|
42
25
|
return;
|
|
43
26
|
}
|
|
44
27
|
if (!isViewable) {
|
|
45
|
-
nodeToUpdateRef.current.style.display =
|
|
28
|
+
nodeToUpdateRef.current.style.display = "none";
|
|
46
29
|
return;
|
|
47
30
|
}
|
|
48
|
-
nodeToUpdateRef.current.style.display =
|
|
49
|
-
nodeToUpdateRef.current.setAttribute(
|
|
31
|
+
nodeToUpdateRef.current.style.display = "";
|
|
32
|
+
nodeToUpdateRef.current.setAttribute("href", newPermalink);
|
|
50
33
|
}, [newPermalink, isViewable]);
|
|
51
34
|
};
|
|
52
|
-
|
|
35
|
+
export {
|
|
36
|
+
useUpdatePostLinkListener
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=listener-hooks.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/editor-initialization/listener-hooks.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tVIEW_AS_LINK_SELECTOR,\n\tVIEW_AS_PREVIEW_LINK_SELECTOR,\n} from '../../store/constants';\n\n/**\n * This listener hook monitors any change in permalink and updates the view\n * post link in the admin bar.\n */\nexport const useUpdatePostLinkListener = () => {\n\tconst { isViewable, newPermalink } = useSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\t\treturn {\n\t\t\tisViewable: postType?.viewable,\n\t\t\tnewPermalink: getCurrentPost().link,\n\t\t};\n\t}, [] );\n\n\tconst nodeToUpdateRef = useRef();\n\n\tuseEffect( () => {\n\t\tnodeToUpdateRef.current =\n\t\t\tdocument.querySelector( VIEW_AS_PREVIEW_LINK_SELECTOR ) ||\n\t\t\tdocument.querySelector( VIEW_AS_LINK_SELECTOR );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! newPermalink || ! nodeToUpdateRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! isViewable ) {\n\t\t\tnodeToUpdateRef.current.style.display = 'none';\n\t\t\treturn;\n\t\t}\n\n\t\tnodeToUpdateRef.current.style.display = '';\n\t\tnodeToUpdateRef.current.setAttribute( 'href', newPermalink );\n\t}, [ newPermalink, isViewable ] );\n};\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,iBAAiB;AAC1B,SAAS,WAAW,cAAc;AAClC,SAAS,SAAS,mBAAmB;AACrC,SAAS,SAAS,iBAAiB;AAKnC;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAMA,MAAM,4BAA4B,MAAM;AAC9C,QAAM,EAAE,YAAY,aAAa,IAAI,UAAW,CAAE,WAAY;AAC7D,UAAM,EAAE,YAAY,IAAI,OAAQ,SAAU;AAC1C,UAAM,EAAE,gBAAgB,uBAAuB,IAC9C,OAAQ,WAAY;AACrB,UAAM,WAAW,YAAa,uBAAwB,MAAO,CAAE;AAC/D,WAAO;AAAA,MACN,YAAY,UAAU;AAAA,MACtB,cAAc,eAAe,EAAE;AAAA,IAChC;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,QAAM,kBAAkB,OAAO;AAE/B,YAAW,MAAM;AAChB,oBAAgB,UACf,SAAS,cAAe,6BAA8B,KACtD,SAAS,cAAe,qBAAsB;AAAA,EAChD,GAAG,CAAC,CAAE;AAEN,YAAW,MAAM;AAChB,QAAK,CAAE,gBAAgB,CAAE,gBAAgB,SAAU;AAClD;AAAA,IACD;AAEA,QAAK,CAAE,YAAa;AACnB,sBAAgB,QAAQ,MAAM,UAAU;AACxC;AAAA,IACD;AAEA,oBAAgB,QAAQ,MAAM,UAAU;AACxC,oBAAgB,QAAQ,aAAc,QAAQ,YAAa;AAAA,EAC5D,GAAG,CAAE,cAAc,UAAW,CAAE;AACjC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,85 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
getEditedPostAttribute,
|
|
22
|
-
isCleanNewPost
|
|
23
|
-
} = select(editorStore);
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useSelect, useDispatch } from "@wordpress/data";
|
|
3
|
+
import { __, _x } from "@wordpress/i18n";
|
|
4
|
+
import {
|
|
5
|
+
Modal,
|
|
6
|
+
Button,
|
|
7
|
+
__experimentalHStack as HStack,
|
|
8
|
+
__experimentalVStack as VStack,
|
|
9
|
+
ToggleControl,
|
|
10
|
+
TextControl
|
|
11
|
+
} from "@wordpress/components";
|
|
12
|
+
import { useState } from "@wordpress/element";
|
|
13
|
+
import { store as editorStore } from "@wordpress/editor";
|
|
14
|
+
function InitPatternModal() {
|
|
15
|
+
const { editPost } = useDispatch(editorStore);
|
|
16
|
+
const [syncType, setSyncType] = useState(void 0);
|
|
17
|
+
const [title, setTitle] = useState("");
|
|
18
|
+
const { postType, isNewPost } = useSelect((select) => {
|
|
19
|
+
const { getEditedPostAttribute, isCleanNewPost } = select(editorStore);
|
|
24
20
|
return {
|
|
25
|
-
postType: getEditedPostAttribute(
|
|
21
|
+
postType: getEditedPostAttribute("type"),
|
|
26
22
|
isNewPost: isCleanNewPost()
|
|
27
23
|
};
|
|
28
24
|
}, []);
|
|
29
|
-
const [isModalOpen, setIsModalOpen] = useState(
|
|
30
|
-
|
|
25
|
+
const [isModalOpen, setIsModalOpen] = useState(
|
|
26
|
+
() => isNewPost && postType === "wp_block"
|
|
27
|
+
);
|
|
28
|
+
if (postType !== "wp_block" || !isNewPost) {
|
|
31
29
|
return null;
|
|
32
30
|
}
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
return /* @__PURE__ */ jsx(Fragment, { children: isModalOpen && /* @__PURE__ */ jsx(
|
|
32
|
+
Modal,
|
|
33
|
+
{
|
|
34
|
+
title: __("Create pattern"),
|
|
36
35
|
onRequestClose: () => {
|
|
37
36
|
setIsModalOpen(false);
|
|
38
37
|
},
|
|
39
38
|
overlayClassName: "reusable-blocks-menu-items__convert-modal",
|
|
40
|
-
children:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
children:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
39
|
+
children: /* @__PURE__ */ jsx(
|
|
40
|
+
"form",
|
|
41
|
+
{
|
|
42
|
+
onSubmit: (event) => {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
setIsModalOpen(false);
|
|
45
|
+
editPost({
|
|
46
|
+
title,
|
|
47
|
+
meta: {
|
|
48
|
+
wp_pattern_sync_status: syncType
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
children: /* @__PURE__ */ jsxs(VStack, { spacing: "5", children: [
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
TextControl,
|
|
55
|
+
{
|
|
56
|
+
label: __("Name"),
|
|
57
|
+
value: title,
|
|
58
|
+
onChange: setTitle,
|
|
59
|
+
placeholder: __("My pattern"),
|
|
60
|
+
className: "patterns-create-modal__name-input",
|
|
61
|
+
__nextHasNoMarginBottom: true,
|
|
62
|
+
__next40pxDefaultSize: true
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
ToggleControl,
|
|
67
|
+
{
|
|
68
|
+
__nextHasNoMarginBottom: true,
|
|
69
|
+
label: _x("Synced", "pattern (singular)"),
|
|
70
|
+
help: __(
|
|
71
|
+
"Sync this pattern across multiple locations."
|
|
72
|
+
),
|
|
73
|
+
checked: !syncType,
|
|
74
|
+
onChange: () => {
|
|
75
|
+
setSyncType(
|
|
76
|
+
!syncType ? "unsynced" : void 0
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ jsx(HStack, { justify: "right", children: /* @__PURE__ */ jsx(
|
|
82
|
+
Button,
|
|
83
|
+
{
|
|
84
|
+
__next40pxDefaultSize: true,
|
|
85
|
+
variant: "primary",
|
|
86
|
+
type: "submit",
|
|
87
|
+
disabled: !title,
|
|
88
|
+
accessibleWhenDisabled: true,
|
|
89
|
+
children: __("Create")
|
|
90
|
+
}
|
|
91
|
+
) })
|
|
92
|
+
] })
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
) });
|
|
84
97
|
}
|
|
85
|
-
|
|
98
|
+
export {
|
|
99
|
+
InitPatternModal as default
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/init-pattern-modal/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n\tTextControl,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function InitPatternModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\tconst [ isModalOpen, setIsModalOpen ] = useState(\n\t\t() => isNewPost && postType === 'wp_block'\n\t);\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ _x( 'Synced', 'pattern (singular)' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Sync this pattern across multiple locations.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\tdisabled={ ! title }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AAsCE,mBAsBK,KADD,YArBJ;AAnCF,SAAS,WAAW,mBAAmB;AACvC,SAAS,IAAI,UAAU;AACvB;AAAA,EACC;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB;AAAA,EACA;AAAA,OACM;AACP,SAAS,gBAAgB;AACzB,SAAS,SAAS,mBAAmB;AAEtB,SAAR,mBAAoC;AAC1C,QAAM,EAAE,SAAS,IAAI,YAAa,WAAY;AAC9C,QAAM,CAAE,UAAU,WAAY,IAAI,SAAU,MAAU;AACtD,QAAM,CAAE,OAAO,QAAS,IAAI,SAAU,EAAG;AAEzC,QAAM,EAAE,UAAU,UAAU,IAAI,UAAW,CAAE,WAAY;AACxD,UAAM,EAAE,wBAAwB,eAAe,IAC9C,OAAQ,WAAY;AACrB,WAAO;AAAA,MACN,UAAU,uBAAwB,MAAO;AAAA,MACzC,WAAW,eAAe;AAAA,IAC3B;AAAA,EACD,GAAG,CAAC,CAAE;AACN,QAAM,CAAE,aAAa,cAAe,IAAI;AAAA,IACvC,MAAM,aAAa,aAAa;AAAA,EACjC;AAEA,MAAK,aAAa,cAAc,CAAE,WAAY;AAC7C,WAAO;AAAA,EACR;AAEA,SACC,gCACG,yBACD;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,gBAAiB;AAAA,MAC7B,gBAAiB,MAAM;AACtB,uBAAgB,KAAM;AAAA,MACvB;AAAA,MACA,kBAAiB;AAAA,MAEjB;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,CAAE,UAAW;AACvB,kBAAM,eAAe;AACrB,2BAAgB,KAAM;AACtB,qBAAU;AAAA,cACT;AAAA,cACA,MAAM;AAAA,gBACL,wBAAwB;AAAA,cACzB;AAAA,YACD,CAAE;AAAA,UACH;AAAA,UAEA,+BAAC,UAAO,SAAQ,KACf;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,OAAQ,GAAI,MAAO;AAAA,gBACnB,OAAQ;AAAA,gBACR,UAAW;AAAA,gBACX,aAAc,GAAI,YAAa;AAAA,gBAC/B,WAAU;AAAA,gBACV,yBAAuB;AAAA,gBACvB,uBAAqB;AAAA;AAAA,YACtB;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACA,yBAAuB;AAAA,gBACvB,OAAQ,GAAI,UAAU,oBAAqB;AAAA,gBAC3C,MAAO;AAAA,kBACN;AAAA,gBACD;AAAA,gBACA,SAAU,CAAE;AAAA,gBACZ,UAAW,MAAM;AAChB;AAAA,oBACC,CAAE,WAAW,aAAa;AAAA,kBAC3B;AAAA,gBACD;AAAA;AAAA,YACD;AAAA,YACA,oBAAC,UAAO,SAAQ,SACf;AAAA,cAAC;AAAA;AAAA,gBACA,uBAAqB;AAAA,gBACrB,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,UAAW,CAAE;AAAA,gBACb,wBAAsB;AAAA,gBAEpB,aAAI,QAAS;AAAA;AAAA,YAChB,GACD;AAAA,aACD;AAAA;AAAA,MACD;AAAA;AAAA,EACD,GAEF;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,37 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { __ } from
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
import { store as editPostStore } from '../../store';
|
|
1
|
+
import { useEffect } from "@wordpress/element";
|
|
2
|
+
import { useDispatch } from "@wordpress/data";
|
|
3
|
+
import {
|
|
4
|
+
useShortcut,
|
|
5
|
+
store as keyboardShortcutsStore
|
|
6
|
+
} from "@wordpress/keyboard-shortcuts";
|
|
7
|
+
import { __ } from "@wordpress/i18n";
|
|
8
|
+
import { store as editPostStore } from "../../store";
|
|
13
9
|
function KeyboardShortcuts() {
|
|
14
|
-
const {
|
|
15
|
-
|
|
16
|
-
} = useDispatch(editPostStore);
|
|
17
|
-
const {
|
|
18
|
-
registerShortcut
|
|
19
|
-
} = useDispatch(keyboardShortcutsStore);
|
|
10
|
+
const { toggleFullscreenMode } = useDispatch(editPostStore);
|
|
11
|
+
const { registerShortcut } = useDispatch(keyboardShortcutsStore);
|
|
20
12
|
useEffect(() => {
|
|
21
13
|
registerShortcut({
|
|
22
|
-
name:
|
|
23
|
-
category:
|
|
24
|
-
description: __(
|
|
14
|
+
name: "core/edit-post/toggle-fullscreen",
|
|
15
|
+
category: "global",
|
|
16
|
+
description: __("Enable or disable fullscreen mode."),
|
|
25
17
|
keyCombination: {
|
|
26
|
-
modifier:
|
|
27
|
-
character:
|
|
18
|
+
modifier: "secondary",
|
|
19
|
+
character: "f"
|
|
28
20
|
}
|
|
29
21
|
});
|
|
30
22
|
}, []);
|
|
31
|
-
useShortcut(
|
|
23
|
+
useShortcut("core/edit-post/toggle-fullscreen", () => {
|
|
32
24
|
toggleFullscreenMode();
|
|
33
25
|
});
|
|
34
26
|
return null;
|
|
35
27
|
}
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
var keyboard_shortcuts_default = KeyboardShortcuts;
|
|
29
|
+
export {
|
|
30
|
+
keyboard_shortcuts_default as default
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/keyboard-shortcuts/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction KeyboardShortcuts() {\n\tconst { toggleFullscreenMode } = useDispatch( editPostStore );\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-fullscreen',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Enable or disable fullscreen mode.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'f',\n\t\t\t},\n\t\t} );\n\t}, [] );\n\n\tuseShortcut( 'core/edit-post/toggle-fullscreen', () => {\n\t\ttoggleFullscreenMode();\n\t} );\n\n\treturn null;\n}\n\nexport default KeyboardShortcuts;\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,UAAU;AAKnB,SAAS,SAAS,qBAAqB;AAEvC,SAAS,oBAAoB;AAC5B,QAAM,EAAE,qBAAqB,IAAI,YAAa,aAAc;AAC5D,QAAM,EAAE,iBAAiB,IAAI,YAAa,sBAAuB;AAEjE,YAAW,MAAM;AAChB,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,aAAa,GAAI,oCAAqC;AAAA,MACtD,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAC,CAAE;AAEN,cAAa,oCAAoC,MAAM;AACtD,yBAAqB;AAAA,EACtB,CAAE;AAEF,SAAO;AACR;AAEA,IAAO,6BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|