@wordpress/edit-site 7.1.0 → 7.2.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 +6 -0
- package/README.md +0 -7
- package/build/components/add-new-pattern/index.cjs.map +2 -2
- package/build/components/add-new-post/index.cjs.map +2 -2
- package/build/components/add-new-template/add-custom-generic-template-modal-content.cjs.map +2 -2
- package/build/components/add-new-template/add-custom-template-modal-content.cjs.map +2 -2
- package/build/components/add-new-template/index.cjs.map +2 -2
- package/build/components/add-new-template/utils.cjs.map +2 -2
- package/build/components/add-new-template-legacy/add-custom-generic-template-modal-content.cjs.map +2 -2
- package/build/components/add-new-template-legacy/add-custom-template-modal-content.cjs.map +2 -2
- package/build/components/add-new-template-legacy/index.cjs.map +2 -2
- package/build/components/add-new-template-legacy/utils.cjs.map +2 -2
- package/build/components/app/index.cjs.map +2 -2
- package/build/components/block-editor/use-editor-iframe-props.cjs.map +2 -2
- package/build/components/block-editor/use-navigate-to-entity-record.cjs.map +2 -2
- package/build/components/block-editor/use-site-editor-settings.cjs.map +2 -2
- package/build/components/block-editor/use-viewport-sync.cjs.map +2 -2
- package/build/components/canvas-loader/index.cjs.map +2 -2
- package/build/components/dataviews-actions/index.cjs.map +2 -2
- package/build/components/editor/index.cjs +6 -5
- package/build/components/editor/index.cjs.map +3 -3
- package/build/components/editor/site-preview.cjs.map +2 -2
- package/build/components/editor/use-adapt-editor-to-canvas.cjs.map +2 -2
- package/build/components/editor/use-editor-title.cjs.map +2 -2
- package/build/components/editor/use-resolve-edited-entity.cjs.map +2 -2
- package/build/components/editor/use-revisions-url-sync.cjs +122 -0
- package/build/components/editor/use-revisions-url-sync.cjs.map +7 -0
- package/build/components/layout/animation.cjs.map +2 -2
- package/build/components/layout/hooks.cjs.map +2 -2
- package/build/components/layout/index.cjs +0 -1
- package/build/components/layout/index.cjs.map +2 -2
- package/build/components/media/index.cjs.map +2 -2
- package/build/components/more-menu/index.cjs.map +2 -2
- package/build/components/more-menu/site-export.cjs.map +2 -2
- package/build/components/more-menu/welcome-guide-menu-item.cjs.map +2 -2
- package/build/components/page-patterns/actions.cjs.map +2 -2
- package/build/components/page-patterns/delete-category-menu-item.cjs.map +2 -2
- package/build/components/page-patterns/fields.cjs.map +2 -2
- package/build/components/page-patterns/index.cjs.map +2 -2
- package/build/components/page-patterns/rename-category-menu-item.cjs.map +2 -2
- package/build/components/page-patterns/search-items.cjs.map +2 -2
- package/build/components/page-patterns/use-pattern-settings.cjs.map +2 -2
- package/build/components/page-patterns/use-patterns.cjs.map +2 -2
- package/build/components/page-templates/fields.cjs.map +2 -2
- package/build/components/page-templates/hooks.cjs.map +2 -2
- package/build/components/page-templates/index-legacy.cjs.map +2 -2
- package/build/components/page-templates/index.cjs.map +2 -2
- package/build/components/pagination/index.cjs.map +2 -2
- package/build/components/plugin-template-setting-panel/index.cjs.map +2 -2
- package/build/components/post-list/index.cjs.map +2 -2
- package/build/components/post-list/quick-edit-modal.cjs.map +2 -2
- package/build/components/post-list/use-notes-count.cjs.map +2 -2
- package/build/components/resizable-frame/index.cjs.map +2 -2
- package/build/components/routes/use-title.cjs.map +2 -2
- package/build/components/save-button/index.cjs.map +2 -2
- package/build/components/save-hub/index.cjs.map +2 -2
- package/build/components/save-keyboard-shortcut/index.cjs.map +2 -2
- package/build/components/save-panel/index.cjs.map +2 -2
- package/build/components/sidebar/index.cjs.map +2 -2
- package/build/components/sidebar-button/index.cjs.map +2 -2
- package/build/components/sidebar-dataviews/index.cjs.map +2 -2
- package/build/components/sidebar-global-styles/index.cjs.map +2 -2
- package/build/components/sidebar-identity/index.cjs +5 -2
- package/build/components/sidebar-identity/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-item/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-details-footer/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-global-styles/content.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-global-styles/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-identity/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-main/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menus/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.cjs +24 -25
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-patterns/category-item.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-patterns/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-templates-browse/content-legacy.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-templates-browse/content.cjs +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-templates-browse/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-unsupported/index.cjs.map +2 -2
- package/build/components/site-editor-routes/home.cjs.map +2 -2
- package/build/components/site-editor-routes/identity.cjs.map +2 -2
- package/build/components/site-editor-routes/index.cjs.map +2 -2
- package/build/components/site-editor-routes/navigation-item.cjs.map +2 -2
- package/build/components/site-editor-routes/navigation.cjs.map +2 -2
- package/build/components/site-editor-routes/notfound.cjs.map +2 -2
- package/build/components/site-editor-routes/page-item.cjs.map +2 -2
- package/build/components/site-editor-routes/pages.cjs.map +2 -2
- package/build/components/site-editor-routes/pattern-item.cjs.map +2 -2
- package/build/components/site-editor-routes/patterns.cjs.map +2 -2
- package/build/components/site-editor-routes/stylebook.cjs.map +2 -2
- package/build/components/site-editor-routes/styles.cjs.map +2 -2
- package/build/components/site-editor-routes/template-item.cjs.map +2 -2
- package/build/components/site-editor-routes/template-part-item.cjs.map +2 -2
- package/build/components/site-editor-routes/templates.cjs.map +2 -2
- package/build/components/site-hub/index.cjs.map +2 -2
- package/build/components/welcome-guide/editor.cjs.map +2 -2
- package/build/components/welcome-guide/index.cjs.map +2 -2
- package/build/components/welcome-guide/page.cjs.map +2 -2
- package/build/components/welcome-guide/template.cjs.map +2 -2
- package/build/deprecated.cjs.map +2 -2
- package/build/hooks/commands/use-common-commands.cjs.map +2 -2
- package/build/hooks/commands/use-set-command-context.cjs.map +2 -2
- package/build/index.cjs.map +2 -2
- package/build/lock-unlock.cjs.map +2 -2
- package/build/store/actions.cjs.map +2 -2
- package/build/store/index.cjs.map +2 -2
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/constants.cjs.map +2 -2
- package/build/utils/get-filtered-template-parts.cjs.map +2 -2
- package/build/utils/is-previewing-theme.cjs.map +2 -2
- package/build/utils/is-template-removable.cjs.map +2 -2
- package/build/utils/is-template-revertable.cjs.map +2 -2
- package/build/utils/use-activate-theme.cjs.map +2 -2
- package/build/utils/use-actual-current-theme.cjs.map +2 -2
- package/build-module/components/add-new-pattern/index.mjs.map +2 -2
- package/build-module/components/add-new-post/index.mjs.map +2 -2
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.mjs.map +2 -2
- package/build-module/components/add-new-template/add-custom-template-modal-content.mjs.map +2 -2
- package/build-module/components/add-new-template/index.mjs.map +2 -2
- package/build-module/components/add-new-template/utils.mjs.map +2 -2
- package/build-module/components/add-new-template-legacy/add-custom-generic-template-modal-content.mjs.map +2 -2
- package/build-module/components/add-new-template-legacy/add-custom-template-modal-content.mjs.map +2 -2
- package/build-module/components/add-new-template-legacy/index.mjs.map +2 -2
- package/build-module/components/add-new-template-legacy/utils.mjs.map +2 -2
- package/build-module/components/app/index.mjs.map +2 -2
- package/build-module/components/block-editor/use-editor-iframe-props.mjs.map +2 -2
- package/build-module/components/block-editor/use-navigate-to-entity-record.mjs.map +2 -2
- package/build-module/components/block-editor/use-site-editor-settings.mjs.map +2 -2
- package/build-module/components/block-editor/use-viewport-sync.mjs.map +2 -2
- package/build-module/components/canvas-loader/index.mjs.map +2 -2
- package/build-module/components/dataviews-actions/index.mjs.map +2 -2
- package/build-module/components/editor/index.mjs +6 -5
- package/build-module/components/editor/index.mjs.map +2 -2
- package/build-module/components/editor/site-preview.mjs.map +2 -2
- package/build-module/components/editor/use-adapt-editor-to-canvas.mjs.map +2 -2
- package/build-module/components/editor/use-editor-title.mjs.map +2 -2
- package/build-module/components/editor/use-resolve-edited-entity.mjs.map +2 -2
- package/build-module/components/editor/use-revisions-url-sync.mjs +101 -0
- package/build-module/components/editor/use-revisions-url-sync.mjs.map +7 -0
- package/build-module/components/layout/animation.mjs.map +2 -2
- package/build-module/components/layout/hooks.mjs.map +2 -2
- package/build-module/components/layout/index.mjs +0 -1
- package/build-module/components/layout/index.mjs.map +2 -2
- package/build-module/components/media/index.mjs.map +2 -2
- package/build-module/components/more-menu/index.mjs.map +2 -2
- package/build-module/components/more-menu/site-export.mjs.map +2 -2
- package/build-module/components/more-menu/welcome-guide-menu-item.mjs.map +2 -2
- package/build-module/components/page-patterns/actions.mjs.map +2 -2
- package/build-module/components/page-patterns/delete-category-menu-item.mjs.map +2 -2
- package/build-module/components/page-patterns/fields.mjs.map +2 -2
- package/build-module/components/page-patterns/index.mjs.map +2 -2
- package/build-module/components/page-patterns/rename-category-menu-item.mjs.map +2 -2
- package/build-module/components/page-patterns/search-items.mjs.map +2 -2
- package/build-module/components/page-patterns/use-pattern-settings.mjs.map +2 -2
- package/build-module/components/page-patterns/use-patterns.mjs.map +2 -2
- package/build-module/components/page-templates/fields.mjs.map +2 -2
- package/build-module/components/page-templates/hooks.mjs.map +2 -2
- package/build-module/components/page-templates/index-legacy.mjs.map +2 -2
- package/build-module/components/page-templates/index.mjs.map +2 -2
- package/build-module/components/pagination/index.mjs.map +2 -2
- package/build-module/components/plugin-template-setting-panel/index.mjs.map +2 -2
- package/build-module/components/post-list/index.mjs.map +2 -2
- package/build-module/components/post-list/quick-edit-modal.mjs.map +2 -2
- package/build-module/components/post-list/use-notes-count.mjs.map +2 -2
- package/build-module/components/resizable-frame/index.mjs.map +2 -2
- package/build-module/components/routes/use-title.mjs.map +2 -2
- package/build-module/components/save-button/index.mjs.map +2 -2
- package/build-module/components/save-hub/index.mjs.map +2 -2
- package/build-module/components/save-keyboard-shortcut/index.mjs.map +2 -2
- package/build-module/components/save-panel/index.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/sidebar-button/index.mjs.map +2 -2
- package/build-module/components/sidebar-dataviews/index.mjs.map +2 -2
- package/build-module/components/sidebar-global-styles/index.mjs.map +2 -2
- package/build-module/components/sidebar-identity/index.mjs +5 -2
- package/build-module/components/sidebar-identity/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-item/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-details-footer/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/content.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-identity/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-main/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.mjs +24 -25
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.mjs +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-unsupported/index.mjs.map +2 -2
- package/build-module/components/site-editor-routes/home.mjs.map +2 -2
- package/build-module/components/site-editor-routes/identity.mjs.map +2 -2
- package/build-module/components/site-editor-routes/index.mjs.map +2 -2
- package/build-module/components/site-editor-routes/navigation-item.mjs.map +2 -2
- package/build-module/components/site-editor-routes/navigation.mjs.map +2 -2
- package/build-module/components/site-editor-routes/notfound.mjs.map +2 -2
- package/build-module/components/site-editor-routes/page-item.mjs.map +2 -2
- package/build-module/components/site-editor-routes/pages.mjs.map +2 -2
- package/build-module/components/site-editor-routes/pattern-item.mjs.map +2 -2
- package/build-module/components/site-editor-routes/patterns.mjs.map +2 -2
- package/build-module/components/site-editor-routes/stylebook.mjs.map +2 -2
- package/build-module/components/site-editor-routes/styles.mjs.map +2 -2
- package/build-module/components/site-editor-routes/template-item.mjs.map +2 -2
- package/build-module/components/site-editor-routes/template-part-item.mjs.map +2 -2
- package/build-module/components/site-editor-routes/templates.mjs.map +2 -2
- package/build-module/components/site-hub/index.mjs.map +2 -2
- package/build-module/components/welcome-guide/editor.mjs.map +2 -2
- package/build-module/components/welcome-guide/index.mjs.map +2 -2
- package/build-module/components/welcome-guide/page.mjs.map +2 -2
- package/build-module/components/welcome-guide/template.mjs.map +2 -2
- package/build-module/deprecated.mjs.map +2 -2
- package/build-module/hooks/commands/use-common-commands.mjs.map +2 -2
- package/build-module/hooks/commands/use-set-command-context.mjs.map +2 -2
- package/build-module/index.mjs.map +2 -2
- package/build-module/lock-unlock.mjs.map +2 -2
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/index.mjs.map +2 -2
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/constants.mjs.map +2 -2
- package/build-module/utils/get-filtered-template-parts.mjs.map +2 -2
- package/build-module/utils/is-previewing-theme.mjs.map +2 -2
- package/build-module/utils/is-template-removable.mjs.map +2 -2
- package/build-module/utils/is-template-revertable.mjs.map +2 -2
- package/build-module/utils/use-activate-theme.mjs.map +2 -2
- package/build-module/utils/use-actual-current-theme.mjs.map +2 -2
- package/build-style/style-rtl.css +60 -14
- package/build-style/style.css +60 -14
- package/package.json +48 -48
- package/src/components/add-new-pattern/index.js +0 -7
- package/src/components/add-new-post/index.js +0 -3
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +0 -7
- package/src/components/add-new-template/add-custom-template-modal-content.js +0 -7
- package/src/components/add-new-template/index.js +0 -15
- package/src/components/add-new-template/utils.js +0 -7
- package/src/components/add-new-template-legacy/add-custom-generic-template-modal-content.js +0 -7
- package/src/components/add-new-template-legacy/add-custom-template-modal-content.js +0 -7
- package/src/components/add-new-template-legacy/index.js +0 -15
- package/src/components/add-new-template-legacy/utils.js +0 -7
- package/src/components/app/index.js +0 -7
- package/src/components/block-editor/use-editor-iframe-props.js +0 -11
- package/src/components/block-editor/use-navigate-to-entity-record.js +0 -7
- package/src/components/block-editor/use-site-editor-settings.js +0 -7
- package/src/components/block-editor/use-viewport-sync.js +0 -7
- package/src/components/canvas-loader/index.js +0 -7
- package/src/components/dataviews-actions/index.js +0 -7
- package/src/components/editor/index.js +6 -12
- package/src/components/editor/site-preview.js +0 -3
- package/src/components/editor/use-adapt-editor-to-canvas.js +0 -7
- package/src/components/editor/use-editor-title.js +0 -7
- package/src/components/editor/use-resolve-edited-entity.js +0 -7
- package/src/components/editor/use-revisions-url-sync.js +132 -0
- package/src/components/layout/animation.js +0 -7
- package/src/components/layout/hooks.js +0 -3
- package/src/components/layout/index.js +0 -12
- package/src/components/media/index.js +0 -3
- package/src/components/more-menu/index.js +0 -7
- package/src/components/more-menu/site-export.js +0 -3
- package/src/components/more-menu/welcome-guide-menu-item.js +0 -3
- package/src/components/page-patterns/actions.js +0 -7
- package/src/components/page-patterns/delete-category-menu-item.js +0 -7
- package/src/components/page-patterns/fields.js +0 -7
- package/src/components/page-patterns/index.js +0 -7
- package/src/components/page-patterns/rename-category-menu-item.js +0 -10
- package/src/components/page-patterns/search-items.js +0 -12
- package/src/components/page-patterns/style.scss +3 -0
- package/src/components/page-patterns/use-pattern-settings.js +0 -7
- package/src/components/page-patterns/use-patterns.js +0 -7
- package/src/components/page-templates/fields.js +0 -11
- package/src/components/page-templates/hooks.js +0 -7
- package/src/components/page-templates/index-legacy.js +0 -7
- package/src/components/page-templates/index.js +0 -7
- package/src/components/pagination/index.js +0 -7
- package/src/components/plugin-template-setting-panel/index.js +0 -4
- package/src/components/post-list/index.js +0 -9
- package/src/components/post-list/quick-edit-modal.js +0 -7
- package/src/components/post-list/use-notes-count.js +0 -3
- package/src/components/resizable-frame/index.js +0 -11
- package/src/components/routes/use-title.js +0 -7
- package/src/components/save-button/index.js +0 -7
- package/src/components/save-hub/index.js +0 -7
- package/src/components/save-keyboard-shortcut/index.js +0 -7
- package/src/components/save-panel/index.js +0 -11
- package/src/components/sidebar/index.js +0 -7
- package/src/components/sidebar-button/index.js +0 -7
- package/src/components/sidebar-dataviews/index.js +0 -7
- package/src/components/sidebar-global-styles/index.js +0 -7
- package/src/components/sidebar-identity/index.js +3 -3
- package/src/components/sidebar-navigation-item/index.js +0 -11
- package/src/components/sidebar-navigation-item/style.scss +3 -10
- package/src/components/sidebar-navigation-screen/index.js +0 -11
- package/src/components/sidebar-navigation-screen-details-footer/index.js +0 -7
- package/src/components/sidebar-navigation-screen-global-styles/content.js +0 -7
- package/src/components/sidebar-navigation-screen-global-styles/index.js +0 -7
- package/src/components/sidebar-navigation-screen-identity/index.js +0 -7
- package/src/components/sidebar-navigation-screen-main/index.js +0 -7
- package/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +0 -3
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +0 -7
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +0 -7
- package/src/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +0 -7
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +0 -3
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -6
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +0 -7
- package/src/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +0 -3
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +0 -8
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +38 -48
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +0 -7
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +0 -3
- package/src/components/sidebar-navigation-screen-patterns/index.js +0 -7
- package/src/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js +0 -7
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +0 -7
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +0 -7
- package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +0 -7
- package/src/components/sidebar-navigation-screen-templates-browse/content-legacy.js +0 -7
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +1 -8
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +0 -7
- package/src/components/sidebar-navigation-screen-unsupported/index.js +0 -3
- package/src/components/site-editor-routes/home.js +0 -3
- package/src/components/site-editor-routes/identity.js +0 -3
- package/src/components/site-editor-routes/index.js +0 -7
- package/src/components/site-editor-routes/navigation-item.js +0 -3
- package/src/components/site-editor-routes/navigation.js +0 -3
- package/src/components/site-editor-routes/notfound.js +0 -7
- package/src/components/site-editor-routes/page-item.js +0 -7
- package/src/components/site-editor-routes/pages.js +0 -7
- package/src/components/site-editor-routes/pattern-item.js +0 -3
- package/src/components/site-editor-routes/patterns.js +0 -3
- package/src/components/site-editor-routes/stylebook.js +0 -7
- package/src/components/site-editor-routes/styles.js +0 -7
- package/src/components/site-editor-routes/template-item.js +0 -3
- package/src/components/site-editor-routes/template-part-item.js +0 -3
- package/src/components/site-editor-routes/templates.js +0 -7
- package/src/components/site-hub/index.js +0 -7
- package/src/components/welcome-guide/editor.js +0 -7
- package/src/components/welcome-guide/index.js +0 -3
- package/src/components/welcome-guide/page.js +0 -3
- package/src/components/welcome-guide/template.js +0 -3
- package/src/deprecated.js +0 -3
- package/src/hooks/commands/use-common-commands.js +0 -7
- package/src/hooks/commands/use-set-command-context.js +0 -7
- package/src/index.js +0 -7
- package/src/lock-unlock.js +0 -3
- package/src/store/actions.js +0 -7
- package/src/store/index.js +0 -7
- package/src/store/reducer.js +0 -3
- package/src/store/selectors.js +0 -7
- package/src/utils/constants.js +0 -7
- package/src/utils/get-filtered-template-parts.js +0 -3
- package/src/utils/is-previewing-theme.js +0 -3
- package/src/utils/is-template-removable.js +0 -3
- package/src/utils/is-template-revertable.js +0 -3
- package/src/utils/test/get-filtered-template-parts.js +0 -3
- package/src/utils/use-activate-theme.js +0 -7
- package/src/utils/use-actual-current-theme.js +0 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/app/index.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { useSelect } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport Layout from '../layout';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport { useCommonCommands } from '../../hooks/commands/use-common-commands';\nimport useSetCommandContext from '../../hooks/commands/use-set-command-context';\nimport { useRegisterSiteEditorRoutes } from '../site-editor-routes';\nimport {\n\tcurrentlyPreviewingTheme,\n\tisPreviewingTheme,\n} from '../../utils/is-previewing-theme';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\n\nfunction AppLayout() {\n\tuseCommonCommands();\n\tuseSetCommandContext();\n\n\treturn <Layout />;\n}\n\nexport default function App() {\n\tuseRegisterSiteEditorRoutes();\n\tconst { routes, currentTheme, editorSettings } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\troutes: unlock( select( editSiteStore ) ).getRoutes(),\n\t\t\tcurrentTheme: select( coreStore ).getCurrentTheme(),\n\t\t\t// This is a temp solution until the has_theme_json value is available for the current theme.\n\t\t\teditorSettings: select( editSiteStore ).getSettings(),\n\t\t};\n\t}, [] );\n\n\tconst beforeNavigate = useCallback( ( { path, query } ) => {\n\t\tif ( ! isPreviewingTheme() ) {\n\t\t\treturn { path, query };\n\t\t}\n\n\t\treturn {\n\t\t\tpath,\n\t\t\tquery: {\n\t\t\t\t...query,\n\t\t\t\twp_theme_preview:\n\t\t\t\t\t'wp_theme_preview' in query\n\t\t\t\t\t\t? query.wp_theme_preview\n\t\t\t\t\t\t: currentlyPreviewingTheme(),\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst matchResolverArgsValue = useMemo(\n\t\t() => ( {\n\t\t\tsiteData: { currentTheme, editorSettings },\n\t\t} ),\n\t\t[ currentTheme, editorSettings ]\n\t);\n\n\treturn (\n\t\t<RouterProvider\n\t\t\troutes={ routes }\n\t\t\tpathArg=\"p\"\n\t\t\tbeforeNavigate={ beforeNavigate }\n\t\t\tmatchResolverArgs={ matchResolverArgsValue }\n\t\t>\n\t\t\t<AppLayout />\n\t\t</RouterProvider>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,iBAAiB;AAC1B,SAAS,eAAe,yBAAyB;AACjD,SAAS,aAAa,eAAe;AACrC,SAAS,SAAS,iBAAiB;AACnC,OAAO,YAAY;AACnB,SAAS,cAAc;AACvB,SAAS,SAAS,qBAAqB;AACvC,SAAS,yBAAyB;AAClC,OAAO,0BAA0B;AACjC,SAAS,mCAAmC;AAC5C;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAQC;AANR,IAAM,EAAE,eAAe,IAAI,OAAQ,iBAAkB;AAErD,SAAS,YAAY;AACpB,oBAAkB;AAClB,uBAAqB;AAErB,SAAO,oBAAC,UAAO;AAChB;AAEe,SAAR,MAAuB;AAC7B,8BAA4B;AAC5B,QAAM,EAAE,QAAQ,cAAc,eAAe,IAAI,UAAW,CAAE,WAAY;AACzE,WAAO;AAAA,MACN,QAAQ,OAAQ,OAAQ,aAAc,CAAE,EAAE,UAAU;AAAA,MACpD,cAAc,OAAQ,SAAU,EAAE,gBAAgB;AAAA;AAAA,MAElD,gBAAgB,OAAQ,aAAc,EAAE,YAAY;AAAA,IACrD;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,QAAM,iBAAiB,YAAa,CAAE,EAAE,MAAM,MAAM,MAAO;AAC1D,QAAK,CAAE,kBAAkB,GAAI;AAC5B,aAAO,EAAE,MAAM,MAAM;AAAA,IACtB;AAEA,WAAO;AAAA,MACN;AAAA,MACA,OAAO;AAAA,QACN,GAAG;AAAA,QACH,kBACC,sBAAsB,QACnB,MAAM,mBACN,yBAAyB;AAAA,MAC9B;AAAA,IACD;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,QAAM,yBAAyB;AAAA,IAC9B,OAAQ;AAAA,MACP,UAAU,EAAE,cAAc,eAAe;AAAA,IAC1C;AAAA,IACA,CAAE,cAAc,cAAe;AAAA,EAChC;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,SAAQ;AAAA,MACR;AAAA,MACA,mBAAoB;AAAA,MAEpB,8BAAC,aAAU;AAAA;AAAA,EACZ;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-editor/use-editor-iframe-props.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport { useSelect } from '@wordpress/data';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\nimport { useState, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { addQueryArgs } from '@wordpress/url';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport default function useEditorIframeProps() {\n\tconst { query, path } = useLocation();\n\tconst history = useHistory();\n\tconst { canvas = 'view' } = query;\n\tconst currentPostIsTrashed = useSelect( ( select ) => {\n\t\treturn (\n\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t'trash'\n\t\t);\n\t}, [] );\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( canvas === 'edit' ) {\n\t\t\tsetIsFocused( false );\n\t\t}\n\t}, [ canvas ] );\n\n\t// In view mode, make the canvas iframe be perceived and behave as a button\n\t// to switch to edit mode, with a meaningful label and no title attribute.\n\tconst viewModeIframeProps = {\n\t\t'aria-label': __( 'Edit' ),\n\t\t'aria-disabled': currentPostIsTrashed,\n\t\ttitle: null,\n\t\trole: 'button',\n\t\ttabIndex: 0,\n\t\tonFocus: () => setIsFocused( true ),\n\t\tonBlur: () => setIsFocused( false ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tconst { keyCode } = event;\n\t\t\tif (\n\t\t\t\t( keyCode === ENTER || keyCode === SPACE ) &&\n\t\t\t\t! currentPostIsTrashed\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\thistory.navigate( addQueryArgs( path, { canvas: 'edit' } ), {\n\t\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\tonClick: () =>\n\t\t\thistory.navigate( addQueryArgs( path, { canvas: 'edit' } ), {\n\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t} ),\n\t\tonClickCapture: ( event ) => {\n\t\t\tif ( currentPostIsTrashed ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\t\t\t}\n\t\t},\n\t\treadonly: true,\n\t};\n\n\treturn {\n\t\tclassName: clsx( 'edit-site-visual-editor__editor-canvas', {\n\t\t\t'is-focused': isFocused && canvas === 'view',\n\t\t} ),\n\t\t...( canvas === 'view' ? viewModeIframeProps : {} ),\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,OAAO,aAAa;AAC7B,SAAS,UAAU,iBAAiB;AACpC,SAAS,UAAU;AACnB,SAAS,SAAS,mBAAmB;AACrC,SAAS,eAAe,yBAAyB;AACjD,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AAEvB,IAAM,EAAE,aAAa,WAAW,IAAI,OAAQ,iBAAkB;AAE/C,SAAR,uBAAwC;AAC9C,QAAM,EAAE,OAAO,KAAK,IAAI,YAAY;AACpC,QAAM,UAAU,WAAW;AAC3B,QAAM,EAAE,SAAS,OAAO,IAAI;AAC5B,QAAM,uBAAuB,UAAW,CAAE,WAAY;AACrD,WACC,OAAQ,WAAY,EAAE,wBAAyB,QAAS,MACxD;AAAA,EAEF,GAAG,CAAC,CAAE;AACN,QAAM,CAAE,WAAW,YAAa,IAAI,SAAU,KAAM;AAEpD,YAAW,MAAM;AAChB,QAAK,WAAW,QAAS;AACxB,mBAAc,KAAM;AAAA,IACrB;AAAA,EACD,GAAG,CAAE,MAAO,CAAE;AAId,QAAM,sBAAsB;AAAA,IAC3B,cAAc,GAAI,MAAO;AAAA,IACzB,iBAAiB;AAAA,IACjB,OAAO;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS,MAAM,aAAc,IAAK;AAAA,IAClC,QAAQ,MAAM,aAAc,KAAM;AAAA,IAClC,WAAW,CAAE,UAAW;AACvB,YAAM,EAAE,QAAQ,IAAI;AACpB,WACG,YAAY,SAAS,YAAY,UACnC,CAAE,sBACD;AACD,cAAM,eAAe;AACrB,gBAAQ,SAAU,aAAc,MAAM,EAAE,QAAQ,OAAO,CAAE,GAAG;AAAA,UAC3D,YAAY;AAAA,QACb,CAAE;AAAA,MACH;AAAA,IACD;AAAA,IACA,SAAS,MACR,QAAQ,SAAU,aAAc,MAAM,EAAE,QAAQ,OAAO,CAAE,GAAG;AAAA,MAC3D,YAAY;AAAA,IACb,CAAE;AAAA,IACH,gBAAgB,CAAE,UAAW;AAC5B,UAAK,sBAAuB;AAC3B,cAAM,eAAe;AACrB,cAAM,gBAAgB;AAAA,MACvB;AAAA,IACD;AAAA,IACA,UAAU;AAAA,EACX;AAEA,SAAO;AAAA,IACN,WAAW,KAAM,0CAA0C;AAAA,MAC1D,cAAc,aAAa,WAAW;AAAA,IACvC,CAAE;AAAA,IACF,GAAK,WAAW,SAAS,sBAAsB,CAAC;AAAA,EACjD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-editor/use-navigate-to-entity-record.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { useSelect, useRegistry } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useCallback } from '@wordpress/element';\nimport { addQueryArgs } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { unlock } from '../../lock-unlock';\nimport { DEFAULT_DEVICE_TYPE } from './use-viewport-sync';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\nconst VALID_VIEWPORTS = [ 'desktop', 'tablet', 'mobile' ];\n/**\n * Hook to handle navigation to entity records.\n *\n * @return {Function} Function to navigate to an entity record.\n */\nexport default function useNavigateToEntityRecord() {\n\tconst history = useHistory();\n\tconst location = useLocation();\n\tconst { query, path } = location;\n\tconst registry = useRegistry();\n\tconst currentDeviceType = useSelect(\n\t\t( select ) => select( editorStore ).getDeviceType(),\n\t\t[]\n\t);\n\n\tconst onNavigateToEntityRecord = useCallback(\n\t\t( params ) => {\n\t\t\t// Read entity selection (already has external IDs from onChangeSelection)\n\t\t\tconst currentPostType = registry\n\t\t\t\t.select( editorStore )\n\t\t\t\t.getCurrentPostType();\n\t\t\tconst currentPostId = registry\n\t\t\t\t.select( editorStore )\n\t\t\t\t.getCurrentPostId();\n\t\t\tconst entityEdits = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityRecordEdits(\n\t\t\t\t\t'postType',\n\t\t\t\t\tcurrentPostType,\n\t\t\t\t\tcurrentPostId\n\t\t\t\t);\n\t\t\tconst externalClientId =\n\t\t\t\tentityEdits?.selection?.selectionStart?.clientId;\n\n\t\t\tconst urlUpdates = { ...query };\n\n\t\t\t// Store the selected block in the URL for restoration when navigating back.\n\t\t\tif ( externalClientId ) {\n\t\t\t\turlUpdates.selectedBlock = externalClientId;\n\t\t\t}\n\n\t\t\t// Save the current viewport for when we navigate back (e.g. from overlay editor).\n\t\t\t// Omit viewport from URL when it's the default to keep URLs clean.\n\t\t\tconst requestedViewport =\n\t\t\t\ttypeof params.viewport === 'string'\n\t\t\t\t\t? params.viewport.toLowerCase()\n\t\t\t\t\t: undefined;\n\t\t\tconst isValidRequestedViewport =\n\t\t\t\tVALID_VIEWPORTS.includes( requestedViewport );\n\n\t\t\tif ( isValidRequestedViewport ) {\n\t\t\t\tconst currentViewportLower = (\n\t\t\t\t\tcurrentDeviceType || DEFAULT_DEVICE_TYPE\n\t\t\t\t).toLowerCase();\n\t\t\t\tif (\n\t\t\t\t\tcurrentViewportLower === DEFAULT_DEVICE_TYPE.toLowerCase()\n\t\t\t\t) {\n\t\t\t\t\tdelete urlUpdates.viewport;\n\t\t\t\t} else {\n\t\t\t\t\turlUpdates.viewport = currentViewportLower;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst hasUpdatesToSave =\n\t\t\t\texternalClientId || isValidRequestedViewport;\n\t\t\tif ( hasUpdatesToSave ) {\n\t\t\t\thistory.navigate( addQueryArgs( path, urlUpdates ), {\n\t\t\t\t\treplace: true,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t// Navigate to the new entity record\n\t\t\tconst queryArgs = {\n\t\t\t\tcanvas: 'edit',\n\t\t\t\tfocusMode: true,\n\t\t\t};\n\t\t\tif ( isValidRequestedViewport ) {\n\t\t\t\tqueryArgs.viewport = requestedViewport;\n\t\t\t}\n\t\t\tconst url = addQueryArgs(\n\t\t\t\t`/${ params.postType }/${ params.postId }`,\n\t\t\t\tqueryArgs\n\t\t\t);\n\n\t\t\thistory.navigate( url );\n\t\t},\n\t\t[ history, path, query, registry, currentDeviceType ]\n\t);\n\n\treturn onNavigateToEntityRecord;\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,WAAW,mBAAmB;AACvC,SAAS,eAAe,yBAAyB;AACjD,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,SAAS,iBAAiB;AACnC,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AACvB,SAAS,2BAA2B;AAEpC,IAAM,EAAE,YAAY,YAAY,IAAI,OAAQ,iBAAkB;AAE9D,IAAM,kBAAkB,CAAE,WAAW,UAAU,QAAS;AAMzC,SAAR,4BAA6C;AACnD,QAAM,UAAU,WAAW;AAC3B,QAAM,WAAW,YAAY;AAC7B,QAAM,EAAE,OAAO,KAAK,IAAI;AACxB,QAAM,WAAW,YAAY;AAC7B,QAAM,oBAAoB;AAAA,IACzB,CAAE,WAAY,OAAQ,WAAY,EAAE,cAAc;AAAA,IAClD,CAAC;AAAA,EACF;AAEA,QAAM,2BAA2B;AAAA,IAChC,CAAE,WAAY;AAEb,YAAM,kBAAkB,SACtB,OAAQ,WAAY,EACpB,mBAAmB;AACrB,YAAM,gBAAgB,SACpB,OAAQ,WAAY,EACpB,iBAAiB;AACnB,YAAM,cAAc,SAClB,OAAQ,SAAU,EAClB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD;AACD,YAAM,mBACL,aAAa,WAAW,gBAAgB;AAEzC,YAAM,aAAa,EAAE,GAAG,MAAM;AAG9B,UAAK,kBAAmB;AACvB,mBAAW,gBAAgB;AAAA,MAC5B;AAIA,YAAM,oBACL,OAAO,OAAO,aAAa,WACxB,OAAO,SAAS,YAAY,IAC5B;AACJ,YAAM,2BACL,gBAAgB,SAAU,iBAAkB;AAE7C,UAAK,0BAA2B;AAC/B,cAAM,wBACL,qBAAqB,qBACpB,YAAY;AACd,YACC,yBAAyB,oBAAoB,YAAY,GACxD;AACD,iBAAO,WAAW;AAAA,QACnB,OAAO;AACN,qBAAW,WAAW;AAAA,QACvB;AAAA,MACD;AAEA,YAAM,mBACL,oBAAoB;AACrB,UAAK,kBAAmB;AACvB,gBAAQ,SAAU,aAAc,MAAM,UAAW,GAAG;AAAA,UACnD,SAAS;AAAA,QACV,CAAE;AAAA,MACH;AAGA,YAAM,YAAY;AAAA,QACjB,QAAQ;AAAA,QACR,WAAW;AAAA,MACZ;AACA,UAAK,0BAA2B;AAC/B,kBAAU,WAAW;AAAA,MACtB;AACA,YAAM,MAAM;AAAA,QACX,IAAK,OAAO,QAAS,IAAK,OAAO,MAAO;AAAA,QACxC;AAAA,MACD;AAEA,cAAQ,SAAU,GAAI;AAAA,IACvB;AAAA,IACA,CAAE,SAAS,MAAM,OAAO,UAAU,iBAAkB;AAAA,EACrD;AAEA,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-editor/use-site-editor-settings.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { usePrevious } from '@wordpress/compose';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { generateGlobalStyles } from '@wordpress/global-styles-engine';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport useNavigateToEntityRecord from './use-navigate-to-entity-record';\nimport { FOCUSABLE_ENTITIES } from '../../utils/constants';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\nconst { useGlobalStyles } = unlock( editorPrivateApis );\n\nfunction useNavigateToPreviousEntityRecord() {\n\tconst location = useLocation();\n\tconst previousCanvas = usePrevious( location.query.canvas );\n\tconst history = useHistory();\n\tconst goBack = useMemo( () => {\n\t\tconst isFocusMode =\n\t\t\tlocation.query.focusMode ||\n\t\t\t( location?.params?.postId &&\n\t\t\t\tFOCUSABLE_ENTITIES.includes( location?.params?.postType ) );\n\t\tconst didComeFromEditorCanvas = previousCanvas === 'edit';\n\t\tconst showBackButton = isFocusMode && didComeFromEditorCanvas;\n\t\treturn showBackButton ? () => history.back() : undefined;\n\t}, [ location, history, previousCanvas ] );\n\treturn goBack;\n}\n\nexport function useSpecificEditorSettings() {\n\tconst { query } = useLocation();\n\tconst { canvas = 'view' } = query;\n\tconst onNavigateToEntityRecord = useNavigateToEntityRecord();\n\n\t/*\n\t * Generate global styles directly to avoid circular dependency with GlobalStylesRenderer\n\t * (which runs inside ExperimentalEditorProvider after this hook).\n\t * GlobalStylesRenderer updates editorStore, but reading from it here would cause infinite\n\t * loops. Reading config from useGlobalStyles and generating CSS directly keeps us in sync.\n\t * See: https://github.com/WordPress/gutenberg/issues/73350\n\t */\n\tconst { merged: mergedConfig } = useGlobalStyles();\n\n\tconst { settings, currentPostIsTrashed } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( editSiteStore );\n\t\tconst { getCurrentPostAttribute } = select( editorStore );\n\t\treturn {\n\t\t\tsettings: getSettings(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tgetCurrentPostAttribute( 'status' ) === 'trash',\n\t\t};\n\t}, [] );\n\n\tconst onNavigateToPreviousEntityRecord =\n\t\tuseNavigateToPreviousEntityRecord();\n\n\tconst [ globalStyles, globalSettings ] = useMemo( () => {\n\t\treturn generateGlobalStyles( mergedConfig, [], {\n\t\t\tdisableRootPadding: false,\n\t\t} );\n\t}, [ mergedConfig ] );\n\n\tconst defaultEditorSettings = useMemo( () => {\n\t\t// Preserve non-global styles from settings.styles (e.g., editor styles from add_editor_style)\n\t\tconst nonGlobalStyles = ( settings?.styles ?? [] ).filter(\n\t\t\t( style ) => ! style.isGlobalStyles\n\t\t);\n\n\t\treturn {\n\t\t\t...settings,\n\t\t\tstyles: [\n\t\t\t\t...nonGlobalStyles,\n\t\t\t\t...globalStyles,\n\t\t\t\t{\n\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\tcss:\n\t\t\t\t\t\tcanvas === 'view'\n\t\t\t\t\t\t\t? `body{min-height: 100vh; ${\n\t\t\t\t\t\t\t\t\tcurrentPostIsTrashed\n\t\t\t\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t\t\t\t: 'cursor: pointer;'\n\t\t\t\t\t\t\t }}`\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t],\n\t\t\t__experimentalFeatures: globalSettings,\n\t\t\trichEditingEnabled: true,\n\t\t\tsupportsTemplateMode: true,\n\t\t\tfocusMode: canvas !== 'view',\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tisPreviewMode: canvas === 'view',\n\t\t};\n\t}, [\n\t\tsettings,\n\t\tglobalStyles,\n\t\tglobalSettings,\n\t\tcanvas,\n\t\tcurrentPostIsTrashed,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t] );\n\n\treturn defaultEditorSettings;\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SA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e,IAAI,QAAS,MAAM;AACvD,WAAO,qBAAsB,cAAc,CAAC,GAAG;AAAA,MAC9C,oBAAoB;AAAA,IACrB,CAAE;AAAA,EACH,GAAG,CAAE,YAAa,CAAE;AAEpB,QAAM,wBAAwB,QAAS,MAAM;AAE5C,UAAM,mBAAoB,UAAU,UAAU,CAAC,GAAI;AAAA,MAClD,CAAE,UAAW,CAAE,MAAM;AAAA,IACtB;AAEA,WAAO;AAAA,MACN,GAAG;AAAA,MACH,QAAQ;AAAA,QACP,GAAG;AAAA,QACH,GAAG;AAAA,QACH;AAAA;AAAA;AAAA,UAGC,KACC,WAAW,SACR,2BACA,uBACG,KACA,kBACH,MACA;AAAA,QACL;AAAA,MACD;AAAA,MACA,wBAAwB;AAAA,MACxB,oBAAoB;AAAA,MACpB,sBAAsB;AAAA,MACtB,WAAW,WAAW;AAAA,MACtB;AAAA,MACA;AAAA,MACA,eAAe,WAAW;AAAA,IAC3B;AAAA,EACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AAEF,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-editor/use-viewport-sync.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as editorStore } from '@wordpress/editor';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport const DEFAULT_DEVICE_TYPE = 'Desktop';\n\n// Lowercase values for URL params. Duplicated from block-editor block-visibility constants\n// and editor preview-dropdown choices. See those files when adding new viewport types.\nconst VALID_DEVICE_TYPES = [ 'desktop', 'tablet', 'mobile' ];\n\n// URL viewport params are lowercase; the editor store uses PascalCase.\nconst capitalize = ( str ) => str.charAt( 0 ).toUpperCase() + str.slice( 1 );\n\n/**\n * Syncs the editor's device type with the `viewport` URL query param.\n *\n * Intentionally responds to ongoing URL changes (not just initial load) so that\n * viewport is restored correctly when navigating back (e.g. from overlay template\n * part editor to the previous entity).\n */\nexport default function useViewportSync() {\n\tconst { query } = useLocation();\n\tconst { setDeviceType } = useDispatch( editorStore );\n\n\tuseEffect( () => {\n\t\tconst viewport = query?.viewport?.toLowerCase();\n\t\tconst isValid = VALID_DEVICE_TYPES.includes( viewport );\n\n\t\tsetDeviceType( isValid ? capitalize( viewport ) : DEFAULT_DEVICE_TYPE );\n\t}, [ query?.viewport, setDeviceType ] );\n}\n\n/**\n * Component wrapper that runs the viewport sync hook.\n * Renders nothing; used to run the hook inside the Editor tree (inside EditorProvider).\n */\nexport function ViewportSync() {\n\tuseViewportSync();\n\treturn null;\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,eAAe,yBAAyB;AACjD,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AAEvB,IAAM,EAAE,YAAY,IAAI,OAAQ,iBAAkB;AAE3C,IAAM,sBAAsB;AAInC,IAAM,qBAAqB,CAAE,WAAW,UAAU,QAAS;AAG3D,IAAM,aAAa,CAAE,QAAS,IAAI,OAAQ,CAAE,EAAE,YAAY,IAAI,IAAI,MAAO,CAAE;AAS5D,SAAR,kBAAmC;AACzC,QAAM,EAAE,MAAM,IAAI,YAAY;AAC9B,QAAM,EAAE,cAAc,IAAI,YAAa,WAAY;AAEnD,YAAW,MAAM;AAChB,UAAM,WAAW,OAAO,UAAU,YAAY;AAC9C,UAAM,UAAU,mBAAmB,SAAU,QAAS;AAEtD,kBAAe,UAAU,WAAY,QAAS,IAAI,mBAAoB;AAAA,EACvE,GAAG,CAAE,OAAO,UAAU,aAAc,CAAE;AACvC;AAMO,SAAS,eAAe;AAC9B,kBAAgB;AAChB,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/canvas-loader/index.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { ProgressBar } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { unlock } from '../../lock-unlock';\n\nconst { useStyle } = unlock( editorPrivateApis );\n\nexport default function CanvasLoader( { id } ) {\n\tconst textColor = useStyle( 'color.text' );\n\tconst { elapsed, total } = useSelect( ( select ) => {\n\t\tconst selectorsByStatus = select( coreStore ).countSelectorsByStatus();\n\t\tconst resolving = selectorsByStatus.resolving ?? 0;\n\t\tconst finished = selectorsByStatus.finished ?? 0;\n\t\treturn {\n\t\t\telapsed: finished,\n\t\t\ttotal: finished + resolving,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"edit-site-canvas-loader\"\n\t\t\tstyle={ textColor ? { '--color': textColor } : undefined }\n\t\t>\n\t\t\t<ProgressBar id={ id } max={ total } value={ elapsed } />\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,mBAAmB;AAC5B,SAAS,SAAS,iBAAiB;AACnC,SAAS,iBAAiB;AAC1B,SAAS,eAAe,yBAAyB;AACjD,SAAS,cAAc;AAqBpB;AAnBH,IAAM,EAAE,SAAS,IAAI,OAAQ,iBAAkB;AAEhC,SAAR,aAA+B,EAAE,GAAG,GAAI;AAC9C,QAAM,YAAY,SAAU,YAAa;AACzC,QAAM,EAAE,SAAS,MAAM,IAAI,UAAW,CAAE,WAAY;AACnD,UAAM,oBAAoB,OAAQ,SAAU,EAAE,uBAAuB;AACrE,UAAM,YAAY,kBAAkB,aAAa;AACjD,UAAM,WAAW,kBAAkB,YAAY;AAC/C,WAAO;AAAA,MACN,SAAS;AAAA,MACT,OAAO,WAAW;AAAA,IACnB;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,OAAQ,YAAY,EAAE,WAAW,UAAU,IAAI;AAAA,MAE/C,8BAAC,eAAY,IAAU,KAAM,OAAQ,OAAQ,SAAU;AAAA;AAAA,EACxD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataviews-actions/index.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { pencil, drawerRight } from '@wordpress/icons';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { PATTERN_TYPES } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport const useSetActiveTemplateAction = () => {\n\tconst activeTheme = useSelect( ( select ) =>\n\t\tselect( coreStore ).getCurrentTheme()\n\t);\n\tconst { getEntityRecord } = useSelect( coreStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'set-active-template',\n\t\t\tlabel( items ) {\n\t\t\t\treturn items.some( ( item ) => item._isActive )\n\t\t\t\t\t? __( 'Deactivate' )\n\t\t\t\t\t: __( 'Activate' );\n\t\t\t},\n\t\t\tisPrimary: true,\n\t\t\ticon: pencil,\n\t\t\tisEligible( item ) {\n\t\t\t\tif ( item.theme !== activeTheme.stylesheet ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// If it's not a created template but a registered template,\n\t\t\t\t// only allow activating (so when it's inactive).\n\t\t\t\tif ( typeof item.id !== 'number' ) {\n\t\t\t\t\treturn item._isActive === false;\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tasync callback( items ) {\n\t\t\t\tconst deactivate = items.some( ( item ) => item._isActive );\n\t\t\t\t// current active templates\n\t\t\t\tconst activeTemplates = {\n\t\t\t\t\t...( ( await getEntityRecord( 'root', 'site' )\n\t\t\t\t\t\t.active_templates ) ?? {} ),\n\t\t\t\t};\n\t\t\t\tfor ( const item of items ) {\n\t\t\t\t\tif ( deactivate ) {\n\t\t\t\t\t\tdelete activeTemplates[ item.slug ];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tactiveTemplates[ item.slug ] = item.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tawait editEntityRecord( 'root', 'site', undefined, {\n\t\t\t\t\tactive_templates: activeTemplates,\n\t\t\t\t} );\n\t\t\t\tawait saveEditedEntityRecord( 'root', 'site' );\n\t\t\t},\n\t\t} ),\n\t\t[\n\t\t\teditEntityRecord,\n\t\t\tsaveEditedEntityRecord,\n\t\t\tgetEntityRecord,\n\t\t\tactiveTheme,\n\t\t]\n\t);\n};\n\nexport const useEditPostAction = () => {\n\tconst history = useHistory();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'edit-post',\n\t\t\tlabel: __( 'Edit' ),\n\t\t\ticon: pencil,\n\t\t\tisEligible( post ) {\n\t\t\t\tif ( post.status === 'trash' ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t// It's eligible for all post types except theme patterns.\n\t\t\t\treturn post.type !== PATTERN_TYPES.theme;\n\t\t\t},\n\t\t\tcallback( items ) {\n\t\t\t\tconst post = items[ 0 ];\n\t\t\t\thistory.navigate( `/${ post.type }/${ post.id }?canvas=edit` );\n\t\t\t},\n\t\t} ),\n\t\t[ history ]\n\t);\n};\n\nexport const useQuickEditPostAction = () => {\n\tconst history = useHistory();\n\tconst { path, query } = useLocation();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'quick-edit',\n\t\t\tlabel: __( 'Quick Edit' ),\n\t\t\ticon: drawerRight,\n\t\t\tisPrimary: true,\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( post ) {\n\t\t\t\tif ( post.status === 'trash' ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn post.type === 'page';\n\t\t\t},\n\t\t\tcallback( items ) {\n\t\t\t\thistory.navigate(\n\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\t...query,\n\t\t\t\t\t\tquickEdit: true,\n\t\t\t\t\t\tpostId: items.map( ( item ) => item.id ).join( ',' ),\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t} ),\n\t\t[ history, path, query ]\n\t);\n};\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,QAAQ,mBAAmB;AACpC,SAAS,eAAe;AACxB,SAAS,eAAe,yBAAyB;AACjD,SAAS,aAAa,iBAAiB;AACvC,SAAS,SAAS,iBAAiB;AACnC,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AAEvB,IAAM,EAAE,aAAa,WAAW,IAAI,OAAQ,iBAAkB;AAEvD,IAAM,6BAA6B,MAAM;AAC/C,QAAM,cAAc;AAAA,IAAW,CAAE,WAChC,OAAQ,SAAU,EAAE,gBAAgB;AAAA,EACrC;AACA,QAAM,EAAE,gBAAgB,IAAI,UAAW,SAAU;AACjD,QAAM,EAAE,kBAAkB,uBAAuB,IAChD,YAAa,SAAU;AACxB,SAAO;AAAA,IACN,OAAQ;AAAA,MACP,IAAI;AAAA,MACJ,MAAO,OAAQ;AACd,eAAO,MAAM,KAAM,CAAE,SAA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9D;AAAA,IACD;AAAA,IACA,CAAE,OAAQ;AAAA,EACX;AACD;AAEO,IAAM,yBAAyB,MAAM;AAC3C,QAAM,UAAU,WAAW;AAC3B,QAAM,EAAE,MAAM,MAAM,IAAI,YAAY;AACpC,SAAO;AAAA,IACN,OAAQ;AAAA,MACP,IAAI;AAAA,MACJ,OAAO,GAAI,YAAa;AAAA,MACxB,MAAM;AAAA,MACN,WAAW;AAAA,MACX,cAAc;AAAA,MACd,WAAY,MAAO;AAClB,YAAK,KAAK,WAAW,SAAU;AAC9B,iBAAO;AAAA,QACR;AAEA,eAAO,KAAK,SAAS;AAAA,MACtB;AAAA,MACA,SAAU,OAAQ;AACjB,gBAAQ;AAAA,UACP,aAAc,MAAM;AAAA,YACnB,GAAG;AAAA,YACH,WAAW;AAAA,YACX,QAAQ,MAAM,IAAK,CAAE,SAAU,KAAK,EAAG,EAAE,KAAM,GAAI;AAAA,UACpD,CAAE;AAAA,QACH;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,SAAS,MAAM,KAAM;AAAA,EACxB;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -29,6 +29,7 @@ import SiteEditorMoreMenu from "../more-menu/index.mjs";
|
|
|
29
29
|
import useEditorIframeProps from "../block-editor/use-editor-iframe-props.mjs";
|
|
30
30
|
import { ViewportSync } from "../block-editor/use-viewport-sync.mjs";
|
|
31
31
|
import useEditorTitle from "./use-editor-title.mjs";
|
|
32
|
+
import useRevisionsURLSync from "./use-revisions-url-sync.mjs";
|
|
32
33
|
import { useIsSiteEditorLoading } from "../layout/hooks.mjs";
|
|
33
34
|
import { useAdaptEditorToCanvas } from "./use-adapt-editor-to-canvas.mjs";
|
|
34
35
|
import {
|
|
@@ -69,7 +70,7 @@ function getNavigationPath(location, postType) {
|
|
|
69
70
|
].includes(name)) {
|
|
70
71
|
return getListPathForPostType(postType);
|
|
71
72
|
}
|
|
72
|
-
return addQueryArgs(path, { canvas: void 0 });
|
|
73
|
+
return addQueryArgs(path, { canvas: void 0, revision: void 0 });
|
|
73
74
|
}
|
|
74
75
|
function EditSiteEditor({ isHomeRoute = false }) {
|
|
75
76
|
const location = useLocation();
|
|
@@ -85,13 +86,13 @@ function EditSiteEditor({ isHomeRoute = false }) {
|
|
|
85
86
|
[]
|
|
86
87
|
);
|
|
87
88
|
const postWithTemplate = !!context?.postId;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
);
|
|
89
|
+
const editorPostType = postWithTemplate ? context.postType : postType;
|
|
90
|
+
const editorPostId = postWithTemplate ? context.postId : postId;
|
|
91
|
+
useEditorTitle(editorPostType, editorPostId);
|
|
92
92
|
const _isPreviewingTheme = isPreviewingTheme();
|
|
93
93
|
const iframeProps = useEditorIframeProps();
|
|
94
94
|
const isEditMode = canvas === "edit";
|
|
95
|
+
useRevisionsURLSync(isEditMode, editorPostType, editorPostId);
|
|
95
96
|
const loadingProgressId = useInstanceId(
|
|
96
97
|
CanvasLoader,
|
|
97
98
|
"edit-site-editor__loading-progress"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor/index.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { useDispatch, useSelect } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, isRTL, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport WelcomeGuide from '../welcome-guide';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\nimport SiteEditorMoreMenu from '../more-menu';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\nimport { ViewportSync } from '../block-editor/use-viewport-sync';\nimport useEditorTitle from './use-editor-title';\nimport useRevisionsURLSync from './use-revisions-url-sync';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport {\n\tuseResolveEditedEntity,\n\tuseSyncDeprecatedEntityIntoState,\n} from './use-resolve-edited-entity';\nimport SitePreview from './site-preview';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nfunction getListPathForPostType( postType ) {\n\tswitch ( postType ) {\n\t\tcase 'navigation':\n\t\t\treturn '/navigation';\n\t\tcase 'wp_block':\n\t\t\treturn '/pattern?postType=wp_block';\n\t\tcase 'wp_template_part':\n\t\t\treturn '/pattern?postType=wp_template_part';\n\t\tcase 'wp_template':\n\t\t\treturn '/template';\n\t\tcase 'page':\n\t\t\treturn '/page';\n\t\tcase 'post':\n\t\t\treturn '/';\n\t}\n\tthrow 'Unknown post type';\n}\n\nfunction getNavigationPath( location, postType ) {\n\tconst { path, name } = location;\n\tif (\n\t\t[\n\t\t\t'pattern-item',\n\t\t\t'template-part-item',\n\t\t\t'page-item',\n\t\t\t'template-item',\n\t\t\t'static-template-item',\n\t\t\t'post-item',\n\t\t].includes( name )\n\t) {\n\t\treturn getListPathForPostType( postType );\n\t}\n\treturn addQueryArgs( path, { canvas: undefined, revision: undefined } );\n}\n\nexport default function EditSiteEditor( { isHomeRoute = false } ) {\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst { canvas = 'view' } = location.query;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst entity = useResolveEditedEntity();\n\t// deprecated sync state with url\n\tuseSyncDeprecatedEntityIntoState( entity );\n\tconst { postType, postId, context } = entity;\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreDataStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst postWithTemplate = !! context?.postId;\n\tconst editorPostType = postWithTemplate ? context.postType : postType;\n\tconst editorPostId = postWithTemplate ? context.postId : postId;\n\tuseEditorTitle( editorPostType, editorPostId );\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tuseRevisionsURLSync( isEditMode, editorPostType, editorPostId );\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst editorSettings = useSpecificEditorSettings();\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\tconst { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\tgetListPathForPostType(\n\t\t\t\t\t\t\t\tpostWithTemplate ? context.postType : postType\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\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title ) || __( '(no title)' )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=edit`\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\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\tbreak;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tpostType,\n\t\t\tcontext?.postType,\n\t\t\tpostWithTemplate,\n\t\t\thistory,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\tconst isReady = ! isLoading;\n\n\treturn ! isBlockBasedTheme && isHomeRoute ? (\n\t\t<SitePreview />\n\t) : (\n\t\t<>\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && isReady && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t\tpostId={ postWithTemplate ? context.postId : postId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? postId : undefined }\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\tclassName=\"edit-site-editor__editor-interface\"\n\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t}\n\t\t\t\t\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\n\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t! postWithTemplate && (\n\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEditMode && <ViewportSync /> }\n\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t<BackButton>\n\t\t\t\t\t\t\t{ ( { length } ) =>\n\t\t\t\t\t\t\t\tlength <= 1 && (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\t\t\t\t\t\t\t\t\t\t\tsetCurrentRevisionId( null );\n\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\tgetNavigationPath(\n\t\t\t\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\t\t\t\tpostWithTemplate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? context.postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: postType\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? chevronRight : chevronLeft\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</BackButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<SiteEditorMoreMenu />\n\t\t\t\t</Editor>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,aAAa,iBAAiB;AACvC,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAC9B;AAAA,EACC;AAAA,EACA,eAAe;AAAA,EACf,SAAS;AAAA,OACH;AACP,SAAS,IAAI,OAAO,eAAe;AACnC,SAAS,SAAS,qBAAqB;AACvC,SAAS,eAAe,+BAA+B;AACvD,SAAS,mBAAmB;AAC5B,SAAS,SAAS,oBAAoB;AACtC,SAAS,eAAe,yBAAyB;AACjD,SAAS,sBAAsB;AAC/B,SAAS,aAAa,oBAAoB;AAC1C,SAAS,SAAS,wBAAwB;AAC1C,SAAS,oBAAoB;AAC7B,OAAO,kBAAkB;AACzB,OAAO,kBAAkB;AACzB,SAAS,cAAc;AACvB,SAAS,iCAAiC;AAC1C,OAAO,gCAAgC;AACvC,SAAS,yBAAyB;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A,kBACA;AAAA,oBACC,YACC;AAAA,kBACF;AAAA,gBACD;AAAA,cACD;AAAA,cACA,MACC,MAAM,IAAI,eAAe;AAAA;AAAA,UAE3B,GAGH;AAAA,UAED,oBAAC,sBAAmB;AAAA;AAAA;AAAA,IACrB;AAAA,KAEF;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor/site-preview.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { focus } from '@wordpress/dom';\nimport { addQueryArgs } from '@wordpress/url';\n\nexport default function SitePreview() {\n\tconst siteUrl = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase' );\n\t\treturn siteData?.home;\n\t}, [] );\n\n\treturn (\n\t\t<iframe\n\t\t\tsrc={ addQueryArgs( siteUrl, {\n\t\t\t\t// Parameter for hiding the admin bar.\n\t\t\t\twp_site_preview: 1,\n\t\t\t} ) }\n\t\t\ttitle={ __( 'Site Preview' ) }\n\t\t\tstyle={ {\n\t\t\t\tdisplay: 'block',\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\tbackgroundColor: '#fff',\n\t\t\t} }\n\t\t\tonLoad={ ( event ) => {\n\t\t\t\t// Make interactive elements unclickable.\n\t\t\t\tconst document = event.target.contentDocument;\n\t\t\t\tconst focusableElements = focus.focusable.find( document );\n\t\t\t\tfocusableElements.forEach( ( element ) => {\n\t\t\t\t\telement.style.pointerEvents = 'none';\n\t\t\t\t\telement.tabIndex = -1;\n\t\t\t\t\telement.setAttribute( 'aria-hidden', 'true' );\n\t\t\t\t} );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAU3B;AARa,SAAR,cAA+B;AACrC,QAAM,UAAU,UAAW,CAAE,WAAY;AACxC,UAAM,EAAE,gBAAgB,IAAI,OAAQ,SAAU;AAC9C,UAAM,WAAW,gBAAiB,QAAQ,gBAAiB;AAC3D,WAAO,UAAU;AAAA,EAClB,GAAG,CAAC,CAAE;AAEN,SACC;AAAA,IAAC;AAAA;AAAA,MACA,KAAM,aAAc,SAAS;AAAA;AAAA,QAE5B,iBAAiB;AAAA,MAClB,CAAE;AAAA,MACF,OAAQ,GAAI,cAAe;AAAA,MAC3B,OAAQ;AAAA,QACP,SAAS;AAAA,QACT,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,iBAAiB;AAAA,MAClB;AAAA,MACA,QAAS,CAAE,UAAW;AAErB,cAAM,WAAW,MAAM,OAAO;AAC9B,cAAM,oBAAoB,MAAM,UAAU,KAAM,QAAS;AACzD,0BAAkB,QAAS,CAAE,YAAa;AACzC,kBAAQ,MAAM,gBAAgB;AAC9B,kBAAQ,WAAW;AACnB,kBAAQ,aAAc,eAAe,MAAO;AAAA,QAC7C,CAAE;AAAA,MACH;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor/use-adapt-editor-to-canvas.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useLayoutEffect } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { DEFAULT_DEVICE_TYPE } from '../block-editor/use-viewport-sync';\n\nexport function useAdaptEditorToCanvas( canvas ) {\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst {\n\t\teditPost,\n\t\tsetDeviceType,\n\t\tclosePublishSidebar,\n\t\tsetIsListViewOpened,\n\t\tsetIsInserterOpened,\n\t} = useDispatch( editorStore );\n\tconst { get: getPreference } = useSelect( preferencesStore );\n\tconst { getCurrentPost } = useSelect( editorStore );\n\tconst registry = useRegistry();\n\tuseLayoutEffect( () => {\n\t\tconst isMediumOrBigger =\n\t\t\twindow.matchMedia( '(min-width: 782px)' ).matches;\n\t\tregistry.batch( () => {\n\t\t\tclearSelectedBlock();\n\t\t\tif ( getCurrentPost()?.type ) {\n\t\t\t\teditPost( { selection: undefined }, { undoIgnore: true } );\n\t\t\t}\n\t\t\tsetDeviceType( DEFAULT_DEVICE_TYPE );\n\t\t\tclosePublishSidebar();\n\t\t\tsetIsInserterOpened( false );\n\n\t\t\t// Check if the block list view should be open by default.\n\t\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\t\t// This behavior is disabled for small viewports.\n\t\t\tif (\n\t\t\t\tisMediumOrBigger &&\n\t\t\t\tcanvas === 'edit' &&\n\t\t\t\tgetPreference( 'core', 'showListViewByDefault' ) &&\n\t\t\t\t! getPreference( 'core', 'distractionFree' )\n\t\t\t) {\n\t\t\t\tsetIsListViewOpened( true );\n\t\t\t} else {\n\t\t\t\tsetIsListViewOpened( false );\n\t\t\t}\n\t\t} );\n\t}, [\n\t\tcanvas,\n\t\tregistry,\n\t\tclearSelectedBlock,\n\t\teditPost,\n\t\tsetDeviceType,\n\t\tclosePublishSidebar,\n\t\tsetIsInserterOpened,\n\t\tsetIsListViewOpened,\n\t\tgetPreference,\n\t\tgetCurrentPost,\n\t] );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,aAAa,WAAW,mBAAmB;AACpD,SAAS,SAAS,wBAAwB;AAC1C,SAAS,SAAS,mBAAmB;AACrC,SAAS,uBAAuB;AAChC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,2BAA2B;AAE7B,SAAS,uBAAwB,QAAS;AAChD,QAAM,EAAE,mBAAmB,IAAI,YAAa,gBAAiB;AAC7D,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI,YAAa,WAAY;AAC7B,QAAM,EAAE,KAAK,cAAc,IAAI,UAAW,gBAAiB;AAC3D,QAAM,EAAE,eAAe,IAAI,UAAW,WAAY;AAClD,QAAM,WAAW,YAAY;AAC7B,kBAAiB,MAAM;AACtB,UAAM,mBACL,OAAO,WAAY,oBAAqB,EAAE;AAC3C,aAAS,MAAO,MAAM;AACrB,yBAAmB;AACnB,UAAK,eAAe,GAAG,MAAO;AAC7B,iBAAU,EAAE,WAAW,OAAU,GAAG,EAAE,YAAY,KAAK,CAAE;AAAA,MAC1D;AACA,oBAAe,mBAAoB;AACnC,0BAAoB;AACpB,0BAAqB,KAAM;AAK3B,UACC,oBACA,WAAW,UACX,cAAe,QAAQ,uBAAwB,KAC/C,CAAE,cAAe,QAAQ,iBAAkB,GAC1C;AACD,4BAAqB,IAAK;AAAA,MAC3B,OAAO;AACN,4BAAqB,KAAM;AAAA,MAC5B;AAAA,IACD,CAAE;AAAA,EACH,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor/use-editor-title.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\tprivateApis as coreDataPrivateApis,\n} from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport useTitle from '../routes/use-title';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { getTemplateInfo } = unlock( coreDataPrivateApis );\n\nfunction useEditorTitle( postType, postId ) {\n\tconst { title, isLoaded } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\tgetCurrentTheme,\n\t\t\t\thasFinishedResolution,\n\t\t\t} = select( coreStore );\n\n\t\t\tif ( ! postId ) {\n\t\t\t\treturn { isLoaded: false };\n\t\t\t}\n\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\n\t\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\t\tgetCurrentTheme() ?? {};\n\n\t\t\tconst templateInfo = getTemplateInfo( {\n\t\t\t\ttemplate: _record,\n\t\t\t\ttemplateTypes,\n\t\t\t} );\n\n\t\t\tconst _isLoaded = hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t] );\n\n\t\t\treturn {\n\t\t\t\ttitle: templateInfo.title,\n\t\t\t\tisLoaded: _isLoaded,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tlet editorTitle;\n\tif ( isLoaded ) {\n\t\teditorTitle = sprintf(\n\t\t\t// translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part).\n\t\t\t_x( '%1$s ‹ %2$s', 'breadcrumb trail' ),\n\t\t\tdecodeEntities( title ),\n\t\t\tPOST_TYPE_LABELS[ postType ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( isLoaded && editorTitle );\n}\n\nexport default useEditorTitle;\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,IAAI,eAAe;AAC5B,SAAS,iBAAiB;AAC1B;AAAA,EACC,SAAS;AAAA,EACT,eAAe;AAAA,OACT;AACP,SAAS,sBAAsB;AAC/B,OAAO,cAAc;AACrB,SAAS,kBAAkB,0BAA0B;AACrD,SAAS,cAAc;AAEvB,IAAM,EAAE,gBAAgB,IAAI,OAAQ,mBAAoB;AAExD,SAAS,eAAgB,UAAU,QAAS;AAC3C,QAAM,EAAE,OAAO,SAAS,IAAI;AAAA,IAC3B,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,SAAU;AAEtB,UAAK,CAAE,QAAS;AACf,eAAO,EAAE,UAAU,MAAM;AAAA,MAC1B;AAEA,YAAM,UAAU;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAEA,YAAM,EAAE,wBAAwB,gBAAgB,CAAC,EAAE,IAClD,gBAAgB,KAAK,CAAC;AAEvB,YAAM,eAAe,gBAAiB;AAAA,QACrC,UAAU;AAAA,QACV;AAAA,MACD,CAAE;AAEF,YAAM,YAAY,sBAAuB,yBAAyB;AAAA,QACjE;AAAA,QACA;AAAA,QACA;AAAA,MACD,CAAE;AAEF,aAAO;AAAA,QACN,OAAO,aAAa;AAAA,QACpB,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA,CAAE,UAAU,MAAO;AAAA,EACpB;AAEA,MAAI;AACJ,MAAK,UAAW;AACf,kBAAc;AAAA;AAAA,MAEb,GAAI,eAAe,kBAAmB;AAAA,MACtC,eAAgB,KAAM;AAAA,MACtB,iBAAkB,QAAS,KAC1B,iBAAkB,kBAAmB;AAAA,IACvC;AAAA,EACD;AAIA,WAAU,YAAY,WAAY;AACnC;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor/use-resolve-edited-entity.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { useEffect, useMemo, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tATTACHMENT_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst postTypesWithoutParentTemplate = [\n\tATTACHMENT_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nconst authorizedPostTypes = [ 'page', 'post' ];\n\nfunction getPostType( name ) {\n\tlet postType;\n\tif ( name === 'navigation-item' ) {\n\t\tpostType = NAVIGATION_POST_TYPE;\n\t} else if ( name === 'pattern-item' ) {\n\t\tpostType = PATTERN_TYPES.user;\n\t} else if ( name === 'template-part-item' ) {\n\t\tpostType = TEMPLATE_PART_POST_TYPE;\n\t} else if ( name === 'templates' ) {\n\t\tpostType = TEMPLATE_POST_TYPE;\n\t} else if ( name === 'template-item' ) {\n\t\tpostType = TEMPLATE_POST_TYPE;\n\t} else if ( name === 'page-item' || name === 'pages' ) {\n\t\tpostType = 'page';\n\t} else if ( name === 'post-item' || name === 'posts' ) {\n\t\tpostType = 'post';\n\t}\n\n\treturn postType;\n}\n\nexport function useResolveEditedEntity() {\n\tconst { editEntityRecord } = useDispatch( coreDataStore );\n\tconst { hasEntityRecord } = useSelect( coreDataStore );\n\tconst { name, params = {}, query } = useLocation();\n\tconst { postId = query?.postId } = params; // Fallback to query param for postId for list view routes.\n\tconst postType = getPostType( name, postId ) ?? query?.postType;\n\t// Extract selectedBlock from URL for selection restoration on navigation back.\n\tconst { selectedBlock } = query;\n\n\t// Track which selection we've applied to avoid re-applying the same one,\n\t// but allow applying a new one if the URL changes.\n\tconst appliedSelectionRef = useRef( null );\n\n\tconst homePage = useSelect( ( select ) => {\n\t\tconst { getHomePage } = unlock( select( coreDataStore ) );\n\t\treturn getHomePage();\n\t}, [] );\n\n\t/**\n\t * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId\n\t * in order to match the frontend as closely as possible in the site editor.\n\t *\n\t * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.\n\t */\n\tconst resolvedTemplateId = useSelect(\n\t\t( select ) => {\n\t\t\t// If we're rendering a post type that doesn't have a template\n\t\t\t// no need to resolve its template.\n\t\t\tif (\n\t\t\t\tpostTypesWithoutParentTemplate.includes( postType ) &&\n\t\t\t\tpostId\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Don't trigger resolution for multi-selected posts.\n\t\t\tif ( postId && postId.includes( ',' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { getTemplateId } = unlock( select( coreDataStore ) );\n\n\t\t\t// If we're rendering a specific page, we need to resolve its template.\n\t\t\t// The site editor only supports pages for now, not other CPTs.\n\t\t\tif (\n\t\t\t\tpostType &&\n\t\t\t\tpostId &&\n\t\t\t\tauthorizedPostTypes.includes( postType )\n\t\t\t) {\n\t\t\t\treturn getTemplateId( postType, postId );\n\t\t\t}\n\n\t\t\t// If we're rendering the home page, and we have a static home page, resolve its template.\n\t\t\tif ( homePage?.postType === 'page' ) {\n\t\t\t\treturn getTemplateId( 'page', homePage?.postId );\n\t\t\t}\n\n\t\t\tif ( homePage?.postType === 'wp_template' ) {\n\t\t\t\treturn homePage?.postId;\n\t\t\t}\n\t\t},\n\t\t[ homePage, postId, postType ]\n\t);\n\n\tconst context = useMemo( () => {\n\t\tif ( postTypesWithoutParentTemplate.includes( postType ) && postId ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif ( postType && postId && authorizedPostTypes.includes( postType ) ) {\n\t\t\treturn { postType, postId };\n\t\t}\n\t\t// TODO: for post types lists we should probably not render the front page, but maybe a placeholder\n\t\t// with a message like \"Select a page\" or something similar.\n\t\tif ( homePage?.postType === 'page' ) {\n\t\t\treturn { postType: 'page', postId: homePage?.postId };\n\t\t}\n\n\t\treturn {};\n\t}, [ homePage, postType, postId ] );\n\n\t// Compute entity info based on conditions\n\tlet entity;\n\tif ( postTypesWithoutParentTemplate.includes( postType ) && postId ) {\n\t\tentity = { isReady: true, postType, postId, context };\n\t} else if ( !! homePage ) {\n\t\tentity = {\n\t\t\tisReady: resolvedTemplateId !== undefined,\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tpostId: resolvedTemplateId,\n\t\t\tcontext,\n\t\t};\n\t} else {\n\t\tentity = { isReady: false };\n\t}\n\n\t// Restore selection from URL synchronously, before EditorProvider renders.\n\t// This ensures the selection is available when blocks are reset.\n\t// When editing a page with a template, EditorProvider reads selection from\n\t// the page entity (context), not the template entity.\n\tif (\n\t\tselectedBlock &&\n\t\tentity.isReady &&\n\t\tappliedSelectionRef.current !== selectedBlock\n\t) {\n\t\tconst selectionPostType = entity.context?.postId\n\t\t\t? entity.context.postType\n\t\t\t: entity.postType;\n\t\tconst selectionPostId = entity.context?.postId\n\t\t\t? entity.context.postId\n\t\t\t: entity.postId;\n\n\t\t// Only apply selection if the entity record is loaded,\n\t\t// otherwise editEntityRecord will throw.\n\t\tif (\n\t\t\thasEntityRecord( 'postType', selectionPostType, selectionPostId )\n\t\t) {\n\t\t\teditEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tselectionPostType,\n\t\t\t\tselectionPostId,\n\t\t\t\t{\n\t\t\t\t\tselection: {\n\t\t\t\t\t\tselectionStart: { clientId: selectedBlock },\n\t\t\t\t\t\tselectionEnd: { clientId: selectedBlock },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{ undoIgnore: true }\n\t\t\t);\n\t\t\tappliedSelectionRef.current = selectedBlock;\n\t\t}\n\t}\n\n\treturn entity;\n}\n\nexport function useSyncDeprecatedEntityIntoState( {\n\tpostType,\n\tpostId,\n\tcontext,\n\tisReady,\n} ) {\n\tconst { setEditedEntity } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( isReady ) {\n\t\t\t// setEditedEntity expects a string (because the postId used to be\n\t\t\t// the template slug, even for edited templates). Now the postId can\n\t\t\t// be a number (either because it's an auto-draft or edited\n\t\t\t// template). Passing a number could break plugins doing things like\n\t\t\t// `id.includes`. It would be way more complex to keep passing the\n\t\t\t// template slug, while also being incorrect, so the easiest\n\t\t\t// solution is to cast the postId to a string.\n\t\t\tsetEditedEntity( postType, String( postId ), context );\n\t\t}\n\t}, [ isReady, postType, postId, context, setEditedEntity ] );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,WAAW,SAAS,cAAc;AAC3C,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,qBAAqB;AACvC,SAAS,eAAe,yBAAyB;AACjD,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AACvB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEP,IAAM,EAAE,YAAY,IAAI,OAAQ,iBAAkB;AAElD,IAAM,iCAAiC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AACf;AAEA,IAAM,sBAAsB,CAAE,QAAQ,MAAO;AAE7C,SAAS,YAAa,MAAO;AAC5B,MAAI;AACJ,MAAK,SAAS,mBAAoB;AACjC,eAAW;AAAA,EACZ,WAAY,SAAS,gBAAiB;AACrC,eAAW,cAAc;AAAA,EA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,EAAE,gBAAgB,IAAI,YAAa,aAAc;AAEvD,YAAW,MAAM;AAChB,QAAK,SAAU;AAQd,sBAAiB,UAAU,OAAQ,MAAO,GAAG,OAAQ;AAAA,IACtD;AAAA,EACD,GAAG,CAAE,SAAS,UAAU,QAAQ,SAAS,eAAgB,CAAE;AAC5D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// packages/edit-site/src/components/editor/use-revisions-url-sync.js
|
|
2
|
+
import { useSelect, useDispatch } from "@wordpress/data";
|
|
3
|
+
import { useEffect, useRef } from "@wordpress/element";
|
|
4
|
+
import { store as editorStore } from "@wordpress/editor";
|
|
5
|
+
import { privateApis as routerPrivateApis } from "@wordpress/router";
|
|
6
|
+
import { addQueryArgs } from "@wordpress/url";
|
|
7
|
+
import { unlock } from "../../lock-unlock.mjs";
|
|
8
|
+
var { useHistory, useLocation } = unlock(routerPrivateApis);
|
|
9
|
+
var URL_WRITE_DEBOUNCE_MS = 300;
|
|
10
|
+
function useRevisionsURLSync(enabled, postType, postId) {
|
|
11
|
+
const location = useLocation();
|
|
12
|
+
const history = useHistory();
|
|
13
|
+
const { currentPostType, currentPostId, currentRevisionId } = useSelect(
|
|
14
|
+
(select) => {
|
|
15
|
+
const editor = select(editorStore);
|
|
16
|
+
return {
|
|
17
|
+
currentPostType: editor.getCurrentPostType(),
|
|
18
|
+
currentPostId: editor.getCurrentPostId(),
|
|
19
|
+
currentRevisionId: unlock(editor).getCurrentRevisionId()
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
[]
|
|
23
|
+
);
|
|
24
|
+
const { openRevision, setCurrentRevisionId } = unlock(
|
|
25
|
+
useDispatch(editorStore)
|
|
26
|
+
);
|
|
27
|
+
const entityKey = postType && postId ? `${postType}:${postId}` : null;
|
|
28
|
+
const isCurrentEntity = !!entityKey && currentPostType === postType && String(currentPostId) === String(postId);
|
|
29
|
+
const handledEntityKeyRef = useRef(null);
|
|
30
|
+
const lastURLWriteTimeRef = useRef(null);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!enabled) {
|
|
33
|
+
handledEntityKeyRef.current = null;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (!isCurrentEntity || !entityKey || handledEntityKeyRef.current === entityKey) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
lastURLWriteTimeRef.current = null;
|
|
40
|
+
handledEntityKeyRef.current = entityKey;
|
|
41
|
+
const revision = Number(location.query.revision);
|
|
42
|
+
if (Number.isInteger(revision) && revision > 0) {
|
|
43
|
+
openRevision(revision);
|
|
44
|
+
} else if (currentRevisionId) {
|
|
45
|
+
setCurrentRevisionId(null);
|
|
46
|
+
}
|
|
47
|
+
}, [
|
|
48
|
+
enabled,
|
|
49
|
+
isCurrentEntity,
|
|
50
|
+
entityKey,
|
|
51
|
+
location.query.revision,
|
|
52
|
+
currentRevisionId,
|
|
53
|
+
openRevision,
|
|
54
|
+
setCurrentRevisionId
|
|
55
|
+
]);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (!enabled || !isCurrentEntity || !entityKey || handledEntityKeyRef.current !== entityKey) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (lastURLWriteTimeRef.current === null) {
|
|
61
|
+
lastURLWriteTimeRef.current = Date.now();
|
|
62
|
+
}
|
|
63
|
+
const revisionArg = currentRevisionId ? String(currentRevisionId) : void 0;
|
|
64
|
+
if (location.query.revision === revisionArg) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const write = async () => {
|
|
68
|
+
const addressBarArg = new URLSearchParams(window.location.search).get(
|
|
69
|
+
"revision"
|
|
70
|
+
) ?? void 0;
|
|
71
|
+
if (addressBarArg !== location.query.revision) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
lastURLWriteTimeRef.current = Date.now();
|
|
75
|
+
try {
|
|
76
|
+
await history.navigate(
|
|
77
|
+
addQueryArgs(location.path, { revision: revisionArg }),
|
|
78
|
+
{ replace: true }
|
|
79
|
+
);
|
|
80
|
+
} catch {
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
if (Date.now() - lastURLWriteTimeRef.current >= URL_WRITE_DEBOUNCE_MS) {
|
|
84
|
+
write();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const timeoutId = setTimeout(write, URL_WRITE_DEBOUNCE_MS);
|
|
88
|
+
return () => clearTimeout(timeoutId);
|
|
89
|
+
}, [
|
|
90
|
+
enabled,
|
|
91
|
+
isCurrentEntity,
|
|
92
|
+
entityKey,
|
|
93
|
+
currentRevisionId,
|
|
94
|
+
location,
|
|
95
|
+
history
|
|
96
|
+
]);
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
useRevisionsURLSync as default
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=use-revisions-url-sync.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/editor/use-revisions-url-sync.js"],
|
|
4
|
+
"sourcesContent": ["import { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { addQueryArgs } from '@wordpress/url';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\n/**\n * Safari throws after more than 100 History API calls in 30 seconds.\n */\nconst URL_WRITE_DEBOUNCE_MS = 300;\n\nexport default function useRevisionsURLSync( enabled, postType, postId ) {\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst { currentPostType, currentPostId, currentRevisionId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst editor = select( editorStore );\n\t\t\treturn {\n\t\t\t\tcurrentPostType: editor.getCurrentPostType(),\n\t\t\t\tcurrentPostId: editor.getCurrentPostId(),\n\t\t\t\tcurrentRevisionId: unlock( editor ).getCurrentRevisionId(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { openRevision, setCurrentRevisionId } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst entityKey = postType && postId ? `${ postType }:${ postId }` : null;\n\tconst isCurrentEntity =\n\t\t!! entityKey &&\n\t\tcurrentPostType === postType &&\n\t\tString( currentPostId ) === String( postId );\n\n\t// The route can change before the editor store. Wait until both point to the\n\t// same entity so a revision from the previous entity is not copied into the\n\t// new URL.\n\tconst handledEntityKeyRef = useRef( null );\n\tconst lastURLWriteTimeRef = useRef( null );\n\tuseEffect( () => {\n\t\tif ( ! enabled ) {\n\t\t\thandledEntityKeyRef.current = null;\n\t\t\treturn;\n\t\t}\n\t\tif (\n\t\t\t! isCurrentEntity ||\n\t\t\t! entityKey ||\n\t\t\thandledEntityKeyRef.current === entityKey\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tlastURLWriteTimeRef.current = null;\n\t\thandledEntityKeyRef.current = entityKey;\n\t\tconst revision = Number( location.query.revision );\n\t\tif ( Number.isInteger( revision ) && revision > 0 ) {\n\t\t\topenRevision( revision );\n\t\t} else if ( currentRevisionId ) {\n\t\t\tsetCurrentRevisionId( null );\n\t\t}\n\t}, [\n\t\tenabled,\n\t\tisCurrentEntity,\n\t\tentityKey,\n\t\tlocation.query.revision,\n\t\tcurrentRevisionId,\n\t\topenRevision,\n\t\tsetCurrentRevisionId,\n\t] );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! enabled ||\n\t\t\t! isCurrentEntity ||\n\t\t\t! entityKey ||\n\t\t\thandledEntityKeyRef.current !== entityKey\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tif ( lastURLWriteTimeRef.current === null ) {\n\t\t\tlastURLWriteTimeRef.current = Date.now();\n\t\t}\n\t\tconst revisionArg = currentRevisionId\n\t\t\t? String( currentRevisionId )\n\t\t\t: undefined;\n\t\tif ( location.query.revision === revisionArg ) {\n\t\t\treturn;\n\t\t}\n\t\tconst write = async () => {\n\t\t\t// Route matching can lag behind the address bar. Writing the stale\n\t\t\t// match back would undo the navigation.\n\t\t\tconst addressBarArg =\n\t\t\t\tnew URLSearchParams( window.location.search ).get(\n\t\t\t\t\t'revision'\n\t\t\t\t) ?? undefined;\n\t\t\tif ( addressBarArg !== location.query.revision ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlastURLWriteTimeRef.current = Date.now();\n\t\t\t// Passing `undefined` removes `revision` without dropping the other\n\t\t\t// query args.\n\t\t\ttry {\n\t\t\t\tawait history.navigate(\n\t\t\t\t\taddQueryArgs( location.path, { revision: revisionArg } ),\n\t\t\t\t\t{ replace: true }\n\t\t\t\t);\n\t\t\t} catch {\n\t\t\t\t// Leave the URL unchanged. The effect can try again on the next\n\t\t\t\t// state change.\n\t\t\t}\n\t\t};\n\t\tif (\n\t\t\tDate.now() - lastURLWriteTimeRef.current >=\n\t\t\tURL_WRITE_DEBOUNCE_MS\n\t\t) {\n\t\t\twrite();\n\t\t\treturn;\n\t\t}\n\t\tconst timeoutId = setTimeout( write, URL_WRITE_DEBOUNCE_MS );\n\t\treturn () => clearTimeout( timeoutId );\n\t}, [\n\t\tenabled,\n\t\tisCurrentEntity,\n\t\tentityKey,\n\t\tcurrentRevisionId,\n\t\tlocation,\n\t\thistory,\n\t] );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,WAAW,mBAAmB;AACvC,SAAS,WAAW,cAAc;AAClC,SAAS,SAAS,mBAAmB;AACrC,SAAS,eAAe,yBAAyB;AACjD,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AAEvB,IAAM,EAAE,YAAY,YAAY,IAAI,OAAQ,iBAAkB;AAK9D,IAAM,wBAAwB;AAEf,SAAR,oBAAsC,SAAS,UAAU,QAAS;AACxE,QAAM,WAAW,YAAY;AAC7B,QAAM,UAAU,WAAW;AAC3B,QAAM,EAAE,iBAAiB,eAAe,kBAAkB,IAAI;AAAA,IAC7D,CAA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AAM,aAAa,aAAc;AAC9C;AAAA,IACD;AACA,UAAM,QAAQ,YAAY;AAGzB,YAAM,gBACL,IAAI,gBAAiB,OAAO,SAAS,MAAO,EAAE;AAAA,QAC7C;AAAA,MACD,KAAK;AACN,UAAK,kBAAkB,SAAS,MAAM,UAAW;AAChD;AAAA,MACD;AACA,0BAAoB,UAAU,KAAK,IAAI;AAGvC,UAAI;AACH,cAAM,QAAQ;AAAA,UACb,aAAc,SAAS,MAAM,EAAE,UAAU,YAAY,CAAE;AAAA,UACvD,EAAE,SAAS,KAAK;AAAA,QACjB;AAAA,MACD,QAAQ;AAAA,MAGR;AAAA,IACD;AACA,QACC,KAAK,IAAI,IAAI,oBAAoB,WACjC,uBACC;AACD,YAAM;AACN;AAAA,IACD;AACA,UAAM,YAAY,WAAY,OAAO,qBAAsB;AAC3D,WAAO,MAAM,aAAc,SAAU;AAAA,EACtC,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/layout/animation.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { Controller, easings } from '@react-spring/web';\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\nconst ANIMATION_DURATION = 400;\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n */\nfunction useMovingAnimation( { triggerAnimationOnChange } ) {\n\tconst ref = useRef();\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion.\n\t\tconst disableAnimation = window.matchMedia(\n\t\t\t'(prefers-reduced-motion: reduce)'\n\t\t).matches;\n\n\t\tif ( disableAnimation ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\twidth: prevRect.width,\n\t\t\theight: prevRect.height,\n\t\t\tconfig: {\n\t\t\t\tduration: ANIMATION_DURATION,\n\t\t\t\teasing: easings.easeInOutQuint,\n\t\t\t},\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y, width, height } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\twidth = Math.round( width );\n\t\t\t\theight = Math.round( height );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.width = finishedMoving\n\t\t\t\t\t? null\n\t\t\t\t\t: `${ width }px`;\n\t\t\t\tref.current.style.height = finishedMoving\n\t\t\t\t\t? null\n\t\t\t\t\t: `${ height }px`;\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = ref.current.getBoundingClientRect();\n\n\t\tconst x = Math.round( prevRect.left - destination.left );\n\t\tconst y = Math.round( prevRect.top - destination.top );\n\t\tconst width = destination.width;\n\t\tconst height = destination.height;\n\n\t\tcontroller.start( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tfrom: { x, y, width: prevRect.width, height: prevRect.height },\n\t\t} );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t\tcontroller.set( {\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t\twidth: prevRect.width,\n\t\t\t\theight: prevRect.height,\n\t\t\t} );\n\t\t};\n\t}, [ previous, prevRect ] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,YAAY,eAAe;AACpC,SAAS,iBAAiB,SAAS,cAAc;AAEjD,SAAS,oBAAqB,SAAU;AACvC,SAAO;AAAA,IACN,KAAK,QAAQ;AAAA,IACb,MAAM,QAAQ;AAAA,EACf;AACD;AAEA,IAAM,qBAAqB;AAgB3B,SAAS,mBAAoB,EAAE,yBAAyB,GAAI;AAC3D,QAAM,MAAM,OAAO;AAInB,QAAM,EAAE,UAAU,SAAS,IAAI;AAAA,IAC9B,OAAQ;AAAA,MACP,UAAU,IAAI,WAAW,oBAAqB,IAAI,OAAQ;AAAA,MAC1D,UAAU,IAAI,WAAW,IAAI,QAAQ,sBAAsB;AAAA,IAC5D;AAAA,IACA,CAAE,wBAAyB;AAAA,EAC5B;AAEA,kBAAiB,MAAM;AACtB,QAAK,CAAE,YAAY,CAAE,IAAI,SAAU;AAClC;AAAA,IACD;AAIA,UAAM,mBAAmB,OAAO;AAAA,MAC/B;AAAA,IACD,EAAE;AAEF,QAAK,kBAAmB;AACvB;AAAA,IACD;AAE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