@wordpress/edit-post 7.11.0 → 7.12.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/build/components/block-manager/category.js +14 -22
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/checklist.js +6 -13
- package/build/components/block-manager/checklist.js.map +1 -1
- package/build/components/block-manager/index.js +10 -14
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +21 -26
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build/components/device-preview/index.js +1 -1
- package/build/components/device-preview/index.js.map +1 -1
- package/build/components/editor-initialization/index.js +3 -4
- package/build/components/editor-initialization/index.js.map +1 -1
- package/build/components/header/document-title/index.js +103 -0
- package/build/components/header/document-title/index.js.map +1 -0
- package/build/components/header/fullscreen-mode-close/index.js +8 -9
- package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js +12 -13
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +7 -6
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/main-dashboard-button/index.js +3 -4
- package/build/components/header/main-dashboard-button/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +19 -23
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/post-publish-button-or-toggle.js +15 -16
- package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/header/tools-more-menu-group/index.js +7 -10
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +44 -54
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/layout/actions-panel.js +5 -6
- package/build/components/layout/actions-panel.js.map +1 -1
- package/build/components/layout/index.js +3 -4
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js +3 -7
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/meta-boxes/index.js +9 -13
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/meta-boxes/meta-box-visibility.js +5 -8
- package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js +3 -4
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js +16 -23
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/preferences-modal/options/enable-custom-fields.js +7 -9
- package/build/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
- package/build/components/preferences-modal/options/enable-feature.js +12 -16
- package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/options/enable-panel.js +10 -17
- package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
- package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js +7 -10
- package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +58 -44
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/discussion-panel/index.js +5 -7
- package/build/components/sidebar/discussion-panel/index.js.map +1 -1
- package/build/components/sidebar/featured-image/index.js +9 -17
- package/build/components/sidebar/featured-image/index.js.map +1 -1
- package/build/components/sidebar/page-attributes/index.js +3 -9
- package/build/components/sidebar/page-attributes/index.js.map +1 -1
- package/build/components/sidebar/plugin-document-setting-panel/index.js +20 -25
- package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-post-publish-panel/index.js +12 -15
- package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-post-status-info/index.js +6 -9
- package/build/components/sidebar/plugin-post-status-info/index.js.map +1 -1
- package/build/components/sidebar/plugin-pre-publish-panel/index.js +12 -15
- package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +4 -5
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar/post-excerpt/index.js +5 -7
- package/build/components/sidebar/post-excerpt/index.js.map +1 -1
- package/build/components/sidebar/post-schedule/index.js +16 -23
- package/build/components/sidebar/post-schedule/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +7 -11
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +9 -15
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
- package/build/components/sidebar/post-template/create-modal.js +3 -4
- package/build/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build/components/sidebar/post-template/form.js +13 -20
- package/build/components/sidebar/post-template/form.js.map +1 -1
- package/build/components/sidebar/post-template/index.js +18 -25
- package/build/components/sidebar/post-template/index.js.map +1 -1
- package/build/components/sidebar/post-url/index.js +16 -23
- package/build/components/sidebar/post-url/index.js.map +1 -1
- package/build/components/sidebar/post-visibility/index.js +26 -36
- package/build/components/sidebar/post-visibility/index.js.map +1 -1
- package/build/components/sidebar/settings-header/index.js +3 -4
- package/build/components/sidebar/settings-header/index.js.map +1 -1
- package/build/components/sidebar/template-summary/index.js +1 -1
- package/build/components/sidebar/template-summary/index.js.map +1 -1
- package/build/components/start-page-options/index.js +3 -4
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/view-link/index.js +1 -1
- package/build/components/view-link/index.js.map +1 -1
- package/build/components/visual-editor/block-inspector-button.js +4 -5
- package/build/components/visual-editor/block-inspector-button.js.map +1 -1
- package/build/components/visual-editor/header.native.js +6 -7
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/components/visual-editor/index.js +32 -48
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/welcome-guide/image.js +4 -5
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/editor.js +14 -20
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +3 -6
- package/build/editor.native.js.map +1 -1
- package/build/hooks/validate-multiple-use/index.js +18 -29
- package/build/hooks/validate-multiple-use/index.js.map +1 -1
- package/build/plugins/index.js +20 -23
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +3 -4
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build/store/actions.js +60 -88
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +11 -43
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +11 -16
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-manager/category.js +14 -22
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/checklist.js +6 -13
- package/build-module/components/block-manager/checklist.js.map +1 -1
- package/build-module/components/block-manager/index.js +10 -14
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +21 -26
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build-module/components/device-preview/index.js +1 -1
- package/build-module/components/device-preview/index.js.map +1 -1
- package/build-module/components/editor-initialization/index.js +3 -4
- package/build-module/components/editor-initialization/index.js.map +1 -1
- package/build-module/components/header/document-title/index.js +88 -0
- package/build-module/components/header/document-title/index.js.map +1 -0
- package/build-module/components/header/fullscreen-mode-close/index.js +7 -8
- package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js +12 -13
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.js +7 -6
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/main-dashboard-button/index.js +3 -4
- package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +19 -23
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +15 -16
- package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build-module/components/header/tools-more-menu-group/index.js +7 -10
- package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +42 -52
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/layout/actions-panel.js +5 -6
- package/build-module/components/layout/actions-panel.js.map +1 -1
- package/build-module/components/layout/index.js +3 -4
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/index.native.js +3 -7
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/meta-boxes/index.js +9 -13
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/meta-boxes/meta-box-visibility.js +5 -8
- package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.js +3 -4
- package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js +16 -23
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-custom-fields.js +7 -9
- package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-feature.js +12 -16
- package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-panel.js +10 -17
- package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js +7 -10
- package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +58 -44
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/discussion-panel/index.js +5 -7
- package/build-module/components/sidebar/discussion-panel/index.js.map +1 -1
- package/build-module/components/sidebar/featured-image/index.js +9 -17
- package/build-module/components/sidebar/featured-image/index.js.map +1 -1
- package/build-module/components/sidebar/page-attributes/index.js +3 -9
- package/build-module/components/sidebar/page-attributes/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js +20 -25
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js +12 -15
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-post-status-info/index.js +6 -9
- package/build-module/components/sidebar/plugin-post-status-info/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +12 -15
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +4 -5
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-excerpt/index.js +5 -7
- package/build-module/components/sidebar/post-excerpt/index.js.map +1 -1
- package/build-module/components/sidebar/post-schedule/index.js +16 -23
- package/build-module/components/sidebar/post-schedule/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +7 -11
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +9 -15
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
- package/build-module/components/sidebar/post-template/create-modal.js +3 -4
- package/build-module/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build-module/components/sidebar/post-template/form.js +13 -20
- package/build-module/components/sidebar/post-template/form.js.map +1 -1
- package/build-module/components/sidebar/post-template/index.js +18 -25
- package/build-module/components/sidebar/post-template/index.js.map +1 -1
- package/build-module/components/sidebar/post-url/index.js +16 -23
- package/build-module/components/sidebar/post-url/index.js.map +1 -1
- package/build-module/components/sidebar/post-visibility/index.js +26 -36
- package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
- package/build-module/components/sidebar/settings-header/index.js +3 -4
- package/build-module/components/sidebar/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar/template-summary/index.js +1 -1
- package/build-module/components/sidebar/template-summary/index.js.map +1 -1
- package/build-module/components/start-page-options/index.js +3 -4
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/view-link/index.js +1 -1
- package/build-module/components/view-link/index.js.map +1 -1
- package/build-module/components/visual-editor/block-inspector-button.js +4 -5
- package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/visual-editor/header.native.js +6 -7
- package/build-module/components/visual-editor/header.native.js.map +1 -1
- package/build-module/components/visual-editor/index.js +35 -49
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/welcome-guide/image.js +4 -5
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/editor.js +14 -20
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +3 -6
- package/build-module/editor.native.js.map +1 -1
- package/build-module/hooks/validate-multiple-use/index.js +18 -29
- package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
- package/build-module/plugins/index.js +20 -23
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +3 -4
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build-module/store/actions.js +60 -88
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +11 -43
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +11 -16
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +63 -101
- package/build-style/style.css +63 -101
- package/package.json +32 -32
- package/src/components/header/document-title/index.js +86 -0
- package/src/components/header/document-title/style.scss +61 -0
- package/src/components/header/header-toolbar/style.scss +0 -1
- package/src/components/header/index.js +4 -2
- package/src/components/header/style.scss +6 -0
- package/src/components/secondary-sidebar/list-view-sidebar.js +68 -66
- package/src/components/secondary-sidebar/style.scss +28 -31
- package/src/components/visual-editor/index.js +10 -21
- package/src/components/visual-editor/style.scss +0 -13
- package/src/style.scss +1 -1
- package/build/components/header/template-title/delete-template.js +0 -117
- package/build/components/header/template-title/delete-template.js.map +0 -1
- package/build/components/header/template-title/edit-template-title.js +0 -95
- package/build/components/header/template-title/edit-template-title.js.map +0 -1
- package/build/components/header/template-title/index.js +0 -124
- package/build/components/header/template-title/index.js.map +0 -1
- package/build/components/header/template-title/template-description.js +0 -55
- package/build/components/header/template-title/template-description.js.map +0 -1
- package/build-module/components/header/template-title/delete-template.js +0 -104
- package/build-module/components/header/template-title/delete-template.js.map +0 -1
- package/build-module/components/header/template-title/edit-template-title.js +0 -83
- package/build-module/components/header/template-title/edit-template-title.js.map +0 -1
- package/build-module/components/header/template-title/index.js +0 -105
- package/build-module/components/header/template-title/index.js.map +0 -1
- package/build-module/components/header/template-title/template-description.js +0 -45
- package/build-module/components/header/template-title/template-description.js.map +0 -1
- package/src/components/header/template-title/delete-template.js +0 -106
- package/src/components/header/template-title/edit-template-title.js +0 -78
- package/src/components/header/template-title/index.js +0 -115
- package/src/components/header/template-title/style.scss +0 -94
- package/src/components/header/template-title/template-description.js +0 -42
package/build/store/selectors.js
CHANGED
|
@@ -134,7 +134,7 @@ function convertPanelsToOldFormat(inactivePanels, openPanels) {
|
|
|
134
134
|
var _ref;
|
|
135
135
|
|
|
136
136
|
// First reduce the inactive panels.
|
|
137
|
-
const panelsWithEnabledState = inactivePanels
|
|
137
|
+
const panelsWithEnabledState = inactivePanels?.reduce((accumulatedPanels, panelName) => ({ ...accumulatedPanels,
|
|
138
138
|
[panelName]: {
|
|
139
139
|
enabled: false
|
|
140
140
|
}
|
|
@@ -142,8 +142,8 @@ function convertPanelsToOldFormat(inactivePanels, openPanels) {
|
|
|
142
142
|
// reduction as the initial value so that both open and inactive
|
|
143
143
|
// panel state is combined.
|
|
144
144
|
|
|
145
|
-
const panels = openPanels
|
|
146
|
-
const currentPanelState = accumulatedPanels
|
|
145
|
+
const panels = openPanels?.reduce((accumulatedPanels, panelName) => {
|
|
146
|
+
const currentPanelState = accumulatedPanels?.[panelName];
|
|
147
147
|
return { ...accumulatedPanels,
|
|
148
148
|
[panelName]: { ...currentPanelState,
|
|
149
149
|
opened: true
|
|
@@ -262,7 +262,7 @@ function isEditorPanelRemoved(state, panelName) {
|
|
|
262
262
|
|
|
263
263
|
const isEditorPanelEnabled = (0, _data.createRegistrySelector)(select => (state, panelName) => {
|
|
264
264
|
const inactivePanels = select(_preferences.store).get('core/edit-post', 'inactivePanels');
|
|
265
|
-
return !isEditorPanelRemoved(state, panelName) && !
|
|
265
|
+
return !isEditorPanelRemoved(state, panelName) && !inactivePanels?.includes(panelName);
|
|
266
266
|
});
|
|
267
267
|
/**
|
|
268
268
|
* Returns true if the given panel is open, or false otherwise. Panels are
|
|
@@ -277,7 +277,7 @@ const isEditorPanelEnabled = (0, _data.createRegistrySelector)(select => (state,
|
|
|
277
277
|
exports.isEditorPanelEnabled = isEditorPanelEnabled;
|
|
278
278
|
const isEditorPanelOpened = (0, _data.createRegistrySelector)(select => (state, panelName) => {
|
|
279
279
|
const openPanels = select(_preferences.store).get('core/edit-post', 'openPanels');
|
|
280
|
-
return !!
|
|
280
|
+
return !!openPanels?.includes(panelName);
|
|
281
281
|
});
|
|
282
282
|
/**
|
|
283
283
|
* Returns true if a modal is active, or false otherwise.
|
|
@@ -344,14 +344,11 @@ const getActiveMetaBoxLocations = (0, _rememo.default)(state => {
|
|
|
344
344
|
exports.getActiveMetaBoxLocations = getActiveMetaBoxLocations;
|
|
345
345
|
|
|
346
346
|
function isMetaBoxLocationVisible(state, location) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
let {
|
|
351
|
-
id
|
|
352
|
-
} = _ref2;
|
|
347
|
+
return isMetaBoxLocationActive(state, location) && getMetaBoxesPerLocation(state, location)?.some(({
|
|
348
|
+
id
|
|
349
|
+
}) => {
|
|
353
350
|
return isEditorPanelEnabled(state, `meta-box-${id}`);
|
|
354
|
-
})
|
|
351
|
+
});
|
|
355
352
|
}
|
|
356
353
|
/**
|
|
357
354
|
* Returns true if there is an active meta box in the given location, or false
|
|
@@ -510,11 +507,9 @@ const getEditedPostTemplate = (0, _data.createRegistrySelector)(select => () =>
|
|
|
510
507
|
const currentTemplate = select(_editor.store).getEditedPostAttribute('template');
|
|
511
508
|
|
|
512
509
|
if (currentTemplate) {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
const templateWithSameSlug = (_select$getEntityReco = select(_coreData.store).getEntityRecords('postType', 'wp_template', {
|
|
510
|
+
const templateWithSameSlug = select(_coreData.store).getEntityRecords('postType', 'wp_template', {
|
|
516
511
|
per_page: -1
|
|
517
|
-
})
|
|
512
|
+
})?.find(template => template.slug === currentTemplate);
|
|
518
513
|
|
|
519
514
|
if (!templateWithSameSlug) {
|
|
520
515
|
return templateWithSameSlug;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/store/selectors.js"],"names":["EMPTY_ARRAY","EMPTY_OBJECT","getEditorMode","select","preferencesStore","get","isEditorSidebarOpened","activeGeneralSidebar","interfaceStore","getActiveComplementaryArea","includes","isPluginSidebarOpened","getActiveGeneralSidebarName","convertPanelsToOldFormat","inactivePanels","openPanels","panelsWithEnabledState","reduce","accumulatedPanels","panelName","enabled","panels","currentPanelState","opened","getPreferences","since","alternative","preferences","accumulatedPrefs","preferenceKey","value","getPreference","state","defaultValue","undefined","getHiddenBlockTypes","isPublishSidebarOpened","publishSidebarActive","isEditorPanelRemoved","removedPanels","isEditorPanelEnabled","isEditorPanelOpened","isModalActive","modalName","activeModal","isFeatureActive","feature","isPluginItemPinned","pluginName","isItemPinned","getActiveMetaBoxLocations","Object","keys","metaBoxes","locations","filter","location","isMetaBoxLocationActive","isMetaBoxLocationVisible","getMetaBoxesPerLocation","some","id","length","getAllMetaBoxes","values","flat","hasMetaBoxes","isSavingMetaBoxes","isSaving","__experimentalGetPreviewDeviceType","deviceType","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isEditingTemplate","areMetaBoxesInitialized","initialized","getEditedPostTemplate","currentTemplate","editorStore","getEditedPostAttribute","templateWithSameSlug","coreStore","getEntityRecords","per_page","find","template","slug","getEditedEntityRecord","post","getCurrentPost","link","__experimentalGetTemplateForLink"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;AAQA,MAAMA,WAAW,GAAG,EAApB;AACA,MAAMC,YAAY,GAAG,EAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,aAAa,GAAG,kCAC1BC,MAAF,IAAc;AAAA;;AAAA,wBACbA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,GAA3B,CAAgC,gBAAhC,EAAkD,YAAlD,CADa,qDAEb,QAFa;AAAA,CADc,CAAtB;AAMP;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,qBAAqB,GAAG,kCAClCH,MAAF,IAAc,MAAM;AACnB,QAAMI,oBAAoB,GACzBJ,MAAM,CAAEK,gBAAF,CAAN,CAAyBC,0BAAzB,CACC,gBADD,CADD;AAIA,SAAO,CAAE,oBAAF,EAAwB,iBAAxB,EAA4CC,QAA5C,CACNH,oBADM,CAAP;AAGA,CATmC,CAA9B;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMI,qBAAqB,GAAG,kCAClCR,MAAF,IAAc,MAAM;AACnB,Q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,UAAMG,oBAAoB,4BAAGnF,MAAM,CAAEoF,eAAF,CAAN,CAC3BC,gBAD2B,CACT,UADS,EACG,aADH,EACkB;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KADlB,CAAH,0DAAG,sBAE1BC,IAF0B,CAElBC,QAAF,IAAgBA,QAAQ,CAACC,IAAT,KAAkBT,eAFd,CAA7B;;AAGA,QAAK,CAAEG,oBAAP,EAA8B;AAC7B,aAAOA,oBAAP;AACA;;AACD,WAAOnF,MAAM,CAAEoF,eAAF,CAAN,CAAoBM,qBAApB,CACN,UADM,EAEN,aAFM,EAGNP,oBAAoB,CAACzB,EAHf,CAAP;AAKA;;AAED,QAAMiC,IAAI,GAAG3F,MAAM,CAAEiF,aAAF,CAAN,CAAsBW,cAAtB,EAAb;;AACA,MAAKD,IAAI,CAACE,IAAV,EAAiB;AAChB,WAAO7F,MAAM,CAAEoF,eAAF,CAAN,CAAoBU,gCAApB,CACNH,IAAI,CAACE,IADC,CAAP;AAGA;;AAED,SAAO,IAAP;AACA,CA1BmC,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\n\nconst EMPTY_ARRAY = [];\nconst EMPTY_OBJECT = {};\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector(\n\t( select ) => () =>\n\t\tselect( preferencesStore ).get( 'core/edit-post', 'editorMode' ) ??\n\t\t'visual'\n);\n\n/**\n * Returns true if the editor sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the editor sidebar is opened.\n */\nexport const isEditorSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t'core/edit-post'\n\t\t\t);\n\t\treturn [ 'edit-post/document', 'edit-post/block' ].includes(\n\t\t\tactiveGeneralSidebar\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the plugin sidebar is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the plugin sidebar is opened.\n */\nexport const isPluginSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t'core/edit-post'\n\t\t\t);\n\t\treturn (\n\t\t\t!! activeGeneralSidebar &&\n\t\t\t! [ 'edit-post/document', 'edit-post/block' ].includes(\n\t\t\t\tactiveGeneralSidebar\n\t\t\t)\n\t\t);\n\t}\n);\n\n/**\n * Returns the current active general sidebar name, or null if there is no\n * general sidebar active. The active general sidebar is a unique name to\n * identify either an editor or plugin sidebar.\n *\n * Examples:\n *\n * - `edit-post/document`\n * - `my-plugin/insert-image-sidebar`\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} Active general sidebar name.\n */\nexport const getActiveGeneralSidebarName = createRegistrySelector(\n\t( select ) => () => {\n\t\treturn select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t'core/edit-post'\n\t\t);\n\t}\n);\n\n/**\n * Converts panels from the new preferences store format to the old format\n * that the post editor previously used.\n *\n * The resultant converted data should look like this:\n * {\n * panelName: {\n * enabled: false,\n * opened: true,\n * },\n * anotherPanelName: {\n * opened: true\n * },\n * }\n *\n * @param {string[] | undefined} inactivePanels An array of inactive panel names.\n * @param {string[] | undefined} openPanels An array of open panel names.\n *\n * @return {Object} The converted panel data.\n */\nfunction convertPanelsToOldFormat( inactivePanels, openPanels ) {\n\t// First reduce the inactive panels.\n\tconst panelsWithEnabledState = inactivePanels?.reduce(\n\t\t( accumulatedPanels, panelName ) => ( {\n\t\t\t...accumulatedPanels,\n\t\t\t[ panelName ]: {\n\t\t\t\tenabled: false,\n\t\t\t},\n\t\t} ),\n\t\t{}\n\t);\n\n\t// Then reduce the open panels, passing in the result of the previous\n\t// reduction as the initial value so that both open and inactive\n\t// panel state is combined.\n\tconst panels = openPanels?.reduce( ( accumulatedPanels, panelName ) => {\n\t\tconst currentPanelState = accumulatedPanels?.[ panelName ];\n\t\treturn {\n\t\t\t...accumulatedPanels,\n\t\t\t[ panelName ]: {\n\t\t\t\t...currentPanelState,\n\t\t\t\topened: true,\n\t\t\t},\n\t\t};\n\t}, panelsWithEnabledState ?? {} );\n\n\t// The panels variable will only be set if openPanels wasn't `undefined`.\n\t// If it isn't set just return `panelsWithEnabledState`, and if that isn't\n\t// set return an empty object.\n\treturn panels ?? panelsWithEnabledState ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the preferences (these preferences are persisted locally).\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Preferences Object.\n */\nexport const getPreferences = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-post' ).getPreferences`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\t// These preferences now exist in the preferences store.\n\t// Fetch them so that they can be merged into the post\n\t// editor preferences.\n\tconst preferences = [\n\t\t'hiddenBlockTypes',\n\t\t'editorMode',\n\t\t'preferredStyleVariations',\n\t].reduce( ( accumulatedPrefs, preferenceKey ) => {\n\t\tconst value = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\tpreferenceKey\n\t\t);\n\n\t\treturn {\n\t\t\t...accumulatedPrefs,\n\t\t\t[ preferenceKey ]: value,\n\t\t};\n\t}, {} );\n\n\t// Panels were a preference, but the data structure changed when the state\n\t// was migrated to the preferences store. They need to be converted from\n\t// the new preferences store format to old format to ensure no breaking\n\t// changes for plugins.\n\tconst inactivePanels = select( preferencesStore ).get(\n\t\t'core/edit-post',\n\t\t'inactivePanels'\n\t);\n\tconst openPanels = select( preferencesStore ).get(\n\t\t'core/edit-post',\n\t\t'openPanels'\n\t);\n\tconst panels = convertPanelsToOldFormat( inactivePanels, openPanels );\n\n\treturn {\n\t\t...preferences,\n\t\tpanels,\n\t};\n} );\n\n/**\n *\n * @param {Object} state Global application state.\n * @param {string} preferenceKey Preference Key.\n * @param {*} defaultValue Default Value.\n *\n * @return {*} Preference Value.\n */\nexport function getPreference( state, preferenceKey, defaultValue ) {\n\tdeprecated( `select( 'core/edit-post' ).getPreference`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\t// Avoid using the `getPreferences` registry selector where possible.\n\tconst preferences = getPreferences( state );\n\tconst value = preferences[ preferenceKey ];\n\treturn value === undefined ? defaultValue : value;\n}\n\n/**\n * Returns an array of blocks that are hidden.\n *\n * @return {Array} A list of the hidden block types\n */\nexport const getHiddenBlockTypes = createRegistrySelector( ( select ) => () => {\n\treturn (\n\t\tselect( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'hiddenBlockTypes'\n\t\t) ?? EMPTY_ARRAY\n\t);\n} );\n\n/**\n * Returns true if the publish sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the publish sidebar is open.\n */\nexport function isPublishSidebarOpened( state ) {\n\treturn state.publishSidebarActive;\n}\n\n/**\n * Returns true if the given panel was programmatically removed, or false otherwise.\n * All panels are not removed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is removed.\n */\nexport function isEditorPanelRemoved( state, panelName ) {\n\treturn state.removedPanels.includes( panelName );\n}\n\n/**\n * Returns true if the given panel is enabled, or false otherwise. Panels are\n * enabled by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is enabled.\n */\nexport const isEditorPanelEnabled = createRegistrySelector(\n\t( select ) => ( state, panelName ) => {\n\t\tconst inactivePanels = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'inactivePanels'\n\t\t);\n\t\treturn (\n\t\t\t! isEditorPanelRemoved( state, panelName ) &&\n\t\t\t! inactivePanels?.includes( panelName )\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the given panel is open, or false otherwise. Panels are\n * closed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is open.\n */\nexport const isEditorPanelOpened = createRegistrySelector(\n\t( select ) => ( state, panelName ) => {\n\t\tconst openPanels = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'openPanels'\n\t\t);\n\t\treturn !! openPanels?.includes( panelName );\n\t}\n);\n\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, feature ) => {\n\t\treturn !! select( preferencesStore ).get( 'core/edit-post', feature );\n\t}\n);\n\n/**\n * Returns true if the plugin item is pinned to the header.\n * When the value is not set it defaults to true.\n *\n * @param {Object} state Global application state.\n * @param {string} pluginName Plugin item name.\n *\n * @return {boolean} Whether the plugin item is pinned.\n */\nexport const isPluginItemPinned = createRegistrySelector(\n\t( select ) => ( state, pluginName ) => {\n\t\treturn select( interfaceStore ).isItemPinned(\n\t\t\t'core/edit-post',\n\t\t\tpluginName\n\t\t);\n\t}\n);\n\n/**\n * Returns an array of active meta box locations.\n *\n * @param {Object} state Post editor state.\n *\n * @return {string[]} Active meta box locations.\n */\nexport const getActiveMetaBoxLocations = createSelector(\n\t( state ) => {\n\t\treturn Object.keys( state.metaBoxes.locations ).filter( ( location ) =>\n\t\t\tisMetaBoxLocationActive( state, location )\n\t\t);\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if a metabox location is active and visible\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active and visible.\n */\nexport function isMetaBoxLocationVisible( state, location ) {\n\treturn (\n\t\tisMetaBoxLocationActive( state, location ) &&\n\t\tgetMetaBoxesPerLocation( state, location )?.some( ( { id } ) => {\n\t\t\treturn isEditorPanelEnabled( state, `meta-box-${ id }` );\n\t\t} )\n\t);\n}\n\n/**\n * Returns true if there is an active meta box in the given location, or false\n * otherwise.\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active.\n */\nexport function isMetaBoxLocationActive( state, location ) {\n\tconst metaBoxes = getMetaBoxesPerLocation( state, location );\n\treturn !! metaBoxes && metaBoxes.length !== 0;\n}\n\n/**\n * Returns the list of all the available meta boxes for a given location.\n *\n * @param {Object} state Global application state.\n * @param {string} location Meta box location to test.\n *\n * @return {?Array} List of meta boxes.\n */\nexport function getMetaBoxesPerLocation( state, location ) {\n\treturn state.metaBoxes.locations[ location ];\n}\n\n/**\n * Returns the list of all the available meta boxes.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} List of meta boxes.\n */\nexport const getAllMetaBoxes = createSelector(\n\t( state ) => {\n\t\treturn Object.values( state.metaBoxes.locations ).flat();\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if the post is using Meta Boxes\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether there are metaboxes or not.\n */\nexport function hasMetaBoxes( state ) {\n\treturn getActiveMetaBoxLocations( state ).length > 0;\n}\n\n/**\n * Returns true if the Meta Boxes are being saved.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the metaboxes are being saved.\n */\nexport function isSavingMetaBoxes( state ) {\n\treturn state.metaBoxes.isSaving;\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst { rootClientId, insertionIndex, filterValue } =\n\t\tstate.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns true if the template editing mode is enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether we're editing the template.\n */\nexport function isEditingTemplate( state ) {\n\treturn state.isEditingTemplate;\n}\n\n/**\n * Returns true if meta boxes are initialized.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether meta boxes are initialized.\n */\nexport function areMetaBoxesInitialized( state ) {\n\treturn state.metaBoxes.initialized;\n}\n\n/**\n * Retrieves the template of the currently edited post.\n *\n * @return {Object?} Post Template.\n */\nexport const getEditedPostTemplate = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst currentTemplate =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\t\tif ( currentTemplate ) {\n\t\t\tconst templateWithSameSlug = select( coreStore )\n\t\t\t\t.getEntityRecords( 'postType', 'wp_template', { per_page: -1 } )\n\t\t\t\t?.find( ( template ) => template.slug === currentTemplate );\n\t\t\tif ( ! templateWithSameSlug ) {\n\t\t\t\treturn templateWithSameSlug;\n\t\t\t}\n\t\t\treturn select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\ttemplateWithSameSlug.id\n\t\t\t);\n\t\t}\n\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tif ( post.link ) {\n\t\t\treturn select( coreStore ).__experimentalGetTemplateForLink(\n\t\t\t\tpost.link\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/store/selectors.js"],"names":["EMPTY_ARRAY","EMPTY_OBJECT","getEditorMode","select","preferencesStore","get","isEditorSidebarOpened","activeGeneralSidebar","interfaceStore","getActiveComplementaryArea","includes","isPluginSidebarOpened","getActiveGeneralSidebarName","convertPanelsToOldFormat","inactivePanels","openPanels","panelsWithEnabledState","reduce","accumulatedPanels","panelName","enabled","panels","currentPanelState","opened","getPreferences","since","alternative","preferences","accumulatedPrefs","preferenceKey","value","getPreference","state","defaultValue","undefined","getHiddenBlockTypes","isPublishSidebarOpened","publishSidebarActive","isEditorPanelRemoved","removedPanels","isEditorPanelEnabled","isEditorPanelOpened","isModalActive","modalName","activeModal","isFeatureActive","feature","isPluginItemPinned","pluginName","isItemPinned","getActiveMetaBoxLocations","Object","keys","metaBoxes","locations","filter","location","isMetaBoxLocationActive","isMetaBoxLocationVisible","getMetaBoxesPerLocation","some","id","length","getAllMetaBoxes","values","flat","hasMetaBoxes","isSavingMetaBoxes","isSaving","__experimentalGetPreviewDeviceType","deviceType","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isEditingTemplate","areMetaBoxesInitialized","initialized","getEditedPostTemplate","currentTemplate","editorStore","getEditedPostAttribute","templateWithSameSlug","coreStore","getEntityRecords","per_page","find","template","slug","getEditedEntityRecord","post","getCurrentPost","link","__experimentalGetTemplateForLink"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AAC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AAK,CAAC8C,aAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,iBAAT,CAA4B/C,KAA5B,EAAoC;AAC1C,SAAOA,KAAK,CAAC+C,iBAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,uBAAT,CAAkChD,KAAlC,EAA0C;AAChD,SAAOA,KAAK,CAACqB,SAAN,CAAgB4B,WAAvB;AACA;AAED;AACA;AACA;AACA;AACA;;;AACO,MAAMC,qBAAqB,GAAG,kCAClC/E,MAAF,IAAc,MAAM;AACnB,QAAMgF,eAAe,GACpBhF,MAAM,CAAEiF,aAAF,CAAN,CAAsBC,sBAAtB,CAA8C,UAA9C,CADD;;AAEA,MAAKF,eAAL,EAAuB;AACtB,UAAMG,oBAAoB,GAAGnF,MAAM,CAAEoF,eAAF,CAAN,CAC3BC,gBAD2B,CACT,UADS,EACG,aADH,EACkB;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KADlB,GAE1BC,IAF0B,CAElBC,QAAF,IAAgBA,QAAQ,CAACC,IAAT,KAAkBT,eAFd,CAA7B;;AAGA,QAAK,CAAEG,oBAAP,EAA8B;AAC7B,aAAOA,oBAAP;AACA;;AACD,WAAOnF,MAAM,CAAEoF,eAAF,CAAN,CAAoBM,qBAApB,CACN,UADM,EAEN,aAFM,EAGNP,oBAAoB,CAACzB,EAHf,CAAP;AAKA;;AAED,QAAMiC,IAAI,GAAG3F,MAAM,CAAEiF,aAAF,CAAN,CAAsBW,cAAtB,EAAb;;AACA,MAAKD,IAAI,CAACE,IAAV,EAAiB;AAChB,WAAO7F,MAAM,CAAEoF,eAAF,CAAN,CAAoBU,gCAApB,CACNH,IAAI,CAACE,IADC,CAAP;AAGA;;AAED,SAAO,IAAP;AACA,CA1BmC,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\n\nconst EMPTY_ARRAY = [];\nconst EMPTY_OBJECT = {};\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector(\n\t( select ) => () =>\n\t\tselect( preferencesStore ).get( 'core/edit-post', 'editorMode' ) ??\n\t\t'visual'\n);\n\n/**\n * Returns true if the editor sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the editor sidebar is opened.\n */\nexport const isEditorSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t'core/edit-post'\n\t\t\t);\n\t\treturn [ 'edit-post/document', 'edit-post/block' ].includes(\n\t\t\tactiveGeneralSidebar\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the plugin sidebar is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the plugin sidebar is opened.\n */\nexport const isPluginSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t'core/edit-post'\n\t\t\t);\n\t\treturn (\n\t\t\t!! activeGeneralSidebar &&\n\t\t\t! [ 'edit-post/document', 'edit-post/block' ].includes(\n\t\t\t\tactiveGeneralSidebar\n\t\t\t)\n\t\t);\n\t}\n);\n\n/**\n * Returns the current active general sidebar name, or null if there is no\n * general sidebar active. The active general sidebar is a unique name to\n * identify either an editor or plugin sidebar.\n *\n * Examples:\n *\n * - `edit-post/document`\n * - `my-plugin/insert-image-sidebar`\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} Active general sidebar name.\n */\nexport const getActiveGeneralSidebarName = createRegistrySelector(\n\t( select ) => () => {\n\t\treturn select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t'core/edit-post'\n\t\t);\n\t}\n);\n\n/**\n * Converts panels from the new preferences store format to the old format\n * that the post editor previously used.\n *\n * The resultant converted data should look like this:\n * {\n * panelName: {\n * enabled: false,\n * opened: true,\n * },\n * anotherPanelName: {\n * opened: true\n * },\n * }\n *\n * @param {string[] | undefined} inactivePanels An array of inactive panel names.\n * @param {string[] | undefined} openPanels An array of open panel names.\n *\n * @return {Object} The converted panel data.\n */\nfunction convertPanelsToOldFormat( inactivePanels, openPanels ) {\n\t// First reduce the inactive panels.\n\tconst panelsWithEnabledState = inactivePanels?.reduce(\n\t\t( accumulatedPanels, panelName ) => ( {\n\t\t\t...accumulatedPanels,\n\t\t\t[ panelName ]: {\n\t\t\t\tenabled: false,\n\t\t\t},\n\t\t} ),\n\t\t{}\n\t);\n\n\t// Then reduce the open panels, passing in the result of the previous\n\t// reduction as the initial value so that both open and inactive\n\t// panel state is combined.\n\tconst panels = openPanels?.reduce( ( accumulatedPanels, panelName ) => {\n\t\tconst currentPanelState = accumulatedPanels?.[ panelName ];\n\t\treturn {\n\t\t\t...accumulatedPanels,\n\t\t\t[ panelName ]: {\n\t\t\t\t...currentPanelState,\n\t\t\t\topened: true,\n\t\t\t},\n\t\t};\n\t}, panelsWithEnabledState ?? {} );\n\n\t// The panels variable will only be set if openPanels wasn't `undefined`.\n\t// If it isn't set just return `panelsWithEnabledState`, and if that isn't\n\t// set return an empty object.\n\treturn panels ?? panelsWithEnabledState ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the preferences (these preferences are persisted locally).\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Preferences Object.\n */\nexport const getPreferences = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-post' ).getPreferences`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\t// These preferences now exist in the preferences store.\n\t// Fetch them so that they can be merged into the post\n\t// editor preferences.\n\tconst preferences = [\n\t\t'hiddenBlockTypes',\n\t\t'editorMode',\n\t\t'preferredStyleVariations',\n\t].reduce( ( accumulatedPrefs, preferenceKey ) => {\n\t\tconst value = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\tpreferenceKey\n\t\t);\n\n\t\treturn {\n\t\t\t...accumulatedPrefs,\n\t\t\t[ preferenceKey ]: value,\n\t\t};\n\t}, {} );\n\n\t// Panels were a preference, but the data structure changed when the state\n\t// was migrated to the preferences store. They need to be converted from\n\t// the new preferences store format to old format to ensure no breaking\n\t// changes for plugins.\n\tconst inactivePanels = select( preferencesStore ).get(\n\t\t'core/edit-post',\n\t\t'inactivePanels'\n\t);\n\tconst openPanels = select( preferencesStore ).get(\n\t\t'core/edit-post',\n\t\t'openPanels'\n\t);\n\tconst panels = convertPanelsToOldFormat( inactivePanels, openPanels );\n\n\treturn {\n\t\t...preferences,\n\t\tpanels,\n\t};\n} );\n\n/**\n *\n * @param {Object} state Global application state.\n * @param {string} preferenceKey Preference Key.\n * @param {*} defaultValue Default Value.\n *\n * @return {*} Preference Value.\n */\nexport function getPreference( state, preferenceKey, defaultValue ) {\n\tdeprecated( `select( 'core/edit-post' ).getPreference`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\t// Avoid using the `getPreferences` registry selector where possible.\n\tconst preferences = getPreferences( state );\n\tconst value = preferences[ preferenceKey ];\n\treturn value === undefined ? defaultValue : value;\n}\n\n/**\n * Returns an array of blocks that are hidden.\n *\n * @return {Array} A list of the hidden block types\n */\nexport const getHiddenBlockTypes = createRegistrySelector( ( select ) => () => {\n\treturn (\n\t\tselect( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'hiddenBlockTypes'\n\t\t) ?? EMPTY_ARRAY\n\t);\n} );\n\n/**\n * Returns true if the publish sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the publish sidebar is open.\n */\nexport function isPublishSidebarOpened( state ) {\n\treturn state.publishSidebarActive;\n}\n\n/**\n * Returns true if the given panel was programmatically removed, or false otherwise.\n * All panels are not removed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is removed.\n */\nexport function isEditorPanelRemoved( state, panelName ) {\n\treturn state.removedPanels.includes( panelName );\n}\n\n/**\n * Returns true if the given panel is enabled, or false otherwise. Panels are\n * enabled by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is enabled.\n */\nexport const isEditorPanelEnabled = createRegistrySelector(\n\t( select ) => ( state, panelName ) => {\n\t\tconst inactivePanels = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'inactivePanels'\n\t\t);\n\t\treturn (\n\t\t\t! isEditorPanelRemoved( state, panelName ) &&\n\t\t\t! inactivePanels?.includes( panelName )\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the given panel is open, or false otherwise. Panels are\n * closed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is open.\n */\nexport const isEditorPanelOpened = createRegistrySelector(\n\t( select ) => ( state, panelName ) => {\n\t\tconst openPanels = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'openPanels'\n\t\t);\n\t\treturn !! openPanels?.includes( panelName );\n\t}\n);\n\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, feature ) => {\n\t\treturn !! select( preferencesStore ).get( 'core/edit-post', feature );\n\t}\n);\n\n/**\n * Returns true if the plugin item is pinned to the header.\n * When the value is not set it defaults to true.\n *\n * @param {Object} state Global application state.\n * @param {string} pluginName Plugin item name.\n *\n * @return {boolean} Whether the plugin item is pinned.\n */\nexport const isPluginItemPinned = createRegistrySelector(\n\t( select ) => ( state, pluginName ) => {\n\t\treturn select( interfaceStore ).isItemPinned(\n\t\t\t'core/edit-post',\n\t\t\tpluginName\n\t\t);\n\t}\n);\n\n/**\n * Returns an array of active meta box locations.\n *\n * @param {Object} state Post editor state.\n *\n * @return {string[]} Active meta box locations.\n */\nexport const getActiveMetaBoxLocations = createSelector(\n\t( state ) => {\n\t\treturn Object.keys( state.metaBoxes.locations ).filter( ( location ) =>\n\t\t\tisMetaBoxLocationActive( state, location )\n\t\t);\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if a metabox location is active and visible\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active and visible.\n */\nexport function isMetaBoxLocationVisible( state, location ) {\n\treturn (\n\t\tisMetaBoxLocationActive( state, location ) &&\n\t\tgetMetaBoxesPerLocation( state, location )?.some( ( { id } ) => {\n\t\t\treturn isEditorPanelEnabled( state, `meta-box-${ id }` );\n\t\t} )\n\t);\n}\n\n/**\n * Returns true if there is an active meta box in the given location, or false\n * otherwise.\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active.\n */\nexport function isMetaBoxLocationActive( state, location ) {\n\tconst metaBoxes = getMetaBoxesPerLocation( state, location );\n\treturn !! metaBoxes && metaBoxes.length !== 0;\n}\n\n/**\n * Returns the list of all the available meta boxes for a given location.\n *\n * @param {Object} state Global application state.\n * @param {string} location Meta box location to test.\n *\n * @return {?Array} List of meta boxes.\n */\nexport function getMetaBoxesPerLocation( state, location ) {\n\treturn state.metaBoxes.locations[ location ];\n}\n\n/**\n * Returns the list of all the available meta boxes.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} List of meta boxes.\n */\nexport const getAllMetaBoxes = createSelector(\n\t( state ) => {\n\t\treturn Object.values( state.metaBoxes.locations ).flat();\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if the post is using Meta Boxes\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether there are metaboxes or not.\n */\nexport function hasMetaBoxes( state ) {\n\treturn getActiveMetaBoxLocations( state ).length > 0;\n}\n\n/**\n * Returns true if the Meta Boxes are being saved.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the metaboxes are being saved.\n */\nexport function isSavingMetaBoxes( state ) {\n\treturn state.metaBoxes.isSaving;\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst { rootClientId, insertionIndex, filterValue } =\n\t\tstate.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns true if the template editing mode is enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether we're editing the template.\n */\nexport function isEditingTemplate( state ) {\n\treturn state.isEditingTemplate;\n}\n\n/**\n * Returns true if meta boxes are initialized.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether meta boxes are initialized.\n */\nexport function areMetaBoxesInitialized( state ) {\n\treturn state.metaBoxes.initialized;\n}\n\n/**\n * Retrieves the template of the currently edited post.\n *\n * @return {Object?} Post Template.\n */\nexport const getEditedPostTemplate = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst currentTemplate =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\t\tif ( currentTemplate ) {\n\t\t\tconst templateWithSameSlug = select( coreStore )\n\t\t\t\t.getEntityRecords( 'postType', 'wp_template', { per_page: -1 } )\n\t\t\t\t?.find( ( template ) => template.slug === currentTemplate );\n\t\t\tif ( ! templateWithSameSlug ) {\n\t\t\t\treturn templateWithSameSlug;\n\t\t\t}\n\t\t\treturn select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\ttemplateWithSameSlug.id\n\t\t\t);\n\t\t}\n\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tif ( post.link ) {\n\t\t\treturn select( coreStore ).__experimentalGetTemplateForLink(\n\t\t\t\tpost.link\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n);\n"]}
|
|
@@ -15,11 +15,10 @@ import { store as editorStore } from '@wordpress/editor';
|
|
|
15
15
|
import BlockTypesChecklist from './checklist';
|
|
16
16
|
import { store as editPostStore } from '../../store';
|
|
17
17
|
|
|
18
|
-
function BlockManagerCategory(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} = _ref;
|
|
18
|
+
function BlockManagerCategory({
|
|
19
|
+
title,
|
|
20
|
+
blockTypes
|
|
21
|
+
}) {
|
|
23
22
|
const instanceId = useInstanceId(BlockManagerCategory);
|
|
24
23
|
const {
|
|
25
24
|
defaultAllowedBlockTypes,
|
|
@@ -41,11 +40,10 @@ function BlockManagerCategory(_ref) {
|
|
|
41
40
|
return blockTypes;
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
return blockTypes.filter(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return defaultAllowedBlockTypes === null || defaultAllowedBlockTypes === void 0 ? void 0 : defaultAllowedBlockTypes.includes(name);
|
|
43
|
+
return blockTypes.filter(({
|
|
44
|
+
name
|
|
45
|
+
}) => {
|
|
46
|
+
return defaultAllowedBlockTypes?.includes(name);
|
|
49
47
|
});
|
|
50
48
|
}, [defaultAllowedBlockTypes, blockTypes]);
|
|
51
49
|
const {
|
|
@@ -60,12 +58,9 @@ function BlockManagerCategory(_ref) {
|
|
|
60
58
|
}
|
|
61
59
|
}, []);
|
|
62
60
|
const toggleAllVisible = useCallback(nextIsChecked => {
|
|
63
|
-
const blockNames = blockTypes.map(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
} = _ref3;
|
|
67
|
-
return name;
|
|
68
|
-
});
|
|
61
|
+
const blockNames = blockTypes.map(({
|
|
62
|
+
name
|
|
63
|
+
}) => name);
|
|
69
64
|
|
|
70
65
|
if (nextIsChecked) {
|
|
71
66
|
showBlockTypes(blockNames);
|
|
@@ -78,12 +73,9 @@ function BlockManagerCategory(_ref) {
|
|
|
78
73
|
return null;
|
|
79
74
|
}
|
|
80
75
|
|
|
81
|
-
const checkedBlockNames = filteredBlockTypes.map(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
} = _ref4;
|
|
85
|
-
return name;
|
|
86
|
-
}).filter(type => !hiddenBlockTypes.includes(type));
|
|
76
|
+
const checkedBlockNames = filteredBlockTypes.map(({
|
|
77
|
+
name
|
|
78
|
+
}) => name).filter(type => !hiddenBlockTypes.includes(type));
|
|
87
79
|
const titleId = 'edit-post-block-manager__category-title-' + instanceId;
|
|
88
80
|
const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
|
|
89
81
|
const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"names":["useMemo","useCallback","useDispatch","useSelect","useInstanceId","CheckboxControl","store","editorStore","BlockTypesChecklist","editPostStore","BlockManagerCategory","title","blockTypes","instanceId","defaultAllowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","getHiddenBlockTypes","filteredBlockTypes","filter","name","includes","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","map","length","checkedBlockNames","type","titleId","isAllChecked","isIndeterminate"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,WAAlB,QAAqC,oBAArC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,aAAhC;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,oBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"names":["useMemo","useCallback","useDispatch","useSelect","useInstanceId","CheckboxControl","store","editorStore","BlockTypesChecklist","editPostStore","BlockManagerCategory","title","blockTypes","instanceId","defaultAllowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","getHiddenBlockTypes","filteredBlockTypes","filter","name","includes","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","map","length","checkedBlockNames","type","titleId","isAllChecked","isIndeterminate"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,WAAlB,QAAqC,oBAArC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,aAAhC;AACA,SAASF,KAAK,IAAIG,aAAlB,QA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,eAAef,oBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tdefaultAllowedBlockTypes:\n\t\t\t\t\tgetEditorSettings().defaultAllowedBlockTypes,\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( defaultAllowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn defaultAllowedBlockTypes?.includes( name );\n\t\t} );\n\t}, [ defaultAllowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );\n\tconst toggleVisible = useCallback( ( blockName, nextIsChecked ) => {\n\t\tif ( nextIsChecked ) {\n\t\t\tshowBlockTypes( blockName );\n\t\t} else {\n\t\t\thideBlockTypes( blockName );\n\t\t}\n\t}, [] );\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockNames );\n\t\t\t}\n\t\t},\n\t\t[ blockTypes ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = filteredBlockTypes\n\t\t.map( ( { name } ) => name )\n\t\t.filter( ( type ) => ! hiddenBlockTypes.includes( type ) );\n\n\tconst titleId = 'edit-post-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;\n\tconst isIndeterminate = ! isAllChecked && checkedBlockNames.length > 0;\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ titleId }\n\t\t\tclassName=\"edit-post-block-manager__category\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tchecked={ isAllChecked }\n\t\t\t\tonChange={ toggleAllVisible }\n\t\t\t\tclassName=\"edit-post-block-manager__category-title\"\n\t\t\t\tindeterminate={ isIndeterminate }\n\t\t\t\tlabel={ <span id={ titleId }>{ title }</span> }\n\t\t\t/>\n\t\t\t<BlockTypesChecklist\n\t\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\t\tvalue={ checkedBlockNames }\n\t\t\t\tonItemChange={ toggleVisible }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default BlockManagerCategory;\n"]}
|
|
@@ -6,12 +6,11 @@ import { createElement } from "@wordpress/element";
|
|
|
6
6
|
import { BlockIcon } from '@wordpress/block-editor';
|
|
7
7
|
import { CheckboxControl } from '@wordpress/components';
|
|
8
8
|
|
|
9
|
-
function BlockTypesChecklist(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} = _ref;
|
|
9
|
+
function BlockTypesChecklist({
|
|
10
|
+
blockTypes,
|
|
11
|
+
value,
|
|
12
|
+
onItemChange
|
|
13
|
+
}) {
|
|
15
14
|
return createElement("ul", {
|
|
16
15
|
className: "edit-post-block-manager__checklist"
|
|
17
16
|
}, blockTypes.map(blockType => createElement("li", {
|
|
@@ -21,13 +20,7 @@ function BlockTypesChecklist(_ref) {
|
|
|
21
20
|
__nextHasNoMarginBottom: true,
|
|
22
21
|
label: blockType.title,
|
|
23
22
|
checked: value.includes(blockType.name),
|
|
24
|
-
onChange:
|
|
25
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
26
|
-
args[_key] = arguments[_key];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return onItemChange(blockType.name, ...args);
|
|
30
|
-
}
|
|
23
|
+
onChange: (...args) => onItemChange(blockType.name, ...args)
|
|
31
24
|
}), createElement(BlockIcon, {
|
|
32
25
|
icon: blockType.icon
|
|
33
26
|
}))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/checklist.js"],"names":["BlockIcon","CheckboxControl","BlockTypesChecklist","blockTypes","value","onItemChange","map","blockType","name","title","includes","args","icon"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,yBAA1B;AACA,SAASC,eAAT,QAAgC,uBAAhC;;AAEA,SAASC,mBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/checklist.js"],"names":["BlockIcon","CheckboxControl","BlockTypesChecklist","blockTypes","value","onItemChange","map","blockType","name","title","includes","args","icon"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,yBAA1B;AACA,SAASC,eAAT,QAAgC,uBAAhC;;AAEA,SAASC,mBAAT,CAA8B;AAAEC,EAAAA,UAAF;AAAcC,EAAAA,KAAd;AAAqBC,EAAAA;AAArB,CAA9B,EAAoE;AACnE,SACC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGF,UAAU,CAACG,GAAX,CAAkBC,SAAF,IACjB;AACC,IAAA,GAAG,EAAGA,SAAS,CAACC,IADjB;AAEC,IAAA,SAAS,EAAC;AAFX,KAIC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGD,SAAS,CAACE,KAFnB;AAGC,IAAA,OAAO,EAAGL,KAAK,CAACM,QAAN,CAAgBH,SAAS,CAACC,IAA1B,CAHX;AAIC,IAAA,QAAQ,EAAG,CAAE,GAAGG,IAAL,KACVN,YAAY,CAAEE,SAAS,CAACC,IAAZ,EAAkB,GAAGG,IAArB;AALd,IAJD,EAYC,cAAC,SAAD;AAAW,IAAA,IAAI,EAAGJ,SAAS,CAACK;AAA5B,IAZD,CADC,CADH,CADD;AAoBA;;AAED,eAAeV,mBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { CheckboxControl } from '@wordpress/components';\n\nfunction BlockTypesChecklist( { blockTypes, value, onItemChange } ) {\n\treturn (\n\t\t<ul className=\"edit-post-block-manager__checklist\">\n\t\t\t{ blockTypes.map( ( blockType ) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={ blockType.name }\n\t\t\t\t\tclassName=\"edit-post-block-manager__checklist-item\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ blockType.title }\n\t\t\t\t\t\tchecked={ value.includes( blockType.name ) }\n\t\t\t\t\t\tonChange={ ( ...args ) =>\n\t\t\t\t\t\t\tonItemChange( blockType.name, ...args )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<BlockIcon icon={ blockType.icon } />\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n\nexport default BlockTypesChecklist;\n"]}
|
|
@@ -17,14 +17,13 @@ import { speak } from '@wordpress/a11y';
|
|
|
17
17
|
import BlockManagerCategory from './category';
|
|
18
18
|
import { store as editPostStore } from '../../store';
|
|
19
19
|
|
|
20
|
-
function BlockManager(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = _ref;
|
|
20
|
+
function BlockManager({
|
|
21
|
+
blockTypes,
|
|
22
|
+
categories,
|
|
23
|
+
hasBlockSupport,
|
|
24
|
+
isMatchingSearchTerm,
|
|
25
|
+
numberOfHiddenBlocks
|
|
26
|
+
}) {
|
|
28
27
|
const debouncedSpeak = useDebounce(speak, 500);
|
|
29
28
|
const [search, setSearch] = useState(''); // Filtering occurs here (as opposed to `withSelect`) to avoid
|
|
30
29
|
// wasted renders by consequence of `Array#filter` producing
|
|
@@ -69,12 +68,9 @@ function BlockManager(_ref) {
|
|
|
69
68
|
blockTypes: blockTypes.filter(blockType => blockType.category === category.slug)
|
|
70
69
|
})), createElement(BlockManagerCategory, {
|
|
71
70
|
title: __('Uncategorized'),
|
|
72
|
-
blockTypes: blockTypes.filter(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
} = _ref2;
|
|
76
|
-
return !category;
|
|
77
|
-
})
|
|
71
|
+
blockTypes: blockTypes.filter(({
|
|
72
|
+
category
|
|
73
|
+
}) => !category)
|
|
78
74
|
})));
|
|
79
75
|
}
|
|
80
76
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"names":["store","blocksStore","withSelect","SearchControl","__","_n","sprintf","useEffect","useState","useDebounce","speak","BlockManagerCategory","editPostStore","BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","debouncedSpeak","search","setSearch","filter","blockType","parent","includes","count","length","resultsFoundMessage","nextSearch","map","category","slug","title","select","getBlockTypes","getCategories","getHiddenBlockTypes","hiddenBlockTypes","hiddenBlock","some","registeredBlock","name","Array","isArray"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,YAAjC;AACA,SAASX,KAAK,IAAIY,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,YAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"names":["store","blocksStore","withSelect","SearchControl","__","_n","sprintf","useEffect","useState","useDebounce","speak","BlockManagerCategory","editPostStore","BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","debouncedSpeak","search","setSearch","filter","blockType","parent","includes","count","length","resultsFoundMessage","nextSearch","map","category","slug","title","select","getBlockTypes","getCategories","getHiddenBlockTypes","hiddenBlockTypes","hiddenBlock","some","registeredBlock","name","Array","isArray"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,YAAjC;AACA,SAASX,KAAK,IAAIY,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,YAAT,CAAuB;AACtBC,EAAAA,UADsB;AAEtBC,EAAAA,UAFsB;AAGtBC,EAAAA,eAHsB;AAItBC,EAAAA,oBAJsB;AAKtBC,EAAAA;AALsB,CAAvB,EAMI;AACH,QAAMC,cAAc,GAAGV,WAAW,CAAEC,KAAF,EAAS,GAAT,CAAlC;AACA,QAAM,CAAEU,MAAF,EAAUC,SAAV,IAAwBb,QAAQ,CAAE,EAAF,CAAtC,CAFG,CAIH;A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,KAAqCA,gBAAgB,CAACX,MADvD;AAGA,SAAO;AACNb,IAAAA,UADM;AAENC,IAAAA,UAAU,EAAEqB,aAAa,EAFnB;AAGNpB,IAAAA,eAHM;AAINC,IAAAA,oBAJM;AAKNC,IAAAA;AALM,GAAP;AAOA,CA9BwB,CAAV,CA8BVL,YA9BU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect } from '@wordpress/data';\nimport { SearchControl } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockManagerCategory from './category';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\n\t// Filtering occurs here (as opposed to `withSelect`) to avoid\n\t// wasted renders by consequence of `Array#filter` producing\n\t// a new value reference on each call.\n\tblockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = blockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ blockTypes.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"edit-post-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"edit-post-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"edit-post-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"edit-post-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"edit-post-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t\t( blockType ) =>\n\t\t\t\t\t\t\t\tblockType.category === category.slug\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst {\n\t\tgetBlockTypes,\n\t\tgetCategories,\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t} = select( blocksStore );\n\tconst { getHiddenBlockTypes } = select( editPostStore );\n\n\t// Some hidden blocks become unregistered\n\t// by removing for instance the plugin that registered them, yet\n\t// they're still remain as hidden by the user's action.\n\t// We consider \"hidden\", blocks which were hidden and\n\t// are still registered.\n\tconst blockTypes = getBlockTypes();\n\tconst hiddenBlockTypes = getHiddenBlockTypes().filter( ( hiddenBlock ) => {\n\t\treturn blockTypes.some(\n\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t);\n\t} );\n\tconst numberOfHiddenBlocks =\n\t\tArray.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\treturn {\n\t\tblockTypes,\n\t\tcategories: getCategories(),\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t\tnumberOfHiddenBlocks,\n\t};\n} )( BlockManager );\n"]}
|
|
@@ -79,33 +79,28 @@ const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allow
|
|
|
79
79
|
*/
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
const PluginBlockSettingsMenuItem =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
82
|
+
const PluginBlockSettingsMenuItem = ({
|
|
83
|
+
allowedBlocks,
|
|
84
|
+
icon,
|
|
85
|
+
label,
|
|
86
|
+
onClick,
|
|
87
|
+
small,
|
|
88
|
+
role
|
|
89
|
+
}) => createElement(BlockSettingsMenuControls, null, ({
|
|
90
|
+
selectedBlocks,
|
|
91
|
+
onClose
|
|
92
|
+
}) => {
|
|
93
|
+
if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
label: small ? label : undefined,
|
|
105
|
-
role: role
|
|
106
|
-
}, !small && label);
|
|
107
|
-
});
|
|
108
|
-
};
|
|
97
|
+
return createElement(MenuItem, {
|
|
98
|
+
onClick: compose(onClick, onClose),
|
|
99
|
+
icon: icon,
|
|
100
|
+
label: small ? label : undefined,
|
|
101
|
+
role: role
|
|
102
|
+
}, !small && label);
|
|
103
|
+
});
|
|
109
104
|
|
|
110
105
|
export default PluginBlockSettingsMenuItem;
|
|
111
106
|
//# sourceMappingURL=plugin-block-settings-menu-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-item.js"],"names":["BlockSettingsMenuControls","MenuItem","compose","isEverySelectedBlockAllowed","selected","allowed","filter","id","includes","length","shouldRenderItem","selectedBlocks","allowedBlocks","Array","isArray","PluginBlockSettingsMenuItem","icon","label","onClick","small","role","onClose","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,yBAAT,QAA0C,yBAA1C;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,OAAT,QAAwB,oBAAxB;;AAEA,MAAMC,2BAA2B,GAAG,CAAEC,QAAF,EAAYC,OAAZ,KACnCD,QAAQ,CAACE,MAAT,CAAmBC,EAAF,IAAU,CAAEF,OAAO,CAACG,QAAR,CAAkBD,EAAlB,CAA7B,EAAsDE,MAAtD,KAAiE,CADlE;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMC,gBAAgB,GAAG,CAAEC,cAAF,EAAkBC,aAAlB,KACxB,CAAEC,KAAK,CAACC,OAAN,CAAeF,aAAf,CAAF,IACAT,2BAA2B,CAAEQ,cAAF,EAAkBC,aAAlB,CAF5B;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,2BAA2B,GAAG
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-item.js"],"names":["BlockSettingsMenuControls","MenuItem","compose","isEverySelectedBlockAllowed","selected","allowed","filter","id","includes","length","shouldRenderItem","selectedBlocks","allowedBlocks","Array","isArray","PluginBlockSettingsMenuItem","icon","label","onClick","small","role","onClose","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,yBAAT,QAA0C,yBAA1C;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,OAAT,QAAwB,oBAAxB;;AAEA,MAAMC,2BAA2B,GAAG,CAAEC,QAAF,EAAYC,OAAZ,KACnCD,QAAQ,CAACE,MAAT,CAAmBC,EAAF,IAAU,CAAEF,OAAO,CAACG,QAAR,CAAkBD,EAAlB,CAA7B,EAAsDE,MAAtD,KAAiE,CADlE;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMC,gBAAgB,GAAG,CAAEC,cAAF,EAAkBC,aAAlB,KACxB,CAAEC,KAAK,CAACC,OAAN,CAAeF,aAAf,CAAF,IACAT,2BAA2B,CAAEQ,cAAF,EAAkBC,aAAlB,CAF5B;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,2BAA2B,GAAG,CAAE;AACrCH,EAAAA,aADqC;AAErCI,EAAAA,IAFqC;AAGrCC,EAAAA,KAHqC;AAIrCC,EAAAA,OAJqC;AAKrCC,EAAAA,KALqC;AAMrCC,EAAAA;AANqC,CAAF,KAQnC,cAAC,yBAAD,QACG,CAAE;AAAET,EAAAA,cAAF;AAAkBU,EAAAA;AAAlB,CAAF,KAAmC;AACpC,MAAK,CAAEX,gBAAgB,CAAEC,cAAF,EAAkBC,aAAlB,CAAvB,EAA2D;AAC1D,WAAO,IAAP;AACA;;AACD,SACC,cAAC,QAAD;AACC,IAAA,OAAO,EAAGV,OAAO,CAAEgB,OAAF,EAAWG,OAAX,CADlB;AAEC,IAAA,IAAI,EAAGL,IAFR;AAGC,IAAA,KAAK,EAAGG,KAAK,GAAGF,KAAH,GAAWK,SAHzB;AAIC,IAAA,IAAI,EAAGF;AAJR,KAMG,CAAED,KAAF,IAAWF,KANd,CADD;AAUA,CAfF,CARD;;AA2BA,eAAeF,2BAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockSettingsMenuControls } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\n\nconst isEverySelectedBlockAllowed = ( selected, allowed ) =>\n\tselected.filter( ( id ) => ! allowed.includes( id ) ).length === 0;\n\n/**\n * Plugins may want to add an item to the menu either for every block\n * or only for the specific ones provided in the `allowedBlocks` component property.\n *\n * If there are multiple blocks selected the item will be rendered if every block\n * is of one allowed type (not necessarily the same).\n *\n * @param {string[]} selectedBlocks Array containing the names of the blocks selected\n * @param {string[]} allowedBlocks Array containing the names of the blocks allowed\n * @return {boolean} Whether the item will be rendered or not.\n */\nconst shouldRenderItem = ( selectedBlocks, allowedBlocks ) =>\n\t! Array.isArray( allowedBlocks ) ||\n\tisEverySelectedBlockAllowed( selectedBlocks, allowedBlocks );\n\n/**\n * Renders a new item in the block settings menu.\n *\n * @param {Object} props Component props.\n * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.\n * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.\n * @param {string} props.label The menu item text.\n * @param {Function} props.onClick Callback function to be executed when the user click the menu item.\n * @param {boolean} [props.small] Whether to render the label or not.\n * @param {string} [props.role] The ARIA role for the menu item.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;\n *\n * function doOnClick(){\n * \t// To be called when the user clicks the menu item.\n * }\n *\n * function MyPluginBlockSettingsMenuItem() {\n * \treturn wp.element.createElement(\n * \t\tPluginBlockSettingsMenuItem,\n * \t\t{\n * \t\t\tallowedBlocks: [ 'core/paragraph' ],\n * \t\t\ticon: 'dashicon-name',\n * \t\t\tlabel: __( 'Menu item text' ),\n * \t\t\tonClick: doOnClick,\n * \t\t}\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';\n *\n * const doOnClick = ( ) => {\n * // To be called when the user clicks the menu item.\n * };\n *\n * const MyPluginBlockSettingsMenuItem = () => (\n * <PluginBlockSettingsMenuItem\n * \t\tallowedBlocks={ [ 'core/paragraph' ] }\n * \t\ticon='dashicon-name'\n * \t\tlabel={ __( 'Menu item text' ) }\n * \t\tonClick={ doOnClick } />\n * );\n * ```\n *\n * @return {WPComponent} The component to be rendered.\n */\nconst PluginBlockSettingsMenuItem = ( {\n\tallowedBlocks,\n\ticon,\n\tlabel,\n\tonClick,\n\tsmall,\n\trole,\n} ) => (\n\t<BlockSettingsMenuControls>\n\t\t{ ( { selectedBlocks, onClose } ) => {\n\t\t\tif ( ! shouldRenderItem( selectedBlocks, allowedBlocks ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ compose( onClick, onClose ) }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ small ? label : undefined }\n\t\t\t\t\trole={ role }\n\t\t\t\t>\n\t\t\t\t\t{ ! small && label }\n\t\t\t\t</MenuItem>\n\t\t\t);\n\t\t} }\n\t</BlockSettingsMenuControls>\n);\n\nexport default PluginBlockSettingsMenuItem;\n"]}
|
|
@@ -36,7 +36,7 @@ export default function DevicePreview() {
|
|
|
36
36
|
hasActiveMetaboxes: select(editPostStore).hasMetaBoxes(),
|
|
37
37
|
isSaving: select(editPostStore).isSavingMetaBoxes(),
|
|
38
38
|
isPostSaveable: select(editorStore).isEditedPostSaveable(),
|
|
39
|
-
isViewable: (_postType$viewable = postType
|
|
39
|
+
isViewable: (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false,
|
|
40
40
|
deviceType: select(editPostStore).__experimentalGetPreviewDeviceType()
|
|
41
41
|
};
|
|
42
42
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/device-preview/index.js"],"names":["Icon","MenuGroup","PostPreviewButton","store","editorStore","external","__","__experimentalPreviewOptions","PreviewOptions","useDispatch","useSelect","coreStore","editPostStore","DevicePreview","hasActiveMetaboxes","isPostSaveable","isSaving","isViewable","deviceType","select","getEditedPostAttribute","getPostType","postType","hasMetaBoxes","isSavingMetaBoxes","isEditedPostSaveable","viewable","__experimentalGetPreviewDeviceType","__experimentalSetPreviewDeviceType","setPreviewDeviceType","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,SAAf,QAAgC,uBAAhC;AACA,SAASC,iBAAT,EAA4BC,KAAK,IAAIC,WAArC,QAAwD,mBAAxD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,4BAA4B,IAAIC,cAAzC,QAA+D,yBAA/D;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASP,KAAK,IAAIQ,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASR,KAAK,IAAIS,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,aAAT,GAAyB;AACvC,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,cAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA,UAJK;AAKLC,IAAAA;AALK,MAMFR,SAAS,CAAIS,MAAF,IAAc;AAAA;;AAC5B,UAAM;AAAEC,MAAAA;AAAF,QAA6BD,MAAM,CAAEf,WAAF,CAAzC;AACA,UAAM;AAAEiB,MAAAA;AAAF,QAAkBF,MAAM,CAAER,SAAF,CAA9B;AACA,UAAMW,QAAQ,GAAGD,WAAW,CAAED,sBAAsB,CAAE,MAAF,CAAxB,CAA5B;AAEA,WAAO;AACNN,MAAAA,kBAAkB,EAAEK,MAAM,CAAEP,aAAF,CAAN,CAAwBW,YAAxB,EADd;AAENP,MAAAA,QAAQ,EAAEG,MAAM,CAAEP,aAAF,CAAN,CAAwBY,iBAAxB,EAFJ;AAGNT,MAAAA,cAAc,EAAEI,MAAM,CAAEf,WAAF,CAAN,CAAsBqB,oBAAtB,EAHV;AAINR,MAAAA,UAAU,wBAAEK,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/device-preview/index.js"],"names":["Icon","MenuGroup","PostPreviewButton","store","editorStore","external","__","__experimentalPreviewOptions","PreviewOptions","useDispatch","useSelect","coreStore","editPostStore","DevicePreview","hasActiveMetaboxes","isPostSaveable","isSaving","isViewable","deviceType","select","getEditedPostAttribute","getPostType","postType","hasMetaBoxes","isSavingMetaBoxes","isEditedPostSaveable","viewable","__experimentalGetPreviewDeviceType","__experimentalSetPreviewDeviceType","setPreviewDeviceType","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,SAAf,QAAgC,uBAAhC;AACA,SAASC,iBAAT,EAA4BC,KAAK,IAAIC,WAArC,QAAwD,mBAAxD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,4BAA4B,IAAIC,cAAzC,QAA+D,yBAA/D;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASP,KAAK,IAAIQ,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASR,KAAK,IAAIS,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,aAAT,GAAyB;AACvC,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,cAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA,UAJK;AAKLC,IAAAA;AALK,MAMFR,SAAS,CAAIS,MAAF,IAAc;AAAA;;AAC5B,UAAM;AAAEC,MAAAA;AAAF,QAA6BD,MAAM,CAAEf,WAAF,CAAzC;AACA,UAAM;AAAEiB,MAAAA;AAAF,QAAkBF,MAAM,CAAER,SAAF,CAA9B;AACA,UAAMW,QAAQ,GAAGD,WAAW,CAAED,sBAAsB,CAAE,MAAF,CAAxB,CAA5B;AAEA,WAAO;AACNN,MAAAA,kBAAkB,EAAEK,MAAM,CAAEP,aAAF,CAAN,CAAwBW,YAAxB,EADd;AAENP,MAAAA,QAAQ,EAAEG,MAAM,CAAEP,aAAF,CAAN,CAAwBY,iBAAxB,EAFJ;AAGNT,MAAAA,cAAc,EAAEI,MAAM,CAAEf,WAAF,CAAN,CAAsBqB,oBAAtB,EAHV;AAINR,MAAAA,UAAU,wBAAEK,QAAQ,EAAEI,QAAZ,mEAAwB,KAJ5B;AAKNR,MAAAA,UAAU,EACTC,MAAM,CAAEP,aAAF,CAAN,CAAwBe,kCAAxB;AANK,KAAP;AAQA,GAbY,EAaV,EAbU,CANb;AAoBA,QAAM;AAAEC,IAAAA,kCAAkC,EAAEC;AAAtC,MACLpB,WAAW,CAAEG,aAAF,CADZ;AAGA,SACC,cAAC,cAAD;AACC,IAAA,SAAS,EAAGG,cADb;AAEC,IAAA,SAAS,EAAC,iCAFX;AAGC,IAAA,UAAU,EAAGG,UAHd;AAIC,IAAA,aAAa,EAAGW;AAChB;AALD;AAMC,IAAA,SAAS,EAAGvB,EAAE,CAAE,SAAF;AANf,KAQGW,UAAU,IACX,cAAC,SAAD,QACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,iBAAD;AACC,IAAA,SAAS,EACR,2CAFF;AAIC,IAAA,IAAI,EAAC,UAJN;AAKC,IAAA,mBAAmB,EAAGH,kBALvB;AAMC,IAAA,gBAAgB,EAAGE,QAAQ,GAAG,IAAH,GAAUc,SANtC;AAOC,IAAA,WAAW,EACV,8BACGxB,EAAE,CAAE,oBAAF,CADL,EAEC,cAAC,IAAD;AAAM,MAAA,IAAI,EAAGD;AAAb,MAFD;AARF,IADD,CADD,CATF,CADD;AA+BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Icon, MenuGroup } from '@wordpress/components';\nimport { PostPreviewButton, store as editorStore } from '@wordpress/editor';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalPreviewOptions as PreviewOptions } from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function DevicePreview() {\n\tconst {\n\t\thasActiveMetaboxes,\n\t\tisPostSaveable,\n\t\tisSaving,\n\t\tisViewable,\n\t\tdeviceType,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn {\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tisSaving: select( editPostStore ).isSavingMetaBoxes(),\n\t\t\tisPostSaveable: select( editorStore ).isEditedPostSaveable(),\n\t\t\tisViewable: postType?.viewable ?? false,\n\t\t\tdeviceType:\n\t\t\t\tselect( editPostStore ).__experimentalGetPreviewDeviceType(),\n\t\t};\n\t}, [] );\n\tconst { __experimentalSetPreviewDeviceType: setPreviewDeviceType } =\n\t\tuseDispatch( editPostStore );\n\n\treturn (\n\t\t<PreviewOptions\n\t\t\tisEnabled={ isPostSaveable }\n\t\t\tclassName=\"edit-post-post-preview-dropdown\"\n\t\t\tdeviceType={ deviceType }\n\t\t\tsetDeviceType={ setPreviewDeviceType }\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\tviewLabel={ __( 'Preview' ) }\n\t\t>\n\t\t\t{ isViewable && (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<div className=\"edit-post-header-preview__grouping-external\">\n\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t'edit-post-header-preview__button-external'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t\t\t\tforcePreviewLink={ isSaving ? null : undefined }\n\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\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</div>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</PreviewOptions>\n\t);\n}\n"]}
|
|
@@ -10,10 +10,9 @@ import { useBlockSelectionListener, useUpdatePostLinkListener } from './listener
|
|
|
10
10
|
* @return {null} This is a data component so does not render any ui.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export default function EditorInitialization(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} = _ref;
|
|
13
|
+
export default function EditorInitialization({
|
|
14
|
+
postId
|
|
15
|
+
}) {
|
|
17
16
|
useBlockSelectionListener(postId);
|
|
18
17
|
useUpdatePostLinkListener(postId);
|
|
19
18
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/editor-initialization/index.js"],"names":["useBlockSelectionListener","useUpdatePostLinkListener","EditorInitialization","postId"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,yBADD,EAECC,yBAFD,QAGO,kBAHP;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,oBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/editor-initialization/index.js"],"names":["useBlockSelectionListener","useUpdatePostLinkListener","EditorInitialization","postId"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,yBADD,EAECC,yBAFD,QAGO,kBAHP;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,oBAAT,CAA+B;AAAEC,EAAAA;AAAF,CAA/B,EAA4C;AAC1DH,EAAAA,yBAAyB,CAAEG,MAAF,CAAzB;AACAF,EAAAA,yBAAyB,CAAEE,MAAF,CAAzB;AACA,SAAO,IAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tuseBlockSelectionListener,\n\tuseUpdatePostLinkListener,\n} from './listener-hooks';\n\n/**\n * Data component used for initializing the editor and re-initializes\n * when postId changes or on unmount.\n *\n * @param {number} postId The id of the post.\n * @return {null} This is a data component so does not render any ui.\n */\nexport default function EditorInitialization( { postId } ) {\n\tuseBlockSelectionListener( postId );\n\tuseUpdatePostLinkListener( postId );\n\treturn null;\n}\n"]}
|