@wordpress/editor 14.10.0 → 14.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +2 -10
- package/build/bindings/post-meta.js +2 -1
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/collab-sidebar/add-comment.js +119 -0
- package/build/components/collab-sidebar/add-comment.js.map +1 -0
- package/build/components/collab-sidebar/comment-button-toolbar.js +37 -0
- package/build/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
- package/build/components/collab-sidebar/comment-button.js +37 -0
- package/build/components/collab-sidebar/comment-button.js.map +1 -0
- package/build/components/collab-sidebar/comments.js +321 -0
- package/build/components/collab-sidebar/comments.js.map +1 -0
- package/build/components/collab-sidebar/constants.js +8 -0
- package/build/components/collab-sidebar/constants.js.map +1 -0
- package/build/components/collab-sidebar/index.js +274 -0
- package/build/components/collab-sidebar/index.js.map +1 -0
- package/build/components/collab-sidebar/utils.js +16 -0
- package/build/components/collab-sidebar/utils.js.map +1 -0
- package/build/components/commands/index.js +148 -40
- package/build/components/commands/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +1 -0
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/document-bar/index.js +17 -10
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-tools/index.js +7 -7
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-interface/index.js +4 -4
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/entities-saved-states/index.js +1 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/global-styles-provider/index.js +25 -3
- package/build/components/global-styles-provider/index.js.map +1 -1
- package/build/components/header/index.js +12 -11
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +2 -2
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/more-menu/index.js +9 -7
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +5 -5
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-more-menu-item/index.js +13 -11
- package/build/components/plugin-more-menu-item/index.js.map +1 -1
- package/build/components/plugin-preview-menu-item/index.js +15 -13
- package/build/components/plugin-preview-menu-item/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +0 -15
- package/build/components/plugin-sidebar/index.js.map +1 -1
- package/build/components/post-actions/index.js +5 -5
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/panel.js +4 -4
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-card-panel/index.js +7 -36
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-content-information/index.js +1 -2
- package/build/components/post-content-information/index.js.map +1 -1
- package/build/components/post-featured-image/index.js +26 -7
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-last-revision/index.js +1 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-schedule/label.js +1 -1
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +11 -1
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-template/swap-template-button.js +0 -3
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-transform-panel/index.js +0 -3
- package/build/components/post-transform-panel/index.js.map +1 -1
- package/build/components/post-url/index.js +1 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/panel.js +3 -3
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/preferences-modal/index.js +26 -22
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +23 -8
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.js +10 -12
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +11 -10
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/sidebar/header.js +2 -1
- package/build/components/sidebar/header.js.map +1 -1
- package/build/components/sidebar/index.js +3 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/post-summary.js +2 -2
- package/build/components/sidebar/post-summary.js.map +1 -1
- package/build/components/start-page-options/index.js +0 -3
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/start-template-options/index.js +0 -3
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/time-to-read/index.js +2 -2
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/visual-editor/index.js +30 -29
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/visual-editor/use-zoom-out-mode-exit.js +52 -0
- package/build/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
- package/build/components/zoom-out-toggle/index.js +37 -5
- package/build/components/zoom-out-toggle/index.js.map +1 -1
- package/build/dataviews/actions/duplicate-template-part.js +2 -2
- package/build/dataviews/actions/duplicate-template-part.js.map +1 -1
- package/build/store/actions.js +68 -18
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +0 -2
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +0 -4
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +2 -2
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +5 -4
- package/build/store/selectors.js.map +1 -1
- package/build/utils/pageTypeBadge.js +51 -0
- package/build/utils/pageTypeBadge.js.map +1 -0
- package/build/utils/terms.js +2 -2
- package/build/utils/terms.js.map +1 -1
- package/build-module/bindings/post-meta.js +2 -1
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/collab-sidebar/add-comment.js +113 -0
- package/build-module/components/collab-sidebar/add-comment.js.map +1 -0
- package/build-module/components/collab-sidebar/comment-button-toolbar.js +30 -0
- package/build-module/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
- package/build-module/components/collab-sidebar/comment-button.js +30 -0
- package/build-module/components/collab-sidebar/comment-button.js.map +1 -0
- package/build-module/components/collab-sidebar/comments.js +314 -0
- package/build-module/components/collab-sidebar/comments.js.map +1 -0
- package/build-module/components/collab-sidebar/constants.js +2 -0
- package/build-module/components/collab-sidebar/constants.js.map +1 -0
- package/build-module/components/collab-sidebar/index.js +266 -0
- package/build-module/components/collab-sidebar/index.js.map +1 -0
- package/build-module/components/collab-sidebar/utils.js +10 -0
- package/build-module/components/collab-sidebar/utils.js.map +1 -0
- package/build-module/components/commands/index.js +151 -44
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +1 -0
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +19 -12
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-tools/index.js +8 -8
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-interface/index.js +4 -4
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +1 -1
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +25 -3
- package/build-module/components/global-styles-provider/index.js.map +1 -1
- package/build-module/components/header/index.js +12 -11
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +2 -2
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/more-menu/index.js +9 -7
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +5 -5
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-more-menu-item/index.js +12 -10
- package/build-module/components/plugin-more-menu-item/index.js.map +1 -1
- package/build-module/components/plugin-preview-menu-item/index.js +14 -12
- package/build-module/components/plugin-preview-menu-item/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +0 -15
- package/build-module/components/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/post-actions/index.js +5 -5
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +4 -4
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +8 -36
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-content-information/index.js +1 -2
- package/build-module/components/post-content-information/index.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +26 -7
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +1 -1
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js +1 -1
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +14 -4
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +0 -3
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-transform-panel/index.js +0 -3
- package/build-module/components/post-transform-panel/index.js.map +1 -1
- package/build-module/components/post-url/index.js +1 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/panel.js +3 -3
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +26 -22
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +24 -9
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.js +10 -12
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +12 -11
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/sidebar/header.js +2 -1
- package/build-module/components/sidebar/header.js.map +1 -1
- package/build-module/components/sidebar/index.js +4 -4
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-summary.js +2 -2
- package/build-module/components/sidebar/post-summary.js.map +1 -1
- package/build-module/components/start-page-options/index.js +0 -3
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +0 -3
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/time-to-read/index.js +2 -2
- package/build-module/components/time-to-read/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +31 -30
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/use-zoom-out-mode-exit.js +46 -0
- package/build-module/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
- package/build-module/components/zoom-out-toggle/index.js +37 -5
- package/build-module/components/zoom-out-toggle/index.js.map +1 -1
- package/build-module/dataviews/actions/duplicate-template-part.js +3 -3
- package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -1
- package/build-module/store/actions.js +64 -16
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +0 -2
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/index.js +0 -4
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +3 -3
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +5 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/pageTypeBadge.js +45 -0
- package/build-module/utils/pageTypeBadge.js.map +1 -0
- package/build-module/utils/terms.js +2 -2
- package/build-module/utils/terms.js.map +1 -1
- package/build-style/style-rtl.css +118 -60
- package/build-style/style.css +118 -60
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/add-comment.d.ts +15 -0
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts +5 -0
- package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-button.d.ts +5 -0
- package/build-types/components/collab-sidebar/comment-button.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comments.d.ts +19 -0
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/constants.d.ts +2 -0
- package/build-types/components/collab-sidebar/constants.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/index.d.ts +5 -0
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/utils.d.ts +8 -0
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -0
- package/build-types/components/commands/index.d.ts.map +1 -1
- package/build-types/components/create-template-part-modal/index.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/document-tools/index.d.ts.map +1 -1
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts +1 -2
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/more-menu/index.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/plugin-more-menu-item/index.d.ts +62 -2
- package/build-types/components/plugin-more-menu-item/index.d.ts.map +1 -1
- package/build-types/components/plugin-preview-menu-item/index.d.ts +41 -2
- package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -1
- package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
- package/build-types/components/post-author/panel.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
- package/build-types/components/post-template/hooks.d.ts +2 -2
- package/build-types/components/post-template/swap-template-button.d.ts.map +1 -1
- package/build-types/components/post-transform-panel/index.d.ts.map +1 -1
- package/build-types/components/preferences-modal/index.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/start-page-options/index.d.ts.map +1 -1
- package/build-types/components/start-template-options/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts +5 -0
- package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts.map +1 -0
- package/build-types/components/zoom-out-toggle/index.d.ts +3 -1
- package/build-types/components/zoom-out-toggle/index.d.ts.map +1 -1
- package/build-types/dataviews/store/reducer.d.ts +5 -2
- package/build-types/dataviews/store/reducer.d.ts.map +1 -1
- package/build-types/lock-unlock.d.ts +2 -2
- package/build-types/store/actions.d.ts +9 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/constants.d.ts +0 -2
- package/build-types/store/constants.d.ts.map +1 -1
- package/build-types/store/index.d.ts +9 -11
- package/build-types/store/index.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +24 -4
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +3 -3
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/pageTypeBadge.d.ts +5 -0
- package/build-types/utils/pageTypeBadge.d.ts.map +1 -0
- package/build-types/utils/terms.d.ts.map +1 -1
- package/package.json +39 -37
- package/src/bindings/post-meta.js +1 -0
- package/src/components/collab-sidebar/add-comment.js +121 -0
- package/src/components/collab-sidebar/comment-button-toolbar.js +29 -0
- package/src/components/collab-sidebar/comment-button.js +31 -0
- package/src/components/collab-sidebar/comments.js +404 -0
- package/src/components/collab-sidebar/constants.js +1 -0
- package/src/components/collab-sidebar/index.js +298 -0
- package/src/components/collab-sidebar/style.scss +111 -0
- package/src/components/collab-sidebar/utils.js +9 -0
- package/src/components/commands/index.js +390 -268
- package/src/components/create-template-part-modal/index.js +1 -0
- package/src/components/document-bar/index.js +25 -8
- package/src/components/document-bar/style.scss +13 -4
- package/src/components/document-tools/index.js +8 -8
- package/src/components/editor-interface/index.js +4 -4
- package/src/components/entities-saved-states/index.js +2 -2
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/src/components/global-styles-provider/index.js +32 -6
- package/src/components/header/index.js +20 -10
- package/src/components/inserter-sidebar/index.js +3 -6
- package/src/components/more-menu/index.js +12 -7
- package/src/components/page-attributes/parent.js +6 -4
- package/src/components/plugin-more-menu-item/index.js +12 -11
- package/src/components/plugin-post-publish-panel/test/__snapshots__/index.js.snap +1 -1
- package/src/components/plugin-preview-menu-item/index.js +14 -13
- package/src/components/plugin-sidebar/index.js +0 -13
- package/src/components/post-actions/index.js +8 -11
- package/src/components/post-author/panel.js +4 -2
- package/src/components/post-card-panel/index.js +9 -43
- package/src/components/post-card-panel/style.scss +1 -9
- package/src/components/post-content-information/index.js +1 -1
- package/src/components/post-featured-image/index.js +31 -16
- package/src/components/post-featured-image/style.scss +5 -2
- package/src/components/post-last-revision/index.js +1 -1
- package/src/components/post-schedule/label.js +1 -1
- package/src/components/post-sticky/test/index.js +6 -6
- package/src/components/post-taxonomies/flat-term-selector.js +15 -4
- package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/src/components/post-template/swap-template-button.js +0 -3
- package/src/components/post-transform-panel/index.js +0 -3
- package/src/components/post-url/index.js +1 -1
- package/src/components/post-url/panel.js +4 -2
- package/src/components/preferences-modal/index.js +26 -19
- package/src/components/preferences-modal/test/index.js +1 -1
- package/src/components/preview-dropdown/index.js +45 -18
- package/src/components/provider/index.js +31 -24
- package/src/components/provider/use-block-editor-settings.js +11 -10
- package/src/components/sidebar/header.js +3 -2
- package/src/components/sidebar/index.js +5 -3
- package/src/components/sidebar/post-summary.js +1 -1
- package/src/components/sidebar/style.scss +1 -3
- package/src/components/start-page-options/index.js +0 -3
- package/src/components/start-template-options/index.js +0 -3
- package/src/components/time-to-read/index.js +3 -3
- package/src/components/visual-editor/index.js +39 -42
- package/src/components/visual-editor/style.scss +11 -0
- package/src/components/visual-editor/use-zoom-out-mode-exit.js +49 -0
- package/src/components/zoom-out-toggle/index.js +39 -5
- package/src/dataviews/actions/duplicate-template-part.tsx +3 -3
- package/src/store/actions.js +113 -34
- package/src/store/constants.ts +0 -2
- package/src/store/index.js +0 -4
- package/src/store/private-actions.js +3 -3
- package/src/store/selectors.js +5 -4
- package/src/style.scss +1 -0
- package/src/utils/pageTypeBadge.js +41 -0
- package/src/utils/terms.js +4 -2
- package/src/utils/test/terms.js +3 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_data","_components","_blockEditor","_icons","_keycodes","_coreData","_commands","_element","_compose","_htmlEntities","_constants","_store","_jsxRuntime","MotionButton","motion","Button","DocumentBar","props","postType","postTypeLabel","documentTitle","isNotFound","isUnsyncedPattern","templateTitle","onNavigateToPreviousEntityRecord","useSelect","select","getCurrentPostType","getCurrentPostId","getEditorSettings","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","getEditedEntityRecord","getPostType","isResolving","isResolvingSelector","coreStore","_postType","_postId","_document","_templateInfo","_postTypeLabel","labels","singular_name","title","wp_pattern_sync_status","open","openCommandCenter","useDispatch","commandsStore","isReducedMotion","useReducedMotion","isTemplate","TEMPLATE_POST_TYPES","includes","isGlobalEntity","GLOBAL_POST_TYPES","hasBackButton","entityTitle","icon","mountedRef","useRef","useEffect","current","jsxs","className","clsx","children","jsx","__unstableAnimatePresence","isRTL","chevronRightSmall","chevronLeftSmall","onClick","event","stopPropagation","size","initial","opacity","transform","animate","exit","transition","duration","undefined","__","__experimentalText","__unstableMotion","div","BlockIcon","as","decodeEntities","displayShortcut","primary"],"sources":["@wordpress/editor/src/components/document-bar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { chevronLeftSmall, chevronRightSmall } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPES, GLOBAL_POST_TYPES } from '../../store/constants';\nimport { store as editorStore } from '../../store';\n\n/** @typedef {import(\"@wordpress/components\").IconType} IconType */\n\nconst MotionButton = motion( Button );\n\n/**\n * This component renders a navigation bar at the top of the editor. It displays the title of the current document,\n * a back button (if applicable), and a command center button. It also handles different states of the document,\n * such as \"not found\" or \"unsynced\".\n *\n * @example\n * ```jsx\n * <DocumentBar />\n * ```\n * @param {Object} props The component props.\n * @param {string} props.title A title for the document, defaulting to the document or\n * template title currently being edited.\n * @param {IconType} props.icon An icon for the document, no default.\n * (A default icon indicating the document post type is no longer used.)\n *\n * @return {JSX.Element} The rendered DocumentBar component.\n */\nexport default function DocumentBar( props ) {\n\tconst {\n\t\tpostType,\n\t\tpostTypeLabel,\n\t\tdocumentTitle,\n\t\tisNotFound,\n\t\tisUnsyncedPattern,\n\t\ttemplateTitle,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t\t__experimentalGetTemplateInfo: getTemplateInfo,\n\t\t} = select( editorStore );\n\t\tconst {\n\t\t\tgetEditedEntityRecord,\n\t\t\tgetPostType,\n\t\t\tisResolving: isResolvingSelector,\n\t\t} = select( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\tconst _postId = getCurrentPostId();\n\t\tconst _document = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId\n\t\t);\n\t\tconst _templateInfo = getTemplateInfo( _document );\n\t\tconst _postTypeLabel = getPostType( _postType )?.labels?.singular_name;\n\n\t\treturn {\n\t\t\tpostType: _postType,\n\t\t\tpostTypeLabel: _postTypeLabel,\n\t\t\tdocumentTitle: _document.title,\n\t\t\tisNotFound:\n\t\t\t\t! _document &&\n\t\t\t\t! isResolvingSelector(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t'postType',\n\t\t\t\t\t_postType,\n\t\t\t\t\t_postId\n\t\t\t\t),\n\t\t\tisUnsyncedPattern: _document?.wp_pattern_sync_status === 'unsynced',\n\t\t\ttemplateTitle: _templateInfo.title,\n\t\t\tonNavigateToPreviousEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t};\n\t}, [] );\n\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\tconst isReducedMotion = useReducedMotion();\n\n\tconst isTemplate = TEMPLATE_POST_TYPES.includes( postType );\n\tconst isGlobalEntity = GLOBAL_POST_TYPES.includes( postType );\n\tconst hasBackButton = !! onNavigateToPreviousEntityRecord;\n\tconst entityTitle = isTemplate ? templateTitle : documentTitle;\n\tconst title = props.title || entityTitle;\n\tconst icon = props.icon;\n\n\tconst mountedRef = useRef( false );\n\tuseEffect( () => {\n\t\tmountedRef.current = true;\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'editor-document-bar', {\n\t\t\t\t'has-back-button': hasBackButton,\n\t\t\t\t'is-global': isGlobalEntity && ! isUnsyncedPattern,\n\t\t\t} ) }\n\t\t>\n\t\t\t<AnimatePresence>\n\t\t\t\t{ hasBackButton && (\n\t\t\t\t\t<MotionButton\n\t\t\t\t\t\tclassName=\"editor-document-bar__back\"\n\t\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tonNavigateToPreviousEntityRecord();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? { opacity: 0, transform: 'translateX(15%)' }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ { opacity: 1, transform: 'translateX(0%)' } }\n\t\t\t\t\t\texit={ { opacity: 0, transform: 'translateX(15%)' } }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</MotionButton>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\n\t\t\t{ isNotFound ? (\n\t\t\t\t<Text>{ __( 'Document not found' ) }</Text>\n\t\t\t) : (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-document-bar__command\"\n\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"editor-document-bar__title\"\n\t\t\t\t\t\t// Force entry animation when the back button is added or removed.\n\t\t\t\t\t\tkey={ hasBackButton }\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t\t\ttransform: hasBackButton\n\t\t\t\t\t\t\t\t\t\t\t? 'translateX(15%)'\n\t\t\t\t\t\t\t\t\t\t\t: 'translateX(-15%)',\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateX(0%)',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon && <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\t<Text size=\"body\" as=\"h1\">\n\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-title\">\n\t\t\t\t\t\t\t\t{ title\n\t\t\t\t\t\t\t\t\t? decodeEntities( title )\n\t\t\t\t\t\t\t\t\t: __( 'No title' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ postTypeLabel && ! props.title && (\n\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t{ '· ' + decodeEntities( postTypeLabel ) }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</motion.div>\n\t\t\t\t\t<span className=\"editor-document-bar__shortcut\">\n\t\t\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAMA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,aAA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O,EAAG;UACTF,OAAO,EAAE,CAAC;UACVC,SAAS,EAAE;QACZ,CAAG;QACHG,UAAU,EACThC,eAAe,GAAG;UAAEiC,QAAQ,EAAE;QAAE,CAAC,GAAGC,SACpC;QAAAjB,QAAA,GAECR,IAAI,iBAAI,IAAAhD,WAAA,CAAAyD,GAAA,EAACnE,YAAA,CAAAwF,SAAS;UAAC9B,IAAI,EAAGA;QAAM,CAAE,CAAC,eACrC,IAAAhD,WAAA,CAAAqD,IAAA,EAAChE,WAAA,CAAAsF,kBAAI;UAACV,IAAI,EAAC,MAAM;UAACc,EAAE,EAAC,IAAI;UAAAvB,QAAA,gBACxB,IAAAxD,WAAA,CAAAyD,GAAA;YAAMH,SAAS,EAAC,iCAAiC;YAAAE,QAAA,EAC9CvB,KAAK,GACJ,IAAA+C,4BAAc,EAAE/C,KAAM,CAAC,GACvB,IAAAyC,QAAE,EAAE,UAAW;UAAC,CACd,CAAC,EACLnE,aAAa,IAAI,CAAEF,KAAK,CAAC4B,KAAK,iBAC/B,IAAAjC,WAAA,CAAAyD,GAAA;YAAMH,SAAS,EAAC,sCAAsC;YAAAE,QAAA,EACnD,IAAI,GAAG,IAAAwB,4BAAc,EAAEzE,aAAc;UAAC,CACnC,CACN;QAAA,CACI,CAAC;MAAA,GA/BDuC,aAgCK,CAAC,eACb,IAAA9C,WAAA,CAAAyD,GAAA;QAAMH,SAAS,EAAC,+BAA+B;QAAAE,QAAA,EAC5CyB,yBAAe,CAACC,OAAO,CAAE,GAAI;MAAC,CAC3B,CAAC;IAAA,CACA,CACR;EAAA,CACG,CAAC;AAER","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_data","_components","_blockEditor","_icons","_keycodes","_coreData","_commands","_element","_compose","_htmlEntities","_constants","_store","_pageTypeBadge","_jsxRuntime","MotionButton","motion","Button","DocumentBar","props","postType","postTypeLabel","documentTitle","isNotFound","templateTitle","onNavigateToPreviousEntityRecord","isTemplatePreview","useSelect","select","getCurrentPostType","getCurrentPostId","getEditorSettings","__experimentalGetTemplateInfo","getTemplateInfo","getRenderingMode","editorStore","getEditedEntityRecord","getPostType","isResolving","isResolvingSelector","coreStore","_postType","_postId","_document","_templateInfo","_postTypeLabel","labels","singular_name","title","open","openCommandCenter","useDispatch","commandsStore","isReducedMotion","useReducedMotion","isTemplate","TEMPLATE_POST_TYPES","includes","hasBackButton","entityTitle","icon","pageTypeBadge","usePageTypeBadge","mountedRef","useRef","useEffect","current","jsxs","className","clsx","children","jsx","__unstableAnimatePresence","isRTL","chevronRightSmall","chevronLeftSmall","onClick","event","stopPropagation","size","initial","opacity","transform","animate","exit","transition","duration","undefined","__","BlockIcon","layout","__experimentalText","__unstableMotion","div","as","decodeEntities","displayShortcut","primary"],"sources":["@wordpress/editor/src/components/document-bar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { chevronLeftSmall, chevronRightSmall, layout } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPES } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\n\n/** @typedef {import(\"@wordpress/components\").IconType} IconType */\n\nconst MotionButton = motion( Button );\n\n/**\n * This component renders a navigation bar at the top of the editor. It displays the title of the current document,\n * a back button (if applicable), and a command center button. It also handles different states of the document,\n * such as \"not found\" or \"unsynced\".\n *\n * @example\n * ```jsx\n * <DocumentBar />\n * ```\n * @param {Object} props The component props.\n * @param {string} props.title A title for the document, defaulting to the document or\n * template title currently being edited.\n * @param {IconType} props.icon An icon for the document, no default.\n * (A default icon indicating the document post type is no longer used.)\n *\n * @return {JSX.Element} The rendered DocumentBar component.\n */\nexport default function DocumentBar( props ) {\n\tconst {\n\t\tpostType,\n\t\tpostTypeLabel,\n\t\tdocumentTitle,\n\t\tisNotFound,\n\t\ttemplateTitle,\n\t\tonNavigateToPreviousEntityRecord,\n\t\tisTemplatePreview,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t\t__experimentalGetTemplateInfo: getTemplateInfo,\n\t\t\tgetRenderingMode,\n\t\t} = select( editorStore );\n\t\tconst {\n\t\t\tgetEditedEntityRecord,\n\t\t\tgetPostType,\n\t\t\tisResolving: isResolvingSelector,\n\t\t} = select( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\tconst _postId = getCurrentPostId();\n\t\tconst _document = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId\n\t\t);\n\t\tconst _templateInfo = getTemplateInfo( _document );\n\t\tconst _postTypeLabel = getPostType( _postType )?.labels?.singular_name;\n\n\t\treturn {\n\t\t\tpostType: _postType,\n\t\t\tpostTypeLabel: _postTypeLabel,\n\t\t\tdocumentTitle: _document.title,\n\t\t\tisNotFound:\n\t\t\t\t! _document &&\n\t\t\t\t! isResolvingSelector(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t'postType',\n\t\t\t\t\t_postType,\n\t\t\t\t\t_postId\n\t\t\t\t),\n\t\t\ttemplateTitle: _templateInfo.title,\n\t\t\tonNavigateToPreviousEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisTemplatePreview: getRenderingMode() === 'template-locked',\n\t\t};\n\t}, [] );\n\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\tconst isReducedMotion = useReducedMotion();\n\n\tconst isTemplate = TEMPLATE_POST_TYPES.includes( postType );\n\tconst hasBackButton = !! onNavigateToPreviousEntityRecord;\n\tconst entityTitle = isTemplate ? templateTitle : documentTitle;\n\tconst title = props.title || entityTitle;\n\tconst icon = props.icon;\n\n\tconst pageTypeBadge = usePageTypeBadge();\n\n\tconst mountedRef = useRef( false );\n\tuseEffect( () => {\n\t\tmountedRef.current = true;\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'editor-document-bar', {\n\t\t\t\t'has-back-button': hasBackButton,\n\t\t\t} ) }\n\t\t>\n\t\t\t<AnimatePresence>\n\t\t\t\t{ hasBackButton && (\n\t\t\t\t\t<MotionButton\n\t\t\t\t\t\tclassName=\"editor-document-bar__back\"\n\t\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tonNavigateToPreviousEntityRecord();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? { opacity: 0, transform: 'translateX(15%)' }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ { opacity: 1, transform: 'translateX(0%)' } }\n\t\t\t\t\t\texit={ { opacity: 0, transform: 'translateX(15%)' } }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</MotionButton>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\n\t\t\t{ ! isTemplate && isTemplatePreview && (\n\t\t\t\t<BlockIcon\n\t\t\t\t\ticon={ layout }\n\t\t\t\t\tclassName=\"editor-document-bar__icon-layout\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isNotFound ? (\n\t\t\t\t<Text>{ __( 'Document not found' ) }</Text>\n\t\t\t) : (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-document-bar__command\"\n\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"editor-document-bar__title\"\n\t\t\t\t\t\t// Force entry animation when the back button is added or removed.\n\t\t\t\t\t\tkey={ hasBackButton }\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t\t\ttransform: hasBackButton\n\t\t\t\t\t\t\t\t\t\t\t? 'translateX(15%)'\n\t\t\t\t\t\t\t\t\t\t\t: 'translateX(-15%)',\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateX(0%)',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon && <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\t<Text size=\"body\" as=\"h1\">\n\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-title\">\n\t\t\t\t\t\t\t\t{ title\n\t\t\t\t\t\t\t\t\t? decodeEntities( title )\n\t\t\t\t\t\t\t\t\t: __( 'No title' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ pageTypeBadge && (\n\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t{ `· ${ pageTypeBadge }` }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ postTypeLabel &&\n\t\t\t\t\t\t\t\t! props.title &&\n\t\t\t\t\t\t\t\t! pageTypeBadge && (\n\t\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t\t{ `· ${ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\tpostTypeLabel\n\t\t\t\t\t\t\t\t\t\t) }` }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</motion.div>\n\t\t\t\t\t<span className=\"editor-document-bar__shortcut\">\n\t\t\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAMA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAKA,IAAAY,UAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,cAAA,GAAAf,sBAAA,CAAAC,OAAA;AAAyD,IAAAe,WAAA,GAAAf,OAAA;AA9BzD;AACA;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|
listViewToggleRef,
|
|
50
|
-
showIconLabels
|
|
50
|
+
showIconLabels,
|
|
51
|
+
showTools
|
|
51
52
|
} = (0, _data.useSelect)(select => {
|
|
52
53
|
const {
|
|
53
54
|
get
|
|
@@ -56,14 +57,13 @@ function DocumentTools({
|
|
|
56
57
|
isListViewOpened,
|
|
57
58
|
getEditorMode,
|
|
58
59
|
getInserterSidebarToggleRef,
|
|
59
|
-
getListViewToggleRef
|
|
60
|
+
getListViewToggleRef,
|
|
61
|
+
getRenderingMode,
|
|
62
|
+
getCurrentPostType
|
|
60
63
|
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
61
64
|
const {
|
|
62
65
|
getShortcutRepresentation
|
|
63
66
|
} = select(_keyboardShortcuts.store);
|
|
64
|
-
const {
|
|
65
|
-
__unstableGetEditorMode
|
|
66
|
-
} = select(_blockEditor.store);
|
|
67
67
|
return {
|
|
68
68
|
isInserterOpened: select(_store.store).isInserterOpened(),
|
|
69
69
|
isListViewOpen: isListViewOpened(),
|
|
@@ -73,7 +73,7 @@ function DocumentTools({
|
|
|
73
73
|
showIconLabels: get('core', 'showIconLabels'),
|
|
74
74
|
isDistractionFree: get('core', 'distractionFree'),
|
|
75
75
|
isVisualMode: getEditorMode() === 'visual',
|
|
76
|
-
|
|
76
|
+
showTools: getRenderingMode() !== 'post-only' || getCurrentPostType() === 'wp_template'
|
|
77
77
|
};
|
|
78
78
|
}, []);
|
|
79
79
|
const preventDefault = event => {
|
|
@@ -125,7 +125,7 @@ function DocumentTools({
|
|
|
125
125
|
showTooltip: !showIconLabels,
|
|
126
126
|
"aria-expanded": isInserterOpened
|
|
127
127
|
}), (isWideViewport || !showIconLabels) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
128
|
-
children: [isLargeViewport && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarItem, {
|
|
128
|
+
children: [showTools && isLargeViewport && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarItem, {
|
|
129
129
|
as: _blockEditor.ToolSelector,
|
|
130
130
|
showTooltip: !showIconLabels,
|
|
131
131
|
variant: showIconLabels ? 'tertiary' : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_data","_i18n","_blockEditor","_components","_icons","_element","_keyboardShortcuts","_preferences","_lockUnlock","_store","_redo","_undo","_jsxRuntime","DocumentTools","className","disableBlockTools","setIsInserterOpened","setIsListViewOpened","useDispatch","editorStore","isDistractionFree","isInserterOpened","isListViewOpen","listViewShortcut","inserterSidebarToggleRef","listViewToggleRef","showIconLabels","useSelect","select","get","preferencesStore","isListViewOpened","getEditorMode","getInserterSidebarToggleRef","getListViewToggleRef","unlock","getShortcutRepresentation","keyboardShortcutsStore","__unstableGetEditorMode","blockEditorStore","isVisualMode","isZoomedOutView","preventDefault","event","isLargeViewport","useViewportMatch","isWideViewport","toolbarAriaLabel","__","toggleListView","useCallback","toggleInserter","longLabel","_x","shortLabel","jsx","NavigableToolbar","clsx","variant","children","jsxs","ToolbarItem","ref","as","Button","isPressed","onMouseDown","onClick","disabled","icon","plus","label","showTooltip","Fragment","ToolSelector","undefined","size","EditorHistoryUndo","EditorHistoryRedo","listView","shortcut","_default","exports","default"],"sources":["@wordpress/editor/src/components/document-tools/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tNavigableToolbar,\n\tToolSelector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport EditorHistoryRedo from '../editor-history/redo';\nimport EditorHistoryUndo from '../editor-history/undo';\n\nfunction DocumentTools( { className, disableBlockTools = false } ) {\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tisDistractionFree,\n\t\tisInserterOpened,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tinserterSidebarToggleRef,\n\t\tlistViewToggleRef,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst {\n\t\t\tisListViewOpened,\n\t\t\tgetEditorMode,\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tgetListViewToggleRef,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/editor/toggle-list-view'\n\t\t\t),\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t\tisZoomedOutView: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\n\tconst preventDefault = ( event ) => {\n\t\t// Because the inserter behaves like a dialog,\n\t\t// if the inserter is opened already then when we click on the toggle button\n\t\t// then the initial click event will close the inserter and then be propagated\n\t\t// to the inserter toggle and it will open it again.\n\t\t// To prevent this we need to stop the propagation of the event.\n\t\t// This won't be necessary when the inserter no longer behaves like a dialog.\n\n\t\tif ( isInserterOpened ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserter = useCallback(\n\t\t() => setIsInserterOpened( ! isInserterOpened ),\n\t\t[ isInserterOpened, setIsInserterOpened ]\n\t);\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Block Inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t// Some plugins expect and use the `edit-post-header-toolbar` CSS class to\n\t\t// find the toolbar and inject UI elements into it. This is not officially\n\t\t// supported, but we're keeping it in the list of class names for backwards\n\t\t// compatibility.\n\t\t<NavigableToolbar\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-document-tools',\n\t\t\t\t'edit-post-header-toolbar',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"editor-document-tools__left\">\n\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tref={ inserterSidebarToggleRef }\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"editor-document-tools__inserter-toggle\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\taria-expanded={ isInserterOpened }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\tclassName=\"editor-document-tools__document-overview-toggle\"\n\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\tlabel={ __( 'Document Overview' ) }\n\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-expanded={ isListViewOpen }\n\t\t\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AAKA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,KAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,KAAA,GAAAd,sBAAA,CAAAC,OAAA;AAAuD,IAAAc,WAAA,GAAAd,OAAA;AA5BvD;AACA;AACA;;AAGA;AACA;AACA;;AAeA;AACA;AACA;;AAMA,SAASe,aAAaA,CAAE;EAAEC,SAAS;EAAEC,iBAAiB,GAAG;AAAM,CAAC,EAAG;EAClE,MAAM;IAAEC,mBAAmB;IAAEC;EAAoB,CAAC,GACjD,IAAAC,iBAAW,EAAEC,YAAY,CAAC;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oB,CAAG;YACnCmB,OAAO,EAAGlB,cAAgB;YAC1B+B,QAAQ,EAAGzD,gBAAkB;YAC7BiD,WAAW,EAAG,CAAE9C,cAAgB;YAChCgC,OAAO,EACNhC,cAAc,GAAG,UAAU,GAAGiD,SAC9B;YACD,iBAAgBrD,cAAgB;YAChCwC,GAAG,EAAGrC,iBAAmB;YACzBmD,IAAI,EAAC;UAAS,CACd,CACD;QAAA,CACA,CACF;MAAA,CACG;IAAC,CACW;EAAC;AAErB;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEctE,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_data","_i18n","_blockEditor","_components","_icons","_element","_keyboardShortcuts","_preferences","_lockUnlock","_store","_redo","_undo","_jsxRuntime","DocumentTools","className","disableBlockTools","setIsInserterOpened","setIsListViewOpened","useDispatch","editorStore","isDistractionFree","isInserterOpened","isListViewOpen","listViewShortcut","inserterSidebarToggleRef","listViewToggleRef","showIconLabels","showTools","useSelect","select","get","preferencesStore","isListViewOpened","getEditorMode","getInserterSidebarToggleRef","getListViewToggleRef","getRenderingMode","getCurrentPostType","unlock","getShortcutRepresentation","keyboardShortcutsStore","isVisualMode","preventDefault","event","isLargeViewport","useViewportMatch","isWideViewport","toolbarAriaLabel","__","toggleListView","useCallback","toggleInserter","longLabel","_x","shortLabel","jsx","NavigableToolbar","clsx","variant","children","jsxs","ToolbarItem","ref","as","Button","isPressed","onMouseDown","onClick","disabled","icon","plus","label","showTooltip","Fragment","ToolSelector","undefined","size","EditorHistoryUndo","EditorHistoryRedo","listView","shortcut","_default","exports","default"],"sources":["@wordpress/editor/src/components/document-tools/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { NavigableToolbar, ToolSelector } from '@wordpress/block-editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport EditorHistoryRedo from '../editor-history/redo';\nimport EditorHistoryUndo from '../editor-history/undo';\n\nfunction DocumentTools( { className, disableBlockTools = false } ) {\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tisDistractionFree,\n\t\tisInserterOpened,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tinserterSidebarToggleRef,\n\t\tlistViewToggleRef,\n\t\tshowIconLabels,\n\t\tshowTools,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst {\n\t\t\tisListViewOpened,\n\t\t\tgetEditorMode,\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tgetListViewToggleRef,\n\t\t\tgetRenderingMode,\n\t\t\tgetCurrentPostType,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/editor/toggle-list-view'\n\t\t\t),\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t\tshowTools:\n\t\t\t\tgetRenderingMode() !== 'post-only' ||\n\t\t\t\tgetCurrentPostType() === 'wp_template',\n\t\t};\n\t}, [] );\n\n\tconst preventDefault = ( event ) => {\n\t\t// Because the inserter behaves like a dialog,\n\t\t// if the inserter is opened already then when we click on the toggle button\n\t\t// then the initial click event will close the inserter and then be propagated\n\t\t// to the inserter toggle and it will open it again.\n\t\t// To prevent this we need to stop the propagation of the event.\n\t\t// This won't be necessary when the inserter no longer behaves like a dialog.\n\n\t\tif ( isInserterOpened ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserter = useCallback(\n\t\t() => setIsInserterOpened( ! isInserterOpened ),\n\t\t[ isInserterOpened, setIsInserterOpened ]\n\t);\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Block Inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t// Some plugins expect and use the `edit-post-header-toolbar` CSS class to\n\t\t// find the toolbar and inject UI elements into it. This is not officially\n\t\t// supported, but we're keeping it in the list of class names for backwards\n\t\t// compatibility.\n\t\t<NavigableToolbar\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-document-tools',\n\t\t\t\t'edit-post-header-toolbar',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"editor-document-tools__left\">\n\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tref={ inserterSidebarToggleRef }\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"editor-document-tools__inserter-toggle\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\taria-expanded={ isInserterOpened }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ showTools && isLargeViewport && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\tclassName=\"editor-document-tools__document-overview-toggle\"\n\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\tlabel={ __( 'Document Overview' ) }\n\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-expanded={ isListViewOpen }\n\t\t\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AAKA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,KAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,KAAA,GAAAd,sBAAA,CAAAC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IAAI,EAAC;UAAS,CACd,CAAC,EACA,CAAExD,iBAAiB,iBACpB,IAAAR,WAAA,CAAA2C,GAAA,EAACpD,WAAA,CAAA0D,WAAW;YACXE,EAAE,EAAGC,kBAAQ;YACblD,SAAS,EAAC,iDAAiD;YAC3DuD,IAAI,EAAGU,eAAU;YACjBX,QAAQ,EAAGrD,iBAAmB;YAC9BkD,SAAS,EAAG3C;YACZ;YACAiD,KAAK,EAAG,IAAAvB,QAAE,EAAE,mBAAoB,CAAG;YACnCmB,OAAO,EAAGlB,cAAgB;YAC1B+B,QAAQ,EAAGzD,gBAAkB;YAC7BiD,WAAW,EAAG,CAAE9C,cAAgB;YAChCgC,OAAO,EACNhC,cAAc,GAAG,UAAU,GAAGiD,SAC9B;YACD,iBAAgBrD,cAAgB;YAChCwC,GAAG,EAAGrC,iBAAmB;YACzBmD,IAAI,EAAC;UAAS,CACd,CACD;QAAA,CACA,CACF;MAAA,CACG;IAAC,CACW;EAAC;AAErB;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEctE,aAAa","ignoreList":[]}
|
|
@@ -91,10 +91,11 @@ function EditorInterface({
|
|
|
91
91
|
isInserterOpened: select(_store.store).isInserterOpened(),
|
|
92
92
|
isListViewOpened: select(_store.store).isListViewOpened(),
|
|
93
93
|
isDistractionFree: get('core', 'distractionFree'),
|
|
94
|
-
isPreviewMode: editorSettings.
|
|
94
|
+
isPreviewMode: editorSettings.isPreviewMode,
|
|
95
95
|
showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
|
|
96
|
+
documentLabel:
|
|
96
97
|
// translators: Default label for the Document in the Block Breadcrumb.
|
|
97
|
-
|
|
98
|
+
postTypeLabel || (0, _i18n._x)('Document', 'noun, breadcrumb'),
|
|
98
99
|
isZoomOut: _isZoomOut()
|
|
99
100
|
};
|
|
100
101
|
}, []);
|
|
@@ -125,8 +126,7 @@ function EditorInterface({
|
|
|
125
126
|
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback,
|
|
126
127
|
customSaveButton: customSaveButton,
|
|
127
128
|
forceDisableBlockTools: forceDisableBlockTools,
|
|
128
|
-
title: title
|
|
129
|
-
isEditorIframed: !disableIframe
|
|
129
|
+
title: title
|
|
130
130
|
}),
|
|
131
131
|
editorNotices: /*#__PURE__*/(0, _jsxRuntime.jsx)(_editorNotices.default, {}),
|
|
132
132
|
secondarySidebar: !isPreviewMode && mode === 'visual' && (isInserterOpened && /*#__PURE__*/(0, _jsxRuntime.jsx)(_inserterSidebar.default, {}) || isListViewOpened && /*#__PURE__*/(0, _jsxRuntime.jsx)(_listViewSidebar.default, {})),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_interface","_data","_i18n","_preferences","_blockEditor","_compose","_element","_store","_editorNotices","_header","_inserterSidebar","_listViewSidebar","_savePublishPanels","_textEditor","_visualEditor","_contentSlotFill","_lockUnlock","_jsxRuntime","interfaceLabels","header","__","body","sidebar","actions","footer","EditorInterface","className","styles","children","forceIsDirty","contentRef","disableIframe","autoFocus","customSaveButton","customSavePanel","forceDisableBlockTools","title","iframeProps","mode","isRichEditingEnabled","isInserterOpened","isListViewOpened","isDistractionFree","isPreviewMode","showBlockBreadcrumbs","documentLabel","isZoomOut","useSelect","select","get","preferencesStore","getEditorSettings","getPostTypeLabel","editorStore","editorSettings","postTypeLabel","_isZoomOut","unlock","blockEditorStore","getEditorMode","richEditingEnabled","__unstableIsPreviewMode","_x","isLargeViewport","useViewportMatch","secondarySidebarLabel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","useState","closeEntitiesSavedStates","useCallback","arg","jsx","InterfaceSkeleton","clsx","labels","secondarySidebar","default","isEditorIframed","editorNotices","ComplementaryArea","Slot","scope","content","jsxs","Fragment","editorCanvasView","BlockToolbar","hideDragHandle","BlockBreadcrumb","rootLabelText","isEntitiesSavedStatesOpen","forceIsDirtyPublishPanel","undefined"],"sources":["@wordpress/editor/src/components/editor-interface/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { InterfaceSkeleton, ComplementaryArea } from '@wordpress/interface';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tstore as blockEditorStore,\n\tBlockBreadcrumb,\n\tBlockToolbar,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useState, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport EditorNotices from '../editor-notices';\nimport Header from '../header';\nimport InserterSidebar from '../inserter-sidebar';\nimport ListViewSidebar from '../list-view-sidebar';\nimport SavePublishPanels from '../save-publish-panels';\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport EditorContentSlotFill from './content-slot-fill';\n\nimport { unlock } from '../../lock-unlock';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nexport default function EditorInterface( {\n\tclassName,\n\tstyles,\n\tchildren,\n\tforceIsDirty,\n\tcontentRef,\n\tdisableIframe,\n\tautoFocus,\n\tcustomSaveButton,\n\tcustomSavePanel,\n\tforceDisableBlockTools,\n\ttitle,\n\tiframeProps,\n} ) {\n\tconst {\n\t\tmode,\n\t\tisRichEditingEnabled,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tisDistractionFree,\n\t\tisPreviewMode,\n\t\tshowBlockBreadcrumbs,\n\t\tdocumentLabel,\n\t\tisZoomOut,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditorSettings, getPostTypeLabel } = select( editorStore );\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst postTypeLabel = getPostTypeLabel();\n\t\tconst { isZoomOut: _isZoomOut } = unlock( select( blockEditorStore ) );\n\n\t\treturn {\n\t\t\tmode: select( editorStore ).getEditorMode(),\n\t\t\tisRichEditingEnabled: editorSettings.richEditingEnabled,\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpened: select( editorStore ).isListViewOpened(),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisPreviewMode: editorSettings.__unstableIsPreviewMode,\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\t// translators: Default label for the Document in the Block Breadcrumb.\n\t\t\tdocumentLabel: postTypeLabel || _x( 'Document', 'noun' ),\n\t\t\tisZoomOut: _isZoomOut(),\n\t\t};\n\t}, [] );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'Document Overview' )\n\t\t: __( 'Block Library' );\n\n\t// Local state for save panel.\n\t// Note 'truthy' callback implies an open panel.\n\tconst [ entitiesSavedStatesCallback, setEntitiesSavedStatesCallback ] =\n\t\tuseState( false );\n\tconst closeEntitiesSavedStates = useCallback(\n\t\t( arg ) => {\n\t\t\tif ( typeof entitiesSavedStatesCallback === 'function' ) {\n\t\t\t\tentitiesSavedStatesCallback( arg );\n\t\t\t}\n\t\t\tsetEntitiesSavedStatesCallback( false );\n\t\t},\n\t\t[ entitiesSavedStatesCallback ]\n\t);\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\tclassName={ clsx( 'editor-editor-interface', className, {\n\t\t\t\t'is-entity-save-view-open': !! entitiesSavedStatesCallback,\n\t\t\t\t'is-distraction-free': isDistractionFree && ! isPreviewMode,\n\t\t\t} ) }\n\t\t\tlabels={ {\n\t\t\t\t...interfaceLabels,\n\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t} }\n\t\t\theader={\n\t\t\t\t! isPreviewMode && (\n\t\t\t\t\t<Header\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\tcustomSaveButton={ customSaveButton }\n\t\t\t\t\t\tforceDisableBlockTools={ forceDisableBlockTools }\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\tisEditorIframed={ ! disableIframe }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\teditorNotices={ <EditorNotices /> }\n\t\t\tsecondarySidebar={\n\t\t\t\t! isPreviewMode &&\n\t\t\t\tmode === 'visual' &&\n\t\t\t\t( ( isInserterOpened && <InserterSidebar /> ) ||\n\t\t\t\t\t( isListViewOpened && <ListViewSidebar /> ) )\n\t\t\t}\n\t\t\tsidebar={\n\t\t\t\t! isPreviewMode &&\n\t\t\t\t! isDistractionFree && <ComplementaryArea.Slot scope=\"core\" />\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ ! isDistractionFree && ! isPreviewMode && (\n\t\t\t\t\t\t<EditorNotices />\n\t\t\t\t\t) }\n\n\t\t\t\t\t<EditorContentSlotFill.Slot>\n\t\t\t\t\t\t{ ( [ editorCanvasView ] ) =>\n\t\t\t\t\t\t\teditorCanvasView ? (\n\t\t\t\t\t\t\t\teditorCanvasView\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ ! isPreviewMode &&\n\t\t\t\t\t\t\t\t\t\t( mode === 'text' ||\n\t\t\t\t\t\t\t\t\t\t\t! isRichEditingEnabled ) && (\n\t\t\t\t\t\t\t\t\t\t\t<TextEditor\n\t\t\t\t\t\t\t\t\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\t\t\t\t\t\t\tautoFocus={ autoFocus }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ ! isPreviewMode &&\n\t\t\t\t\t\t\t\t\t\t! isLargeViewport &&\n\t\t\t\t\t\t\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ ( isPreviewMode ||\n\t\t\t\t\t\t\t\t\t\t( isRichEditingEnabled &&\n\t\t\t\t\t\t\t\t\t\t\tmode === 'visual' ) ) && (\n\t\t\t\t\t\t\t\t\t\t<VisualEditor\n\t\t\t\t\t\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\t\t\t\t\t\tdisableIframe={ disableIframe }\n\t\t\t\t\t\t\t\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\t\t\t\t\t\tautoFocus={ autoFocus }\n\t\t\t\t\t\t\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t</EditorContentSlotFill.Slot>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t! isPreviewMode &&\n\t\t\t\t! isDistractionFree &&\n\t\t\t\tisLargeViewport &&\n\t\t\t\tshowBlockBreadcrumbs &&\n\t\t\t\tisRichEditingEnabled &&\n\t\t\t\t! isZoomOut &&\n\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t<BlockBreadcrumb rootLabelText={ documentLabel } />\n\t\t\t\t)\n\t\t\t}\n\t\t\tactions={\n\t\t\t\t! isPreviewMode\n\t\t\t\t\t? customSavePanel || (\n\t\t\t\t\t\t\t<SavePublishPanels\n\t\t\t\t\t\t\t\tcloseEntitiesSavedStates={\n\t\t\t\t\t\t\t\t\tcloseEntitiesSavedStates\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisEntitiesSavedStatesOpen={\n\t\t\t\t\t\t\t\t\tentitiesSavedStatesCallback\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tforceIsDirtyPublishPanel={ forceIsDirty }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAKA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,OAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,gBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,gBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,kBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAA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;IACDtB,OAAO,EACN,CAAEoB,aAAa,GACZT,eAAe,iBACf,IAAAjB,WAAA,CAAAuD,GAAA,EAAC5D,kBAAA,CAAAiE,OAAiB;MACjBR,wBAAwB,EACvBA,wBACA;MACDsB,yBAAyB,EACxBzB,2BACA;MACDC,8BAA8B,EAC7BA,8BACA;MACDyB,wBAAwB,EAAG/D;IAAc,CACzC,CACA,GACDgE;EACH,CACD,CAAC;AAEJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_interface","_data","_i18n","_preferences","_blockEditor","_compose","_element","_store","_editorNotices","_header","_inserterSidebar","_listViewSidebar","_savePublishPanels","_textEditor","_visualEditor","_contentSlotFill","_lockUnlock","_jsxRuntime","interfaceLabels","header","__","body","sidebar","actions","footer","EditorInterface","className","styles","children","forceIsDirty","contentRef","disableIframe","autoFocus","customSaveButton","customSavePanel","forceDisableBlockTools","title","iframeProps","mode","isRichEditingEnabled","isInserterOpened","isListViewOpened","isDistractionFree","isPreviewMode","showBlockBreadcrumbs","documentLabel","isZoomOut","useSelect","select","get","preferencesStore","getEditorSettings","getPostTypeLabel","editorStore","editorSettings","postTypeLabel","_isZoomOut","unlock","blockEditorStore","getEditorMode","richEditingEnabled","_x","isLargeViewport","useViewportMatch","secondarySidebarLabel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","useState","closeEntitiesSavedStates","useCallback","arg","jsx","InterfaceSkeleton","clsx","labels","secondarySidebar","default","editorNotices","ComplementaryArea","Slot","scope","content","jsxs","Fragment","editorCanvasView","BlockToolbar","hideDragHandle","BlockBreadcrumb","rootLabelText","isEntitiesSavedStatesOpen","forceIsDirtyPublishPanel","undefined"],"sources":["@wordpress/editor/src/components/editor-interface/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { InterfaceSkeleton, ComplementaryArea } from '@wordpress/interface';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tstore as blockEditorStore,\n\tBlockBreadcrumb,\n\tBlockToolbar,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useState, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport EditorNotices from '../editor-notices';\nimport Header from '../header';\nimport InserterSidebar from '../inserter-sidebar';\nimport ListViewSidebar from '../list-view-sidebar';\nimport SavePublishPanels from '../save-publish-panels';\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport EditorContentSlotFill from './content-slot-fill';\n\nimport { unlock } from '../../lock-unlock';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nexport default function EditorInterface( {\n\tclassName,\n\tstyles,\n\tchildren,\n\tforceIsDirty,\n\tcontentRef,\n\tdisableIframe,\n\tautoFocus,\n\tcustomSaveButton,\n\tcustomSavePanel,\n\tforceDisableBlockTools,\n\ttitle,\n\tiframeProps,\n} ) {\n\tconst {\n\t\tmode,\n\t\tisRichEditingEnabled,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tisDistractionFree,\n\t\tisPreviewMode,\n\t\tshowBlockBreadcrumbs,\n\t\tdocumentLabel,\n\t\tisZoomOut,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditorSettings, getPostTypeLabel } = select( editorStore );\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst postTypeLabel = getPostTypeLabel();\n\t\tconst { isZoomOut: _isZoomOut } = unlock( select( blockEditorStore ) );\n\n\t\treturn {\n\t\t\tmode: select( editorStore ).getEditorMode(),\n\t\t\tisRichEditingEnabled: editorSettings.richEditingEnabled,\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpened: select( editorStore ).isListViewOpened(),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisPreviewMode: editorSettings.isPreviewMode,\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tdocumentLabel:\n\t\t\t\t// translators: Default label for the Document in the Block Breadcrumb.\n\t\t\t\tpostTypeLabel || _x( 'Document', 'noun, breadcrumb' ),\n\t\t\tisZoomOut: _isZoomOut(),\n\t\t};\n\t}, [] );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'Document Overview' )\n\t\t: __( 'Block Library' );\n\n\t// Local state for save panel.\n\t// Note 'truthy' callback implies an open panel.\n\tconst [ entitiesSavedStatesCallback, setEntitiesSavedStatesCallback ] =\n\t\tuseState( false );\n\tconst closeEntitiesSavedStates = useCallback(\n\t\t( arg ) => {\n\t\t\tif ( typeof entitiesSavedStatesCallback === 'function' ) {\n\t\t\t\tentitiesSavedStatesCallback( arg );\n\t\t\t}\n\t\t\tsetEntitiesSavedStatesCallback( false );\n\t\t},\n\t\t[ entitiesSavedStatesCallback ]\n\t);\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\tclassName={ clsx( 'editor-editor-interface', className, {\n\t\t\t\t'is-entity-save-view-open': !! entitiesSavedStatesCallback,\n\t\t\t\t'is-distraction-free': isDistractionFree && ! isPreviewMode,\n\t\t\t} ) }\n\t\t\tlabels={ {\n\t\t\t\t...interfaceLabels,\n\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t} }\n\t\t\theader={\n\t\t\t\t! isPreviewMode && (\n\t\t\t\t\t<Header\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\tcustomSaveButton={ customSaveButton }\n\t\t\t\t\t\tforceDisableBlockTools={ forceDisableBlockTools }\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\teditorNotices={ <EditorNotices /> }\n\t\t\tsecondarySidebar={\n\t\t\t\t! isPreviewMode &&\n\t\t\t\tmode === 'visual' &&\n\t\t\t\t( ( isInserterOpened && <InserterSidebar /> ) ||\n\t\t\t\t\t( isListViewOpened && <ListViewSidebar /> ) )\n\t\t\t}\n\t\t\tsidebar={\n\t\t\t\t! isPreviewMode &&\n\t\t\t\t! isDistractionFree && <ComplementaryArea.Slot scope=\"core\" />\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ ! isDistractionFree && ! isPreviewMode && (\n\t\t\t\t\t\t<EditorNotices />\n\t\t\t\t\t) }\n\n\t\t\t\t\t<EditorContentSlotFill.Slot>\n\t\t\t\t\t\t{ ( [ editorCanvasView ] ) =>\n\t\t\t\t\t\t\teditorCanvasView ? (\n\t\t\t\t\t\t\t\teditorCanvasView\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ ! isPreviewMode &&\n\t\t\t\t\t\t\t\t\t\t( mode === 'text' ||\n\t\t\t\t\t\t\t\t\t\t\t! isRichEditingEnabled ) && (\n\t\t\t\t\t\t\t\t\t\t\t<TextEditor\n\t\t\t\t\t\t\t\t\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\t\t\t\t\t\t\tautoFocus={ autoFocus }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ ! isPreviewMode &&\n\t\t\t\t\t\t\t\t\t\t! isLargeViewport &&\n\t\t\t\t\t\t\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ ( isPreviewMode ||\n\t\t\t\t\t\t\t\t\t\t( isRichEditingEnabled &&\n\t\t\t\t\t\t\t\t\t\t\tmode === 'visual' ) ) && (\n\t\t\t\t\t\t\t\t\t\t<VisualEditor\n\t\t\t\t\t\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\t\t\t\t\t\tdisableIframe={ disableIframe }\n\t\t\t\t\t\t\t\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\t\t\t\t\t\tautoFocus={ autoFocus }\n\t\t\t\t\t\t\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t</EditorContentSlotFill.Slot>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t! isPreviewMode &&\n\t\t\t\t! isDistractionFree &&\n\t\t\t\tisLargeViewport &&\n\t\t\t\tshowBlockBreadcrumbs &&\n\t\t\t\tisRichEditingEnabled &&\n\t\t\t\t! isZoomOut &&\n\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t<BlockBreadcrumb rootLabelText={ documentLabel } />\n\t\t\t\t)\n\t\t\t}\n\t\t\tactions={\n\t\t\t\t! isPreviewMode\n\t\t\t\t\t? customSavePanel || (\n\t\t\t\t\t\t\t<SavePublishPanels\n\t\t\t\t\t\t\t\tcloseEntitiesSavedStates={\n\t\t\t\t\t\t\t\t\tcloseEntitiesSavedStates\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisEntitiesSavedStatesOpen={\n\t\t\t\t\t\t\t\t\tentitiesSavedStatesCallback\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tforceIsDirtyPublishPanel={ forceIsDirty }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAKA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,OAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,gBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,gBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,kBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,WAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,aAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,gBAAA,GAAAjB,sBAAA,CAAAC,OAAA;AAEA,IAAAiB,WAAA,GAAAjB,OAAA;AAA2C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BAAwB,EAAG7D;IAAc,CACzC,CACA,GACD8D;EACH,CACD,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -157,7 +157,7 @@ function EntitiesSavedStatesExtensible({
|
|
|
157
157
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
158
158
|
id: renderDialog ? dialogDescription : undefined,
|
|
159
159
|
children: isDirty ? (0, _element.createInterpolateElement)((0, _i18n.sprintf)(/* translators: %d: number of site changes waiting to be saved. */
|
|
160
|
-
(0, _i18n._n)('There is <strong>%d site change</strong> waiting to be saved.', 'There are <strong>%d site changes</strong> waiting to be saved.',
|
|
160
|
+
(0, _i18n._n)('There is <strong>%d site change</strong> waiting to be saved.', 'There are <strong>%d site changes</strong> waiting to be saved.', dirtyEntityRecords.length), dirtyEntityRecords.length), {
|
|
161
161
|
strong: /*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {})
|
|
162
162
|
}) : (0, _i18n.__)('Select the items you want to save.')
|
|
163
163
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_element","_compose","_data","_entityTypeList","_interopRequireDefault","_useIsDirty","_store","_lockUnlock","_jsxRuntime","identity","values","EntitiesSavedStates","close","renderDialog","undefined","isDirtyProps","useIsDirty","jsx","EntitiesSavedStatesExtensible","additionalPrompt","onSave","saveEnabled","saveEnabledProp","saveLabel","__","dirtyEntityRecords","isDirty","setUnselectedEntities","unselectedEntities","saveButtonRef","useRef","saveDirtyEntities","unlock","useDispatch","editorStore","partitionedSavables","reduce","acc","record","name","push","site","siteSavables","wp_template","templateSavables","wp_template_part","templatePartSavables","contentSavables","sortedPartitionedSavables","Object","filter","Array","isArray","dismissPanel","useCallback","saveDialogRef","saveDialogProps","useDialog","onClose","dialogLabel","useInstanceId","dialogDescription","jsxs","ref","className","role","children","Flex","gap","FlexItem","isBlock","as","Button","variant","size","onClick","disabled","accessibleWhenDisabled","entitiesToSkip","id","createInterpolateElement","sprintf","_n","length","strong","map","list","default"],"sources":["@wordpress/editor/src/components/entities-saved-states/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Flex, FlexItem } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tuseCallback,\n\tuseRef,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport {\n\t__experimentalUseDialog as useDialog,\n\tuseInstanceId,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport EntityTypeList from './entity-type-list';\nimport { useIsDirty } from './hooks/use-is-dirty';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction identity( values ) {\n\treturn values;\n}\n\n/**\n * Renders the component for managing saved states of entities.\n *\n * @param {Object} props The component props.\n * @param {Function} props.close The function to close the dialog.\n * @param {Function} props.renderDialog The function to render the dialog.\n *\n * @return {JSX.Element} The rendered component.\n */\nexport default function EntitiesSavedStates( {\n\tclose,\n\trenderDialog = undefined,\n} ) {\n\tconst isDirtyProps = useIsDirty();\n\treturn (\n\t\t<EntitiesSavedStatesExtensible\n\t\t\tclose={ close }\n\t\t\trenderDialog={ renderDialog }\n\t\t\t{ ...isDirtyProps }\n\t\t/>\n\t);\n}\n\n/**\n * Renders a panel for saving entities with dirty records.\n *\n * @param {Object} props The component props.\n * @param {string} props.additionalPrompt Additional prompt to display.\n * @param {Function} props.close Function to close the panel.\n * @param {Function} props.onSave Function to call when saving entities.\n * @param {boolean} props.saveEnabled Flag indicating if save is enabled.\n * @param {string} props.saveLabel Label for the save button.\n * @param {Function} props.renderDialog Function to render a custom dialog.\n * @param {Array} props.dirtyEntityRecords Array of dirty entity records.\n * @param {boolean} props.isDirty Flag indicating if there are dirty entities.\n * @param {Function} props.setUnselectedEntities Function to set unselected entities.\n * @param {Array} props.unselectedEntities Array of unselected entities.\n *\n * @return {JSX.Element} The rendered component.\n */\nexport function EntitiesSavedStatesExtensible( {\n\tadditionalPrompt = undefined,\n\tclose,\n\tonSave = identity,\n\tsaveEnabled: saveEnabledProp = undefined,\n\tsaveLabel = __( 'Save' ),\n\trenderDialog = undefined,\n\tdirtyEntityRecords,\n\tisDirty,\n\tsetUnselectedEntities,\n\tunselectedEntities,\n} ) {\n\tconst saveButtonRef = useRef();\n\tconst { saveDirtyEntities } = unlock( useDispatch( editorStore ) );\n\t// To group entities by type.\n\tconst partitionedSavables = dirtyEntityRecords.reduce( ( acc, record ) => {\n\t\tconst { name } = record;\n\t\tif ( ! acc[ name ] ) {\n\t\t\tacc[ name ] = [];\n\t\t}\n\t\tacc[ name ].push( record );\n\t\treturn acc;\n\t}, {} );\n\n\t// Sort entity groups.\n\tconst {\n\t\tsite: siteSavables,\n\t\twp_template: templateSavables,\n\t\twp_template_part: templatePartSavables,\n\t\t...contentSavables\n\t} = partitionedSavables;\n\tconst sortedPartitionedSavables = [\n\t\tsiteSavables,\n\t\ttemplateSavables,\n\t\ttemplatePartSavables,\n\t\t...Object.values( contentSavables ),\n\t].filter( Array.isArray );\n\n\tconst saveEnabled = saveEnabledProp ?? isDirty;\n\t// Explicitly define this with no argument passed. Using `close` on\n\t// its own will use the event object in place of the expected saved entities.\n\tconst dismissPanel = useCallback( () => close(), [ close ] );\n\n\tconst [ saveDialogRef, saveDialogProps ] = useDialog( {\n\t\tonClose: () => dismissPanel(),\n\t} );\n\tconst dialogLabel = useInstanceId( EntitiesSavedStatesExtensible, 'label' );\n\tconst dialogDescription = useInstanceId(\n\t\tEntitiesSavedStatesExtensible,\n\t\t'description'\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ saveDialogRef }\n\t\t\t{ ...saveDialogProps }\n\t\t\tclassName=\"entities-saved-states__panel\"\n\t\t\trole={ renderDialog ? 'dialog' : undefined }\n\t\t\taria-labelledby={ renderDialog ? dialogLabel : undefined }\n\t\t\taria-describedby={ renderDialog ? dialogDescription : undefined }\n\t\t>\n\t\t\t<Flex className=\"entities-saved-states__panel-header\" gap={ 2 }>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tonClick={ dismissPanel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tref={ saveButtonRef }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tdisabled={ ! saveEnabled }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsaveDirtyEntities( {\n\t\t\t\t\t\t\tonSave,\n\t\t\t\t\t\t\tdirtyEntityRecords,\n\t\t\t\t\t\t\tentitiesToSkip: unselectedEntities,\n\t\t\t\t\t\t\tclose,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tclassName=\"editor-entities-saved-states__save-button\"\n\t\t\t\t>\n\t\t\t\t\t{ saveLabel }\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\n\t\t\t<div className=\"entities-saved-states__text-prompt\">\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"entities-saved-states__text-prompt--header-wrapper\"\n\t\t\t\t\tid={ renderDialog ? dialogLabel : undefined }\n\t\t\t\t>\n\t\t\t\t\t<strong className=\"entities-saved-states__text-prompt--header\">\n\t\t\t\t\t\t{ __( 'Are you ready to save?' ) }\n\t\t\t\t\t</strong>\n\t\t\t\t\t{ additionalPrompt }\n\t\t\t\t</div>\n\t\t\t\t<p id={ renderDialog ? dialogDescription : undefined }>\n\t\t\t\t\t{ isDirty\n\t\t\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %d: number of site changes waiting to be saved. */\n\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t'There is <strong>%d site change</strong> waiting to be saved.',\n\t\t\t\t\t\t\t\t\t\t'There are <strong>%d site changes</strong> waiting to be saved.',\n\t\t\t\t\t\t\t\t\t\tsortedPartitionedSavables.length\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tsortedPartitionedSavables.length\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{ strong: <strong /> }\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( 'Select the items you want to save.' ) }\n\t\t\t\t</p>\n\t\t\t</div>\n\n\t\t\t{ sortedPartitionedSavables.map( ( list ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityTypeList\n\t\t\t\t\t\tkey={ list[ 0 ].name }\n\t\t\t\t\t\tlist={ list }\n\t\t\t\t\t\tunselectedEntities={ unselectedEntities }\n\t\t\t\t\t\tsetUnselectedEntities={ setUnselectedEntities }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,eAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAA2C,IAAAU,WAAA,GAAAV,OAAA;AAtB3C;AACA;AACA;;AAcA;AACA;AACA;;AAMA,SAASW,QAAQA,CAAEC,MAAM,EAAG;EAC3B,OAAOA,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,mBAAmBA,CAAE;EAC5CC,KAAK;EACLC,YAAY,GAAGC;AAChB,CAAC,EAAG;EACH,MAAMC,YAAY,GAAG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AAE,EAAE,oCAAqC;MAAC,CAC3C,CAAC;IAAA,CACA,CAAC,EAEJwB,yBAAyB,CAACqC,GAAG,CAAIC,IAAI,IAAM;MAC5C,oBACC,IAAA9E,WAAA,CAAAS,GAAA,EAACd,eAAA,CAAAoF,OAAc;QAEdD,IAAI,EAAGA,IAAM;QACb1D,kBAAkB,EAAGA,kBAAoB;QACzCD,qBAAqB,EAAGA;MAAuB,GAHzC2D,IAAI,CAAE,CAAC,CAAE,CAAC/C,IAIhB,CAAC;IAEJ,CAAE,CAAC;EAAA,CACC,CAAC;AAER","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_element","_compose","_data","_entityTypeList","_interopRequireDefault","_useIsDirty","_store","_lockUnlock","_jsxRuntime","identity","values","EntitiesSavedStates","close","renderDialog","undefined","isDirtyProps","useIsDirty","jsx","EntitiesSavedStatesExtensible","additionalPrompt","onSave","saveEnabled","saveEnabledProp","saveLabel","__","dirtyEntityRecords","isDirty","setUnselectedEntities","unselectedEntities","saveButtonRef","useRef","saveDirtyEntities","unlock","useDispatch","editorStore","partitionedSavables","reduce","acc","record","name","push","site","siteSavables","wp_template","templateSavables","wp_template_part","templatePartSavables","contentSavables","sortedPartitionedSavables","Object","filter","Array","isArray","dismissPanel","useCallback","saveDialogRef","saveDialogProps","useDialog","onClose","dialogLabel","useInstanceId","dialogDescription","jsxs","ref","className","role","children","Flex","gap","FlexItem","isBlock","as","Button","variant","size","onClick","disabled","accessibleWhenDisabled","entitiesToSkip","id","createInterpolateElement","sprintf","_n","length","strong","map","list","default"],"sources":["@wordpress/editor/src/components/entities-saved-states/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Flex, FlexItem } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tuseCallback,\n\tuseRef,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport {\n\t__experimentalUseDialog as useDialog,\n\tuseInstanceId,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport EntityTypeList from './entity-type-list';\nimport { useIsDirty } from './hooks/use-is-dirty';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction identity( values ) {\n\treturn values;\n}\n\n/**\n * Renders the component for managing saved states of entities.\n *\n * @param {Object} props The component props.\n * @param {Function} props.close The function to close the dialog.\n * @param {Function} props.renderDialog The function to render the dialog.\n *\n * @return {JSX.Element} The rendered component.\n */\nexport default function EntitiesSavedStates( {\n\tclose,\n\trenderDialog = undefined,\n} ) {\n\tconst isDirtyProps = useIsDirty();\n\treturn (\n\t\t<EntitiesSavedStatesExtensible\n\t\t\tclose={ close }\n\t\t\trenderDialog={ renderDialog }\n\t\t\t{ ...isDirtyProps }\n\t\t/>\n\t);\n}\n\n/**\n * Renders a panel for saving entities with dirty records.\n *\n * @param {Object} props The component props.\n * @param {string} props.additionalPrompt Additional prompt to display.\n * @param {Function} props.close Function to close the panel.\n * @param {Function} props.onSave Function to call when saving entities.\n * @param {boolean} props.saveEnabled Flag indicating if save is enabled.\n * @param {string} props.saveLabel Label for the save button.\n * @param {Function} props.renderDialog Function to render a custom dialog.\n * @param {Array} props.dirtyEntityRecords Array of dirty entity records.\n * @param {boolean} props.isDirty Flag indicating if there are dirty entities.\n * @param {Function} props.setUnselectedEntities Function to set unselected entities.\n * @param {Array} props.unselectedEntities Array of unselected entities.\n *\n * @return {JSX.Element} The rendered component.\n */\nexport function EntitiesSavedStatesExtensible( {\n\tadditionalPrompt = undefined,\n\tclose,\n\tonSave = identity,\n\tsaveEnabled: saveEnabledProp = undefined,\n\tsaveLabel = __( 'Save' ),\n\trenderDialog = undefined,\n\tdirtyEntityRecords,\n\tisDirty,\n\tsetUnselectedEntities,\n\tunselectedEntities,\n} ) {\n\tconst saveButtonRef = useRef();\n\tconst { saveDirtyEntities } = unlock( useDispatch( editorStore ) );\n\t// To group entities by type.\n\tconst partitionedSavables = dirtyEntityRecords.reduce( ( acc, record ) => {\n\t\tconst { name } = record;\n\t\tif ( ! acc[ name ] ) {\n\t\t\tacc[ name ] = [];\n\t\t}\n\t\tacc[ name ].push( record );\n\t\treturn acc;\n\t}, {} );\n\n\t// Sort entity groups.\n\tconst {\n\t\tsite: siteSavables,\n\t\twp_template: templateSavables,\n\t\twp_template_part: templatePartSavables,\n\t\t...contentSavables\n\t} = partitionedSavables;\n\tconst sortedPartitionedSavables = [\n\t\tsiteSavables,\n\t\ttemplateSavables,\n\t\ttemplatePartSavables,\n\t\t...Object.values( contentSavables ),\n\t].filter( Array.isArray );\n\n\tconst saveEnabled = saveEnabledProp ?? isDirty;\n\t// Explicitly define this with no argument passed. Using `close` on\n\t// its own will use the event object in place of the expected saved entities.\n\tconst dismissPanel = useCallback( () => close(), [ close ] );\n\n\tconst [ saveDialogRef, saveDialogProps ] = useDialog( {\n\t\tonClose: () => dismissPanel(),\n\t} );\n\tconst dialogLabel = useInstanceId( EntitiesSavedStatesExtensible, 'label' );\n\tconst dialogDescription = useInstanceId(\n\t\tEntitiesSavedStatesExtensible,\n\t\t'description'\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ saveDialogRef }\n\t\t\t{ ...saveDialogProps }\n\t\t\tclassName=\"entities-saved-states__panel\"\n\t\t\trole={ renderDialog ? 'dialog' : undefined }\n\t\t\taria-labelledby={ renderDialog ? dialogLabel : undefined }\n\t\t\taria-describedby={ renderDialog ? dialogDescription : undefined }\n\t\t>\n\t\t\t<Flex className=\"entities-saved-states__panel-header\" gap={ 2 }>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tonClick={ dismissPanel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tref={ saveButtonRef }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tdisabled={ ! saveEnabled }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsaveDirtyEntities( {\n\t\t\t\t\t\t\tonSave,\n\t\t\t\t\t\t\tdirtyEntityRecords,\n\t\t\t\t\t\t\tentitiesToSkip: unselectedEntities,\n\t\t\t\t\t\t\tclose,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tclassName=\"editor-entities-saved-states__save-button\"\n\t\t\t\t>\n\t\t\t\t\t{ saveLabel }\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\n\t\t\t<div className=\"entities-saved-states__text-prompt\">\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"entities-saved-states__text-prompt--header-wrapper\"\n\t\t\t\t\tid={ renderDialog ? dialogLabel : undefined }\n\t\t\t\t>\n\t\t\t\t\t<strong className=\"entities-saved-states__text-prompt--header\">\n\t\t\t\t\t\t{ __( 'Are you ready to save?' ) }\n\t\t\t\t\t</strong>\n\t\t\t\t\t{ additionalPrompt }\n\t\t\t\t</div>\n\t\t\t\t<p id={ renderDialog ? dialogDescription : undefined }>\n\t\t\t\t\t{ isDirty\n\t\t\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %d: number of site changes waiting to be saved. */\n\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t'There is <strong>%d site change</strong> waiting to be saved.',\n\t\t\t\t\t\t\t\t\t\t'There are <strong>%d site changes</strong> waiting to be saved.',\n\t\t\t\t\t\t\t\t\t\tdirtyEntityRecords.length\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tdirtyEntityRecords.length\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{ strong: <strong /> }\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( 'Select the items you want to save.' ) }\n\t\t\t\t</p>\n\t\t\t</div>\n\n\t\t\t{ sortedPartitionedSavables.map( ( list ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityTypeList\n\t\t\t\t\t\tkey={ list[ 0 ].name }\n\t\t\t\t\t\tlist={ list }\n\t\t\t\t\t\tunselectedEntities={ unselectedEntities }\n\t\t\t\t\t\tsetUnselectedEntities={ setUnselectedEntities }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,eAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAA2C,IAAAU,WAAA,GAAAV,OAAA;AAtB3C;AACA;AACA;;AAcA;AACA;AACA;;AAMA,SAASW,QAAQA,CAAEC,MAAM,EAAG;EAC3B,OAAOA,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,mBAAmBA,CAAE;EAC5CC,KAAK;EACLC,YAAY,GAAGC;AAChB,CAAC,EAAG;EACH,MAAMC,YAAY,GAAG,IAAAC,sBAAU,EAAC,CAAC;EACjC,oBACC,IAAAR,WAAA,CAAAS,GAAA,EAACC,6BAA6B;IAC7BN,KAAK,EAAGA,KAAO;IACfC,YAAY,EAAGA,YAAc;IAAA,GACxBE;EAAY,CACjB,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,6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D,IAAI,CAAE,CAAC,CAAE,CAAC/C,IAIhB,CAAC;IAEJ,CAAE,CAAC;EAAA,CACC,CAAC;AAER","ignoreList":[]}
|
|
@@ -72,7 +72,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
72
72
|
registerShortcut({
|
|
73
73
|
name: 'core/editor/toggle-list-view',
|
|
74
74
|
category: 'global',
|
|
75
|
-
description: (0, _i18n.__)('
|
|
75
|
+
description: (0, _i18n.__)('Show or hide the List View.'),
|
|
76
76
|
keyCombination: {
|
|
77
77
|
modifier: 'access',
|
|
78
78
|
character: 'o'
|
|
@@ -81,7 +81,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
81
81
|
registerShortcut({
|
|
82
82
|
name: 'core/editor/toggle-distraction-free',
|
|
83
83
|
category: 'global',
|
|
84
|
-
description: (0, _i18n.__)('
|
|
84
|
+
description: (0, _i18n.__)('Enter or exit distraction free mode.'),
|
|
85
85
|
keyCombination: {
|
|
86
86
|
modifier: 'primaryShift',
|
|
87
87
|
character: '\\'
|
|
@@ -90,7 +90,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
90
90
|
registerShortcut({
|
|
91
91
|
name: 'core/editor/toggle-sidebar',
|
|
92
92
|
category: 'global',
|
|
93
|
-
description: (0, _i18n.__)('Show or hide the Settings
|
|
93
|
+
description: (0, _i18n.__)('Show or hide the Settings panel.'),
|
|
94
94
|
keyCombination: {
|
|
95
95
|
modifier: 'primaryShift',
|
|
96
96
|
character: ','
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_i18n","_blockEditor","_keyboardShortcuts","_keycodes","_jsxRuntime","EditorKeyboardShortcutsRegister","registerShortcut","useDispatch","keyboardShortcutsStore","useEffect","name","category","description","__","keyCombination","modifier","character","aliases","isAppleOS","jsx","BlockEditorKeyboardShortcuts","Register","_default","exports","default"],"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: __( '
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_i18n","_blockEditor","_keyboardShortcuts","_keycodes","_jsxRuntime","EditorKeyboardShortcutsRegister","registerShortcut","useDispatch","keyboardShortcutsStore","useEffect","name","category","description","__","keyCombination","modifier","character","aliases","isAppleOS","jsx","BlockEditorKeyboardShortcuts","Register","_default","exports","default"],"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: __( 'Show or hide 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: __( 'Enter or exit 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 panel.' ),\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":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,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ACjBI,IAAI,EAAE,6BAA6B;MACnCC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAE,IAAAC,QAAE,EAAE,8CAA+C,CAAC;MACjEC,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,CAAEV,gBAAgB,CAAG,CAAC;EAEzB,oBAAO,IAAAF,WAAA,CAAAe,GAAA,EAAClB,YAAA,CAAAmB,4BAA4B,CAACC,QAAQ,IAAE,CAAC;AACjD;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcnB,+BAA+B","ignoreList":[]}
|
|
@@ -68,12 +68,34 @@ function useGlobalStylesUserConfig() {
|
|
|
68
68
|
} = select(_coreData.store);
|
|
69
69
|
const _globalStylesId = select(_coreData.store).__experimentalGetCurrentGlobalStylesId();
|
|
70
70
|
let record;
|
|
71
|
-
|
|
71
|
+
|
|
72
|
+
/*
|
|
73
|
+
* Ensure that the global styles ID request is complete by testing `_globalStylesId`,
|
|
74
|
+
* before firing off the `canUser` OPTIONS request for user capabilities, otherwise it will
|
|
75
|
+
* fetch `/wp/v2/global-styles` instead of `/wp/v2/global-styles/{id}`.
|
|
76
|
+
* NOTE: Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`,
|
|
77
|
+
* or set using the `block_editor_rest_api_preload_paths` filter, if this changes.
|
|
78
|
+
*/
|
|
79
|
+
const userCanEditGlobalStyles = _globalStylesId ? canUser('update', {
|
|
72
80
|
kind: 'root',
|
|
73
81
|
name: 'globalStyles',
|
|
74
82
|
id: _globalStylesId
|
|
75
|
-
});
|
|
76
|
-
if (_globalStylesId
|
|
83
|
+
}) : null;
|
|
84
|
+
if (_globalStylesId &&
|
|
85
|
+
/*
|
|
86
|
+
* Test that the OPTIONS request for user capabilities is complete
|
|
87
|
+
* before fetching the global styles entity record.
|
|
88
|
+
* This is to avoid fetching the global styles entity unnecessarily.
|
|
89
|
+
*/
|
|
90
|
+
typeof userCanEditGlobalStyles === 'boolean') {
|
|
91
|
+
/*
|
|
92
|
+
* Fetch the global styles entity record based on the user's capabilities.
|
|
93
|
+
* The default context is `edit` for users who can edit global styles.
|
|
94
|
+
* Otherwise, the context is `view`.
|
|
95
|
+
* NOTE: There is an equivalent conditional check using `current_user_can()` in the backend
|
|
96
|
+
* to preload the global styles entity. Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`,
|
|
97
|
+
* or set using `block_editor_rest_api_preload_paths` filter, if this changes.
|
|
98
|
+
*/
|
|
77
99
|
if (userCanEditGlobalStyles) {
|
|
78
100
|
record = getEditedEntityRecord('root', 'globalStyles', _globalStylesId);
|
|
79
101
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_deepmerge","_interopRequireDefault","require","_isPlainObject","_blockEditor","_coreData","_data","_element","_lockUnlock","_jsxRuntime","GlobalStylesContext","cleanEmptyObject","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","base","user","deepmerge","isMergeableObject","isPlainObject","customMerge","key","baseConfig","userConfig","undefined","useGlobalStylesUserConfig","globalStylesId","isReady","settings","styles","_links","useSelect","select","getEntityRecord","getEditedEntityRecord","hasFinishedResolution","canUser","coreStore","_globalStylesId","__experimentalGetCurrentGlobalStylesId","record","userCanEditGlobalStyles","kind","name","id","context","hasResolved","editEntityRecord","useDispatch","config","useMemo","setConfig","useCallback","callbackOrObject","options","_record$styles","_record$settings","_record$_links","currentConfig","updatedConfig","useGlobalStylesBaseConfig","__experimentalGetCurrentThemeBaseGlobalStyles","useGlobalStylesContext","isUserConfigReady","setUserConfig","isBaseConfigReady","mergedConfig","merged","GlobalStylesProvider","children","jsx","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/*\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\t */\n\t\tisMergeableObject: isPlainObject,\n\t\t/*\n\t\t * Exceptions to the above rule.\n\t\t * Background images should be replaced, not merged,\n\t\t * as they themselves are specific object definitions for the style.\n\t\t */\n\t\tcustomMerge: ( key ) => {\n\t\t\tif ( key === 'backgroundImage' ) {\n\t\t\t\treturn ( baseConfig, userConfig ) => userConfig;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t} );\n}\n\nfunction useGlobalStylesUserConfig() {\n\tconst { globalStylesId, isReady, settings, styles, _links } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\thasFinishedResolution,\n\t\t\t\tcanUser,\n\t\t\t} = select( coreStore );\n\t\t\tconst _globalStylesId =\n\t\t\t\tselect( coreStore ).__experimentalGetCurrentGlobalStylesId();\n\n\t\t\tlet record;\n\t\t\tconst userCanEditGlobalStyles = canUser( 'update', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'globalStyles',\n\t\t\t\tid: _globalStylesId,\n\t\t\t} );\n\n\t\t\tif ( _globalStylesId ) {\n\t\t\t\tif ( userCanEditGlobalStyles ) {\n\t\t\t\t\trecord = 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\t);\n\t\t\t\t} else {\n\t\t\t\t\trecord = getEntityRecord(\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\t\t{ context: 'view' }\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\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\tif ( _globalStylesId ) {\n\t\t\t\t\thasResolved = userCanEditGlobalStyles\n\t\t\t\t\t\t? hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t\t ] )\n\t\t\t\t\t\t: hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t\t\t\t{ context: 'view' },\n\t\t\t\t\t\t ] );\n\t\t\t\t} else {\n\t\t\t\t\thasResolved = true;\n\t\t\t\t}\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\t_links: record?._links,\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\t_links: _links ?? {},\n\t\t};\n\t}, [ settings, styles, _links ] );\n\n\tconst setConfig = useCallback(\n\t\t/**\n\t\t * Set the global styles config.\n\t\t * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.\n\t\t * Otherwise, overwrite the current config with the incoming object.\n\t\t * @param {Object} options Options for editEntityRecord Core selector.\n\t\t */\n\t\t( callbackOrObject, 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\n\t\t\tconst currentConfig = {\n\t\t\t\tstyles: record?.styles ?? {},\n\t\t\t\tsettings: record?.settings ?? {},\n\t\t\t\t_links: record?._links ?? {},\n\t\t\t};\n\n\t\t\tconst updatedConfig =\n\t\t\t\ttypeof callbackOrObject === 'function'\n\t\t\t\t\t? callbackOrObject( currentConfig )\n\t\t\t\t\t: callbackOrObject;\n\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\t_links: cleanEmptyObject( updatedConfig._links ) || {},\n\t\t\t\t},\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\t\t[ globalStylesId, editEntityRecord, getEditedEntityRecord ]\n\t);\n\n\treturn [ isReady, config, setConfig ];\n}\n\nfunction useGlobalStylesBaseConfig() {\n\tconst baseConfig = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).__experimentalGetCurrentThemeBaseGlobalStyles(),\n\t\t[]\n\t);\n\treturn [ !! baseConfig, baseConfig ];\n}\n\nexport function useGlobalStylesContext() {\n\tconst [ isUserConfigReady, userConfig, setUserConfig ] =\n\t\tuseGlobalStylesUserConfig();\n\tconst [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! baseConfig || ! userConfig ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t}, [ userConfig, baseConfig ] );\n\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":";;;;;;;;;AAGA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AAA2C,IAAAO,WAAA,GAAAP,OAAA;AAjB3C;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;;AAGA,MAAM;EAAEQ,mBAAmB;EAAEC;AAAiB,CAAC,GAAG,IAAAC,kBAAM,EACvDC,wBACD,CAAC;AAEM,SAASC,uBAAuBA,CAAEC,IAAI,EAAEC,IAAI,EAAG;EACrD,OAAO,IAAAC,kBAAS,EAAEF,IAAI,EAAEC,IAAI,EAAE;IAC7B;AACF;AACA;AACA;AACA;IACEE,iBAAiB,EAAEC,4BAAa;IAChC;AACF;AACA;AACA;AACA;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E5B,UAAU,IAAI,CAAEC,UAAU,EAAG;MACnC,OAAO,CAAC,CAAC;IACV;IAEA,OAAOT,uBAAuB,CAAEQ,UAAU,EAAEC,UAAW,CAAC;EACzD,CAAC,EAAE,CAAEA,UAAU,EAAED,UAAU,CAAG,CAAC;EAE/B,MAAMuB,OAAO,GAAG,IAAAK,gBAAO,EAAE,MAAM;IAC9B,OAAO;MACNvB,OAAO,EAAEoC,iBAAiB,IAAIE,iBAAiB;MAC/CjD,IAAI,EAAEO,UAAU;MAChBR,IAAI,EAAEO,UAAU;MAChB6C,MAAM,EAAED,YAAY;MACpBF;IACD,CAAC;EACF,CAAC,EAAE,CACFE,YAAY,EACZ3C,UAAU,EACVD,UAAU,EACV0C,aAAa,EACbD,iBAAiB,EACjBE,iBAAiB,CAChB,CAAC;EAEH,OAAOpB,OAAO;AACf;AAEO,SAASuB,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACpD,MAAMxB,OAAO,GAAGiB,sBAAsB,CAAC,CAAC;EACxC,IAAK,CAAEjB,OAAO,CAAClB,OAAO,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,oBACC,IAAAlB,WAAA,CAAA6D,GAAA,EAAC5D,mBAAmB,CAAC6D,QAAQ;IAACC,KAAK,EAAG3B,OAAS;IAAAwB,QAAA,EAC5CA;EAAQ,CACmB,CAAC;AAEjC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_deepmerge","_interopRequireDefault","require","_isPlainObject","_blockEditor","_coreData","_data","_element","_lockUnlock","_jsxRuntime","GlobalStylesContext","cleanEmptyObject","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","base","user","deepmerge","isMergeableObject","isPlainObject","customMerge","key","baseConfig","userConfig","undefined","useGlobalStylesUserConfig","globalStylesId","isReady","settings","styles","_links","useSelect","select","getEntityRecord","getEditedEntityRecord","hasFinishedResolution","canUser","coreStore","_globalStylesId","__experimentalGetCurrentGlobalStylesId","record","userCanEditGlobalStyles","kind","name","id","context","hasResolved","editEntityRecord","useDispatch","config","useMemo","setConfig","useCallback","callbackOrObject","options","_record$styles","_record$settings","_record$_links","currentConfig","updatedConfig","useGlobalStylesBaseConfig","__experimentalGetCurrentThemeBaseGlobalStyles","useGlobalStylesContext","isUserConfigReady","setUserConfig","isBaseConfigReady","mergedConfig","merged","GlobalStylesProvider","children","jsx","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/*\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\t */\n\t\tisMergeableObject: isPlainObject,\n\t\t/*\n\t\t * Exceptions to the above rule.\n\t\t * Background images should be replaced, not merged,\n\t\t * as they themselves are specific object definitions for the style.\n\t\t */\n\t\tcustomMerge: ( key ) => {\n\t\t\tif ( key === 'backgroundImage' ) {\n\t\t\t\treturn ( baseConfig, userConfig ) => userConfig;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t} );\n}\n\nfunction useGlobalStylesUserConfig() {\n\tconst { globalStylesId, isReady, settings, styles, _links } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\thasFinishedResolution,\n\t\t\t\tcanUser,\n\t\t\t} = select( coreStore );\n\t\t\tconst _globalStylesId =\n\t\t\t\tselect( coreStore ).__experimentalGetCurrentGlobalStylesId();\n\n\t\t\tlet record;\n\n\t\t\t/*\n\t\t\t * Ensure that the global styles ID request is complete by testing `_globalStylesId`,\n\t\t\t * before firing off the `canUser` OPTIONS request for user capabilities, otherwise it will\n\t\t\t * fetch `/wp/v2/global-styles` instead of `/wp/v2/global-styles/{id}`.\n\t\t\t * NOTE: Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`,\n\t\t\t * or set using the `block_editor_rest_api_preload_paths` filter, if this changes.\n\t\t\t */\n\t\t\tconst userCanEditGlobalStyles = _globalStylesId\n\t\t\t\t? canUser( 'update', {\n\t\t\t\t\t\tkind: 'root',\n\t\t\t\t\t\tname: 'globalStyles',\n\t\t\t\t\t\tid: _globalStylesId,\n\t\t\t\t } )\n\t\t\t\t: null;\n\n\t\t\tif (\n\t\t\t\t_globalStylesId &&\n\t\t\t\t/*\n\t\t\t\t * Test that the OPTIONS request for user capabilities is complete\n\t\t\t\t * before fetching the global styles entity record.\n\t\t\t\t * This is to avoid fetching the global styles entity unnecessarily.\n\t\t\t\t */\n\t\t\t\ttypeof userCanEditGlobalStyles === 'boolean'\n\t\t\t) {\n\t\t\t\t/*\n\t\t\t\t * Fetch the global styles entity record based on the user's capabilities.\n\t\t\t\t * The default context is `edit` for users who can edit global styles.\n\t\t\t\t * Otherwise, the context is `view`.\n\t\t\t\t * NOTE: There is an equivalent conditional check using `current_user_can()` in the backend\n\t\t\t\t * to preload the global styles entity. Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`,\n\t\t\t\t * or set using `block_editor_rest_api_preload_paths` filter, if this changes.\n\t\t\t\t */\n\t\t\t\tif ( userCanEditGlobalStyles ) {\n\t\t\t\t\trecord = 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\t);\n\t\t\t\t} else {\n\t\t\t\t\trecord = getEntityRecord(\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\t\t{ context: 'view' }\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\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\tif ( _globalStylesId ) {\n\t\t\t\t\thasResolved = userCanEditGlobalStyles\n\t\t\t\t\t\t? hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t\t ] )\n\t\t\t\t\t\t: hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t\t\t\t{ context: 'view' },\n\t\t\t\t\t\t ] );\n\t\t\t\t} else {\n\t\t\t\t\thasResolved = true;\n\t\t\t\t}\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\t_links: record?._links,\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\t_links: _links ?? {},\n\t\t};\n\t}, [ settings, styles, _links ] );\n\n\tconst setConfig = useCallback(\n\t\t/**\n\t\t * Set the global styles config.\n\t\t * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.\n\t\t * Otherwise, overwrite the current config with the incoming object.\n\t\t * @param {Object} options Options for editEntityRecord Core selector.\n\t\t */\n\t\t( callbackOrObject, 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\n\t\t\tconst currentConfig = {\n\t\t\t\tstyles: record?.styles ?? {},\n\t\t\t\tsettings: record?.settings ?? {},\n\t\t\t\t_links: record?._links ?? {},\n\t\t\t};\n\n\t\t\tconst updatedConfig =\n\t\t\t\ttypeof callbackOrObject === 'function'\n\t\t\t\t\t? callbackOrObject( currentConfig )\n\t\t\t\t\t: callbackOrObject;\n\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\t_links: cleanEmptyObject( updatedConfig._links ) || {},\n\t\t\t\t},\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\t\t[ globalStylesId, editEntityRecord, getEditedEntityRecord ]\n\t);\n\n\treturn [ isReady, config, setConfig ];\n}\n\nfunction useGlobalStylesBaseConfig() {\n\tconst baseConfig = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).__experimentalGetCurrentThemeBaseGlobalStyles(),\n\t\t[]\n\t);\n\treturn [ !! baseConfig, baseConfig ];\n}\n\nexport function useGlobalStylesContext() {\n\tconst [ isUserConfigReady, userConfig, setUserConfig ] =\n\t\tuseGlobalStylesUserConfig();\n\tconst [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! baseConfig || ! userConfig ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t}, [ userConfig, baseConfig ] );\n\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":";;;;;;;;;AAGA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AAA2C,IAAAO,WAAA,GAAAP,OAAA;AAjB3C;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;;AAGA,MAAM;EAAEQ,mBAAmB;EAAEC;AAAiB,CAAC,GAAG,IAAAC,kBAAM,EACvDC,wBACD,CAAC;AAEM,SAASC,uBAAuBA,CAAEC,IAAI,EAAEC,IAAI,EAAG;EACrD,OAAO,IAAAC,kBAAS,EAAEF,IAAI,EAAEC,IAAI,EAAE;IAC7B;AACF;AACA;AACA;AACA;IACEE,iBAAiB,EAAEC,4BAAa;IAChC;AACF;AACA;AACA;AACA;IACEC,WAAW,EAAIC,GAAG,IAAM;MACvB,IAAKA,GAAG,KAAK,iBAAiB,EAAG;QAChC,OAAO,CAAEC,UAAU,EAAEC,UAAU,KAAMA,UAAU;MAChD;MACA,OAAOC,SAAS;IACjB;EACD,CAAE,CAAC;AACJ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