@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
|
@@ -8,6 +8,12 @@ import { __ } from '@wordpress/i18n';
|
|
|
8
8
|
import { BlockEditorKeyboardShortcuts } from '@wordpress/block-editor';
|
|
9
9
|
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
10
10
|
import { isAppleOS } from '@wordpress/keycodes';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Component for registering editor keyboard shortcuts.
|
|
14
|
+
*
|
|
15
|
+
* @return {Element} The component to be rendered.
|
|
16
|
+
*/
|
|
11
17
|
function EditorKeyboardShortcutsRegister() {
|
|
12
18
|
// Registering the shortcuts.
|
|
13
19
|
const {
|
|
@@ -61,7 +67,7 @@ function EditorKeyboardShortcutsRegister() {
|
|
|
61
67
|
registerShortcut({
|
|
62
68
|
name: 'core/editor/toggle-list-view',
|
|
63
69
|
category: 'global',
|
|
64
|
-
description: __('Open the
|
|
70
|
+
description: __('Open the List View.'),
|
|
65
71
|
keyCombination: {
|
|
66
72
|
modifier: 'access',
|
|
67
73
|
character: 'o'
|
|
@@ -94,6 +100,35 @@ function EditorKeyboardShortcutsRegister() {
|
|
|
94
100
|
character: 'h'
|
|
95
101
|
}
|
|
96
102
|
});
|
|
103
|
+
registerShortcut({
|
|
104
|
+
name: 'core/editor/next-region',
|
|
105
|
+
category: 'global',
|
|
106
|
+
description: __('Navigate to the next part of the editor.'),
|
|
107
|
+
keyCombination: {
|
|
108
|
+
modifier: 'ctrl',
|
|
109
|
+
character: '`'
|
|
110
|
+
},
|
|
111
|
+
aliases: [{
|
|
112
|
+
modifier: 'access',
|
|
113
|
+
character: 'n'
|
|
114
|
+
}]
|
|
115
|
+
});
|
|
116
|
+
registerShortcut({
|
|
117
|
+
name: 'core/editor/previous-region',
|
|
118
|
+
category: 'global',
|
|
119
|
+
description: __('Navigate to the previous part of the editor.'),
|
|
120
|
+
keyCombination: {
|
|
121
|
+
modifier: 'ctrlShift',
|
|
122
|
+
character: '`'
|
|
123
|
+
},
|
|
124
|
+
aliases: [{
|
|
125
|
+
modifier: 'access',
|
|
126
|
+
character: 'p'
|
|
127
|
+
}, {
|
|
128
|
+
modifier: 'ctrlShift',
|
|
129
|
+
character: '~'
|
|
130
|
+
}]
|
|
131
|
+
});
|
|
97
132
|
}, [registerShortcut]);
|
|
98
133
|
return createElement(BlockEditorKeyboardShortcuts.Register, null);
|
|
99
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useDispatch","__","BlockEditorKeyboardShortcuts","store","keyboardShortcutsStore","isAppleOS","EditorKeyboardShortcutsRegister","registerShortcut","name","category","description","keyCombination","modifier","character","aliases","createElement","Register"],"sources":["@wordpress/editor/src/components/global-keyboard-shortcuts/register-shortcuts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { BlockEditorKeyboardShortcuts } from '@wordpress/block-editor';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { isAppleOS } from '@wordpress/keycodes';\n\nfunction EditorKeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/toggle-mode',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Switch between visual editor and code editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'm',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t\t// Disable on Apple OS because it conflicts with the browser's\n\t\t\t// history shortcut. It's a fine alias for both Windows and Linux.\n\t\t\t// Since there's no conflict for Ctrl+Shift+Z on both Windows and\n\t\t\t// Linux, we keep it as the default for consistency.\n\t\t\taliases: isAppleOS()\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodifier: 'primary',\n\t\t\t\t\t\t\tcharacter: 'y',\n\t\t\t\t\t\t},\n\t\t\t\t ],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/toggle-list-view',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Open the
|
|
1
|
+
{"version":3,"names":["useEffect","useDispatch","__","BlockEditorKeyboardShortcuts","store","keyboardShortcutsStore","isAppleOS","EditorKeyboardShortcutsRegister","registerShortcut","name","category","description","keyCombination","modifier","character","aliases","createElement","Register"],"sources":["@wordpress/editor/src/components/global-keyboard-shortcuts/register-shortcuts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { BlockEditorKeyboardShortcuts } from '@wordpress/block-editor';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { isAppleOS } from '@wordpress/keycodes';\n\n/**\n * Component for registering editor keyboard shortcuts.\n *\n * @return {Element} The component to be rendered.\n */\nfunction EditorKeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/toggle-mode',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Switch between visual editor and code editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'm',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t\t// Disable on Apple OS because it conflicts with the browser's\n\t\t\t// history shortcut. It's a fine alias for both Windows and Linux.\n\t\t\t// Since there's no conflict for Ctrl+Shift+Z on both Windows and\n\t\t\t// Linux, we keep it as the default for consistency.\n\t\t\taliases: isAppleOS()\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodifier: 'primary',\n\t\t\t\t\t\t\tcharacter: 'y',\n\t\t\t\t\t\t},\n\t\t\t\t ],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/toggle-list-view',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Open the List View.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'o',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/toggle-distraction-free',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Toggle distraction free mode.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: '\\\\',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/toggle-sidebar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Show or hide the Settings sidebar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: ',',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/keyboard-shortcuts',\n\t\t\tcategory: 'main',\n\t\t\tdescription: __( 'Display these keyboard shortcuts.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'h',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/next-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the next part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrl',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'n',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/editor/previous-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the previous part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'p',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\t\tcharacter: '~',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn <BlockEditorKeyboardShortcuts.Register />;\n}\n\nexport default EditorKeyboardShortcutsRegister;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,4BAA4B,QAAQ,yBAAyB;AACtE,SAASC,KAAK,IAAIC,sBAAsB,QAAQ,+BAA+B;AAC/E,SAASC,SAAS,QAAQ,qBAAqB;;AAE/C;AACA;AACA;AACA;AACA;AACA,SAASC,+BAA+BA,CAAA,EAAG;EAC1C;EACA,MAAM;IAAEC;EAAiB,CAAC,GAAGP,WAAW,CAAEI,sBAAuB,CAAC;EAClEL,SAAS,CAAE,MAAM;IAChBQ,gBAAgB,CAAE;MACjBC,IAAI,EAAE,yBAAyB;MAC/BC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAET,EAAE,CAAE,+CAAgD,CAAC;MAClEU,cAAc,EAAE;QACfC,QAAQ,EAAE,WAAW;QACrBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;IAEHN,gBAAgB,CAAE;MACjBC,IAAI,EAAE,kBAAkB;MACxBC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAET,EAAE,CAAE,oBAAqB,CAAC;MACvCU,cAAc,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AS,EAAE;MACZ;IACD,CAAE,CAAC;IAEHN,gBAAgB,CAAE;MACjBC,IAAI,EAAE,gCAAgC;MACtCC,QAAQ,EAAE,MAAM;MAChBC,WAAW,EAAET,EAAE,CAAE,mCAAoC,CAAC;MACtDU,cAAc,EAAE;QACfC,QAAQ,EAAE,QAAQ;QAClBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;IAEHN,gBAAgB,CAAE;MACjBC,IAAI,EAAE,yBAAyB;MAC/BC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAET,EAAE,CAAE,0CAA2C,CAAC;MAC7DU,cAAc,EAAE;QACfC,QAAQ,EAAE,MAAM;QAChBC,SAAS,EAAE;MACZ,CAAC;MACDC,OAAO,EAAE,CACR;QACCF,QAAQ,EAAE,QAAQ;QAClBC,SAAS,EAAE;MACZ,CAAC;IAEH,CAAE,CAAC;IAEHN,gBAAgB,CAAE;MACjBC,IAAI,EAAE,6BAA6B;MACnCC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAET,EAAE,CAAE,8CAA+C,CAAC;MACjEU,cAAc,EAAE;QACfC,QAAQ,EAAE,WAAW;QACrBC,SAAS,EAAE;MACZ,CAAC;MACDC,OAAO,EAAE,CACR;QACCF,QAAQ,EAAE,QAAQ;QAClBC,SAAS,EAAE;MACZ,CAAC,EACD;QACCD,QAAQ,EAAE,WAAW;QACrBC,SAAS,EAAE;MACZ,CAAC;IAEH,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEN,gBAAgB,CAAG,CAAC;EAEzB,OAAOQ,aAAA,CAACb,4BAA4B,CAACc,QAAQ,MAAE,CAAC;AACjD;AAEA,eAAeV,+BAA+B","ignoreList":[]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
5
|
+
import deepmerge from 'deepmerge';
|
|
6
|
+
import { isPlainObject } from 'is-plain-object';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
12
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
13
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
14
|
+
import { useMemo, useCallback } from '@wordpress/element';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
import { unlock } from '../../lock-unlock';
|
|
20
|
+
const {
|
|
21
|
+
GlobalStylesContext,
|
|
22
|
+
cleanEmptyObject
|
|
23
|
+
} = unlock(blockEditorPrivateApis);
|
|
24
|
+
export function mergeBaseAndUserConfigs(base, user) {
|
|
25
|
+
return deepmerge(base, user, {
|
|
26
|
+
// We only pass as arrays the presets,
|
|
27
|
+
// in which case we want the new array of values
|
|
28
|
+
// to override the old array (no merging).
|
|
29
|
+
isMergeableObject: isPlainObject
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function useGlobalStylesUserConfig() {
|
|
33
|
+
const {
|
|
34
|
+
globalStylesId,
|
|
35
|
+
isReady,
|
|
36
|
+
settings,
|
|
37
|
+
styles
|
|
38
|
+
} = useSelect(select => {
|
|
39
|
+
const {
|
|
40
|
+
getEditedEntityRecord,
|
|
41
|
+
hasFinishedResolution
|
|
42
|
+
} = select(coreStore);
|
|
43
|
+
const _globalStylesId = select(coreStore).__experimentalGetCurrentGlobalStylesId();
|
|
44
|
+
const record = _globalStylesId ? getEditedEntityRecord('root', 'globalStyles', _globalStylesId) : undefined;
|
|
45
|
+
let hasResolved = false;
|
|
46
|
+
if (hasFinishedResolution('__experimentalGetCurrentGlobalStylesId')) {
|
|
47
|
+
hasResolved = _globalStylesId ? hasFinishedResolution('getEditedEntityRecord', ['root', 'globalStyles', _globalStylesId]) : true;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
globalStylesId: _globalStylesId,
|
|
51
|
+
isReady: hasResolved,
|
|
52
|
+
settings: record?.settings,
|
|
53
|
+
styles: record?.styles
|
|
54
|
+
};
|
|
55
|
+
}, []);
|
|
56
|
+
const {
|
|
57
|
+
getEditedEntityRecord
|
|
58
|
+
} = useSelect(coreStore);
|
|
59
|
+
const {
|
|
60
|
+
editEntityRecord
|
|
61
|
+
} = useDispatch(coreStore);
|
|
62
|
+
const config = useMemo(() => {
|
|
63
|
+
return {
|
|
64
|
+
settings: settings !== null && settings !== void 0 ? settings : {},
|
|
65
|
+
styles: styles !== null && styles !== void 0 ? styles : {}
|
|
66
|
+
};
|
|
67
|
+
}, [settings, styles]);
|
|
68
|
+
const setConfig = useCallback((callback, options = {}) => {
|
|
69
|
+
var _record$styles, _record$settings;
|
|
70
|
+
const record = getEditedEntityRecord('root', 'globalStyles', globalStylesId);
|
|
71
|
+
const currentConfig = {
|
|
72
|
+
styles: (_record$styles = record?.styles) !== null && _record$styles !== void 0 ? _record$styles : {},
|
|
73
|
+
settings: (_record$settings = record?.settings) !== null && _record$settings !== void 0 ? _record$settings : {}
|
|
74
|
+
};
|
|
75
|
+
const updatedConfig = callback(currentConfig);
|
|
76
|
+
editEntityRecord('root', 'globalStyles', globalStylesId, {
|
|
77
|
+
styles: cleanEmptyObject(updatedConfig.styles) || {},
|
|
78
|
+
settings: cleanEmptyObject(updatedConfig.settings) || {}
|
|
79
|
+
}, options);
|
|
80
|
+
}, [globalStylesId]);
|
|
81
|
+
return [isReady, config, setConfig];
|
|
82
|
+
}
|
|
83
|
+
function useGlobalStylesBaseConfig() {
|
|
84
|
+
const baseConfig = useSelect(select => {
|
|
85
|
+
return select(coreStore).__experimentalGetCurrentThemeBaseGlobalStyles();
|
|
86
|
+
}, []);
|
|
87
|
+
return [!!baseConfig, baseConfig];
|
|
88
|
+
}
|
|
89
|
+
export function useGlobalStylesContext() {
|
|
90
|
+
const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig();
|
|
91
|
+
const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig();
|
|
92
|
+
const mergedConfig = useMemo(() => {
|
|
93
|
+
if (!baseConfig || !userConfig) {
|
|
94
|
+
return {};
|
|
95
|
+
}
|
|
96
|
+
return mergeBaseAndUserConfigs(baseConfig, userConfig);
|
|
97
|
+
}, [userConfig, baseConfig]);
|
|
98
|
+
const context = useMemo(() => {
|
|
99
|
+
return {
|
|
100
|
+
isReady: isUserConfigReady && isBaseConfigReady,
|
|
101
|
+
user: userConfig,
|
|
102
|
+
base: baseConfig,
|
|
103
|
+
merged: mergedConfig,
|
|
104
|
+
setUserConfig
|
|
105
|
+
};
|
|
106
|
+
}, [mergedConfig, userConfig, baseConfig, setUserConfig, isUserConfigReady, isBaseConfigReady]);
|
|
107
|
+
return context;
|
|
108
|
+
}
|
|
109
|
+
export function GlobalStylesProvider({
|
|
110
|
+
children
|
|
111
|
+
}) {
|
|
112
|
+
const context = useGlobalStylesContext();
|
|
113
|
+
if (!context.isReady) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
return createElement(GlobalStylesContext.Provider, {
|
|
117
|
+
value: context
|
|
118
|
+
}, children);
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["deepmerge","isPlainObject","privateApis","blockEditorPrivateApis","store","coreStore","useSelect","useDispatch","useMemo","useCallback","unlock","GlobalStylesContext","cleanEmptyObject","mergeBaseAndUserConfigs","base","user","isMergeableObject","useGlobalStylesUserConfig","globalStylesId","isReady","settings","styles","select","getEditedEntityRecord","hasFinishedResolution","_globalStylesId","__experimentalGetCurrentGlobalStylesId","record","undefined","hasResolved","editEntityRecord","config","setConfig","callback","options","_record$styles","_record$settings","currentConfig","updatedConfig","useGlobalStylesBaseConfig","baseConfig","__experimentalGetCurrentThemeBaseGlobalStyles","useGlobalStylesContext","isUserConfigReady","userConfig","setUserConfig","isBaseConfigReady","mergedConfig","context","merged","GlobalStylesProvider","children","createElement","Provider","value"],"sources":["@wordpress/editor/src/components/global-styles-provider/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, cleanEmptyObject } = unlock(\n\tblockEditorPrivateApis\n);\n\nexport function mergeBaseAndUserConfigs( base, user ) {\n\treturn deepmerge( base, user, {\n\t\t// We only pass as arrays the presets,\n\t\t// in which case we want the new array of values\n\t\t// to override the old array (no merging).\n\t\tisMergeableObject: isPlainObject,\n\t} );\n}\n\nfunction useGlobalStylesUserConfig() {\n\tconst { globalStylesId, isReady, settings, styles } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _globalStylesId =\n\t\t\t\tselect( coreStore ).__experimentalGetCurrentGlobalStylesId();\n\t\t\tconst record = _globalStylesId\n\t\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t_globalStylesId\n\t\t\t\t )\n\t\t\t\t: undefined;\n\n\t\t\tlet hasResolved = false;\n\t\t\tif (\n\t\t\t\thasFinishedResolution(\n\t\t\t\t\t'__experimentalGetCurrentGlobalStylesId'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\thasResolved = _globalStylesId\n\t\t\t\t\t? hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t ] )\n\t\t\t\t\t: true;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tglobalStylesId: _globalStylesId,\n\t\t\t\tisReady: hasResolved,\n\t\t\t\tsettings: record?.settings,\n\t\t\t\tstyles: record?.styles,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { getEditedEntityRecord } = useSelect( coreStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst config = useMemo( () => {\n\t\treturn {\n\t\t\tsettings: settings ?? {},\n\t\t\tstyles: styles ?? {},\n\t\t};\n\t}, [ settings, styles ] );\n\n\tconst setConfig = useCallback(\n\t\t( callback, options = {} ) => {\n\t\t\tconst record = getEditedEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId\n\t\t\t);\n\t\t\tconst currentConfig = {\n\t\t\t\tstyles: record?.styles ?? {},\n\t\t\t\tsettings: record?.settings ?? {},\n\t\t\t};\n\t\t\tconst updatedConfig = callback( currentConfig );\n\t\t\teditEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId,\n\t\t\t\t{\n\t\t\t\t\tstyles: cleanEmptyObject( updatedConfig.styles ) || {},\n\t\t\t\t\tsettings: cleanEmptyObject( updatedConfig.settings ) || {},\n\t\t\t\t},\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\t\t[ globalStylesId ]\n\t);\n\n\treturn [ isReady, config, setConfig ];\n}\n\nfunction useGlobalStylesBaseConfig() {\n\tconst baseConfig = useSelect( ( select ) => {\n\t\treturn select(\n\t\t\tcoreStore\n\t\t).__experimentalGetCurrentThemeBaseGlobalStyles();\n\t}, [] );\n\n\treturn [ !! baseConfig, baseConfig ];\n}\n\nexport function useGlobalStylesContext() {\n\tconst [ isUserConfigReady, userConfig, setUserConfig ] =\n\t\tuseGlobalStylesUserConfig();\n\tconst [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! baseConfig || ! userConfig ) {\n\t\t\treturn {};\n\t\t}\n\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t}, [ userConfig, baseConfig ] );\n\tconst context = useMemo( () => {\n\t\treturn {\n\t\t\tisReady: isUserConfigReady && isBaseConfigReady,\n\t\t\tuser: userConfig,\n\t\t\tbase: baseConfig,\n\t\t\tmerged: mergedConfig,\n\t\t\tsetUserConfig,\n\t\t};\n\t}, [\n\t\tmergedConfig,\n\t\tuserConfig,\n\t\tbaseConfig,\n\t\tsetUserConfig,\n\t\tisUserConfigReady,\n\t\tisBaseConfigReady,\n\t] );\n\n\treturn context;\n}\n\nexport function GlobalStylesProvider( { children } ) {\n\tconst context = useGlobalStylesContext();\n\tif ( ! context.isReady ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,WAAW;AACjC,SAASC,aAAa,QAAQ,iBAAiB;;AAE/C;AACA;AACA;AACA,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;;AAEzD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC,mBAAmB;EAAEC;AAAiB,CAAC,GAAGF,MAAM,CACvDP,sBACD,CAAC;AAED,OAAO,SAASU,uBAAuBA,CAAEC,IAAI,EAAEC,IAAI,EAAG;EACrD,OAAOf,SAAS,CAAEc,IAAI,EAAEC,IAAI,EAAE;IAC7B;IACA;IACA;IACAC,iBAAiB,EAAEf;EACpB,CAAE,CAAC;AACJ;AAEA,SAASgB,yBAAyBA,CAAA,EAAG;EACpC,MAAM;IAAEC,cAAc;IAAEC,OAAO;IA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U,IAAI,CAAEI,UAAU,EAAG;MACnC,OAAO,CAAC,CAAC;IACV;IACA,OAAO/B,uBAAuB,CAAE2B,UAAU,EAAEI,UAAW,CAAC;EACzD,CAAC,EAAE,CAAEA,UAAU,EAAEJ,UAAU,CAAG,CAAC;EAC/B,MAAMQ,OAAO,GAAGxC,OAAO,CAAE,MAAM;IAC9B,OAAO;MACNW,OAAO,EAAEwB,iBAAiB,IAAIG,iBAAiB;MAC/C/B,IAAI,EAAE6B,UAAU;MAChB9B,IAAI,EAAE0B,UAAU;MAChBS,MAAM,EAAEF,YAAY;MACpBF;IACD,CAAC;EACF,CAAC,EAAE,CACFE,YAAY,EACZH,UAAU,EACVJ,UAAU,EACVK,aAAa,EACbF,iBAAiB,EACjBG,iBAAiB,CAChB,CAAC;EAEH,OAAOE,OAAO;AACf;AAEA,OAAO,SAASE,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACpD,MAAMH,OAAO,GAAGN,sBAAsB,CAAC,CAAC;EACxC,IAAK,CAAEM,OAAO,CAAC7B,OAAO,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,OACCiC,aAAA,CAACzC,mBAAmB,CAAC0C,QAAQ;IAACC,KAAK,EAAGN;EAAS,GAC5CG,QAC2B,CAAC;AAEjC","ignoreList":[]}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { useSelect } from '@wordpress/data';
|
|
11
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
12
|
+
import { __unstableMotion as motion } from '@wordpress/components';
|
|
13
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
14
|
+
import { useState } from '@wordpress/element';
|
|
15
|
+
import { PinnedItems } from '@wordpress/interface';
|
|
16
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
import CollapsableBlockToolbar from '../collapsible-block-toolbar';
|
|
22
|
+
import DocumentBar from '../document-bar';
|
|
23
|
+
import DocumentTools from '../document-tools';
|
|
24
|
+
import MoreMenu from '../more-menu';
|
|
25
|
+
import PostPreviewButton from '../post-preview-button';
|
|
26
|
+
import PostPublishButtonOrToggle from '../post-publish-button/post-publish-button-or-toggle';
|
|
27
|
+
import PostSavedState from '../post-saved-state';
|
|
28
|
+
import PostTypeSupportCheck from '../post-type-support-check';
|
|
29
|
+
import PostViewLink from '../post-view-link';
|
|
30
|
+
import PreviewDropdown from '../preview-dropdown';
|
|
31
|
+
import { store as editorStore } from '../../store';
|
|
32
|
+
const slideY = {
|
|
33
|
+
hidden: {
|
|
34
|
+
y: '-50px'
|
|
35
|
+
},
|
|
36
|
+
distractionFreeInactive: {
|
|
37
|
+
y: 0
|
|
38
|
+
},
|
|
39
|
+
hover: {
|
|
40
|
+
y: 0,
|
|
41
|
+
transition: {
|
|
42
|
+
type: 'tween',
|
|
43
|
+
delay: 0.2
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
function Header({
|
|
48
|
+
customSaveButton,
|
|
49
|
+
forceIsDirty,
|
|
50
|
+
forceDisableBlockTools,
|
|
51
|
+
setEntitiesSavedStatesCallback,
|
|
52
|
+
title,
|
|
53
|
+
children
|
|
54
|
+
}) {
|
|
55
|
+
const isWideViewport = useViewportMatch('large');
|
|
56
|
+
const isLargeViewport = useViewportMatch('medium');
|
|
57
|
+
const {
|
|
58
|
+
isTextEditor,
|
|
59
|
+
isPublishSidebarOpened,
|
|
60
|
+
showIconLabels,
|
|
61
|
+
hasFixedToolbar,
|
|
62
|
+
isNestedEntity,
|
|
63
|
+
isZoomedOutView
|
|
64
|
+
} = useSelect(select => {
|
|
65
|
+
const {
|
|
66
|
+
get: getPreference
|
|
67
|
+
} = select(preferencesStore);
|
|
68
|
+
const {
|
|
69
|
+
getEditorMode,
|
|
70
|
+
getEditorSettings,
|
|
71
|
+
isPublishSidebarOpened: _isPublishSidebarOpened
|
|
72
|
+
} = select(editorStore);
|
|
73
|
+
const {
|
|
74
|
+
__unstableGetEditorMode
|
|
75
|
+
} = select(blockEditorStore);
|
|
76
|
+
return {
|
|
77
|
+
isTextEditor: getEditorMode() === 'text',
|
|
78
|
+
isPublishSidebarOpened: _isPublishSidebarOpened(),
|
|
79
|
+
showIconLabels: getPreference('core', 'showIconLabels'),
|
|
80
|
+
hasFixedToolbar: getPreference('core', 'fixedToolbar'),
|
|
81
|
+
isNestedEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord,
|
|
82
|
+
isZoomedOutView: __unstableGetEditorMode() === 'zoom-out'
|
|
83
|
+
};
|
|
84
|
+
}, []);
|
|
85
|
+
const hasTopToolbar = isLargeViewport && hasFixedToolbar;
|
|
86
|
+
const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = useState(true);
|
|
87
|
+
|
|
88
|
+
// The edit-post-header classname is only kept for backward compatibilty
|
|
89
|
+
// as some plugins might be relying on its presence.
|
|
90
|
+
return createElement("div", {
|
|
91
|
+
className: "editor-header edit-post-header"
|
|
92
|
+
}, children, createElement(motion.div, {
|
|
93
|
+
variants: slideY,
|
|
94
|
+
transition: {
|
|
95
|
+
type: 'tween',
|
|
96
|
+
delay: 0.8
|
|
97
|
+
},
|
|
98
|
+
className: "editor-header__toolbar"
|
|
99
|
+
}, createElement(DocumentTools, {
|
|
100
|
+
disableBlockTools: forceDisableBlockTools || isTextEditor
|
|
101
|
+
}), hasTopToolbar && createElement(CollapsableBlockToolbar, {
|
|
102
|
+
isCollapsed: isBlockToolsCollapsed,
|
|
103
|
+
onToggle: setIsBlockToolsCollapsed
|
|
104
|
+
}), createElement("div", {
|
|
105
|
+
className: clsx('editor-header__center', {
|
|
106
|
+
'is-collapsed': !isBlockToolsCollapsed && hasTopToolbar
|
|
107
|
+
})
|
|
108
|
+
}, !title ? createElement(PostTypeSupportCheck, {
|
|
109
|
+
supportKeys: "title"
|
|
110
|
+
}, createElement(DocumentBar, null)) : title)), createElement(motion.div, {
|
|
111
|
+
variants: slideY,
|
|
112
|
+
transition: {
|
|
113
|
+
type: 'tween',
|
|
114
|
+
delay: 0.8
|
|
115
|
+
},
|
|
116
|
+
className: "editor-header__settings"
|
|
117
|
+
}, !customSaveButton && !isPublishSidebarOpened &&
|
|
118
|
+
// This button isn't completely hidden by the publish sidebar.
|
|
119
|
+
// We can't hide the whole toolbar when the publish sidebar is open because
|
|
120
|
+
// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
|
|
121
|
+
// We track that DOM node to return focus to the PostPublishButtonOrToggle
|
|
122
|
+
// when the publish sidebar has been closed.
|
|
123
|
+
createElement(PostSavedState, {
|
|
124
|
+
forceIsDirty: forceIsDirty
|
|
125
|
+
}), createElement(PreviewDropdown, {
|
|
126
|
+
forceIsAutosaveable: forceIsDirty,
|
|
127
|
+
disabled: isNestedEntity || isZoomedOutView
|
|
128
|
+
}), createElement(PostPreviewButton, {
|
|
129
|
+
className: "editor-header__post-preview-button",
|
|
130
|
+
forceIsAutosaveable: forceIsDirty
|
|
131
|
+
}), createElement(PostViewLink, null), !customSaveButton && createElement(PostPublishButtonOrToggle, {
|
|
132
|
+
forceIsDirty: forceIsDirty,
|
|
133
|
+
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
|
|
134
|
+
}), customSaveButton, (isWideViewport || !showIconLabels) && createElement(PinnedItems.Slot, {
|
|
135
|
+
scope: "core"
|
|
136
|
+
}), createElement(MoreMenu, null)));
|
|
137
|
+
}
|
|
138
|
+
export default Header;
|
|
139
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["clsx","useSelect","useViewportMatch","__unstableMotion","motion","store","preferencesStore","useState","PinnedItems","blockEditorStore","CollapsableBlockToolbar","DocumentBar","DocumentTools","MoreMenu","PostPreviewButton","PostPublishButtonOrToggle","PostSavedState","PostTypeSupportCheck","PostViewLink","PreviewDropdown","editorStore","slideY","hidden","y","distractionFreeInactive","hover","transition","type","delay","Header","customSaveButton","forceIsDirty","forceDisableBlockTools","setEntitiesSavedStatesCallback","title","children","isWideViewport","isLargeViewport","isTextEditor","isPublishSidebarOpened","showIconLabels","hasFixedToolbar","isNestedEntity","isZoomedOutView","select","get","getPreference","getEditorMode","getEditorSettings","_isPublishSidebarOpened","__unstableGetEditorMode","onNavigateToPreviousEntityRecord","hasTopToolbar","isBlockToolsCollapsed","setIsBlockToolsCollapsed","createElement","className","div","variants","disableBlockTools","isCollapsed","onToggle","supportKeys","forceIsAutosaveable","disabled","Slot","scope"],"sources":["@wordpress/editor/src/components/header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport CollapsableBlockToolbar from '../collapsible-block-toolbar';\nimport DocumentBar from '../document-bar';\nimport DocumentTools from '../document-tools';\nimport MoreMenu from '../more-menu';\nimport PostPreviewButton from '../post-preview-button';\nimport PostPublishButtonOrToggle from '../post-publish-button/post-publish-button-or-toggle';\nimport PostSavedState from '../post-saved-state';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport PostViewLink from '../post-view-link';\nimport PreviewDropdown from '../preview-dropdown';\nimport { store as editorStore } from '../../store';\n\nconst slideY = {\n\thidden: { y: '-50px' },\n\tdistractionFreeInactive: { y: 0 },\n\thover: { y: 0, transition: { type: 'tween', delay: 0.2 } },\n};\n\nfunction Header( {\n\tcustomSaveButton,\n\tforceIsDirty,\n\tforceDisableBlockTools,\n\tsetEntitiesSavedStatesCallback,\n\ttitle,\n\tchildren,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tisTextEditor,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasFixedToolbar,\n\t\tisNestedEntity,\n\t\tisZoomedOutView,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorMode,\n\t\t\tgetEditorSettings,\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened,\n\t\t} = select( editorStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\tisNestedEntity:\n\t\t\t\t!! getEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisZoomedOutView: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\n\tconst hasTopToolbar = isLargeViewport && hasFixedToolbar;\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\t// The edit-post-header classname is only kept for backward compatibilty\n\t// as some plugins might be relying on its presence.\n\treturn (\n\t\t<div className=\"editor-header edit-post-header\">\n\t\t\t{ children }\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"editor-header__toolbar\"\n\t\t\t>\n\t\t\t\t<DocumentTools\n\t\t\t\t\tdisableBlockTools={ forceDisableBlockTools || isTextEditor }\n\t\t\t\t/>\n\t\t\t\t{ hasTopToolbar && (\n\t\t\t\t\t<CollapsableBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'editor-header__center', {\n\t\t\t\t\t\t'is-collapsed':\n\t\t\t\t\t\t\t! isBlockToolsCollapsed && hasTopToolbar,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ ! title ? (\n\t\t\t\t\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t\t\t\t\t<DocumentBar />\n\t\t\t\t\t\t</PostTypeSupportCheck>\n\t\t\t\t\t) : (\n\t\t\t\t\t\ttitle\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</motion.div>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"editor-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! customSaveButton && ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t// We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState forceIsDirty={ forceIsDirty } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\tdisabled={ isNestedEntity || isZoomedOutView }\n\t\t\t\t/>\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"editor-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\t\t\t\t{ ! customSaveButton && (\n\t\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ customSaveButton }\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\t\t\t\t<MoreMenu />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;AAClE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SAASH,KAAK,IAAII,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,QAAQ,MAAM,cAAc;AACnC,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,yBAAyB,MAAM,sDAAsD;AAC5F,OAAOC,cAAc,MAAM,qBAAqB;AAChD,OAAOC,oBAAoB,MAAM,4BAA4B;AAC7D,OAAOC,YAAY,MAAM,mBAAmB;AAC5C,OAAOC,eAAe,MAAM,qBAAqB;AACjD,SAASd,KAAK,IAAIe,WAAW,QAAQ,aAAa;AAElD,MAAMC,MAAM,GAAG;EACdC,MAAM,EAAE;IAAEC,CAAC,EAAE;EAAQ,CAAC;E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B;IACjB0C,SAAS,EAAC,oCAAoC;IAC9CO,mBAAmB,EAAGhC;EAAc,CACpC,CAAC,EACFwB,aAAA,CAACrC,YAAY,MAAE,CAAC,EACd,CAAEY,gBAAgB,IACnByB,aAAA,CAACxC,yBAAyB;IACzBgB,YAAY,EAAGA,YAAc;IAC7BE,8BAA8B,EAC7BA;EACA,CACD,CACD,EACCH,gBAAgB,EAChB,CAAEM,cAAc,IAAI,CAAEI,cAAc,KACrCe,aAAA,CAAC/C,WAAW,CAACyD,IAAI;IAACC,KAAK,EAAC;EAAM,CAAE,CAChC,EACDX,aAAA,CAAC1C,QAAQ,MAAE,CACA,CACR,CAAC;AAER;AAEA,eAAegB,MAAM","ignoreList":[]}
|
|
@@ -3,13 +3,11 @@ import { createElement } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { useViewportMatch, __experimentalUseDialog as useDialog } from '@wordpress/compose';
|
|
10
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { useEffect, useRef } from '@wordpress/element';
|
|
6
|
+
import { __experimentalLibrary as Library, store as blockEditorStore } from '@wordpress/block-editor';
|
|
7
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
8
|
+
import { useCallback, useRef } from '@wordpress/element';
|
|
12
9
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
10
|
+
import { ESCAPE } from '@wordpress/keycodes';
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* Internal dependencies
|
|
@@ -21,54 +19,78 @@ export default function InserterSidebar({
|
|
|
21
19
|
isRightSidebarOpen
|
|
22
20
|
}) {
|
|
23
21
|
const {
|
|
22
|
+
blockSectionRootClientId,
|
|
23
|
+
inserterSidebarToggleRef,
|
|
24
24
|
insertionPoint,
|
|
25
25
|
showMostUsedBlocks
|
|
26
26
|
} = useSelect(select => {
|
|
27
27
|
const {
|
|
28
|
+
getInserterSidebarToggleRef,
|
|
28
29
|
getInsertionPoint
|
|
29
30
|
} = unlock(select(editorStore));
|
|
31
|
+
const {
|
|
32
|
+
getBlockRootClientId,
|
|
33
|
+
__unstableGetEditorMode,
|
|
34
|
+
getSettings
|
|
35
|
+
} = select(blockEditorStore);
|
|
30
36
|
const {
|
|
31
37
|
get
|
|
32
38
|
} = select(preferencesStore);
|
|
39
|
+
const getBlockSectionRootClientId = () => {
|
|
40
|
+
if (__unstableGetEditorMode() === 'zoom-out') {
|
|
41
|
+
const {
|
|
42
|
+
sectionRootClientId
|
|
43
|
+
} = unlock(getSettings());
|
|
44
|
+
if (sectionRootClientId) {
|
|
45
|
+
return sectionRootClientId;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return getBlockRootClientId();
|
|
49
|
+
};
|
|
33
50
|
return {
|
|
51
|
+
inserterSidebarToggleRef: getInserterSidebarToggleRef(),
|
|
34
52
|
insertionPoint: getInsertionPoint(),
|
|
35
|
-
showMostUsedBlocks: get('core', 'mostUsedBlocks')
|
|
53
|
+
showMostUsedBlocks: get('core', 'mostUsedBlocks'),
|
|
54
|
+
blockSectionRootClientId: getBlockSectionRootClientId()
|
|
36
55
|
};
|
|
37
56
|
}, []);
|
|
38
57
|
const {
|
|
39
58
|
setIsInserterOpened
|
|
40
59
|
} = useDispatch(editorStore);
|
|
41
60
|
const isMobileViewport = useViewportMatch('medium', '<');
|
|
42
|
-
const TagName = !isMobileViewport ? VisuallyHidden : 'div';
|
|
43
|
-
const [inserterDialogRef, inserterDialogProps] = useDialog({
|
|
44
|
-
onClose: () => setIsInserterOpened(false),
|
|
45
|
-
focusOnMount: null
|
|
46
|
-
});
|
|
47
61
|
const libraryRef = useRef();
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
|
|
63
|
+
// When closing the inserter, focus should return to the toggle button.
|
|
64
|
+
const closeInserterSidebar = useCallback(() => {
|
|
65
|
+
setIsInserterOpened(false);
|
|
66
|
+
inserterSidebarToggleRef.current?.focus();
|
|
67
|
+
}, [inserterSidebarToggleRef, setIsInserterOpened]);
|
|
68
|
+
const closeOnEscape = useCallback(event => {
|
|
69
|
+
if (event.keyCode === ESCAPE && !event.defaultPrevented) {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
closeInserterSidebar();
|
|
72
|
+
}
|
|
73
|
+
}, [closeInserterSidebar]);
|
|
74
|
+
return (
|
|
75
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
76
|
+
createElement("div", {
|
|
77
|
+
onKeyDown: closeOnEscape,
|
|
78
|
+
className: "editor-inserter-sidebar"
|
|
79
|
+
}, createElement("div", {
|
|
80
|
+
className: "editor-inserter-sidebar__content"
|
|
81
|
+
}, createElement(Library, {
|
|
82
|
+
showMostUsedBlocks: showMostUsedBlocks,
|
|
83
|
+
showInserterHelpPanel: true,
|
|
84
|
+
shouldFocusBlock: isMobileViewport,
|
|
85
|
+
rootClientId: blockSectionRootClientId !== null && blockSectionRootClientId !== void 0 ? blockSectionRootClientId : insertionPoint.rootClientId,
|
|
86
|
+
__experimentalInsertionIndex: insertionPoint.insertionIndex,
|
|
87
|
+
__experimentalInitialTab: insertionPoint.tab,
|
|
88
|
+
__experimentalInitialCategory: insertionPoint.category,
|
|
89
|
+
__experimentalFilterValue: insertionPoint.filterValue,
|
|
90
|
+
__experimentalOnPatternCategorySelection: isRightSidebarOpen ? closeGeneralSidebar : undefined,
|
|
91
|
+
ref: libraryRef,
|
|
92
|
+
onClose: closeInserterSidebar
|
|
93
|
+
})))
|
|
94
|
+
);
|
|
73
95
|
}
|
|
74
96
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","useSelect","
|
|
1
|
+
{"version":3,"names":["useDispatch","useSelect","__experimentalLibrary","Library","store","blockEditorStore","useViewportMatch","useCallback","useRef","preferencesStore","ESCAPE","unlock","editorStore","InserterSidebar","closeGeneralSidebar","isRightSidebarOpen","blockSectionRootClientId","inserterSidebarToggleRef","insertionPoint","showMostUsedBlocks","select","getInserterSidebarToggleRef","getInsertionPoint","getBlockRootClientId","__unstableGetEditorMode","getSettings","get","getBlockSectionRootClientId","sectionRootClientId","setIsInserterOpened","isMobileViewport","libraryRef","closeInserterSidebar","current","focus","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","createElement","onKeyDown","className","showInserterHelpPanel","shouldFocusBlock","rootClientId","__experimentalInsertionIndex","insertionIndex","__experimentalInitialTab","tab","__experimentalInitialCategory","category","__experimentalFilterValue","filterValue","__experimentalOnPatternCategorySelection","undefined","ref","onClose"],"sources":["@wordpress/editor/src/components/inserter-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\t__experimentalLibrary as Library,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nexport default function InserterSidebar( {\n\tcloseGeneralSidebar,\n\tisRightSidebarOpen,\n} ) {\n\tconst {\n\t\tblockSectionRootClientId,\n\t\tinserterSidebarToggleRef,\n\t\tinsertionPoint,\n\t\tshowMostUsedBlocks,\n\t} = useSelect( ( select ) => {\n\t\tconst { getInserterSidebarToggleRef, getInsertionPoint } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\tconst { getBlockRootClientId, __unstableGetEditorMode, getSettings } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst getBlockSectionRootClientId = () => {\n\t\t\tif ( __unstableGetEditorMode() === 'zoom-out' ) {\n\t\t\t\tconst { sectionRootClientId } = unlock( getSettings() );\n\t\t\t\tif ( sectionRootClientId ) {\n\t\t\t\t\treturn sectionRootClientId;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn getBlockRootClientId();\n\t\t};\n\t\treturn {\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tinsertionPoint: getInsertionPoint(),\n\t\t\tshowMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),\n\t\t\tblockSectionRootClientId: getBlockSectionRootClientId(),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst libraryRef = useRef();\n\n\t// When closing the inserter, focus should return to the toggle button.\n\tconst closeInserterSidebar = useCallback( () => {\n\t\tsetIsInserterOpened( false );\n\t\tinserterSidebarToggleRef.current?.focus();\n\t}, [ inserterSidebarToggleRef, setIsInserterOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseInserterSidebar();\n\t\t\t}\n\t\t},\n\t\t[ closeInserterSidebar ]\n\t);\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div onKeyDown={ closeOnEscape } className=\"editor-inserter-sidebar\">\n\t\t\t<div className=\"editor-inserter-sidebar__content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={\n\t\t\t\t\t\tblockSectionRootClientId ?? insertionPoint.rootClientId\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalInitialTab={ insertionPoint.tab }\n\t\t\t\t\t__experimentalInitialCategory={ insertionPoint.category }\n\t\t\t\t\t__experimentalFilterValue={ insertionPoint.filterValue }\n\t\t\t\t\t__experimentalOnPatternCategorySelection={\n\t\t\t\t\t\tisRightSidebarOpen ? closeGeneralSidebar : undefined\n\t\t\t\t\t}\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t\tonClose={ closeInserterSidebar }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,qBAAqB,IAAIC,OAAO,EAChCC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,EAAEC,MAAM,QAAQ,oBAAoB;AACxD,SAASJ,KAAK,IAAIK,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,MAAM,QAAQ,qBAAqB;;AAE5C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASP,KAAK,IAAIQ,WAAW,QAAQ,aAAa;AAElD,eAAe,SAASC,eAAeA,CAAE;EACxCC,mBAAmB;EACnBC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,wBAAwB;IACxBC,wBAAwB;IACxBC,cAAc;IACdC;EACD,CAAC,GAAGlB,SAAS,CAAImB,MAAM,IAAM;IAC5B,MAAM;MAAEC,2BAA2B;MAAEC;IAAkB,CAAC,GAAGX,MAAM,CAChES,MAAM,CAAER,WAAY,CACrB,CAAC;IACD,MAAM;MAAEW,oBAAoB;MAAEC,uBAA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AAoB,CAAC,CAAC;IACvB;EACD,CAAC,EACD,CAAEA,oBAAoB,CACvB,CAAC;EAED;IACC;IACAQ,aAAA;MAAKC,SAAS,EAAGN,aAAe;MAACO,SAAS,EAAC;IAAyB,GACnEF,aAAA;MAAKE,SAAS,EAAC;IAAkC,GAChDF,aAAA,CAACrC,OAAO;MACPgB,kBAAkB,EAAGA,kBAAoB;MACzCwB,qBAAqB;MACrBC,gBAAgB,EAAGd,gBAAkB;MACrCe,YAAY,EACX7B,wBAAwB,aAAxBA,wBAAwB,cAAxBA,wBAAwB,GAAIE,cAAc,CAAC2B,YAC3C;MACDC,4BAA4B,EAC3B5B,cAAc,CAAC6B,cACf;MACDC,wBAAwB,EAAG9B,cAAc,CAAC+B,GAAK;MAC/CC,6BAA6B,EAAGhC,cAAc,CAACiC,QAAU;MACzDC,yBAAyB,EAAGlC,cAAc,CAACmC,WAAa;MACxDC,wCAAwC,EACvCvC,kBAAkB,GAAGD,mBAAmB,GAAGyC,SAC3C;MACDC,GAAG,EAAGzB,UAAY;MAClB0B,OAAO,EAAGzB;IAAsB,CAChC,CACG,CACD;EAAC;AAER","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","textFormattingShortcuts","keyCombination","modifier","character","description"],"sources":["@wordpress/editor/src/components/keyboard-shortcut-help-modal/config.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const textFormattingShortcuts = [\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'b' },\n\t\tdescription: __( 'Make the selected text bold.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'i' },\n\t\tdescription: __( 'Make the selected text italic.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'k' },\n\t\tdescription: __( 'Convert the selected text into a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'k' },\n\t\tdescription: __( 'Remove a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { character: '[[' },\n\t\tdescription: __( 'Insert a link to a post or page.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'u' },\n\t\tdescription: __( 'Underline the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'd' },\n\t\tdescription: __( 'Strikethrough the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'x' },\n\t\tdescription: __( 'Make the selected text inline code.' ),\n\t},\n\t{\n\t\tkeyCombination: {
|
|
1
|
+
{"version":3,"names":["__","textFormattingShortcuts","keyCombination","modifier","character","description","aliases"],"sources":["@wordpress/editor/src/components/keyboard-shortcut-help-modal/config.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const textFormattingShortcuts = [\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'b' },\n\t\tdescription: __( 'Make the selected text bold.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'i' },\n\t\tdescription: __( 'Make the selected text italic.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'k' },\n\t\tdescription: __( 'Convert the selected text into a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'k' },\n\t\tdescription: __( 'Remove a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { character: '[[' },\n\t\tdescription: __( 'Insert a link to a post or page.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'u' },\n\t\tdescription: __( 'Underline the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'd' },\n\t\tdescription: __( 'Strikethrough the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'x' },\n\t\tdescription: __( 'Make the selected text inline code.' ),\n\t},\n\t{\n\t\tkeyCombination: {\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: '0',\n\t\t},\n\t\taliases: [\n\t\t\t{\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: '7',\n\t\t\t},\n\t\t],\n\t\tdescription: __( 'Convert the current heading to a paragraph.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: '1-6' },\n\t\tdescription: __(\n\t\t\t'Convert the current paragraph or heading to a heading of level 1 to 6.'\n\t\t),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'SPACE' },\n\t\tdescription: __( 'Add non breaking space.' ),\n\t},\n];\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AAEpC,OAAO,MAAMC,uBAAuB,GAAG,CACtC;EACCC,cAAc,EAAE;IAAEC,QAAQ,EAAE,SAAS;IAAEC,SAAS,EAAE;EAAI,CAAC;EACvDC,WAAW,EAAEL,EAAE,CAAE,8BAA+B;AACjD,CAAC,EACD;EACCE,cAAc,EAAE;IAAEC,QAAQ,EAAE,SAAS;IAAEC,SAAS,EAAE;EAAI,CAAC;EACvDC,WAAW,EAAEL,EAAE,CAAE,gCAAiC;AACnD,CAAC,EACD;EACCE,cAAc,EAAE;IAAEC,QAAQ,EAAE,SAAS;IAAEC,SAAS,EAAE;EAAI,CAAC;EACvDC,WAAW,EAAEL,EAAE,CAAE,wCAAyC;AAC3D,CAAC,EACD;EACCE,cAAc,EAAE;IAAEC,QAAQ,EAAE,cAAc;IAAEC,SAAS,EAAE;EAAI,CAAC;EAC5DC,WAAW,EAAEL,EAAE,CAAE,gBAAiB;AACnC,CAAC,EACD;EACCE,cAAc,EAAE;IAAEE,SAAS,EAAE;EAAK,CAAC;EACnCC,WAAW,EAAEL,EAAE,CAAE,kCAAmC;AACrD,CAAC,EACD;EACCE,cAAc,EAAE;IAAEC,QAAQ,EAAE,SAAS;IAAEC,SAAS,EAAE;EAAI,CAAC;EACvDC,WAAW,EAAEL,EAAE,CAAE,8BAA+B;AACjD,CAAC,EACD;EACCE,cAAc,EAAE;IAAEC,QAAQ,EAAE,QAAQ;IAAEC,SAAS,EAAE;EAAI,CAAC;EACtDC,WAAW,EAAEL,EAAE,CAAE,kCAAmC;AACrD,CAAC,EACD;EACCE,cAAc,EAAE;IAAEC,QAAQ,EAAE,QAAQ;IAAEC,SAAS,EAAE;EAAI,CAAC;EACtDC,WAAW,EAAEL,EAAE,CAAE,qCAAsC;AACxD,CAAC,EACD;EACCE,cAAc,EAAE;IACfC,QAAQ,EAAE,QAAQ;IAClBC,SAAS,EAAE;EACZ,CAAC;EACDE,OAAO,EAAE,CACR;IACCH,QAAQ,EAAE,QAAQ;IAClBC,SAAS,EAAE;EACZ,CAAC,CACD;EACDC,WAAW,EAAEL,EAAE,CAAE,6CAA8C;AAChE,CAAC,EACD;EACCE,cAAc,EAAE;IAAEC,QAAQ,EAAE,QAAQ;IAAEC,SAAS,EAAE;EAAM,CAAC;EACxDC,WAAW,EAAEL,EAAE,CACd,wEACD;AACD,CAAC,EACD;EACCE,cAAc,EAAE;IAAEC,QAAQ,EAAE,cAAc;IAAEC,SAAS,EAAE;EAAQ,CAAC;EAChEC,WAAW,EAAEL,EAAE,CAAE,yBAA0B;AAC5C,CAAC,CACD","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import { createElement } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import clsx from 'clsx';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -45,7 +45,7 @@ const ShortcutSection = ({
|
|
|
45
45
|
shortcuts,
|
|
46
46
|
className
|
|
47
47
|
}) => createElement("section", {
|
|
48
|
-
className:
|
|
48
|
+
className: clsx('editor-keyboard-shortcut-help-modal__section', className)
|
|
49
49
|
}, !!title && createElement("h2", {
|
|
50
50
|
className: "editor-keyboard-shortcut-help-modal__section-title"
|
|
51
51
|
}, title), createElement(ShortcutList, {
|