@wordpress/edit-post 7.24.1 → 7.26.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 +8 -0
- package/LICENSE.md +1 -1
- package/build/components/browser-url/index.js +3 -2
- package/build/components/browser-url/index.js.map +1 -1
- package/build/components/header/index.js +35 -33
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/mode-switcher/index.js +1 -1
- package/build/components/header/mode-switcher/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +2 -1
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +22 -18
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -20
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +45 -38
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js +3 -1
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/meta-boxes/meta-box-visibility.js +2 -6
- package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build/components/preferences-modal/index.js +87 -54
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/options/enable-feature.js +23 -23
- package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/options/enable-panel.js +3 -6
- package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
- package/build/components/sidebar/plugin-document-setting-panel/index.js +3 -3
- package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +2 -10
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +3 -5
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/settings-header/index.js +17 -43
- package/build/components/sidebar/settings-header/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +80 -26
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/components/start-page-options/index.js +3 -3
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/visual-editor/index.js +20 -257
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/welcome-guide/index.js +6 -3
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/editor.js +20 -30
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +3 -11
- package/build/editor.native.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +16 -12
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/use-post-history.js +79 -0
- package/build/hooks/use-post-history.js.map +1 -0
- package/build/index.js +24 -20
- package/build/index.js.map +1 -1
- package/build/index.native.js +7 -1
- package/build/index.native.js.map +1 -1
- package/build/plugins/welcome-guide-menu-item/index.js +2 -6
- package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
- package/build/store/actions.js +94 -112
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +1 -95
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +86 -48
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/browser-url/index.js +3 -2
- package/build-module/components/browser-url/index.js.map +1 -1
- package/build-module/components/header/index.js +37 -35
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/mode-switcher/index.js +1 -1
- package/build-module/components/header/mode-switcher/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +2 -1
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +23 -19
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -20
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +46 -38
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/index.native.js +4 -2
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/meta-boxes/meta-box-visibility.js +2 -6
- package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +87 -54
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-feature.js +22 -23
- package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-panel.js +3 -7
- package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js +3 -3
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +2 -10
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +4 -6
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/settings-header/index.js +20 -46
- package/build-module/components/sidebar/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +80 -27
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/components/start-page-options/index.js +3 -3
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +24 -261
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +6 -3
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/editor.js +20 -30
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +3 -11
- package/build-module/editor.native.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +16 -12
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/use-post-history.js +73 -0
- package/build-module/hooks/use-post-history.js.map +1 -0
- package/build-module/index.js +19 -12
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +7 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/plugins/welcome-guide-menu-item/index.js +2 -6
- package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
- package/build-module/store/actions.js +86 -105
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +1 -92
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +76 -38
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +65 -473
- package/build-style/style.css +65 -473
- package/package.json +32 -32
- package/src/components/browser-url/index.js +4 -2
- package/src/components/header/index.js +45 -46
- package/src/components/header/mode-switcher/index.js +2 -1
- package/src/components/header/more-menu/index.js +1 -0
- package/src/components/header/style.scss +63 -37
- package/src/components/header/writing-menu/index.js +24 -24
- package/src/components/keyboard-shortcut-help-modal/test/index.js +0 -15
- package/src/components/keyboard-shortcuts/index.js +1 -23
- package/src/components/layout/index.js +31 -39
- package/src/components/layout/index.native.js +9 -1
- package/src/components/meta-boxes/meta-box-visibility.js +2 -8
- package/src/components/preferences-modal/index.js +128 -97
- package/src/components/preferences-modal/options/enable-feature.js +26 -21
- package/src/components/preferences-modal/options/enable-panel.js +3 -7
- package/src/components/preferences-modal/test/__snapshots__/meta-boxes-section.js.snap +187 -175
- package/src/components/preferences-modal/test/index.js +1 -52
- package/src/components/sidebar/plugin-document-setting-panel/index.js +3 -3
- package/src/components/sidebar/plugin-sidebar/index.js +1 -9
- package/src/components/sidebar/post-status/index.js +5 -5
- package/src/components/sidebar/settings-header/index.js +19 -71
- package/src/components/sidebar/settings-sidebar/index.js +125 -60
- package/src/components/sidebar/style.scss +4 -12
- package/src/components/start-page-options/index.js +3 -3
- package/src/components/text-editor/style.scss +0 -6
- package/src/components/visual-editor/index.js +26 -359
- package/src/components/visual-editor/style.scss +0 -15
- package/src/components/welcome-guide/index.js +4 -2
- package/src/editor.js +36 -35
- package/src/editor.native.js +2 -23
- package/src/hooks/commands/use-common-commands.js +14 -16
- package/src/hooks/use-post-history.js +73 -0
- package/src/index.js +24 -13
- package/src/index.native.js +8 -1
- package/src/plugins/welcome-guide-menu-item/index.js +3 -6
- package/src/store/actions.js +80 -131
- package/src/store/reducer.js +0 -93
- package/src/store/selectors.js +97 -55
- package/src/store/test/actions.js +10 -131
- package/src/store/test/reducer.js +1 -108
- package/src/store/test/selectors.js +0 -50
- package/src/style.scss +1 -8
- package/src/test/__snapshots__/editor.native.js.snap +21 -0
- package/src/test/editor.native.js +107 -56
- package/build/components/device-preview/index.js +0 -72
- package/build/components/device-preview/index.js.map +0 -1
- package/build/components/header/document-actions/index.js +0 -82
- package/build/components/header/document-actions/index.js.map +0 -1
- package/build/components/header/header-toolbar/index.js +0 -156
- package/build/components/header/header-toolbar/index.js.map +0 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +0 -73
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
- package/build/components/secondary-sidebar/list-view-outline.js +0 -112
- package/build/components/secondary-sidebar/list-view-outline.js.map +0 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +0 -148
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
- package/build/components/sidebar/discussion-panel/index.js +0 -59
- package/build/components/sidebar/discussion-panel/index.js.map +0 -1
- package/build/components/sidebar/featured-image/index.js +0 -70
- package/build/components/sidebar/featured-image/index.js.map +0 -1
- package/build/components/sidebar/last-revision/index.js +0 -21
- package/build/components/sidebar/last-revision/index.js.map +0 -1
- package/build/components/sidebar/page-attributes/index.js +0 -65
- package/build/components/sidebar/page-attributes/index.js.map +0 -1
- package/build/components/sidebar/plugin-post-excerpt/index.js +0 -72
- package/build/components/sidebar/plugin-post-excerpt/index.js.map +0 -1
- package/build/components/sidebar/post-excerpt/index.js +0 -54
- package/build/components/sidebar/post-excerpt/index.js.map +0 -1
- package/build/components/sidebar/post-taxonomies/index.js +0 -30
- package/build/components/sidebar/post-taxonomies/index.js.map +0 -1
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -56
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +0 -1
- package/build/components/sidebar/post-template/create-modal.js +0 -99
- package/build/components/sidebar/post-template/create-modal.js.map +0 -1
- package/build/components/sidebar/post-template/form.js +0 -110
- package/build/components/sidebar/post-template/form.js.map +0 -1
- package/build/components/sidebar/post-template/index.js +0 -106
- package/build/components/sidebar/post-template/index.js.map +0 -1
- package/build/components/view-link/index.js +0 -53
- package/build/components/view-link/index.js.map +0 -1
- package/build-module/components/device-preview/index.js +0 -65
- package/build-module/components/device-preview/index.js.map +0 -1
- package/build-module/components/header/document-actions/index.js +0 -74
- package/build-module/components/header/document-actions/index.js.map +0 -1
- package/build-module/components/header/header-toolbar/index.js +0 -148
- package/build-module/components/header/header-toolbar/index.js.map +0 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +0 -66
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
- package/build-module/components/secondary-sidebar/list-view-outline.js +0 -105
- package/build-module/components/secondary-sidebar/list-view-outline.js.map +0 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +0 -140
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
- package/build-module/components/sidebar/discussion-panel/index.js +0 -52
- package/build-module/components/sidebar/discussion-panel/index.js.map +0 -1
- package/build-module/components/sidebar/featured-image/index.js +0 -63
- package/build-module/components/sidebar/featured-image/index.js.map +0 -1
- package/build-module/components/sidebar/last-revision/index.js +0 -13
- package/build-module/components/sidebar/last-revision/index.js.map +0 -1
- package/build-module/components/sidebar/page-attributes/index.js +0 -57
- package/build-module/components/sidebar/page-attributes/index.js.map +0 -1
- package/build-module/components/sidebar/plugin-post-excerpt/index.js +0 -64
- package/build-module/components/sidebar/plugin-post-excerpt/index.js.map +0 -1
- package/build-module/components/sidebar/post-excerpt/index.js +0 -47
- package/build-module/components/sidebar/post-excerpt/index.js.map +0 -1
- package/build-module/components/sidebar/post-taxonomies/index.js +0 -21
- package/build-module/components/sidebar/post-taxonomies/index.js.map +0 -1
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -48
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +0 -1
- package/build-module/components/sidebar/post-template/create-modal.js +0 -92
- package/build-module/components/sidebar/post-template/create-modal.js.map +0 -1
- package/build-module/components/sidebar/post-template/form.js +0 -102
- package/build-module/components/sidebar/post-template/form.js.map +0 -1
- package/build-module/components/sidebar/post-template/index.js +0 -98
- package/build-module/components/sidebar/post-template/index.js.map +0 -1
- package/build-module/components/view-link/index.js +0 -46
- package/build-module/components/view-link/index.js.map +0 -1
- package/src/components/device-preview/index.js +0 -73
- package/src/components/header/document-actions/index.js +0 -82
- package/src/components/header/document-actions/style.scss +0 -64
- package/src/components/header/header-toolbar/index.js +0 -182
- package/src/components/header/header-toolbar/style.scss +0 -114
- package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +0 -929
- package/src/components/secondary-sidebar/inserter-sidebar.js +0 -71
- package/src/components/secondary-sidebar/list-view-outline.js +0 -98
- package/src/components/secondary-sidebar/list-view-sidebar.js +0 -170
- package/src/components/secondary-sidebar/style.scss +0 -120
- package/src/components/sidebar/discussion-panel/index.js +0 -62
- package/src/components/sidebar/featured-image/index.js +0 -67
- package/src/components/sidebar/last-revision/index.js +0 -17
- package/src/components/sidebar/last-revision/style.scss +0 -10
- package/src/components/sidebar/page-attributes/index.js +0 -65
- package/src/components/sidebar/plugin-post-excerpt/index.js +0 -61
- package/src/components/sidebar/plugin-post-excerpt/test/index.js +0 -36
- package/src/components/sidebar/post-excerpt/index.js +0 -59
- package/src/components/sidebar/post-taxonomies/index.js +0 -30
- package/src/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -48
- package/src/components/sidebar/post-template/create-modal.js +0 -140
- package/src/components/sidebar/post-template/form.js +0 -141
- package/src/components/sidebar/post-template/index.js +0 -120
- package/src/components/sidebar/post-template/style.scss +0 -22
- package/src/components/sidebar/settings-header/style.scss +0 -74
- package/src/components/sidebar/template/style.scss +0 -35
- package/src/components/view-link/index.js +0 -48
|
@@ -7,8 +7,8 @@ import classnames from 'classnames';
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
11
|
-
import { PostSavedState, PostPreviewButton } from '@wordpress/editor';
|
|
10
|
+
import { BlockToolbar, store as blockEditorStore } from '@wordpress/block-editor';
|
|
11
|
+
import { PostSavedState, PostPreviewButton, store as editorStore, DocumentBar, privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
12
12
|
import { useEffect, useRef, useState } from '@wordpress/element';
|
|
13
13
|
import { useSelect } from '@wordpress/data';
|
|
14
14
|
import { __ } from '@wordpress/i18n';
|
|
@@ -22,18 +22,16 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
22
22
|
* Internal dependencies
|
|
23
23
|
*/
|
|
24
24
|
import FullscreenModeClose from './fullscreen-mode-close';
|
|
25
|
-
import HeaderToolbar from './header-toolbar';
|
|
26
25
|
import MoreMenu from './more-menu';
|
|
27
26
|
import PostPublishButtonOrToggle from './post-publish-button-or-toggle';
|
|
28
|
-
import { default as DevicePreview } from '../device-preview';
|
|
29
|
-
import ViewLink from '../view-link';
|
|
30
27
|
import MainDashboardButton from './main-dashboard-button';
|
|
31
28
|
import { store as editPostStore } from '../../store';
|
|
32
|
-
import DocumentActions from './document-actions';
|
|
33
29
|
import { unlock } from '../../lock-unlock';
|
|
34
30
|
const {
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
DocumentTools,
|
|
32
|
+
PostViewLink,
|
|
33
|
+
PreviewDropdown
|
|
34
|
+
} = unlock(editorPrivateApis);
|
|
37
35
|
const slideY = {
|
|
38
36
|
hidden: {
|
|
39
37
|
y: '-50px'
|
|
@@ -65,40 +63,45 @@ const slideX = {
|
|
|
65
63
|
}
|
|
66
64
|
};
|
|
67
65
|
function Header({
|
|
68
|
-
setEntitiesSavedStatesCallback
|
|
69
|
-
setListViewToggleElement
|
|
66
|
+
setEntitiesSavedStatesCallback
|
|
70
67
|
}) {
|
|
71
68
|
const isWideViewport = useViewportMatch('large');
|
|
72
69
|
const isLargeViewport = useViewportMatch('medium');
|
|
73
70
|
const blockToolbarRef = useRef();
|
|
74
71
|
const {
|
|
75
|
-
|
|
72
|
+
isTextEditor,
|
|
73
|
+
hasBlockSelection,
|
|
76
74
|
hasActiveMetaboxes,
|
|
77
75
|
hasFixedToolbar,
|
|
78
76
|
isEditingTemplate,
|
|
79
77
|
isPublishSidebarOpened,
|
|
80
|
-
showIconLabels
|
|
78
|
+
showIconLabels,
|
|
79
|
+
hasHistory
|
|
81
80
|
} = useSelect(select => {
|
|
82
81
|
const {
|
|
83
82
|
get: getPreference
|
|
84
83
|
} = select(preferencesStore);
|
|
84
|
+
const {
|
|
85
|
+
getEditorMode
|
|
86
|
+
} = select(editPostStore);
|
|
85
87
|
return {
|
|
86
|
-
|
|
88
|
+
isTextEditor: getEditorMode() === 'text',
|
|
89
|
+
hasBlockSelection: !!select(blockEditorStore).getBlockSelectionStart(),
|
|
87
90
|
hasActiveMetaboxes: select(editPostStore).hasMetaBoxes(),
|
|
88
|
-
|
|
91
|
+
hasHistory: !!select(editorStore).getEditorSettings().goBack,
|
|
92
|
+
isEditingTemplate: select(editorStore).getRenderingMode() === 'template-only',
|
|
89
93
|
isPublishSidebarOpened: select(editPostStore).isPublishSidebarOpened(),
|
|
90
|
-
hasFixedToolbar: getPreference('core
|
|
91
|
-
showIconLabels:
|
|
94
|
+
hasFixedToolbar: getPreference('core', 'fixedToolbar'),
|
|
95
|
+
showIconLabels: getPreference('core', 'showIconLabels')
|
|
92
96
|
};
|
|
93
97
|
}, []);
|
|
94
98
|
const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = useState(true);
|
|
95
|
-
const hasBlockSelected = !!blockSelectionStart;
|
|
96
99
|
useEffect(() => {
|
|
97
100
|
// If we have a new block selection, show the block tools
|
|
98
|
-
if (
|
|
101
|
+
if (hasBlockSelection) {
|
|
99
102
|
setIsBlockToolsCollapsed(false);
|
|
100
103
|
}
|
|
101
|
-
}, [
|
|
104
|
+
}, [hasBlockSelection]);
|
|
102
105
|
return createElement("div", {
|
|
103
106
|
className: "edit-post-header"
|
|
104
107
|
}, createElement(MainDashboardButton.Slot, null, createElement(motion.div, {
|
|
@@ -116,19 +119,18 @@ function Header({
|
|
|
116
119
|
delay: 0.8
|
|
117
120
|
},
|
|
118
121
|
className: "edit-post-header__toolbar"
|
|
119
|
-
}, createElement(
|
|
120
|
-
|
|
121
|
-
setListViewToggleElement: setListViewToggleElement
|
|
122
|
+
}, createElement(DocumentTools, {
|
|
123
|
+
disableBlockTools: isTextEditor
|
|
122
124
|
}), hasFixedToolbar && isLargeViewport && createElement(Fragment, null, createElement("div", {
|
|
123
125
|
className: classnames('selected-block-tools-wrapper', {
|
|
124
|
-
'is-collapsed': isBlockToolsCollapsed
|
|
126
|
+
'is-collapsed': isEditingTemplate && isBlockToolsCollapsed
|
|
125
127
|
})
|
|
126
|
-
}, createElement(
|
|
127
|
-
|
|
128
|
+
}, createElement(BlockToolbar, {
|
|
129
|
+
hideDragHandle: true
|
|
128
130
|
})), createElement(Popover.Slot, {
|
|
129
131
|
ref: blockToolbarRef,
|
|
130
132
|
name: "block-toolbar"
|
|
131
|
-
}), isEditingTemplate &&
|
|
133
|
+
}), isEditingTemplate && hasBlockSelection && createElement(Button, {
|
|
132
134
|
className: "edit-post-header__block-tools-toggle",
|
|
133
135
|
icon: isBlockToolsCollapsed ? next : previous,
|
|
134
136
|
onClick: () => {
|
|
@@ -137,9 +139,9 @@ function Header({
|
|
|
137
139
|
label: isBlockToolsCollapsed ? __('Show block tools') : __('Hide block tools')
|
|
138
140
|
})), createElement("div", {
|
|
139
141
|
className: classnames('edit-post-header__center', {
|
|
140
|
-
'is-collapsed': !isBlockToolsCollapsed &&
|
|
142
|
+
'is-collapsed': isEditingTemplate && hasBlockSelection && !isBlockToolsCollapsed && hasFixedToolbar && isLargeViewport
|
|
141
143
|
})
|
|
142
|
-
}, isEditingTemplate && createElement(
|
|
144
|
+
}, (isEditingTemplate || hasHistory) && createElement(DocumentBar, null))), createElement(motion.div, {
|
|
143
145
|
variants: slideY,
|
|
144
146
|
transition: {
|
|
145
147
|
type: 'tween',
|
|
@@ -153,19 +155,19 @@ function Header({
|
|
|
153
155
|
// We track that DOM node to return focus to the PostPublishButtonOrToggle
|
|
154
156
|
// when the publish sidebar has been closed.
|
|
155
157
|
createElement(PostSavedState, {
|
|
156
|
-
forceIsDirty: hasActiveMetaboxes
|
|
157
|
-
|
|
158
|
-
}), createElement(DevicePreview, null), createElement(PostPreviewButton, {
|
|
158
|
+
forceIsDirty: hasActiveMetaboxes
|
|
159
|
+
}), createElement(PreviewDropdown, {
|
|
159
160
|
forceIsAutosaveable: hasActiveMetaboxes
|
|
160
|
-
}), createElement(
|
|
161
|
+
}), createElement(PostPreviewButton, {
|
|
162
|
+
className: "edit-post-header__post-preview-button",
|
|
163
|
+
forceIsAutosaveable: hasActiveMetaboxes
|
|
164
|
+
}), createElement(PostViewLink, null), createElement(PostPublishButtonOrToggle, {
|
|
161
165
|
forceIsDirty: hasActiveMetaboxes,
|
|
162
166
|
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
|
|
163
|
-
}), (isWideViewport || !showIconLabels) && createElement(
|
|
167
|
+
}), (isWideViewport || !showIconLabels) && createElement(PinnedItems.Slot, {
|
|
164
168
|
scope: "core/edit-post"
|
|
165
169
|
}), createElement(MoreMenu, {
|
|
166
170
|
showIconLabels: showIconLabels
|
|
167
|
-
})), showIconLabels && !isWideViewport && createElement(MoreMenu, {
|
|
168
|
-
showIconLabels: showIconLabels
|
|
169
171
|
})));
|
|
170
172
|
}
|
|
171
173
|
export default Header;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","privateApis","blockEditorPrivateApis","store","blockEditorStore","PostSavedState","PostPreviewButton","useEffect","useRef","useState","useSelect","__","next","previous","PinnedItems","useViewportMatch","Button","__unstableMotion","motion","Popover","preferencesStore","FullscreenModeClose","HeaderToolbar","MoreMenu","PostPublishButtonOrToggle","default","DevicePreview","ViewLink","MainDashboardButton","editPostStore","DocumentActions","unlock","BlockContextualToolbar","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","setListViewToggleElement","isWideViewport","isLargeViewport","blockToolbarRef","blockSelectionStart","hasActiveMetaboxes","hasFixedToolbar","isEditingTemplate","isPublishSidebarOpened","showIconLabels","select","get","getPreference","getBlockSelectionStart","hasMetaBoxes","isFeatureActive","isBlockToolsCollapsed","setIsBlockToolsCollapsed","hasBlockSelected","createElement","className","Slot","div","variants","showTooltip","Fragment","isFixed","ref","name","icon","onClick","collapsed","label","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\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { PostSavedState, PostPreviewButton } 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 HeaderToolbar from './header-toolbar';\nimport MoreMenu from './more-menu';\nimport PostPublishButtonOrToggle from './post-publish-button-or-toggle';\nimport { default as DevicePreview } from '../device-preview';\nimport ViewLink from '../view-link';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport DocumentActions from './document-actions';\nimport { unlock } from '../../lock-unlock';\n\nconst { BlockContextualToolbar } = unlock( blockEditorPrivateApis );\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( {\n\tsetEntitiesSavedStatesCallback,\n\tsetListViewToggleElement,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst blockToolbarRef = useRef();\n\tconst {\n\t\tblockSelectionStart,\n\t\thasActiveMetaboxes,\n\t\thasFixedToolbar,\n\t\tisEditingTemplate,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\n\t\treturn {\n\t\t\tblockSelectionStart:\n\t\t\t\tselect( blockEditorStore ).getBlockSelectionStart(),\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tisEditingTemplate: select( editPostStore ).isEditingTemplate(),\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editPostStore ).isPublishSidebarOpened(),\n\t\t\thasFixedToolbar: getPreference( 'core/edit-post', 'fixedToolbar' ),\n\t\t\tshowIconLabels:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasBlockSelected = !! 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 showTooltip />\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<HeaderToolbar\n\t\t\t\t\thasFixedToolbar={ hasFixedToolbar }\n\t\t\t\t\tsetListViewToggleElement={ setListViewToggleElement }\n\t\t\t\t/>\n\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\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': isBlockToolsCollapsed,\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<BlockContextualToolbar isFixed />\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{ isEditingTemplate && hasBlockSelected && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"edit-post-header__block-tools-toggle\"\n\t\t\t\t\t\t\t\ticon={ isBlockToolsCollapsed ? next : previous }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsBlockToolsCollapsed(\n\t\t\t\t\t\t\t\t\t\t( collapsed ) => ! collapsed\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\tlabel={\n\t\t\t\t\t\t\t\t\tisBlockToolsCollapsed\n\t\t\t\t\t\t\t\t\t\t? __( 'Show block tools' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Hide block tools' )\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) }\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\t! isBlockToolsCollapsed &&\n\t\t\t\t\t\t\tisLargeViewport &&\n\t\t\t\t\t\t\tisEditingTemplate,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ isEditingTemplate && <DocumentActions /> }\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\n\t\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\t\tshowIconLabels={ showIconLabels }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<DevicePreview />\n\t\t\t\t<PostPreviewButton forceIsAutosaveable={ hasActiveMetaboxes } />\n\t\t\t\t<ViewLink />\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<>\n\t\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-post\" />\n\t\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ showIconLabels && ! isWideViewport && (\n\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t) }\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,IAAIC,sBAAsB,EACrCC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,cAAc,EAAEC,iBAAiB,QAAQ,mBAAmB;AACrE,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,oBAAoB;AAChE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,QAAQ,QAAQ,kBAAkB;AACjD,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SACCC,MAAM,EACNC,gBAAgB,IAAIC,MAAM,EAC1BC,OAAO,QACD,uBAAuB;AAC9B,SAAShB,KAAK,IAAIiB,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,QAAQ,MAAM,aAAa;AAClC,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,OAAO,IAAIC,aAAa,QAAQ,mBAAmB;AAC5D,OAAOC,QAAQ,MAAM,cAAc;AACnC,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,SAASzB,KAAK,IAAI0B,aAAa,QAAQ,aAAa;AACpD,OAAOC,eAAe,MAAM,oBAAoB;AAChD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAuB,CAAC,GAAGD,MAAM,CAAE7B,sBAAuB,CAAC;AAEnE,MAAM+B,MAAM,GAAG;EACdC,MAAM,EA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N,8BAA8B,EAC7BA;EACA,CACD,CAAC,EACA,CAAEE,cAAc,IAAI,CAAEQ,cAAc,KACrCU,aAAA,CAAAM,QAAA,QACCN,aAAA,CAAClD,WAAW,CAACoD,IAAI;IAACc,KAAK,EAAC;EAAgB,CAAE,CAAC,EAC3ChB,aAAA,CAACzC,QAAQ;IAAC+B,cAAc,EAAGA;EAAgB,CAAE,CAC5C,CACF,EACCA,cAAc,IAAI,CAAER,cAAc,IACnCkB,aAAA,CAACzC,QAAQ;IAAC+B,cAAc,EAAGA;EAAgB,CAAE,CAEnC,CACR,CAAC;AAER;AAEA,eAAeX,MAAM"}
|
|
1
|
+
{"version":3,"names":["classnames","BlockToolbar","store","blockEditorStore","PostSavedState","PostPreviewButton","editorStore","DocumentBar","privateApis","editorPrivateApis","useEffect","useRef","useState","useSelect","__","next","previous","PinnedItems","useViewportMatch","Button","__unstableMotion","motion","Popover","preferencesStore","FullscreenModeClose","MoreMenu","PostPublishButtonOrToggle","MainDashboardButton","editPostStore","unlock","DocumentTools","PostViewLink","PreviewDropdown","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","isWideViewport","isLargeViewport","blockToolbarRef","isTextEditor","hasBlockSelection","hasActiveMetaboxes","hasFixedToolbar","isEditingTemplate","isPublishSidebarOpened","showIconLabels","hasHistory","select","get","getPreference","getEditorMode","getBlockSelectionStart","hasMetaBoxes","getEditorSettings","goBack","getRenderingMode","isBlockToolsCollapsed","setIsBlockToolsCollapsed","createElement","className","Slot","div","variants","showTooltip","disableBlockTools","Fragment","hideDragHandle","ref","name","icon","onClick","collapsed","label","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\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 { 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 } ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst blockToolbarRef = useRef();\n\tconst {\n\t\tisTextEditor,\n\t\thasBlockSelection,\n\t\thasActiveMetaboxes,\n\t\thasFixedToolbar,\n\t\tisEditingTemplate,\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( editPostStore );\n\n\t\treturn {\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\thasHistory: !! select( editorStore ).getEditorSettings().goBack,\n\t\t\tisEditingTemplate:\n\t\t\t\tselect( editorStore ).getRenderingMode() === 'template-only',\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editPostStore ).isPublishSidebarOpened(),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tuseEffect( () => {\n\t\t// If we have a new block selection, show the block tools\n\t\tif ( hasBlockSelection ) {\n\t\t\tsetIsBlockToolsCollapsed( false );\n\t\t}\n\t}, [ hasBlockSelection ] );\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 showTooltip />\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{ hasFixedToolbar && isLargeViewport && (\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\tisEditingTemplate &&\n\t\t\t\t\t\t\t\t\t\tisBlockToolsCollapsed,\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{ isEditingTemplate && hasBlockSelection && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"edit-post-header__block-tools-toggle\"\n\t\t\t\t\t\t\t\ticon={ isBlockToolsCollapsed ? next : previous }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsBlockToolsCollapsed(\n\t\t\t\t\t\t\t\t\t\t( collapsed ) => ! collapsed\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\tlabel={\n\t\t\t\t\t\t\t\t\tisBlockToolsCollapsed\n\t\t\t\t\t\t\t\t\t\t? __( 'Show block tools' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Hide block tools' )\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) }\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\tisEditingTemplate &&\n\t\t\t\t\t\t\thasBlockSelection &&\n\t\t\t\t\t\t\t! isBlockToolsCollapsed &&\n\t\t\t\t\t\t\thasFixedToolbar &&\n\t\t\t\t\t\t\tisLargeViewport,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ ( isEditingTemplate || 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={ showIconLabels } />\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,YAAY,EACZC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SACCC,cAAc,EACdC,iBAAiB,EACjBH,KAAK,IAAII,WAAW,EACpBC,WAAW,EACXC,WAAW,IAAIC,iBAAiB,QAC1B,mBAAmB;AAC1B,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,oBAAoB;AAChE,SAASC,SAAS,QAAQ,iBAAiB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Store).getShortcutRepresentation('core/edit-post/toggle-mode'),
|
|
37
37
|
isRichEditingEnabled: select(editorStore).getEditorSettings().richEditingEnabled,
|
|
38
38
|
isCodeEditingEnabled: select(editorStore).getEditorSettings().codeEditingEnabled,
|
|
39
|
-
isEditingTemplate: select(
|
|
39
|
+
isEditingTemplate: select(editorStore).getRenderingMode() === 'template-only',
|
|
40
40
|
mode: select(editPostStore).getEditorMode()
|
|
41
41
|
}), []);
|
|
42
42
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","MenuItemsChoice","MenuGroup","useSelect","useDispatch","store","keyboardShortcutsStore","editorStore","editPostStore","MODES","value","label","ModeSwitcher","shortcut","isRichEditingEnabled","isCodeEditingEnabled","isEditingTemplate","mode","select","getShortcutRepresentation","getEditorSettings","richEditingEnabled","codeEditingEnabled","getEditorMode","switchEditorMode","selectedMode","choices","map","choice","disabled","info","createElement","onSelect"],"sources":["@wordpress/edit-post/src/components/header/mode-switcher/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItemsChoice, MenuGroup } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\n/**\n * Set of available mode options.\n *\n * @type {Array}\n */\nconst MODES = [\n\t{\n\t\tvalue: 'visual',\n\t\tlabel: __( 'Visual editor' ),\n\t},\n\t{\n\t\tvalue: 'text',\n\t\tlabel: __( 'Code editor' ),\n\t},\n];\n\nfunction ModeSwitcher() {\n\tconst {\n\t\tshortcut,\n\t\tisRichEditingEnabled,\n\t\tisCodeEditingEnabled,\n\t\tisEditingTemplate,\n\t\tmode,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/edit-post/toggle-mode' ),\n\t\t\tisRichEditingEnabled:\n\t\t\t\tselect( editorStore ).getEditorSettings().richEditingEnabled,\n\t\t\tisCodeEditingEnabled:\n\t\t\t\tselect( editorStore ).getEditorSettings().codeEditingEnabled,\n\t\t\tisEditingTemplate
|
|
1
|
+
{"version":3,"names":["__","MenuItemsChoice","MenuGroup","useSelect","useDispatch","store","keyboardShortcutsStore","editorStore","editPostStore","MODES","value","label","ModeSwitcher","shortcut","isRichEditingEnabled","isCodeEditingEnabled","isEditingTemplate","mode","select","getShortcutRepresentation","getEditorSettings","richEditingEnabled","codeEditingEnabled","getRenderingMode","getEditorMode","switchEditorMode","selectedMode","choices","map","choice","disabled","info","createElement","onSelect"],"sources":["@wordpress/edit-post/src/components/header/mode-switcher/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItemsChoice, MenuGroup } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\n/**\n * Set of available mode options.\n *\n * @type {Array}\n */\nconst MODES = [\n\t{\n\t\tvalue: 'visual',\n\t\tlabel: __( 'Visual editor' ),\n\t},\n\t{\n\t\tvalue: 'text',\n\t\tlabel: __( 'Code editor' ),\n\t},\n];\n\nfunction ModeSwitcher() {\n\tconst {\n\t\tshortcut,\n\t\tisRichEditingEnabled,\n\t\tisCodeEditingEnabled,\n\t\tisEditingTemplate,\n\t\tmode,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/edit-post/toggle-mode' ),\n\t\t\tisRichEditingEnabled:\n\t\t\t\tselect( editorStore ).getEditorSettings().richEditingEnabled,\n\t\t\tisCodeEditingEnabled:\n\t\t\t\tselect( editorStore ).getEditorSettings().codeEditingEnabled,\n\t\t\tisEditingTemplate:\n\t\t\t\tselect( editorStore ).getRenderingMode() === 'template-only',\n\t\t\tmode: select( editPostStore ).getEditorMode(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { switchEditorMode } = useDispatch( editPostStore );\n\n\tif ( isEditingTemplate ) {\n\t\treturn null;\n\t}\n\n\tlet selectedMode = mode;\n\tif ( ! isRichEditingEnabled && mode === 'visual' ) {\n\t\tselectedMode = 'text';\n\t}\n\tif ( ! isCodeEditingEnabled && mode === 'text' ) {\n\t\tselectedMode = 'visual';\n\t}\n\n\tconst choices = MODES.map( ( choice ) => {\n\t\tif ( ! isCodeEditingEnabled && choice.value === 'text' ) {\n\t\t\tchoice = {\n\t\t\t\t...choice,\n\t\t\t\tdisabled: true,\n\t\t\t};\n\t\t}\n\t\tif ( ! isRichEditingEnabled && choice.value === 'visual' ) {\n\t\t\tchoice = {\n\t\t\t\t...choice,\n\t\t\t\tdisabled: true,\n\t\t\t\tinfo: __(\n\t\t\t\t\t'You can enable the visual editor in your profile settings.'\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t\tif ( choice.value !== selectedMode && ! choice.disabled ) {\n\t\t\treturn { ...choice, shortcut };\n\t\t}\n\t\treturn choice;\n\t} );\n\n\treturn (\n\t\t<MenuGroup label={ __( 'Editor' ) }>\n\t\t\t<MenuItemsChoice\n\t\t\t\tchoices={ choices }\n\t\t\t\tvalue={ selectedMode }\n\t\t\t\tonSelect={ switchEditorMode }\n\t\t\t/>\n\t\t</MenuGroup>\n\t);\n}\n\nexport default ModeSwitcher;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,EAAEC,SAAS,QAAQ,uBAAuB;AAClE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,sBAAsB,QAAQ,+BAA+B;AAC/E,SAASD,KAAK,IAAIE,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EACxB;EAEA,MAAMC,OAAO,GAAGlB,KAAK,CAACmB,GAAG,CAAIC,MAAM,IAAM;IACxC,IAAK,CAAEd,oBAAoB,IAAIc,MAAM,CAACnB,KAAK,KAAK,MAAM,EAAG;MACxDmB,MAAM,GAAG;QACR,GAAGA,MAAM;QACTC,QAAQ,EAAE;MACX,CAAC;IACF;IACA,IAAK,CAAEhB,oBAAoB,IAAIe,MAAM,CAACnB,KAAK,KAAK,QAAQ,EAAG;MAC1DmB,MAAM,GAAG;QACR,GAAGA,MAAM;QACTC,QAAQ,EAAE,IAAI;QACdC,IAAI,EAAE/B,EAAE,CACP,4DACD;MACD,CAAC;IACF;IACA,IAAK6B,MAAM,CAACnB,KAAK,KAAKgB,YAAY,IAAI,CAAEG,MAAM,CAACC,QAAQ,EAAG;MACzD,OAAO;QAAE,GAAGD,MAAM;QAAEhB;MAAS,CAAC;IAC/B;IACA,OAAOgB,MAAM;EACd,CAAE,CAAC;EAEH,OACCG,aAAA,CAAC9B,SAAS;IAACS,KAAK,EAAGX,EAAE,CAAE,QAAS;EAAG,GAClCgC,aAAA,CAAC/B,eAAe;IACf0B,OAAO,EAAGA,OAAS;IACnBjB,KAAK,EAAGgB,YAAc;IACtBO,QAAQ,EAAGR;EAAkB,CAC7B,CACS,CAAC;AAEd;AAEA,eAAeb,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","MenuGroup","ActionItem","MoreMenuDropdown","PinnedItems","useViewportMatch","ModeSwitcher","PreferencesMenuItem","ToolsMoreMenuGroup","WritingMenu","MoreMenu","showIconLabels","isLargeViewport","createElement","toggleProps","showTooltip","variant","onClose","Fragment","Slot","className","scope","name","label","as","fillProps","onClick"],"sources":["@wordpress/edit-post/src/components/header/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuGroup } from '@wordpress/components';\nimport {\n\tActionItem,\n\tMoreMenuDropdown,\n\tPinnedItems,\n} from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport ModeSwitcher from '../mode-switcher';\nimport PreferencesMenuItem from '../preferences-menu-item';\nimport ToolsMoreMenuGroup from '../tools-more-menu-group';\nimport WritingMenu from '../writing-menu';\n\nconst MoreMenu = ( { showIconLabels } ) => {\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\n\treturn (\n\t\t<MoreMenuDropdown\n\t\t\ttoggleProps={ {\n\t\t\t\tshowTooltip: ! showIconLabels,\n\t\t\t\t...( showIconLabels && { variant: 'tertiary' } ),\n\t\t\t} }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t{ showIconLabels && ! isLargeViewport && (\n\t\t\t\t\t\t<PinnedItems.Slot\n\t\t\t\t\t\t\tclassName={ showIconLabels && 'show-icon-labels' }\n\t\t\t\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<WritingMenu />\n\t\t\t\t\t<ModeSwitcher />\n\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/edit-post/plugin-more-menu\"\n\t\t\t\t\t\tlabel={ __( 'Plugins' ) }\n\t\t\t\t\t\tas={ MenuGroup }\n\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsMoreMenuGroup.Slot fillProps={ { onClose } } />\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<PreferencesMenuItem />\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</MoreMenuDropdown>\n\t);\n};\n\nexport default MoreMenu;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SACCC,UAAU,EACVC,gBAAgB,EAChBC,WAAW,QACL,sBAAsB;AAC7B,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,kBAAkB,MAAM,0BAA0B;AACzD,OAAOC,WAAW,MAAM,iBAAiB;AAEzC,MAAMC,QAAQ,GAAGA,CAAE;EAAEC;AAAe,CAAC,KAAM;EAC1C,MAAMC,eAAe,GAAGP,gBAAgB,CAAE,OAAQ,CAAC;EAEnD,OACCQ,aAAA,CAACV,gBAAgB;IAChBW,WAAW,EAAG;MACbC,WAAW,EAAE,CAAEJ,cAAc;MAC7B,IAAKA,cAAc,IAAI;QAAEK,OAAO,EAAE;MAAW,CAAC;
|
|
1
|
+
{"version":3,"names":["__","MenuGroup","ActionItem","MoreMenuDropdown","PinnedItems","useViewportMatch","ModeSwitcher","PreferencesMenuItem","ToolsMoreMenuGroup","WritingMenu","MoreMenu","showIconLabels","isLargeViewport","createElement","toggleProps","showTooltip","variant","size","onClose","Fragment","Slot","className","scope","name","label","as","fillProps","onClick"],"sources":["@wordpress/edit-post/src/components/header/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuGroup } from '@wordpress/components';\nimport {\n\tActionItem,\n\tMoreMenuDropdown,\n\tPinnedItems,\n} from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport ModeSwitcher from '../mode-switcher';\nimport PreferencesMenuItem from '../preferences-menu-item';\nimport ToolsMoreMenuGroup from '../tools-more-menu-group';\nimport WritingMenu from '../writing-menu';\n\nconst MoreMenu = ( { showIconLabels } ) => {\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\n\treturn (\n\t\t<MoreMenuDropdown\n\t\t\ttoggleProps={ {\n\t\t\t\tshowTooltip: ! showIconLabels,\n\t\t\t\t...( showIconLabels && { variant: 'tertiary' } ),\n\t\t\t\tsize: 'compact',\n\t\t\t} }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t{ showIconLabels && ! isLargeViewport && (\n\t\t\t\t\t\t<PinnedItems.Slot\n\t\t\t\t\t\t\tclassName={ showIconLabels && 'show-icon-labels' }\n\t\t\t\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<WritingMenu />\n\t\t\t\t\t<ModeSwitcher />\n\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/edit-post/plugin-more-menu\"\n\t\t\t\t\t\tlabel={ __( 'Plugins' ) }\n\t\t\t\t\t\tas={ MenuGroup }\n\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsMoreMenuGroup.Slot fillProps={ { onClose } } />\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<PreferencesMenuItem />\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</MoreMenuDropdown>\n\t);\n};\n\nexport default MoreMenu;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SACCC,UAAU,EACVC,gBAAgB,EAChBC,WAAW,QACL,sBAAsB;AAC7B,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,kBAAkB,MAAM,0BAA0B;AACzD,OAAOC,WAAW,MAAM,iBAAiB;AAEzC,MAAMC,QAAQ,GAAGA,CAAE;EAAEC;AAAe,CAAC,KAAM;EAC1C,MAAMC,eAAe,GAAGP,gBAAgB,CAAE,OAAQ,CAAC;EAEnD,OACCQ,aAAA,CAACV,gBAAgB;IAChBW,WAAW,EAAG;MACbC,WAAW,EAAE,CAAEJ,cAAc;MAC7B,IAAKA,cAAc,IAAI;QAAEK,OAAO,EAAE;MAAW,CAAC,CAAE;MAChDC,IAAI,EAAE;IACP;EAAG,GAED,CAAE;IAAEC;EAAQ,CAAC,KACdL,aAAA,CAAAM,QAAA,QACGR,cAAc,IAAI,CAAEC,eAAe,IACpCC,aAAA,CAACT,WAAW,CAACgB,IAAI;IAChBC,SAAS,EAAGV,cAAc,IAAI,kBAAoB;IAClDW,KAAK,EAAC;EAAgB,CACtB,CACD,EACDT,aAAA,CAACJ,WAAW,MAAE,CAAC,EACfI,aAAA,CAACP,YAAY,MAAE,CAAC,EAChBO,aAAA,CAACX,UAAU,CAACkB,IAAI;IACfG,IAAI,EAAC,iCAAiC;IACtCC,KAAK,EAAGxB,EAAE,CAAE,SAAU,CAAG;IACzByB,EAAE,EAAGxB,SAAW;IAChByB,SAAS,EAAG;MAAEC,OAAO,EAAET;IAAQ;EAAG,CAClC,CAAC,EACFL,aAAA,CAACL,kBAAkB,CAACY,IAAI;IAACM,SAAS,EAAG;MAAER;IAAQ;EAAG,CAAE,CAAC,EACrDL,aAAA,CAACZ,SAAS,QACTY,aAAA,CAACN,mBAAmB,MAAE,CACZ,CACV,CAEc,CAAC;AAErB,CAAC;AAED,eAAeG,QAAQ"}
|
|
@@ -2,13 +2,13 @@ import { createElement } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { useDispatch, useRegistry } from '@wordpress/data';
|
|
6
6
|
import { MenuGroup } from '@wordpress/components';
|
|
7
7
|
import { __, _x } from '@wordpress/i18n';
|
|
8
8
|
import { useViewportMatch } from '@wordpress/compose';
|
|
9
9
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
10
10
|
import { PreferenceToggleMenuItem, store as preferencesStore } from '@wordpress/preferences';
|
|
11
|
-
import { store as
|
|
11
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
@@ -16,23 +16,27 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
|
16
16
|
import { store as postEditorStore } from '../../../store';
|
|
17
17
|
function WritingMenu() {
|
|
18
18
|
const registry = useRegistry();
|
|
19
|
-
const isDistractionFree = useSelect(select => select(blockEditorStore).getSettings().isDistractionFree, []);
|
|
20
19
|
const {
|
|
21
|
-
setIsInserterOpened,
|
|
22
|
-
setIsListViewOpened,
|
|
23
20
|
closeGeneralSidebar
|
|
24
21
|
} = useDispatch(postEditorStore);
|
|
25
22
|
const {
|
|
26
23
|
set: setPreference
|
|
27
24
|
} = useDispatch(preferencesStore);
|
|
25
|
+
const {
|
|
26
|
+
setIsInserterOpened,
|
|
27
|
+
setIsListViewOpened
|
|
28
|
+
} = useDispatch(editorStore);
|
|
28
29
|
const toggleDistractionFree = () => {
|
|
29
30
|
registry.batch(() => {
|
|
30
|
-
setPreference('core
|
|
31
|
+
setPreference('core', 'fixedToolbar', true);
|
|
31
32
|
setIsInserterOpened(false);
|
|
32
33
|
setIsListViewOpened(false);
|
|
33
34
|
closeGeneralSidebar();
|
|
34
35
|
});
|
|
35
36
|
};
|
|
37
|
+
const turnOffDistractionFree = () => {
|
|
38
|
+
setPreference('core', 'distractionFree', false);
|
|
39
|
+
};
|
|
36
40
|
const isLargeViewport = useViewportMatch('medium');
|
|
37
41
|
if (!isLargeViewport) {
|
|
38
42
|
return null;
|
|
@@ -40,15 +44,24 @@ function WritingMenu() {
|
|
|
40
44
|
return createElement(MenuGroup, {
|
|
41
45
|
label: _x('View', 'noun')
|
|
42
46
|
}, createElement(PreferenceToggleMenuItem, {
|
|
43
|
-
scope: "core
|
|
44
|
-
disabled: isDistractionFree,
|
|
47
|
+
scope: "core",
|
|
45
48
|
name: "fixedToolbar",
|
|
49
|
+
onToggle: turnOffDistractionFree,
|
|
46
50
|
label: __('Top toolbar'),
|
|
47
51
|
info: __('Access all block and document tools in a single place'),
|
|
48
52
|
messageActivated: __('Top toolbar activated'),
|
|
49
53
|
messageDeactivated: __('Top toolbar deactivated')
|
|
50
54
|
}), createElement(PreferenceToggleMenuItem, {
|
|
51
|
-
scope: "core
|
|
55
|
+
scope: "core",
|
|
56
|
+
name: "distractionFree",
|
|
57
|
+
onToggle: toggleDistractionFree,
|
|
58
|
+
label: __('Distraction free'),
|
|
59
|
+
info: __('Write with calmness'),
|
|
60
|
+
messageActivated: __('Distraction free mode activated'),
|
|
61
|
+
messageDeactivated: __('Distraction free mode deactivated'),
|
|
62
|
+
shortcut: displayShortcut.primaryShift('\\')
|
|
63
|
+
}), createElement(PreferenceToggleMenuItem, {
|
|
64
|
+
scope: "core",
|
|
52
65
|
name: "focusMode",
|
|
53
66
|
label: __('Spotlight mode'),
|
|
54
67
|
info: __('Focus on one block at a time'),
|
|
@@ -58,19 +71,10 @@ function WritingMenu() {
|
|
|
58
71
|
scope: "core/edit-post",
|
|
59
72
|
name: "fullscreenMode",
|
|
60
73
|
label: __('Fullscreen mode'),
|
|
61
|
-
info: __('Show and hide admin
|
|
74
|
+
info: __('Show and hide the admin user interface'),
|
|
62
75
|
messageActivated: __('Fullscreen mode activated'),
|
|
63
76
|
messageDeactivated: __('Fullscreen mode deactivated'),
|
|
64
77
|
shortcut: displayShortcut.secondary('f')
|
|
65
|
-
}), createElement(PreferenceToggleMenuItem, {
|
|
66
|
-
scope: "core/edit-post",
|
|
67
|
-
name: "distractionFree",
|
|
68
|
-
onToggle: toggleDistractionFree,
|
|
69
|
-
label: __('Distraction free'),
|
|
70
|
-
info: __('Write with calmness'),
|
|
71
|
-
messageActivated: __('Distraction free mode activated'),
|
|
72
|
-
messageDeactivated: __('Distraction free mode deactivated'),
|
|
73
|
-
shortcut: displayShortcut.primaryShift('\\')
|
|
74
78
|
}));
|
|
75
79
|
}
|
|
76
80
|
export default WritingMenu;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useDispatch","useRegistry","MenuGroup","__","_x","useViewportMatch","displayShortcut","PreferenceToggleMenuItem","store","preferencesStore","editorStore","postEditorStore","WritingMenu","registry","closeGeneralSidebar","set","setPreference","setIsInserterOpened","setIsListViewOpened","toggleDistractionFree","batch","turnOffDistractionFree","isLargeViewport","createElement","label","scope","name","onToggle","info","messageActivated","messageDeactivated","shortcut","primaryShift","secondary"],"sources":["@wordpress/edit-post/src/components/header/writing-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useRegistry } from '@wordpress/data';\nimport { MenuGroup } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as postEditorStore } from '../../../store';\n\nfunction WritingMenu() {\n\tconst registry = useRegistry();\n\n\tconst { closeGeneralSidebar } = useDispatch( postEditorStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editorStore );\n\n\tconst toggleDistractionFree = () => {\n\t\tregistry.batch( () => {\n\t\t\tsetPreference( 'core', 'fixedToolbar', true );\n\t\t\tsetIsInserterOpened( false );\n\t\t\tsetIsListViewOpened( false );\n\t\t\tcloseGeneralSidebar();\n\t\t} );\n\t};\n\n\tconst turnOffDistractionFree = () => {\n\t\tsetPreference( 'core', 'distractionFree', false );\n\t};\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tif ( ! isLargeViewport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core\"\n\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\tonToggle={ turnOffDistractionFree }\n\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\tinfo={ __(\n\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t) }\n\t\t\t\tmessageActivated={ __( 'Top toolbar activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Top toolbar deactivated' ) }\n\t\t\t/>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core\"\n\t\t\t\tname=\"distractionFree\"\n\t\t\t\tonToggle={ toggleDistractionFree }\n\t\t\t\tlabel={ __( 'Distraction free' ) }\n\t\t\t\tinfo={ __( 'Write with calmness' ) }\n\t\t\t\tmessageActivated={ __( 'Distraction free mode activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Distraction free mode deactivated' ) }\n\t\t\t\tshortcut={ displayShortcut.primaryShift( '\\\\' ) }\n\t\t\t/>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core\"\n\t\t\t\tname=\"focusMode\"\n\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\tinfo={ __( 'Focus on one block at a time' ) }\n\t\t\t\tmessageActivated={ __( 'Spotlight mode activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Spotlight mode deactivated' ) }\n\t\t\t/>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tname=\"fullscreenMode\"\n\t\t\t\tlabel={ __( 'Fullscreen mode' ) }\n\t\t\t\tinfo={ __( 'Show and hide the admin user interface' ) }\n\t\t\t\tmessageActivated={ __( 'Fullscreen mode activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Fullscreen mode deactivated' ) }\n\t\t\t\tshortcut={ displayShortcut.secondary( 'f' ) }\n\t\t\t/>\n\t\t</MenuGroup>\n\t);\n}\n\nexport default WritingMenu;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC1D,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACx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GAAI;EAAG,CAC7C,CACS,CAAC;AAEd;AAEA,eAAerB,WAAW"}
|
|
@@ -16,8 +16,7 @@ import { store as editPostStore } from '../../store';
|
|
|
16
16
|
function KeyboardShortcuts() {
|
|
17
17
|
const {
|
|
18
18
|
getEditorMode,
|
|
19
|
-
isEditorSidebarOpened
|
|
20
|
-
isListViewOpened
|
|
19
|
+
isEditorSidebarOpened
|
|
21
20
|
} = useSelect(editPostStore);
|
|
22
21
|
const isModeToggleDisabled = useSelect(select => {
|
|
23
22
|
const {
|
|
@@ -31,7 +30,6 @@ function KeyboardShortcuts() {
|
|
|
31
30
|
openGeneralSidebar,
|
|
32
31
|
closeGeneralSidebar,
|
|
33
32
|
toggleFeature,
|
|
34
|
-
setIsListViewOpened,
|
|
35
33
|
toggleDistractionFree
|
|
36
34
|
} = useDispatch(editPostStore);
|
|
37
35
|
const {
|
|
@@ -96,15 +94,6 @@ function KeyboardShortcuts() {
|
|
|
96
94
|
character: 'f'
|
|
97
95
|
}
|
|
98
96
|
});
|
|
99
|
-
registerShortcut({
|
|
100
|
-
name: 'core/edit-post/toggle-list-view',
|
|
101
|
-
category: 'global',
|
|
102
|
-
description: __('Open the block list view.'),
|
|
103
|
-
keyCombination: {
|
|
104
|
-
modifier: 'access',
|
|
105
|
-
character: 'o'
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
97
|
registerShortcut({
|
|
109
98
|
name: 'core/edit-post/toggle-sidebar',
|
|
110
99
|
category: 'global',
|
|
@@ -195,14 +184,6 @@ function KeyboardShortcuts() {
|
|
|
195
184
|
openGeneralSidebar(sidebarToOpen);
|
|
196
185
|
}
|
|
197
186
|
});
|
|
198
|
-
|
|
199
|
-
// Only opens the list view. Other functionality for this shortcut happens in the rendered sidebar.
|
|
200
|
-
useShortcut('core/edit-post/toggle-list-view', event => {
|
|
201
|
-
if (!isListViewOpened()) {
|
|
202
|
-
event.preventDefault();
|
|
203
|
-
setIsListViewOpened(true);
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
187
|
useShortcut('core/edit-post/transform-heading-to-paragraph', event => handleTextLevelShortcut(event, 0));
|
|
207
188
|
[1, 2, 3, 4, 5, 6].forEach(level => {
|
|
208
189
|
//the loop is based off on a constant therefore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useSelect","useDispatch","useShortcut","store","keyboardShortcutsStore","__","editorStore","blockEditorStore","createBlock","editPostStore","KeyboardShortcuts","getEditorMode","isEditorSidebarOpened","isListViewOpened","isModeToggleDisabled","select","richEditingEnabled","codeEditingEnabled","getEditorSettings","switchEditorMode","openGeneralSidebar","closeGeneralSidebar","toggleFeature","setIsListViewOpened","toggleDistractionFree","registerShortcut","replaceBlocks","getBlockName","getSelectedBlockClientId","getBlockAttributes","getBlockSelectionStart","handleTextLevelShortcut","event","level","preventDefault","destinationBlockName","currentClientId","blockName","attributes","textAlign","destinationTextAlign","content","name","category","description","keyCombination","modifier","character","aliases","forEach","isDisabled","sidebarToOpen"],"sources":["@wordpress/edit-post/src/components/keyboard-shortcuts/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction KeyboardShortcuts() {\n\tconst { getEditorMode, isEditorSidebarOpened, isListViewOpened } =\n\t\tuseSelect( editPostStore );\n\tconst isModeToggleDisabled = useSelect( ( select ) => {\n\t\tconst { richEditingEnabled, codeEditingEnabled } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\treturn ! richEditingEnabled || ! codeEditingEnabled;\n\t}, [] );\n\n\tconst {\n\t\tswitchEditorMode,\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\ttoggleFeature,\n\t\tsetIsListViewOpened,\n\t\ttoggleDistractionFree,\n\t} = useDispatch( editPostStore );\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst {\n\t\tgetBlockName,\n\t\tgetSelectedBlockClientId,\n\t\tgetBlockAttributes,\n\t\tgetBlockSelectionStart,\n\t} = useSelect( blockEditorStore );\n\n\tconst handleTextLevelShortcut = ( event, level ) => {\n\t\tevent.preventDefault();\n\t\tconst destinationBlockName =\n\t\t\tlevel === 0 ? 'core/paragraph' : 'core/heading';\n\t\tconst currentClientId = getSelectedBlockClientId();\n\t\tif ( currentClientId === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst blockName = getBlockName( currentClientId );\n\t\tif ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {\n\t\t\treturn;\n\t\t}\n\t\tconst attributes = getBlockAttributes( currentClientId );\n\t\tconst textAlign =\n\t\t\tblockName === 'core/paragraph' ? 'align' : 'textAlign';\n\t\tconst destinationTextAlign =\n\t\t\tdestinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';\n\n\t\treplaceBlocks(\n\t\t\tcurrentClientId,\n\t\t\tcreateBlock( destinationBlockName, {\n\t\t\t\tlevel,\n\t\t\t\tcontent: attributes.content,\n\t\t\t\t...{ [ destinationTextAlign ]: attributes[ textAlign ] },\n\t\t\t} )\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-mode',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Switch between visual editor and code editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'm',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-distraction-free',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Toggle distraction free mode.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: '\\\\',\n\t\t\t},\n\t\t} );\n\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\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-list-view',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Open the block list view.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'o',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-sidebar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Show or hide the Settings sidebar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: ',',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/next-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the next part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrl',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'n',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/previous-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the previous part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'p',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\t\tcharacter: '~',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/keyboard-shortcuts',\n\t\t\tcategory: 'main',\n\t\t\tdescription: __( 'Display these keyboard shortcuts.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'h',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/transform-heading-to-paragraph',\n\t\t\tcategory: 'block-library',\n\t\t\tdescription: __( 'Transform heading to paragraph.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: `0`,\n\t\t\t},\n\t\t} );\n\n\t\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t\tregisterShortcut( {\n\t\t\t\tname: `core/edit-post/transform-paragraph-to-heading-${ level }`,\n\t\t\t\tcategory: 'block-library',\n\t\t\t\tdescription: __( 'Transform paragraph to heading.' ),\n\t\t\t\tkeyCombination: {\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: `${ level }`,\n\t\t\t\t},\n\t\t\t} );\n\t\t} );\n\t}, [] );\n\n\tuseShortcut(\n\t\t'core/edit-post/toggle-mode',\n\t\t() => {\n\t\t\tswitchEditorMode(\n\t\t\t\tgetEditorMode() === 'visual' ? 'text' : 'visual'\n\t\t\t);\n\t\t},\n\t\t{\n\t\t\tisDisabled: isModeToggleDisabled,\n\t\t}\n\t);\n\n\tuseShortcut( 'core/edit-post/toggle-fullscreen', () => {\n\t\ttoggleFeature( 'fullscreenMode' );\n\t} );\n\n\tuseShortcut( 'core/edit-post/toggle-distraction-free', () => {\n\t\ttoggleDistractionFree();\n\t} );\n\n\tuseShortcut( 'core/edit-post/toggle-sidebar', ( event ) => {\n\t\t// This shortcut has no known clashes, but use preventDefault to prevent any\n\t\t// obscure shortcuts from triggering.\n\t\tevent.preventDefault();\n\n\t\tif ( isEditorSidebarOpened() ) {\n\t\t\tcloseGeneralSidebar();\n\t\t} else {\n\t\t\tconst sidebarToOpen = getBlockSelectionStart()\n\t\t\t\t? 'edit-post/block'\n\t\t\t\t: 'edit-post/document';\n\t\t\topenGeneralSidebar( sidebarToOpen );\n\t\t}\n\t} );\n\n\t// Only opens the list view. Other functionality for this shortcut happens in the rendered sidebar.\n\tuseShortcut( 'core/edit-post/toggle-list-view', ( event ) => {\n\t\tif ( ! isListViewOpened() ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsListViewOpened( true );\n\t\t}\n\t} );\n\n\tuseShortcut( 'core/edit-post/transform-heading-to-paragraph', ( event ) =>\n\t\thandleTextLevelShortcut( event, 0 )\n\t);\n\n\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t//the loop is based off on a constant therefore\n\t\t//the hook will execute the same way every time\n\t\t//eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseShortcut(\n\t\t\t`core/edit-post/transform-paragraph-to-heading-${ level }`,\n\t\t\t( event ) => handleTextLevelShortcut( event, level )\n\t\t);\n\t} );\n\n\treturn null;\n}\n\nexport default KeyboardShortcuts;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,WAAW,EACXC,KAAK,IAAIC,sBAAsB,QACzB,+BAA+B;AACtC,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;AACxD,SAASH,KAAK,IAAII,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,WAAW,QAAQ,mBAAmB;;AAE/C;AACA;AACA;AACA,SAASL,KAAK,IAAIM,aAAa,QAAQ,aAAa;AAEpD,SAASC,iBAA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AgB,CAAC,CAAC,EAAG;MAC3BmB,KAAK,CAACE,cAAc,CAAC,CAAC;MACtBX,mBAAmB,CAAE,IAAK,CAAC;IAC5B;EACD,CAAE,CAAC;EAEHrB,WAAW,CAAE,+CAA+C,EAAI8B,KAAK,IACpED,uBAAuB,CAAEC,KAAK,EAAE,CAAE,CACnC,CAAC;EAED,CAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAE,CAACiB,OAAO,CAAIhB,KAAK,IAAM;IAC1C;IACA;IACA;IACA/B,WAAW,CACT,iDAAiD+B,KAAO,EAAC,EACxDD,KAAK,IAAMD,uBAAuB,CAAEC,KAAK,EAAEC,KAAM,CACpD,CAAC;EACF,CAAE,CAAC;EAEH,OAAO,IAAI;AACZ;AAEA,eAAevB,iBAAiB"}
|
|
1
|
+
{"version":3,"names":["useEffect","useSelect","useDispatch","useShortcut","store","keyboardShortcutsStore","__","editorStore","blockEditorStore","createBlock","editPostStore","KeyboardShortcuts","getEditorMode","isEditorSidebarOpened","isModeToggleDisabled","select","richEditingEnabled","codeEditingEnabled","getEditorSettings","switchEditorMode","openGeneralSidebar","closeGeneralSidebar","toggleFeature","toggleDistractionFree","registerShortcut","replaceBlocks","getBlockName","getSelectedBlockClientId","getBlockAttributes","getBlockSelectionStart","handleTextLevelShortcut","event","level","preventDefault","destinationBlockName","currentClientId","blockName","attributes","textAlign","destinationTextAlign","content","name","category","description","keyCombination","modifier","character","aliases","forEach","isDisabled","sidebarToOpen"],"sources":["@wordpress/edit-post/src/components/keyboard-shortcuts/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction KeyboardShortcuts() {\n\tconst { getEditorMode, isEditorSidebarOpened } = useSelect( editPostStore );\n\tconst isModeToggleDisabled = useSelect( ( select ) => {\n\t\tconst { richEditingEnabled, codeEditingEnabled } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\treturn ! richEditingEnabled || ! codeEditingEnabled;\n\t}, [] );\n\tconst {\n\t\tswitchEditorMode,\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\ttoggleFeature,\n\t\ttoggleDistractionFree,\n\t} = useDispatch( editPostStore );\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst {\n\t\tgetBlockName,\n\t\tgetSelectedBlockClientId,\n\t\tgetBlockAttributes,\n\t\tgetBlockSelectionStart,\n\t} = useSelect( blockEditorStore );\n\n\tconst handleTextLevelShortcut = ( event, level ) => {\n\t\tevent.preventDefault();\n\t\tconst destinationBlockName =\n\t\t\tlevel === 0 ? 'core/paragraph' : 'core/heading';\n\t\tconst currentClientId = getSelectedBlockClientId();\n\t\tif ( currentClientId === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst blockName = getBlockName( currentClientId );\n\t\tif ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {\n\t\t\treturn;\n\t\t}\n\t\tconst attributes = getBlockAttributes( currentClientId );\n\t\tconst textAlign =\n\t\t\tblockName === 'core/paragraph' ? 'align' : 'textAlign';\n\t\tconst destinationTextAlign =\n\t\t\tdestinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';\n\n\t\treplaceBlocks(\n\t\t\tcurrentClientId,\n\t\t\tcreateBlock( destinationBlockName, {\n\t\t\t\tlevel,\n\t\t\t\tcontent: attributes.content,\n\t\t\t\t...{ [ destinationTextAlign ]: attributes[ textAlign ] },\n\t\t\t} )\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-mode',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Switch between visual editor and code editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'm',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-distraction-free',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Toggle distraction free mode.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: '\\\\',\n\t\t\t},\n\t\t} );\n\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\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-sidebar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Show or hide the Settings sidebar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: ',',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/next-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the next part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrl',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'n',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/previous-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the previous part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'p',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\t\tcharacter: '~',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/keyboard-shortcuts',\n\t\t\tcategory: 'main',\n\t\t\tdescription: __( 'Display these keyboard shortcuts.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'h',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/transform-heading-to-paragraph',\n\t\t\tcategory: 'block-library',\n\t\t\tdescription: __( 'Transform heading to paragraph.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: `0`,\n\t\t\t},\n\t\t} );\n\n\t\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t\tregisterShortcut( {\n\t\t\t\tname: `core/edit-post/transform-paragraph-to-heading-${ level }`,\n\t\t\t\tcategory: 'block-library',\n\t\t\t\tdescription: __( 'Transform paragraph to heading.' ),\n\t\t\t\tkeyCombination: {\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: `${ level }`,\n\t\t\t\t},\n\t\t\t} );\n\t\t} );\n\t}, [] );\n\n\tuseShortcut(\n\t\t'core/edit-post/toggle-mode',\n\t\t() => {\n\t\t\tswitchEditorMode(\n\t\t\t\tgetEditorMode() === 'visual' ? 'text' : 'visual'\n\t\t\t);\n\t\t},\n\t\t{\n\t\t\tisDisabled: isModeToggleDisabled,\n\t\t}\n\t);\n\n\tuseShortcut( 'core/edit-post/toggle-fullscreen', () => {\n\t\ttoggleFeature( 'fullscreenMode' );\n\t} );\n\n\tuseShortcut( 'core/edit-post/toggle-distraction-free', () => {\n\t\ttoggleDistractionFree();\n\t} );\n\n\tuseShortcut( 'core/edit-post/toggle-sidebar', ( event ) => {\n\t\t// This shortcut has no known clashes, but use preventDefault to prevent any\n\t\t// obscure shortcuts from triggering.\n\t\tevent.preventDefault();\n\n\t\tif ( isEditorSidebarOpened() ) {\n\t\t\tcloseGeneralSidebar();\n\t\t} else {\n\t\t\tconst sidebarToOpen = getBlockSelectionStart()\n\t\t\t\t? 'edit-post/block'\n\t\t\t\t: 'edit-post/document';\n\t\t\topenGeneralSidebar( sidebarToOpen );\n\t\t}\n\t} );\n\n\tuseShortcut( 'core/edit-post/transform-heading-to-paragraph', ( event ) =>\n\t\thandleTextLevelShortcut( event, 0 )\n\t);\n\n\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t//the loop is based off on a constant therefore\n\t\t//the hook will execute the same way every time\n\t\t//eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseShortcut(\n\t\t\t`core/edit-post/transform-paragraph-to-heading-${ level }`,\n\t\t\t( event ) => handleTextLevelShortcut( event, level )\n\t\t);\n\t} );\n\n\treturn null;\n}\n\nexport default KeyboardShortcuts;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,WAAW,EACXC,KAAK,IAAIC,sBAAsB,QACzB,+BAA+B;AACtC,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;AACxD,SAASH,KAAK,IAAII,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,WAAW,QAAQ,mBAAmB;;AAE/C;AACA;AACA;AACA,SAASL,KAAK,IAAIM,aAAa,QAAQ,aAAa;AAEpD,SAASC,iBAAiBA,CAAA,EAAG;EAC5B,MAAM;IAAEC,aAAa;IAAEC;EAAsB,CAAC,GAAGZ,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