@wordpress/edit-site 5.14.0 → 5.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/add-new-page/index.js +1 -6
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +21 -7
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/utils.js +10 -8
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/block-editor/constants.js +1 -1
- package/build/components/block-editor/constants.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +1 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +0 -4
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +87 -13
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/code-editor/index.js +60 -28
- package/build/components/code-editor/index.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +7 -3
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/editor/index.js +1 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +13 -9
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/layout/index.js +8 -3
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-actions/index.js +2 -2
- package/build/components/page-actions/index.js.map +1 -1
- package/build/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -16
- package/build/components/page-actions/trash-page-menu-item.js.map +1 -0
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/page-patterns/duplicate-menu-item.js +163 -0
- package/build/components/page-patterns/duplicate-menu-item.js.map +1 -0
- package/build/components/page-patterns/grid-item.js +83 -58
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/grid.js +5 -18
- package/build/components/page-patterns/grid.js.map +1 -1
- package/build/components/page-patterns/header.js +69 -0
- package/build/components/page-patterns/header.js.map +1 -0
- package/build/components/page-patterns/index.js +3 -1
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/pagination.js +63 -0
- package/build/components/page-patterns/pagination.js.map +1 -0
- package/build/components/page-patterns/patterns-list.js +95 -30
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/rename-menu-item.js +109 -0
- package/build/components/page-patterns/rename-menu-item.js.map +1 -0
- package/build/components/page-patterns/use-patterns.js +102 -121
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-template-parts/add-new-template-part.js +74 -0
- package/build/components/page-template-parts/add-new-template-part.js.map +1 -0
- package/build/components/page-template-parts/index.js +2 -23
- package/build/components/page-template-parts/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +78 -36
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/save-panel/index.js +5 -5
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +14 -8
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +4 -2
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +4 -4
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +4 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +2 -3
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +1 -34
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +33 -25
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +9 -7
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -3
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +5 -2
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +72 -51
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +11 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +20 -9
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build/components/site-hub/index.js +24 -11
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -5
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +15 -12
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +3 -1
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/template-actions/rename-menu-item.js +12 -8
- package/build/components/template-actions/rename-menu-item.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +6 -1
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +78 -20
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +56 -10
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/store/private-actions.js +7 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/utils/normalize-record-key.js +19 -0
- package/build/utils/normalize-record-key.js.map +1 -0
- package/build/utils/use-activate-theme.js +1 -1
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build-module/components/add-new-page/index.js +1 -6
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +19 -7
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +9 -6
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/block-editor/constants.js +1 -1
- package/build-module/components/block-editor/constants.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +1 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +0 -4
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +89 -14
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/code-editor/index.js +62 -30
- package/build-module/components/code-editor/index.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +6 -3
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +1 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +13 -9
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/layout/index.js +8 -3
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-actions/index.js +2 -2
- package/build-module/components/page-actions/index.js.map +1 -1
- package/build-module/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -17
- package/build-module/components/page-actions/trash-page-menu-item.js.map +1 -0
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -3
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/page-patterns/duplicate-menu-item.js +147 -0
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/grid-item.js +84 -64
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/grid.js +5 -17
- package/build-module/components/page-patterns/grid.js.map +1 -1
- package/build-module/components/page-patterns/header.js +54 -0
- package/build-module/components/page-patterns/header.js.map +1 -0
- package/build-module/components/page-patterns/index.js +3 -1
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/pagination.js +54 -0
- package/build-module/components/page-patterns/pagination.js.map +1 -0
- package/build-module/components/page-patterns/patterns-list.js +96 -33
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/rename-menu-item.js +97 -0
- package/build-module/components/page-patterns/rename-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/use-patterns.js +103 -122
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-template-parts/add-new-template-part.js +58 -0
- package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -0
- package/build-module/components/page-template-parts/index.js +3 -22
- package/build-module/components/page-template-parts/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +79 -39
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +5 -5
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +15 -9
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +4 -3
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +4 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +4 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +2 -3
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +1 -32
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +33 -25
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +8 -7
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -3
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +4 -2
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +76 -53
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +18 -9
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build-module/components/site-hub/index.js +24 -11
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +7 -5
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +16 -12
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +2 -1
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/template-actions/rename-menu-item.js +11 -8
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +3 -1
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +74 -20
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +57 -10
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/store/private-actions.js +7 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/utils/normalize-record-key.js +12 -0
- package/build-module/utils/normalize-record-key.js.map +1 -0
- package/build-module/utils/use-activate-theme.js +1 -1
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-style/style-rtl.css +221 -63
- package/build-style/style.css +221 -63
- package/package.json +39 -40
- package/src/components/add-new-page/index.js +0 -3
- package/src/components/add-new-pattern/index.js +23 -12
- package/src/components/add-new-template/utils.js +9 -6
- package/src/components/block-editor/constants.js +5 -1
- package/src/components/block-editor/editor-canvas.js +1 -1
- package/src/components/block-editor/index.js +0 -4
- package/src/components/block-editor/use-site-editor-settings.js +99 -20
- package/src/components/canvas-spinner/style.scss +14 -0
- package/src/components/code-editor/index.js +51 -33
- package/src/components/create-pattern-modal/index.js +5 -2
- package/src/components/editor/index.js +2 -2
- package/src/components/header-edit-mode/document-actions/style.scss +4 -0
- package/src/components/header-edit-mode/index.js +29 -22
- package/src/components/layout/index.js +16 -2
- package/src/components/layout/style.scss +2 -1
- package/src/components/page-actions/index.js +2 -2
- package/src/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +9 -22
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
- package/src/components/page-patterns/duplicate-menu-item.js +196 -0
- package/src/components/page-patterns/grid-item.js +189 -133
- package/src/components/page-patterns/grid.js +3 -20
- package/src/components/page-patterns/header.js +69 -0
- package/src/components/page-patterns/index.js +6 -1
- package/src/components/page-patterns/pagination.js +80 -0
- package/src/components/page-patterns/patterns-list.js +160 -72
- package/src/components/page-patterns/rename-menu-item.js +115 -0
- package/src/components/page-patterns/style.scss +140 -30
- package/src/components/page-patterns/use-patterns.js +102 -172
- package/src/components/page-template-parts/add-new-template-part.js +57 -0
- package/src/components/page-template-parts/index.js +3 -22
- package/src/components/resizable-frame/index.js +102 -34
- package/src/components/resizable-frame/style.scss +9 -9
- package/src/components/save-panel/index.js +10 -4
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +2 -5
- package/src/components/sidebar-navigation-item/style.scss +5 -12
- package/src/components/sidebar-navigation-screen/index.js +14 -7
- package/src/components/sidebar-navigation-screen/style.scss +14 -0
- package/src/components/sidebar-navigation-screen-main/index.js +44 -40
- package/src/components/sidebar-navigation-screen-main/template-part-hint.js +34 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +4 -3
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +15 -5
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/src/components/sidebar-navigation-screen-page/index.js +3 -3
- package/src/components/sidebar-navigation-screen-page/status-label.js +1 -35
- package/src/components/sidebar-navigation-screen-pages/index.js +39 -29
- package/src/components/sidebar-navigation-screen-pattern/index.js +5 -2
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -1
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +2 -1
- package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +12 -2
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +5 -2
- package/src/components/sidebar-navigation-screen-patterns/index.js +103 -98
- package/src/components/sidebar-navigation-screen-patterns/style.scss +20 -0
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +7 -6
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +9 -0
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +31 -9
- package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -1
- package/src/components/site-hub/index.js +45 -28
- package/src/components/site-hub/style.scss +13 -0
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +73 -66
- package/src/components/template-actions/index.js +2 -1
- package/src/components/template-actions/rename-menu-item.js +17 -10
- package/src/components/use-edited-entity-record/index.js +6 -1
- package/src/hooks/commands/use-common-commands.js +56 -23
- package/src/hooks/push-changes-to-global-styles/index.js +63 -9
- package/src/store/private-actions.js +5 -1
- package/src/style.scss +10 -12
- package/src/utils/normalize-record-key.js +11 -0
- package/src/utils/use-activate-theme.js +1 -1
- package/build/components/code-editor/code-editor-text-area.js +0 -96
- package/build/components/code-editor/code-editor-text-area.js.map +0 -1
- package/build/components/keyboard-shortcuts/index.js +0 -148
- package/build/components/keyboard-shortcuts/index.js.map +0 -1
- package/build/components/page-actions/delete-page-menu-item.js.map +0 -1
- package/build/components/page-content-focus-manager/constants.js +0 -9
- package/build/components/page-content-focus-manager/constants.js.map +0 -1
- package/build-module/components/code-editor/code-editor-text-area.js +0 -84
- package/build-module/components/code-editor/code-editor-text-area.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/index.js +0 -132
- package/build-module/components/keyboard-shortcuts/index.js.map +0 -1
- package/build-module/components/page-actions/delete-page-menu-item.js.map +0 -1
- package/build-module/components/page-content-focus-manager/constants.js +0 -2
- package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
- package/src/components/code-editor/code-editor-text-area.js +0 -84
- package/src/components/keyboard-shortcuts/index.js +0 -137
- package/src/components/page-content-focus-manager/constants.js +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/use-site-editor-settings.js"],"names":["useSiteEditorSettings","templateType","storedSettings","canvasMode","select","getSettings","getCanvasMode","editSiteStore","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","coreStore","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","focusMode","restStoredSettings","inserterMediaCategories"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKe,SAASA,qBAAT,CAAgCC,YAAhC,EAA+C;AAAA;;AAC7D,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAiC,qBAAaC,MAAF,IAAc;AAC/D,UAAM;AAAEC,MAAAA,WAAF;AAAeC,MAAAA;AAAf,QAAiC,wBACtCF,MAAM,CAAEG,YAAF,CADgC,CAAvC;AAGA,WAAO;AACNL,MAAAA,cAAc,EAAEG,WAAW,EADrB;AAENF,MAAAA,UAAU,EAAEG,aAAa;AAFnB,KAAP;AAIA,GARsC,EAQpC,EARoC,CAAvC;AAUA,QAAME,qBAAqB,4BAC1BN,cAAc,CAACO,qCADW,yEAC8B;AACxDP,EAAAA,cAAc,CAACQ,2BAFhB,CAX6D,CAahB;;AAC7C,QAAMC,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EAAkCI,0BAAlC,CAT8B,CAA/B;AAWA,SAAO,sBAAS,MAAM;AACrB,UAAM;AACLN,MAAAA,qCADK;AAELG,MAAAA,8CAFK;AAGLoB,MAAAA,SAHK;AAIL,SAAGC;AAJE,QAKF/B,cALJ;AAOA,WAAO,EACN,GAAG+B,kBADG;AAENC,MAAAA,uBAAuB,EAAvBA,gCAFM;AAGNxB,MAAAA,2BAA2B,EAAES,aAHvB;AAINN,MAAAA,oCAAoC,EAAEkB,sBAJhC;AAKNC,MAAAA,SAAS,EAAE7B,UAAU,KAAK,MAAf,IAAyB6B,SAAzB,GAAqC,KAArC,GAA6CA;AALlD,KAAP;AAOA,GAfM,EAeJ,CAAE9B,cAAF,EAAkBiB,aAAlB,EAAiCY,sBAAjC,EAAyD5B,UAAzD,CAfI,CAAP;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport inserterMediaCategories from './inserter-media-categories';\n\nexport default function useSiteEditorSettings( templateType ) {\n\tconst { storedSettings, canvasMode } = useSelect( ( select ) => {\n\t\tconst { getSettings, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\treturn {\n\t\t\tstoredSettings: getSettings(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t};\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tstoredSettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( templateType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, templateType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\treturn useMemo( () => {\n\t\tconst {\n\t\t\t__experimentalAdditionalBlockPatterns,\n\t\t\t__experimentalAdditionalBlockPatternCategories,\n\t\t\tfocusMode,\n\t\t\t...restStoredSettings\n\t\t} = storedSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\tfocusMode: canvasMode === 'view' && focusMode ? false : focusMode,\n\t\t};\n\t}, [ storedSettings, blockPatterns, blockPatternCategories, canvasMode ] );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/use-site-editor-settings.js"],"names":["useArchiveLabel","templateSlug","taxonomyMatches","match","taxonomy","term","select","getEntityRecords","getTaxonomy","coreStore","archiveTypeLabel","archiveNameLabel","labels","singular_name","records","slug","per_page","name","useSiteEditorSettings","setIsInserterOpened","editSiteStore","storedSettings","canvasMode","templateType","getSettings","getCanvasMode","getEditedPostType","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getEditedPostId","getEditedEntityRecord","usedPostType","usedPostId","_record","getBlockPatterns","getBlockPatternCategories","archiveLabels","blockPatterns","filter","x","index","arr","findIndex","y","postTypes","Array","isArray","includes","blockPatternCategories","focusMode","restStoredSettings","inserterMediaCategories","__experimentalArchiveTitleTypeLabel","__experimentalArchiveTitleNameLabel"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKA,SAASA,eAAT,CAA0BC,YAA1B,EAAyC;AACxC,QAAMC,eAAe,GAAGD,YAAY,EAAEE,KAAd,CACvB,8EADuB,CAAxB;AAGA,MAAIC,QAAJ;AACA,MAAIC,IAAJ;;AACA,MAAKH,eAAL,EAAuB;AACtB;AACA,QAAKA,eAAe,CAAE,CAAF,CAApB,EAA4B;AAC3BE,MAAAA,QAAQ,GAAGF,eAAe,CAAE,CAAF,CAAf,GACRA,eAAe,CAAE,CAAF,CADP,GAERA,eAAe,CAAE,CAAF,CAFlB;AAGA,KAJD,CAKA;AALA,SAMK,IAAKA,eAAe,CAAE,CAAF,CAApB,EAA4B;AAChCE,MAAAA,QAAQ,GAAGF,eAAe,CAAE,CAAF,CAAf,GACRA,eAAe,CAAE,CAAF,CADP,GAERA,eAAe,CAAE,CAAF,CAFlB;AAGAG,MAAAA,IAAI,GAAGH,eAAe,CAAE,CAAF,CAAtB;AACA;;AACDE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AP;AASA,GAjBM,EAiBJ,CACFU,cADE,EAEFsB,aAFE,EAGFW,sBAHE,EAIFhC,UAJE,EAKFoB,aAAa,CAAChC,gBALZ,EAMFgC,aAAa,CAAC/B,gBANZ,CAjBI,CAAP;AAyBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport inserterMediaCategories from './inserter-media-categories';\n\nfunction useArchiveLabel( templateSlug ) {\n\tconst taxonomyMatches = templateSlug?.match(\n\t\t/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/\n\t);\n\tlet taxonomy;\n\tlet term;\n\tif ( taxonomyMatches ) {\n\t\t// If is for a all taxonomies of a type\n\t\tif ( taxonomyMatches[ 1 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 2 ]\n\t\t\t\t? taxonomyMatches[ 2 ]\n\t\t\t\t: taxonomyMatches[ 1 ];\n\t\t}\n\t\t// If is for a all taxonomies of a type\n\t\telse if ( taxonomyMatches[ 3 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 6 ]\n\t\t\t\t? taxonomyMatches[ 6 ]\n\t\t\t\t: taxonomyMatches[ 4 ];\n\t\t\tterm = taxonomyMatches[ 7 ];\n\t\t}\n\t\ttaxonomy = taxonomy === 'tag' ? 'post_tag' : taxonomy;\n\n\t\t//getTaxonomy( 'category' );\n\t\t//wp.data.select('core').getEntityRecords( 'taxonomy', 'category', {slug: 'newcat'} );\n\t}\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomy } = select( coreStore );\n\t\t\tlet archiveTypeLabel;\n\t\t\tlet archiveNameLabel;\n\t\t\tif ( taxonomy ) {\n\t\t\t\tarchiveTypeLabel =\n\t\t\t\t\tgetTaxonomy( taxonomy )?.labels?.singular_name;\n\t\t\t}\n\t\t\tif ( term ) {\n\t\t\t\tconst records = getEntityRecords( 'taxonomy', taxonomy, {\n\t\t\t\t\tslug: term,\n\t\t\t\t\tper_page: 1,\n\t\t\t\t} );\n\t\t\t\tif ( records && records[ 0 ] ) {\n\t\t\t\t\tarchiveNameLabel = records[ 0 ].name;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tarchiveTypeLabel,\n\t\t\t\tarchiveNameLabel,\n\t\t\t};\n\t\t},\n\t\t[ taxonomy, term ]\n\t);\n}\n\nexport default function useSiteEditorSettings() {\n\tconst { setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst { storedSettings, canvasMode, templateType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, getCanvasMode, getEditedPostType } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( setIsInserterOpened ),\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpened ]\n\t);\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tstoredSettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories, templateSlug } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst usedPostType = getEditedPostType();\n\t\t\tconst usedPostId = getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tusedPostType,\n\t\t\t\tusedPostId\n\t\t\t);\n\t\t\treturn {\n\t\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\t\trestBlockPatternCategories:\n\t\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t\t\ttemplateSlug: _record.slug,\n\t\t\t};\n\t\t}, [] );\n\tconst archiveLabels = useArchiveLabel( templateSlug );\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( templateType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, templateType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\treturn useMemo( () => {\n\t\tconst {\n\t\t\t__experimentalAdditionalBlockPatterns,\n\t\t\t__experimentalAdditionalBlockPatternCategories,\n\t\t\tfocusMode,\n\t\t\t...restStoredSettings\n\t\t} = storedSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\tfocusMode: canvasMode === 'view' && focusMode ? false : focusMode,\n\t\t\t__experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,\n\t\t\t__experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel,\n\t\t};\n\t}, [\n\t\tstoredSettings,\n\t\tblockPatterns,\n\t\tblockPatternCategories,\n\t\tcanvasMode,\n\t\tarchiveLabels.archiveTypeLabel,\n\t\tarchiveLabels.archiveNameLabel,\n\t] );\n}\n"]}
|
|
@@ -9,6 +9,8 @@ exports.default = CodeEditor;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
+
var _reactAutosizeTextarea = _interopRequireDefault(require("react-autosize-textarea"));
|
|
13
|
+
|
|
12
14
|
var _blocks = require("@wordpress/blocks");
|
|
13
15
|
|
|
14
16
|
var _coreData = require("@wordpress/core-data");
|
|
@@ -21,9 +23,13 @@ var _i18n = require("@wordpress/i18n");
|
|
|
21
23
|
|
|
22
24
|
var _components = require("@wordpress/components");
|
|
23
25
|
|
|
26
|
+
var _compose = require("@wordpress/compose");
|
|
27
|
+
|
|
24
28
|
var _store = require("../../store");
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
/**
|
|
31
|
+
* External dependencies
|
|
32
|
+
*/
|
|
27
33
|
|
|
28
34
|
/**
|
|
29
35
|
* WordPress dependencies
|
|
@@ -33,39 +39,56 @@ var _codeEditorTextArea = _interopRequireDefault(require("./code-editor-text-are
|
|
|
33
39
|
* Internal dependencies
|
|
34
40
|
*/
|
|
35
41
|
function CodeEditor() {
|
|
42
|
+
const instanceId = (0, _compose.useInstanceId)(CodeEditor);
|
|
36
43
|
const {
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
shortcut,
|
|
45
|
+
content,
|
|
46
|
+
blocks,
|
|
47
|
+
type,
|
|
48
|
+
id
|
|
39
49
|
} = (0, _data.useSelect)(select => {
|
|
40
50
|
const {
|
|
41
|
-
|
|
51
|
+
getEditedEntityRecord
|
|
52
|
+
} = select(_coreData.store);
|
|
53
|
+
const {
|
|
54
|
+
getEditedPostType,
|
|
55
|
+
getEditedPostId
|
|
42
56
|
} = select(_store.store);
|
|
43
57
|
const {
|
|
44
58
|
getShortcutRepresentation
|
|
45
59
|
} = select(_keyboardShortcuts.store);
|
|
60
|
+
|
|
61
|
+
const _type = getEditedPostType();
|
|
62
|
+
|
|
63
|
+
const _id = getEditedPostId();
|
|
64
|
+
|
|
65
|
+
const editedRecord = getEditedEntityRecord('postType', _type, _id);
|
|
46
66
|
return {
|
|
47
|
-
|
|
48
|
-
|
|
67
|
+
shortcut: getShortcutRepresentation('core/edit-site/toggle-mode'),
|
|
68
|
+
content: editedRecord?.content,
|
|
69
|
+
blocks: editedRecord?.blocks,
|
|
70
|
+
type: _type,
|
|
71
|
+
id: _id
|
|
49
72
|
};
|
|
50
73
|
}, []);
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
let content;
|
|
55
|
-
|
|
56
|
-
if (contentStructure instanceof Function) {
|
|
57
|
-
content = contentStructure({
|
|
58
|
-
blocks
|
|
59
|
-
});
|
|
60
|
-
} else if (blocks) {
|
|
61
|
-
// If we have parsed blocks already, they should be our source of truth.
|
|
62
|
-
// Parsing applies block deprecations and legacy block conversions that
|
|
63
|
-
// unparsed content will not have.
|
|
64
|
-
content = (0, _blocks.__unstableSerializeAndClean)(blocks);
|
|
65
|
-
} else {
|
|
66
|
-
content = contentStructure;
|
|
67
|
-
}
|
|
74
|
+
const {
|
|
75
|
+
editEntityRecord
|
|
76
|
+
} = (0, _data.useDispatch)(_coreData.store); // Replicates the logic found in getEditedPostContent().
|
|
68
77
|
|
|
78
|
+
const realContent = (0, _element.useMemo)(() => {
|
|
79
|
+
if (content instanceof Function) {
|
|
80
|
+
return content({
|
|
81
|
+
blocks
|
|
82
|
+
});
|
|
83
|
+
} else if (blocks) {
|
|
84
|
+
// If we have parsed blocks already, they should be our source of truth.
|
|
85
|
+
// Parsing applies block deprecations and legacy block conversions that
|
|
86
|
+
// unparsed content will not have.
|
|
87
|
+
return (0, _blocks.__unstableSerializeAndClean)(blocks);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return content;
|
|
91
|
+
}, [content, blocks]);
|
|
69
92
|
const {
|
|
70
93
|
switchEditorMode
|
|
71
94
|
} = (0, _data.useDispatch)(_store.store);
|
|
@@ -79,14 +102,23 @@ function CodeEditor() {
|
|
|
79
102
|
shortcut: shortcut
|
|
80
103
|
}, (0, _i18n.__)('Exit code editor'))), (0, _element.createElement)("div", {
|
|
81
104
|
className: "edit-site-code-editor__body"
|
|
82
|
-
}, (0, _element.createElement)(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
105
|
+
}, (0, _element.createElement)(_components.VisuallyHidden, {
|
|
106
|
+
as: "label",
|
|
107
|
+
htmlFor: `code-editor-text-area-${instanceId}`
|
|
108
|
+
}, (0, _i18n.__)('Type text or HTML')), (0, _element.createElement)(_reactAutosizeTextarea.default, {
|
|
109
|
+
autoComplete: "off",
|
|
110
|
+
dir: "auto",
|
|
111
|
+
value: realContent,
|
|
112
|
+
onChange: event => {
|
|
113
|
+
editEntityRecord('postType', type, id, {
|
|
114
|
+
content: event.target.value,
|
|
115
|
+
blocks: undefined,
|
|
86
116
|
selection: undefined
|
|
87
117
|
});
|
|
88
118
|
},
|
|
89
|
-
|
|
119
|
+
className: "edit-site-code-editor-text-area",
|
|
120
|
+
id: `code-editor-text-area-${instanceId}`,
|
|
121
|
+
placeholder: (0, _i18n.__)('Start writing with text or HTML')
|
|
90
122
|
})));
|
|
91
123
|
}
|
|
92
124
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/code-editor/index.js"],"names":["CodeEditor","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/code-editor/index.js"],"names":["CodeEditor","instanceId","shortcut","content","blocks","type","id","select","getEditedEntityRecord","coreStore","getEditedPostType","getEditedPostId","editSiteStore","getShortcutRepresentation","keyboardShortcutsStore","_type","_id","editedRecord","editEntityRecord","realContent","Function","switchEditorMode","event","target","value","undefined","selection"],"mappings":";;;;;;;;;AAcA;;AAXA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAKA;;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AAGe,SAASA,UAAT,GAAsB;AACpC,QAAMC,UAAU,GAAG,4BAAeD,UAAf,CAAnB;AACA,QAAM;AAAEE,IAAAA,QAAF;AAAYC,IAAAA,OAAZ;AAAqBC,IAAAA,MAArB;AAA6BC,IAAAA,IAA7B;AAAmCC,IAAAA;AAAnC,MAA0C,qBAAaC,MAAF,IAAc;AACxE,UAAM;AAAEC,MAAAA;AAAF,QAA4BD,MAAM,CAAEE,eAAF,CAAxC;AACA,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QAAyCJ,MAAM,CAAEK,YAAF,CAArD;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAgCN,MAAM,CAAEO,wBAAF,CAA5C;;AACA,UAAMC,KAAK,GAAGL,iBAAiB,EAA/B;;AACA,UAAMM,GAAG,GAAGL,eAAe,EAA3B;;AACA,UAAMM,YAAY,GAAGT,qBAAqB,CAAE,UAAF,EAAcO,KAAd,EAAqBC,GAArB,CAA1C;AAEA,WAAO;AACNd,MAAAA,QAAQ,EAAEW,yBAAyB,CAAE,4BAAF,CAD7B;AAENV,MAAAA,OAAO,EAAEc,YAAY,EAAEd,OAFjB;AAGNC,MAAAA,MAAM,EAAEa,YAAY,EAAEb,MAHhB;AAINC,MAAAA,IAAI,EAAEU,KAJA;AAKNT,MAAAA,EAAE,EAAEU;AALE,KAAP;AAOA,GAf+C,EAe7C,EAf6C,CAAhD;AAgBA,QAAM;AAAEE,IAAAA;AAAF,MAAuB,uBAAaT,eAAb,CAA7B,CAlBoC,CAmBpC;;AACA,QAAMU,WAAW,GAAG,sBAAS,MAAM;AAClC,QAA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C;AAaC,IAAA,WAAW,EAAG,cAAI,iCAAJ;AAbf,IAPD,CAXD,CADD;AAqCA","sourcesContent":["/**\n * External dependencies\n */\nimport Textarea from 'react-autosize-textarea';\n\n/**\n * WordPress dependencies\n */\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function CodeEditor() {\n\tconst instanceId = useInstanceId( CodeEditor );\n\tconst { shortcut, content, blocks, type, id } = useSelect( ( select ) => {\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\tconst _type = getEditedPostType();\n\t\tconst _id = getEditedPostId();\n\t\tconst editedRecord = getEditedEntityRecord( 'postType', _type, _id );\n\n\t\treturn {\n\t\t\tshortcut: getShortcutRepresentation( 'core/edit-site/toggle-mode' ),\n\t\t\tcontent: editedRecord?.content,\n\t\t\tblocks: editedRecord?.blocks,\n\t\t\ttype: _type,\n\t\t\tid: _id,\n\t\t};\n\t}, [] );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\t// Replicates the logic found in getEditedPostContent().\n\tconst realContent = useMemo( () => {\n\t\tif ( content instanceof Function ) {\n\t\t\treturn content( { blocks } );\n\t\t} else if ( blocks ) {\n\t\t\t// If we have parsed blocks already, they should be our source of truth.\n\t\t\t// Parsing applies block deprecations and legacy block conversions that\n\t\t\t// unparsed content will not have.\n\t\t\treturn __unstableSerializeAndClean( blocks );\n\t\t}\n\t\treturn content;\n\t}, [ content, blocks ] );\n\n\tconst { switchEditorMode } = useDispatch( editSiteStore );\n\treturn (\n\t\t<div className=\"edit-site-code-editor\">\n\t\t\t<div className=\"edit-site-code-editor__toolbar\">\n\t\t\t\t<h2>{ __( 'Editing code' ) }</h2>\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tonClick={ () => switchEditorMode( 'visual' ) }\n\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Exit code editor' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t\t<div className=\"edit-site-code-editor__body\">\n\t\t\t\t<VisuallyHidden\n\t\t\t\t\tas=\"label\"\n\t\t\t\t\thtmlFor={ `code-editor-text-area-${ instanceId }` }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Type text or HTML' ) }\n\t\t\t\t</VisuallyHidden>\n\t\t\t\t<Textarea\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tdir=\"auto\"\n\t\t\t\t\tvalue={ realContent }\n\t\t\t\t\tonChange={ ( event ) => {\n\t\t\t\t\t\teditEntityRecord( 'postType', type, id, {\n\t\t\t\t\t\t\tcontent: event.target.value,\n\t\t\t\t\t\t\tblocks: undefined,\n\t\t\t\t\t\t\tselection: undefined,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tclassName=\"edit-site-code-editor-text-area\"\n\t\t\t\t\tid={ `code-editor-text-area-${ instanceId }` }\n\t\t\t\t\tplaceholder={ __( 'Start writing with text or HTML' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -17,6 +17,8 @@ var _notices = require("@wordpress/notices");
|
|
|
17
17
|
|
|
18
18
|
var _data = require("@wordpress/data");
|
|
19
19
|
|
|
20
|
+
var _blocks = require("@wordpress/blocks");
|
|
21
|
+
|
|
20
22
|
var _utils = require("../page-patterns/utils");
|
|
21
23
|
|
|
22
24
|
/**
|
|
@@ -27,9 +29,11 @@ var _utils = require("../page-patterns/utils");
|
|
|
27
29
|
* Internal dependencies
|
|
28
30
|
*/
|
|
29
31
|
function CreatePatternModal({
|
|
32
|
+
blocks = [],
|
|
30
33
|
closeModal,
|
|
31
34
|
onCreate,
|
|
32
|
-
onError
|
|
35
|
+
onError,
|
|
36
|
+
title
|
|
33
37
|
}) {
|
|
34
38
|
const [name, setName] = (0, _element.useState)('');
|
|
35
39
|
const [syncType, setSyncType] = (0, _element.useState)(_utils.SYNC_TYPES.unsynced);
|
|
@@ -57,7 +61,7 @@ function CreatePatternModal({
|
|
|
57
61
|
try {
|
|
58
62
|
const pattern = await saveEntityRecord('postType', 'wp_block', {
|
|
59
63
|
title: name || (0, _i18n.__)('Untitled Pattern'),
|
|
60
|
-
content: '',
|
|
64
|
+
content: blocks?.length ? (0, _blocks.serialize)(blocks) : '',
|
|
61
65
|
status: 'publish',
|
|
62
66
|
meta: syncType === _utils.SYNC_TYPES.unsynced ? {
|
|
63
67
|
wp_pattern_sync_status: syncType
|
|
@@ -79,7 +83,7 @@ function CreatePatternModal({
|
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
return (0, _element.createElement)(_components.Modal, {
|
|
82
|
-
title: (0, _i18n.__)('Create pattern'),
|
|
86
|
+
title: title || (0, _i18n.__)('Create pattern'),
|
|
83
87
|
onRequestClose: closeModal,
|
|
84
88
|
overlayClassName: "edit-site-create-pattern-modal"
|
|
85
89
|
}, (0, _element.createElement)("form", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/create-pattern-modal/index.js"],"names":["CreatePatternModal","closeModal","onCreate","onError","name","setName","syncType","setSyncType","SYNC_TYPES","unsynced","isSubmitting","setIsSubmitting","onSyncChange","full","createErrorNotice","noticesStore","saveEntityRecord","coreStore","createPattern","type","pattern","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/create-pattern-modal/index.js"],"names":["CreatePatternModal","blocks","closeModal","onCreate","onError","title","name","setName","syncType","setSyncType","SYNC_TYPES","unsynced","isSubmitting","setIsSubmitting","onSyncChange","full","createErrorNotice","noticesStore","saveEntityRecord","coreStore","createPattern","type","pattern","content","length","status","meta","wp_pattern_sync_status","undefined","throwOnError","categoryId","USER_PATTERN_CATEGORY","error","errorMessage","message","code","event","preventDefault"],"mappings":";;;;;;;AAaA;;AAVA;;AAQA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AArBA;AACA;AACA;;AAgBA;AACA;AACA;AAGe,SAASA,kBAAT,CAA6B;AAC3CC,EAAAA,MAAM,GAAG,EADkC;AAE3CC,EAAAA,UAF2C;AAG3CC,EAAAA,QAH2C;AAI3CC,EAAAA,OAJ2C;AAK3CC,EAAAA;AAL2C,CAA7B,EAMX;AACH,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoB,uBAAU,EAAV,CAA1B;AACA,QAAM,CAAEC,QAAF,EAAYC,WAAZ,IAA4B,uBAAUC,kBAAWC,QAArB,CAAlC;AACA,QAAM,CAAEC,YAAF,EAAgBC,eAAhB,IAAoC,uBAAU,KAAV,CAA1C;;AAEA,QAAMC,YAAY,GAAG,MAAM;AAC1BL,IAAAA,WAAW,CACVD,QAAQ,KAAKE,kBAAWK,IAAxB,GAA+BL,kBAAWC,QAA1C,GAAqDD,kBAAWK,IADtD,CAAX;AAGA,GAJD;;AAMA,QAAM;AAAEC,IAAAA;AAAF,MAAwB,uBAAaC,cAAb,CAA9B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAuB,uBAAaC,eAAb,CAA7B;;AAEA,iBAAeC,aAAf,GAA+B;AAC9B,QAAK,CAAEd,IAAP,EAAc;AACbU,MAAAA,iBAAiB,CAAE,cAAI,8BAAJ,CAAF,EAAwC;AACxDK,QAAAA,IAAI,EAAE;AADkD,OAAxC,CAAjB;AAGA;AACA;;AAED,QAAI;AACH,YAAMC,OAAO,GAAG,MAAMJ,gBAAgB,CACrC,UADqC,EAErC,UAFqC,EAGrC;AACCb,QAAAA,KAAK,EAAEC,IA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AGC,IAAA,QAAQ,EAAGb,OAHZ;AAIC,IAAA,WAAW,EAAG,cAAI,YAAJ,CAJf;AAKC,IAAA,QAAQ,MALT;AAMC,IAAA,KAAK,EAAGD,IANT;AAOC,IAAA,uBAAuB;AAPxB,IADD,EAUC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,cAAI,oCAAJ,CADT;AAEC,IAAA,QAAQ,EAAGQ,YAFZ;AAGC,IAAA,IAAI,EAAG,cACN,6EADM,CAHR;AAMC,IAAA,OAAO,EAAGN,QAAQ,KAAKE,kBAAWK;AANnC,IAVD,EAkBC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAG,MAAM;AACfb,MAAAA,UAAU;AACV;AAJF,KAMG,cAAI,QAAJ,CANH,CADD,EASC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,QAAQ,EAAG,CAAEI,IAHd;AAIC,IAAA,MAAM,EAAGM;AAJV,KAMG,cAAI,QAAJ,CANH,CATD,CAlBD,CAVD,CALD,CADD;AAwDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tTextControl,\n\tButton,\n\tModal,\n\tToggleControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch } from '@wordpress/data';\nimport { serialize } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { SYNC_TYPES, USER_PATTERN_CATEGORY } from '../page-patterns/utils';\n\nexport default function CreatePatternModal( {\n\tblocks = [],\n\tcloseModal,\n\tonCreate,\n\tonError,\n\ttitle,\n} ) {\n\tconst [ name, setName ] = useState( '' );\n\tconst [ syncType, setSyncType ] = useState( SYNC_TYPES.unsynced );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\n\tconst onSyncChange = () => {\n\t\tsetSyncType(\n\t\t\tsyncType === SYNC_TYPES.full ? SYNC_TYPES.unsynced : SYNC_TYPES.full\n\t\t);\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tasync function createPattern() {\n\t\tif ( ! name ) {\n\t\t\tcreateErrorNotice( __( 'Please enter a pattern name.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst pattern = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_block',\n\t\t\t\t{\n\t\t\t\t\ttitle: name || __( 'Untitled Pattern' ),\n\t\t\t\t\tcontent: blocks?.length ? serialize( blocks ) : '',\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\tmeta:\n\t\t\t\t\t\tsyncType === SYNC_TYPES.unsynced\n\t\t\t\t\t\t\t? { wp_pattern_sync_status: syncType }\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonCreate( { pattern, categoryId: USER_PATTERN_CATEGORY } );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the pattern.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\tonError();\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ title || __( 'Create pattern' ) }\n\t\t\tonRequestClose={ closeModal }\n\t\t\toverlayClassName=\"edit-site-create-pattern-modal\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif ( ! name ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tsetIsSubmitting( true );\n\t\t\t\t\tawait createPattern();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"4\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tclassName=\"edit-site-create-pattern-modal__input\"\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tonChange={ setName }\n\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t\trequired\n\t\t\t\t\t\tvalue={ name }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Keep all pattern instances in sync' ) }\n\t\t\t\t\t\tonChange={ onSyncChange }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Editing the original pattern will also update anywhere the pattern is used.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tchecked={ syncType === SYNC_TYPES.full }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tdisabled={ ! name }\n\t\t\t\t\t\t\tisBusy={ isSubmitting }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"]}
|
|
@@ -94,7 +94,7 @@ const typeLabels = {
|
|
|
94
94
|
const blockRemovalRules = {
|
|
95
95
|
'core/query': (0, _i18n.__)('Query Loop displays a list of posts or pages.'),
|
|
96
96
|
'core/post-content': (0, _i18n.__)('Post Content displays the content of a post or page.'),
|
|
97
|
-
'core/
|
|
97
|
+
'core/post-template': (0, _i18n.__)('Post Template displays each post or page in a Query Loop.')
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
function Editor({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/editor/index.js"],"names":["BlockRemovalWarningModal","blockEditorPrivateApis","interfaceLabels","body","sidebar","actions","footer","typeLabels","wp_template","wp_template_part","wp_block","blockRemovalRules","Editor","isLoading","record","editedPost","getTitle","isLoaded","hasLoadedPost","id","editedPostId","type","editedPostType","context","editorMode","canvasMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","showIconLabels","showBlockBreadcrumbs","hasPageContentFocus","select","getEditedPostContext","getEditorMode","getCanvasMode","isInserterOpened","isListViewOpened","_hasPageContentFocus","editSiteStore","__unstableGetEditorMode","blockEditorStore","getActiveComplementaryArea","interfaceStore","name","preferencesStore","get","setEditedPostContext","isViewMode","isEditMode","showVisualEditor","shouldShowBlockBreadcrumbs","shouldShowInserter","shouldShowListView","secondarySidebarLabel","blockContext","postType","postId","nonPostFields","queryContext","page","newQueryContext","title","secondarySidebar"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA5CA;AACA;AACA;;AAGA;AACA;AACA;;AAoBA;AACA;AACA;AAiBA,MAAM;AAAEA,EAAAA;AAAF,IAA+B,wBAAQC,wBAAR,CAArC;AAEA,MAAMC,eAAe,GAAG;AACvB;AACAC,EAAAA,IAAI,EAAE,cAAI,gBAAJ,CAFiB;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GAEhB,cAAI,UAAJ;AAJL,MA7DH;AAsEC,IAAA,MAAM,EAAG,EACR,GAAG9B,eADK;AAER8D,MAAAA,gBAAgB,EAAET;AAFV;AAtEV,IAHD,CALD,CADD,CAHD,CADD;AA6FA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { EntityProvider } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockContextProvider,\n\tBlockBreadcrumb,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { EditorNotices, EditorSnackbars } from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SidebarComplementaryAreaFills } from '../sidebar-edit-mode';\nimport BlockEditor from '../block-editor';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport WelcomeGuide from '../welcome-guide';\nimport StartTemplateOptions from '../start-template-options';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport useTitle from '../routes/use-title';\nimport CanvasSpinner from '../canvas-spinner';\nimport { unlock } from '../../lock-unlock';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { SidebarFixedBottomSlot } from '../sidebar-edit-mode/sidebar-fixed-bottom';\n\nconst { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );\n\nconst interfaceLabels = {\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\nconst typeLabels = {\n\twp_template: __( 'Template Part' ),\n\twp_template_part: __( 'Template Part' ),\n\twp_block: __( 'Pattern' ),\n};\n\n// Prevent accidental removal of certain blocks, asking the user for\n// confirmation.\nconst blockRemovalRules = {\n\t'core/query': __( 'Query Loop displays a list of posts or pages.' ),\n\t'core/post-content': __(\n\t\t'Post Content displays the content of a post or page.'\n\t),\n\t'core/footnotes': __(\n\t\t'The Footnotes block displays all footnotes found in the content. Note that any footnotes in the content will persist after removing this block.'\n\t),\n};\n\nexport default function Editor( { isLoading } ) {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\n\tconst { id: editedPostId, type: editedPostType } = editedPost;\n\n\tconst {\n\t\tcontext,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tshowIconLabels,\n\t\tshowBlockBreadcrumbs,\n\t\thasPageContentFocus,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostContext,\n\t\t\tgetEditorMode,\n\t\t\tgetCanvasMode,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\thasPageContentFocus: _hasPageContentFocus,\n\t\t} = unlock( select( editSiteStore ) );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tcontext: getEditedPostContext(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisRightSidebarOpen: getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\thasPageContentFocus: _hasPageContentFocus(),\n\t\t};\n\t}, [] );\n\tconst { setEditedPostContext } = useDispatch( editSiteStore );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst shouldShowBlockBreadcrumbs =\n\t\tshowBlockBreadcrumbs &&\n\t\tisEditMode &&\n\t\tshowVisualEditor &&\n\t\tblockEditorMode !== 'zoom-out';\n\tconst shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;\n\tconst shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\tconst blockContext = useMemo( () => {\n\t\tconst { postType, postId, ...nonPostFields } = context ?? {};\n\t\treturn {\n\t\t\t...( hasPageContentFocus ? context : nonPostFields ),\n\t\t\tqueryContext: [\n\t\t\t\tcontext?.queryContext || { page: 1 },\n\t\t\t\t( newQueryContext ) =>\n\t\t\t\t\tsetEditedPostContext( {\n\t\t\t\t\t\t...context,\n\t\t\t\t\t\tqueryContext: {\n\t\t\t\t\t\t\t...context?.queryContext,\n\t\t\t\t\t\t\t...newQueryContext,\n\t\t\t\t\t\t},\n\t\t\t\t\t} ),\n\t\t\t],\n\t\t};\n\t}, [ hasPageContentFocus, context, setEditedPostContext ] );\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\tconst type = typeLabels[ editedPostType ] ?? __( 'Template' );\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail in browser tab. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s ‹ Editor' ),\n\t\t\tgetTitle(),\n\t\t\ttype\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n\n\treturn (\n\t\t<>\n\t\t\t{ isLoading ? <CanvasSpinner /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ editedPostType }\n\t\t\t\t\tid={ editedPostId }\n\t\t\t\t>\n\t\t\t\t\t<BlockContextProvider value={ blockContext }>\n\t\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t\t{ isEditMode && <StartTemplateOptions /> }\n\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\tisDistractionFree={ true }\n\t\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'edit-site-editor__interface-skeleton',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t\t\t\t\t'is-loading': isLoading,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t\t{ showVisualEditor && editedPost && (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<BlockEditor />\n\t\t\t\t\t\t\t\t\t\t\t<BlockRemovalWarningModal\n\t\t\t\t\t\t\t\t\t\t\t\trules={ blockRemovalRules }\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) }\n\t\t\t\t\t\t\t\t\t{ editorMode === 'text' &&\n\t\t\t\t\t\t\t\t\t\teditedPost &&\n\t\t\t\t\t\t\t\t\t\tisEditMode && <CodeEditor /> }\n\t\t\t\t\t\t\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcutsEditMode />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsecondarySidebar={\n\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\t( ( shouldShowInserter && (\n\t\t\t\t\t\t\t\t\t<InserterSidebar />\n\t\t\t\t\t\t\t\t) ) ||\n\t\t\t\t\t\t\t\t\t( shouldShowListView && (\n\t\t\t\t\t\t\t\t\t\t<ListViewSidebar />\n\t\t\t\t\t\t\t\t\t) ) )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t\t\t<SidebarFixedBottomSlot />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\t\tshouldShowBlockBreadcrumbs && (\n\t\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\t\trootLabelText={\n\t\t\t\t\t\t\t\t\t\t\thasPageContentFocus\n\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Page' )\n\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Template' )\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)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/editor/index.js"],"names":["BlockRemovalWarningModal","blockEditorPrivateApis","interfaceLabels","body","sidebar","actions","footer","typeLabels","wp_template","wp_template_part","wp_block","blockRemovalRules","Editor","isLoading","record","editedPost","getTitle","isLoaded","hasLoadedPost","id","editedPostId","type","editedPostType","context","editorMode","canvasMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","showIconLabels","showBlockBreadcrumbs","hasPageContentFocus","select","getEditedPostContext","getEditorMode","getCanvasMode","isInserterOpened","isListViewOpened","_hasPageContentFocus","editSiteStore","__unstableGetEditorMode","blockEditorStore","getActiveComplementaryArea","interfaceStore","name","preferencesStore","get","setEditedPostContext","isViewMode","isEditMode","showVisualEditor","shouldShowBlockBreadcrumbs","shouldShowInserter","shouldShowListView","secondarySidebarLabel","blockContext","postType","postId","nonPostFields","queryContext","page","newQueryContext","title","secondarySidebar"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA5CA;AACA;AACA;;AAGA;AACA;AACA;;AAoBA;AACA;AACA;AAiBA,MAAM;AAAEA,EAAAA;AAAF,IAA+B,wBAAQC,wBAAR,CAArC;AAEA,MAAMC,eAAe,GAAG;AACvB;AACAC,EAAAA,IAAI,EAAE,cAAI,gBAAJ,CAFiB;;AAGvB;AACAC,EAAAA,OAAO,EAAE,cAAI,iBAAJ,CAJc;;AAKvB;AACAC,EAAAA,OAAO,EAAE,cAAI,gBAAJ,CANc;;AAOvB;AACAC,EAAAA,MAAM,EAAE,cAAI,eAAJ;AARe,CAAxB;AAWA,MAAMC,UAAU,GAAG;AAClBC,EAAAA,WAAW,EAAE,cAAI,eAAJ,CADK;AAElBC,EAAAA,gBAAgB,EAAE,cAAI,eAAJ,CAFA;AAGlBC,EAAAA,QAAQ,EAAE,cAAI,SAAJ;AAHQ,CAAnB,C,CAMA;AACA;;AACA,MAAMC,iBAAiB,GAAG;AACzB,gBAAc,cAAI,+CAAJ,CADW;AAEzB,uBAAqB,cACpB,sDADoB,CAFI;AAKzB,wBAAsB,cACrB,2DADqB;AALG,CAA1B;;AAUe,SAASC,MAAT,CAAiB;AAAEC,EAAAA;AAAF,CAAjB,EAAiC;AAC/C,QAAM;AACLC,IAAAA,MAAM,EAAEC,UADH;AAELC,IAAAA,QAFK;AAGLC,IAAAA,QAAQ,EAAEC;AAHL,MAIF,qCAJJ;AAMA,QAAM;AAAEC,IAAAA,EAAE,EAAEC,YAAN;AAAoBC,IAAAA,IA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R;AAEC,MAAA,aAAa,EAAG;AAFjB,OAIG,cACD,2EADC,CAJH,CAfF,EAwBGmC,UAAU,IACX,4BAAC,iBAAD,OAzBF,CAZF;AAyCC,IAAA,gBAAgB,EACfA,UAAU,KACNG,kBAAkB,IACrB,4BAAC,wBAAD,OADC,IAGCC,kBAAkB,IACnB,4BAAC,wBAAD,OALQ,CA1CZ;AAkDC,IAAA,OAAO,EACNJ,UAAU,IACVvB,kBADA,IAEC,qDACC,4BAAC,4BAAD,CAAmB,IAAnB;AAAwB,MAAA,KAAK,EAAC;AAA9B,MADD,EAEC,4BAAC,0CAAD,OAFD,CArDH;AA2DC,IAAA,MAAM,EACLyB,0BAA0B,IACzB,4BAAC,4BAAD;AACC,MAAA,aAAa,EACZpB,mBAAmB,GAChB,cAAI,MAAJ,CADgB,GAEhB,cAAI,UAAJ;AAJL,MA7DH;AAsEC,IAAA,MAAM,EAAG,EACR,GAAG9B,eADK;AAER8D,MAAAA,gBAAgB,EAAET;AAFV;AAtEV,IAHD,CALD,CADD,CAHD,CADD;AA6FA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { EntityProvider } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockContextProvider,\n\tBlockBreadcrumb,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { EditorNotices, EditorSnackbars } from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SidebarComplementaryAreaFills } from '../sidebar-edit-mode';\nimport BlockEditor from '../block-editor';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport WelcomeGuide from '../welcome-guide';\nimport StartTemplateOptions from '../start-template-options';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport useTitle from '../routes/use-title';\nimport CanvasSpinner from '../canvas-spinner';\nimport { unlock } from '../../lock-unlock';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { SidebarFixedBottomSlot } from '../sidebar-edit-mode/sidebar-fixed-bottom';\n\nconst { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );\n\nconst interfaceLabels = {\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\nconst typeLabels = {\n\twp_template: __( 'Template Part' ),\n\twp_template_part: __( 'Template Part' ),\n\twp_block: __( 'Pattern' ),\n};\n\n// Prevent accidental removal of certain blocks, asking the user for\n// confirmation.\nconst blockRemovalRules = {\n\t'core/query': __( 'Query Loop displays a list of posts or pages.' ),\n\t'core/post-content': __(\n\t\t'Post Content displays the content of a post or page.'\n\t),\n\t'core/post-template': __(\n\t\t'Post Template displays each post or page in a Query Loop.'\n\t),\n};\n\nexport default function Editor( { isLoading } ) {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\n\tconst { id: editedPostId, type: editedPostType } = editedPost;\n\n\tconst {\n\t\tcontext,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tshowIconLabels,\n\t\tshowBlockBreadcrumbs,\n\t\thasPageContentFocus,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostContext,\n\t\t\tgetEditorMode,\n\t\t\tgetCanvasMode,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\thasPageContentFocus: _hasPageContentFocus,\n\t\t} = unlock( select( editSiteStore ) );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tcontext: getEditedPostContext(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisRightSidebarOpen: getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\thasPageContentFocus: _hasPageContentFocus(),\n\t\t};\n\t}, [] );\n\tconst { setEditedPostContext } = useDispatch( editSiteStore );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst shouldShowBlockBreadcrumbs =\n\t\tshowBlockBreadcrumbs &&\n\t\tisEditMode &&\n\t\tshowVisualEditor &&\n\t\tblockEditorMode !== 'zoom-out';\n\tconst shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;\n\tconst shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\tconst blockContext = useMemo( () => {\n\t\tconst { postType, postId, ...nonPostFields } = context ?? {};\n\t\treturn {\n\t\t\t...( hasPageContentFocus ? context : nonPostFields ),\n\t\t\tqueryContext: [\n\t\t\t\tcontext?.queryContext || { page: 1 },\n\t\t\t\t( newQueryContext ) =>\n\t\t\t\t\tsetEditedPostContext( {\n\t\t\t\t\t\t...context,\n\t\t\t\t\t\tqueryContext: {\n\t\t\t\t\t\t\t...context?.queryContext,\n\t\t\t\t\t\t\t...newQueryContext,\n\t\t\t\t\t\t},\n\t\t\t\t\t} ),\n\t\t\t],\n\t\t};\n\t}, [ hasPageContentFocus, context, setEditedPostContext ] );\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\tconst type = typeLabels[ editedPostType ] ?? __( 'Template' );\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail in browser tab. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s ‹ Editor' ),\n\t\t\tgetTitle(),\n\t\t\ttype\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n\n\treturn (\n\t\t<>\n\t\t\t{ isLoading ? <CanvasSpinner /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ editedPostType }\n\t\t\t\t\tid={ editedPostId }\n\t\t\t\t>\n\t\t\t\t\t<BlockContextProvider value={ blockContext }>\n\t\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t\t{ isEditMode && <StartTemplateOptions /> }\n\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\tisDistractionFree={ true }\n\t\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'edit-site-editor__interface-skeleton',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t\t\t\t\t'is-loading': isLoading,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t\t{ showVisualEditor && editedPost && (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<BlockEditor />\n\t\t\t\t\t\t\t\t\t\t\t<BlockRemovalWarningModal\n\t\t\t\t\t\t\t\t\t\t\t\trules={ blockRemovalRules }\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) }\n\t\t\t\t\t\t\t\t\t{ editorMode === 'text' &&\n\t\t\t\t\t\t\t\t\t\teditedPost &&\n\t\t\t\t\t\t\t\t\t\tisEditMode && <CodeEditor /> }\n\t\t\t\t\t\t\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcutsEditMode />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsecondarySidebar={\n\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\t( ( shouldShowInserter && (\n\t\t\t\t\t\t\t\t\t<InserterSidebar />\n\t\t\t\t\t\t\t\t) ) ||\n\t\t\t\t\t\t\t\t\t( shouldShowListView && (\n\t\t\t\t\t\t\t\t\t\t<ListViewSidebar />\n\t\t\t\t\t\t\t\t\t) ) )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t\t\t<SidebarFixedBottomSlot />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\t\tshouldShowBlockBreadcrumbs && (\n\t\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\t\trootLabelText={\n\t\t\t\t\t\t\t\t\t\t\thasPageContentFocus\n\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Page' )\n\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Template' )\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)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -79,7 +79,8 @@ function HeaderEditMode() {
|
|
|
79
79
|
blockEditorMode,
|
|
80
80
|
homeUrl,
|
|
81
81
|
showIconLabels,
|
|
82
|
-
editorCanvasView
|
|
82
|
+
editorCanvasView,
|
|
83
|
+
hasFixedToolbar
|
|
83
84
|
} = (0, _data.useSelect)(select => {
|
|
84
85
|
const {
|
|
85
86
|
__experimentalGetPreviewDeviceType,
|
|
@@ -99,6 +100,9 @@ function HeaderEditMode() {
|
|
|
99
100
|
getUnstableBase // Site index.
|
|
100
101
|
|
|
101
102
|
} = select(_coreData.store);
|
|
103
|
+
const {
|
|
104
|
+
get: getPreference
|
|
105
|
+
} = select(_preferences.store);
|
|
102
106
|
return {
|
|
103
107
|
deviceType: __experimentalGetPreviewDeviceType(),
|
|
104
108
|
templateType: postType,
|
|
@@ -108,15 +112,12 @@ function HeaderEditMode() {
|
|
|
108
112
|
isVisualMode: getEditorMode() === 'visual',
|
|
109
113
|
blockEditorMode: __unstableGetEditorMode(),
|
|
110
114
|
homeUrl: getUnstableBase()?.home,
|
|
111
|
-
showIconLabels:
|
|
115
|
+
showIconLabels: getPreference(_store.store.name, 'showIconLabels'),
|
|
112
116
|
editorCanvasView: (0, _lockUnlock.unlock)(select(_store.store)).getEditorCanvasContainerView(),
|
|
113
|
-
isDistractionFree:
|
|
117
|
+
isDistractionFree: getPreference(_store.store.name, 'distractionFree'),
|
|
118
|
+
hasFixedToolbar: getPreference(_store.store.name, 'fixedToolbar')
|
|
114
119
|
};
|
|
115
120
|
}, []);
|
|
116
|
-
const {
|
|
117
|
-
get: getPreference
|
|
118
|
-
} = (0, _data.useSelect)(_preferences.store);
|
|
119
|
-
const hasFixedToolbar = getPreference(_store.store.name, 'fixedToolbar');
|
|
120
121
|
const {
|
|
121
122
|
__experimentalSetPreviewDeviceType: setPreviewDeviceType,
|
|
122
123
|
setIsInserterOpened,
|
|
@@ -254,10 +255,13 @@ function HeaderEditMode() {
|
|
|
254
255
|
deviceType: deviceType,
|
|
255
256
|
setDeviceType: setPreviewDeviceType,
|
|
256
257
|
label: (0, _i18n.__)('View')
|
|
257
|
-
}, (
|
|
258
|
+
}, ({
|
|
259
|
+
onClose
|
|
260
|
+
}) => (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItem, {
|
|
258
261
|
href: homeUrl,
|
|
259
262
|
target: "_blank",
|
|
260
|
-
icon: _icons.external
|
|
263
|
+
icon: _icons.external,
|
|
264
|
+
onClick: onClose
|
|
261
265
|
}, (0, _i18n.__)('View site'), (0, _element.createElement)(_components.VisuallyHidden, {
|
|
262
266
|
as: "span"
|
|
263
267
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/header-edit-mode/index.js"],"names":["useShouldContextualToolbarShow","blockEditorPrivateApis","preventDefault","event","HeaderEditMode","inserterButton","deviceType","templateType","isInserterOpen","isListViewOpen","listViewShortcut","isVisualMode","isDistractionFree","blockEditorMode","homeUrl","showIconLabels","editorCanvasView","select","__experimentalGetPreviewDeviceType","getEditedPostType","isInserterOpened","isListViewOpened","getEditorMode","editSiteStore","getShortcutRepresentation","keyboardShortcutsStore","__unstableGetEditorMode","blockEditorStore","postType","getUnstableBase","coreStore","home","preferencesStore","get","getEditorCanvasContainerView","getPreference","hasFixedToolbar","name","__experimentalSetPreviewDeviceType","setPreviewDeviceType","setIsInserterOpened","setIsListViewOpened","__unstableSetEditorMode","disableMotion","isLargeViewport","toggleInserter","current","focus","toggleListView","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","hasDefaultEditorCanvasView","isFocusMode","longLabel","shortLabel","isZoomedOutViewExperimentEnabled","window","__experimentalEnableZoomedOutView","isZoomedOutView","toolbarVariants","y","isDistractionFreeHovering","view","edit","toolbarTransition","type","duration","ease","motion","div","Button","plus","ToolSelector","undefined","UndoButton","RedoButton","listView","chevronUpD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AAGC,IAAA,UAAU,EAAGK;AAHd,KAKG,CAAEZ,WAAF,IAAiBD,0BAAjB,IACD;AACC,IAAA,SAAS,EAAG,yBACX,6CADW,EAEX;AAAE,uBAAiBO;AAAnB,KAFW;AADb,KAMC,4BAAC,yCAAD;AACC,IAAA,UAAU,EAAGtD,UADd;AAEC,IAAA,aAAa,EAAGiC,oBAFjB;AAGC,IAAA,KAAK,EAAG,cAAI,MAAJ;AAHT,KAKC,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAGzB,OADR;AAEC,IAAA,MAAM,EAAC,QAFR;AAGC,IAAA,IAAI,EAAGkE;AAHR,KAKG,cAAI,WAAJ,CALH,EAMC,4BAAC,0BAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB;AAEE;AACA,gBAAI,sBAAJ,CAHF,CAND,CADD,CALD,CAND,CANF,EAmCC,4BAAC,mBAAD,OAnCD,EAoCG,CAAEpE,iBAAF,IACD,4BAAC,sBAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IArCF,EAuCC,4BAAC,iBAAD;AAAU,IAAA,cAAc,EAAGG;AAA3B,IAvCD,CADD,CAzHD,CADD;AAuKA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch, useReducedMotion } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tToolSelector,\n\t__experimentalPreviewOptions as PreviewOptions,\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { PinnedItems } from '@wordpress/interface';\nimport { _x, __ } from '@wordpress/i18n';\nimport { listView, plus, external, chevronUpDown } from '@wordpress/icons';\nimport {\n\t__unstableMotion as motion,\n\tButton,\n\tToolbarItem,\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport MoreMenu from './more-menu';\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport DocumentActions from './document-actions';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport { unlock } from '../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nexport default function HeaderEditMode() {\n\tconst inserterButton = useRef();\n\tconst {\n\t\tdeviceType,\n\t\ttemplateType,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tisVisualMode,\n\t\tisDistractionFree,\n\t\tblockEditorMode,\n\t\thomeUrl,\n\t\tshowIconLabels,\n\t\teditorCanvasView,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetEditedPostType,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\tgetEditorMode,\n\t\t} = select( editSiteStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\tconst postType = getEditedPostType();\n\n\t\tconst {\n\t\t\tgetUnstableBase, // Site index.\n\t\t} = select( coreStore );\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\ttemplateType: postType,\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-site/toggle-list-view'\n\t\t\t),\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\teditorCanvasView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t\tisDistractionFree: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'distractionFree'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { get: getPreference } = useSelect( preferencesStore );\n\tconst hasFixedToolbar = getPreference( editSiteStore.name, 'fixedToolbar' );\n\n\tconst {\n\t\t__experimentalSetPreviewDeviceType: setPreviewDeviceType,\n\t\tsetIsInserterOpened,\n\t\tsetIsListViewOpened,\n\t} = useDispatch( editSiteStore );\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\tconst disableMotion = useReducedMotion();\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpen, setIsInserterOpened ] );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\n\tconst isFocusMode =\n\t\ttemplateType === 'wp_template_part' || templateType === 'wp_navigation';\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpen ? __( 'Add' ) : __( 'Close' );\n\n\tconst isZoomedOutViewExperimentEnabled =\n\t\twindow?.__experimentalEnableZoomedOutView && isVisualMode;\n\tconst isZoomedOutView = blockEditorMode === 'zoom-out';\n\n\tconst toolbarVariants = {\n\t\tisDistractionFree: { y: '-50px' },\n\t\tisDistractionFreeHovering: { y: 0 },\n\t\tview: { y: 0 },\n\t\tedit: { y: 0 },\n\t};\n\n\tconst toolbarTransition = {\n\t\ttype: 'tween',\n\t\tduration: disableMotion ? 0 : 0.2,\n\t\tease: 'easeOut',\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-site-header-edit-mode', {\n\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ hasDefaultEditorCanvasView && (\n\t\t\t\t<NavigableToolbar\n\t\t\t\t\tas={ motion.div }\n\t\t\t\t\tclassName=\"edit-site-header-edit-mode__start\"\n\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t\tshouldUseKeyboardFocusShortcut={\n\t\t\t\t\t\t! blockToolbarCanBeFocused\n\t\t\t\t\t}\n\t\t\t\t\tvariants={ toolbarVariants }\n\t\t\t\t\ttransition={ toolbarTransition }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"edit-site-header-edit-mode__toolbar\">\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\tref={ inserterButton }\n\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__inserter-toggle\"\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\t\t\t\tdisabled={ ! isVisualMode }\n\t\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? shortLabel : longLabel\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ ! hasFixedToolbar && (\n\t\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\tshowIconLabels\n\t\t\t\t\t\t\t\t\t\t\t\t? 'tertiary'\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdisabled={ ! isVisualMode }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ UndoButton }\n\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ RedoButton }\n\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__list-view-toggle\"\n\t\t\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\t\t\t! isVisualMode || isZoomedOutView\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\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\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\tshowIconLabels\n\t\t\t\t\t\t\t\t\t\t\t\t? 'tertiary'\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\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) }\n\t\t\t\t\t\t\t\t{ isZoomedOutViewExperimentEnabled &&\n\t\t\t\t\t\t\t\t\t! isDistractionFree &&\n\t\t\t\t\t\t\t\t\t! hasFixedToolbar && (\n\t\t\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__zoom-out-view-toggle\"\n\t\t\t\t\t\t\t\t\t\t\ticon={ chevronUpDown }\n\t\t\t\t\t\t\t\t\t\t\tisPressed={ isZoomedOutView }\n\t\t\t\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\t\t\t\tlabel={ __( 'Zoom-out View' ) }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tsetPreviewDeviceType(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'desktop'\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t__unstableSetEditorMode(\n\t\t\t\t\t\t\t\t\t\t\t\t\tisZoomedOutView\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 'edit'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'zoom-out'\n\t\t\t\t\t\t\t\t\t\t\t\t);\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) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</NavigableToolbar>\n\t\t\t) }\n\n\t\t\t{ ! isDistractionFree && (\n\t\t\t\t<div className=\"edit-site-header-edit-mode__center\">\n\t\t\t\t\t{ ! hasDefaultEditorCanvasView ? (\n\t\t\t\t\t\tgetEditorCanvasContainerTitle( editorCanvasView )\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<DocumentActions />\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t<div className=\"edit-site-header-edit-mode__end\">\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-site-header-edit-mode__actions\"\n\t\t\t\t\tvariants={ toolbarVariants }\n\t\t\t\t\ttransition={ toolbarTransition }\n\t\t\t\t>\n\t\t\t\t\t{ ! isFocusMode && hasDefaultEditorCanvasView && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'edit-site-header-edit-mode__preview-options',\n\t\t\t\t\t\t\t\t{ 'is-zoomed-out': isZoomedOutView }\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PreviewOptions\n\t\t\t\t\t\t\t\tdeviceType={ deviceType }\n\t\t\t\t\t\t\t\tsetDeviceType={ setPreviewDeviceType }\n\t\t\t\t\t\t\t\tlabel={ __( 'View' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t</PreviewOptions>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t) }\n\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t</motion.div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/header-edit-mode/index.js"],"names":["useShouldContextualToolbarShow","blockEditorPrivateApis","preventDefault","event","HeaderEditMode","inserterButton","deviceType","templateType","isInserterOpen","isListViewOpen","listViewShortcut","isVisualMode","isDistractionFree","blockEditorMode","homeUrl","showIconLabels","editorCanvasView","hasFixedToolbar","select","__experimentalGetPreviewDeviceType","getEditedPostType","isInserterOpened","isListViewOpened","getEditorMode","editSiteStore","getShortcutRepresentation","keyboardShortcutsStore","__unstableGetEditorMode","blockEditorStore","postType","getUnstableBase","coreStore","get","getPreference","preferencesStore","home","name","getEditorCanvasContainerView","__experimentalSetPreviewDeviceType","setPreviewDeviceType","setIsInserterOpened","setIsListViewOpened","__unstableSetEditorMode","disableMotion","isLargeViewport","toggleInserter","current","focus","toggleListView","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","hasDefaultEditorCanvasView","isFocusMode","longLabel","shortLabel","isZoomedOutViewExperimentEnabled","window","__experimentalEnableZoomedOutView","isZoomedOutView","toolbarVariants","y","isDistractionFreeHovering","view","edit","toolbarTransition","type","duration","ease","motion","div","Button","plus","ToolSelector","undefined","UndoButton","RedoButton","listView","chevronUpDown","onClose","external"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AA9CA;AACA;AACA;;AAGA;AACA;AACA;;AA0BA;AACA;AACA;AAaA,MAAM;AAAEA,EAAAA;AAAF,IAAqC,wBAAQC,wBAAR,CAA3C;;AAEA,MAAMC,cAAc,GAAKC,KAAF,IAAa;AACnCA,EAAAA,KAAK,CAACD,cAAN;AACA,CAFD;;AAIe,SAASE,cAAT,GAA0B;AACxC,QAAMC,cAAc,GAAG,sBAAvB;AACA,QAAM;AACLC,IAAAA,UADK;AAELC,IAAAA,YAFK;AAGLC,IAAAA,cAH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,cAAI,WAAJ,CANH,EAOC,4BAAC,0BAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB;AAEE;AACA,gBAAI,sBAAJ,CAHF,CAPD,CADD,CANF,CAND,CANF,EAsCC,4BAAC,mBAAD,OAtCD,EAuCG,CAAEpE,iBAAF,IACD,4BAAC,sBAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IAxCF,EA0CC,4BAAC,iBAAD;AAAU,IAAA,cAAc,EAAGG;AAA3B,IA1CD,CADD,CAzHD,CADD;AA0KA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch, useReducedMotion } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tToolSelector,\n\t__experimentalPreviewOptions as PreviewOptions,\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { PinnedItems } from '@wordpress/interface';\nimport { _x, __ } from '@wordpress/i18n';\nimport { listView, plus, external, chevronUpDown } from '@wordpress/icons';\nimport {\n\t__unstableMotion as motion,\n\tButton,\n\tToolbarItem,\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport MoreMenu from './more-menu';\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport DocumentActions from './document-actions';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport { unlock } from '../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nexport default function HeaderEditMode() {\n\tconst inserterButton = useRef();\n\tconst {\n\t\tdeviceType,\n\t\ttemplateType,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tisVisualMode,\n\t\tisDistractionFree,\n\t\tblockEditorMode,\n\t\thomeUrl,\n\t\tshowIconLabels,\n\t\teditorCanvasView,\n\t\thasFixedToolbar,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetEditedPostType,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\tgetEditorMode,\n\t\t} = select( editSiteStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\tconst postType = getEditedPostType();\n\n\t\tconst {\n\t\t\tgetUnstableBase, // Site index.\n\t\t} = select( coreStore );\n\n\t\tconst { get: getPreference } = select( preferencesStore );\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\ttemplateType: postType,\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-site/toggle-list-view'\n\t\t\t),\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t\tshowIconLabels: getPreference(\n\t\t\t\teditSiteStore.name,\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\teditorCanvasView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t\tisDistractionFree: getPreference(\n\t\t\t\teditSiteStore.name,\n\t\t\t\t'distractionFree'\n\t\t\t),\n\t\t\thasFixedToolbar: getPreference(\n\t\t\t\teditSiteStore.name,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\t__experimentalSetPreviewDeviceType: setPreviewDeviceType,\n\t\tsetIsInserterOpened,\n\t\tsetIsListViewOpened,\n\t} = useDispatch( editSiteStore );\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\tconst disableMotion = useReducedMotion();\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpen, setIsInserterOpened ] );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\n\tconst isFocusMode =\n\t\ttemplateType === 'wp_template_part' || templateType === 'wp_navigation';\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpen ? __( 'Add' ) : __( 'Close' );\n\n\tconst isZoomedOutViewExperimentEnabled =\n\t\twindow?.__experimentalEnableZoomedOutView && isVisualMode;\n\tconst isZoomedOutView = blockEditorMode === 'zoom-out';\n\n\tconst toolbarVariants = {\n\t\tisDistractionFree: { y: '-50px' },\n\t\tisDistractionFreeHovering: { y: 0 },\n\t\tview: { y: 0 },\n\t\tedit: { y: 0 },\n\t};\n\n\tconst toolbarTransition = {\n\t\ttype: 'tween',\n\t\tduration: disableMotion ? 0 : 0.2,\n\t\tease: 'easeOut',\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-site-header-edit-mode', {\n\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ hasDefaultEditorCanvasView && (\n\t\t\t\t<NavigableToolbar\n\t\t\t\t\tas={ motion.div }\n\t\t\t\t\tclassName=\"edit-site-header-edit-mode__start\"\n\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t\tshouldUseKeyboardFocusShortcut={\n\t\t\t\t\t\t! blockToolbarCanBeFocused\n\t\t\t\t\t}\n\t\t\t\t\tvariants={ toolbarVariants }\n\t\t\t\t\ttransition={ toolbarTransition }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"edit-site-header-edit-mode__toolbar\">\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\tref={ inserterButton }\n\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__inserter-toggle\"\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\t\t\t\tdisabled={ ! isVisualMode }\n\t\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? shortLabel : longLabel\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ ! hasFixedToolbar && (\n\t\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\tshowIconLabels\n\t\t\t\t\t\t\t\t\t\t\t\t? 'tertiary'\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdisabled={ ! isVisualMode }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ UndoButton }\n\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ RedoButton }\n\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__list-view-toggle\"\n\t\t\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\t\t\t! isVisualMode || isZoomedOutView\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\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\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\tshowIconLabels\n\t\t\t\t\t\t\t\t\t\t\t\t? 'tertiary'\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\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) }\n\t\t\t\t\t\t\t\t{ isZoomedOutViewExperimentEnabled &&\n\t\t\t\t\t\t\t\t\t! isDistractionFree &&\n\t\t\t\t\t\t\t\t\t! hasFixedToolbar && (\n\t\t\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__zoom-out-view-toggle\"\n\t\t\t\t\t\t\t\t\t\t\ticon={ chevronUpDown }\n\t\t\t\t\t\t\t\t\t\t\tisPressed={ isZoomedOutView }\n\t\t\t\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\t\t\t\tlabel={ __( 'Zoom-out View' ) }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tsetPreviewDeviceType(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'desktop'\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t__unstableSetEditorMode(\n\t\t\t\t\t\t\t\t\t\t\t\t\tisZoomedOutView\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 'edit'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'zoom-out'\n\t\t\t\t\t\t\t\t\t\t\t\t);\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) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</NavigableToolbar>\n\t\t\t) }\n\n\t\t\t{ ! isDistractionFree && (\n\t\t\t\t<div className=\"edit-site-header-edit-mode__center\">\n\t\t\t\t\t{ ! hasDefaultEditorCanvasView ? (\n\t\t\t\t\t\tgetEditorCanvasContainerTitle( editorCanvasView )\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<DocumentActions />\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t<div className=\"edit-site-header-edit-mode__end\">\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-site-header-edit-mode__actions\"\n\t\t\t\t\tvariants={ toolbarVariants }\n\t\t\t\t\ttransition={ toolbarTransition }\n\t\t\t\t>\n\t\t\t\t\t{ ! isFocusMode && hasDefaultEditorCanvasView && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'edit-site-header-edit-mode__preview-options',\n\t\t\t\t\t\t\t\t{ 'is-zoomed-out': isZoomedOutView }\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PreviewOptions\n\t\t\t\t\t\t\t\tdeviceType={ deviceType }\n\t\t\t\t\t\t\t\tsetDeviceType={ setPreviewDeviceType }\n\t\t\t\t\t\t\t\tlabel={ __( 'View' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</PreviewOptions>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t) }\n\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t</motion.div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -141,7 +141,8 @@ function Layout() {
|
|
|
141
141
|
const [canvasResizer, canvasSize] = (0, _compose.useResizeObserver)();
|
|
142
142
|
const [fullResizer] = (0, _compose.useResizeObserver)();
|
|
143
143
|
const [isResizing] = (0, _element.useState)(false);
|
|
144
|
-
const isEditorLoading = (0, _hooks.useIsSiteEditorLoading)();
|
|
144
|
+
const isEditorLoading = (0, _hooks.useIsSiteEditorLoading)();
|
|
145
|
+
const [isResizableFrameOversized, setIsResizableFrameOversized] = (0, _element.useState)(false); // This determines which animation variant should apply to the header.
|
|
145
146
|
// There is also a `isDistractionFreeHovering` state that gets priority
|
|
146
147
|
// when hovering the `edit-site-layout__header-container` in distraction
|
|
147
148
|
// free mode. It's set via framer and trickles down to all the children
|
|
@@ -230,6 +231,7 @@ function Layout() {
|
|
|
230
231
|
}
|
|
231
232
|
},
|
|
232
233
|
ref: hubRef,
|
|
234
|
+
isTransparent: isResizableFrameOversized,
|
|
233
235
|
className: "edit-site-layout__hub"
|
|
234
236
|
}), (0, _element.createElement)(_components.__unstableAnimatePresence, {
|
|
235
237
|
initial: false
|
|
@@ -302,7 +304,9 @@ function Layout() {
|
|
|
302
304
|
} : {},
|
|
303
305
|
initial: false,
|
|
304
306
|
layout: "position",
|
|
305
|
-
className:
|
|
307
|
+
className: (0, _classnames.default)('edit-site-layout__canvas', {
|
|
308
|
+
'is-right-aligned': isResizableFrameOversized
|
|
309
|
+
}),
|
|
306
310
|
transition: {
|
|
307
311
|
type: 'tween',
|
|
308
312
|
duration: disableMotion || isResizing ? 0 : ANIMATION_DURATION,
|
|
@@ -311,7 +315,8 @@ function Layout() {
|
|
|
311
315
|
}, (0, _element.createElement)(_errorBoundary.default, null, (0, _element.createElement)(_resizableFrame.default, {
|
|
312
316
|
isReady: !isEditorLoading,
|
|
313
317
|
isFullWidth: isEditing,
|
|
314
|
-
|
|
318
|
+
isOversized: isResizableFrameOversized,
|
|
319
|
+
setIsOversized: setIsResizableFrameOversized,
|
|
315
320
|
innerContentStyle: {
|
|
316
321
|
background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor
|
|
317
322
|
}
|