@wordpress/edit-post 7.25.0 → 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 +6 -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 +25 -25
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +11 -8
- 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 +33 -26
- 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 +25 -8
- 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 +2 -3
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +1 -7
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/editor.js +19 -28
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +3 -10
- 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 +19 -16
- package/build/index.js.map +1 -1
- package/build/index.native.js +7 -1
- package/build/index.native.js.map +1 -1
- package/build/store/actions.js +59 -73
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +1 -62
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +66 -38
- 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 +25 -25
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +11 -8
- 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 +33 -25
- 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 +25 -8
- 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 +3 -4
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +2 -8
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/editor.js +19 -28
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +3 -10
- 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 +17 -11
- 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/store/actions.js +55 -69
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +1 -60
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +58 -29
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +13 -284
- package/build-style/style.css +13 -284
- package/package.json +32 -32
- package/src/components/browser-url/index.js +4 -2
- package/src/components/header/index.js +24 -40
- package/src/components/header/style.scss +3 -3
- package/src/components/header/writing-menu/index.js +10 -8
- 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 +18 -27
- 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 +27 -9
- 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/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 +3 -3
- package/src/components/sidebar/settings-sidebar/index.js +15 -13
- package/src/components/text-editor/style.scss +0 -6
- package/src/editor.js +34 -33
- package/src/editor.native.js +2 -17
- package/src/hooks/commands/use-common-commands.js +14 -16
- package/src/hooks/use-post-history.js +73 -0
- package/src/index.js +22 -12
- package/src/index.native.js +8 -1
- package/src/store/actions.js +48 -85
- package/src/store/reducer.js +0 -60
- package/src/store/selectors.js +74 -46
- package/src/store/test/actions.js +10 -103
- package/src/store/test/reducer.js +1 -108
- package/src/store/test/selectors.js +0 -50
- package/src/style.scss +1 -5
- package/src/test/editor.native.js +17 -0
- package/build/components/header/header-toolbar/index.js +0 -160
- 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/view-link/index.js +0 -53
- package/build/components/view-link/index.js.map +0 -1
- package/build-module/components/header/header-toolbar/index.js +0 -152
- 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/view-link/index.js +0 -46
- package/build-module/components/view-link/index.js.map +0 -1
- package/src/components/header/header-toolbar/index.js +0 -186
- package/src/components/header/header-toolbar/style.scss +0 -116
- 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/view-link/index.js +0 -48
|
@@ -1,160 +0,0 @@
|
|
|
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 _compose = require("@wordpress/compose");
|
|
9
|
-
var _data = require("@wordpress/data");
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
12
|
-
var _editor = require("@wordpress/editor");
|
|
13
|
-
var _components = require("@wordpress/components");
|
|
14
|
-
var _icons = require("@wordpress/icons");
|
|
15
|
-
var _element = require("@wordpress/element");
|
|
16
|
-
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
17
|
-
var _store = require("../../../store");
|
|
18
|
-
var _lockUnlock = require("../../../lock-unlock");
|
|
19
|
-
/**
|
|
20
|
-
* WordPress dependencies
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Internal dependencies
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
const {
|
|
28
|
-
useShouldContextualToolbarShow
|
|
29
|
-
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
30
|
-
const preventDefault = event => {
|
|
31
|
-
event.preventDefault();
|
|
32
|
-
};
|
|
33
|
-
function HeaderToolbar({
|
|
34
|
-
hasFixedToolbar,
|
|
35
|
-
setListViewToggleElement
|
|
36
|
-
}) {
|
|
37
|
-
const inserterButton = (0, _element.useRef)();
|
|
38
|
-
const {
|
|
39
|
-
setIsInserterOpened,
|
|
40
|
-
setIsListViewOpened
|
|
41
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
42
|
-
const {
|
|
43
|
-
isInserterEnabled,
|
|
44
|
-
isInserterOpened,
|
|
45
|
-
isTextModeEnabled,
|
|
46
|
-
showIconLabels,
|
|
47
|
-
isListViewOpen,
|
|
48
|
-
listViewShortcut
|
|
49
|
-
} = (0, _data.useSelect)(select => {
|
|
50
|
-
const {
|
|
51
|
-
hasInserterItems,
|
|
52
|
-
getBlockRootClientId,
|
|
53
|
-
getBlockSelectionEnd
|
|
54
|
-
} = select(_blockEditor.store);
|
|
55
|
-
const {
|
|
56
|
-
getEditorSettings
|
|
57
|
-
} = select(_editor.store);
|
|
58
|
-
const {
|
|
59
|
-
getEditorMode,
|
|
60
|
-
isFeatureActive,
|
|
61
|
-
isListViewOpened
|
|
62
|
-
} = select(_store.store);
|
|
63
|
-
const {
|
|
64
|
-
getShortcutRepresentation
|
|
65
|
-
} = select(_keyboardShortcuts.store);
|
|
66
|
-
return {
|
|
67
|
-
// This setting (richEditingEnabled) should not live in the block editor's setting.
|
|
68
|
-
isInserterEnabled: getEditorMode() === 'visual' && getEditorSettings().richEditingEnabled && hasInserterItems(getBlockRootClientId(getBlockSelectionEnd())),
|
|
69
|
-
isInserterOpened: select(_store.store).isInserterOpened(),
|
|
70
|
-
isTextModeEnabled: getEditorMode() === 'text',
|
|
71
|
-
showIconLabels: isFeatureActive('showIconLabels'),
|
|
72
|
-
isListViewOpen: isListViewOpened(),
|
|
73
|
-
listViewShortcut: getShortcutRepresentation('core/edit-post/toggle-list-view')
|
|
74
|
-
};
|
|
75
|
-
}, []);
|
|
76
|
-
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
77
|
-
const isWideViewport = (0, _compose.useViewportMatch)('wide');
|
|
78
|
-
const {
|
|
79
|
-
shouldShowContextualToolbar,
|
|
80
|
-
canFocusHiddenToolbar,
|
|
81
|
-
fixedToolbarCanBeFocused
|
|
82
|
-
} = useShouldContextualToolbarShow();
|
|
83
|
-
// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
|
|
84
|
-
// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.
|
|
85
|
-
const blockToolbarCanBeFocused = shouldShowContextualToolbar || canFocusHiddenToolbar || fixedToolbarCanBeFocused;
|
|
86
|
-
/* translators: accessibility text for the editor toolbar */
|
|
87
|
-
const toolbarAriaLabel = (0, _i18n.__)('Document tools');
|
|
88
|
-
const toggleListView = (0, _element.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
89
|
-
const overflowItems = (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.ToolbarItem, {
|
|
90
|
-
as: _components.Button,
|
|
91
|
-
className: "edit-post-header-toolbar__document-overview-toggle",
|
|
92
|
-
icon: _icons.listView,
|
|
93
|
-
disabled: isTextModeEnabled,
|
|
94
|
-
isPressed: isListViewOpen
|
|
95
|
-
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
96
|
-
label: (0, _i18n.__)('Document Overview'),
|
|
97
|
-
onClick: toggleListView,
|
|
98
|
-
shortcut: listViewShortcut,
|
|
99
|
-
showTooltip: !showIconLabels,
|
|
100
|
-
variant: showIconLabels ? 'tertiary' : undefined,
|
|
101
|
-
"aria-expanded": isListViewOpen,
|
|
102
|
-
ref: setListViewToggleElement,
|
|
103
|
-
size: "compact"
|
|
104
|
-
}));
|
|
105
|
-
const toggleInserter = (0, _element.useCallback)(() => {
|
|
106
|
-
if (isInserterOpened) {
|
|
107
|
-
// Focusing the inserter button should close the inserter popover.
|
|
108
|
-
// However, there are some cases it won't close when the focus is lost.
|
|
109
|
-
// See https://github.com/WordPress/gutenberg/issues/43090 for more details.
|
|
110
|
-
inserterButton.current.focus();
|
|
111
|
-
setIsInserterOpened(false);
|
|
112
|
-
} else {
|
|
113
|
-
setIsInserterOpened(true);
|
|
114
|
-
}
|
|
115
|
-
}, [isInserterOpened, setIsInserterOpened]);
|
|
116
|
-
|
|
117
|
-
/* translators: button label text should, if possible, be under 16 characters. */
|
|
118
|
-
const longLabel = (0, _i18n._x)('Toggle block inserter', 'Generic label for block inserter button');
|
|
119
|
-
const shortLabel = !isInserterOpened ? (0, _i18n.__)('Add') : (0, _i18n.__)('Close');
|
|
120
|
-
return (0, _react.createElement)(_blockEditor.NavigableToolbar, {
|
|
121
|
-
className: "edit-post-header-toolbar",
|
|
122
|
-
"aria-label": toolbarAriaLabel,
|
|
123
|
-
shouldUseKeyboardFocusShortcut: !blockToolbarCanBeFocused,
|
|
124
|
-
variant: "unstyled"
|
|
125
|
-
}, (0, _react.createElement)("div", {
|
|
126
|
-
className: "edit-post-header-toolbar__left"
|
|
127
|
-
}, (0, _react.createElement)(_components.ToolbarItem, {
|
|
128
|
-
ref: inserterButton,
|
|
129
|
-
as: _components.Button,
|
|
130
|
-
className: "edit-post-header-toolbar__inserter-toggle",
|
|
131
|
-
variant: "primary",
|
|
132
|
-
isPressed: isInserterOpened,
|
|
133
|
-
onMouseDown: preventDefault,
|
|
134
|
-
onClick: toggleInserter,
|
|
135
|
-
disabled: !isInserterEnabled,
|
|
136
|
-
icon: _icons.plus,
|
|
137
|
-
label: showIconLabels ? shortLabel : longLabel,
|
|
138
|
-
showTooltip: !showIconLabels,
|
|
139
|
-
"aria-expanded": isInserterOpened
|
|
140
|
-
}), (isWideViewport || !showIconLabels) && (0, _react.createElement)(_react.Fragment, null, isLargeViewport && !hasFixedToolbar && (0, _react.createElement)(_components.ToolbarItem, {
|
|
141
|
-
as: _blockEditor.ToolSelector,
|
|
142
|
-
showTooltip: !showIconLabels,
|
|
143
|
-
variant: showIconLabels ? 'tertiary' : undefined,
|
|
144
|
-
disabled: isTextModeEnabled,
|
|
145
|
-
size: "compact"
|
|
146
|
-
}), (0, _react.createElement)(_components.ToolbarItem, {
|
|
147
|
-
as: _editor.EditorHistoryUndo,
|
|
148
|
-
showTooltip: !showIconLabels,
|
|
149
|
-
variant: showIconLabels ? 'tertiary' : undefined,
|
|
150
|
-
size: "compact"
|
|
151
|
-
}), (0, _react.createElement)(_components.ToolbarItem, {
|
|
152
|
-
as: _editor.EditorHistoryRedo,
|
|
153
|
-
showTooltip: !showIconLabels,
|
|
154
|
-
variant: showIconLabels ? 'tertiary' : undefined,
|
|
155
|
-
size: "compact"
|
|
156
|
-
}), overflowItems)));
|
|
157
|
-
}
|
|
158
|
-
var _default = HeaderToolbar;
|
|
159
|
-
exports.default = _default;
|
|
160
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_data","_i18n","_blockEditor","_editor","_components","_icons","_element","_keyboardShortcuts","_store","_lockUnlock","useShouldContextualToolbarShow","unlock","blockEditorPrivateApis","preventDefault","event","HeaderToolbar","hasFixedToolbar","setListViewToggleElement","inserterButton","useRef","setIsInserterOpened","setIsListViewOpened","useDispatch","editPostStore","isInserterEnabled","isInserterOpened","isTextModeEnabled","showIconLabels","isListViewOpen","listViewShortcut","useSelect","select","hasInserterItems","getBlockRootClientId","getBlockSelectionEnd","blockEditorStore","getEditorSettings","editorStore","getEditorMode","isFeatureActive","isListViewOpened","getShortcutRepresentation","keyboardShortcutsStore","richEditingEnabled","isLargeViewport","useViewportMatch","isWideViewport","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","toolbarAriaLabel","__","toggleListView","useCallback","overflowItems","_react","createElement","Fragment","ToolbarItem","as","Button","className","icon","listView","disabled","isPressed","label","onClick","shortcut","showTooltip","variant","undefined","ref","size","toggleInserter","current","focus","longLabel","_x","shortLabel","NavigableToolbar","shouldUseKeyboardFocusShortcut","onMouseDown","plus","ToolSelector","EditorHistoryUndo","EditorHistoryRedo","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tNavigableToolbar,\n\tToolSelector,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tEditorHistoryRedo,\n\tEditorHistoryUndo,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useRef, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction HeaderToolbar( { hasFixedToolbar, setListViewToggleElement } ) {\n\tconst inserterButton = useRef();\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst {\n\t\tisInserterEnabled,\n\t\tisInserterOpened,\n\t\tisTextModeEnabled,\n\t\tshowIconLabels,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t} = useSelect( ( select ) => {\n\t\tconst { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst { getEditorMode, isFeatureActive, isListViewOpened } =\n\t\t\tselect( editPostStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tisInserterEnabled:\n\t\t\t\tgetEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisTextModeEnabled: getEditorMode() === 'text',\n\t\t\tshowIconLabels: isFeatureActive( 'showIconLabels' ),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-post/toggle-list-view'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\tconst overflowItems = (\n\t\t<>\n\t\t\t<ToolbarItem\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-post-header-toolbar__document-overview-toggle\"\n\t\t\t\ticon={ listView }\n\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\tlabel={ __( 'Document Overview' ) }\n\t\t\t\tonClick={ toggleListView }\n\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\taria-expanded={ isListViewOpen }\n\t\t\t\tref={ setListViewToggleElement }\n\t\t\t\tsize=\"compact\"\n\t\t\t/>\n\t\t</>\n\t);\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpened ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpened, setIsInserterOpened ] );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-post-header-toolbar\"\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"edit-post-header-toolbar__left\">\n\t\t\t\t<ToolbarItem\n\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tclassName=\"edit-post-header-toolbar__inserter-toggle\"\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\tdisabled={ ! isInserterEnabled }\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\taria-expanded={ isInserterOpened }\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{ isLargeViewport && ! hasFixedToolbar && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ isTextModeEnabled }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ overflowItems }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default HeaderToolbar;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAMA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AA1BA;AACA;AACA;;AAoBA;AACA;AACA;;AAIA,MAAM;EAAEW;AAA+B,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE3E,MAAMC,cAAc,G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,EAAE,EAAGyB,yBAAc;IACnBf,WAAW,EAAG,CAAE3C,cAAgB;IAChC4C,OAAO,EACN5C,cAAc,GAAG,UAAU,GAAG6C,SAC9B;IACDP,QAAQ,EAAGvC,iBAAmB;IAC9BgD,IAAI,EAAC;EAAS,CACd,CACD,EACD,IAAAlB,MAAA,CAAAC,aAAA,EAACrD,WAAA,CAAAuD,WAAW;IACXC,EAAE,EAAG0B,yBAAmB;IACxBhB,WAAW,EAAG,CAAE3C,cAAgB;IAChC4C,OAAO,EAAG5C,cAAc,GAAG,UAAU,GAAG6C,SAAW;IACnDE,IAAI,EAAC;EAAS,CACd,CAAC,EACF,IAAAlB,MAAA,CAAAC,aAAA,EAACrD,WAAA,CAAAuD,WAAW;IACXC,EAAE,EAAG2B,yBAAmB;IACxBjB,WAAW,EAAG,CAAE3C,cAAgB;IAChC4C,OAAO,EAAG5C,cAAc,GAAG,UAAU,GAAG6C,SAAW;IACnDE,IAAI,EAAC;EAAS,CACd,CAAC,EACAnB,aACD,CAEC,CACY,CAAC;AAErB;AAAC,IAAAiC,QAAA,GAEczE,aAAa;AAAA0E,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = InserterSidebar;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _data = require("@wordpress/data");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
11
|
-
var _icons = require("@wordpress/icons");
|
|
12
|
-
var _compose = require("@wordpress/compose");
|
|
13
|
-
var _i18n = require("@wordpress/i18n");
|
|
14
|
-
var _element = require("@wordpress/element");
|
|
15
|
-
var _store = require("../../store");
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
function InserterSidebar() {
|
|
25
|
-
const {
|
|
26
|
-
insertionPoint,
|
|
27
|
-
showMostUsedBlocks
|
|
28
|
-
} = (0, _data.useSelect)(select => {
|
|
29
|
-
const {
|
|
30
|
-
isFeatureActive,
|
|
31
|
-
__experimentalGetInsertionPoint
|
|
32
|
-
} = select(_store.store);
|
|
33
|
-
return {
|
|
34
|
-
insertionPoint: __experimentalGetInsertionPoint(),
|
|
35
|
-
showMostUsedBlocks: isFeatureActive('mostUsedBlocks')
|
|
36
|
-
};
|
|
37
|
-
}, []);
|
|
38
|
-
const {
|
|
39
|
-
setIsInserterOpened
|
|
40
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
41
|
-
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
42
|
-
const TagName = !isMobileViewport ? _components.VisuallyHidden : 'div';
|
|
43
|
-
const [inserterDialogRef, inserterDialogProps] = (0, _compose.__experimentalUseDialog)({
|
|
44
|
-
onClose: () => setIsInserterOpened(false),
|
|
45
|
-
focusOnMount: null
|
|
46
|
-
});
|
|
47
|
-
const libraryRef = (0, _element.useRef)();
|
|
48
|
-
(0, _element.useEffect)(() => {
|
|
49
|
-
libraryRef.current.focusSearch();
|
|
50
|
-
}, []);
|
|
51
|
-
return (0, _react.createElement)("div", {
|
|
52
|
-
ref: inserterDialogRef,
|
|
53
|
-
...inserterDialogProps,
|
|
54
|
-
className: "edit-post-editor__inserter-panel"
|
|
55
|
-
}, (0, _react.createElement)(TagName, {
|
|
56
|
-
className: "edit-post-editor__inserter-panel-header"
|
|
57
|
-
}, (0, _react.createElement)(_components.Button, {
|
|
58
|
-
icon: _icons.close,
|
|
59
|
-
label: (0, _i18n.__)('Close block inserter'),
|
|
60
|
-
onClick: () => setIsInserterOpened(false)
|
|
61
|
-
})), (0, _react.createElement)("div", {
|
|
62
|
-
className: "edit-post-editor__inserter-panel-content"
|
|
63
|
-
}, (0, _react.createElement)(_blockEditor.__experimentalLibrary, {
|
|
64
|
-
showMostUsedBlocks: showMostUsedBlocks,
|
|
65
|
-
showInserterHelpPanel: true,
|
|
66
|
-
shouldFocusBlock: isMobileViewport,
|
|
67
|
-
rootClientId: insertionPoint.rootClientId,
|
|
68
|
-
__experimentalInsertionIndex: insertionPoint.insertionIndex,
|
|
69
|
-
__experimentalFilterValue: insertionPoint.filterValue,
|
|
70
|
-
ref: libraryRef
|
|
71
|
-
})));
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=inserter-sidebar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_components","_blockEditor","_icons","_compose","_i18n","_element","_store","InserterSidebar","insertionPoint","showMostUsedBlocks","useSelect","select","isFeatureActive","__experimentalGetInsertionPoint","editPostStore","setIsInserterOpened","useDispatch","isMobileViewport","useViewportMatch","TagName","VisuallyHidden","inserterDialogRef","inserterDialogProps","useDialog","onClose","focusOnMount","libraryRef","useRef","useEffect","current","focusSearch","_react","createElement","ref","className","Button","icon","close","label","__","onClick","__experimentalLibrary","showInserterHelpPanel","shouldFocusBlock","rootClientId","__experimentalInsertionIndex","insertionIndex","__experimentalFilterValue","filterValue"],"sources":["@wordpress/edit-post/src/components/secondary-sidebar/inserter-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { close } from '@wordpress/icons';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst { insertionPoint, showMostUsedBlocks } = useSelect( ( select ) => {\n\t\tconst { isFeatureActive, __experimentalGetInsertionPoint } =\n\t\t\tselect( editPostStore );\n\t\treturn {\n\t\t\tinsertionPoint: __experimentalGetInsertionPoint(),\n\t\t\tshowMostUsedBlocks: isFeatureActive( 'mostUsedBlocks' ),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editPostStore );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst TagName = ! isMobileViewport ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: () => setIsInserterOpened( false ),\n\t\tfocusOnMount: null,\n\t} );\n\n\tconst libraryRef = useRef();\n\tuseEffect( () => {\n\t\tlibraryRef.current.focusSearch();\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-post-editor__inserter-panel\"\n\t\t>\n\t\t\t<TagName className=\"edit-post-editor__inserter-panel-header\">\n\t\t\t\t<Button\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tlabel={ __( 'Close block inserter' ) }\n\t\t\t\t\tonClick={ () => setIsInserterOpened( false ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"edit-post-editor__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFilterValue={ insertionPoint.filterValue }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE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AAA,CAAAC,aAAA,EAACb,OAAO;IAACe,SAAS,EAAC;EAAyC,GAC3D,IAAAH,MAAA,CAAAC,aAAA,EAAChC,WAAA,CAAAmC,MAAM;IACNC,IAAI,EAAGC,YAAO;IACdC,KAAK,EAAG,IAAAC,QAAE,EAAE,sBAAuB,CAAG;IACtCC,OAAO,EAAGA,CAAA,KAAMzB,mBAAmB,CAAE,KAAM;EAAG,CAC9C,CACO,CAAC,EACV,IAAAgB,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAA0C,GACxD,IAAAH,MAAA,CAAAC,aAAA,EAAC/B,YAAA,CAAAwC,qBAAO;IACPhC,kBAAkB,EAAGA,kBAAoB;IACzCiC,qBAAqB;IACrBC,gBAAgB,EAAG1B,gBAAkB;IACrC2B,YAAY,EAAGpC,cAAc,CAACoC,YAAc;IAC5CC,4BAA4B,EAC3BrC,cAAc,CAACsC,cACf;IACDC,yBAAyB,EAAGvC,cAAc,CAACwC,WAAa;IACxDf,GAAG,EAAGP;EAAY,CAClB,CACG,CACD,CAAC;AAER"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = ListViewOutline;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _data = require("@wordpress/data");
|
|
9
|
-
var _editor = require("@wordpress/editor");
|
|
10
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
11
|
-
var _components = require("@wordpress/components");
|
|
12
|
-
var _i18n = require("@wordpress/i18n");
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
function EmptyOutlineIllustration() {
|
|
18
|
-
return (0, _react.createElement)(_components.SVG, {
|
|
19
|
-
width: "138",
|
|
20
|
-
height: "148",
|
|
21
|
-
viewBox: "0 0 138 148",
|
|
22
|
-
fill: "none",
|
|
23
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
24
|
-
}, (0, _react.createElement)(_components.Rect, {
|
|
25
|
-
width: "138",
|
|
26
|
-
height: "148",
|
|
27
|
-
rx: "4",
|
|
28
|
-
fill: "#F0F6FC"
|
|
29
|
-
}), (0, _react.createElement)(_components.Line, {
|
|
30
|
-
x1: "44",
|
|
31
|
-
y1: "28",
|
|
32
|
-
x2: "24",
|
|
33
|
-
y2: "28",
|
|
34
|
-
stroke: "#DDDDDD"
|
|
35
|
-
}), (0, _react.createElement)(_components.Rect, {
|
|
36
|
-
x: "48",
|
|
37
|
-
y: "16",
|
|
38
|
-
width: "27",
|
|
39
|
-
height: "23",
|
|
40
|
-
rx: "4",
|
|
41
|
-
fill: "#DDDDDD"
|
|
42
|
-
}), (0, _react.createElement)(_components.Path, {
|
|
43
|
-
d: "M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z",
|
|
44
|
-
fill: "black"
|
|
45
|
-
}), (0, _react.createElement)(_components.Line, {
|
|
46
|
-
x1: "55",
|
|
47
|
-
y1: "59",
|
|
48
|
-
x2: "24",
|
|
49
|
-
y2: "59",
|
|
50
|
-
stroke: "#DDDDDD"
|
|
51
|
-
}), (0, _react.createElement)(_components.Rect, {
|
|
52
|
-
x: "59",
|
|
53
|
-
y: "47",
|
|
54
|
-
width: "29",
|
|
55
|
-
height: "23",
|
|
56
|
-
rx: "4",
|
|
57
|
-
fill: "#DDDDDD"
|
|
58
|
-
}), (0, _react.createElement)(_components.Path, {
|
|
59
|
-
d: "M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z",
|
|
60
|
-
fill: "black"
|
|
61
|
-
}), (0, _react.createElement)(_components.Line, {
|
|
62
|
-
x1: "80",
|
|
63
|
-
y1: "90",
|
|
64
|
-
x2: "24",
|
|
65
|
-
y2: "90",
|
|
66
|
-
stroke: "#DDDDDD"
|
|
67
|
-
}), (0, _react.createElement)(_components.Rect, {
|
|
68
|
-
x: "84",
|
|
69
|
-
y: "78",
|
|
70
|
-
width: "30",
|
|
71
|
-
height: "23",
|
|
72
|
-
rx: "4",
|
|
73
|
-
fill: "#F0B849"
|
|
74
|
-
}), (0, _react.createElement)(_components.Path, {
|
|
75
|
-
d: "M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z",
|
|
76
|
-
fill: "black"
|
|
77
|
-
}), (0, _react.createElement)(_components.Line, {
|
|
78
|
-
x1: "66",
|
|
79
|
-
y1: "121",
|
|
80
|
-
x2: "24",
|
|
81
|
-
y2: "121",
|
|
82
|
-
stroke: "#DDDDDD"
|
|
83
|
-
}), (0, _react.createElement)(_components.Rect, {
|
|
84
|
-
x: "70",
|
|
85
|
-
y: "109",
|
|
86
|
-
width: "29",
|
|
87
|
-
height: "23",
|
|
88
|
-
rx: "4",
|
|
89
|
-
fill: "#DDDDDD"
|
|
90
|
-
}), (0, _react.createElement)(_components.Path, {
|
|
91
|
-
d: "M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z",
|
|
92
|
-
fill: "black"
|
|
93
|
-
}));
|
|
94
|
-
}
|
|
95
|
-
function ListViewOutline() {
|
|
96
|
-
const {
|
|
97
|
-
headingCount
|
|
98
|
-
} = (0, _data.useSelect)(select => {
|
|
99
|
-
const {
|
|
100
|
-
getGlobalBlockCount
|
|
101
|
-
} = select(_blockEditor.store);
|
|
102
|
-
return {
|
|
103
|
-
headingCount: getGlobalBlockCount('core/heading')
|
|
104
|
-
};
|
|
105
|
-
}, []);
|
|
106
|
-
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
|
|
107
|
-
className: "edit-post-editor__list-view-overview"
|
|
108
|
-
}, (0, _react.createElement)("div", null, (0, _react.createElement)(_components.__experimentalText, null, (0, _i18n.__)('Characters:')), (0, _react.createElement)(_components.__experimentalText, null, (0, _react.createElement)(_editor.CharacterCount, null))), (0, _react.createElement)("div", null, (0, _react.createElement)(_components.__experimentalText, null, (0, _i18n.__)('Words:')), (0, _react.createElement)(_editor.WordCount, null)), (0, _react.createElement)("div", null, (0, _react.createElement)(_components.__experimentalText, null, (0, _i18n.__)('Time to read:')), (0, _react.createElement)(_editor.TimeToRead, null))), headingCount > 0 ? (0, _react.createElement)(_editor.DocumentOutline, null) : (0, _react.createElement)("div", {
|
|
109
|
-
className: "edit-post-editor__list-view-empty-headings"
|
|
110
|
-
}, (0, _react.createElement)(EmptyOutlineIllustration, null), (0, _react.createElement)("p", null, (0, _i18n.__)('Navigate the structure of your document and address issues like empty or incorrect heading levels.'))));
|
|
111
|
-
}
|
|
112
|
-
//# sourceMappingURL=list-view-outline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_editor","_blockEditor","_components","_i18n","EmptyOutlineIllustration","_react","createElement","SVG","width","height","viewBox","fill","xmlns","Rect","rx","Line","x1","y1","x2","y2","stroke","x","y","Path","d","ListViewOutline","headingCount","useSelect","select","getGlobalBlockCount","blockEditorStore","Fragment","className","__experimentalText","__","CharacterCount","WordCount","TimeToRead","DocumentOutline"],"sources":["@wordpress/edit-post/src/components/secondary-sidebar/list-view-outline.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tDocumentOutline,\n\tWordCount,\n\tTimeToRead,\n\tCharacterCount,\n} from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\t__experimentalText as Text,\n\tPath,\n\tSVG,\n\tLine,\n\tRect,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nfunction EmptyOutlineIllustration() {\n\treturn (\n\t\t<SVG\n\t\t\twidth=\"138\"\n\t\t\theight=\"148\"\n\t\t\tviewBox=\"0 0 138 148\"\n\t\t\tfill=\"none\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t>\n\t\t\t<Rect width=\"138\" height=\"148\" rx=\"4\" fill=\"#F0F6FC\" />\n\t\t\t<Line x1=\"44\" y1=\"28\" x2=\"24\" y2=\"28\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"48\" y=\"16\" width=\"27\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"55\" y1=\"59\" x2=\"24\" y2=\"59\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"59\" y=\"47\" width=\"29\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"80\" y1=\"90\" x2=\"24\" y2=\"90\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"84\" y=\"78\" width=\"30\" height=\"23\" rx=\"4\" fill=\"#F0B849\" />\n\t\t\t<Path\n\t\t\t\td=\"M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t\t<Line x1=\"66\" y1=\"121\" x2=\"24\" y2=\"121\" stroke=\"#DDDDDD\" />\n\t\t\t<Rect x=\"70\" y=\"109\" width=\"29\" height=\"23\" rx=\"4\" fill=\"#DDDDDD\" />\n\t\t\t<Path\n\t\t\t\td=\"M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z\"\n\t\t\t\tfill=\"black\"\n\t\t\t/>\n\t\t</SVG>\n\t);\n}\n\nexport default function ListViewOutline() {\n\tconst { headingCount } = useSelect( ( select ) => {\n\t\tconst { getGlobalBlockCount } = select( blockEditorStore );\n\t\treturn {\n\t\t\theadingCount: getGlobalBlockCount( 'core/heading' ),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-post-editor__list-view-overview\">\n\t\t\t\t<div>\n\t\t\t\t\t<Text>{ __( 'Characters:' ) }</Text>\n\t\t\t\t\t<Text>\n\t\t\t\t\t\t<CharacterCount />\n\t\t\t\t\t</Text>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<Text>{ __( 'Words:' ) }</Text>\n\t\t\t\t\t<WordCount />\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<Text>{ __( 'Time to read:' ) }</Text>\n\t\t\t\t\t<TimeToRead />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{ headingCount > 0 ? (\n\t\t\t\t<DocumentOutline />\n\t\t\t) : (\n\t\t\t\t<div className=\"edit-post-editor__list-view-empty-headings\">\n\t\t\t\t\t<EmptyOutlineIllustration />\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Navigate the structure of your document and address issues like empty or incorrect heading levels.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t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,aAAA,EAACJ,WAAA,CAAA+B,kBAAI,QAAG,IAAAC,QAAE,EAAE,eAAgB,CAAS,CAAC,EACtC,IAAA7B,MAAA,CAAAC,aAAA,EAACN,OAAA,CAAAqC,UAAU,MAAE,CACT,CACD,CAAC,EACJX,YAAY,GAAG,CAAC,GACjB,IAAArB,MAAA,CAAAC,aAAA,EAACN,OAAA,CAAAsC,eAAe,MAAE,CAAC,GAEnB,IAAAjC,MAAA,CAAAC,aAAA;IAAK0B,SAAS,EAAC;EAA4C,GAC1D,IAAA3B,MAAA,CAAAC,aAAA,EAACF,wBAAwB,MAAE,CAAC,EAC5B,IAAAC,MAAA,CAAAC,aAAA,aACG,IAAA4B,QAAE,EACH,oGACD,CACE,CACC,CAEL,CAAC;AAEL"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = ListViewSidebar;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
10
|
-
var _components = require("@wordpress/components");
|
|
11
|
-
var _compose = require("@wordpress/compose");
|
|
12
|
-
var _data = require("@wordpress/data");
|
|
13
|
-
var _dom = require("@wordpress/dom");
|
|
14
|
-
var _element = require("@wordpress/element");
|
|
15
|
-
var _i18n = require("@wordpress/i18n");
|
|
16
|
-
var _icons = require("@wordpress/icons");
|
|
17
|
-
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
18
|
-
var _keycodes = require("@wordpress/keycodes");
|
|
19
|
-
var _store = require("../../store");
|
|
20
|
-
var _listViewOutline = _interopRequireDefault(require("./list-view-outline"));
|
|
21
|
-
/**
|
|
22
|
-
* WordPress dependencies
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Internal dependencies
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
function ListViewSidebar({
|
|
30
|
-
listViewToggleElement
|
|
31
|
-
}) {
|
|
32
|
-
const {
|
|
33
|
-
setIsListViewOpened
|
|
34
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
35
|
-
|
|
36
|
-
// This hook handles focus when the sidebar first renders.
|
|
37
|
-
const focusOnMountRef = (0, _compose.useFocusOnMount)('firstElement');
|
|
38
|
-
|
|
39
|
-
// When closing the list view, focus should return to the toggle button.
|
|
40
|
-
const closeListView = (0, _element.useCallback)(() => {
|
|
41
|
-
setIsListViewOpened(false);
|
|
42
|
-
listViewToggleElement?.focus();
|
|
43
|
-
}, [listViewToggleElement, setIsListViewOpened]);
|
|
44
|
-
const closeOnEscape = (0, _element.useCallback)(event => {
|
|
45
|
-
if (event.keyCode === _keycodes.ESCAPE && !event.defaultPrevented) {
|
|
46
|
-
event.preventDefault();
|
|
47
|
-
closeListView();
|
|
48
|
-
}
|
|
49
|
-
}, [closeListView]);
|
|
50
|
-
|
|
51
|
-
// Use internal state instead of a ref to make sure that the component
|
|
52
|
-
// re-renders when the dropZoneElement updates.
|
|
53
|
-
const [dropZoneElement, setDropZoneElement] = (0, _element.useState)(null);
|
|
54
|
-
// Tracks our current tab.
|
|
55
|
-
const [tab, setTab] = (0, _element.useState)('list-view');
|
|
56
|
-
|
|
57
|
-
// This ref refers to the sidebar as a whole.
|
|
58
|
-
const sidebarRef = (0, _element.useRef)();
|
|
59
|
-
// This ref refers to the tab panel.
|
|
60
|
-
const tabPanelRef = (0, _element.useRef)();
|
|
61
|
-
// This ref refers to the list view application area.
|
|
62
|
-
const listViewRef = (0, _element.useRef)();
|
|
63
|
-
|
|
64
|
-
// Must merge the refs together so focus can be handled properly in the next function.
|
|
65
|
-
const listViewContainerRef = (0, _compose.useMergeRefs)([focusOnMountRef, listViewRef, setDropZoneElement]);
|
|
66
|
-
|
|
67
|
-
/*
|
|
68
|
-
* Callback function to handle list view or outline focus.
|
|
69
|
-
*
|
|
70
|
-
* @param {string} currentTab The current tab. Either list view or outline.
|
|
71
|
-
*
|
|
72
|
-
* @return void
|
|
73
|
-
*/
|
|
74
|
-
function handleSidebarFocus(currentTab) {
|
|
75
|
-
// Tab panel focus.
|
|
76
|
-
const tabPanelFocus = _dom.focus.tabbable.find(tabPanelRef.current)[0];
|
|
77
|
-
// List view tab is selected.
|
|
78
|
-
if (currentTab === 'list-view') {
|
|
79
|
-
// Either focus the list view or the tab panel. Must have a fallback because the list view does not render when there are no blocks.
|
|
80
|
-
const listViewApplicationFocus = _dom.focus.tabbable.find(listViewRef.current)[0];
|
|
81
|
-
const listViewFocusArea = sidebarRef.current.contains(listViewApplicationFocus) ? listViewApplicationFocus : tabPanelFocus;
|
|
82
|
-
listViewFocusArea.focus();
|
|
83
|
-
// Outline tab is selected.
|
|
84
|
-
} else {
|
|
85
|
-
tabPanelFocus.focus();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
const handleToggleListViewShortcut = (0, _element.useCallback)(() => {
|
|
89
|
-
// If the sidebar has focus, it is safe to close.
|
|
90
|
-
if (sidebarRef.current.contains(sidebarRef.current.ownerDocument.activeElement)) {
|
|
91
|
-
closeListView();
|
|
92
|
-
} else {
|
|
93
|
-
// If the list view or outline does not have focus, focus should be moved to it.
|
|
94
|
-
handleSidebarFocus(tab);
|
|
95
|
-
}
|
|
96
|
-
}, [closeListView, tab]);
|
|
97
|
-
|
|
98
|
-
// This only fires when the sidebar is open because of the conditional rendering.
|
|
99
|
-
// It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed.
|
|
100
|
-
(0, _keyboardShortcuts.useShortcut)('core/edit-post/toggle-list-view', handleToggleListViewShortcut);
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Render tab content for a given tab name.
|
|
104
|
-
*
|
|
105
|
-
* @param {string} tabName The name of the tab to render.
|
|
106
|
-
*/
|
|
107
|
-
function renderTabContent(tabName) {
|
|
108
|
-
if (tabName === 'list-view') {
|
|
109
|
-
return (0, _react.createElement)("div", {
|
|
110
|
-
className: "edit-post-editor__list-view-panel-content"
|
|
111
|
-
}, (0, _react.createElement)(_blockEditor.__experimentalListView, {
|
|
112
|
-
dropZoneElement: dropZoneElement
|
|
113
|
-
}));
|
|
114
|
-
}
|
|
115
|
-
return (0, _react.createElement)(_listViewOutline.default, null);
|
|
116
|
-
}
|
|
117
|
-
return (
|
|
118
|
-
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
119
|
-
(0, _react.createElement)("div", {
|
|
120
|
-
className: "edit-post-editor__document-overview-panel",
|
|
121
|
-
onKeyDown: closeOnEscape,
|
|
122
|
-
ref: sidebarRef
|
|
123
|
-
}, (0, _react.createElement)(_components.Button, {
|
|
124
|
-
className: "edit-post-editor__document-overview-panel__close-button",
|
|
125
|
-
icon: _icons.closeSmall,
|
|
126
|
-
label: (0, _i18n.__)('Close'),
|
|
127
|
-
onClick: closeListView
|
|
128
|
-
}), (0, _react.createElement)(_components.TabPanel, {
|
|
129
|
-
className: "edit-post-editor__document-overview-panel__tab-panel",
|
|
130
|
-
ref: tabPanelRef,
|
|
131
|
-
onSelect: tabName => setTab(tabName),
|
|
132
|
-
selectOnMove: false,
|
|
133
|
-
tabs: [{
|
|
134
|
-
name: 'list-view',
|
|
135
|
-
title: (0, _i18n._x)('List View', 'Post overview'),
|
|
136
|
-
className: 'edit-post-sidebar__panel-tab'
|
|
137
|
-
}, {
|
|
138
|
-
name: 'outline',
|
|
139
|
-
title: (0, _i18n._x)('Outline', 'Post overview'),
|
|
140
|
-
className: 'edit-post-sidebar__panel-tab'
|
|
141
|
-
}]
|
|
142
|
-
}, currentTab => (0, _react.createElement)("div", {
|
|
143
|
-
className: "edit-post-editor__list-view-container",
|
|
144
|
-
ref: listViewContainerRef
|
|
145
|
-
}, renderTabContent(currentTab.name))))
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
//# sourceMappingURL=list-view-sidebar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_components","_compose","_data","_dom","_element","_i18n","_icons","_keyboardShortcuts","_keycodes","_store","_listViewOutline","_interopRequireDefault","ListViewSidebar","listViewToggleElement","setIsListViewOpened","useDispatch","editPostStore","focusOnMountRef","useFocusOnMount","closeListView","useCallback","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","dropZoneElement","setDropZoneElement","useState","tab","setTab","sidebarRef","useRef","tabPanelRef","listViewRef","listViewContainerRef","useMergeRefs","handleSidebarFocus","currentTab","tabPanelFocus","tabbable","find","current","listViewApplicationFocus","listViewFocusArea","contains","handleToggleListViewShortcut","ownerDocument","activeElement","useShortcut","renderTabContent","tabName","_react","createElement","className","__experimentalListView","default","onKeyDown","ref","Button","icon","closeSmall","label","__","onClick","TabPanel","onSelect","selectOnMove","tabs","name","title","_x"],"sources":["@wordpress/edit-post/src/components/secondary-sidebar/list-view-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button, TabPanel } from '@wordpress/components';\nimport { useFocusOnMount, useMergeRefs } from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { focus } from '@wordpress/dom';\nimport { useCallback, useRef, useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport ListViewOutline from './list-view-outline';\n\nexport default function ListViewSidebar( { listViewToggleElement } ) {\n\tconst { setIsListViewOpened } = useDispatch( editPostStore );\n\n\t// This hook handles focus when the sidebar first renders.\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\t// When closing the list view, focus should return to the toggle button.\n\tconst closeListView = useCallback( () => {\n\t\tsetIsListViewOpened( false );\n\t\tlistViewToggleElement?.focus();\n\t}, [ listViewToggleElement, setIsListViewOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseListView();\n\t\t\t}\n\t\t},\n\t\t[ closeListView ]\n\t);\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the dropZoneElement updates.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\t// Tracks our current tab.\n\tconst [ tab, setTab ] = useState( 'list-view' );\n\n\t// This ref refers to the sidebar as a whole.\n\tconst sidebarRef = useRef();\n\t// This ref refers to the tab panel.\n\tconst tabPanelRef = useRef();\n\t// This ref refers to the list view application area.\n\tconst listViewRef = useRef();\n\n\t// Must merge the refs together so focus can be handled properly in the next function.\n\tconst listViewContainerRef = useMergeRefs( [\n\t\tfocusOnMountRef,\n\t\tlistViewRef,\n\t\tsetDropZoneElement,\n\t] );\n\n\t/*\n\t * Callback function to handle list view or outline focus.\n\t *\n\t * @param {string} currentTab The current tab. Either list view or outline.\n\t *\n\t * @return void\n\t */\n\tfunction handleSidebarFocus( currentTab ) {\n\t\t// Tab panel focus.\n\t\tconst tabPanelFocus = focus.tabbable.find( tabPanelRef.current )[ 0 ];\n\t\t// List view tab is selected.\n\t\tif ( currentTab === 'list-view' ) {\n\t\t\t// Either focus the list view or the tab panel. Must have a fallback because the list view does not render when there are no blocks.\n\t\t\tconst listViewApplicationFocus = focus.tabbable.find(\n\t\t\t\tlistViewRef.current\n\t\t\t)[ 0 ];\n\t\t\tconst listViewFocusArea = sidebarRef.current.contains(\n\t\t\t\tlistViewApplicationFocus\n\t\t\t)\n\t\t\t\t? listViewApplicationFocus\n\t\t\t\t: tabPanelFocus;\n\t\t\tlistViewFocusArea.focus();\n\t\t\t// Outline tab is selected.\n\t\t} else {\n\t\t\ttabPanelFocus.focus();\n\t\t}\n\t}\n\n\tconst handleToggleListViewShortcut = useCallback( () => {\n\t\t// If the sidebar has focus, it is safe to close.\n\t\tif (\n\t\t\tsidebarRef.current.contains(\n\t\t\t\tsidebarRef.current.ownerDocument.activeElement\n\t\t\t)\n\t\t) {\n\t\t\tcloseListView();\n\t\t} else {\n\t\t\t// If the list view or outline does not have focus, focus should be moved to it.\n\t\t\thandleSidebarFocus( tab );\n\t\t}\n\t}, [ closeListView, tab ] );\n\n\t// This only fires when the sidebar is open because of the conditional rendering.\n\t// It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed.\n\tuseShortcut(\n\t\t'core/edit-post/toggle-list-view',\n\t\thandleToggleListViewShortcut\n\t);\n\n\t/**\n\t * Render tab content for a given tab name.\n\t *\n\t * @param {string} tabName The name of the tab to render.\n\t */\n\tfunction renderTabContent( tabName ) {\n\t\tif ( tabName === 'list-view' ) {\n\t\t\treturn (\n\t\t\t\t<div className=\"edit-post-editor__list-view-panel-content\">\n\t\t\t\t\t<ListView dropZoneElement={ dropZoneElement } />\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\t\treturn <ListViewOutline />;\n\t}\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"edit-post-editor__document-overview-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t\tref={ sidebarRef }\n\t\t>\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-editor__document-overview-panel__close-button\"\n\t\t\t\ticon={ closeSmall }\n\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\tonClick={ closeListView }\n\t\t\t/>\n\t\t\t<TabPanel\n\t\t\t\tclassName=\"edit-post-editor__document-overview-panel__tab-panel\"\n\t\t\t\tref={ tabPanelRef }\n\t\t\t\tonSelect={ ( tabName ) => setTab( tabName ) }\n\t\t\t\tselectOnMove={ false }\n\t\t\t\ttabs={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'list-view',\n\t\t\t\t\t\ttitle: _x( 'List View', 'Post overview' ),\n\t\t\t\t\t\tclassName: 'edit-post-sidebar__panel-tab',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'outline',\n\t\t\t\t\t\ttitle: _x( 'Outline', 'Post overview' ),\n\t\t\t\t\t\tclassName: 'edit-post-sidebar__panel-tab',\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ ( currentTab ) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"edit-post-editor__list-view-container\"\n\t\t\t\t\t\tref={ listViewContainerRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ renderTabContent( currentTab.name ) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TabPanel>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,gBAAA,GAAAC,sBAAA,CAAAZ,OAAA;AAlBA;AACA;AACA;;AAYA;AACA;AACA;;AAIe,SAASa,eAAeA,CAAE;EAAEC;AAAsB,CAAC,EAAG;EACpE,MAAM;IAAEC;EAAoB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;;EAE5D;EACA,MAAMC,eAAe,GAAG,IAAAC,wBAAe,EAAE,cAAe,CAAC;;EAEzD;EACA,MAAMC,aAAa,GAAG,IAAAC,oBAAW,EAAE,MAAM;IACxCN,mBAAmB,CAAE,KAAM,CAAC;IAC5BD,qBAAqB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,EACF,IAAAmC,MAAA,CAAAC,aAAA,EAACvD,WAAA,CAAAmE,QAAQ;MACRX,SAAS,EAAC,sDAAsD;MAChEI,GAAG,EAAGzB,WAAa;MACnBiC,QAAQ,EAAKf,OAAO,IAAMrB,MAAM,CAAEqB,OAAQ,CAAG;MAC7CgB,YAAY,EAAG,KAAO;MACtBC,IAAI,EAAG,CACN;QACCC,IAAI,EAAE,WAAW;QACjBC,KAAK,EAAE,IAAAC,QAAE,EAAE,WAAW,EAAE,eAAgB,CAAC;QACzCjB,SAAS,EAAE;MACZ,CAAC,EACD;QACCe,IAAI,EAAE,SAAS;QACfC,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAS,EAAE,eAAgB,CAAC;QACvCjB,SAAS,EAAE;MACZ,CAAC;IACC,GAEChB,UAAU,IACb,IAAAc,MAAA,CAAAC,aAAA;MACCC,SAAS,EAAC,uCAAuC;MACjDI,GAAG,EAAGvB;IAAsB,GAE1Be,gBAAgB,CAAEZ,UAAU,CAAC+B,IAAK,CAChC,CAEG,CACN;EAAC;AAER"}
|
|
@@ -1,59 +0,0 @@
|
|
|
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 _i18n = require("@wordpress/i18n");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _editor = require("@wordpress/editor");
|
|
11
|
-
var _data = require("@wordpress/data");
|
|
12
|
-
var _store = require("../../../store");
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Module Constants
|
|
23
|
-
*/
|
|
24
|
-
const PANEL_NAME = 'discussion-panel';
|
|
25
|
-
function DiscussionPanel() {
|
|
26
|
-
const {
|
|
27
|
-
isEnabled,
|
|
28
|
-
isOpened
|
|
29
|
-
} = (0, _data.useSelect)(select => {
|
|
30
|
-
const {
|
|
31
|
-
isEditorPanelEnabled,
|
|
32
|
-
isEditorPanelOpened
|
|
33
|
-
} = select(_store.store);
|
|
34
|
-
return {
|
|
35
|
-
isEnabled: isEditorPanelEnabled(PANEL_NAME),
|
|
36
|
-
isOpened: isEditorPanelOpened(PANEL_NAME)
|
|
37
|
-
};
|
|
38
|
-
}, []);
|
|
39
|
-
const {
|
|
40
|
-
toggleEditorPanelOpened
|
|
41
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
42
|
-
if (!isEnabled) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
return (0, _react.createElement)(_editor.PostTypeSupportCheck, {
|
|
46
|
-
supportKeys: ['comments', 'trackbacks']
|
|
47
|
-
}, (0, _react.createElement)(_components.PanelBody, {
|
|
48
|
-
title: (0, _i18n.__)('Discussion'),
|
|
49
|
-
opened: isOpened,
|
|
50
|
-
onToggle: () => toggleEditorPanelOpened(PANEL_NAME)
|
|
51
|
-
}, (0, _react.createElement)(_editor.PostTypeSupportCheck, {
|
|
52
|
-
supportKeys: "comments"
|
|
53
|
-
}, (0, _react.createElement)(_components.PanelRow, null, (0, _react.createElement)(_editor.PostComments, null))), (0, _react.createElement)(_editor.PostTypeSupportCheck, {
|
|
54
|
-
supportKeys: "trackbacks"
|
|
55
|
-
}, (0, _react.createElement)(_components.PanelRow, null, (0, _react.createElement)(_editor.PostPingbacks, null)))));
|
|
56
|
-
}
|
|
57
|
-
var _default = DiscussionPanel;
|
|
58
|
-
exports.default = _default;
|
|
59
|
-
//# sourceMappingURL=index.js.map
|