@wordpress/edit-post 7.33.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 +2 -0
- package/README.md +22 -36
- package/build/components/header/index.js +17 -48
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +17 -43
- 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/keyboard-shortcuts/index.js +0 -88
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +18 -11
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +2 -11
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +29 -6
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +40 -10
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/deprecated.js +132 -0
- package/build/deprecated.js.map +1 -0
- package/build/index.js +19 -58
- package/build/index.js.map +1 -1
- package/build-module/components/header/index.js +20 -51
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +17 -43
- 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/keyboard-shortcuts/index.js +1 -89
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +18 -11
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +3 -12
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +30 -7
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +43 -13
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/deprecated.js +116 -0
- package/build-module/deprecated.js.map +1 -0
- package/build-module/index.js +2 -15
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +6 -141
- package/build-style/style.css +6 -141
- package/package.json +31 -31
- package/src/components/header/index.js +24 -69
- package/src/components/header/more-menu/index.js +27 -42
- package/src/components/header/more-menu/manage-patterns-menu-item.js +33 -0
- package/src/components/header/style.scss +0 -79
- package/src/components/keyboard-shortcuts/index.js +1 -106
- package/src/components/layout/index.js +12 -6
- package/src/components/layout/style.scss +7 -80
- package/src/components/preferences-modal/index.js +2 -22
- package/src/components/sidebar/post-status/index.js +57 -17
- package/src/components/sidebar/settings-sidebar/index.js +60 -24
- package/src/deprecated.js +107 -0
- package/src/index.js +3 -24
- package/build/components/header/post-publish-button-or-toggle.js +0 -94
- package/build/components/header/post-publish-button-or-toggle.js.map +0 -1
- package/build/components/header/preferences-menu-item/index.js +0 -39
- 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/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-pre-publish-panel/index.js +0 -43
- package/build/components/sidebar/plugin-pre-publish-panel/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 -44
- 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/post-publish-button-or-toggle.js +0 -86
- 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 -32
- 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/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-pre-publish-panel/index.js +0 -36
- package/build-module/components/sidebar/plugin-pre-publish-panel/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 -36
- 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/post-publish-button-or-toggle.js +0 -97
- package/src/components/header/preferences-menu-item/index.js +0 -31
- package/src/components/header/test/index.js +0 -63
- 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/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-pre-publish-panel/index.js +0 -32
- 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 -36
- /package/src/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +0 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -41,65 +41,51 @@ _Parameters_
|
|
|
41
41
|
|
|
42
42
|
### PluginBlockSettingsMenuItem
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
### PluginDocumentSettingPanel
|
|
44
|
+
_Related_
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
- PluginBlockSettingsMenuItem in @wordpress/editor package.
|
|
49
47
|
|
|
50
|
-
###
|
|
48
|
+
### PluginDocumentSettingPanel
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
_Related_
|
|
53
51
|
|
|
54
|
-
|
|
52
|
+
- PluginDocumentSettingPanel in @wordpress/editor package.
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
### PluginMoreMenuItem
|
|
57
55
|
|
|
58
|
-
|
|
56
|
+
_Related_
|
|
59
57
|
|
|
60
|
-
|
|
58
|
+
- PluginMoreMenuItem in @wordpress/editor package.
|
|
61
59
|
|
|
62
|
-
|
|
63
|
-
- _props.className_ `[string]`: An optional class name added to the panel.
|
|
64
|
-
- _props.title_ `[string]`: Title displayed at the top of the panel.
|
|
65
|
-
- _props.initialOpen_ `[boolean]`: Whether to have the panel initially opened. When no title is provided it is always opened.
|
|
66
|
-
- _props.icon_ `[WPBlockTypeIconRender]`: The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
|
|
67
|
-
- _props.children_ `Element`: Children to be rendered
|
|
60
|
+
### PluginPostPublishPanel
|
|
68
61
|
|
|
69
|
-
|
|
62
|
+
_Related_
|
|
70
63
|
|
|
71
|
-
-
|
|
64
|
+
- PluginPostPublishPanel in @wordpress/editor package.
|
|
72
65
|
|
|
73
66
|
### PluginPostStatusInfo
|
|
74
67
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
### PluginPrePublishPanel
|
|
78
|
-
|
|
79
|
-
> **Deprecated** since 6.6, use `wp.editor.PluginPrePublishPanel` instead.
|
|
80
|
-
|
|
81
|
-
Renders provided content to the pre-publish side panel in the publish flow (side panel that opens when a user first pushes "Publish" from the main editor).
|
|
68
|
+
_Related_
|
|
82
69
|
|
|
83
|
-
|
|
70
|
+
- PluginPostStatusInfo in @wordpress/editor package.
|
|
84
71
|
|
|
85
|
-
|
|
86
|
-
- _props.className_ `[string]`: An optional class name added to the panel.
|
|
87
|
-
- _props.title_ `[string]`: Title displayed at the top of the panel.
|
|
88
|
-
- _props.initialOpen_ `[boolean]`: Whether to have the panel initially opened. When no title is provided it is always opened.
|
|
89
|
-
- _props.icon_ `[WPBlockTypeIconRender]`: The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
|
|
90
|
-
- _props.children_ `Element`: Children to be rendered
|
|
72
|
+
### PluginPrePublishPanel
|
|
91
73
|
|
|
92
|
-
|
|
74
|
+
_Related_
|
|
93
75
|
|
|
94
|
-
-
|
|
76
|
+
- PluginPrePublishPanel in @wordpress/editor package.
|
|
95
77
|
|
|
96
78
|
### PluginSidebar
|
|
97
79
|
|
|
98
|
-
|
|
80
|
+
_Related_
|
|
81
|
+
|
|
82
|
+
- PluginSidebar in @wordpress/editor package.
|
|
99
83
|
|
|
100
84
|
### PluginSidebarMoreMenuItem
|
|
101
85
|
|
|
102
|
-
|
|
86
|
+
_Related_
|
|
87
|
+
|
|
88
|
+
- PluginSidebarMoreMenuItem in @wordpress/editor package.
|
|
103
89
|
|
|
104
90
|
### reinitializeEditor
|
|
105
91
|
|
|
@@ -7,18 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
11
10
|
var _editor = require("@wordpress/editor");
|
|
12
|
-
var _element = require("@wordpress/element");
|
|
13
11
|
var _data = require("@wordpress/data");
|
|
14
|
-
var _i18n = require("@wordpress/i18n");
|
|
15
|
-
var _icons = require("@wordpress/icons");
|
|
16
12
|
var _compose = require("@wordpress/compose");
|
|
17
13
|
var _components = require("@wordpress/components");
|
|
18
14
|
var _preferences = require("@wordpress/preferences");
|
|
15
|
+
var _element = require("@wordpress/element");
|
|
19
16
|
var _fullscreenModeClose = _interopRequireDefault(require("./fullscreen-mode-close"));
|
|
20
17
|
var _moreMenu = _interopRequireDefault(require("./more-menu"));
|
|
21
|
-
var _postPublishButtonOrToggle = _interopRequireDefault(require("./post-publish-button-or-toggle"));
|
|
22
18
|
var _mainDashboardButton = _interopRequireDefault(require("./main-dashboard-button"));
|
|
23
19
|
var _store = require("../../store");
|
|
24
20
|
var _lockUnlock = require("../../lock-unlock");
|
|
@@ -35,13 +31,13 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
35
31
|
*/
|
|
36
32
|
|
|
37
33
|
const {
|
|
38
|
-
|
|
39
|
-
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
40
|
-
const {
|
|
34
|
+
CollapsableBlockToolbar,
|
|
41
35
|
DocumentTools,
|
|
42
36
|
PostViewLink,
|
|
43
37
|
PreviewDropdown,
|
|
44
|
-
PinnedItems
|
|
38
|
+
PinnedItems,
|
|
39
|
+
MoreMenu,
|
|
40
|
+
PostPublishButtonOrToggle
|
|
45
41
|
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
46
42
|
const slideY = {
|
|
47
43
|
hidden: {
|
|
@@ -79,14 +75,13 @@ function Header({
|
|
|
79
75
|
}) {
|
|
80
76
|
const isWideViewport = (0, _compose.useViewportMatch)('large');
|
|
81
77
|
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
82
|
-
const blockToolbarRef = (0, _element.useRef)();
|
|
83
78
|
const {
|
|
84
79
|
isTextEditor,
|
|
85
|
-
blockSelectionStart,
|
|
86
80
|
hasActiveMetaboxes,
|
|
87
81
|
isPublishSidebarOpened,
|
|
88
82
|
showIconLabels,
|
|
89
|
-
hasHistory
|
|
83
|
+
hasHistory,
|
|
84
|
+
hasFixedToolbar
|
|
90
85
|
} = (0, _data.useSelect)(select => {
|
|
91
86
|
const {
|
|
92
87
|
get: getPreference
|
|
@@ -96,25 +91,15 @@ function Header({
|
|
|
96
91
|
} = select(_editor.store);
|
|
97
92
|
return {
|
|
98
93
|
isTextEditor: getEditorMode() === 'text',
|
|
99
|
-
blockSelectionStart: select(_blockEditor.store).getBlockSelectionStart(),
|
|
100
94
|
hasActiveMetaboxes: select(_store.store).hasMetaBoxes(),
|
|
101
95
|
hasHistory: !!select(_editor.store).getEditorSettings().onNavigateToPreviousEntityRecord,
|
|
102
96
|
isPublishSidebarOpened: select(_editor.store).isPublishSidebarOpened(),
|
|
103
|
-
showIconLabels: getPreference('core', 'showIconLabels')
|
|
97
|
+
showIconLabels: getPreference('core', 'showIconLabels'),
|
|
98
|
+
hasFixedToolbar: getPreference('core', 'fixedToolbar')
|
|
104
99
|
};
|
|
105
100
|
}, []);
|
|
106
|
-
const
|
|
107
|
-
showFixedToolbar
|
|
108
|
-
} = useShowBlockTools();
|
|
109
|
-
const showTopToolbar = isLargeViewport && showFixedToolbar;
|
|
101
|
+
const hasTopToolbar = isLargeViewport && hasFixedToolbar;
|
|
110
102
|
const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0, _element.useState)(true);
|
|
111
|
-
const hasBlockSelection = !!blockSelectionStart;
|
|
112
|
-
(0, _element.useEffect)(() => {
|
|
113
|
-
// If we have a new block selection, show the block tools
|
|
114
|
-
if (blockSelectionStart) {
|
|
115
|
-
setIsBlockToolsCollapsed(false);
|
|
116
|
-
}
|
|
117
|
-
}, [blockSelectionStart]);
|
|
118
103
|
return (0, _react.createElement)("div", {
|
|
119
104
|
className: "edit-post-header"
|
|
120
105
|
}, (0, _react.createElement)(_mainDashboardButton.default.Slot, null, (0, _react.createElement)(_components.__unstableMotion.div, {
|
|
@@ -135,26 +120,12 @@ function Header({
|
|
|
135
120
|
className: "edit-post-header__toolbar"
|
|
136
121
|
}, (0, _react.createElement)(DocumentTools, {
|
|
137
122
|
disableBlockTools: isTextEditor
|
|
138
|
-
}),
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}, (0, _react.createElement)(_blockEditor.BlockToolbar, {
|
|
143
|
-
hideDragHandle: true
|
|
144
|
-
})), (0, _react.createElement)(_components.Popover.Slot, {
|
|
145
|
-
ref: blockToolbarRef,
|
|
146
|
-
name: "block-toolbar"
|
|
147
|
-
}), (0, _react.createElement)(_components.Button, {
|
|
148
|
-
className: "edit-post-header__block-tools-toggle",
|
|
149
|
-
icon: isBlockToolsCollapsed ? _icons.next : _icons.previous,
|
|
150
|
-
onClick: () => {
|
|
151
|
-
setIsBlockToolsCollapsed(collapsed => !collapsed);
|
|
152
|
-
},
|
|
153
|
-
label: isBlockToolsCollapsed ? (0, _i18n.__)('Show block tools') : (0, _i18n.__)('Hide block tools'),
|
|
154
|
-
size: "compact"
|
|
155
|
-
})), (0, _react.createElement)("div", {
|
|
123
|
+
}), hasTopToolbar && (0, _react.createElement)(CollapsableBlockToolbar, {
|
|
124
|
+
isCollapsed: isBlockToolsCollapsed,
|
|
125
|
+
onToggle: setIsBlockToolsCollapsed
|
|
126
|
+
}), (0, _react.createElement)("div", {
|
|
156
127
|
className: (0, _classnames.default)('edit-post-header__center', {
|
|
157
|
-
'is-collapsed': hasHistory && !isBlockToolsCollapsed &&
|
|
128
|
+
'is-collapsed': hasHistory && !isBlockToolsCollapsed && hasTopToolbar
|
|
158
129
|
})
|
|
159
130
|
}, hasHistory && (0, _react.createElement)(_editor.DocumentBar, null))), (0, _react.createElement)(_components.__unstableMotion.div, {
|
|
160
131
|
variants: slideY,
|
|
@@ -176,14 +147,12 @@ function Header({
|
|
|
176
147
|
}), (0, _react.createElement)(_editor.PostPreviewButton, {
|
|
177
148
|
className: "edit-post-header__post-preview-button",
|
|
178
149
|
forceIsAutosaveable: hasActiveMetaboxes
|
|
179
|
-
}), (0, _react.createElement)(PostViewLink, null), (0, _react.createElement)(
|
|
150
|
+
}), (0, _react.createElement)(PostViewLink, null), (0, _react.createElement)(PostPublishButtonOrToggle, {
|
|
180
151
|
forceIsDirty: hasActiveMetaboxes,
|
|
181
152
|
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
|
|
182
153
|
}), (isWideViewport || !showIconLabels) && (0, _react.createElement)(PinnedItems.Slot, {
|
|
183
154
|
scope: "core"
|
|
184
|
-
}), (0, _react.createElement)(_moreMenu.default,
|
|
185
|
-
showIconLabels: showIconLabels
|
|
186
|
-
})));
|
|
155
|
+
}), (0, _react.createElement)(MoreMenu, null), (0, _react.createElement)(_moreMenu.default, null)));
|
|
187
156
|
}
|
|
188
157
|
var _default = exports.default = Header;
|
|
189
158
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_blockEditor","_editor","_element","_data","_i18n","_icons","_compose","_components","_preferences","_fullscreenModeClose","_moreMenu","_postPublishButtonOrToggle","_mainDashboardButton","_store","_lockUnlock","useShowBlockTools","unlock","blockEditorPrivateApis","DocumentTools","PostViewLink","PreviewDropdown","PinnedItems","editorPrivateApis","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","initialPost","isWideViewport","useViewportMatch","isLargeViewport","blockToolbarRef","useRef","isTextEditor","blockSelectionStart","hasActiveMetaboxes","isPublishSidebarOpened","showIconLabels","hasHistory","useSelect","select","get","getPreference","preferencesStore","getEditorMode","editorStore","blockEditorStore","getBlockSelectionStart","editPostStore","hasMetaBoxes","getEditorSettings","onNavigateToPreviousEntityRecord","showFixedToolbar","showTopToolbar","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","hasBlockSelection","useEffect","_react","createElement","className","default","Slot","__unstableMotion","div","variants","showTooltip","disableBlockTools","Fragment","classnames","BlockToolbar","hideDragHandle","Popover","ref","name","Button","icon","next","previous","onClick","collapsed","label","__","size","DocumentBar","PostSavedState","forceIsDirty","forceIsAutosaveable","PostPreviewButton","scope","_default","exports"],"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 { 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, PinnedItems } =\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\" />\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":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAF,OAAA;AAOA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAKA,IAAAS,YAAA,GAAAT,OAAA;AAKA,IAAAU,oBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,SAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,0BAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,oBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,WAAA,GAAAf,OAAA;AAxCA;AACA;AACA;;AAGA;AACA;AACA;;AAyBA;AACA;AACA;;AAQA,MAAM;EAAEgB;AAAkB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAC9D,MAAM;EAAEC,aAAa;EAAEC,YAAY;EAAEC,eAAe;EAAEC;AAAY,CAAC,GAClE,IAAAL,kBAAM,EAAEM,mBAAkB,CAAC;AAE5B,MAAMC,MAAM,GAAG;EACdC,MAAM,EAAE;IAAEC,CAAC,EAAE;E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W,MAAE,CAC1B,CACM,CAAC,EACb,IAAA1B,MAAA,CAAAC,aAAA,EAAC7D,WAAA,CAAAiE,gBAAM,CAACC,GAAG;IACVC,QAAQ,EAAGnD,MAAQ;IACnBK,UAAU,EAAG;MAAEC,IAAI,EAAE,OAAO;MAAEC,KAAK,EAAE;IAAI,CAAG;IAC5CuC,SAAS,EAAC;EAA4B,GAEpC,CAAEzB,sBAAsB;EACzB;EACA;EACA;EACA;EACA;EACA,IAAAuB,MAAA,CAAAC,aAAA,EAACnE,OAAA,CAAA6F,cAAc;IAACC,YAAY,EAAGpD;EAAoB,CAAE,CACrD,EACD,IAAAwB,MAAA,CAAAC,aAAA,EAAChD,eAAe;IAAC4E,mBAAmB,EAAGrD;EAAoB,CAAE,CAAC,EAC9D,IAAAwB,MAAA,CAAAC,aAAA,EAACnE,OAAA,CAAAgG,iBAAiB;IACjB5B,SAAS,EAAC,uCAAuC;IACjD2B,mBAAmB,EAAGrD;EAAoB,CAC1C,CAAC,EACF,IAAAwB,MAAA,CAAAC,aAAA,EAACjD,YAAY,MAAE,CAAC,EAChB,IAAAgD,MAAA,CAAAC,aAAA,EAACzD,0BAAA,CAAA2D,OAAyB;IACzByB,YAAY,EAAGpD,kBAAoB;IACnCT,8BAA8B,EAC7BA;EACA,CACD,CAAC,EACA,CAAEE,cAAc,IAAI,CAAES,cAAc,KACrC,IAAAsB,MAAA,CAAAC,aAAA,EAAC/C,WAAW,CAACkD,IAAI;IAAC2B,KAAK,EAAC;EAAM,CAAE,CAChC,EACD,IAAA/B,MAAA,CAAAC,aAAA,EAAC1D,SAAA,CAAA4D,OAAQ;IAACzB,cAAc,EAAGA;EAAgB,CAAE,CAClC,CACR,CAAC;AAER;AAAC,IAAAsD,QAAA,GAAAC,OAAA,CAAA9B,OAAA,GAEcrC,MAAM","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_editor","_data","_compose","_components","_preferences","_element","_fullscreenModeClose","_moreMenu","_mainDashboardButton","_store","_lockUnlock","CollapsableBlockToolbar","DocumentTools","PostViewLink","PreviewDropdown","PinnedItems","MoreMenu","PostPublishButtonOrToggle","unlock","editorPrivateApis","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","slideX","x","Header","setEntitiesSavedStatesCallback","initialPost","isWideViewport","useViewportMatch","isLargeViewport","isTextEditor","hasActiveMetaboxes","isPublishSidebarOpened","showIconLabels","hasHistory","hasFixedToolbar","useSelect","select","get","getPreference","preferencesStore","getEditorMode","editorStore","editPostStore","hasMetaBoxes","getEditorSettings","onNavigateToPreviousEntityRecord","hasTopToolbar","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","_react","createElement","className","default","Slot","__unstableMotion","div","variants","showTooltip","disableBlockTools","isCollapsed","onToggle","classnames","DocumentBar","PostSavedState","forceIsDirty","forceIsAutosaveable","PostPreviewButton","scope","_default","exports"],"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":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,oBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,SAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,oBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AA5BA;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;;AAOA,MAAM;EACLY,uBAAuB;EACvBC,aAAa;EACbC,YAAY;EACZC,eAAe;EACfC,WAAW;EACXC,QAAQ;EACRC;AACD,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAE/B,MAAMC,MAAM,GAAG;EACdC,MAAM,EAAE;IAAEC,CAAC,EAAE;EAAQ,CAAC;EACtBC,uBAAuB,EAAE;IAAED,CAAC,EAAE;EAAE,CAAC;EACjCE,KAAK,EAAE;IAAEF,CAAC,EAAE,CAAC;IAAEG,UAAU,EAAE;MAAEC,IAAI,EAAE,OAAO;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= void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _i18n = require("@wordpress/i18n");
|
|
10
|
-
var _components = require("@wordpress/components");
|
|
11
10
|
var _compose = require("@wordpress/compose");
|
|
12
11
|
var _editor = require("@wordpress/editor");
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var _toolsMoreMenuGroup = _interopRequireDefault(require("../tools-more-menu-group"));
|
|
16
|
-
var _writingMenu = _interopRequireDefault(require("../writing-menu"));
|
|
12
|
+
var _preferences = require("@wordpress/preferences");
|
|
13
|
+
var _keycodes = require("@wordpress/keycodes");
|
|
17
14
|
var _lockUnlock = require("../../../lock-unlock");
|
|
15
|
+
var _managePatternsMenuItem = _interopRequireDefault(require("./manage-patterns-menu-item"));
|
|
16
|
+
var _welcomeGuideMenuItem = _interopRequireDefault(require("./welcome-guide-menu-item"));
|
|
17
|
+
var _preferencesModal = _interopRequireDefault(require("../../preferences-modal"));
|
|
18
18
|
/**
|
|
19
19
|
* WordPress dependencies
|
|
20
20
|
*/
|
|
@@ -24,46 +24,20 @@ var _lockUnlock = require("../../../lock-unlock");
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
const {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
PinnedItems
|
|
27
|
+
ToolsMoreMenuGroup,
|
|
28
|
+
ViewMoreMenuGroup
|
|
30
29
|
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
31
|
-
const MoreMenu = ({
|
|
32
|
-
showIconLabels
|
|
33
|
-
}) => {
|
|
30
|
+
const MoreMenu = () => {
|
|
34
31
|
const isLargeViewport = (0, _compose.useViewportMatch)('large');
|
|
35
|
-
return (0, _react.createElement)(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
variant: 'tertiary'
|
|
45
|
-
}),
|
|
46
|
-
tooltipPosition: 'bottom',
|
|
47
|
-
showTooltip: !showIconLabels,
|
|
48
|
-
size: 'compact'
|
|
49
|
-
}
|
|
50
|
-
}, ({
|
|
51
|
-
onClose
|
|
52
|
-
}) => (0, _react.createElement)(_react.Fragment, null, showIconLabels && !isLargeViewport && (0, _react.createElement)(PinnedItems.Slot, {
|
|
53
|
-
className: showIconLabels && 'show-icon-labels',
|
|
54
|
-
scope: "core"
|
|
55
|
-
}), (0, _react.createElement)(_writingMenu.default, null), (0, _react.createElement)(ModeSwitcher, null), (0, _react.createElement)(ActionItem.Slot, {
|
|
56
|
-
name: "core/plugin-more-menu",
|
|
57
|
-
label: (0, _i18n.__)('Plugins'),
|
|
58
|
-
as: _components.MenuGroup,
|
|
59
|
-
fillProps: {
|
|
60
|
-
onClick: onClose
|
|
61
|
-
}
|
|
62
|
-
}), (0, _react.createElement)(_toolsMoreMenuGroup.default.Slot, {
|
|
63
|
-
fillProps: {
|
|
64
|
-
onClose
|
|
65
|
-
}
|
|
66
|
-
}), (0, _react.createElement)(_components.MenuGroup, null, (0, _react.createElement)(_preferencesMenuItem.default, null))));
|
|
32
|
+
return (0, _react.createElement)(_react.Fragment, null, isLargeViewport && (0, _react.createElement)(ViewMoreMenuGroup, null, (0, _react.createElement)(_preferences.PreferenceToggleMenuItem, {
|
|
33
|
+
scope: "core/edit-post",
|
|
34
|
+
name: "fullscreenMode",
|
|
35
|
+
label: (0, _i18n.__)('Fullscreen mode'),
|
|
36
|
+
info: (0, _i18n.__)('Show and hide the admin user interface'),
|
|
37
|
+
messageActivated: (0, _i18n.__)('Fullscreen mode activated'),
|
|
38
|
+
messageDeactivated: (0, _i18n.__)('Fullscreen mode deactivated'),
|
|
39
|
+
shortcut: _keycodes.displayShortcut.secondary('f')
|
|
40
|
+
})), (0, _react.createElement)(ToolsMoreMenuGroup, null, (0, _react.createElement)(_managePatternsMenuItem.default, null), (0, _react.createElement)(_welcomeGuideMenuItem.default, null)), (0, _react.createElement)(_preferencesModal.default, null));
|
|
67
41
|
};
|
|
68
42
|
var _default = exports.default = MoreMenu;
|
|
69
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_compose","_editor","_preferences","_keycodes","_lockUnlock","_managePatternsMenuItem","_interopRequireDefault","_welcomeGuideMenuItem","_preferencesModal","ToolsMoreMenuGroup","ViewMoreMenuGroup","unlock","editorPrivateApis","MoreMenu","isLargeViewport","useViewportMatch","_react","createElement","Fragment","PreferenceToggleMenuItem","scope","name","label","__","info","messageActivated","messageDeactivated","shortcut","displayShortcut","secondary","default","_default","exports"],"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<WelcomeGuideMenuItem />\n\t\t\t</ToolsMoreMenuGroup>\n\t\t\t<EditPostPreferencesModal />\n\t\t</>\n\t);\n};\n\nexport default MoreMenu;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,uBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,qBAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,iBAAA,GAAAF,sBAAA,CAAAP,OAAA;AAfA;AACA;AACA;;AAOA;AACA;AACA;;AAMA,MAAM;EAAEU,kBAAkB;EAAEC;AAAkB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAE7E,MAAMC,QAAQ,GAAGA,CAAA,KAAM;EACtB,MAAMC,eAAe,GAAG,IAAAC,yBAAgB,EAAE,OAAQ,CAAC;EAEnD,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACGJ,eAAe,IAChB,IAAAE,MAAA,CAAAC,aAAA,EAACP,iBAAiB,QACjB,IAAAM,MAAA,CAAAC,aAAA,EAACf,YAAA,CAAAiB,wBAAwB;IACxBC,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAC,gBAAgB;IACrBC,KAAK,EAAG,IAAAC,QAAE,EAAE,iBAAkB,CAAG;IACjCC,IAAI,EAAG,IAAAD,QAAE,EAAE,wCAAyC,CAAG;IACvDE,gBAAgB,EAAG,IAAAF,QAAE,EAAE,2BAA4B,CAAG;IACtDG,kBAAkB,EAAG,IAAAH,QAAE,EACtB,6BACD,CAAG;IACHI,QAAQ,EAAGC,yBAAe,CAACC,SAAS,CAAE,GAAI;EAAG,CAC7C,CACiB,CACnB,EACD,IAAAb,MAAA,CAAAC,aAAA,EAACR,kBAAkB,QAClB,IAAAO,MAAA,CAAAC,aAAA,EAACZ,uBAAA,CAAAyB,OAAsB,MAAE,CAAC,EAC1B,IAAAd,MAAA,CAAAC,aAAA,EAACV,qBAAA,CAAAuB,OAAoB,MAAE,CACJ,CAAC,EACrB,IAAAd,MAAA,CAAAC,aAAA,EAACT,iBAAA,CAAAsB,OAAwB,MAAE,CAC1B,CAAC;AAEL,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEajB,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _components = require("@wordpress/components");
|
|
9
|
+
var _coreData = require("@wordpress/core-data");
|
|
10
|
+
var _data = require("@wordpress/data");
|
|
11
|
+
var _i18n = require("@wordpress/i18n");
|
|
12
|
+
var _url = require("@wordpress/url");
|
|
13
|
+
/**
|
|
14
|
+
* WordPress dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
function ManagePatternsMenuItem() {
|
|
18
|
+
const url = (0, _data.useSelect)(select => {
|
|
19
|
+
const {
|
|
20
|
+
canUser
|
|
21
|
+
} = select(_coreData.store);
|
|
22
|
+
const defaultUrl = (0, _url.addQueryArgs)('edit.php', {
|
|
23
|
+
post_type: 'wp_block'
|
|
24
|
+
});
|
|
25
|
+
const patternsUrl = (0, _url.addQueryArgs)('site-editor.php', {
|
|
26
|
+
path: '/patterns'
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// The site editor and templates both check whether the user has
|
|
30
|
+
// edit_theme_options capabilities. We can leverage that here and not
|
|
31
|
+
// display the manage patterns link if the user can't access it.
|
|
32
|
+
return canUser('read', 'templates') ? patternsUrl : defaultUrl;
|
|
33
|
+
}, []);
|
|
34
|
+
return (0, _react.createElement)(_components.MenuItem, {
|
|
35
|
+
role: "menuitem",
|
|
36
|
+
href: url
|
|
37
|
+
}, (0, _i18n.__)('Manage patterns'));
|
|
38
|
+
}
|
|
39
|
+
var _default = exports.default = ManagePatternsMenuItem;
|
|
40
|
+
//# sourceMappingURL=manage-patterns-menu-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_components","require","_coreData","_data","_i18n","_url","ManagePatternsMenuItem","url","useSelect","select","canUser","coreStore","defaultUrl","addQueryArgs","post_type","patternsUrl","path","_react","createElement","MenuItem","role","href","__","_default","exports","default"],"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":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AAPA;AACA;AACA;;AAOA,SAASK,sBAAsBA,CAAA,EAAG;EACjC,MAAMC,GAAG,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACpC,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM,CAAEE,eAAU,CAAC;IACvC,MAAMC,UAAU,GAAG,IAAAC,iBAAY,EAAE,UAAU,EAAE;MAC5CC,SAAS,EAAE;IACZ,CAAE,CAAC;IACH,MAAMC,WAAW,GAAG,IAAAF,iBAAY,EAAE,iBAAiB,EAAE;MACpDG,IAAI,EAAE;IACP,CAAE,CAAC;;IAEH;IACA;IACA;IACA,OAAON,OAAO,CAAE,MAAM,EAAE,WAAY,CAAC,GAAGK,WAAW,GAAGH,UAAU;EACjE,CAAC,EAAE,EAAG,CAAC;EAEP,OACC,IAAAK,MAAA,CAAAC,aAAA,EAAClB,WAAA,CAAAmB,QAAQ;IAACC,IAAI,EAAC,UAAU;IAACC,IAAI,EAAGd;EAAK,GACnC,IAAAe,QAAE,EAAE,iBAAkB,CACf,CAAC;AAEb;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcnB,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_preferences","_i18n","_editor","WelcomeGuideMenuItem","isEditingTemplate","useSelect","select","editorStore","getCurrentPostType","_react","createElement","PreferenceToggleMenuItem","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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMe,SAASI,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,iBAAiB,GAAG,IAAAC,eAAS,EAChCC,MAAM,IACPA,MAAM,CAAEC,aAAY,CAAC,CAACC,kBAAkB,CAAC,CAAC,KAAK,aAAa,EAC7D,EACD,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACV,YAAA,CAAAW,wBAAwB;IACxBC,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAGT,iBAAiB,GAAG,sBAAsB,GAAG,cAAgB;IACpEU,KAAK,EAAG,IAAAC,QAAE,EAAE,eAAgB;EAAG,CAC/B,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -8,8 +8,6 @@ var _element = require("@wordpress/element");
|
|
|
8
8
|
var _data = require("@wordpress/data");
|
|
9
9
|
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
10
10
|
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
12
|
-
var _blocks = require("@wordpress/blocks");
|
|
13
11
|
var _store = require("../../store");
|
|
14
12
|
/**
|
|
15
13
|
* WordPress dependencies
|
|
@@ -26,36 +24,6 @@ function KeyboardShortcuts() {
|
|
|
26
24
|
const {
|
|
27
25
|
registerShortcut
|
|
28
26
|
} = (0, _data.useDispatch)(_keyboardShortcuts.store);
|
|
29
|
-
const {
|
|
30
|
-
replaceBlocks
|
|
31
|
-
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
32
|
-
const {
|
|
33
|
-
getBlockName,
|
|
34
|
-
getSelectedBlockClientId,
|
|
35
|
-
getBlockAttributes
|
|
36
|
-
} = (0, _data.useSelect)(_blockEditor.store);
|
|
37
|
-
const handleTextLevelShortcut = (event, level) => {
|
|
38
|
-
event.preventDefault();
|
|
39
|
-
const destinationBlockName = level === 0 ? 'core/paragraph' : 'core/heading';
|
|
40
|
-
const currentClientId = getSelectedBlockClientId();
|
|
41
|
-
if (currentClientId === null) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const blockName = getBlockName(currentClientId);
|
|
45
|
-
if (blockName !== 'core/paragraph' && blockName !== 'core/heading') {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const attributes = getBlockAttributes(currentClientId);
|
|
49
|
-
const textAlign = blockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
50
|
-
const destinationTextAlign = destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
|
|
51
|
-
replaceBlocks(currentClientId, (0, _blocks.createBlock)(destinationBlockName, {
|
|
52
|
-
level,
|
|
53
|
-
content: attributes.content,
|
|
54
|
-
...{
|
|
55
|
-
[destinationTextAlign]: attributes[textAlign]
|
|
56
|
-
}
|
|
57
|
-
}));
|
|
58
|
-
};
|
|
59
27
|
(0, _element.useEffect)(() => {
|
|
60
28
|
registerShortcut({
|
|
61
29
|
name: 'core/edit-post/toggle-fullscreen',
|
|
@@ -66,66 +34,10 @@ function KeyboardShortcuts() {
|
|
|
66
34
|
character: 'f'
|
|
67
35
|
}
|
|
68
36
|
});
|
|
69
|
-
registerShortcut({
|
|
70
|
-
name: 'core/edit-post/next-region',
|
|
71
|
-
category: 'global',
|
|
72
|
-
description: (0, _i18n.__)('Navigate to the next part of the editor.'),
|
|
73
|
-
keyCombination: {
|
|
74
|
-
modifier: 'ctrl',
|
|
75
|
-
character: '`'
|
|
76
|
-
},
|
|
77
|
-
aliases: [{
|
|
78
|
-
modifier: 'access',
|
|
79
|
-
character: 'n'
|
|
80
|
-
}]
|
|
81
|
-
});
|
|
82
|
-
registerShortcut({
|
|
83
|
-
name: 'core/edit-post/previous-region',
|
|
84
|
-
category: 'global',
|
|
85
|
-
description: (0, _i18n.__)('Navigate to the previous part of the editor.'),
|
|
86
|
-
keyCombination: {
|
|
87
|
-
modifier: 'ctrlShift',
|
|
88
|
-
character: '`'
|
|
89
|
-
},
|
|
90
|
-
aliases: [{
|
|
91
|
-
modifier: 'access',
|
|
92
|
-
character: 'p'
|
|
93
|
-
}, {
|
|
94
|
-
modifier: 'ctrlShift',
|
|
95
|
-
character: '~'
|
|
96
|
-
}]
|
|
97
|
-
});
|
|
98
|
-
registerShortcut({
|
|
99
|
-
name: 'core/edit-post/transform-heading-to-paragraph',
|
|
100
|
-
category: 'block-library',
|
|
101
|
-
description: (0, _i18n.__)('Transform heading to paragraph.'),
|
|
102
|
-
keyCombination: {
|
|
103
|
-
modifier: 'access',
|
|
104
|
-
character: `0`
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
[1, 2, 3, 4, 5, 6].forEach(level => {
|
|
108
|
-
registerShortcut({
|
|
109
|
-
name: `core/edit-post/transform-paragraph-to-heading-${level}`,
|
|
110
|
-
category: 'block-library',
|
|
111
|
-
description: (0, _i18n.__)('Transform paragraph to heading.'),
|
|
112
|
-
keyCombination: {
|
|
113
|
-
modifier: 'access',
|
|
114
|
-
character: `${level}`
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
37
|
}, []);
|
|
119
38
|
(0, _keyboardShortcuts.useShortcut)('core/edit-post/toggle-fullscreen', () => {
|
|
120
39
|
toggleFeature('fullscreenMode');
|
|
121
40
|
});
|
|
122
|
-
(0, _keyboardShortcuts.useShortcut)('core/edit-post/transform-heading-to-paragraph', event => handleTextLevelShortcut(event, 0));
|
|
123
|
-
[1, 2, 3, 4, 5, 6].forEach(level => {
|
|
124
|
-
//the loop is based off on a constant therefore
|
|
125
|
-
//the hook will execute the same way every time
|
|
126
|
-
//eslint-disable-next-line react-hooks/rules-of-hooks
|
|
127
|
-
(0, _keyboardShortcuts.useShortcut)(`core/edit-post/transform-paragraph-to-heading-${level}`, event => handleTextLevelShortcut(event, level));
|
|
128
|
-
});
|
|
129
41
|
return null;
|
|
130
42
|
}
|
|
131
43
|
var _default = exports.default = KeyboardShortcuts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_keyboardShortcuts","_i18n","
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_keyboardShortcuts","_i18n","_store","KeyboardShortcuts","toggleFeature","useDispatch","editPostStore","registerShortcut","keyboardShortcutsStore","useEffect","name","category","description","__","keyCombination","modifier","character","useShortcut","_default","exports","default"],"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":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AAIA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGA,SAASK,iBAAiBA,CAAA,EAAG;EAC5B,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EACtD,MAAM;IAAEC;EAAiB,CAAC,GAAG,IAAAF,iBAAW,EAAEG,wBAAuB,CAAC;EAElE,IAAAC,kBAAS,EAAE,MAAM;IAChBF,gBAAgB,CAAE;MACjBG,IAAI,EAAE,kCAAkC;MACxCC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAE,IAAAC,QAAE,EAAE,yBAA0B,CAAC;MAC5CC,cAAc,EAAE;QACfC,QAAQ,EAAE,WAAW;QACrBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;EACJ,CAAC,EAAE,EAAG,CAAC;EAEP,IAAAC,8BAAW,EAAE,kCAAkC,EAAE,MAAM;IACtDb,aAAa,CAAE,gBAAiB,CAAC;EAClC,CAAE,CAAC;EAEH,OAAO,IAAI;AACZ;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcjB,iBAAiB","ignoreList":[]}
|