@wordpress/edit-site 5.11.0 → 5.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/add-new-page/index.js +105 -0
- package/build/components/add-new-page/index.js.map +1 -0
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +4 -5
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +19 -22
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/index.js +4 -5
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +9 -12
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +19 -26
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/add-new-template/utils.js +71 -120
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/block-editor/back-button.js +1 -3
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/block-inspector-button.js +3 -4
- package/build/components/block-editor/block-inspector-button.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +6 -7
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +13 -10
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/inserter-media-categories.js +25 -42
- package/build/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +6 -7
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +5 -7
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/code-editor/code-editor-text-area.js +5 -6
- package/build/components/code-editor/code-editor-text-area.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +25 -29
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +26 -17
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +7 -8
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/error-boundary/warning.js +8 -10
- package/build/components/error-boundary/warning.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +7 -10
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/color-indicator-wrapper.js +4 -5
- package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +3 -4
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +1 -3
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +8 -10
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +3 -4
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/header.js +4 -5
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/icon-with-current-color.js +4 -5
- package/build/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +5 -6
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +10 -14
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +41 -51
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +4 -7
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +9 -10
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +3 -4
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +8 -8
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +14 -19
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +5 -11
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/screen-root.js +3 -3
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +3 -4
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +5 -6
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +5 -6
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/subtitle.js +4 -5
- package/build/components/global-styles/subtitle.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +4 -5
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +5 -6
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/ui.js +40 -21
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +5 -6
- package/build/components/global-styles/variations-panel.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +102 -23
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +2 -6
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +49 -53
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/header-edit-mode/tools-more-menu-group/index.js +5 -14
- package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +41 -51
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/layout/index.js +4 -12
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +13 -23
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/header.js +4 -7
- package/build/components/list/header.js.map +1 -1
- package/build/components/list/index.js +2 -4
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +35 -40
- package/build/components/list/table.js.map +1 -1
- package/build/components/page-actions/delete-page-menu-item.js +70 -0
- package/build/components/page-actions/delete-page-menu-item.js.map +1 -0
- package/build/components/page-actions/index.js +43 -0
- package/build/components/page-actions/index.js.map +1 -0
- package/build/components/page-content-lock/constants.js +9 -0
- package/build/components/page-content-lock/constants.js.map +1 -0
- package/build/components/page-content-lock/index.js +29 -0
- package/build/components/page-content-lock/index.js.map +1 -0
- package/build/components/page-content-lock/use-disable-non-content-blocks.js +49 -0
- package/build/components/page-content-lock/use-disable-non-content-blocks.js.map +1 -0
- package/build/components/page-content-lock/use-page-content-lock-notifications.js +112 -0
- package/build/components/page-content-lock/use-page-content-lock-notifications.js.map +1 -0
- package/build/components/preferences-modal/index.js +4 -5
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +20 -12
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/revisions/index.js +11 -14
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/routes/link.js +8 -12
- package/build/components/routes/link.js.map +1 -1
- package/build/components/routes/use-title.js +1 -5
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/save-button/index.js +13 -7
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +97 -5
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-panel/index.js +63 -17
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +8 -3
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +7 -5
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/default-sidebar.js +11 -12
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +13 -10
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/content-blocks-list.js +79 -0
- package/build/components/sidebar-edit-mode/page-panels/content-blocks-list.js.map +1 -0
- package/build/components/sidebar-edit-mode/page-panels/index.js +86 -0
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +4 -5
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +39 -21
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/sidebar-card/index.js +46 -0
- package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +3 -4
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
- package/build/components/sidebar-edit-mode/{template-card → template-panel}/index.js +22 -18
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +7 -8
- package/{build-module/components/sidebar-edit-mode/template-revisions/index.js.map → build/components/sidebar-edit-mode/template-panel/last-revision.js.map} +1 -1
- package/build/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +12 -16
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -0
- package/build/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +15 -19
- package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -0
- package/build/components/sidebar-navigation-item/index.js +7 -8
- package/build/components/sidebar-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +21 -14
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +103 -13
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +3 -5
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +7 -10
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +17 -23
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +20 -23
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +4 -5
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +8 -9
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +81 -10
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/page-details.js +148 -0
- package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -0
- package/build/components/sidebar-navigation-screen-page/status-label.js +110 -0
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pages/index.js +128 -17
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +22 -16
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template-part/index.js +105 -0
- package/build/components/sidebar-navigation-screen-template-part/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +13 -18
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-subtitle/index.js +3 -4
- package/build/components/sidebar-navigation-subtitle/index.js.map +1 -1
- package/build/components/site-hub/index.js +20 -13
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +4 -5
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/start-template-options/index.js +15 -21
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +35 -39
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
- 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 +9 -10
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/{list/actions → template-actions}/index.js +34 -31
- package/build/components/template-actions/index.js.map +1 -0
- package/build/components/{list/actions → template-actions}/rename-menu-item.js +4 -5
- package/build/components/template-actions/rename-menu-item.js.map +1 -0
- package/build/components/template-part-converter/convert-to-regular.js +4 -5
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +8 -10
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/template-part-converter/index.js +12 -18
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/welcome-guide/image.js +4 -5
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +6 -8
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +11 -8
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/template-part-edit.js +5 -6
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +3 -6
- package/build/index.js.map +1 -1
- package/build/store/actions.js +129 -125
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +7 -10
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js +32 -33
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +35 -11
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +1 -3
- package/build/store/utils.js.map +1 -1
- package/build/utils/get-is-list-page.js +3 -4
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/is-previewing-theme.js +1 -3
- package/build/utils/is-previewing-theme.js.map +1 -1
- package/build/utils/is-template-revertable.js +1 -1
- package/build/utils/is-template-revertable.js.map +1 -1
- package/build-module/components/add-new-page/index.js +93 -0
- package/build-module/components/add-new-page/index.js.map +1 -0
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +4 -5
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +19 -22
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/index.js +4 -5
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +9 -12
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +18 -26
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +71 -120
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +1 -3
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/block-inspector-button.js +3 -4
- package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +6 -7
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +12 -10
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js +25 -42
- package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +6 -7
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +5 -7
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/code-editor/code-editor-text-area.js +5 -6
- package/build-module/components/code-editor/code-editor-text-area.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +25 -29
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +26 -17
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +7 -8
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/error-boundary/warning.js +8 -10
- package/build-module/components/error-boundary/warning.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +7 -10
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/color-indicator-wrapper.js +4 -5
- package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +3 -4
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +1 -3
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +8 -10
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +3 -4
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/header.js +4 -5
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/icon-with-current-color.js +4 -5
- package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +5 -6
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +10 -14
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +41 -51
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +4 -7
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +9 -10
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +3 -4
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +8 -8
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +14 -19
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +5 -10
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +3 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +3 -4
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +5 -6
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +5 -6
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/subtitle.js +4 -5
- package/build-module/components/global-styles/subtitle.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +4 -5
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +5 -6
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/ui.js +40 -21
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +5 -6
- package/build-module/components/global-styles/variations-panel.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +102 -24
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +2 -6
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +49 -53
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +5 -13
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +39 -49
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/layout/index.js +4 -12
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +13 -23
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/header.js +4 -7
- package/build-module/components/list/header.js.map +1 -1
- package/build-module/components/list/index.js +2 -4
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +34 -39
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/page-actions/delete-page-menu-item.js +58 -0
- package/build-module/components/page-actions/delete-page-menu-item.js.map +1 -0
- package/build-module/components/page-actions/index.js +30 -0
- package/build-module/components/page-actions/index.js.map +1 -0
- package/build-module/components/page-content-lock/constants.js +2 -0
- package/build-module/components/page-content-lock/constants.js.map +1 -0
- package/build-module/components/page-content-lock/index.js +14 -0
- package/build-module/components/page-content-lock/index.js.map +1 -0
- package/build-module/components/page-content-lock/use-disable-non-content-blocks.js +36 -0
- package/build-module/components/page-content-lock/use-disable-non-content-blocks.js.map +1 -0
- package/build-module/components/page-content-lock/use-page-content-lock-notifications.js +98 -0
- package/build-module/components/page-content-lock/use-page-content-lock-notifications.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +4 -5
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +20 -12
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/revisions/index.js +11 -13
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/routes/link.js +8 -12
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/routes/use-title.js +1 -5
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/save-button/index.js +13 -7
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +95 -8
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +62 -19
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +9 -3
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +6 -5
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/default-sidebar.js +11 -12
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +14 -11
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/content-blocks-list.js +67 -0
- package/build-module/components/sidebar-edit-mode/page-panels/content-blocks-list.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +67 -0
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +4 -5
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +36 -22
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +35 -0
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +3 -4
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/index.js +20 -19
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +7 -8
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +12 -16
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +15 -19
- package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -0
- package/build-module/components/sidebar-navigation-item/index.js +7 -8
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +22 -15
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +104 -14
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +3 -5
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +7 -10
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +17 -23
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +20 -23
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +4 -5
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +8 -9
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +79 -14
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/page-details.js +131 -0
- package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +97 -0
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pages/index.js +125 -19
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +22 -17
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template-part/index.js +86 -0
- package/build-module/components/sidebar-navigation-screen-template-part/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +13 -18
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-subtitle/index.js +3 -4
- package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +21 -14
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +4 -5
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +15 -21
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +35 -39
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
- 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 +9 -10
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/{list/actions → template-actions}/index.js +34 -31
- package/build-module/components/template-actions/index.js.map +1 -0
- package/build-module/components/{list/actions → template-actions}/rename-menu-item.js +4 -5
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -0
- package/build-module/components/template-part-converter/convert-to-regular.js +4 -5
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +8 -10
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +12 -18
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/welcome-guide/image.js +4 -5
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +6 -8
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +11 -8
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +5 -6
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +3 -6
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +125 -126
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +7 -10
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/reducer.js +30 -33
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +31 -11
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +1 -3
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +3 -4
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/is-previewing-theme.js +1 -3
- package/build-module/utils/is-previewing-theme.js.map +1 -1
- package/build-module/utils/is-template-revertable.js +1 -1
- package/build-module/utils/is-template-revertable.js.map +1 -1
- package/build-style/style-rtl.css +281 -59
- package/build-style/style.css +281 -59
- package/package.json +39 -36
- package/src/components/add-new-page/index.js +105 -0
- package/src/components/add-new-template/new-template.js +2 -1
- package/src/components/block-editor/index.js +25 -14
- package/src/components/editor/index.js +14 -8
- package/src/components/editor/style.scss +6 -11
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +7 -5
- package/src/components/global-styles/ui.js +28 -0
- package/src/components/header-edit-mode/document-actions/index.js +126 -32
- package/src/components/header-edit-mode/document-actions/style.scss +64 -9
- package/src/components/header-edit-mode/tools-more-menu-group/index.js +1 -6
- package/src/components/layout/index.js +3 -9
- package/src/components/list/table.js +6 -2
- package/src/components/page-actions/delete-page-menu-item.js +71 -0
- package/src/components/page-actions/index.js +36 -0
- package/src/components/page-content-lock/constants.js +5 -0
- package/src/components/page-content-lock/index.js +14 -0
- package/src/components/page-content-lock/use-disable-non-content-blocks.js +44 -0
- package/src/components/page-content-lock/use-page-content-lock-notifications.js +128 -0
- package/src/components/resizable-frame/index.js +15 -5
- package/src/components/resizable-frame/style.scss +20 -18
- package/src/components/revisions/index.js +6 -7
- package/src/components/save-button/index.js +6 -0
- package/src/components/save-hub/index.js +143 -38
- package/src/components/save-hub/style.scss +6 -0
- package/src/components/save-panel/index.js +62 -15
- package/src/components/secondary-sidebar/list-view-sidebar.js +8 -1
- package/src/components/sidebar/index.js +6 -4
- package/src/components/sidebar/style.scss +3 -4
- package/src/components/sidebar-edit-mode/index.js +16 -14
- package/src/components/sidebar-edit-mode/page-panels/content-blocks-list.js +77 -0
- package/src/components/sidebar-edit-mode/page-panels/index.js +89 -0
- package/src/components/sidebar-edit-mode/page-panels/style.scss +10 -0
- package/src/components/sidebar-edit-mode/settings-header/index.js +51 -28
- package/src/components/sidebar-edit-mode/sidebar-card/index.js +34 -0
- package/src/components/sidebar-edit-mode/sidebar-card/style.scss +34 -0
- package/src/components/sidebar-edit-mode/{template-card → template-panel}/index.js +22 -19
- package/src/components/sidebar-edit-mode/{template-card → template-panel}/style.scss +2 -32
- package/src/components/sidebar-navigation-screen/index.js +74 -50
- package/src/components/sidebar-navigation-screen/style.scss +45 -4
- package/src/components/sidebar-navigation-screen-global-styles/index.js +118 -12
- package/src/components/sidebar-navigation-screen-global-styles/style.scss +15 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +1 -1
- package/src/components/sidebar-navigation-screen-page/index.js +137 -24
- package/src/components/sidebar-navigation-screen-page/page-details.js +163 -0
- package/src/components/sidebar-navigation-screen-page/status-label.js +101 -0
- package/src/components/sidebar-navigation-screen-page/style.scss +80 -0
- package/src/components/sidebar-navigation-screen-pages/index.js +180 -44
- package/src/components/sidebar-navigation-screen-template/index.js +25 -22
- package/src/components/sidebar-navigation-screen-template-part/index.js +103 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +1 -1
- package/src/components/sidebar-navigation-subtitle/style.scss +2 -2
- package/src/components/site-hub/index.js +21 -6
- package/src/components/site-hub/style.scss +26 -0
- package/src/components/{list/actions → template-actions}/index.js +19 -6
- package/src/hooks/push-changes-to-global-styles/index.js +13 -7
- package/src/store/actions.js +20 -1
- package/src/store/reducer.js +20 -0
- package/src/store/selectors.js +24 -0
- package/src/store/test/actions.js +31 -0
- package/src/store/test/reducer.js +44 -0
- package/src/store/test/selectors.js +57 -0
- package/src/style.scss +5 -2
- package/src/utils/is-previewing-theme.js +1 -4
- package/build/components/list/actions/index.js.map +0 -1
- package/build/components/list/actions/rename-menu-item.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-card/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-card/template-actions.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-card/template-areas.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-revisions/index.js.map +0 -1
- package/build-module/components/list/actions/index.js.map +0 -1
- package/build-module/components/list/actions/rename-menu-item.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-card/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-card/template-actions.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-card/template-areas.js.map +0 -1
- package/src/components/sidebar-navigation-screen-pages/style.scss +0 -4
- /package/src/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +0 -0
- /package/src/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +0 -0
- /package/src/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +0 -0
- /package/src/components/{list/actions → template-actions}/rename-menu-item.js +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PageContentLock = PageContentLock;
|
|
7
|
+
Object.defineProperty(exports, "usePageContentLockNotifications", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _usePageContentLockNotifications.usePageContentLockNotifications;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
var _useDisableNonContentBlocks = require("./use-disable-non-content-blocks");
|
|
15
|
+
|
|
16
|
+
var _usePageContentLockNotifications = require("./use-page-content-lock-notifications");
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Component that when rendered, locks the site editor so that only page content
|
|
24
|
+
* can be edited.
|
|
25
|
+
*/
|
|
26
|
+
function PageContentLock() {
|
|
27
|
+
(0, _useDisableNonContentBlocks.useDisableNonContentBlocks)();
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-content-lock/index.js"],"names":["PageContentLock"],"mappings":";;;;;;;;;;;;;AAGA;;AAUA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACO,SAASA,eAAT,GAA2B;AACjC;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useDisableNonContentBlocks } from './use-disable-non-content-blocks';\n\n/**\n * Component that when rendered, locks the site editor so that only page content\n * can be edited.\n */\nexport function PageContentLock() {\n\tuseDisableNonContentBlocks();\n}\n\nexport { usePageContentLockNotifications } from './use-page-content-lock-notifications';\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useDisableNonContentBlocks = useDisableNonContentBlocks;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _compose = require("@wordpress/compose");
|
|
11
|
+
|
|
12
|
+
var _hooks = require("@wordpress/hooks");
|
|
13
|
+
|
|
14
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
15
|
+
|
|
16
|
+
var _privateApis = require("../../private-apis");
|
|
17
|
+
|
|
18
|
+
var _constants = require("./constants");
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* WordPress dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Internal dependencies
|
|
26
|
+
*/
|
|
27
|
+
const {
|
|
28
|
+
useBlockEditingMode
|
|
29
|
+
} = (0, _privateApis.unlock)(_blockEditor.privateApis);
|
|
30
|
+
/**
|
|
31
|
+
* Disables non-content blocks using the `useBlockEditingMode` hook.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
function useDisableNonContentBlocks() {
|
|
35
|
+
useBlockEditingMode('disabled');
|
|
36
|
+
(0, _element.useEffect)(() => {
|
|
37
|
+
(0, _hooks.addFilter)('editor.BlockEdit', 'core/edit-site/disable-non-content-blocks', withDisableNonContentBlocks);
|
|
38
|
+
return () => (0, _hooks.removeFilter)('editor.BlockEdit', 'core/edit-site/disable-non-content-blocks');
|
|
39
|
+
}, []);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const withDisableNonContentBlocks = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
|
|
43
|
+
const isContent = _constants.CONTENT_BLOCK_TYPES.includes(props.name);
|
|
44
|
+
|
|
45
|
+
const mode = isContent ? 'contentOnly' : undefined;
|
|
46
|
+
useBlockEditingMode(mode);
|
|
47
|
+
return (0, _element.createElement)(BlockEdit, props);
|
|
48
|
+
}, 'withBlockEditingMode');
|
|
49
|
+
//# sourceMappingURL=use-disable-non-content-blocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-content-lock/use-disable-non-content-blocks.js"],"names":["useBlockEditingMode","blockEditorPrivateApis","useDisableNonContentBlocks","withDisableNonContentBlocks","BlockEdit","props","isContent","CONTENT_BLOCK_TYPES","includes","name","mode","undefined"],"mappings":";;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAMA;;AACA;;AAZA;AACA;AACA;;AAMA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAA0B,yBAAQC,wBAAR,CAAhC;AAEA;AACA;AACA;;AACO,SAASC,0BAAT,GAAsC;AAC5CF,EAAAA,mBAAmB,CAAE,UAAF,CAAnB;AACA,0BAAW,MAAM;AAChB,0BACC,kBADD,EAEC,2CAFD,EAGCG,2BAHD;AAKA,WAAO,MACN,yBACC,kBADD,EAEC,2CAFD,CADD;AAKA,GAXD,EAWG,EAXH;AAYA;;AAED,MAAMA,2BAA2B,GAAG,yCACjCC,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAMC,SAAS,GAAGC,+BAAoBC,QAApB,CAA8BH,KAAK,CAACI,IAApC,CAAlB;;AACA,QAAMC,IAAI,GAAGJ,SAAS,GAAG,aAAH,GAAmBK,SAAzC;AACAX,EAAAA,mBAAmB,CAAEU,IAAF,CAAnB;AACA,SAAO,4BAAC,SAAD,EAAgBL,KAAhB,CAAP;AACA,CANkC,EAOnC,sBAPmC,CAApC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter, removeFilter } from '@wordpress/hooks';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { CONTENT_BLOCK_TYPES } from './constants';\n\nconst { useBlockEditingMode } = unlock( blockEditorPrivateApis );\n\n/**\n * Disables non-content blocks using the `useBlockEditingMode` hook.\n */\nexport function useDisableNonContentBlocks() {\n\tuseBlockEditingMode( 'disabled' );\n\tuseEffect( () => {\n\t\taddFilter(\n\t\t\t'editor.BlockEdit',\n\t\t\t'core/edit-site/disable-non-content-blocks',\n\t\t\twithDisableNonContentBlocks\n\t\t);\n\t\treturn () =>\n\t\t\tremoveFilter(\n\t\t\t\t'editor.BlockEdit',\n\t\t\t\t'core/edit-site/disable-non-content-blocks'\n\t\t\t);\n\t}, [] );\n}\n\nconst withDisableNonContentBlocks = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst isContent = CONTENT_BLOCK_TYPES.includes( props.name );\n\t\tconst mode = isContent ? 'contentOnly' : undefined;\n\t\tuseBlockEditingMode( mode );\n\t\treturn <BlockEdit { ...props } />;\n\t},\n\t'withBlockEditingMode'\n);\n"]}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.usePageContentLockNotifications = usePageContentLockNotifications;
|
|
7
|
+
|
|
8
|
+
var _data = require("@wordpress/data");
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _notices = require("@wordpress/notices");
|
|
13
|
+
|
|
14
|
+
var _i18n = require("@wordpress/i18n");
|
|
15
|
+
|
|
16
|
+
var _compose = require("@wordpress/compose");
|
|
17
|
+
|
|
18
|
+
var _store = require("../../store");
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* WordPress dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Internal dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Hook that displays notifications that guide the user towards using the
|
|
30
|
+
* content vs. template editing modes.
|
|
31
|
+
*
|
|
32
|
+
* @return {import('react').RefObject<HTMLElement>} Ref which should be passed
|
|
33
|
+
* (using useMergeRefs()) to
|
|
34
|
+
* the editor iframe canvas.
|
|
35
|
+
*/
|
|
36
|
+
function usePageContentLockNotifications() {
|
|
37
|
+
const ref = useEditTemplateNotification();
|
|
38
|
+
useBackToPageNotification();
|
|
39
|
+
return ref;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Hook that displays a 'Edit your template to edit this block' notification
|
|
43
|
+
* when the user is focusing on editing page content and clicks on a locked
|
|
44
|
+
* template block.
|
|
45
|
+
*
|
|
46
|
+
* @return {import('react').RefObject<HTMLElement>} Ref which should be passed
|
|
47
|
+
* (using useMergeRefs()) to
|
|
48
|
+
* the editor iframe canvas.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
function useEditTemplateNotification() {
|
|
53
|
+
const hasPageContentLock = (0, _data.useSelect)(select => select(_store.store).hasPageContentLock(), []);
|
|
54
|
+
const alreadySeen = (0, _element.useRef)(false);
|
|
55
|
+
const {
|
|
56
|
+
createInfoNotice
|
|
57
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
58
|
+
const {
|
|
59
|
+
setHasPageContentLock
|
|
60
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
61
|
+
return (0, _compose.useRefEffect)(node => {
|
|
62
|
+
const handleClick = event => {
|
|
63
|
+
if (!alreadySeen.current && hasPageContentLock && event.target.classList.contains('is-root-container')) {
|
|
64
|
+
createInfoNotice((0, _i18n.__)('Edit your template to edit this block'), {
|
|
65
|
+
isDismissible: true,
|
|
66
|
+
type: 'snackbar',
|
|
67
|
+
actions: [{
|
|
68
|
+
label: (0, _i18n.__)('Edit template'),
|
|
69
|
+
onClick: () => setHasPageContentLock(false)
|
|
70
|
+
}]
|
|
71
|
+
});
|
|
72
|
+
alreadySeen.current = true;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
node.addEventListener('click', handleClick);
|
|
77
|
+
return () => node.removeEventListener('click', handleClick);
|
|
78
|
+
}, [hasPageContentLock, alreadySeen, createInfoNotice, setHasPageContentLock]);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Hook that displays a 'You are editing a template' notification when the user
|
|
82
|
+
* switches from focusing on editing page content to editing a template.
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
function useBackToPageNotification() {
|
|
87
|
+
const hasPageContentLock = (0, _data.useSelect)(select => select(_store.store).hasPageContentLock(), []);
|
|
88
|
+
const alreadySeen = (0, _element.useRef)(false);
|
|
89
|
+
const prevHasPageContentLock = (0, _element.useRef)(false);
|
|
90
|
+
const {
|
|
91
|
+
createInfoNotice
|
|
92
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
93
|
+
const {
|
|
94
|
+
setHasPageContentLock
|
|
95
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
96
|
+
(0, _element.useEffect)(() => {
|
|
97
|
+
if (!alreadySeen.current && prevHasPageContentLock.current && !hasPageContentLock) {
|
|
98
|
+
createInfoNotice((0, _i18n.__)('You are editing a template'), {
|
|
99
|
+
isDismissible: true,
|
|
100
|
+
type: 'snackbar',
|
|
101
|
+
actions: [{
|
|
102
|
+
label: (0, _i18n.__)('Back to page'),
|
|
103
|
+
onClick: () => setHasPageContentLock(true)
|
|
104
|
+
}]
|
|
105
|
+
});
|
|
106
|
+
alreadySeen.current = true;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
prevHasPageContentLock.current = hasPageContentLock;
|
|
110
|
+
}, [alreadySeen, prevHasPageContentLock, hasPageContentLock, createInfoNotice, setHasPageContentLock]);
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=use-page-content-lock-notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-content-lock/use-page-content-lock-notifications.js"],"names":["usePageContentLockNotifications","ref","useEditTemplateNotification","useBackToPageNotification","hasPageContentLock","select","editSiteStore","alreadySeen","createInfoNotice","noticesStore","setHasPageContentLock","node","handleClick","event","current","target","classList","contains","isDismissible","type","actions","label","onClick","addEventListener","removeEventListener","prevHasPageContentLock"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,+BAAT,GAA2C;AACjD,QAAMC,GAAG,GAAGC,2BAA2B,EAAvC;AACAC,EAAAA,yBAAyB;AACzB,SAAOF,GAAP;AACA;AAED;AACA;AACA;A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CAAwBF,kBAAxB,EADY,EAE1B,EAF0B,CAA3B;AAKA,QAAMG,WAAW,GAAG,qBAAQ,KAAR,CAApB;AACA,QAAMkB,sBAAsB,GAAG,qBAAQ,KAAR,CAA/B;AAEA,QAAM;AAAEjB,IAAAA;AAAF,MAAuB,uBAAaC,cAAb,CAA7B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA4B,uBAAaJ,YAAb,CAAlC;AAEA,0BAAW,MAAM;AAChB,QACC,CAAEC,WAAW,CAACO,OAAd,IACAW,sBAAsB,CAACX,OADvB,IAEA,CAAEV,kBAHH,EAIE;AACDI,MAAAA,gBAAgB,CAAE,cAAI,4BAAJ,CAAF,EAAsC;AACrDU,QAAAA,aAAa,EAAE,IADsC;AAErDC,QAAAA,IAAI,EAAE,UAF+C;AAGrDC,QAAAA,OAAO,EAAE,CACR;AACCC,UAAAA,KAAK,EAAE,cAAI,cAAJ,CADR;AAECC,UAAAA,OAAO,EAAE,MAAMZ,qBAAqB,CAAE,IAAF;AAFrC,SADQ;AAH4C,OAAtC,CAAhB;AAUAH,MAAAA,WAAW,CAACO,OAAZ,GAAsB,IAAtB;AACA;;AACDW,IAAAA,sBAAsB,CAACX,OAAvB,GAAiCV,kBAAjC;AACA,GAnBD,EAmBG,CACFG,WADE,EAEFkB,sBAFE,EAGFrB,kBAHE,EAIFI,gBAJE,EAKFE,qBALE,CAnBH;AA0BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __ } from '@wordpress/i18n';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\n/**\n * Hook that displays notifications that guide the user towards using the\n * content vs. template editing modes.\n *\n * @return {import('react').RefObject<HTMLElement>} Ref which should be passed\n * (using useMergeRefs()) to\n * the editor iframe canvas.\n */\nexport function usePageContentLockNotifications() {\n\tconst ref = useEditTemplateNotification();\n\tuseBackToPageNotification();\n\treturn ref;\n}\n\n/**\n * Hook that displays a 'Edit your template to edit this block' notification\n * when the user is focusing on editing page content and clicks on a locked\n * template block.\n *\n * @return {import('react').RefObject<HTMLElement>} Ref which should be passed\n * (using useMergeRefs()) to\n * the editor iframe canvas.\n */\nfunction useEditTemplateNotification() {\n\tconst hasPageContentLock = useSelect(\n\t\t( select ) => select( editSiteStore ).hasPageContentLock(),\n\t\t[]\n\t);\n\n\tconst alreadySeen = useRef( false );\n\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\tconst { setHasPageContentLock } = useDispatch( editSiteStore );\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tconst handleClick = ( event ) => {\n\t\t\t\tif (\n\t\t\t\t\t! alreadySeen.current &&\n\t\t\t\t\thasPageContentLock &&\n\t\t\t\t\tevent.target.classList.contains( 'is-root-container' )\n\t\t\t\t) {\n\t\t\t\t\tcreateInfoNotice(\n\t\t\t\t\t\t__( 'Edit your template to edit this block' ),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tisDismissible: true,\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlabel: __( 'Edit template' ),\n\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\tsetHasPageContentLock( false ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\talreadySeen.current = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\tnode.addEventListener( 'click', handleClick );\n\t\t\treturn () => node.removeEventListener( 'click', handleClick );\n\t\t},\n\t\t[\n\t\t\thasPageContentLock,\n\t\t\talreadySeen,\n\t\t\tcreateInfoNotice,\n\t\t\tsetHasPageContentLock,\n\t\t]\n\t);\n}\n\n/**\n * Hook that displays a 'You are editing a template' notification when the user\n * switches from focusing on editing page content to editing a template.\n */\nfunction useBackToPageNotification() {\n\tconst hasPageContentLock = useSelect(\n\t\t( select ) => select( editSiteStore ).hasPageContentLock(),\n\t\t[]\n\t);\n\n\tconst alreadySeen = useRef( false );\n\tconst prevHasPageContentLock = useRef( false );\n\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\tconst { setHasPageContentLock } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! alreadySeen.current &&\n\t\t\tprevHasPageContentLock.current &&\n\t\t\t! hasPageContentLock\n\t\t) {\n\t\t\tcreateInfoNotice( __( 'You are editing a template' ), {\n\t\t\t\tisDismissible: true,\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Back to page' ),\n\t\t\t\t\t\tonClick: () => setHasPageContentLock( true ),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t} );\n\t\t\talreadySeen.current = true;\n\t\t}\n\t\tprevHasPageContentLock.current = hasPageContentLock;\n\t}, [\n\t\talreadySeen,\n\t\tprevHasPageContentLock,\n\t\thasPageContentLock,\n\t\tcreateInfoNotice,\n\t\tsetHasPageContentLock,\n\t] );\n}\n"]}
|
|
@@ -22,11 +22,10 @@ var _enableFeature = _interopRequireDefault(require("./enable-feature"));
|
|
|
22
22
|
/**
|
|
23
23
|
* Internal dependencies
|
|
24
24
|
*/
|
|
25
|
-
function EditSitePreferencesModal(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = _ref;
|
|
25
|
+
function EditSitePreferencesModal({
|
|
26
|
+
isModalActive,
|
|
27
|
+
toggleModal
|
|
28
|
+
}) {
|
|
30
29
|
const sections = (0, _element.useMemo)(() => [{
|
|
31
30
|
name: 'general',
|
|
32
31
|
tabLabel: (0, _i18n.__)('General'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/preferences-modal/index.js"],"names":["EditSitePreferencesModal","isModalActive","toggleModal","sections","name","tabLabel","content"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAKA;;AAdA;AACA;AACA;;AASA;AACA;AACA;AAGe,SAASA,wBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/preferences-modal/index.js"],"names":["EditSitePreferencesModal","isModalActive","toggleModal","sections","name","tabLabel","content"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAKA;;AAdA;AACA;AACA;;AASA;AACA;AACA;AAGe,SAASA,wBAAT,CAAmC;AACjDC,EAAAA,aADiD;AAEjDC,EAAAA;AAFiD,CAAnC,EAGX;AACH,QAAMC,QAAQ,GAAG,sBAAS,MAAM,CAC/B;AACCC,IAAAA,IAAI,EAAE,SADP;AAECC,IAAAA,QAAQ,EAAE,cAAI,SAAJ,CAFX;AAGCC,IAAAA,OAAO,EACN,4BAAC,kCAAD;AACC,MAAA,KAAK,EAAG,cAAI,YAAJ,CADT;AAEC,MAAA,WAAW,EAAG,cACb,2EADa;AAFf,OAMC,4BAAC,sBAAD;AACC,MAAA,WAAW,EAAC,WADb;AAEC,MAAA,IAAI,EAAG,cACN,uDADM,CAFR;AAKC,MAAA,KAAK,EAAG,cAAI,gBAAJ;AALT,MAND,EAaC,4BAAC,sBAAD;AACC,MAAA,WAAW,EAAC,gBADb;AAEC,MAAA,KAAK,EAAG,cAAI,yBAAJ,CAFT;AAGC,MAAA,IAAI,EAAG,cAAI,wCAAJ;AAHR,MAbD,EAkBC,4BAAC,sBAAD;AACC,MAAA,WAAW,EAAC,uBADb;AAEC,MAAA,IAAI,EAAG,cACN,+CADM,CAFR;AAKC,MAAA,KAAK,EAAG,cAAI,uBAAJ;AALT,MAlBD,EAyBC,4BAAC,sBAAD;AACC,MAAA,WAAW,EAAC,sBADb;AAEC,MAAA,IAAI,EAAG,cACN,sDADM,CAFR;AAKC,MAAA,KAAK,EAAG,cAAI,2BAAJ;AALT,MAzBD;AAJF,GAD+B,EAwC/B;AACCF,IAAAA,IAAI,EAAE,QADP;AAECC,IAAAA,QAAQ,EAAE,cAAI,QAAJ,CAFX;AAGCC,IAAAA,OAAO,EACN,4BAAC,kCAAD;AACC,MAAA,KAAK,EAAG,cAAI,oBAAJ,CADT;AAEC,MAAA,WAAW,EAAG,cACb,iFADa;AAFf,OAMC,4BAAC,sBAAD;AACC,MAAA,WAAW,EAAC,sBADb;AAEC,MAAA,IAAI,EAAG,cACN,iEADM,CAFR;AAKC,MAAA,KAAK,EAAG,cAAI,kCAAJ;AALT,MAND;AAJF,GAxC+B,CAAf,CAAjB;;AA6DA,MAAK,CAAEL,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AACD,SACC,4BAAC,2BAAD;AAAkB,IAAA,UAAU,EAAGC;AAA/B,KACC,4BAAC,+BAAD;AAAsB,IAAA,QAAQ,EAAGC;AAAjC,IADD,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPreferencesModal,\n\tPreferencesModalTabs,\n\tPreferencesModalSection,\n} from '@wordpress/interface';\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport EnableFeature from './enable-feature';\n\nexport default function EditSitePreferencesModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tconst sections = useMemo( () => [\n\t\t{\n\t\t\tname: 'general',\n\t\t\ttabLabel: __( 'General' ),\n\t\t\tcontent: (\n\t\t\t\t<PreferencesModalSection\n\t\t\t\t\ttitle={ __( 'Appearance' ) }\n\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t'Customize options related to the block editor interface and editing flow.'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\tfeatureName=\"focusMode\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Highlights the current block and fades other content.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\tfeatureName=\"showIconLabels\"\n\t\t\t\t\t\tlabel={ __( 'Show button text labels' ) }\n\t\t\t\t\t\thelp={ __( 'Show text instead of icons on buttons.' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\tfeatureName=\"showListViewByDefault\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Opens the block list view sidebar by default.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlabel={ __( 'Always open list view' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\tfeatureName=\"showBlockBreadcrumbs\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Shows block breadcrumbs at the bottom of the editor.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlabel={ __( 'Display block breadcrumbs' ) }\n\t\t\t\t\t/>\n\t\t\t\t</PreferencesModalSection>\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tname: 'blocks',\n\t\t\ttabLabel: __( 'Blocks' ),\n\t\t\tcontent: (\n\t\t\t\t<PreferencesModalSection\n\t\t\t\t\ttitle={ __( 'Block interactions' ) }\n\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t'Customize how you interact with blocks in the block library and editing canvas.'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\tfeatureName=\"keepCaretInsideBlock\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlabel={ __( 'Contain text cursor inside block' ) }\n\t\t\t\t\t/>\n\t\t\t\t</PreferencesModalSection>\n\t\t\t),\n\t\t},\n\t] );\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<PreferencesModal closeModal={ toggleModal }>\n\t\t\t<PreferencesModalTabs sections={ sections } />\n\t\t</PreferencesModal>\n\t);\n}\n"]}
|
|
@@ -66,13 +66,12 @@ function calculateNewHeight(width, initialAspectRatio) {
|
|
|
66
66
|
return width / intermediateAspectRatio;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
function ResizableFrame(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
} = _ref2;
|
|
69
|
+
function ResizableFrame({
|
|
70
|
+
isFullWidth,
|
|
71
|
+
isReady,
|
|
72
|
+
children,
|
|
73
|
+
oversizedClassName
|
|
74
|
+
}) {
|
|
76
75
|
const [frameSize, setFrameSize] = (0, _element.useState)({
|
|
77
76
|
width: '100%',
|
|
78
77
|
height: '100%'
|
|
@@ -163,6 +162,17 @@ function ResizableFrame(_ref2) {
|
|
|
163
162
|
height: frameSize.height
|
|
164
163
|
}
|
|
165
164
|
};
|
|
165
|
+
const resizeHandleVariants = {
|
|
166
|
+
default: {
|
|
167
|
+
opacity: 1,
|
|
168
|
+
left: -16
|
|
169
|
+
},
|
|
170
|
+
resizing: {
|
|
171
|
+
opacity: 1,
|
|
172
|
+
left: -16,
|
|
173
|
+
scaleY: 1.3
|
|
174
|
+
}
|
|
175
|
+
};
|
|
166
176
|
return (0, _element.createElement)(_components.ResizableBox, {
|
|
167
177
|
as: _components.__unstableMotion.div,
|
|
168
178
|
ref: frameRef,
|
|
@@ -203,21 +213,19 @@ function ResizableFrame(_ref2) {
|
|
|
203
213
|
left: isHovering || isResizing ? (0, _element.createElement)(_components.__unstableMotion.div, {
|
|
204
214
|
key: "handle",
|
|
205
215
|
className: "edit-site-resizable-frame__handle",
|
|
216
|
+
variants: resizeHandleVariants,
|
|
217
|
+
animate: isResizing ? 'resizing' : 'default',
|
|
206
218
|
title: "Drag to resize",
|
|
207
219
|
initial: {
|
|
208
220
|
opacity: 0,
|
|
209
221
|
left: 0
|
|
210
222
|
},
|
|
211
|
-
animate: {
|
|
212
|
-
opacity: 1,
|
|
213
|
-
left: -15
|
|
214
|
-
},
|
|
215
223
|
exit: {
|
|
216
224
|
opacity: 0,
|
|
217
225
|
left: 0
|
|
218
226
|
},
|
|
219
227
|
whileHover: {
|
|
220
|
-
|
|
228
|
+
scaleY: 1.3
|
|
221
229
|
}
|
|
222
230
|
}) : null
|
|
223
231
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/resizable-frame/index.js"],"names":["HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","width","height","top","right","bottom","left","FRAME_MIN_WIDTH","FRAME_REFERENCE_WIDTH","FRAME_TARGET_ASPECT_RATIO","SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD","calculateNewHeight","initialAspectRatio","lerp","a","b","amount","lerpFactor","Math","max","min","intermediateAspectRatio","ResizableFrame","isFullWidth","isReady","children","oversizedClassName","frameSize","setFrameSize","startingWidth","setStartingWidth","isResizing","setIsResizing","isHovering","setIsHovering","isOversized","setIsOversized","resizeRatio","setResizeRatio","setCanvasMode","editSiteStore","initialAspectRatioRef","initialComputedWidthRef","FRAME_TRANSITION","type","duration","frameRef","offsetWidth","offsetHeight","current","resizable","handleResizeStart","_event","_direction","ref","handleResize","_ref","delta","normalizedDelta","deltaAbs","abs","maxDoubledDelta","deltaToDouble","doubleSegment","singleSegment","updatedWidth","handleResizeStop","remainingWidth","ownerDocument","documentElement","frameAnimationVariants","default","flexGrow","fullWidth","motion","div","definition","topRight","bottomRight","bottomLeft","topLeft","opacity","scale","borderRadius"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAIA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAIA;AACA,MAAMA,sBAAsB,GAAG;AAC9BC,EAAAA,QAAQ,EAAEC,SADoB;AAE9BC,EAAAA,UAAU,EAAED,SAFkB;AAG9BE,EAAAA,MAAM,EAAEF,SAHsB;AAI9BG,EAA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AC,4BAAD,CAAQ,GAAR;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG;AACTgD,MAAAA,YAAY,EAAE5D,WAAW,GAAG,CAAH,GAAO;AADvB,KAFX;AAKC,IAAA,UAAU,EAAGoB;AALd,KAOGlB,QAPH,CAjED,CADD;AA6EA;;eAEcH,c","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect } from '@wordpress/element';\nimport {\n\tResizableBox,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n// The minimum width of the frame (in px) while resizing.\nconst FRAME_MIN_WIDTH = 340;\n// The reference width of the frame (in px) used to calculate the aspect ratio.\nconst FRAME_REFERENCE_WIDTH = 1300;\n// 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.\nconst FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;\n// The minimum distance (in px) between the frame resize handle and the\n// viewport's edge. If the frame is resized to be closer to the viewport's edge\n// than this distance, then \"canvas mode\" will be enabled.\nconst SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;\n\nfunction calculateNewHeight( width, initialAspectRatio ) {\n\tconst lerp = ( a, b, amount ) => {\n\t\treturn a + ( b - a ) * amount;\n\t};\n\n\t// Calculate the intermediate aspect ratio based on the current width.\n\tconst lerpFactor =\n\t\t1 -\n\t\tMath.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\t1,\n\t\t\t\t( width - FRAME_MIN_WIDTH ) /\n\t\t\t\t\t( FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH )\n\t\t\t)\n\t\t);\n\n\t// Calculate the height based on the intermediate aspect ratio\n\t// ensuring the frame arrives at the target aspect ratio.\n\tconst intermediateAspectRatio = lerp(\n\t\tinitialAspectRatio,\n\t\tFRAME_TARGET_ASPECT_RATIO,\n\t\tlerpFactor\n\t);\n\n\treturn width / intermediateAspectRatio;\n}\n\nfunction ResizableFrame( {\n\tisFullWidth,\n\tisReady,\n\tchildren,\n\toversizedClassName,\n} ) {\n\tconst [ frameSize, setFrameSize ] = useState( {\n\t\twidth: '100%',\n\t\theight: '100%',\n\t} );\n\t// The width of the resizable frame when a new resize gesture starts.\n\tconst [ startingWidth, setStartingWidth ] = useState();\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ isHovering, setIsHovering ] = useState( false );\n\tconst [ isOversized, setIsOversized ] = useState( false );\n\tconst [ resizeRatio, setResizeRatio ] = useState( 1 );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst initialAspectRatioRef = useRef( null );\n\t// The width of the resizable frame on initial render.\n\tconst initialComputedWidthRef = useRef( null );\n\tconst FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };\n\tconst frameRef = useRef( null );\n\n\t// Remember frame dimensions on initial render.\n\tuseEffect( () => {\n\t\tconst { offsetWidth, offsetHeight } = frameRef.current.resizable;\n\t\tinitialComputedWidthRef.current = offsetWidth;\n\t\tinitialAspectRatioRef.current = offsetWidth / offsetHeight;\n\t}, [] );\n\n\tconst handleResizeStart = ( _event, _direction, ref ) => {\n\t\t// Remember the starting width so we don't have to get `ref.offsetWidth` on\n\t\t// every resize event thereafter, which will cause layout thrashing.\n\t\tsetStartingWidth( ref.offsetWidth );\n\t\tsetIsResizing( true );\n\t};\n\n\t// Calculate the frame size based on the window width as its resized.\n\tconst handleResize = ( _event, _direction, _ref, delta ) => {\n\t\tconst normalizedDelta = delta.width / resizeRatio;\n\t\tconst deltaAbs = Math.abs( normalizedDelta );\n\t\tconst maxDoubledDelta =\n\t\t\tdelta.width < 0 // is shrinking\n\t\t\t\t? deltaAbs\n\t\t\t\t: ( initialComputedWidthRef.current - startingWidth ) / 2;\n\t\tconst deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );\n\t\tconst doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;\n\t\tconst singleSegment = 1 - doubleSegment;\n\n\t\tsetResizeRatio( singleSegment + doubleSegment * 2 );\n\n\t\tconst updatedWidth = startingWidth + delta.width;\n\n\t\tsetIsOversized( updatedWidth > initialComputedWidthRef.current );\n\n\t\t// Width will be controlled by the library (via `resizeRatio`),\n\t\t// so we only need to update the height.\n\t\tsetFrameSize( {\n\t\t\theight: isOversized\n\t\t\t\t? '100%'\n\t\t\t\t: calculateNewHeight(\n\t\t\t\t\t\tupdatedWidth,\n\t\t\t\t\t\tinitialAspectRatioRef.current\n\t\t\t\t ),\n\t\t} );\n\t};\n\n\tconst handleResizeStop = ( _event, _direction, ref ) => {\n\t\tsetIsResizing( false );\n\n\t\tif ( ! isOversized ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsOversized( false );\n\n\t\tconst remainingWidth =\n\t\t\tref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;\n\n\t\tif ( remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ) {\n\t\t\t// Reset the initial aspect ratio if the frame is resized slightly\n\t\t\t// above the sidebar but not far enough to trigger full screen.\n\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t} else {\n\t\t\t// Trigger full screen if the frame is resized far enough to the left.\n\t\t\tsetCanvasMode( 'edit' );\n\t\t}\n\t};\n\n\tconst frameAnimationVariants = {\n\t\tdefault: {\n\t\t\tflexGrow: 0,\n\t\t\theight: frameSize.height,\n\t\t},\n\t\tfullWidth: {\n\t\t\tflexGrow: 1,\n\t\t\theight: frameSize.height,\n\t\t},\n\t};\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tas={ motion.div }\n\t\t\tref={ frameRef }\n\t\t\tinitial={ false }\n\t\t\tvariants={ frameAnimationVariants }\n\t\t\tanimate={ isFullWidth ? 'fullWidth' : 'default' }\n\t\t\tonAnimationComplete={ ( definition ) => {\n\t\t\t\tif ( definition === 'fullWidth' )\n\t\t\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t\t} }\n\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\tsize={ frameSize }\n\t\t\tenable={ {\n\t\t\t\ttop: false,\n\t\t\t\tright: false,\n\t\t\t\tbottom: false,\n\t\t\t\t// Resizing will be disabled until the editor content is loaded.\n\t\t\t\tleft: isReady,\n\t\t\t\ttopRight: false,\n\t\t\t\tbottomRight: false,\n\t\t\t\tbottomLeft: false,\n\t\t\t\ttopLeft: false,\n\t\t\t} }\n\t\t\tresizeRatio={ resizeRatio }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t\tminWidth={ FRAME_MIN_WIDTH }\n\t\t\tmaxWidth={ isFullWidth ? '100%' : '150%' }\n\t\t\tmaxHeight={ '100%' }\n\t\t\tonMouseOver={ () => setIsHovering( true ) }\n\t\t\tonMouseOut={ () => setIsHovering( false ) }\n\t\t\thandleComponent={ {\n\t\t\t\tleft:\n\t\t\t\t\tisHovering || isResizing ? (\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\t\t\tclassName=\"edit-site-resizable-frame__handle\"\n\t\t\t\t\t\t\ttitle=\"Drag to resize\"\n\t\t\t\t\t\t\tinitial={ {\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\t\tleft: -15,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\texit={ {\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\twhileHover={ { scale: 1.1 } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null,\n\t\t\t} }\n\t\t\tonResizeStart={ handleResizeStart }\n\t\t\tonResize={ handleResize }\n\t\t\tonResizeStop={ handleResizeStop }\n\t\t\tclassName={ classnames( 'edit-site-resizable-frame__inner', {\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t\t[ oversizedClassName ]: isOversized,\n\t\t\t} ) }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-site-resizable-frame__inner-content\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tborderRadius: isFullWidth ? 0 : 8,\n\t\t\t\t} }\n\t\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</motion.div>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableFrame;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/resizable-frame/index.js"],"names":["HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","width","height","top","right","bottom","left","FRAME_MIN_WIDTH","FRAME_REFERENCE_WIDTH","FRAME_TARGET_ASPECT_RATIO","SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD","calculateNewHeight","initialAspectRatio","lerp","a","b","amount","lerpFactor","Math","max","min","intermediateAspectRatio","ResizableFrame","isFullWidth","isReady","children","oversizedClassName","frameSize","setFrameSize","startingWidth","setStartingWidth","isResizing","setIsResizing","isHovering","setIsHovering","isOversized","setIsOversized","resizeRatio","setResizeRatio","setCanvasMode","editSiteStore","initialAspectRatioRef","initialComputedWidthRef","FRAME_TRANSITION","type","duration","frameRef","offsetWidth","offsetHeight","current","resizable","handleResizeStart","_event","_direction","ref","handleResize","_ref","delta","normalizedDelta","deltaAbs","abs","maxDoubledDelta","deltaToDouble","doubleSegment","singleSegment","updatedWidth","handleResizeStop","remainingWidth","ownerDocument","documentElement","frameAnimationVariants","default","flexGrow","fullWidth","resizeHandleVariants","opacity","resizing","scaleY","motion","div","definition","topRight","bottomRight","bottomLeft","topLeft","borderRadius"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAIA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAIA;AACA,MAAMA,sBAAsB,GAAG;AAC9BC,EAAAA,QAAQ,EAAEC,SADoB;AAE9BC,EAAAA,UAAU,EAAED,SAFkB;AAG9BE,EAAAA,MAAM,EAAEF,SAHsB;AAI9BG,EAAAA,KAAK,EAAEH,SAJuB;AAK9BI,EAAAA,MAAM,EAAEJ,SALsB;AAM9BK,EAAAA,GAAG,EAAEL,SANyB;AAO9BM,EAAAA,KAAK,EAAEN,SAPuB;AAQ9BO,EAAAA,MAAM,EAAEP,SARsB;AAS9BQ,EAAAA,IAAI,EAAER;AATwB,CAA/B,C,CAYA;;AACA,MAAMS,eAAe,GAAG,GAAxB,C,CACA;;AACA,MAAMC,qBAAqB,GAAG,IAA9B,C,CACA;;AACA,MAAMC,yBAAyB,GAAG,IAAI,IAAtC,C,CACA;AACA;AACA;;AACA,MAAMC,kCAAkC,GAAG,GAA3C;;AAEA,SAASC,kBAAT,CAA6BV,KAA7B,EAAoCW,kBAApC,EAAyD;AACxD,QAAMC,IAAI,GAAG,CAAEC,CAAF,EAAKC,CAAL,EAAQC,MAAR,KAAoB;AAChC,WAAOF,CAAC,GAAG,CAAEC,CAAC,GAAGD,CAAN,IAAYE,MAAvB;AACA,GAFD,CADwD,CAKxD;;;AACA,QAAMC,UAAU,GACf,IACAC,IAAI,CAACC,GAAL,CACC,CADD,EAECD,IAAI,CAACE,GAAL,CACC,CADD,EAEC,CAAEnB,KAAK,GAAGM,eAAV,KACGC,qBAAqB,GAAGD,eAD3B,C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4BAAD,CAAQ,GAAR;AACC,QAAA,GAAG,EAAC,QADL;AAEC,QAAA,SAAS,EAAC,mCAFX;AAGC,QAAA,QAAQ,EAAG2C,oBAHZ;AAIC,QAAA,OAAO,EAAG3C,UAAU,GAAG,UAAH,GAAgB,SAJrC;AAKC,QAAA,KAAK,EAAC,gBALP;AAMC,QAAA,OAAO,EAAG;AACT4C,UAAAA,OAAO,EAAE,CADA;AAETrE,UAAAA,IAAI,EAAE;AAFG,SANX;AAUC,QAAA,IAAI,EAAG;AACNqE,UAAAA,OAAO,EAAE,CADH;AAENrE,UAAAA,IAAI,EAAE;AAFA,SAVR;AAcC,QAAA,UAAU,EAAG;AAAEuE,UAAAA,MAAM,EAAE;AAAV;AAdd,QADD,GAiBI;AAnBY,KAlCnB;AAuDC,IAAA,aAAa,EAAG1B,iBAvDjB;AAwDC,IAAA,QAAQ,EAAGI,YAxDZ;AAyDC,IAAA,YAAY,EAAGW,gBAzDhB;AA0DC,IAAA,SAAS,EAAG,yBAAY,kCAAZ,EAAgD;AAC3D,qBAAenC,UAD4C;AAE3D,OAAEL,kBAAF,GAAwBS;AAFmC,KAAhD;AA1Db,KA+DC,4BAAC,4BAAD,CAAQ,GAAR;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG;AACTkD,MAAAA,YAAY,EAAE9D,WAAW,GAAG,CAAH,GAAO;AADvB,KAFX;AAKC,IAAA,UAAU,EAAGoB;AALd,KAOGlB,QAPH,CA/DD,CADD;AA2EA;;eAEcH,c","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect } from '@wordpress/element';\nimport {\n\tResizableBox,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n// The minimum width of the frame (in px) while resizing.\nconst FRAME_MIN_WIDTH = 340;\n// The reference width of the frame (in px) used to calculate the aspect ratio.\nconst FRAME_REFERENCE_WIDTH = 1300;\n// 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.\nconst FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;\n// The minimum distance (in px) between the frame resize handle and the\n// viewport's edge. If the frame is resized to be closer to the viewport's edge\n// than this distance, then \"canvas mode\" will be enabled.\nconst SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;\n\nfunction calculateNewHeight( width, initialAspectRatio ) {\n\tconst lerp = ( a, b, amount ) => {\n\t\treturn a + ( b - a ) * amount;\n\t};\n\n\t// Calculate the intermediate aspect ratio based on the current width.\n\tconst lerpFactor =\n\t\t1 -\n\t\tMath.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\t1,\n\t\t\t\t( width - FRAME_MIN_WIDTH ) /\n\t\t\t\t\t( FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH )\n\t\t\t)\n\t\t);\n\n\t// Calculate the height based on the intermediate aspect ratio\n\t// ensuring the frame arrives at the target aspect ratio.\n\tconst intermediateAspectRatio = lerp(\n\t\tinitialAspectRatio,\n\t\tFRAME_TARGET_ASPECT_RATIO,\n\t\tlerpFactor\n\t);\n\n\treturn width / intermediateAspectRatio;\n}\n\nfunction ResizableFrame( {\n\tisFullWidth,\n\tisReady,\n\tchildren,\n\toversizedClassName,\n} ) {\n\tconst [ frameSize, setFrameSize ] = useState( {\n\t\twidth: '100%',\n\t\theight: '100%',\n\t} );\n\t// The width of the resizable frame when a new resize gesture starts.\n\tconst [ startingWidth, setStartingWidth ] = useState();\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ isHovering, setIsHovering ] = useState( false );\n\tconst [ isOversized, setIsOversized ] = useState( false );\n\tconst [ resizeRatio, setResizeRatio ] = useState( 1 );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst initialAspectRatioRef = useRef( null );\n\t// The width of the resizable frame on initial render.\n\tconst initialComputedWidthRef = useRef( null );\n\tconst FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };\n\tconst frameRef = useRef( null );\n\n\t// Remember frame dimensions on initial render.\n\tuseEffect( () => {\n\t\tconst { offsetWidth, offsetHeight } = frameRef.current.resizable;\n\t\tinitialComputedWidthRef.current = offsetWidth;\n\t\tinitialAspectRatioRef.current = offsetWidth / offsetHeight;\n\t}, [] );\n\n\tconst handleResizeStart = ( _event, _direction, ref ) => {\n\t\t// Remember the starting width so we don't have to get `ref.offsetWidth` on\n\t\t// every resize event thereafter, which will cause layout thrashing.\n\t\tsetStartingWidth( ref.offsetWidth );\n\t\tsetIsResizing( true );\n\t};\n\n\t// Calculate the frame size based on the window width as its resized.\n\tconst handleResize = ( _event, _direction, _ref, delta ) => {\n\t\tconst normalizedDelta = delta.width / resizeRatio;\n\t\tconst deltaAbs = Math.abs( normalizedDelta );\n\t\tconst maxDoubledDelta =\n\t\t\tdelta.width < 0 // is shrinking\n\t\t\t\t? deltaAbs\n\t\t\t\t: ( initialComputedWidthRef.current - startingWidth ) / 2;\n\t\tconst deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );\n\t\tconst doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;\n\t\tconst singleSegment = 1 - doubleSegment;\n\n\t\tsetResizeRatio( singleSegment + doubleSegment * 2 );\n\n\t\tconst updatedWidth = startingWidth + delta.width;\n\n\t\tsetIsOversized( updatedWidth > initialComputedWidthRef.current );\n\n\t\t// Width will be controlled by the library (via `resizeRatio`),\n\t\t// so we only need to update the height.\n\t\tsetFrameSize( {\n\t\t\theight: isOversized\n\t\t\t\t? '100%'\n\t\t\t\t: calculateNewHeight(\n\t\t\t\t\t\tupdatedWidth,\n\t\t\t\t\t\tinitialAspectRatioRef.current\n\t\t\t\t ),\n\t\t} );\n\t};\n\n\tconst handleResizeStop = ( _event, _direction, ref ) => {\n\t\tsetIsResizing( false );\n\n\t\tif ( ! isOversized ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsOversized( false );\n\n\t\tconst remainingWidth =\n\t\t\tref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;\n\n\t\tif ( remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ) {\n\t\t\t// Reset the initial aspect ratio if the frame is resized slightly\n\t\t\t// above the sidebar but not far enough to trigger full screen.\n\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t} else {\n\t\t\t// Trigger full screen if the frame is resized far enough to the left.\n\t\t\tsetCanvasMode( 'edit' );\n\t\t}\n\t};\n\n\tconst frameAnimationVariants = {\n\t\tdefault: {\n\t\t\tflexGrow: 0,\n\t\t\theight: frameSize.height,\n\t\t},\n\t\tfullWidth: {\n\t\t\tflexGrow: 1,\n\t\t\theight: frameSize.height,\n\t\t},\n\t};\n\n\tconst resizeHandleVariants = {\n\t\tdefault: {\n\t\t\topacity: 1,\n\t\t\tleft: -16,\n\t\t},\n\t\tresizing: {\n\t\t\topacity: 1,\n\t\t\tleft: -16,\n\t\t\tscaleY: 1.3,\n\t\t},\n\t};\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tas={ motion.div }\n\t\t\tref={ frameRef }\n\t\t\tinitial={ false }\n\t\t\tvariants={ frameAnimationVariants }\n\t\t\tanimate={ isFullWidth ? 'fullWidth' : 'default' }\n\t\t\tonAnimationComplete={ ( definition ) => {\n\t\t\t\tif ( definition === 'fullWidth' )\n\t\t\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t\t} }\n\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\tsize={ frameSize }\n\t\t\tenable={ {\n\t\t\t\ttop: false,\n\t\t\t\tright: false,\n\t\t\t\tbottom: false,\n\t\t\t\t// Resizing will be disabled until the editor content is loaded.\n\t\t\t\tleft: isReady,\n\t\t\t\ttopRight: false,\n\t\t\t\tbottomRight: false,\n\t\t\t\tbottomLeft: false,\n\t\t\t\ttopLeft: false,\n\t\t\t} }\n\t\t\tresizeRatio={ resizeRatio }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t\tminWidth={ FRAME_MIN_WIDTH }\n\t\t\tmaxWidth={ isFullWidth ? '100%' : '150%' }\n\t\t\tmaxHeight={ '100%' }\n\t\t\tonMouseOver={ () => setIsHovering( true ) }\n\t\t\tonMouseOut={ () => setIsHovering( false ) }\n\t\t\thandleComponent={ {\n\t\t\t\tleft:\n\t\t\t\t\tisHovering || isResizing ? (\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\t\t\tclassName=\"edit-site-resizable-frame__handle\"\n\t\t\t\t\t\t\tvariants={ resizeHandleVariants }\n\t\t\t\t\t\t\tanimate={ isResizing ? 'resizing' : 'default' }\n\t\t\t\t\t\t\ttitle=\"Drag to resize\"\n\t\t\t\t\t\t\tinitial={ {\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\texit={ {\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\twhileHover={ { scaleY: 1.3 } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null,\n\t\t\t} }\n\t\t\tonResizeStart={ handleResizeStart }\n\t\t\tonResize={ handleResize }\n\t\t\tonResizeStop={ handleResizeStop }\n\t\t\tclassName={ classnames( 'edit-site-resizable-frame__inner', {\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t\t[ oversizedClassName ]: isOversized,\n\t\t\t} ) }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-site-resizable-frame__inner-content\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tborderRadius: isFullWidth ? 0 : 8,\n\t\t\t\t} }\n\t\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</motion.div>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableFrame;\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _lodash = require("lodash");
|
|
13
|
-
|
|
14
12
|
var _components = require("@wordpress/components");
|
|
15
13
|
|
|
16
14
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -27,10 +25,6 @@ var _globalStylesProvider = require("../global-styles/global-styles-provider");
|
|
|
27
25
|
|
|
28
26
|
var _editorCanvasContainer = _interopRequireDefault(require("../editor-canvas-container"));
|
|
29
27
|
|
|
30
|
-
/**
|
|
31
|
-
* External dependencies
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
28
|
/**
|
|
35
29
|
* WordPress dependencies
|
|
36
30
|
*/
|
|
@@ -43,19 +37,22 @@ const {
|
|
|
43
37
|
useGlobalStylesOutputWithConfig
|
|
44
38
|
} = (0, _privateApis.unlock)(_blockEditor.privateApis);
|
|
45
39
|
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
function isObjectEmpty(object) {
|
|
41
|
+
return !object || Object.keys(object).length === 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function Revisions({
|
|
45
|
+
onClose,
|
|
46
|
+
userConfig,
|
|
47
|
+
blocks
|
|
48
|
+
}) {
|
|
52
49
|
const {
|
|
53
50
|
baseConfig
|
|
54
51
|
} = (0, _data.useSelect)(select => ({
|
|
55
52
|
baseConfig: select(_coreData.store).__experimentalGetCurrentThemeBaseGlobalStyles()
|
|
56
53
|
}), []);
|
|
57
54
|
const mergedConfig = (0, _element.useMemo)(() => {
|
|
58
|
-
if (!(
|
|
55
|
+
if (!isObjectEmpty(userConfig) && !isObjectEmpty(baseConfig)) {
|
|
59
56
|
return (0, _globalStylesProvider.mergeBaseAndUserConfigs)(baseConfig, userConfig);
|
|
60
57
|
}
|
|
61
58
|
|
|
@@ -67,7 +64,7 @@ function Revisions(_ref) {
|
|
|
67
64
|
__unstableIsPreviewMode: true
|
|
68
65
|
}), [originalSettings]);
|
|
69
66
|
const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig);
|
|
70
|
-
const editorStyles = !(
|
|
67
|
+
const editorStyles = !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : settings.styles;
|
|
71
68
|
return (0, _element.createElement)(_editorCanvasContainer.default, {
|
|
72
69
|
title: (0, _i18n.__)('Revisions'),
|
|
73
70
|
onClose: onClose,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/revisions/index.js"],"names":["ExperimentalBlockEditorProvider","useGlobalStylesOutputWithConfig","blockEditorPrivateApis","Revisions","onClose","userConfig","blocks","baseConfig","select","coreStore","__experimentalGetCurrentThemeBaseGlobalStyles","mergedConfig","renderedBlocksArray","Array","isArray","originalSettings","blockEditorStore","getSettings","settings","__unstableIsPreviewMode","globalStyles","editorStyles","styles"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/revisions/index.js"],"names":["ExperimentalBlockEditorProvider","useGlobalStylesOutputWithConfig","blockEditorPrivateApis","isObjectEmpty","object","Object","keys","length","Revisions","onClose","userConfig","blocks","baseConfig","select","coreStore","__experimentalGetCurrentThemeBaseGlobalStyles","mergedConfig","renderedBlocksArray","Array","isArray","originalSettings","blockEditorStore","getSettings","settings","__unstableIsPreviewMode","globalSt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;AAAhD,GAAR,CADgB,EAEhB,CAAEJ,gBAAF,CAFgB,CAAjB;AAKA,QAAM,CAAEK,YAAF,IAAmBxB,+BAA+B,CAAEe,YAAF,CAAxD;AAEA,QAAMU,YAAY,GACjB,CAAEvB,aAAa,CAAEsB,YAAF,CAAf,IAAmC,CAAEtB,aAAa,CAAEO,UAAF,CAAlD,GACGe,YADH,GAEGF,QAAQ,CAACI,MAHb;AAKA,SACC,4BAAC,8BAAD;AACC,IAAA,KAAK,EAAG,cAAI,WAAJ,CADT;AAEC,IAAA,OAAO,EAAGlB,OAFX;AAGC,IAAA,gBAAgB,EAAG,cAAI,iBAAJ,CAHpB;AAIC,IAAA,cAAc,EAAG;AAJlB,KAMC,4BAAC,6BAAD;AACC,IAAA,SAAS,EAAC,6BADX;AAEC,IAAA,IAAI,EAAC,WAFN;AAGC,IAAA,QAAQ,EAAG;AAHZ,KAKC,4BAAC,mCAAD;AAAc,IAAA,MAAM,EAAGiB;AAAvB,IALD,EAMC,2CAEE;AACA;AACC,0FAJH,CAND,EAaC,4BAAC,oBAAD;AAAU,IAAA,SAAS,EAAC;AAApB,KACC,4BAAC,+BAAD;AACC,IAAA,KAAK,EAAGT,mBADT;AAEC,IAAA,QAAQ,EAAGM;AAFZ,KAIC,4BAAC,sBAAD;AAAW,IAAA,cAAc,EAAG;AAA5B,IAJD,CADD,CAbD,CAND,CADD;AA+BA;;eAEcf,S","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Disabled } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\n\nimport { unlock } from '../../private-apis';\nimport { mergeBaseAndUserConfigs } from '../global-styles/global-styles-provider';\nimport EditorCanvasContainer from '../editor-canvas-container';\n\nconst { ExperimentalBlockEditorProvider, useGlobalStylesOutputWithConfig } =\n\tunlock( blockEditorPrivateApis );\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\nfunction Revisions( { onClose, userConfig, blocks } ) {\n\tconst { baseConfig } = useSelect(\n\t\t( select ) => ( {\n\t\t\tbaseConfig:\n\t\t\t\tselect(\n\t\t\t\t\tcoreStore\n\t\t\t\t).__experimentalGetCurrentThemeBaseGlobalStyles(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {\n\t\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t\t}\n\t\treturn {};\n\t}, [ baseConfig, userConfig ] );\n\n\tconst renderedBlocksArray = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),\n\t\t[ originalSettings ]\n\t);\n\n\tconst [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );\n\n\tconst editorStyles =\n\t\t! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig )\n\t\t\t? globalStyles\n\t\t\t: settings.styles;\n\n\treturn (\n\t\t<EditorCanvasContainer\n\t\t\ttitle={ __( 'Revisions' ) }\n\t\t\tonClose={ onClose }\n\t\t\tcloseButtonLabel={ __( 'Close revisions' ) }\n\t\t\tenableResizing={ true }\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tclassName=\"edit-site-revisions__iframe\"\n\t\t\t\tname=\"revisions\"\n\t\t\t\ttabIndex={ 0 }\n\t\t\t>\n\t\t\t\t<EditorStyles styles={ editorStyles } />\n\t\t\t\t<style>\n\t\t\t\t\t{\n\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t`.is-root-container { display: flow-root; } body { position: relative; padding: 32px; }`\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t<Disabled className=\"edit-site-revisions__example-preview__content\">\n\t\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\t\tvalue={ renderedBlocksArray }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockList renderAppender={ false } />\n\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t</Disabled>\n\t\t\t</Iframe>\n\t\t</EditorCanvasContainer>\n\t);\n}\n\nexport default Revisions;\n"]}
|
|
@@ -31,10 +31,7 @@ const {
|
|
|
31
31
|
useHistory
|
|
32
32
|
} = (0, _privateApis.unlock)(_router.privateApis);
|
|
33
33
|
|
|
34
|
-
function useLink() {
|
|
35
|
-
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
36
|
-
let state = arguments.length > 1 ? arguments[1] : undefined;
|
|
37
|
-
let shouldReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
34
|
+
function useLink(params = {}, state, shouldReplace = false) {
|
|
38
35
|
const history = useHistory();
|
|
39
36
|
|
|
40
37
|
function onClick(event) {
|
|
@@ -63,14 +60,13 @@ function useLink() {
|
|
|
63
60
|
};
|
|
64
61
|
}
|
|
65
62
|
|
|
66
|
-
function Link(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
} = _ref;
|
|
63
|
+
function Link({
|
|
64
|
+
params = {},
|
|
65
|
+
state,
|
|
66
|
+
replace: shouldReplace = false,
|
|
67
|
+
children,
|
|
68
|
+
...props
|
|
69
|
+
}) {
|
|
74
70
|
const {
|
|
75
71
|
href,
|
|
76
72
|
onClick
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/routes/link.js"],"names":["useHistory","routerPrivateApis","useLink","params","state","shouldReplace","history","onClick","event","preventDefault","replace","push","currentArgs","window","location","href","currentUrlWithoutArgs","Object","keys","theme_preview","newUrl","Link","children","props"],"mappings":";;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAiB,yBAAQC,mBAAR,CAAvB;;AAEO,SAASC,OAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/routes/link.js"],"names":["useHistory","routerPrivateApis","useLink","params","state","shouldReplace","history","onClick","event","preventDefault","replace","push","currentArgs","window","location","href","currentUrlWithoutArgs","Object","keys","theme_preview","newUrl","Link","children","props"],"mappings":";;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAiB,yBAAQC,mBAAR,CAAvB;;AAEO,SAASC,OAAT,CAAkBC,MAAM,GAAG,EAA3B,EAA+BC,KAA/B,EAAsCC,aAAa,GAAG,KAAtD,EAA8D;AACpE,QAAMC,OAAO,GAAGN,UAAU,EAA1B;;AAEA,WAASO,OAAT,CAAkBC,KAAlB,EAA0B;AACzBA,IAAAA,KAAK,CAACC,cAAN;;AAEA,QAAKJ,aAAL,EAAqB;AACpBC,MAAAA,OAAO,CAACI,OAAR,CAAiBP,MAAjB,EAAyBC,KAAzB;AACA,KAFD,MAEO;AACNE,MAAAA,OAAO,CAACK,IAAR,CAAcR,MAAd,EAAsBC,KAAtB;AACA;AACD;;AAED,QAAMQ,WAAW,GAAG,uBAAcC,MAAM,CAACC,QAAP,CAAgBC,IAA9B,CAApB;AACA,QAAMC,qBAAqB,GAAG,0BAC7BH,MAAM,CAACC,QAAP,CAAgBC,IADa,EAE7B,GAAGE,MAAM,CAACC,IAAP,CAAaN,WAAb,CAF0B,CAA9B;;AAKA,MAAK,2CAAL,EAA2B;AAC1BT,IAAAA,MAAM,GAAG,EACR,GAAGA,MADK;AAERgB,MAAAA,aAAa,EAAE;AAFP,KAAT;AAIA;;AAED,QAAMC,MAAM,GAAG,uBAAcJ,qBAAd,EAAqCb,MAArC,CAAf;AAEA,SAAO;AACNY,IAAAA,IAAI,EAAEK,MADA;AAENb,IAAAA;AAFM,GAAP;AAIA;;AAEc,SAASc,IAAT,CAAe;AAC7BlB,EAAAA,MAAM,GAAG,EADoB;AAE7BC,EAAAA,KAF6B;AAG7BM,EAAAA,OAAO,EAAEL,aAAa,GAAG,KAHI;AAI7BiB,EAAAA,QAJ6B;AAK7B,KAAGC;AAL0B,CAAf,EAMX;AACH,QAAM;AAAER,IAAAA,IAAF;AAAQR,IAAAA;AAAR,MAAoBL,OAAO,CAAEC,MAAF,EAAUC,KAAV,EAAiBC,aAAjB,CAAjC;AAEA,SACC;AAAG,IAAA,IAAI,EAAGU,IAAV;AAAiB,IAAA,OAAO,EAAGR;AAA3B,KAA0CgB,KAA1C,GACGD,QADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addQueryArgs, getQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from '../../utils/is-previewing-theme';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport function useLink( params = {}, state, shouldReplace = false ) {\n\tconst history = useHistory();\n\n\tfunction onClick( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( shouldReplace ) {\n\t\t\thistory.replace( params, state );\n\t\t} else {\n\t\t\thistory.push( params, state );\n\t\t}\n\t}\n\n\tconst currentArgs = getQueryArgs( window.location.href );\n\tconst currentUrlWithoutArgs = removeQueryArgs(\n\t\twindow.location.href,\n\t\t...Object.keys( currentArgs )\n\t);\n\n\tif ( isPreviewingTheme() ) {\n\t\tparams = {\n\t\t\t...params,\n\t\t\ttheme_preview: currentlyPreviewingTheme(),\n\t\t};\n\t}\n\n\tconst newUrl = addQueryArgs( currentUrlWithoutArgs, params );\n\n\treturn {\n\t\thref: newUrl,\n\t\tonClick,\n\t};\n}\n\nexport default function Link( {\n\tparams = {},\n\tstate,\n\treplace: shouldReplace = false,\n\tchildren,\n\t...props\n} ) {\n\tconst { href, onClick } = useLink( params, state, shouldReplace );\n\n\treturn (\n\t\t<a href={ href } onClick={ onClick } { ...props }>\n\t\t\t{ children }\n\t\t</a>\n\t);\n}\n"]}
|
|
@@ -34,11 +34,7 @@ const {
|
|
|
34
34
|
|
|
35
35
|
function useTitle(title) {
|
|
36
36
|
const location = useLocation();
|
|
37
|
-
const siteTitle = (0, _data.useSelect)(select =>
|
|
38
|
-
var _select$getEntityReco;
|
|
39
|
-
|
|
40
|
-
return (_select$getEntityReco = select(_coreData.store).getEntityRecord('root', 'site')) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.title;
|
|
41
|
-
}, []);
|
|
37
|
+
const siteTitle = (0, _data.useSelect)(select => select(_coreData.store).getEntityRecord('root', 'site')?.title, []);
|
|
42
38
|
const isInitialLocationRef = (0, _element.useRef)(true);
|
|
43
39
|
(0, _element.useEffect)(() => {
|
|
44
40
|
isInitialLocationRef.current = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/routes/use-title.js"],"names":["useLocation","routerPrivateApis","useTitle","title","location","siteTitle","select","coreStore","getEntityRecord","isInitialLocationRef","current","formattedTitle","document"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAdA;AACA;AACA;;AASA;AACA;AACA;AAGA,MAAM;AAAEA,EAAAA;AAAF,IAAkB,yBAAQC,mBAAR,CAAxB;;AAEe,SAASC,QAAT,CAAmBC,KAAnB,EAA2B;AACzC,QAAMC,QAAQ,GAAGJ,WAAW,EAA5B;AACA,QAAMK,SAAS,GAAG,qBACfC,MAAF
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/routes/use-title.js"],"names":["useLocation","routerPrivateApis","useTitle","title","location","siteTitle","select","coreStore","getEntityRecord","isInitialLocationRef","current","formattedTitle","document"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAdA;AACA;AACA;;AASA;AACA;AACA;AAGA,MAAM;AAAEA,EAAAA;AAAF,IAAkB,yBAAQC,mBAAR,CAAxB;;AAEe,SAASC,QAAT,CAAmBC,KAAnB,EAA2B;AACzC,QAAMC,QAAQ,GAAGJ,WAAW,EAA5B;AACA,QAAMK,SAAS,GAAG,qBACfC,MAAF,IACCA,MAAM,CAAEC,eAAF,CAAN,CAAoBC,eAApB,CAAqC,MAArC,EAA6C,MAA7C,GAAuDL,KAFvC,EAGjB,EAHiB,CAAlB;AAKA,QAAMM,oBAAoB,GAAG,qBAAQ,IAAR,CAA7B;AAEA,0BAAW,MAAM;AAChBA,IAAAA,oBAAoB,CAACC,OAArB,GAA+B,KAA/B;AACA,GAFD,EAEG,CAAEN,QAAF,CAFH;AAIA,0BAAW,MAAM;AAChB;AACA,QAAKK,oBAAoB,CAACC,OAA1B,EAAoC;AACnC;AACA;;AAED,QAAKP,KAAK,IAAIE,SAAd,EAA0B;AACzB;AACA,YAAMM,cAAc,GAAG;AACtB;AACA,oBAAI,yBAAJ,CAFsB,EAGtB,kCAAgBR,KAAhB,CAHsB,EAItB,kCAAgBE,SAAhB,CAJsB,CAAvB;AAOAO,MAAAA,QAAQ,CAACT,KAAT,GAAiBQ,cAAjB,CATyB,CAWzB;;AACA,uBACC;AACC;AACA,oBAAI,oBAAJ,CAFD,EAGCC,QAAQ,CAACT,KAHV,CADD,EAMC,WAND;AAQA;AACD,GA3BD,EA2BG,CAAEA,KAAF,EAASE,SAAT,EAAoBD,QAApB,CA3BH;AA4BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { speak } from '@wordpress/a11y';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function useTitle( title ) {\n\tconst location = useLocation();\n\tconst siteTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', 'site' )?.title,\n\t\t[]\n\t);\n\tconst isInitialLocationRef = useRef( true );\n\n\tuseEffect( () => {\n\t\tisInitialLocationRef.current = false;\n\t}, [ location ] );\n\n\tuseEffect( () => {\n\t\t// Don't update or announce the title for initial page load.\n\t\tif ( isInitialLocationRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( title && siteTitle ) {\n\t\t\t// @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68\n\t\t\tconst formattedTitle = sprintf(\n\t\t\t\t/* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */\n\t\t\t\t__( '%1$s ‹ %2$s — WordPress' ),\n\t\t\t\tdecodeEntities( title ),\n\t\t\t\tdecodeEntities( siteTitle )\n\t\t\t);\n\n\t\t\tdocument.title = formattedTitle;\n\n\t\t\t// Announce title on route change for screen readers.\n\t\t\tspeak(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The page title that is currently displaying. */\n\t\t\t\t\t__( 'Now displaying: %s' ),\n\t\t\t\t\tdocument.title\n\t\t\t\t),\n\t\t\t\t'assertive'\n\t\t\t);\n\t\t}\n\t}, [ title, siteTitle, location ] );\n}\n"]}
|
|
@@ -28,13 +28,13 @@ var _isPreviewingTheme = require("../../utils/is-previewing-theme");
|
|
|
28
28
|
/**
|
|
29
29
|
* Internal dependencies
|
|
30
30
|
*/
|
|
31
|
-
function SaveButton(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
function SaveButton({
|
|
32
|
+
className = 'edit-site-save-button__button',
|
|
33
|
+
variant = 'primary',
|
|
34
|
+
showTooltip = true,
|
|
35
|
+
defaultLabel,
|
|
36
|
+
icon
|
|
37
|
+
}) {
|
|
38
38
|
const {
|
|
39
39
|
isDirty,
|
|
40
40
|
isSaving,
|
|
@@ -63,10 +63,16 @@ function SaveButton(_ref) {
|
|
|
63
63
|
const disabled = isSaving || !activateSaveEnabled;
|
|
64
64
|
|
|
65
65
|
const getLabel = () => {
|
|
66
|
+
if (isSaving) {
|
|
67
|
+
return (0, _i18n.__)('Saving');
|
|
68
|
+
}
|
|
69
|
+
|
|
66
70
|
if (disabled) {
|
|
67
71
|
return (0, _i18n.__)('Saved');
|
|
68
72
|
}
|
|
69
73
|
|
|
74
|
+
if (defaultLabel) return defaultLabel;
|
|
75
|
+
|
|
70
76
|
if ((0, _isPreviewingTheme.isPreviewingTheme)() && isDirty) {
|
|
71
77
|
return (0, _i18n.__)('Activate & Save');
|
|
72
78
|
} else if ((0, _isPreviewingTheme.isPreviewingTheme)()) {
|