@wordpress/edit-post 7.32.0 → 7.34.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/CHANGELOG.md +4 -0
- package/README.md +17 -223
- package/build/components/browser-url/index.js.map +1 -1
- package/build/components/editor-initialization/index.js +0 -1
- package/build/components/editor-initialization/index.js.map +1 -1
- package/build/components/editor-initialization/listener-hooks.js +1 -38
- package/build/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +20 -51
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/index.native.js +1 -1
- package/build/components/header/index.native.js.map +1 -1
- package/build/components/header/main-dashboard-button/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +17 -42
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/more-menu/manage-patterns-menu-item.js +40 -0
- package/build/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/init-pattern-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +0 -123
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +28 -29
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build/components/preferences-modal/enable-panel.js.map +1 -1
- package/build/components/preferences-modal/index.js +3 -32
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/sidebar/post-format/index.js.map +1 -1
- package/build/components/sidebar/post-pending-status/index.js.map +1 -1
- package/build/components/sidebar/post-slug/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +35 -12
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/post-sticky/index.js.map +1 -1
- package/build/components/sidebar/post-trash/index.js.map +1 -1
- package/build/components/sidebar/post-visibility/index.js.map +1 -1
- package/build/components/sidebar/settings-header/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +68 -41
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/components/text-editor/index.js.map +1 -1
- package/build/components/visual-editor/block-inspector-button.js +1 -1
- package/build/components/visual-editor/block-inspector-button.js.map +1 -1
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/components/visual-editor/index.js +4 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/visual-editor/index.native.js.map +1 -1
- package/build/components/visual-editor/use-padding-appender.js +62 -0
- package/build/components/visual-editor/use-padding-appender.js.map +1 -0
- package/build/components/welcome-guide/default.js.map +1 -1
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/deprecated.js +132 -0
- package/build/deprecated.js.map +1 -0
- package/build/editor.js +2 -2
- package/build/editor.js.map +1 -1
- package/build/editor.native.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +5 -22
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/components/index.js.map +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use-navigate-to-entity-record.js.map +1 -1
- package/build/hooks/validate-multiple-use/index.js.map +1 -1
- package/build/index.js +19 -62
- package/build/index.js.map +1 -1
- package/build/index.native.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/store/actions.js +10 -8
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +1 -1
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +34 -19
- package/build/store/selectors.js.map +1 -1
- package/build/utils/meta-boxes.js.map +1 -1
- package/build-module/components/browser-url/index.js.map +1 -1
- package/build-module/components/editor-initialization/index.js +1 -2
- package/build-module/components/editor-initialization/index.js.map +1 -1
- package/build-module/components/editor-initialization/listener-hooks.js +2 -38
- package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.js +22 -53
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/index.native.js +1 -1
- package/build-module/components/header/index.native.js.map +1 -1
- package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +17 -42
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/more-menu/manage-patterns-menu-item.js +33 -0
- package/build-module/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build-module/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/init-pattern-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -124
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +28 -29
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +4 -32
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/sidebar/post-format/index.js.map +1 -1
- package/build-module/components/sidebar/post-pending-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-slug/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +36 -14
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-sticky/index.js.map +1 -1
- package/build-module/components/sidebar/post-trash/index.js.map +1 -1
- package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
- package/build-module/components/sidebar/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +71 -44
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/block-inspector-button.js +1 -1
- package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/visual-editor/header.native.js.map +1 -1
- package/build-module/components/visual-editor/index.js +4 -1
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/index.native.js.map +1 -1
- package/build-module/components/visual-editor/use-padding-appender.js +55 -0
- package/build-module/components/visual-editor/use-padding-appender.js.map +1 -0
- package/build-module/components/welcome-guide/default.js.map +1 -1
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/deprecated.js +116 -0
- package/build-module/deprecated.js.map +1 -0
- package/build-module/editor.js +2 -2
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +7 -24
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/components/index.js.map +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/use-navigate-to-entity-record.js.map +1 -1
- package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
- package/build-module/index.js +2 -15
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/store/actions.js +8 -7
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +33 -18
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/meta-boxes.js.map +1 -1
- package/build-style/classic-rtl.css +2 -2
- package/build-style/classic.css +2 -2
- package/build-style/style-rtl.css +18 -589
- package/build-style/style.css +18 -589
- package/package.json +32 -34
- package/src/classic.scss +1 -1
- package/src/components/editor-initialization/index.js +1 -5
- package/src/components/editor-initialization/listener-hooks.js +1 -40
- package/src/components/editor-initialization/test/listener-hooks.js +1 -96
- package/src/components/header/index.js +25 -71
- package/src/components/header/index.native.js +1 -1
- package/src/components/header/more-menu/index.js +27 -43
- package/src/components/header/more-menu/manage-patterns-menu-item.js +33 -0
- package/src/components/header/style.scss +5 -82
- package/src/components/keyboard-shortcuts/index.js +2 -148
- package/src/components/layout/index.js +26 -47
- package/src/components/layout/style.scss +7 -80
- package/src/components/preferences-modal/index.js +3 -46
- package/src/components/sidebar/post-status/index.js +61 -24
- package/src/components/sidebar/settings-sidebar/index.js +113 -73
- package/src/components/visual-editor/block-inspector-button.js +1 -1
- package/src/components/visual-editor/index.js +4 -0
- package/src/components/visual-editor/use-padding-appender.js +66 -0
- package/src/deprecated.js +107 -0
- package/src/editor.js +2 -2
- package/src/hooks/commands/use-common-commands.js +11 -26
- package/src/index.js +3 -20
- package/src/store/actions.js +10 -12
- package/src/store/selectors.js +41 -33
- package/src/store/test/actions.js +11 -10
- package/src/style.scss +1 -19
- package/build/components/header/plugin-more-menu-item/index.js +0 -78
- package/build/components/header/plugin-more-menu-item/index.js.map +0 -1
- package/build/components/header/plugin-sidebar-more-menu-item/index.js +0 -71
- package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
- package/build/components/header/post-publish-button-or-toggle.js +0 -91
- package/build/components/header/post-publish-button-or-toggle.js.map +0 -1
- package/build/components/header/preferences-menu-item/index.js +0 -31
- package/build/components/header/preferences-menu-item/index.js.map +0 -1
- package/build/components/header/tools-more-menu-group/index.js +0 -26
- package/build/components/header/tools-more-menu-group/index.js.map +0 -1
- package/build/components/header/writing-menu/index.js +0 -71
- package/build/components/header/writing-menu/index.js.map +0 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +0 -78
- package/build/components/keyboard-shortcut-help-modal/config.js.map +0 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -49
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +0 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +0 -132
- package/build/components/keyboard-shortcut-help-modal/index.js.map +0 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +0 -55
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +0 -1
- package/build/components/layout/actions-panel.js +0 -86
- package/build/components/layout/actions-panel.js.map +0 -1
- package/build/components/preferences-modal/enable-publish-sidebar.js +0 -38
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
- package/build/components/sidebar/plugin-post-publish-panel/index.js +0 -39
- package/build/components/sidebar/plugin-post-publish-panel/index.js.map +0 -1
- package/build/components/sidebar/plugin-post-status-info/index.js +0 -73
- package/build/components/sidebar/plugin-post-status-info/index.js.map +0 -1
- package/build/components/sidebar/plugin-pre-publish-panel/index.js +0 -43
- package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +0 -1
- package/build/components/sidebar/plugin-sidebar/index.js +0 -104
- package/build/components/sidebar/plugin-sidebar/index.js.map +0 -1
- package/build/components/start-page-options/index.js +0 -107
- package/build/components/start-page-options/index.js.map +0 -1
- package/build/plugins/copy-content-menu-item/index.js +0 -39
- package/build/plugins/copy-content-menu-item/index.js.map +0 -1
- package/build/plugins/index.js +0 -69
- package/build/plugins/index.js.map +0 -1
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -41
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
- package/build/plugins/welcome-guide-menu-item/index.js.map +0 -1
- package/build-module/components/header/plugin-more-menu-item/index.js +0 -73
- package/build-module/components/header/plugin-more-menu-item/index.js.map +0 -1
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +0 -65
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +0 -83
- package/build-module/components/header/post-publish-button-or-toggle.js.map +0 -1
- package/build-module/components/header/preferences-menu-item/index.js +0 -24
- package/build-module/components/header/preferences-menu-item/index.js.map +0 -1
- package/build-module/components/header/tools-more-menu-group/index.js +0 -19
- package/build-module/components/header/tools-more-menu-group/index.js.map +0 -1
- package/build-module/components/header/writing-menu/index.js +0 -64
- package/build-module/components/header/writing-menu/index.js.map +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +0 -71
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -41
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -122
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -48
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +0 -1
- package/build-module/components/layout/actions-panel.js +0 -78
- package/build-module/components/layout/actions-panel.js.map +0 -1
- package/build-module/components/preferences-modal/enable-publish-sidebar.js +0 -31
- package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js +0 -32
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +0 -1
- package/build-module/components/sidebar/plugin-post-status-info/index.js +0 -66
- package/build-module/components/sidebar/plugin-post-status-info/index.js.map +0 -1
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +0 -36
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +0 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +0 -98
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +0 -1
- package/build-module/components/start-page-options/index.js +0 -100
- package/build-module/components/start-page-options/index.js.map +0 -1
- package/build-module/plugins/copy-content-menu-item/index.js +0 -32
- package/build-module/plugins/copy-content-menu-item/index.js.map +0 -1
- package/build-module/plugins/index.js +0 -65
- package/build-module/plugins/index.js.map +0 -1
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -33
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
- package/build-module/plugins/welcome-guide-menu-item/index.js.map +0 -1
- package/src/components/header/plugin-more-menu-item/index.js +0 -73
- package/src/components/header/plugin-sidebar-more-menu-item/index.js +0 -64
- package/src/components/header/post-publish-button-or-toggle.js +0 -92
- package/src/components/header/preferences-menu-item/index.js +0 -25
- package/src/components/header/test/index.js +0 -51
- package/src/components/header/tools-more-menu-group/index.js +0 -20
- package/src/components/header/writing-menu/index.js +0 -73
- package/src/components/keyboard-shortcut-help-modal/config.js +0 -53
- package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -43
- package/src/components/keyboard-shortcut-help-modal/index.js +0 -163
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +0 -67
- package/src/components/keyboard-shortcut-help-modal/style.scss +0 -61
- package/src/components/keyboard-shortcut-help-modal/test/index.js +0 -36
- package/src/components/layout/actions-panel.js +0 -103
- package/src/components/preferences-modal/enable-publish-sidebar.js +0 -32
- package/src/components/preferences-modal/test/index.js +0 -28
- package/src/components/sidebar/plugin-post-publish-panel/index.js +0 -28
- package/src/components/sidebar/plugin-post-status-info/index.js +0 -63
- package/src/components/sidebar/plugin-post-status-info/test/__snapshots__/index.js.snap +0 -11
- package/src/components/sidebar/plugin-post-status-info/test/index.js +0 -29
- package/src/components/sidebar/plugin-pre-publish-panel/index.js +0 -32
- package/src/components/sidebar/plugin-sidebar/index.js +0 -94
- package/src/components/start-page-options/index.js +0 -108
- package/src/components/start-page-options/style.scss +0 -26
- package/src/plugins/copy-content-menu-item/index.js +0 -29
- package/src/plugins/index.js +0 -85
- package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -34
- /package/src/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElement
|
|
1
|
+
import { createElement } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
@@ -7,33 +7,29 @@ import classnames from 'classnames';
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
11
|
-
import { PostSavedState, PostPreviewButton, store as editorStore, DocumentBar, privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
12
|
-
import { useEffect, useRef, useState } from '@wordpress/element';
|
|
10
|
+
import { DocumentBar, PostSavedState, PostPreviewButton, store as editorStore, privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
13
11
|
import { useSelect } from '@wordpress/data';
|
|
14
|
-
import { __ } from '@wordpress/i18n';
|
|
15
|
-
import { next, previous } from '@wordpress/icons';
|
|
16
|
-
import { PinnedItems } from '@wordpress/interface';
|
|
17
12
|
import { useViewportMatch } from '@wordpress/compose';
|
|
18
|
-
import {
|
|
13
|
+
import { __unstableMotion as motion } from '@wordpress/components';
|
|
19
14
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
15
|
+
import { useState } from '@wordpress/element';
|
|
20
16
|
|
|
21
17
|
/**
|
|
22
18
|
* Internal dependencies
|
|
23
19
|
*/
|
|
24
20
|
import FullscreenModeClose from './fullscreen-mode-close';
|
|
25
|
-
import
|
|
26
|
-
import PostPublishButtonOrToggle from './post-publish-button-or-toggle';
|
|
21
|
+
import PostEditorMoreMenu from './more-menu';
|
|
27
22
|
import MainDashboardButton from './main-dashboard-button';
|
|
28
23
|
import { store as editPostStore } from '../../store';
|
|
29
24
|
import { unlock } from '../../lock-unlock';
|
|
30
25
|
const {
|
|
31
|
-
|
|
32
|
-
} = unlock(blockEditorPrivateApis);
|
|
33
|
-
const {
|
|
26
|
+
CollapsableBlockToolbar,
|
|
34
27
|
DocumentTools,
|
|
35
28
|
PostViewLink,
|
|
36
|
-
PreviewDropdown
|
|
29
|
+
PreviewDropdown,
|
|
30
|
+
PinnedItems,
|
|
31
|
+
MoreMenu,
|
|
32
|
+
PostPublishButtonOrToggle
|
|
37
33
|
} = unlock(editorPrivateApis);
|
|
38
34
|
const slideY = {
|
|
39
35
|
hidden: {
|
|
@@ -71,14 +67,13 @@ function Header({
|
|
|
71
67
|
}) {
|
|
72
68
|
const isWideViewport = useViewportMatch('large');
|
|
73
69
|
const isLargeViewport = useViewportMatch('medium');
|
|
74
|
-
const blockToolbarRef = useRef();
|
|
75
70
|
const {
|
|
76
71
|
isTextEditor,
|
|
77
|
-
blockSelectionStart,
|
|
78
72
|
hasActiveMetaboxes,
|
|
79
73
|
isPublishSidebarOpened,
|
|
80
74
|
showIconLabels,
|
|
81
|
-
hasHistory
|
|
75
|
+
hasHistory,
|
|
76
|
+
hasFixedToolbar
|
|
82
77
|
} = useSelect(select => {
|
|
83
78
|
const {
|
|
84
79
|
get: getPreference
|
|
@@ -88,25 +83,15 @@ function Header({
|
|
|
88
83
|
} = select(editorStore);
|
|
89
84
|
return {
|
|
90
85
|
isTextEditor: getEditorMode() === 'text',
|
|
91
|
-
blockSelectionStart: select(blockEditorStore).getBlockSelectionStart(),
|
|
92
86
|
hasActiveMetaboxes: select(editPostStore).hasMetaBoxes(),
|
|
93
87
|
hasHistory: !!select(editorStore).getEditorSettings().onNavigateToPreviousEntityRecord,
|
|
94
88
|
isPublishSidebarOpened: select(editorStore).isPublishSidebarOpened(),
|
|
95
|
-
showIconLabels: getPreference('core', 'showIconLabels')
|
|
89
|
+
showIconLabels: getPreference('core', 'showIconLabels'),
|
|
90
|
+
hasFixedToolbar: getPreference('core', 'fixedToolbar')
|
|
96
91
|
};
|
|
97
92
|
}, []);
|
|
98
|
-
const
|
|
99
|
-
showFixedToolbar
|
|
100
|
-
} = useShowBlockTools();
|
|
101
|
-
const showTopToolbar = isLargeViewport && showFixedToolbar;
|
|
93
|
+
const hasTopToolbar = isLargeViewport && hasFixedToolbar;
|
|
102
94
|
const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = useState(true);
|
|
103
|
-
const hasBlockSelection = !!blockSelectionStart;
|
|
104
|
-
useEffect(() => {
|
|
105
|
-
// If we have a new block selection, show the block tools
|
|
106
|
-
if (blockSelectionStart) {
|
|
107
|
-
setIsBlockToolsCollapsed(false);
|
|
108
|
-
}
|
|
109
|
-
}, [blockSelectionStart]);
|
|
110
95
|
return createElement("div", {
|
|
111
96
|
className: "edit-post-header"
|
|
112
97
|
}, createElement(MainDashboardButton.Slot, null, createElement(motion.div, {
|
|
@@ -127,26 +112,12 @@ function Header({
|
|
|
127
112
|
className: "edit-post-header__toolbar"
|
|
128
113
|
}, createElement(DocumentTools, {
|
|
129
114
|
disableBlockTools: isTextEditor
|
|
130
|
-
}),
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}, createElement(BlockToolbar, {
|
|
135
|
-
hideDragHandle: true
|
|
136
|
-
})), createElement(Popover.Slot, {
|
|
137
|
-
ref: blockToolbarRef,
|
|
138
|
-
name: "block-toolbar"
|
|
139
|
-
}), createElement(Button, {
|
|
140
|
-
className: "edit-post-header__block-tools-toggle",
|
|
141
|
-
icon: isBlockToolsCollapsed ? next : previous,
|
|
142
|
-
onClick: () => {
|
|
143
|
-
setIsBlockToolsCollapsed(collapsed => !collapsed);
|
|
144
|
-
},
|
|
145
|
-
label: isBlockToolsCollapsed ? __('Show block tools') : __('Hide block tools'),
|
|
146
|
-
size: "compact"
|
|
147
|
-
})), createElement("div", {
|
|
115
|
+
}), hasTopToolbar && createElement(CollapsableBlockToolbar, {
|
|
116
|
+
isCollapsed: isBlockToolsCollapsed,
|
|
117
|
+
onToggle: setIsBlockToolsCollapsed
|
|
118
|
+
}), createElement("div", {
|
|
148
119
|
className: classnames('edit-post-header__center', {
|
|
149
|
-
'is-collapsed': hasHistory && !isBlockToolsCollapsed &&
|
|
120
|
+
'is-collapsed': hasHistory && !isBlockToolsCollapsed && hasTopToolbar
|
|
150
121
|
})
|
|
151
122
|
}, hasHistory && createElement(DocumentBar, null))), createElement(motion.div, {
|
|
152
123
|
variants: slideY,
|
|
@@ -172,10 +143,8 @@ function Header({
|
|
|
172
143
|
forceIsDirty: hasActiveMetaboxes,
|
|
173
144
|
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
|
|
174
145
|
}), (isWideViewport || !showIconLabels) && createElement(PinnedItems.Slot, {
|
|
175
|
-
scope: "core
|
|
176
|
-
}), createElement(MoreMenu,
|
|
177
|
-
showIconLabels: showIconLabels
|
|
178
|
-
})));
|
|
146
|
+
scope: "core"
|
|
147
|
+
}), createElement(MoreMenu, null), createElement(PostEditorMoreMenu, null)));
|
|
179
148
|
}
|
|
180
149
|
export default Header;
|
|
181
150
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","BlockToolbar","privateApis","blockEditorPrivateApis","store","blockEditorStore","PostSavedState","PostPreviewButton","editorStore","DocumentBar","editorPrivateApis","useEffect","useRef","useState","useSelect","__","next","previous","PinnedItems","useViewportMatch","Button","__unstableMotion","motion","Popover","preferencesStore","FullscreenModeClose","MoreMenu","PostPublishButtonOrToggle","MainDashboardButton","editPostStore","unlock","useShowBlockTools","DocumentTools","PostViewLink","PreviewDropdown","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","initialPost","isWideViewport","isLargeViewport","blockToolbarRef","isTextEditor","blockSelectionStart","hasActiveMetaboxes","isPublishSidebarOpened","showIconLabels","hasHistory","select","get","getPreference","getEditorMode","getBlockSelectionStart","hasMetaBoxes","getEditorSettings","onNavigateToPreviousEntityRecord","showFixedToolbar","showTopToolbar","isBlockToolsCollapsed","setIsBlockToolsCollapsed","hasBlockSelection","createElement","className","Slot","div","variants","showTooltip","disableBlockTools","Fragment","hideDragHandle","ref","name","icon","onClick","collapsed","label","size","forceIsDirty","forceIsAutosaveable","scope"],"sources":["@wordpress/edit-post/src/components/header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockToolbar,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tPostSavedState,\n\tPostPreviewButton,\n\tstore as editorStore,\n\tDocumentBar,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { next, previous } from '@wordpress/icons';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\tPopover,\n} from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport MoreMenu from './more-menu';\nimport PostPublishButtonOrToggle from './post-publish-button-or-toggle';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { useShowBlockTools } = unlock( blockEditorPrivateApis );\nconst { DocumentTools, PostViewLink, PreviewDropdown } =\n\tunlock( editorPrivateApis );\n\nconst slideY = {\n\thidden: { y: '-50px' },\n\tdistractionFreeInactive: { y: 0 },\n\thover: { y: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nconst slideX = {\n\thidden: { x: '-100%' },\n\tdistractionFreeInactive: { x: 0 },\n\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nfunction Header( { setEntitiesSavedStatesCallback, initialPost } ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst blockToolbarRef = useRef();\n\tconst {\n\t\tisTextEditor,\n\t\tblockSelectionStart,\n\t\thasActiveMetaboxes,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasHistory,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst { getEditorMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tblockSelectionStart:\n\t\t\t\tselect( blockEditorStore ).getBlockSelectionStart(),\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\thasHistory:\n\t\t\t\t!! select( editorStore ).getEditorSettings()\n\t\t\t\t\t.onNavigateToPreviousEntityRecord,\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editorStore ).isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\n\tconst { showFixedToolbar } = useShowBlockTools();\n\tconst showTopToolbar = isLargeViewport && showFixedToolbar;\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\tconst hasBlockSelection = !! blockSelectionStart;\n\n\tuseEffect( () => {\n\t\t// If we have a new block selection, show the block tools\n\t\tif ( blockSelectionStart ) {\n\t\t\tsetIsBlockToolsCollapsed( false );\n\t\t}\n\t}, [ blockSelectionStart ] );\n\n\treturn (\n\t\t<div className=\"edit-post-header\">\n\t\t\t<MainDashboardButton.Slot>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ slideX }\n\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t>\n\t\t\t\t\t<FullscreenModeClose\n\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\tinitialPost={ initialPost }\n\t\t\t\t\t/>\n\t\t\t\t</motion.div>\n\t\t\t</MainDashboardButton.Slot>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__toolbar\"\n\t\t\t>\n\t\t\t\t<DocumentTools disableBlockTools={ isTextEditor } />\n\t\t\t\t{ showTopToolbar && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'selected-block-tools-wrapper',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\t\t\t\tisBlockToolsCollapsed ||\n\t\t\t\t\t\t\t\t\t\t! hasBlockSelection,\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\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-post-header__block-tools-toggle\"\n\t\t\t\t\t\t\ticon={ isBlockToolsCollapsed ? next : previous }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsBlockToolsCollapsed(\n\t\t\t\t\t\t\t\t\t( collapsed ) => ! collapsed\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisBlockToolsCollapsed\n\t\t\t\t\t\t\t\t\t? __( 'Show block tools' )\n\t\t\t\t\t\t\t\t\t: __( 'Hide block tools' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames( 'edit-post-header__center', {\n\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\thasHistory &&\n\t\t\t\t\t\t\t! isBlockToolsCollapsed &&\n\t\t\t\t\t\t\tshowTopToolbar,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ hasHistory && <DocumentBar /> }\n\t\t\t\t</div>\n\t\t\t</motion.div>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t// We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState forceIsDirty={ hasActiveMetaboxes } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown forceIsAutosaveable={ hasActiveMetaboxes } />\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"edit-post-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-post\" />\n\t\t\t\t) }\n\t\t\t\t<MoreMenu showIconLabels={ showIconLab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AAoB,CAC1C,CAAC,EACFiB,aAAA,CAACrC,YAAY,MAAE,CAAC,EAChBqC,aAAA,CAAC3C,yBAAyB;IACzB2D,YAAY,EAAGjC,kBAAoB;IACnCP,8BAA8B,EAC7BA;EACA,CACD,CAAC,EACA,CAAEE,cAAc,IAAI,CAAEO,cAAc,KACrCe,aAAA,CAACpD,WAAW,CAACsD,IAAI;IAACgB,KAAK,EAAC;EAAgB,CAAE,CAC1C,EACDlB,aAAA,CAAC5C,QAAQ;IAAC6B,cAAc,EAAGA;EAAgB,CAAE,CAClC,CACR,CAAC;AAER;AAEA,eAAeV,MAAM"}
|
|
1
|
+
{"version":3,"names":["classnames","DocumentBar","PostSavedState","PostPreviewButton","store","editorStore","privateApis","editorPrivateApis","useSelect","useViewportMatch","__unstableMotion","motion","preferencesStore","useState","FullscreenModeClose","PostEditorMoreMenu","MainDashboardButton","editPostStore","unlock","CollapsableBlockToolbar","DocumentTools","PostViewLink","PreviewDropdown","PinnedItems","MoreMenu","PostPublishButtonOrToggle","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","initialPost","isWideViewport","isLargeViewport","isTextEditor","hasActiveMetaboxes","isPublishSidebarOpened","showIconLabels","hasHistory","hasFixedToolbar","select","get","getPreference","getEditorMode","hasMetaBoxes","getEditorSettings","onNavigateToPreviousEntityRecord","hasTopToolbar","isBlockToolsCollapsed","setIsBlockToolsCollapsed","createElement","className","Slot","div","variants","showTooltip","disableBlockTools","isCollapsed","onToggle","forceIsDirty","forceIsAutosaveable","scope"],"sources":["@wordpress/edit-post/src/components/header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDocumentBar,\n\tPostSavedState,\n\tPostPreviewButton,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport PostEditorMoreMenu from './more-menu';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tCollapsableBlockToolbar,\n\tDocumentTools,\n\tPostViewLink,\n\tPreviewDropdown,\n\tPinnedItems,\n\tMoreMenu,\n\tPostPublishButtonOrToggle,\n} = unlock( editorPrivateApis );\n\nconst slideY = {\n\thidden: { y: '-50px' },\n\tdistractionFreeInactive: { y: 0 },\n\thover: { y: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nconst slideX = {\n\thidden: { x: '-100%' },\n\tdistractionFreeInactive: { x: 0 },\n\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nfunction Header( { setEntitiesSavedStatesCallback, initialPost } ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tisTextEditor,\n\t\thasActiveMetaboxes,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasHistory,\n\t\thasFixedToolbar,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst { getEditorMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\thasHistory:\n\t\t\t\t!! select( editorStore ).getEditorSettings()\n\t\t\t\t\t.onNavigateToPreviousEntityRecord,\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editorStore ).isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t};\n\t}, [] );\n\n\tconst hasTopToolbar = isLargeViewport && hasFixedToolbar;\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\treturn (\n\t\t<div className=\"edit-post-header\">\n\t\t\t<MainDashboardButton.Slot>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ slideX }\n\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t>\n\t\t\t\t\t<FullscreenModeClose\n\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\tinitialPost={ initialPost }\n\t\t\t\t\t/>\n\t\t\t\t</motion.div>\n\t\t\t</MainDashboardButton.Slot>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__toolbar\"\n\t\t\t>\n\t\t\t\t<DocumentTools disableBlockTools={ isTextEditor } />\n\t\t\t\t{ hasTopToolbar && (\n\t\t\t\t\t<CollapsableBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames( 'edit-post-header__center', {\n\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\thasHistory &&\n\t\t\t\t\t\t\t! isBlockToolsCollapsed &&\n\t\t\t\t\t\t\thasTopToolbar,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ hasHistory && <DocumentBar /> }\n\t\t\t\t</div>\n\t\t\t</motion.div>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t// We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState forceIsDirty={ hasActiveMetaboxes } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown forceIsAutosaveable={ hasActiveMetaboxes } />\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"edit-post-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\t\t\t\t<MoreMenu />\n\t\t\t\t<PostEditorMoreMenu />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,WAAW,EACXC,cAAc,EACdC,iBAAiB,EACjBC,KAAK,IAAIC,WAAW,EACpBC,WAAW,IAAIC,iBAAiB,QAC1B,mBAAmB;AAC1B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;AAClE,SAASP,KAAK,IAAIQ,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,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,aAAA,CAACtC,uBAAuB;IACvB6C,WAAW,EAAGT,qBAAuB;IACrCU,QAAQ,EAAGT;EAA0B,CACrC,CACD,EACDC,aAAA;IACCC,SAAS,EAAG1D,UAAU,CAAE,0BAA0B,EAAE;MACnD,cAAc,EACb6C,UAAU,IACV,CAAEU,qBAAqB,IACvBD;IACF,CAAE;EAAG,GAEHT,UAAU,IAAIY,aAAA,CAACxD,WAAW,MAAE,CAC1B,CACM,CAAC,EACbwD,aAAA,CAAC9C,MAAM,CAACiD,GAAG;IACVC,QAAQ,EAAGnC,MAAQ;IACnBK,UAAU,EAAG;MAAEC,IAAI,EAAE,OAAO;MAAEC,KAAK,EAAE;IAAI,CAAG;IAC5CyB,SAAS,EAAC;EAA4B,GAEpC,CAAEf,sBAAsB;EACzB;EACA;EACA;EACA;EACA;EACAc,aAAA,CAACvD,cAAc;IAACgE,YAAY,EAAGxB;EAAoB,CAAE,CACrD,EACDe,aAAA,CAACnC,eAAe;IAAC6C,mBAAmB,EAAGzB;EAAoB,CAAE,CAAC,EAC9De,aAAA,CAACtD,iBAAiB;IACjBuD,SAAS,EAAC,uCAAuC;IACjDS,mBAAmB,EAAGzB;EAAoB,CAC1C,CAAC,EACFe,aAAA,CAACpC,YAAY,MAAE,CAAC,EAChBoC,aAAA,CAAChC,yBAAyB;IACzByC,YAAY,EAAGxB,kBAAoB;IACnCL,8BAA8B,EAC7BA;EACA,CACD,CAAC,EACA,CAAEE,cAAc,IAAI,CAAEK,cAAc,KACrCa,aAAA,CAAClC,WAAW,CAACoC,IAAI;IAACS,KAAK,EAAC;EAAM,CAAE,CAChC,EACDX,aAAA,CAACjC,QAAQ,MAAE,CAAC,EACZiC,aAAA,CAAC1C,kBAAkB,MAAE,CACV,CACR,CAAC;AAER;AAEA,eAAeqB,MAAM","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Keyboard","Component","HeaderToolbar","Header","constructor","arguments","keyboardDidShow","bind","keyboardDidHide","state","isKeyboardVisible","componentDidMount","keyboardShowSubscription","addListener","keyboardHideSubscription","componentWillUnmount","remove","setState","render","createElement","showKeyboardHideButton"],"sources":["@wordpress/edit-post/src/components/header/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Keyboard } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport '@wordpress/
|
|
1
|
+
{"version":3,"names":["Keyboard","Component","HeaderToolbar","Header","constructor","arguments","keyboardDidShow","bind","keyboardDidHide","state","isKeyboardVisible","componentDidMount","keyboardShowSubscription","addListener","keyboardHideSubscription","componentWillUnmount","remove","setState","render","createElement","showKeyboardHideButton"],"sources":["@wordpress/edit-post/src/components/header/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Keyboard } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport HeaderToolbar from './header-toolbar';\n\nexport default class Header extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.keyboardDidShow = this.keyboardDidShow.bind( this );\n\t\tthis.keyboardDidHide = this.keyboardDidHide.bind( this );\n\n\t\tthis.state = {\n\t\t\tisKeyboardVisible: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.keyboardShowSubscription = Keyboard.addListener(\n\t\t\t'keyboardDidShow',\n\t\t\tthis.keyboardDidShow\n\t\t);\n\t\tthis.keyboardHideSubscription = Keyboard.addListener(\n\t\t\t'keyboardDidHide',\n\t\t\tthis.keyboardDidHide\n\t\t);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.keyboardShowSubscription.remove();\n\t\tthis.keyboardHideSubscription.remove();\n\t}\n\n\tkeyboardDidShow() {\n\t\tthis.setState( { isKeyboardVisible: true } );\n\t}\n\n\tkeyboardDidHide() {\n\t\tthis.setState( { isKeyboardVisible: false } );\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<He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,sBAAsB,EAAG,IAAI,CAACX,KAAK,CAACC;IAAmB,CACvD,CAAC;EAEJ;AACD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalUseSlotFills","useSlotFills","createSlotFill","slotName","Fill","Slot","MainDashboardButtonSlot","MainDashboardButton","children","fills","hasFills","Boolean","length","createElement","bubblesVirtually"],"sources":["@wordpress/edit-post/src/components/header/main-dashboard-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseSlotFills as useSlotFills,\n\tcreateSlotFill,\n} from '@wordpress/components';\n\nconst slotName = '__experimentalMainDashboardButton';\n\nconst { Fill, Slot: MainDashboardButtonSlot } = createSlotFill( slotName );\n\nconst MainDashboardButton = Fill;\n\nconst Slot = ( { children } ) => {\n\tconst fills = useSlotFills( slotName );\n\tconst hasFills = Boolean( fills && fills.length );\n\n\tif ( ! hasFills ) {\n\t\treturn children;\n\t}\n\n\treturn <MainDashboardButtonSlot bubblesVirtually />;\n};\n\nMainDashboardButton.Slot = Slot;\n\nexport default MainDashboardButton;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,0BAA0B,IAAIC,YAAY,EAC1CC,cAAc,QACR,uBAAuB;AAE9B,MAAMC,QAAQ,GAAG,mCAAmC;AAEpD,MAAM;EAAEC,IAAI;EAAEC,IAAI,EAAEC;AAAwB,CAAC,GAAGJ,cAAc,CAAEC,QAAS,CAAC;AAE1E,MAAMI,mBAAmB,GAAGH,IAAI;AAEhC,MAAMC,IAAI,GAAGA,CAAE;EAAEG;AAAS,CAAC,KAAM;EAChC,MAAMC,KAAK,GAAGR,YAAY,CAAEE,QAAS,CAAC;EACtC,MAAMO,QAAQ,GAAGC,OAAO,CAAEF,KAAK,IAAIA,KAAK,CAACG,MAAO,CAAC;EAEjD,IAAK,CAAEF,QAAQ,EAAG;IACjB,OAAOF,QAAQ;EAChB;EAEA,OAAOK,aAAA,CAACP,uBAAuB;IAACQ,gBAAgB;EAAA,CAAE,CAAC;AACpD,CAAC;AAEDP,mBAAmB,CAACF,IAAI,GAAGA,IAAI;AAE/B,eAAeE,mBAAmB"}
|
|
1
|
+
{"version":3,"names":["__experimentalUseSlotFills","useSlotFills","createSlotFill","slotName","Fill","Slot","MainDashboardButtonSlot","MainDashboardButton","children","fills","hasFills","Boolean","length","createElement","bubblesVirtually"],"sources":["@wordpress/edit-post/src/components/header/main-dashboard-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseSlotFills as useSlotFills,\n\tcreateSlotFill,\n} from '@wordpress/components';\n\nconst slotName = '__experimentalMainDashboardButton';\n\nconst { Fill, Slot: MainDashboardButtonSlot } = createSlotFill( slotName );\n\nconst MainDashboardButton = Fill;\n\nconst Slot = ( { children } ) => {\n\tconst fills = useSlotFills( slotName );\n\tconst hasFills = Boolean( fills && fills.length );\n\n\tif ( ! hasFills ) {\n\t\treturn children;\n\t}\n\n\treturn <MainDashboardButtonSlot bubblesVirtually />;\n};\n\nMainDashboardButton.Slot = Slot;\n\nexport default MainDashboardButton;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,0BAA0B,IAAIC,YAAY,EAC1CC,cAAc,QACR,uBAAuB;AAE9B,MAAMC,QAAQ,GAAG,mCAAmC;AAEpD,MAAM;EAAEC,IAAI;EAAEC,IAAI,EAAEC;AAAwB,CAAC,GAAGJ,cAAc,CAAEC,QAAS,CAAC;AAE1E,MAAMI,mBAAmB,GAAGH,IAAI;AAEhC,MAAMC,IAAI,GAAGA,CAAE;EAAEG;AAAS,CAAC,KAAM;EAChC,MAAMC,KAAK,GAAGR,YAAY,CAAEE,QAAS,CAAC;EACtC,MAAMO,QAAQ,GAAGC,OAAO,CAAEF,KAAK,IAAIA,KAAK,CAACG,MAAO,CAAC;EAEjD,IAAK,CAAEF,QAAQ,EAAG;IACjB,OAAOF,QAAQ;EAChB;EAEA,OAAOK,aAAA,CAACP,uBAAuB;IAACQ,gBAAgB;EAAA,CAAE,CAAC;AACpD,CAAC;AAEDP,mBAAmB,CAACF,IAAI,GAAGA,IAAI;AAE/B,eAAeE,mBAAmB","ignoreList":[]}
|
|
@@ -3,58 +3,33 @@ import { createElement, Fragment } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { MenuGroup, DropdownMenu } from '@wordpress/components';
|
|
7
|
-
import { ActionItem, PinnedItems } from '@wordpress/interface';
|
|
8
6
|
import { useViewportMatch } from '@wordpress/compose';
|
|
9
7
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
10
|
-
import {
|
|
8
|
+
import { PreferenceToggleMenuItem } from '@wordpress/preferences';
|
|
9
|
+
import { displayShortcut } from '@wordpress/keycodes';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Internal dependencies
|
|
14
13
|
*/
|
|
15
|
-
import PreferencesMenuItem from '../preferences-menu-item';
|
|
16
|
-
import ToolsMoreMenuGroup from '../tools-more-menu-group';
|
|
17
|
-
import WritingMenu from '../writing-menu';
|
|
18
14
|
import { unlock } from '../../../lock-unlock';
|
|
15
|
+
import ManagePatternsMenuItem from './manage-patterns-menu-item';
|
|
16
|
+
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
17
|
+
import EditPostPreferencesModal from '../../preferences-modal';
|
|
19
18
|
const {
|
|
20
|
-
|
|
19
|
+
ToolsMoreMenuGroup,
|
|
20
|
+
ViewMoreMenuGroup
|
|
21
21
|
} = unlock(editorPrivateApis);
|
|
22
|
-
const MoreMenu = ({
|
|
23
|
-
showIconLabels
|
|
24
|
-
}) => {
|
|
22
|
+
const MoreMenu = () => {
|
|
25
23
|
const isLargeViewport = useViewportMatch('large');
|
|
26
|
-
return createElement(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
variant: 'tertiary'
|
|
36
|
-
}),
|
|
37
|
-
tooltipPosition: 'bottom',
|
|
38
|
-
showTooltip: !showIconLabels,
|
|
39
|
-
size: 'compact'
|
|
40
|
-
}
|
|
41
|
-
}, ({
|
|
42
|
-
onClose
|
|
43
|
-
}) => createElement(Fragment, null, showIconLabels && !isLargeViewport && createElement(PinnedItems.Slot, {
|
|
44
|
-
className: showIconLabels && 'show-icon-labels',
|
|
45
|
-
scope: "core/edit-post"
|
|
46
|
-
}), createElement(WritingMenu, null), createElement(ModeSwitcher, null), createElement(ActionItem.Slot, {
|
|
47
|
-
name: "core/edit-post/plugin-more-menu",
|
|
48
|
-
label: __('Plugins'),
|
|
49
|
-
as: MenuGroup,
|
|
50
|
-
fillProps: {
|
|
51
|
-
onClick: onClose
|
|
52
|
-
}
|
|
53
|
-
}), createElement(ToolsMoreMenuGroup.Slot, {
|
|
54
|
-
fillProps: {
|
|
55
|
-
onClose
|
|
56
|
-
}
|
|
57
|
-
}), createElement(MenuGroup, null, createElement(PreferencesMenuItem, null))));
|
|
24
|
+
return createElement(Fragment, null, isLargeViewport && createElement(ViewMoreMenuGroup, null, createElement(PreferenceToggleMenuItem, {
|
|
25
|
+
scope: "core/edit-post",
|
|
26
|
+
name: "fullscreenMode",
|
|
27
|
+
label: __('Fullscreen mode'),
|
|
28
|
+
info: __('Show and hide the admin user interface'),
|
|
29
|
+
messageActivated: __('Fullscreen mode activated'),
|
|
30
|
+
messageDeactivated: __('Fullscreen mode deactivated'),
|
|
31
|
+
shortcut: displayShortcut.secondary('f')
|
|
32
|
+
})), createElement(ToolsMoreMenuGroup, null, createElement(ManagePatternsMenuItem, null), createElement(WelcomeGuideMenuItem, null)), createElement(EditPostPreferencesModal, null));
|
|
58
33
|
};
|
|
59
34
|
export default MoreMenu;
|
|
60
35
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","
|
|
1
|
+
{"version":3,"names":["__","useViewportMatch","privateApis","editorPrivateApis","PreferenceToggleMenuItem","displayShortcut","unlock","ManagePatternsMenuItem","WelcomeGuideMenuItem","EditPostPreferencesModal","ToolsMoreMenuGroup","ViewMoreMenuGroup","MoreMenu","isLargeViewport","createElement","Fragment","scope","name","label","info","messageActivated","messageDeactivated","shortcut","secondary"],"sources":["@wordpress/edit-post/src/components/header/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\nimport { displayShortcut } from '@wordpress/keycodes';\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<W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wB,MAAE,CAC1B,CAAC;AAEL,CAAC;AAED,eAAeG,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { MenuItem } from '@wordpress/components';
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
import { useSelect } from '@wordpress/data';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
9
|
+
import { addQueryArgs } from '@wordpress/url';
|
|
10
|
+
function ManagePatternsMenuItem() {
|
|
11
|
+
const url = useSelect(select => {
|
|
12
|
+
const {
|
|
13
|
+
canUser
|
|
14
|
+
} = select(coreStore);
|
|
15
|
+
const defaultUrl = addQueryArgs('edit.php', {
|
|
16
|
+
post_type: 'wp_block'
|
|
17
|
+
});
|
|
18
|
+
const patternsUrl = addQueryArgs('site-editor.php', {
|
|
19
|
+
path: '/patterns'
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// The site editor and templates both check whether the user has
|
|
23
|
+
// edit_theme_options capabilities. We can leverage that here and not
|
|
24
|
+
// display the manage patterns link if the user can't access it.
|
|
25
|
+
return canUser('read', 'templates') ? patternsUrl : defaultUrl;
|
|
26
|
+
}, []);
|
|
27
|
+
return createElement(MenuItem, {
|
|
28
|
+
role: "menuitem",
|
|
29
|
+
href: url
|
|
30
|
+
}, __('Manage patterns'));
|
|
31
|
+
}
|
|
32
|
+
export default ManagePatternsMenuItem;
|
|
33
|
+
//# sourceMappingURL=manage-patterns-menu-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MenuItem","store","coreStore","useSelect","__","addQueryArgs","ManagePatternsMenuItem","url","select","canUser","defaultUrl","post_type","patternsUrl","path","createElement","role","href"],"sources":["@wordpress/edit-post/src/components/header/more-menu/manage-patterns-menu-item.js"],"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\tpath: '/patterns',\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( 'read', 'templates' ) ? patternsUrl : 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"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,gBAAgB;AAE7C,SAASC,sBAAsBA,CAAA,EAAG;EACjC,MAAMC,GAAG,GAAGJ,SAAS,CAAIK,MAAM,IAAM;IACpC,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM,CAAEN,SAAU,CAAC;IACvC,MAAMQ,UAAU,GAAGL,YAAY,CAAE,UAAU,EAAE;MAC5CM,SAAS,EAAE;IACZ,CAAE,CAAC;IACH,MAAMC,WAAW,GAAGP,YAAY,CAAE,iBAAiB,EAAE;MACpDQ,IAAI,EAAE;IACP,CAAE,CAAC;;IAEH;IACA;IACA;IACA,OAAOJ,OAAO,CAAE,MAAM,EAAE,WAAY,CAAC,GAAGG,WAAW,GAAGF,UAAU;EACjE,CAAC,EAAE,EAAG,CAAC;EAEP,OACCI,aAAA,CAACd,QAAQ;IAACe,IAAI,EAAC,UAAU;IAACC,IAAI,EAAGT;EAAK,GACnCH,EAAE,CAAE,iBAAkB,CACf,CAAC;AAEb;AAEA,eAAeE,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSelect","PreferenceToggleMenuItem","__","store","editorStore","WelcomeGuideMenuItem","isEditingTemplate","select","getCurrentPostType","createElement","scope","name","label"],"sources":["@wordpress/edit-post/src/components/header/more-menu/welcome-guide-menu-item.js"],"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"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,wBAAwB,QAAQ,wBAAwB;AACjE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AAExD,eAAe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,iBAAiB,GAAGN,SAAS,CAChCO,MAAM,IACPA,MAAM,CAAEH,WAAY,CAAC,CAACI,kBAAkB,CAAC,CAAC,KAAK,aAAa,EAC7D,EACD,CAAC;EAED,OACCC,aAAA,CAACR,wBAAwB;IACxBS,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAGL,iBAAiB,GAAG,sBAAsB,GAAG,cAAgB;IACpEM,KAAK,EAAGV,EAAE,CAAE,eAAgB;EAAG,CAC/B,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","__","_x","Modal","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","ToggleControl","TextControl","useEffect","useState","store","editorStore","privateApis","blockEditorPrivateApis","unlock","ReusableBlocksRenameHint","InitPatternModal","editPost","isModalOpen","setIsModalOpen","syncType","setSyncType","undefined","title","setTitle","postType","isNewPost","select","getEditedPostAttribute","isCleanNewPost","createElement","Fragment","onRequestClose","overlayClassName","onSubmit","event","preventDefault","meta","wp_pattern_sync_status","spacing","label","value","onChange","placeholder","className","__nextHasNoMarginBottom","__next40pxDefaultSize","help","checked","justify","variant","type","disabled","__experimentalIsFocusable"],"sources":["@wordpress/edit-post/src/components/init-pattern-modal/index.js"],"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 { useEffect, useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\n\nimport { unlock } from '../../lock-unlock';\n\nconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\nexport default function InitPatternModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\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\n\tuseEffect( () => {\n\t\tif ( isNewPost && postType === 'wp_block' ) {\n\t\t\tsetIsModalOpen( true );\n\t\t}\n\t\t// We only want the modal to open when the page is first loaded.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\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<ReusableBlocksRenameHint />\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t\t\t'Option that makes an individual pattern synchronized'\n\t\t\t\t\t\t\t\t) }\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\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\t__experimentalIsFocusable\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"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SACCC,KAAK,EACLC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,aAAa,EACbC,WAAW,QACL,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,W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IACHc,gBAAgB,EAAC;EAA2C,GAE5DH,aAAA;IACCI,QAAQ,EAAKC,KAAK,IAAM;MACvBA,KAAK,CAACC,cAAc,CAAC,CAAC;MACtBjB,cAAc,CAAE,KAAM,CAAC;MACvBF,QAAQ,CAAE;QACTM,KAAK;QACLc,IAAI,EAAE;UACLC,sBAAsB,EAAElB;QACzB;MACD,CAAE,CAAC;IACJ;EAAG,GAEHU,aAAA,CAACzB,MAAM;IAACkC,OAAO,EAAC;EAAG,GAClBT,aAAA,CAACvB,WAAW;IACXiC,KAAK,EAAG1C,EAAE,CAAE,MAAO,CAAG;IACtB2C,KAAK,EAAGlB,KAAO;IACfmB,QAAQ,EAAGlB,QAAU;IACrBmB,WAAW,EAAG7C,EAAE,CAAE,YAAa,CAAG;IAClC8C,SAAS,EAAC,mCAAmC;IAC7CC,uBAAuB;IACvBC,qBAAqB;EAAA,CACrB,CAAC,EACFhB,aAAA,CAACf,wBAAwB,MAAE,CAAC,EAC5Be,aAAA,CAACxB,aAAa;IACbkC,KAAK,EAAGzC,EAAE,CACT,QAAQ,EACR,sDACD,CAAG;IACHgD,IAAI,EAAGjD,EAAE,CACR,8CACD,CAAG;IACHkD,OAAO,EAAG,CAAE5B,QAAU;IACtBsB,QAAQ,EAAGA,CAAA,KAAM;MAChBrB,WAAW,CACV,CAAED,QAAQ,GAAG,UAAU,GAAGE,SAC3B,CAAC;IACF;EAAG,CACH,CAAC,EACFQ,aAAA,CAAC3B,MAAM;IAAC8C,OAAO,EAAC;EAAO,GACtBnB,aAAA,CAAC7B,MAAM;IACNiD,OAAO,EAAC,SAAS;IACjBC,IAAI,EAAC,QAAQ;IACbC,QAAQ,EAAG,CAAE7B,KAAO;IACpB8B,yBAAyB;EAAA,GAEvBvD,EAAE,CAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAEP,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","__","_x","Modal","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","ToggleControl","TextControl","useEffect","useState","store","editorStore","privateApis","blockEditorPrivateApis","unlock","ReusableBlocksRenameHint","InitPatternModal","editPost","isModalOpen","setIsModalOpen","syncType","setSyncType","undefined","title","setTitle","postType","isNewPost","select","getEditedPostAttribute","isCleanNewPost","createElement","Fragment","onRequestClose","overlayClassName","onSubmit","event","preventDefault","meta","wp_pattern_sync_status","spacing","label","value","onChange","placeholder","className","__nextHasNoMarginBottom","__next40pxDefaultSize","help","checked","justify","variant","type","disabled","__experimentalIsFocusable"],"sources":["@wordpress/edit-post/src/components/init-pattern-modal/index.js"],"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 { useEffect, useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\n\nimport { unlock } from '../../lock-unlock';\n\nconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\nexport default function InitPatternModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\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\n\tuseEffect( () => {\n\t\tif ( isNewPost && postType === 'wp_block' ) {\n\t\t\tsetIsModalOpen( true );\n\t\t}\n\t\t// We only want the modal to open when the page is first loaded.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\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<ReusableBlocksRenameHint />\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t\t\t'Option that makes an individual pattern synchronized'\n\t\t\t\t\t\t\t\t) }\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\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\t__experimentalIsFocusable\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"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SACCC,KAAK,EACLC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,aAAa,EACbC,WAAW,QACL,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAE/E;AACA;AACA;;AAEA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAyB,CAAC,GAAGD,MAAM,CAAED,sBAAuB,CAAC;AAErE,eAAe,SAASG,gBAAgBA,CAAA,EAAG;EAC1C,MAAM;IAAEC;EAAS,CAAC,GAAGpB,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C;IACJ;EAAG,GAEHU,aAAA,CAACzB,MAAM;IAACkC,OAAO,EAAC;EAAG,GAClBT,aAAA,CAACvB,WAAW;IACXiC,KAAK,EAAG1C,EAAE,CAAE,MAAO,CAAG;IACtB2C,KAAK,EAAGlB,KAAO;IACfmB,QAAQ,EAAGlB,QAAU;IACrBmB,WAAW,EAAG7C,EAAE,CAAE,YAAa,CAAG;IAClC8C,SAAS,EAAC,mCAAmC;IAC7CC,uBAAuB;IACvBC,qBAAqB;EAAA,CACrB,CAAC,EACFhB,aAAA,CAACf,wBAAwB,MAAE,CAAC,EAC5Be,aAAA,CAACxB,aAAa;IACbkC,KAAK,EAAGzC,EAAE,CACT,QAAQ,EACR,sDACD,CAAG;IACHgD,IAAI,EAAGjD,EAAE,CACR,8CACD,CAAG;IACHkD,OAAO,EAAG,CAAE5B,QAAU;IACtBsB,QAAQ,EAAGA,CAAA,KAAM;MAChBrB,WAAW,CACV,CAAED,QAAQ,GAAG,UAAU,GAAGE,SAC3B,CAAC;IACF;EAAG,CACH,CAAC,EACFQ,aAAA,CAAC3B,MAAM;IAAC8C,OAAO,EAAC;EAAO,GACtBnB,aAAA,CAAC7B,MAAM;IACNiD,OAAO,EAAC,SAAS;IACjBC,IAAI,EAAC,QAAQ;IACbC,QAAQ,EAAG,CAAE7B,KAAO;IACpB8B,yBAAyB;EAAA,GAEvBvD,EAAE,CAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAEP,CAAC;AAEL","ignoreList":[]}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useEffect } from '@wordpress/element';
|
|
5
|
-
import {
|
|
5
|
+
import { useDispatch } from '@wordpress/data';
|
|
6
6
|
import { useShortcut, store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
9
|
-
import { createBlock } from '@wordpress/blocks';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* Internal dependencies
|
|
@@ -14,47 +12,11 @@ import { createBlock } from '@wordpress/blocks';
|
|
|
14
12
|
import { store as editPostStore } from '../../store';
|
|
15
13
|
function KeyboardShortcuts() {
|
|
16
14
|
const {
|
|
17
|
-
isEditorSidebarOpened
|
|
18
|
-
} = useSelect(editPostStore);
|
|
19
|
-
const {
|
|
20
|
-
openGeneralSidebar,
|
|
21
|
-
closeGeneralSidebar,
|
|
22
15
|
toggleFeature
|
|
23
16
|
} = useDispatch(editPostStore);
|
|
24
17
|
const {
|
|
25
18
|
registerShortcut
|
|
26
19
|
} = useDispatch(keyboardShortcutsStore);
|
|
27
|
-
const {
|
|
28
|
-
replaceBlocks
|
|
29
|
-
} = useDispatch(blockEditorStore);
|
|
30
|
-
const {
|
|
31
|
-
getBlockName,
|
|
32
|
-
getSelectedBlockClientId,
|
|
33
|
-
getBlockAttributes,
|
|
34
|
-
getBlockSelectionStart
|
|
35
|
-
} = useSelect(blockEditorStore);
|
|
36
|
-
const handleTextLevelShortcut = (event, level) => {
|
|
37
|
-
event.preventDefault();
|
|
38
|
-
const destinationBlockName = level === 0 ? 'core/paragraph' : 'core/heading';
|
|
39
|
-
const currentClientId = getSelectedBlockClientId();
|
|
40
|
-
if (currentClientId === null) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const blockName = getBlockName(currentClientId);
|
|
44
|
-
if (blockName !== 'core/paragraph' && blockName !== 'core/heading') {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const attributes = getBlockAttributes(currentClientId);
|
|
48
|
-
const textAlign = blockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
49
|
-
const destinationTextAlign = destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
50
|
-
replaceBlocks(currentClientId, createBlock(destinationBlockName, {
|
|
51
|
-
level,
|
|
52
|
-
content: attributes.content,
|
|
53
|
-
...{
|
|
54
|
-
[destinationTextAlign]: attributes[textAlign]
|
|
55
|
-
}
|
|
56
|
-
}));
|
|
57
|
-
};
|
|
58
20
|
useEffect(() => {
|
|
59
21
|
registerShortcut({
|
|
60
22
|
name: 'core/edit-post/toggle-fullscreen',
|
|
@@ -65,95 +27,10 @@ function KeyboardShortcuts() {
|
|
|
65
27
|
character: 'f'
|
|
66
28
|
}
|
|
67
29
|
});
|
|
68
|
-
registerShortcut({
|
|
69
|
-
name: 'core/edit-post/toggle-sidebar',
|
|
70
|
-
category: 'global',
|
|
71
|
-
description: __('Show or hide the Settings sidebar.'),
|
|
72
|
-
keyCombination: {
|
|
73
|
-
modifier: 'primaryShift',
|
|
74
|
-
character: ','
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
registerShortcut({
|
|
78
|
-
name: 'core/edit-post/next-region',
|
|
79
|
-
category: 'global',
|
|
80
|
-
description: __('Navigate to the next part of the editor.'),
|
|
81
|
-
keyCombination: {
|
|
82
|
-
modifier: 'ctrl',
|
|
83
|
-
character: '`'
|
|
84
|
-
},
|
|
85
|
-
aliases: [{
|
|
86
|
-
modifier: 'access',
|
|
87
|
-
character: 'n'
|
|
88
|
-
}]
|
|
89
|
-
});
|
|
90
|
-
registerShortcut({
|
|
91
|
-
name: 'core/edit-post/previous-region',
|
|
92
|
-
category: 'global',
|
|
93
|
-
description: __('Navigate to the previous part of the editor.'),
|
|
94
|
-
keyCombination: {
|
|
95
|
-
modifier: 'ctrlShift',
|
|
96
|
-
character: '`'
|
|
97
|
-
},
|
|
98
|
-
aliases: [{
|
|
99
|
-
modifier: 'access',
|
|
100
|
-
character: 'p'
|
|
101
|
-
}, {
|
|
102
|
-
modifier: 'ctrlShift',
|
|
103
|
-
character: '~'
|
|
104
|
-
}]
|
|
105
|
-
});
|
|
106
|
-
registerShortcut({
|
|
107
|
-
name: 'core/edit-post/keyboard-shortcuts',
|
|
108
|
-
category: 'main',
|
|
109
|
-
description: __('Display these keyboard shortcuts.'),
|
|
110
|
-
keyCombination: {
|
|
111
|
-
modifier: 'access',
|
|
112
|
-
character: 'h'
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
registerShortcut({
|
|
116
|
-
name: 'core/edit-post/transform-heading-to-paragraph',
|
|
117
|
-
category: 'block-library',
|
|
118
|
-
description: __('Transform heading to paragraph.'),
|
|
119
|
-
keyCombination: {
|
|
120
|
-
modifier: 'access',
|
|
121
|
-
character: `0`
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
[1, 2, 3, 4, 5, 6].forEach(level => {
|
|
125
|
-
registerShortcut({
|
|
126
|
-
name: `core/edit-post/transform-paragraph-to-heading-${level}`,
|
|
127
|
-
category: 'block-library',
|
|
128
|
-
description: __('Transform paragraph to heading.'),
|
|
129
|
-
keyCombination: {
|
|
130
|
-
modifier: 'access',
|
|
131
|
-
character: `${level}`
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
30
|
}, []);
|
|
136
31
|
useShortcut('core/edit-post/toggle-fullscreen', () => {
|
|
137
32
|
toggleFeature('fullscreenMode');
|
|
138
33
|
});
|
|
139
|
-
useShortcut('core/edit-post/toggle-sidebar', event => {
|
|
140
|
-
// This shortcut has no known clashes, but use preventDefault to prevent any
|
|
141
|
-
// obscure shortcuts from triggering.
|
|
142
|
-
event.preventDefault();
|
|
143
|
-
if (isEditorSidebarOpened()) {
|
|
144
|
-
closeGeneralSidebar();
|
|
145
|
-
} else {
|
|
146
|
-
const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document';
|
|
147
|
-
openGeneralSidebar(sidebarToOpen);
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
useShortcut('core/edit-post/transform-heading-to-paragraph', event => handleTextLevelShortcut(event, 0));
|
|
151
|
-
[1, 2, 3, 4, 5, 6].forEach(level => {
|
|
152
|
-
//the loop is based off on a constant therefore
|
|
153
|
-
//the hook will execute the same way every time
|
|
154
|
-
//eslint-disable-next-line react-hooks/rules-of-hooks
|
|
155
|
-
useShortcut(`core/edit-post/transform-paragraph-to-heading-${level}`, event => handleTextLevelShortcut(event, level));
|
|
156
|
-
});
|
|
157
34
|
return null;
|
|
158
35
|
}
|
|
159
36
|
export default KeyboardShortcuts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","
|
|
1
|
+
{"version":3,"names":["useEffect","useDispatch","useShortcut","store","keyboardShortcutsStore","__","editPostStore","KeyboardShortcuts","toggleFeature","registerShortcut","name","category","description","keyCombination","modifier","character"],"sources":["@wordpress/edit-post/src/components/keyboard-shortcuts/index.js"],"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 { toggleFeature } = 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: __( 'Toggle 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\ttoggleFeature( 'fullscreenMode' );\n\t} );\n\n\treturn null;\n}\n\nexport default KeyboardShortcuts;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SACCC,WAAW,EACXC,KAAK,IAAIC,sBAAsB,QACzB,+BAA+B;AACtC,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASF,KAAK,IAAIG,aAAa,QAAQ,aAAa;AAEpD,SAASC,iBAAiBA,CAAA,EAAG;EAC5B,MAAM;IAAEC;EAAc,CAAC,GAAGP,WAAW,CAAEK,aAAc,CAAC;EACtD,MAAM;IAAEG;EAAiB,CAAC,GAAGR,WAAW,CAAEG,sBAAuB,CAAC;EAElEJ,SAAS,CAAE,MAAM;IAChBS,gBAAgB,CAAE;MACjBC,IAAI,EAAE,kCAAkC;MACxCC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAEP,EAAE,CAAE,yBAA0B,CAAC;MAC5CQ,cAAc,EAAE;QACfC,QAAQ,EAAE,WAAW;QACrBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;EACJ,CAAC,EAAE,EAAG,CAAC;EAEPb,WAAW,CAAE,kCAAkC,EAAE,MAAM;IACtDM,aAAa,CAAE,gBAAiB,CAAC;EAClC,CAAE,CAAC;EAEH,OAAO,IAAI;AACZ;AAEA,eAAeD,iBAAiB","ignoreList":[]}
|