@wordpress/editor 13.33.0 → 13.35.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 +12 -4
- package/README.md +132 -20
- package/build/bindings/pattern-overrides.js +70 -1
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/components/autosave-monitor/index.js +15 -12
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +126 -0
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
- package/build/components/block-settings-menu/content-only-settings-menu.native.js +11 -0
- package/build/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
- package/build/components/character-count/index.js +5 -0
- package/build/components/character-count/index.js.map +1 -1
- package/build/components/collapsible-block-toolbar/index.js +73 -0
- package/build/components/collapsible-block-toolbar/index.js.map +1 -0
- package/build/components/document-bar/index.js +2 -2
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/check.js +8 -0
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/document-outline/index.js +11 -0
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js +2 -2
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/document-tools/index.js +15 -25
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build/components/editor-canvas/index.js +19 -8
- package/build/components/editor-canvas/index.js.map +1 -1
- package/build/components/editor-history/redo.js +11 -0
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +11 -0
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-snackbars/index.js +6 -0
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +7 -0
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +35 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/global-styles-provider/index.js +130 -0
- package/build/components/global-styles-provider/index.js.map +1 -0
- package/build/components/header/index.js +147 -0
- package/build/components/header/index.js.map +1 -0
- package/build/components/inserter-sidebar/index.js +56 -34
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/list-view-sidebar/index.js +1 -1
- package/build/components/list-view-sidebar/index.js.map +1 -1
- package/build/components/more-menu/copy-content-menu-item.js +59 -0
- package/build/components/more-menu/copy-content-menu-item.js.map +1 -0
- package/build/components/more-menu/index.js +119 -0
- package/build/components/more-menu/index.js.map +1 -0
- package/build/components/more-menu/tools-more-menu-group.js +23 -0
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build/components/more-menu/view-more-menu-group.js +24 -0
- package/build/components/more-menu/view-more-menu-group.js.map +1 -0
- package/build/components/page-attributes/check.js +8 -0
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/order.js +7 -0
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/panel.js +14 -8
- package/build/components/page-attributes/panel.js.map +1 -1
- package/build/components/page-attributes/parent.js +7 -0
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-post-publish-panel/index.js +1 -1
- package/build/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/plugin-pre-publish-panel/index.js +1 -1
- package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +1 -1
- package/build/components/plugin-sidebar/index.js.map +1 -1
- package/build/components/post-actions/actions.js +219 -66
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +32 -16
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/check.js +9 -0
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/index.js +6 -0
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/panel.js +5 -0
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-card-panel/index.js +7 -66
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-comments/index.js +28 -8
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-content-information/index.js +72 -0
- package/build/components/post-content-information/index.js.map +1 -0
- package/build/components/post-discussion/panel.js +104 -20
- package/build/components/post-discussion/panel.js.map +1 -1
- package/build/components/post-excerpt/check.js +0 -19
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js +52 -12
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js +118 -7
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-excerpt/plugin.js +2 -2
- package/build/components/post-excerpt/plugin.js.map +1 -1
- package/build/components/post-featured-image/index.js +1 -1
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/panel.js +27 -0
- package/build/components/post-format/panel.js.map +1 -0
- package/build/components/post-last-edited-panel/index.js +33 -0
- package/build/components/post-last-edited-panel/index.js.map +1 -0
- package/build/components/post-panel-row/index.js +2 -2
- package/build/components/post-panel-row/index.js.map +1 -1
- package/build/components/post-panel-section/index.js +28 -0
- package/build/components/post-panel-section/index.js.map +1 -0
- package/build/components/post-pingbacks/index.js +5 -2
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-publish-button/post-publish-button-or-toggle.js +100 -0
- package/build/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
- package/build/components/post-saved-state/index.js +2 -2
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/panel.js +1 -1
- package/build/components/post-schedule/panel.js.map +1 -1
- package/build/components/post-slug/panel.js +27 -0
- package/build/components/post-slug/panel.js.map +1 -0
- package/build/components/post-status/index.js +13 -13
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-sticky/panel.js +21 -0
- package/build/components/post-sticky/panel.js.map +1 -0
- package/build/components/post-template/block-theme.js +2 -2
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js +0 -1
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/swap-template-button.js +2 -5
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-title/index.js +2 -2
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/post-title-raw.js +2 -2
- package/build/components/post-title/post-title-raw.js.map +1 -1
- package/build/components/post-transform-panel/hooks.js +90 -0
- package/build/components/post-transform-panel/hooks.js.map +1 -0
- package/build/components/post-transform-panel/index.js +101 -0
- package/build/components/post-transform-panel/index.js.map +1 -0
- package/build/components/post-trash/panel.js +18 -0
- package/build/components/post-trash/panel.js.map +1 -0
- package/build/components/post-type-support-check/index.js +1 -1
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/index.js +2 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/panel.js +1 -1
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/preferences-modal/enable-publish-sidebar.js +34 -0
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
- package/build/components/preferences-modal/index.js +11 -5
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +3 -1
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +23 -16
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +21 -3
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/save-publish-panels/index.js +89 -0
- package/build/components/save-publish-panels/index.js.map +1 -0
- package/build/components/sidebar/constants.js +11 -0
- package/build/components/sidebar/constants.js.map +1 -0
- package/build/components/sidebar/header.js +53 -0
- package/build/components/sidebar/header.js.map +1 -0
- package/build/components/sidebar/index.js +157 -0
- package/build/components/sidebar/index.js.map +1 -0
- package/build/components/sidebar/post-summary.js +84 -0
- package/build/components/sidebar/post-summary.js.map +1 -0
- package/build/components/start-page-options/index.js +10 -8
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/start-template-options/index.js +192 -0
- package/build/components/start-template-options/index.js.map +1 -0
- package/build/components/template-content-panel/index.js +38 -0
- package/build/components/template-content-panel/index.js.map +1 -0
- package/build/hooks/pattern-overrides.js +10 -5
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/private-apis.js +19 -8
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +72 -0
- package/build/private-apis.native.js.map +1 -0
- package/build/store/private-selectors.js +6 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +15 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +3 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +69 -1
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/components/autosave-monitor/index.js +15 -13
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +119 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.native.js +5 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
- package/build-module/components/character-count/index.js +6 -0
- package/build-module/components/character-count/index.js.map +1 -1
- package/build-module/components/collapsible-block-toolbar/index.js +65 -0
- package/build-module/components/collapsible-block-toolbar/index.js.map +1 -0
- package/build-module/components/document-bar/index.js +2 -2
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/check.js +9 -0
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/document-outline/index.js +11 -0
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +2 -2
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/document-tools/index.js +17 -27
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/editor-canvas/index.js +19 -8
- package/build-module/components/editor-canvas/index.js.map +1 -1
- package/build-module/components/editor-history/redo.js +11 -0
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +11 -0
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +6 -0
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +8 -0
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +36 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +120 -0
- package/build-module/components/global-styles-provider/index.js.map +1 -0
- package/build-module/components/header/index.js +139 -0
- package/build-module/components/header/index.js.map +1 -0
- package/build-module/components/inserter-sidebar/index.js +59 -37
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/list-view-sidebar/index.js +1 -1
- package/build-module/components/list-view-sidebar/index.js.map +1 -1
- package/build-module/components/more-menu/copy-content-menu-item.js +52 -0
- package/build-module/components/more-menu/copy-content-menu-item.js.map +1 -0
- package/build-module/components/more-menu/index.js +111 -0
- package/build-module/components/more-menu/index.js.map +1 -0
- package/build-module/components/more-menu/tools-more-menu-group.js +16 -0
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build-module/components/more-menu/view-more-menu-group.js +17 -0
- package/build-module/components/more-menu/view-more-menu-group.js.map +1 -0
- package/build-module/components/page-attributes/check.js +9 -0
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js +7 -0
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/panel.js +13 -6
- package/build-module/components/page-attributes/panel.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +7 -0
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-post-publish-panel/index.js +1 -1
- package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +1 -1
- package/build-module/components/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +223 -70
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +33 -17
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/check.js +10 -0
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/index.js +6 -0
- package/build-module/components/post-author/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +6 -0
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +9 -67
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-comments/index.js +30 -10
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-content-information/index.js +66 -0
- package/build-module/components/post-content-information/index.js.map +1 -0
- package/build-module/components/post-discussion/panel.js +105 -21
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/check.js +0 -19
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +52 -11
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +118 -8
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-excerpt/plugin.js +2 -2
- package/build-module/components/post-excerpt/plugin.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +1 -1
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/panel.js +18 -0
- package/build-module/components/post-format/panel.js.map +1 -0
- package/build-module/components/post-last-edited-panel/index.js +26 -0
- package/build-module/components/post-last-edited-panel/index.js.map +1 -0
- package/build-module/components/post-panel-row/index.js +2 -2
- package/build-module/components/post-panel-row/index.js.map +1 -1
- package/build-module/components/post-panel-section/index.js +20 -0
- package/build-module/components/post-panel-section/index.js.map +1 -0
- package/build-module/components/post-pingbacks/index.js +6 -3
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-publish-button/post-publish-button-or-toggle.js +91 -0
- package/build-module/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
- package/build-module/components/post-saved-state/index.js +2 -2
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/panel.js +1 -1
- package/build-module/components/post-schedule/panel.js.map +1 -1
- package/build-module/components/post-slug/panel.js +18 -0
- package/build-module/components/post-slug/panel.js.map +1 -0
- package/build-module/components/post-status/index.js +13 -13
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-sticky/panel.js +12 -0
- package/build-module/components/post-sticky/panel.js.map +1 -0
- package/build-module/components/post-template/block-theme.js +2 -2
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +0 -1
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +3 -6
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-title/index.js +2 -2
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/post-title-raw.js +2 -2
- package/build-module/components/post-title/post-title-raw.js.map +1 -1
- package/build-module/components/post-transform-panel/hooks.js +83 -0
- package/build-module/components/post-transform-panel/hooks.js.map +1 -0
- package/build-module/components/post-transform-panel/index.js +94 -0
- package/build-module/components/post-transform-panel/index.js.map +1 -0
- package/build-module/components/post-trash/panel.js +10 -0
- package/build-module/components/post-trash/panel.js.map +1 -0
- package/build-module/components/post-type-support-check/index.js +1 -1
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/index.js +2 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/panel.js +1 -1
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/preferences-modal/enable-publish-sidebar.js +27 -0
- package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +11 -5
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +3 -1
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +24 -17
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +21 -3
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +80 -0
- package/build-module/components/save-publish-panels/index.js.map +1 -0
- package/build-module/components/sidebar/constants.js +5 -0
- package/build-module/components/sidebar/constants.js.map +1 -0
- package/build-module/components/sidebar/header.js +46 -0
- package/build-module/components/sidebar/header.js.map +1 -0
- package/build-module/components/sidebar/index.js +149 -0
- package/build-module/components/sidebar/index.js.map +1 -0
- package/build-module/components/sidebar/post-summary.js +77 -0
- package/build-module/components/sidebar/post-summary.js.map +1 -0
- package/build-module/components/start-page-options/index.js +10 -8
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +185 -0
- package/build-module/components/start-template-options/index.js.map +1 -0
- package/build-module/components/template-content-panel/index.js +31 -0
- package/build-module/components/template-content-panel/index.js.map +1 -0
- package/build-module/hooks/pattern-overrides.js +10 -5
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/private-apis.js +19 -8
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +62 -0
- package/build-module/private-apis.native.js.map +1 -0
- package/build-module/store/private-selectors.js +3 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +14 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +3 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +535 -48
- package/build-style/style.css +535 -48
- package/package.json +38 -36
- package/src/bindings/pattern-overrides.js +83 -1
- package/src/components/autocompleters/style.scss +1 -2
- package/src/components/autosave-monitor/index.js +15 -12
- package/src/components/block-settings-menu/content-only-settings-menu.js +175 -0
- package/src/components/block-settings-menu/content-only-settings-menu.native.js +4 -0
- package/src/components/block-settings-menu/style.scss +4 -0
- package/src/components/character-count/index.js +5 -0
- package/src/components/collapsible-block-toolbar/index.js +77 -0
- package/src/components/collapsible-block-toolbar/style.scss +80 -0
- package/src/components/document-bar/index.js +2 -2
- package/src/components/document-outline/check.js +8 -0
- package/src/components/document-outline/index.js +10 -0
- package/src/components/document-outline/item.js +2 -2
- package/src/components/document-tools/index.js +19 -26
- package/src/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/src/components/editor-canvas/index.js +18 -6
- package/src/components/editor-history/redo.js +10 -0
- package/src/components/editor-history/undo.js +10 -0
- package/src/components/editor-snackbars/index.js +5 -0
- package/src/components/entities-saved-states/style.scss +7 -0
- package/src/components/global-keyboard-shortcuts/index.js +7 -0
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +42 -1
- package/src/components/global-styles-provider/index.js +162 -0
- package/src/components/header/index.js +154 -0
- package/src/components/header/style.scss +231 -0
- package/src/components/inserter-sidebar/index.js +52 -32
- package/src/components/inserter-sidebar/style.scss +10 -3
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
- package/src/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/src/components/list-view-sidebar/index.js +1 -1
- package/src/components/list-view-sidebar/style.scss +3 -2
- package/src/components/more-menu/copy-content-menu-item.js +51 -0
- package/src/components/more-menu/index.js +158 -0
- package/src/components/more-menu/tools-more-menu-group.js +11 -0
- package/src/components/more-menu/view-more-menu-group.js +13 -0
- package/src/components/page-attributes/check.js +8 -0
- package/src/components/page-attributes/order.js +6 -0
- package/src/components/page-attributes/panel.js +21 -17
- package/src/components/page-attributes/parent.js +6 -0
- package/src/components/page-attributes/test/order.js +5 -1
- package/src/components/plugin-post-publish-panel/index.js +1 -1
- package/src/components/plugin-pre-publish-panel/index.js +1 -1
- package/src/components/plugin-sidebar/index.js +1 -1
- package/src/components/post-actions/actions.js +373 -152
- package/src/components/post-actions/index.js +34 -33
- package/src/components/post-author/check.js +9 -0
- package/src/components/post-author/index.js +5 -0
- package/src/components/post-author/panel.js +5 -0
- package/src/components/post-card-panel/index.js +40 -141
- package/src/components/post-card-panel/style.scss +2 -6
- package/src/components/post-comments/index.js +47 -9
- package/src/components/post-content-information/index.js +83 -0
- package/src/components/post-content-information/style.scss +6 -0
- package/src/components/post-discussion/panel.js +108 -27
- package/src/components/post-discussion/style.scss +26 -0
- package/src/components/post-excerpt/check.js +0 -18
- package/src/components/post-excerpt/index.js +66 -15
- package/src/components/post-excerpt/panel.js +196 -19
- package/src/components/post-excerpt/plugin.js +2 -2
- package/src/components/post-excerpt/style.scss +24 -0
- package/src/components/post-featured-image/index.js +1 -1
- package/src/components/post-featured-image/style.scss +2 -8
- package/src/components/post-format/panel.js +22 -0
- package/src/components/post-format/style.scss +6 -0
- package/src/components/post-last-edited-panel/index.js +35 -0
- package/src/components/post-last-edited-panel/style.scss +6 -0
- package/src/components/post-last-revision/test/check.js +5 -1
- package/src/components/post-panel-row/index.js +2 -2
- package/src/components/post-panel-row/style.scss +3 -3
- package/src/components/post-panel-section/index.js +19 -0
- package/src/components/post-panel-section/style.scss +3 -0
- package/src/components/post-pingbacks/index.js +11 -2
- package/src/components/post-publish-button/post-publish-button-or-toggle.js +102 -0
- package/src/components/post-publish-button/test/post-publish-button-or-toggle.js +63 -0
- package/src/components/post-publish-panel/style.scss +48 -0
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +225 -75
- package/src/components/post-saved-state/index.js +2 -2
- package/src/components/post-schedule/panel.js +1 -1
- package/src/components/post-schedule/style.scss +2 -4
- package/src/components/post-slug/panel.js +22 -0
- package/src/components/post-slug/style.scss +5 -0
- package/src/components/post-slug/test/index.js +5 -1
- package/src/components/post-status/index.js +88 -80
- package/src/components/post-status/style.scss +0 -1
- package/src/components/post-sticky/panel.js +18 -0
- package/src/components/post-template/block-theme.js +2 -2
- package/src/components/post-template/classic-theme.js +0 -1
- package/src/components/post-template/swap-template-button.js +3 -6
- package/src/components/post-text-editor/style.scss +1 -1
- package/src/components/post-title/index.js +2 -2
- package/src/components/post-title/post-title-raw.js +2 -2
- package/src/components/post-title/style.scss +1 -1
- package/src/components/post-transform-panel/hooks.js +114 -0
- package/src/components/post-transform-panel/index.js +99 -0
- package/src/components/post-trash/panel.js +13 -0
- package/src/components/post-type-support-check/index.js +1 -1
- package/src/components/post-type-support-check/test/index.js +2 -2
- package/src/components/post-url/index.js +1 -0
- package/src/components/post-url/panel.js +1 -1
- package/src/components/preferences-modal/enable-publish-sidebar.js +28 -0
- package/src/components/preferences-modal/index.js +17 -3
- package/src/components/preview-dropdown/index.js +3 -1
- package/src/components/provider/disable-non-page-content-blocks.js +23 -21
- package/src/components/provider/index.js +4 -0
- package/src/components/provider/use-block-editor-settings.js +19 -4
- package/src/components/save-publish-panels/index.js +96 -0
- package/src/components/save-publish-panels/style.scss +36 -0
- package/src/components/sidebar/constants.js +4 -0
- package/src/components/sidebar/header.js +49 -0
- package/src/components/sidebar/index.js +200 -0
- package/src/components/sidebar/post-summary.js +104 -0
- package/src/components/sidebar/style.scss +18 -0
- package/src/components/start-page-options/index.js +12 -5
- package/src/components/start-template-options/index.js +219 -0
- package/src/components/start-template-options/style.scss +55 -0
- package/src/components/template-areas/style.scss +0 -1
- package/src/components/template-content-panel/index.js +36 -0
- package/src/hooks/pattern-overrides.js +12 -6
- package/src/private-apis.js +22 -8
- package/src/private-apis.native.js +61 -0
- package/src/store/private-selectors.js +3 -0
- package/src/store/reducer.js +12 -0
- package/src/store/selectors.js +3 -1
- package/src/style.scss +11 -0
- package/src/components/post-slug/test/check.js +0 -17
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
+
import { Button, createSlotFill } from '@wordpress/components';
|
|
7
|
+
import { __ } from '@wordpress/i18n';
|
|
8
|
+
import { useCallback } from '@wordpress/element';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import EntitiesSavedStates from '../entities-saved-states';
|
|
14
|
+
import PostPublishPanel from '../post-publish-panel';
|
|
15
|
+
import PluginPrePublishPanel from '../plugin-pre-publish-panel';
|
|
16
|
+
import PluginPostPublishPanel from '../plugin-post-publish-panel';
|
|
17
|
+
import { store as editorStore } from '../../store';
|
|
18
|
+
const {
|
|
19
|
+
Fill,
|
|
20
|
+
Slot
|
|
21
|
+
} = createSlotFill('ActionsPanel');
|
|
22
|
+
export const ActionsPanelFill = Fill;
|
|
23
|
+
export default function SavePublishPanels({
|
|
24
|
+
setEntitiesSavedStatesCallback,
|
|
25
|
+
closeEntitiesSavedStates,
|
|
26
|
+
isEntitiesSavedStatesOpen,
|
|
27
|
+
forceIsDirtyPublishPanel
|
|
28
|
+
}) {
|
|
29
|
+
const {
|
|
30
|
+
closePublishSidebar,
|
|
31
|
+
togglePublishSidebar
|
|
32
|
+
} = useDispatch(editorStore);
|
|
33
|
+
const {
|
|
34
|
+
publishSidebarOpened,
|
|
35
|
+
hasNonPostEntityChanges
|
|
36
|
+
} = useSelect(select => ({
|
|
37
|
+
publishSidebarOpened: select(editorStore).isPublishSidebarOpened(),
|
|
38
|
+
hasNonPostEntityChanges: select(editorStore).hasNonPostEntityChanges()
|
|
39
|
+
}), []);
|
|
40
|
+
const openEntitiesSavedStates = useCallback(() => setEntitiesSavedStatesCallback(true), []);
|
|
41
|
+
|
|
42
|
+
// It is ok for these components to be unmounted when not in visual use.
|
|
43
|
+
// We don't want more than one present at a time, decide which to render.
|
|
44
|
+
let unmountableContent;
|
|
45
|
+
if (publishSidebarOpened) {
|
|
46
|
+
unmountableContent = createElement(PostPublishPanel, {
|
|
47
|
+
onClose: closePublishSidebar,
|
|
48
|
+
forceIsDirty: forceIsDirtyPublishPanel,
|
|
49
|
+
PrePublishExtension: PluginPrePublishPanel.Slot,
|
|
50
|
+
PostPublishExtension: PluginPostPublishPanel.Slot
|
|
51
|
+
});
|
|
52
|
+
} else if (hasNonPostEntityChanges) {
|
|
53
|
+
unmountableContent = createElement("div", {
|
|
54
|
+
className: "editor-layout__toggle-entities-saved-states-panel"
|
|
55
|
+
}, createElement(Button, {
|
|
56
|
+
variant: "secondary",
|
|
57
|
+
className: "editor-layout__toggle-entities-saved-states-panel-button",
|
|
58
|
+
onClick: openEntitiesSavedStates,
|
|
59
|
+
"aria-expanded": false
|
|
60
|
+
}, __('Open save panel')));
|
|
61
|
+
} else {
|
|
62
|
+
unmountableContent = createElement("div", {
|
|
63
|
+
className: "editor-layout__toggle-publish-panel"
|
|
64
|
+
}, createElement(Button, {
|
|
65
|
+
variant: "secondary",
|
|
66
|
+
className: "editor-layout__toggle-publish-panel-button",
|
|
67
|
+
onClick: togglePublishSidebar,
|
|
68
|
+
"aria-expanded": false
|
|
69
|
+
}, __('Open publish panel')));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Since EntitiesSavedStates controls its own panel, we can keep it
|
|
73
|
+
// always mounted to retain its own component state (such as checkboxes).
|
|
74
|
+
return createElement(Fragment, null, isEntitiesSavedStatesOpen && createElement(EntitiesSavedStates, {
|
|
75
|
+
close: closeEntitiesSavedStates
|
|
76
|
+
}), createElement(Slot, {
|
|
77
|
+
bubblesVirtually: true
|
|
78
|
+
}), !isEntitiesSavedStatesOpen && unmountableContent);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","Button","createSlotFill","__","useCallback","EntitiesSavedStates","PostPublishPanel","PluginPrePublishPanel","PluginPostPublishPanel","store","editorStore","Fill","Slot","ActionsPanelFill","SavePublishPanels","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","isEntitiesSavedStatesOpen","forceIsDirtyPublishPanel","closePublishSidebar","togglePublishSidebar","publishSidebarOpened","hasNonPostEntityChanges","select","isPublishSidebarOpened","openEntitiesSavedStates","unmountableContent","createElement","onClose","forceIsDirty","PrePublishExtension","PostPublishExtension","className","variant","onClick","Fragment","close","bubblesVirtually"],"sources":["@wordpress/editor/src/components/save-publish-panels/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, createSlotFill } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EntitiesSavedStates from '../entities-saved-states';\nimport PostPublishPanel from '../post-publish-panel';\nimport PluginPrePublishPanel from '../plugin-pre-publish-panel';\nimport PluginPostPublishPanel from '../plugin-post-publish-panel';\nimport { store as editorStore } from '../../store';\n\nconst { Fill, Slot } = createSlotFill( 'ActionsPanel' );\n\nexport const ActionsPanelFill = Fill;\n\nexport default function SavePublishPanels( {\n\tsetEntitiesSavedStatesCallback,\n\tcloseEntitiesSavedStates,\n\tisEntitiesSavedStatesOpen,\n\tforceIsDirtyPublishPanel,\n} ) {\n\tconst { closePublishSidebar, togglePublishSidebar } =\n\t\tuseDispatch( editorStore );\n\tconst { publishSidebarOpened, hasNonPostEntityChanges } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpublishSidebarOpened:\n\t\t\t\tselect( editorStore ).isPublishSidebarOpened(),\n\t\t\thasNonPostEntityChanges:\n\t\t\t\tselect( editorStore ).hasNonPostEntityChanges(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst openEntitiesSavedStates = useCallback(\n\t\t() => setEntitiesSavedStatesCallback( true ),\n\t\t[]\n\t);\n\n\t// It is ok for these components to be unmounted when not in visual use.\n\t// We don't want more than one present at a time, decide which to render.\n\tlet unmountableContent;\n\tif ( publishSidebarOpened ) {\n\t\tunmountableContent = (\n\t\t\t<PostPublishPanel\n\t\t\t\tonClose={ closePublishSidebar }\n\t\t\t\tforceIsDirty={ forceIsDirtyPublishPanel }\n\t\t\t\tPrePublishExtension={ PluginPrePublishPanel.Slot }\n\t\t\t\tPostPublishExtension={ PluginPostPublishPanel.Slot }\n\t\t\t/>\n\t\t);\n\t} else if ( hasNonPostEntityChanges ) {\n\t\tunmountableContent = (\n\t\t\t<div className=\"editor-layout__toggle-entities-saved-states-panel\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"editor-layout__toggle-entities-saved-states-panel-button\"\n\t\t\t\t\tonClick={ openEntitiesSavedStates }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\tunmountableContent = (\n\t\t\t<div className=\"editor-layout__toggle-publish-panel\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"editor-layout__toggle-publish-panel-button\"\n\t\t\t\t\tonClick={ togglePublishSidebar }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open publish panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Since EntitiesSavedStates controls its own panel, we can keep it\n\t// always mounted to retain its own component state (such as checkboxes).\n\treturn (\n\t\t<>\n\t\t\t{ isEntitiesSavedStatesOpen && (\n\t\t\t\t<EntitiesSavedStates close={ closeEntitiesSavedStates } />\n\t\t\t) }\n\t\t\t<Slot bubblesVirtually />\n\t\t\t{ ! isEntitiesSavedStatesOpen && unmountableContent }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,cAAc,QAAQ,uBAAuB;AAC9D,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,gBAAgB,MAAM,uBAAuB;AACpD,OAAOC,qBAAqB,MAAM,6BAA6B;AAC/D,OAAOC,sBAAsB,MAAM,8BAA8B;AACjE,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,MAAM;EAAEC,IAAI;EAAEC;AAAK,CAAC,GAAGV,cAAc,CAAE,cAAe,CAAC;AAEvD,OAAO,MAAMW,gBAAgB,GAAGF,IAAI;AAEpC,eAAe,SAASG,iBAAiBA,CAAE;EAC1CC,8BAA8B;EAC9BC,wBAAwB;EACxBC,yBAAyB;EACzBC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC,mBAAmB;IAAEC;EAAqB,CAAC,GAClDpB,WAAW,CAAEU,WAAY,CAAC;EAC3B,MAAM;IAAEW,oBAAoB;IAAEC;EAAwB,CAAC,GAAGvB,SAAS,CAChEwB,MAAM,KAAQ;IACfF,oBAAoB,EACnBE,MAAM,CAAEb,WAAY,CAAC,CAACc,sBAAsB,CAAC,CAAC;IAC/CF,uBAAuB,EACtBC,MAAM,CAAEb,WAAY,CAAC,CAACY,uBAAuB,CAAC;EAChD,CAAC,CAAE,EACH,EACD,CAAC;EAED,MAAMG,uBAAuB,GAAGrB,WAAW,CAC1C,MAAMW,8BAA8B,CAAE,IAAK,CAAC,EAC5C,EACD,CAAC;;EAED;EACA;EACA,IAAIW,kBAAkB;EACtB,IAAKL,oBAAoB,EAAG;IAC3BK,kBAAkB,GACjBC,aAAA,CAACrB,gBAAgB;MAChBsB,OAAO,EAAGT,mBAAqB;MAC/BU,YAAY,EAAGX,wBAA0B;MACzCY,mBAAmB,EAAGvB,qBAAqB,CAACK,IAAM;MAClDmB,oBAAoB,EAAGvB,sBAAsB,CAACI;IAAM,CACpD,CACD;EACF,CAAC,MAAM,IAAKU,uBAAuB,EAAG;IACrCI,kBAAkB,GACjBC,aAAA;MAAKK,SAAS,EAAC;IAAmD,GACjEL,aAAA,CAAC1B,MAAM;MACNgC,OAAO,EAAC,WAAW;MACnBD,SAAS,EAAC,0DAA0D;MACpEE,OAAO,EAAGT,uBAAyB;MACnC,iBAAgB;IAAO,GAErBtB,EAAE,CAAE,iBAAkB,CACjB,CACJ,CACL;EACF,CAAC,MAAM;IACNuB,kBAAkB,GACjBC,aAAA;MAAKK,SAAS,EAAC;IAAqC,GACnDL,aAAA,CAAC1B,MAAM;MACNgC,OAAO,EAAC,WAAW;MACnBD,SAAS,EAAC,4CAA4C;MACtDE,OAAO,EAAGd,oBAAsB;MAChC,iBAAgB;IAAO,GAErBjB,EAAE,CAAE,oBAAqB,CACpB,CACJ,CACL;EACF;;EAEA;EACA;EACA,OACCwB,aAAA,CAAAQ,QAAA,QACGlB,yBAAyB,IAC1BU,aAAA,CAACtB,mBAAmB;IAAC+B,KAAK,EAAGpB;EAA0B,CAAE,CACzD,EACDW,aAAA,CAACf,IAAI;IAACyB,gBAAgB;EAAA,CAAE,CAAC,EACvB,CAAEpB,yBAAyB,IAAIS,kBAChC,CAAC;AAEL","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sidebars","document","block"],"sources":["@wordpress/editor/src/components/sidebar/constants.js"],"sourcesContent":["export const sidebars = {\n\tdocument: 'edit-post/document',\n\tblock: 'edit-post/block',\n};\n"],"mappings":"AAAA,OAAO,MAAMA,QAAQ,GAAG;EACvBC,QAAQ,EAAE,oBAAoB;EAC9BC,KAAK,EAAE;AACR,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
6
|
+
import { __, _x } from '@wordpress/i18n';
|
|
7
|
+
import { useSelect } from '@wordpress/data';
|
|
8
|
+
import { forwardRef } from '@wordpress/element';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import { store as editorStore } from '../../store';
|
|
14
|
+
import { unlock } from '../../lock-unlock';
|
|
15
|
+
import { sidebars } from './constants';
|
|
16
|
+
const {
|
|
17
|
+
Tabs
|
|
18
|
+
} = unlock(componentsPrivateApis);
|
|
19
|
+
const SidebarHeader = (_, ref) => {
|
|
20
|
+
const {
|
|
21
|
+
documentLabel
|
|
22
|
+
} = useSelect(select => {
|
|
23
|
+
const {
|
|
24
|
+
getPostTypeLabel
|
|
25
|
+
} = select(editorStore);
|
|
26
|
+
return {
|
|
27
|
+
// translators: Default label for the Document sidebar tab, not selected.
|
|
28
|
+
documentLabel: getPostTypeLabel() || _x('Document', 'noun')
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
return createElement(Tabs.TabList, {
|
|
32
|
+
ref: ref
|
|
33
|
+
}, createElement(Tabs.Tab, {
|
|
34
|
+
tabId: sidebars.document
|
|
35
|
+
// Used for focus management in the SettingsSidebar component.
|
|
36
|
+
,
|
|
37
|
+
"data-tab-id": sidebars.document
|
|
38
|
+
}, documentLabel), createElement(Tabs.Tab, {
|
|
39
|
+
tabId: sidebars.block
|
|
40
|
+
// Used for focus management in the SettingsSidebar component.
|
|
41
|
+
,
|
|
42
|
+
"data-tab-id": sidebars.block
|
|
43
|
+
}, __('Block')));
|
|
44
|
+
};
|
|
45
|
+
export default forwardRef(SidebarHeader);
|
|
46
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["privateApis","componentsPrivateApis","__","_x","useSelect","forwardRef","store","editorStore","unlock","sidebars","Tabs","SidebarHeader","_","ref","documentLabel","select","getPostTypeLabel","createElement","TabList","Tab","tabId","document","block"],"sources":["@wordpress/editor/src/components/sidebar/header.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { sidebars } from './constants';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst SidebarHeader = ( _, ref ) => {\n\tconst { documentLabel } = useSelect( ( select ) => {\n\t\tconst { getPostTypeLabel } = select( editorStore );\n\n\t\treturn {\n\t\t\t// translators: Default label for the Document sidebar tab, not selected.\n\t\t\tdocumentLabel: getPostTypeLabel() || _x( 'Document', 'noun' ),\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<Tabs.TabList ref={ ref }>\n\t\t\t<Tabs.Tab\n\t\t\t\ttabId={ sidebars.document }\n\t\t\t\t// Used for focus management in the SettingsSidebar component.\n\t\t\t\tdata-tab-id={ sidebars.document }\n\t\t\t>\n\t\t\t\t{ documentLabel }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab\n\t\t\t\ttabId={ sidebars.block }\n\t\t\t\t// Used for focus management in the SettingsSidebar component.\n\t\t\t\tdata-tab-id={ sidebars.block }\n\t\t\t>\n\t\t\t\t{ /* translators: Text label for the Block Settings Sidebar tab. */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":[]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { BlockInspector, store as blockEditorStore } from '@wordpress/block-editor';
|
|
6
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
|
+
import { Platform, useCallback, useContext, useEffect, useRef } from '@wordpress/element';
|
|
8
|
+
import { isRTL, __ } from '@wordpress/i18n';
|
|
9
|
+
import { drawerLeft, drawerRight } from '@wordpress/icons';
|
|
10
|
+
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
11
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
12
|
+
import { store as interfaceStore } from '@wordpress/interface';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import PageAttributesPanel from '../page-attributes/panel';
|
|
18
|
+
import PatternOverridesPanel from '../pattern-overrides-panel';
|
|
19
|
+
import PluginDocumentSettingPanel from '../plugin-document-setting-panel';
|
|
20
|
+
import PluginSidebar from '../plugin-sidebar';
|
|
21
|
+
import PostLastRevisionPanel from '../post-last-revision/panel';
|
|
22
|
+
import PostSummary from './post-summary';
|
|
23
|
+
import PostTaxonomiesPanel from '../post-taxonomies/panel';
|
|
24
|
+
import PostTransformPanel from '../post-transform-panel';
|
|
25
|
+
import SidebarHeader from './header';
|
|
26
|
+
import TemplateContentPanel from '../template-content-panel';
|
|
27
|
+
import useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';
|
|
28
|
+
import { sidebars } from './constants';
|
|
29
|
+
import { unlock } from '../../lock-unlock';
|
|
30
|
+
import { store as editorStore } from '../../store';
|
|
31
|
+
import { NAVIGATION_POST_TYPE, TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE } from '../../store/constants';
|
|
32
|
+
const {
|
|
33
|
+
Tabs
|
|
34
|
+
} = unlock(componentsPrivateApis);
|
|
35
|
+
const SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select({
|
|
36
|
+
web: true,
|
|
37
|
+
native: false
|
|
38
|
+
});
|
|
39
|
+
const SidebarContent = ({
|
|
40
|
+
tabName,
|
|
41
|
+
keyboardShortcut,
|
|
42
|
+
renderingMode,
|
|
43
|
+
onActionPerformed,
|
|
44
|
+
extraPanels
|
|
45
|
+
}) => {
|
|
46
|
+
const tabListRef = useRef(null);
|
|
47
|
+
// Because `PluginSidebar` renders a `ComplementaryArea`, we
|
|
48
|
+
// need to forward the `Tabs` context so it can be passed through the
|
|
49
|
+
// underlying slot/fill.
|
|
50
|
+
const tabsContextValue = useContext(Tabs.Context);
|
|
51
|
+
|
|
52
|
+
// This effect addresses a race condition caused by tabbing from the last
|
|
53
|
+
// block in the editor into the settings sidebar. Without this effect, the
|
|
54
|
+
// selected tab and browser focus can become separated in an unexpected way
|
|
55
|
+
// (e.g the "block" tab is focused, but the "post" tab is selected).
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
const tabsElements = Array.from(tabListRef.current?.querySelectorAll('[role="tab"]') || []);
|
|
58
|
+
const selectedTabElement = tabsElements.find(
|
|
59
|
+
// We are purposefully using a custom `data-tab-id` attribute here
|
|
60
|
+
// because we don't want rely on any assumptions about `Tabs`
|
|
61
|
+
// component internals.
|
|
62
|
+
element => element.getAttribute('data-tab-id') === tabName);
|
|
63
|
+
const activeElement = selectedTabElement?.ownerDocument.activeElement;
|
|
64
|
+
const tabsHasFocus = tabsElements.some(element => {
|
|
65
|
+
return activeElement && activeElement.id === element.id;
|
|
66
|
+
});
|
|
67
|
+
if (tabsHasFocus && selectedTabElement && selectedTabElement.id !== activeElement?.id) {
|
|
68
|
+
selectedTabElement?.focus();
|
|
69
|
+
}
|
|
70
|
+
}, [tabName]);
|
|
71
|
+
return createElement(PluginSidebar, {
|
|
72
|
+
identifier: tabName,
|
|
73
|
+
header: createElement(Tabs.Context.Provider, {
|
|
74
|
+
value: tabsContextValue
|
|
75
|
+
}, createElement(SidebarHeader, {
|
|
76
|
+
ref: tabListRef
|
|
77
|
+
})),
|
|
78
|
+
closeLabel: __('Close Settings')
|
|
79
|
+
// This classname is added so we can apply a corrective negative
|
|
80
|
+
// margin to the panel.
|
|
81
|
+
// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049
|
|
82
|
+
,
|
|
83
|
+
className: "editor-sidebar__panel",
|
|
84
|
+
headerClassName: "editor-sidebar__panel-tabs"
|
|
85
|
+
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
86
|
+
title: __('Settings'),
|
|
87
|
+
toggleShortcut: keyboardShortcut,
|
|
88
|
+
icon: isRTL() ? drawerLeft : drawerRight,
|
|
89
|
+
isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT
|
|
90
|
+
}, createElement(Tabs.Context.Provider, {
|
|
91
|
+
value: tabsContextValue
|
|
92
|
+
}, createElement(Tabs.TabPanel, {
|
|
93
|
+
tabId: sidebars.document,
|
|
94
|
+
focusable: false
|
|
95
|
+
}, createElement(PostSummary, {
|
|
96
|
+
onActionPerformed: onActionPerformed
|
|
97
|
+
}), createElement(PluginDocumentSettingPanel.Slot, null), renderingMode !== 'post-only' && createElement(TemplateContentPanel, null), createElement(PostTransformPanel, null), createElement(PostLastRevisionPanel, null), createElement(PostTaxonomiesPanel, null), createElement(PageAttributesPanel, null), createElement(PatternOverridesPanel, null), extraPanels), createElement(Tabs.TabPanel, {
|
|
98
|
+
tabId: sidebars.block,
|
|
99
|
+
focusable: false
|
|
100
|
+
}, createElement(BlockInspector, null))));
|
|
101
|
+
};
|
|
102
|
+
const Sidebar = ({
|
|
103
|
+
extraPanels,
|
|
104
|
+
onActionPerformed
|
|
105
|
+
}) => {
|
|
106
|
+
useAutoSwitchEditorSidebars();
|
|
107
|
+
const {
|
|
108
|
+
tabName,
|
|
109
|
+
keyboardShortcut,
|
|
110
|
+
showSummary,
|
|
111
|
+
renderingMode
|
|
112
|
+
} = useSelect(select => {
|
|
113
|
+
const shortcut = select(keyboardShortcutsStore).getShortcutRepresentation('core/editor/toggle-sidebar');
|
|
114
|
+
const sidebar = select(interfaceStore).getActiveComplementaryArea('core');
|
|
115
|
+
const _isEditorSidebarOpened = [sidebars.block, sidebars.document].includes(sidebar);
|
|
116
|
+
let _tabName = sidebar;
|
|
117
|
+
if (!_isEditorSidebarOpened) {
|
|
118
|
+
_tabName = !!select(blockEditorStore).getBlockSelectionStart() ? sidebars.block : sidebars.document;
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
tabName: _tabName,
|
|
122
|
+
keyboardShortcut: shortcut,
|
|
123
|
+
showSummary: ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE].includes(select(editorStore).getCurrentPostType()),
|
|
124
|
+
renderingMode: select(editorStore).getRenderingMode()
|
|
125
|
+
};
|
|
126
|
+
}, []);
|
|
127
|
+
const {
|
|
128
|
+
enableComplementaryArea
|
|
129
|
+
} = useDispatch(interfaceStore);
|
|
130
|
+
const onTabSelect = useCallback(newSelectedTabId => {
|
|
131
|
+
if (!!newSelectedTabId) {
|
|
132
|
+
enableComplementaryArea('core', newSelectedTabId);
|
|
133
|
+
}
|
|
134
|
+
}, [enableComplementaryArea]);
|
|
135
|
+
return createElement(Tabs, {
|
|
136
|
+
selectedTabId: tabName,
|
|
137
|
+
onSelect: onTabSelect,
|
|
138
|
+
selectOnMove: false
|
|
139
|
+
}, createElement(SidebarContent, {
|
|
140
|
+
tabName: tabName,
|
|
141
|
+
keyboardShortcut: keyboardShortcut,
|
|
142
|
+
showSummary: showSummary,
|
|
143
|
+
renderingMode: renderingMode,
|
|
144
|
+
onActionPerformed: onActionPerformed,
|
|
145
|
+
extraPanels: extraPanels
|
|
146
|
+
}));
|
|
147
|
+
};
|
|
148
|
+
export default Sidebar;
|
|
149
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BlockInspector","store","blockEditorStore","useSelect","useDispatch","Platform","useCallback","useContext","useEffect","useRef","isRTL","__","drawerLeft","drawerRight","keyboardShortcutsStore","privateApis","componentsPrivateApis","interfaceStore","PageAttributesPanel","PatternOverridesPanel","PluginDocumentSettingPanel","PluginSidebar","PostLastRevisionPanel","PostSummary","PostTaxonomiesPanel","PostTransformPanel","SidebarHeader","TemplateContentPanel","useAutoSwitchEditorSidebars","sidebars","unlock","editorStore","NAVIGATION_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_POST_TYPE","Tabs","SIDEBAR_ACTIVE_BY_DEFAULT","select","web","native","SidebarContent","tabName","keyboardShortcut","renderingMode","onActionPerformed","extraPanels","tabListRef","tabsContextValue","Context","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","createElement","identifier","header","Provider","value","ref","closeLabel","className","headerClassName","title","toggleShortcut","icon","isActiveByDefault","TabPanel","tabId","document","focusable","Slot","block","Sidebar","showSummary","shortcut","getShortcutRepresentation","sidebar","getActiveComplementaryArea","_isEditorSidebarOpened","includes","_tabName","getBlockSelectionStart","getCurrentPostType","getRenderingMode","enableComplementaryArea","onTabSelect","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/editor/src/components/sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPlatform,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PageAttributesPanel from '../page-attributes/panel';\nimport PatternOverridesPanel from '../pattern-overrides-panel';\nimport PluginDocumentSettingPanel from '../plugin-document-setting-panel';\nimport PluginSidebar from '../plugin-sidebar';\nimport PostLastRevisionPanel from '../post-last-revision/panel';\nimport PostSummary from './post-summary';\nimport PostTaxonomiesPanel from '../post-taxonomies/panel';\nimport PostTransformPanel from '../post-transform-panel';\nimport SidebarHeader from './header';\nimport TemplateContentPanel from '../template-content-panel';\nimport useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';\nimport { sidebars } from './constants';\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst SidebarContent = ( {\n\ttabName,\n\tkeyboardShortcut,\n\trenderingMode,\n\tonActionPerformed,\n\textraPanels,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `PluginSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === tabName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ tabName ] );\n\n\treturn (\n\t\t<PluginSidebar\n\t\t\tidentifier={ tabName }\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader ref={ tabListRef } />\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t// margin to the panel.\n\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\tclassName=\"editor-sidebar__panel\"\n\t\t\theaderClassName=\"editor-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\ttoggleShortcut={ keyboardShortcut }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>\n\t\t\t\t\t<PostSummary onActionPerformed={ onActionPerformed } />\n\t\t\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t\t\t{ renderingMode !== 'post-only' && (\n\t\t\t\t\t\t<TemplateContentPanel />\n\t\t\t\t\t) }\n\t\t\t\t\t<PostTransformPanel />\n\t\t\t\t\t<PostLastRevisionPanel />\n\t\t\t\t\t<PostTaxonomiesPanel />\n\t\t\t\t\t<PageAttributesPanel />\n\t\t\t\t\t<PatternOverridesPanel />\n\t\t\t\t\t{ extraPanels }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</PluginSidebar>\n\t);\n};\n\nconst Sidebar = ( { extraPanels, onActionPerformed } ) => {\n\tuseAutoSwitchEditorSidebars();\n\tconst { tabName, keyboardShortcut, showSummary, renderingMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst shortcut = select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/editor/toggle-sidebar' );\n\n\t\t\tconst sidebar =\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea( 'core' );\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\tsidebars.block,\n\t\t\t\tsidebars.document,\n\t\t\t].includes( sidebar );\n\t\t\tlet _tabName = sidebar;\n\t\t\tif ( ! _isEditorSidebarOpened ) {\n\t\t\t\t_tabName = !! select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).getBlockSelectionStart()\n\t\t\t\t\t? sidebars.block\n\t\t\t\t\t: sidebars.document;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttabName: _tabName,\n\t\t\t\tkeyboardShortcut: shortcut,\n\t\t\t\tshowSummary: ! [\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t\tNAVIGATION_POST_TYPE,\n\t\t\t\t].includes( select( editorStore ).getCurrentPostType() ),\n\t\t\t\trenderingMode: select( editorStore ).getRenderingMode(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( 'core', newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\tselectedTabId={ tabName }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\ttabName={ tabName }\n\t\t\t\tkeyboardShortcut={ keyboardShortcut }\n\t\t\t\tshowSummary={ showSummary }\n\t\t\t\trenderingMode={ renderingMode }\n\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\textraPanels={ extraPanels }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n};\n\nexport default Sidebar;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,cAAc,EACdC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,QAAQ,EACRC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,MAAM,QACA,oBAAoB;AAC3B,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,EAAEC,WAAW,QAAQ,kBAAkB;AAC1D,SAASZ,KAAK,IAAIa,sBAAsB,QAAQ,+BAA+B;AAC/E,SAASC,WAAW,IAAIC,qBAAqB,QAAQ,uBAAuB;AAC5E,SAASf,KAAK,IAAIgB,cAAc,QAAQ,sBAAsB;;AAE9D;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,0BAA0B,MAAM,kCAAkC;AACzE,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,qBAAqB,MAAM,6BAA6B;AAC/D,OAAOC,WAAW,MAAM,gBAAgB;AACxC,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,kBAAkB,MAAM,yBAAyB;AACxD,OAAOC,aAAa,MAAM,UAAU;AACpC,OAAOC,oBAAoB,MAAM,2BAA2B;A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EN,WAAY,CAAC,CAAC+D,gBAAgB,CAAC;IACvD,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,MAAM;IAAEC;EAAwB,CAAC,GAAG3F,WAAW,CAAEa,cAAe,CAAC;EAEjE,MAAM+E,WAAW,GAAG1F,WAAW,CAC5B2F,gBAAgB,IAAM;IACvB,IAAK,CAAC,CAAEA,gBAAgB,EAAG;MAC1BF,uBAAuB,CAAE,MAAM,EAAEE,gBAAiB,CAAC;IACpD;EACD,CAAC,EACD,CAAEF,uBAAuB,CAC1B,CAAC;EAED,OACC/B,aAAA,CAAC7B,IAAI;IACJ+D,aAAa,EAAGzD,OAAS;IACzB0D,QAAQ,EAAGH,WAAa;IACxBI,YAAY,EAAG;EAAO,GAEtBpC,aAAA,CAACxB,cAAc;IACdC,OAAO,EAAGA,OAAS;IACnBC,gBAAgB,EAAGA,gBAAkB;IACrC0C,WAAW,EAAGA,WAAa;IAC3BzC,aAAa,EAAGA,aAAe;IAC/BC,iBAAiB,EAAGA,iBAAmB;IACvCC,WAAW,EAAGA;EAAa,CAC3B,CACI,CAAC;AAET,CAAC;AAED,eAAesC,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { __experimentalVStack as VStack } from '@wordpress/components';
|
|
6
|
+
import { useSelect } from '@wordpress/data';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import PluginPostStatusInfo from '../plugin-post-status-info';
|
|
12
|
+
import PostActions from '../post-actions';
|
|
13
|
+
import PostAuthorPanel from '../post-author/panel';
|
|
14
|
+
import PostCardPanel from '../post-card-panel';
|
|
15
|
+
import PostContentInformation from '../post-content-information';
|
|
16
|
+
import PostDiscussionPanel from '../post-discussion/panel';
|
|
17
|
+
import { PrivatePostExcerptPanel as PostExcerptPanel } from '../post-excerpt/panel';
|
|
18
|
+
import PostFeaturedImagePanel from '../post-featured-image/panel';
|
|
19
|
+
import PostFormatPanel from '../post-format/panel';
|
|
20
|
+
import PostLastEditedPanel from '../post-last-edited-panel';
|
|
21
|
+
import PostPanelSection from '../post-panel-section';
|
|
22
|
+
import PostSchedulePanel from '../post-schedule/panel';
|
|
23
|
+
import PostStatusPanel from '../post-status';
|
|
24
|
+
import PostStickyPanel from '../post-sticky';
|
|
25
|
+
import PostSyncStatus from '../post-sync-status';
|
|
26
|
+
import PostTemplatePanel from '../post-template/panel';
|
|
27
|
+
import PostTrashPanel from '../post-trash/panel';
|
|
28
|
+
import PostURLPanel from '../post-url/panel';
|
|
29
|
+
import { store as editorStore } from '../../store';
|
|
30
|
+
import { NAVIGATION_POST_TYPE, PATTERN_POST_TYPE, TEMPLATE_PART_POST_TYPE, TEMPLATE_POST_TYPE } from '../../store/constants';
|
|
31
|
+
import TemplateAreas from '../template-areas';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Module Constants
|
|
35
|
+
*/
|
|
36
|
+
const PANEL_NAME = 'post-status';
|
|
37
|
+
export default function PostSummary({
|
|
38
|
+
onActionPerformed
|
|
39
|
+
}) {
|
|
40
|
+
const {
|
|
41
|
+
isRemovedPostStatusPanel,
|
|
42
|
+
postType
|
|
43
|
+
} = useSelect(select => {
|
|
44
|
+
// We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do
|
|
45
|
+
// not use isEditorPanelEnabled since this panel should not be disabled through the UI.
|
|
46
|
+
const {
|
|
47
|
+
isEditorPanelRemoved,
|
|
48
|
+
getCurrentPostType
|
|
49
|
+
} = select(editorStore);
|
|
50
|
+
return {
|
|
51
|
+
isRemovedPostStatusPanel: isEditorPanelRemoved(PANEL_NAME),
|
|
52
|
+
postType: getCurrentPostType()
|
|
53
|
+
};
|
|
54
|
+
}, []);
|
|
55
|
+
const isPattern = postType === PATTERN_POST_TYPE;
|
|
56
|
+
const isTemplate = postType === TEMPLATE_POST_TYPE;
|
|
57
|
+
const isTemplatePart = postType === TEMPLATE_PART_POST_TYPE;
|
|
58
|
+
const isNavigation = postType === NAVIGATION_POST_TYPE;
|
|
59
|
+
return createElement(PostPanelSection, {
|
|
60
|
+
className: "editor-post-summary"
|
|
61
|
+
}, createElement(PluginPostStatusInfo.Slot, null, fills => createElement(Fragment, null, createElement(VStack, {
|
|
62
|
+
spacing: 4
|
|
63
|
+
}, createElement(PostCardPanel, {
|
|
64
|
+
actions: createElement(PostActions, {
|
|
65
|
+
onActionPerformed: onActionPerformed
|
|
66
|
+
})
|
|
67
|
+
}), createElement(PostFeaturedImagePanel, {
|
|
68
|
+
withPanelBody: false
|
|
69
|
+
}), createElement(PostExcerptPanel, null), createElement(VStack, {
|
|
70
|
+
spacing: 1
|
|
71
|
+
}, createElement(PostContentInformation, null), createElement(PostLastEditedPanel, null)), !isRemovedPostStatusPanel && createElement(VStack, {
|
|
72
|
+
spacing: 2
|
|
73
|
+
}, createElement(VStack, {
|
|
74
|
+
spacing: 1
|
|
75
|
+
}, createElement(PostStatusPanel, null), createElement(PostSchedulePanel, null), createElement(PostTemplatePanel, null), createElement(PostURLPanel, null), createElement(PostDiscussionPanel, null), createElement(PostSyncStatus, null)), createElement(PostStickyPanel, null), createElement(PostFormatPanel, null), createElement(PostAuthorPanel, null), isTemplate && createElement(TemplateAreas, null), fills, !isPattern && !isTemplate && !isTemplatePart && !isNavigation && createElement(PostTrashPanel, null))))));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=post-summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__experimentalVStack","VStack","useSelect","PluginPostStatusInfo","PostActions","PostAuthorPanel","PostCardPanel","PostContentInformation","PostDiscussionPanel","PrivatePostExcerptPanel","PostExcerptPanel","PostFeaturedImagePanel","PostFormatPanel","PostLastEditedPanel","PostPanelSection","PostSchedulePanel","PostStatusPanel","PostStickyPanel","PostSyncStatus","PostTemplatePanel","PostTrashPanel","PostURLPanel","store","editorStore","NAVIGATION_POST_TYPE","PATTERN_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_POST_TYPE","TemplateAreas","PANEL_NAME","PostSummary","onActionPerformed","isRemovedPostStatusPanel","postType","select","isEditorPanelRemoved","getCurrentPostType","isPattern","isTemplate","isTemplatePart","isNavigation","createElement","className","Slot","fills","Fragment","spacing","actions","withPanelBody"],"sources":["@wordpress/editor/src/components/sidebar/post-summary.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PluginPostStatusInfo from '../plugin-post-status-info';\nimport PostActions from '../post-actions';\nimport PostAuthorPanel from '../post-author/panel';\nimport PostCardPanel from '../post-card-panel';\nimport PostContentInformation from '../post-content-information';\nimport PostDiscussionPanel from '../post-discussion/panel';\nimport { PrivatePostExcerptPanel as PostExcerptPanel } from '../post-excerpt/panel';\nimport PostFeaturedImagePanel from '../post-featured-image/panel';\nimport PostFormatPanel from '../post-format/panel';\nimport PostLastEditedPanel from '../post-last-edited-panel';\nimport PostPanelSection from '../post-panel-section';\nimport PostSchedulePanel from '../post-schedule/panel';\nimport PostStatusPanel from '../post-status';\nimport PostStickyPanel from '../post-sticky';\nimport PostSyncStatus from '../post-sync-status';\nimport PostTemplatePanel from '../post-template/panel';\nimport PostTrashPanel from '../post-trash/panel';\nimport PostURLPanel from '../post-url/panel';\nimport { store as editorStore } from '../../store';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\nimport TemplateAreas from '../template-areas';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-status';\n\nexport default function PostSummary( { onActionPerformed } ) {\n\tconst { isRemovedPostStatusPanel, postType } = useSelect( ( select ) => {\n\t\t// We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do\n\t\t// not use isEditorPanelEnabled since this panel should not be disabled through the UI.\n\t\tconst { isEditorPanelRemoved, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisRemovedPostStatusPanel: isEditorPanelRemoved( PANEL_NAME ),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\tconst isPattern = postType === PATTERN_POST_TYPE;\n\tconst isTemplate = postType === TEMPLATE_POST_TYPE;\n\tconst isTemplatePart = postType === TEMPLATE_PART_POST_TYPE;\n\tconst isNavigation = postType === NAVIGATION_POST_TYPE;\n\n\treturn (\n\t\t<PostPanelSection className=\"editor-post-summary\">\n\t\t\t<PluginPostStatusInfo.Slot>\n\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t<PostCardPanel\n\t\t\t\t\t\t\t\tactions={\n\t\t\t\t\t\t\t\t\t<PostActions\n\t\t\t\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PostFeaturedImagePanel withPanelBody={ false } />\n\t\t\t\t\t\t\t<PostExcerptPanel />\n\t\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t\t<PostContentInformation />\n\t\t\t\t\t\t\t\t<PostLastEditedPanel />\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t{ ! isRemovedPostStatusPanel && (\n\t\t\t\t\t\t\t\t<VStack spacing={ 2 }>\n\t\t\t\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t\t\t\t<PostStatusPanel />\n\t\t\t\t\t\t\t\t\t\t<PostSchedulePanel />\n\t\t\t\t\t\t\t\t\t\t<PostTemplatePanel />\n\t\t\t\t\t\t\t\t\t\t<PostURLPanel />\n\t\t\t\t\t\t\t\t\t\t<PostDiscussionPanel />\n\t\t\t\t\t\t\t\t\t\t<PostSyncStatus />\n\t\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t\t<PostStickyPanel />\n\t\t\t\t\t\t\t\t\t<PostFormatPanel />\n\t\t\t\t\t\t\t\t\t<PostAuthorPanel />\n\t\t\t\t\t\t\t\t\t{ isTemplate && <TemplateAreas /> }\n\t\t\t\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t\t\t\t{ ! isPattern &&\n\t\t\t\t\t\t\t\t\t\t! isTemplate &&\n\t\t\t\t\t\t\t\t\t\t! isTemplatePart &&\n\t\t\t\t\t\t\t\t\t\t! isNavigation && <PostTrashPanel /> }\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PluginPostStatusInfo.Slot>\n\t\t</PostPanelSection>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,4BAA4B;AAC7D,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,eAAe,MAAM,sBAAsB;AAClD,OAAOC,aAAa,MAAM,oBAAoB;AAC9C,OAAOC,sBAAsB,MAAM,6BAA6B;AAChE,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,SAASC,uBAAuB,IAAIC,gBAAgB,QAAQ,uBAAuB;AACnF,OAAOC,sBAAsB,MAAM,8BAA8B;AACjE,OAAOC,eAAe,MAAM,sBAAsB;AAClD,OAAOC,mBAAmB,MAAM,2BAA2B;AAC3D,OAAOC,gBAAgB,MAAM,uBAAuB;AACpD,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,eAAe,MAAM,gBAAgB;AAC5C,OAAOC,eAAe,MAAM,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,CACD,CAAC,EACFU,aAAA,CAAC9B,sBAAsB;IAACqC,aAAa,EAAG;EAAO,CAAE,CAAC,EAClDP,aAAA,CAAC/B,gBAAgB,MAAE,CAAC,EACpB+B,aAAA,CAACxC,MAAM;IAAC6C,OAAO,EAAG;EAAG,GACpBL,aAAA,CAAClC,sBAAsB,MAAE,CAAC,EAC1BkC,aAAA,CAAC5B,mBAAmB,MAAE,CACf,CAAC,EACP,CAAEmB,wBAAwB,IAC3BS,aAAA,CAACxC,MAAM;IAAC6C,OAAO,EAAG;EAAG,GACpBL,aAAA,CAACxC,MAAM;IAAC6C,OAAO,EAAG;EAAG,GACpBL,aAAA,CAACzB,eAAe,MAAE,CAAC,EACnByB,aAAA,CAAC1B,iBAAiB,MAAE,CAAC,EACrB0B,aAAA,CAACtB,iBAAiB,MAAE,CAAC,EACrBsB,aAAA,CAACpB,YAAY,MAAE,CAAC,EAChBoB,aAAA,CAACjC,mBAAmB,MAAE,CAAC,EACvBiC,aAAA,CAACvB,cAAc,MAAE,CACV,CAAC,EACTuB,aAAA,CAACxB,eAAe,MAAE,CAAC,EACnBwB,aAAA,CAAC7B,eAAe,MAAE,CAAC,EACnB6B,aAAA,CAACpC,eAAe,MAAE,CAAC,EACjBiC,UAAU,IAAIG,aAAA,CAACb,aAAa,MAAE,CAAC,EAC/BgB,KAAK,EACL,CAAEP,SAAS,IACZ,CAAEC,UAAU,IACZ,CAAEC,cAAc,IAChB,CAAEC,YAAY,IAAIC,aAAA,CAACrB,cAAc,MAAE,CAC7B,CAEF,CACP,CAEuB,CACV,CAAC;AAErB","ignoreList":[]}
|
|
@@ -9,11 +9,13 @@ import { store as blockEditorStore, __experimentalBlockPatternsList as BlockPatt
|
|
|
9
9
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
10
|
import { useAsyncList } from '@wordpress/compose';
|
|
11
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
12
|
+
import { __unstableSerializeAndClean } from '@wordpress/blocks';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
15
16
|
*/
|
|
16
17
|
import { store as editorStore } from '../../store';
|
|
18
|
+
import { TEMPLATE_POST_TYPE } from '../../store/constants';
|
|
17
19
|
function useStartPatterns() {
|
|
18
20
|
// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,
|
|
19
21
|
// and it has no postTypes declared and the current post type is page or if
|
|
@@ -70,7 +72,10 @@ function PatternSelection({
|
|
|
70
72
|
shownPatterns: shownBlockPatterns,
|
|
71
73
|
onClickPattern: (_pattern, blocks) => {
|
|
72
74
|
editEntityRecord('postType', postType, postId, {
|
|
73
|
-
blocks
|
|
75
|
+
blocks,
|
|
76
|
+
content: ({
|
|
77
|
+
blocks: blocksForSerialization = []
|
|
78
|
+
}) => __unstableSerializeAndClean(blocksForSerialization)
|
|
74
79
|
});
|
|
75
80
|
onChoosePattern();
|
|
76
81
|
}
|
|
@@ -106,15 +111,12 @@ export default function StartPageOptions() {
|
|
|
106
111
|
isEditedPostDirty,
|
|
107
112
|
isEditedPostEmpty,
|
|
108
113
|
getCurrentPostType,
|
|
109
|
-
getCurrentPostId
|
|
110
|
-
getEditorSettings
|
|
114
|
+
getCurrentPostId
|
|
111
115
|
} = select(editorStore);
|
|
112
|
-
const
|
|
113
|
-
__unstableIsPreviewMode: isPreviewMode
|
|
114
|
-
} = getEditorSettings();
|
|
116
|
+
const _postType = getCurrentPostType();
|
|
115
117
|
return {
|
|
116
|
-
shouldEnableModal: !
|
|
117
|
-
postType:
|
|
118
|
+
shouldEnableModal: !isEditedPostDirty() && isEditedPostEmpty() && TEMPLATE_POST_TYPE !== _postType,
|
|
119
|
+
postType: _postType,
|
|
118
120
|
postId: getCurrentPostId()
|
|
119
121
|
};
|
|
120
122
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Modal","__","useState","useMemo","useEffect","store","blockEditorStore","__experimentalBlockPatternsList","BlockPatternsList","useSelect","useDispatch","useAsyncList","coreStore","editorStore","useStartPatterns","blockPatternsWithPostContentBlockType","postType","select","getPatternsByBlockTypes","getBlocksByName","getCurrentPostType","getRenderingMode","rootClientId","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","shownBlockPatterns","editEntityRecord","postId","getCurrentPostId","createElement","shownPatterns","onClickPattern","_pattern","blocks","StartPageOptionsModal","onClose","startPatterns","hasStartPattern","length","title","isFullScreen","onRequestClose","className","StartPageOptions","isClosed","setIsClosed","shouldEnableModal","isEditedPostDirty","isEditedPostEmpty","
|
|
1
|
+
{"version":3,"names":["Modal","__","useState","useMemo","useEffect","store","blockEditorStore","__experimentalBlockPatternsList","BlockPatternsList","useSelect","useDispatch","useAsyncList","coreStore","__unstableSerializeAndClean","editorStore","TEMPLATE_POST_TYPE","useStartPatterns","blockPatternsWithPostContentBlockType","postType","select","getPatternsByBlockTypes","getBlocksByName","getCurrentPostType","getRenderingMode","rootClientId","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","shownBlockPatterns","editEntityRecord","postId","getCurrentPostId","createElement","shownPatterns","onClickPattern","_pattern","blocks","content","blocksForSerialization","StartPageOptionsModal","onClose","startPatterns","hasStartPattern","length","title","isFullScreen","onRequestClose","className","StartPageOptions","isClosed","setIsClosed","shouldEnableModal","isEditedPostDirty","isEditedPostEmpty","_postType"],"sources":["@wordpress/editor/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\n\nfunction useStartPatterns() {\n\t// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,\n\t// and it has no postTypes declared and the current post type is page or if\n\t// the current post type is part of the postTypes declared.\n\tconst { blockPatternsWithPostContentBlockType, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPatternsByBlockTypes, getBlocksByName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getCurrentPostType, getRenderingMode } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst rootClientId =\n\t\t\t\tgetRenderingMode() === 'post-only'\n\t\t\t\t\t? ''\n\t\t\t\t\t: getBlocksByName( 'core/post-content' )?.[ 0 ];\n\t\t\treturn {\n\t\t\t\tblockPatternsWithPostContentBlockType: getPatternsByBlockTypes(\n\t\t\t\t\t'core/post-content',\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn useMemo( () => {\n\t\t// filter patterns without postTypes declared if the current postType is page\n\t\t// or patterns that declare the current postType in its post type array.\n\t\treturn blockPatternsWithPostContentBlockType.filter( ( pattern ) => {\n\t\t\treturn (\n\t\t\t\t( postType === 'page' && ! pattern.postTypes ) ||\n\t\t\t\t( Array.isArray( pattern.postTypes ) &&\n\t\t\t\t\tpattern.postTypes.includes( postType ) )\n\t\t\t);\n\t\t} );\n\t}, [ postType, blockPatternsWithPostContentBlockType ] );\n}\n\nfunction PatternSelection( { blockPatterns, onChoosePattern } ) {\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\tonClickPattern={ ( _pattern, blocks ) => {\n\t\t\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\t\t\tblocks,\n\t\t\t\t\tcontent: ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t\t\t\t__unstableSerializeAndClean( blocksForSerialization ),\n\t\t\t\t} );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartPageOptionsModal( { onClose } ) {\n\tconst startPatterns = useStartPatterns();\n\tconst hasStartPattern = startPatterns.length > 0;\n\n\tif ( ! hasStartPattern ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tisFullScreen\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<div className=\"editor-start-page-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tblockPatterns={ startPatterns }\n\t\t\t\t\tonChoosePattern={ onClose }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartPageOptions() {\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { shouldEnableModal, postType, postId } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditedPostDirty,\n\t\t\tisEditedPostEmpty,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t} = select( editorStore );\n\t\tconst _postType = getCurrentPostType();\n\n\t\treturn {\n\t\t\tshouldEnableModal:\n\t\t\t\t! isEditedPostDirty() &&\n\t\t\t\tisEditedPostEmpty() &&\n\t\t\t\tTEMPLATE_POST_TYPE !== _postType,\n\t\t\tpostType: _postType,\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t// Should reset the modal state when navigating to a new page/post.\n\t\tsetIsClosed( false );\n\t}, [ postType, postId ] );\n\n\tif ( ! shouldEnableModal || isClosed ) {\n\t\treturn null;\n\t}\n\n\treturn <StartPageOptionsModal onClose={ () => setIsClosed( true ) } />;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACjE,SACCC,KAAK,IAAIC,gBAAgB,EACzBC,+BAA+B,IAAIC,iBAAiB,QAC9C,yBAAyB;AAChC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASN,KAAK,IAAIO,SAAS,QAAQ,sBAAsB;AACzD,SAASC,2BAA2B,QAAQ,mBAAmB;;AAE/D;AACA;AACA;AACA,SAASR,KAAK,IAAIS,WAAW,QAAQ,aAAa;AAClD,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,SAASC,gBAAgBA,CAAA,EAAG;EAC3B;EACA;EACA;EACA,MAAM;IAAEC,qCAAqC;IAAEC;EAAS,CAAC,GAAGT,SAAS,CAClEU,MAAM,IAAM;IACb,MAAM;MAAEC,uBAAuB;MAAEC;IAAgB,CAAC,GACjDF,MAAM,CAAEb,gBAAiB,CAAC;IAC3B,MAAM;MAAEgB,kBAAkB;MAAEC;IAAiB,CAAC,GAC7CJ,MAAM,CAAEL,WAAY,CAAC;IACtB,MAAMU,YAAY,GACjBD,gBAAgB,CAAC,CAAC,KAAK,WAAW,GAC/B,EAAE,GACFF,eAAe,CAAE,mBAAoB,CAAC,GAAI,CAAC,CAAE;IACjD,OAAO;MACNJ,qCAAqC,EAAEG,uBAAuB,CAC7D,mBAAmB,EACnBI,YACD,CAAC;MACDN,QAAQ,EAAEI,kBAAkB,CAAC;IAC9B,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,OAAOnB,OAAO,CAAE,MAAM;IACrB;IACA;IACA,OAAOc,qCAAqC,CAACQ,MAA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