@wordpress/edit-site 7.1.0 → 7.3.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 +28 -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 +4 -20
- package/build/components/block-editor/use-navigate-to-entity-record.cjs.map +2 -2
- package/build/components/block-editor/use-site-editor-settings.cjs +0 -1
- package/build/components/block-editor/use-site-editor-settings.cjs.map +2 -2
- package/build/components/block-editor/viewport.cjs +46 -0
- package/build/components/block-editor/viewport.cjs.map +7 -0
- 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 +14 -12
- 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 +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 +11 -2
- 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 +2 -3
- package/build/components/more-menu/index.cjs.map +3 -3
- 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 +3 -1
- 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 +1 -1
- 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 +1 -1
- 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 +3 -0
- 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 +5 -21
- 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 +0 -1
- package/build-module/components/block-editor/use-site-editor-settings.mjs.map +2 -2
- package/build-module/components/block-editor/viewport.mjs +19 -0
- package/build-module/components/block-editor/viewport.mjs.map +7 -0
- 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 +14 -13
- 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 +1 -1
- 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 +11 -2
- 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 +1 -2
- package/build-module/components/more-menu/index.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 +3 -1
- 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 +1 -1
- 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 +1 -1
- 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 +3 -0
- 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 +157 -66
- package/build-style/style.css +157 -66
- 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 +11 -39
- package/src/components/block-editor/use-site-editor-settings.js +0 -8
- package/src/components/block-editor/viewport.js +34 -0
- package/src/components/canvas-loader/index.js +0 -7
- package/src/components/dataviews-actions/index.js +0 -7
- package/src/components/editor/index.js +19 -20
- package/src/components/editor/site-preview.js +0 -3
- package/src/components/editor/use-adapt-editor-to-canvas.js +1 -8
- 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 +10 -14
- package/src/components/media/index.js +0 -3
- package/src/components/more-menu/index.js +2 -9
- 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 +6 -9
- 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 +1 -8
- 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 +1 -8
- 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 +3 -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/style.scss +7 -3
- 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
- package/build/components/block-editor/use-viewport-sync.cjs +0 -55
- package/build/components/block-editor/use-viewport-sync.cjs.map +0 -7
- package/build/components/more-menu/site-export.cjs +0 -93
- package/build/components/more-menu/site-export.cjs.map +0 -7
- package/build-module/components/block-editor/use-viewport-sync.mjs +0 -29
- package/build-module/components/block-editor/use-viewport-sync.mjs.map +0 -7
- package/build-module/components/more-menu/site-export.mjs +0 -62
- package/build-module/components/more-menu/site-export.mjs.map +0 -7
- package/src/components/block-editor/use-viewport-sync.js +0 -51
- package/src/components/more-menu/site-export.js +0 -74
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/edit-site/src/components/block-editor/viewport.js
|
|
21
|
+
var viewport_exports = {};
|
|
22
|
+
__export(viewport_exports, {
|
|
23
|
+
DEFAULT_DEVICE_TYPE: () => DEFAULT_DEVICE_TYPE,
|
|
24
|
+
getDeviceType: () => getDeviceType,
|
|
25
|
+
isValidViewport: () => isValidViewport
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(viewport_exports);
|
|
28
|
+
var DEFAULT_DEVICE_TYPE = "Desktop";
|
|
29
|
+
var VALID_VIEWPORTS = ["desktop", "tablet", "mobile"];
|
|
30
|
+
function isValidViewport(viewport) {
|
|
31
|
+
return !!viewport && VALID_VIEWPORTS.includes(viewport.toLowerCase());
|
|
32
|
+
}
|
|
33
|
+
function getDeviceType(viewport) {
|
|
34
|
+
if (!isValidViewport(viewport)) {
|
|
35
|
+
return DEFAULT_DEVICE_TYPE;
|
|
36
|
+
}
|
|
37
|
+
const value = viewport.toLowerCase();
|
|
38
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
39
|
+
}
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
DEFAULT_DEVICE_TYPE,
|
|
43
|
+
getDeviceType,
|
|
44
|
+
isValidViewport
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=viewport.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/block-editor/viewport.js"],
|
|
4
|
+
"sourcesContent": ["export const DEFAULT_DEVICE_TYPE = 'Desktop';\n\n/*\n * Lowercase in the URL, PascalCase in the editor store. Duplicated in\n * packages/boot/src/components/canvas/viewport.ts, in the editor's\n * preview-dropdown choices, and in the block editor's block-visibility\n * constants. Update all four when adding a viewport type.\n */\nconst VALID_VIEWPORTS = [ 'desktop', 'tablet', 'mobile' ];\n\n/**\n * Whether a viewport is one an entity can be asked to be edited at.\n *\n * @param {string} [viewport] Viewport, as written in the URL.\n * @return {boolean} Whether the editor has a width for it.\n */\nexport function isValidViewport( viewport ) {\n\treturn !! viewport && VALID_VIEWPORTS.includes( viewport.toLowerCase() );\n}\n\n/**\n * The device type a `viewport` query param names.\n *\n * @param {string} [viewport] Viewport, as written in the URL.\n * @return {string} Device type, Desktop for a viewport the editor has no width for.\n */\nexport function getDeviceType( viewport ) {\n\tif ( ! isValidViewport( viewport ) ) {\n\t\treturn DEFAULT_DEVICE_TYPE;\n\t}\n\n\tconst value = viewport.toLowerCase();\n\treturn value.charAt( 0 ).toUpperCase() + value.slice( 1 );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,sBAAsB;AAQnC,IAAM,kBAAkB,CAAE,WAAW,UAAU,QAAS;AAQjD,SAAS,gBAAiB,UAAW;AAC3C,SAAO,CAAC,CAAE,YAAY,gBAAgB,SAAU,SAAS,YAAY,CAAE;AACxE;AAQO,SAAS,cAAe,UAAW;AACzC,MAAK,CAAE,gBAAiB,QAAS,GAAI;AACpC,WAAO;AAAA,EACR;AAEA,QAAM,QAAQ,SAAS,YAAY;AACnC,SAAO,MAAM,OAAQ,CAAE,EAAE,YAAY,IAAI,MAAM,MAAO,CAAE;AACzD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/canvas-loader/index.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
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;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA4B;AAC5B,uBAAmC;AACnC,kBAA0B;AAC1B,oBAAiD;AACjD,yBAAuB;AAqBpB;AAnBH,IAAM,EAAE,SAAS,QAAI,2BAAQ,cAAAA,WAAkB;AAEhC,SAAR,aAA+B,EAAE,GAAG,GAAI;AAC9C,QAAM,YAAY,SAAU,YAAa;AACzC,QAAM,EAAE,SAAS,MAAM,QAAI,uBAAW,CAAE,WAAY;AACnD,UAAM,oBAAoB,OAAQ,iBAAAC,KAAU,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,sDAAC,iCAAY,IAAU,KAAM,OAAQ,OAAQ,SAAU;AAAA;AAAA,EACxD;AAEF;",
|
|
6
6
|
"names": ["editorPrivateApis", "coreStore"]
|
|
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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
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: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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": ["routerPrivateApis", "coreStore"]
|
|
7
7
|
}
|
|
@@ -39,7 +39,6 @@ var import_compose = require("@wordpress/compose");
|
|
|
39
39
|
var import_editor = require("@wordpress/editor");
|
|
40
40
|
var import_i18n = require("@wordpress/i18n");
|
|
41
41
|
var import_core_data = require("@wordpress/core-data");
|
|
42
|
-
var import_block_library = require("@wordpress/block-library");
|
|
43
42
|
var import_element = require("@wordpress/element");
|
|
44
43
|
var import_notices = require("@wordpress/notices");
|
|
45
44
|
var import_router = require("@wordpress/router");
|
|
@@ -47,6 +46,7 @@ var import_html_entities = require("@wordpress/html-entities");
|
|
|
47
46
|
var import_icons = require("@wordpress/icons");
|
|
48
47
|
var import_block_editor = require("@wordpress/block-editor");
|
|
49
48
|
var import_url = require("@wordpress/url");
|
|
49
|
+
var import_preferences = require("@wordpress/preferences");
|
|
50
50
|
var import_welcome_guide = __toESM(require("../welcome-guide/index.cjs"));
|
|
51
51
|
var import_canvas_loader = __toESM(require("../canvas-loader/index.cjs"));
|
|
52
52
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
@@ -57,8 +57,9 @@ var import_save_button = __toESM(require("../save-button/index.cjs"));
|
|
|
57
57
|
var import_save_panel = __toESM(require("../save-panel/index.cjs"));
|
|
58
58
|
var import_more_menu = __toESM(require("../more-menu/index.cjs"));
|
|
59
59
|
var import_use_editor_iframe_props = __toESM(require("../block-editor/use-editor-iframe-props.cjs"));
|
|
60
|
-
var
|
|
60
|
+
var import_viewport = require("../block-editor/viewport.cjs");
|
|
61
61
|
var import_use_editor_title = __toESM(require("./use-editor-title.cjs"));
|
|
62
|
+
var import_use_revisions_url_sync = __toESM(require("./use-revisions-url-sync.cjs"));
|
|
62
63
|
var import_hooks = require("../layout/hooks.cjs");
|
|
63
64
|
var import_use_adapt_editor_to_canvas = require("./use-adapt-editor-to-canvas.cjs");
|
|
64
65
|
var import_use_resolve_edited_entity = require("./use-resolve-edited-entity.cjs");
|
|
@@ -66,7 +67,6 @@ var import_site_preview = __toESM(require("./site-preview.cjs"));
|
|
|
66
67
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
67
68
|
var { Editor, BackButton } = (0, import_lock_unlock.unlock)(import_editor.privateApis);
|
|
68
69
|
var { useHistory, useLocation } = (0, import_lock_unlock.unlock)(import_router.privateApis);
|
|
69
|
-
var { BlockKeyboardShortcuts } = (0, import_lock_unlock.unlock)(import_block_library.privateApis);
|
|
70
70
|
function getListPathForPostType(postType) {
|
|
71
71
|
switch (postType) {
|
|
72
72
|
case "navigation":
|
|
@@ -96,7 +96,7 @@ function getNavigationPath(location, postType) {
|
|
|
96
96
|
].includes(name)) {
|
|
97
97
|
return getListPathForPostType(postType);
|
|
98
98
|
}
|
|
99
|
-
return (0, import_url.addQueryArgs)(path, { canvas: void 0 });
|
|
99
|
+
return (0, import_url.addQueryArgs)(path, { canvas: void 0, revision: void 0 });
|
|
100
100
|
}
|
|
101
101
|
function EditSiteEditor({ isHomeRoute = false }) {
|
|
102
102
|
const location = useLocation();
|
|
@@ -111,14 +111,18 @@ function EditSiteEditor({ isHomeRoute = false }) {
|
|
|
111
111
|
(select) => select(import_core_data.store).getCurrentTheme()?.is_block_theme,
|
|
112
112
|
[]
|
|
113
113
|
);
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
postWithTemplate ? context.postId : postId
|
|
114
|
+
const showIconLabels = (0, import_data.useSelect)(
|
|
115
|
+
(select) => select(import_preferences.store).get("core", "showIconLabels"),
|
|
116
|
+
[]
|
|
118
117
|
);
|
|
118
|
+
const postWithTemplate = !!context?.postId;
|
|
119
|
+
const editorPostType = postWithTemplate ? context.postType : postType;
|
|
120
|
+
const editorPostId = postWithTemplate ? context.postId : postId;
|
|
121
|
+
(0, import_use_editor_title.default)(editorPostType, editorPostId);
|
|
119
122
|
const _isPreviewingTheme = (0, import_is_previewing_theme.isPreviewingTheme)();
|
|
120
123
|
const iframeProps = (0, import_use_editor_iframe_props.default)();
|
|
121
124
|
const isEditMode = canvas === "edit";
|
|
125
|
+
(0, import_use_revisions_url_sync.default)(isEditMode, editorPostType, editorPostId);
|
|
122
126
|
const loadingProgressId = (0, import_compose.useInstanceId)(
|
|
123
127
|
import_canvas_loader.default,
|
|
124
128
|
"edit-site-editor__loading-progress"
|
|
@@ -179,8 +183,6 @@ function EditSiteEditor({ isHomeRoute = false }) {
|
|
|
179
183
|
);
|
|
180
184
|
const isReady = !isLoading;
|
|
181
185
|
return !isBlockBasedTheme && isHomeRoute ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_site_preview.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
182
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_editor.EditorKeyboardShortcutsRegister, {}),
|
|
183
|
-
isEditMode && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockKeyboardShortcuts, {}),
|
|
184
186
|
!isReady ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_canvas_loader.default, { id: loadingProgressId }) : null,
|
|
185
187
|
isEditMode && isReady && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
186
188
|
import_welcome_guide.default,
|
|
@@ -200,15 +202,15 @@ function EditSiteEditor({ isHomeRoute = false }) {
|
|
|
200
202
|
customSavePanel: _isPreviewingTheme && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_save_panel.default, {}),
|
|
201
203
|
iframeProps,
|
|
202
204
|
onActionPerformed,
|
|
205
|
+
initialViewport: isEditMode ? (0, import_viewport.getDeviceType)(location.query.viewport) : void 0,
|
|
203
206
|
extraSidebarPanels: !postWithTemplate && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_template_setting_panel.default.Slot, {}),
|
|
204
207
|
children: [
|
|
205
|
-
isEditMode && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_use_viewport_sync.ViewportSync, {}),
|
|
206
208
|
isEditMode && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BackButton, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
207
209
|
import_components.Button,
|
|
208
210
|
{
|
|
209
211
|
size: "compact",
|
|
210
212
|
label: (0, import_i18n.__)("Open Navigation"),
|
|
211
|
-
showTooltip:
|
|
213
|
+
showTooltip: !showIconLabels,
|
|
212
214
|
tooltipPosition: "middle right",
|
|
213
215
|
onClick: () => {
|
|
214
216
|
resetZoomLevel();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor/index.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["editorPrivateApis", "routerPrivateApis", "
|
|
4
|
+
"sourcesContent": ["import { useDispatch, useSelect } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\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 { 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 { store as preferencesStore } from '@wordpress/preferences';\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 { getDeviceType } from '../block-editor/viewport';\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 );\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 showIconLabels = useSelect(\n\t\t( select ) =>\n\t\t\tselect( preferencesStore ).get( 'core', 'showIconLabels' ),\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{ ! 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\tinitialViewport={\n\t\t\t\t\t\tisEditMode\n\t\t\t\t\t\t\t? getDeviceType( location.query.viewport )\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\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 && (\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={ ! showIconLabels }\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;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,wBAAuB;AACvB,qBAA8B;AAC9B,oBAGO;AACP,kBAAmC;AACnC,uBAAuC;AACvC,qBAA4B;AAC5B,qBAAsC;AACtC,oBAAiD;AACjD,2BAA+B;AAC/B,mBAA0C;AAC1C,0BAA0C;AAC1C,iBAA6B;AAC7B,yBAA0C;AAC1C,2BAAyB;AACzB,2BAAyB;AACzB,yBAAuB;AACvB,sCAA0C;AAC1C,2CAAuC;AACvC,iCAAkC;AAClC,yBAAuB;AACvB,wBAAsB;AACtB,uBAA+B;AAC/B,qCAAiC;AACjC,sBAA8B;AAC9B,8BAA2B;AAC3B,oCAAgC;AAChC,mBAAuC;AACvC,wCAAuC;AACvC,uCAGO;AACP,0BAAwB;AAqIt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AAAA,cACA,UACC,mBAAM,IAAI,4BAAe;AAAA;AAAA,UAE3B,GAGH;AAAA,UAED,4CAAC,iBAAAC,SAAA,EAAmB;AAAA;AAAA;AAAA,IACrB;AAAA,KAEF;AAEF;",
|
|
6
|
+
"names": ["editorPrivateApis", "routerPrivateApis", "coreDataStore", "preferencesStore", "useEditorTitle", "useEditorIframeProps", "useRevisionsURLSync", "CanvasLoader", "blockEditorStore", "editorStore", "noticesStore", "SitePreview", "WelcomeGuide", "SaveButton", "SavePanel", "PluginTemplateSettingPanel", "SiteEditorMoreMenu"]
|
|
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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
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;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AACnB,kBAA0B;AAC1B,uBAAmC;AACnC,iBAAsB;AACtB,iBAA6B;AAU3B;AARa,SAAR,cAA+B;AACrC,QAAM,cAAU,uBAAW,CAAE,WAAY;AACxC,UAAM,EAAE,gBAAgB,IAAI,OAAQ,iBAAAA,KAAU;AAC9C,UAAM,WAAW,gBAAiB,QAAQ,gBAAiB;AAC3D,WAAO,UAAU;AAAA,EAClB,GAAG,CAAC,CAAE;AAEN,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAM,yBAAc,SAAS;AAAA;AAAA,QAE5B,iBAAiB;AAAA,MAClB,CAAE;AAAA,MACF,WAAQ,gBAAI,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,iBAAM,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": ["coreStore"]
|
|
7
7
|
}
|
|
@@ -28,7 +28,7 @@ var import_block_editor = require("@wordpress/block-editor");
|
|
|
28
28
|
var import_editor = require("@wordpress/editor");
|
|
29
29
|
var import_element = require("@wordpress/element");
|
|
30
30
|
var import_preferences = require("@wordpress/preferences");
|
|
31
|
-
var
|
|
31
|
+
var import_viewport = require("../block-editor/viewport.cjs");
|
|
32
32
|
function useAdaptEditorToCanvas(canvas) {
|
|
33
33
|
const { clearSelectedBlock } = (0, import_data.useDispatch)(import_block_editor.store);
|
|
34
34
|
const {
|
|
@@ -48,7 +48,7 @@ function useAdaptEditorToCanvas(canvas) {
|
|
|
48
48
|
if (getCurrentPost()?.type) {
|
|
49
49
|
editPost({ selection: void 0 }, { undoIgnore: true });
|
|
50
50
|
}
|
|
51
|
-
setDeviceType(
|
|
51
|
+
setDeviceType(import_viewport.DEFAULT_DEVICE_TYPE);
|
|
52
52
|
closePublishSidebar();
|
|
53
53
|
setIsInserterOpened(false);
|
|
54
54
|
if (isMediumOrBigger && canvas === "edit" && getPreference("core", "showListViewByDefault") && !getPreference("core", "distractionFree")) {
|
|
@@ -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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
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/viewport';\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;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAoD;AACpD,0BAA0C;AAC1C,oBAAqC;AACrC,qBAAgC;AAChC,yBAA0C;AAC1C,sBAAoC;AAE7B,SAAS,uBAAwB,QAAS;AAChD,QAAM,EAAE,mBAAmB,QAAI,yBAAa,oBAAAA,KAAiB;AAC7D,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,yBAAa,cAAAC,KAAY;AAC7B,QAAM,EAAE,KAAK,cAAc,QAAI,uBAAW,mBAAAC,KAAiB;AAC3D,QAAM,EAAE,eAAe,QAAI,uBAAW,cAAAD,KAAY;AAClD,QAAM,eAAW,yBAAY;AAC7B,sCAAiB,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,mCAAoB;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": ["blockEditorStore", "editorStore", "preferencesStore"]
|
|
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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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/components/editor/use-resolve-edited-entity.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA2C;AAC3C,kBAAuC;AACvC,uBAAuC;AACvC,oBAAiD;AACjD,mBAAuC;AACvC,yBAAuB;AACvB,uBAMO;AAEP,IAAM,EAAE,YAAY,QAAI,2BAAQ,cAAAA,WAAkB;AAElD,IAAM,iCAAiC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,+BAAc;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,+BAAc;AAAA,EAC1B,WAAY,SAAS,sBAAuB;AAC3C,eAAW;AAAA,EACZ,WAAY,SAAS,aAAc;AAClC,eAAW;AAAA,EACZ,WAAY,SAAS,iBAAkB;AACtC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AAU;AAQd,sBAAiB,UAAU,OAAQ,MAAO,GAAG,OAAQ;AAAA,IACtD;AAAA,EACD,GAAG,CAAE,SAAS,UAAU,QAAQ,SAAS,eAAgB,CAAE;AAC5D;",
|
|
6
6
|
"names": ["routerPrivateApis", "coreDataStore", "editSiteStore"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/edit-site/src/components/editor/use-revisions-url-sync.js
|
|
21
|
+
var use_revisions_url_sync_exports = {};
|
|
22
|
+
__export(use_revisions_url_sync_exports, {
|
|
23
|
+
default: () => useRevisionsURLSync
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(use_revisions_url_sync_exports);
|
|
26
|
+
var import_data = require("@wordpress/data");
|
|
27
|
+
var import_element = require("@wordpress/element");
|
|
28
|
+
var import_editor = require("@wordpress/editor");
|
|
29
|
+
var import_router = require("@wordpress/router");
|
|
30
|
+
var import_url = require("@wordpress/url");
|
|
31
|
+
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
32
|
+
var { useHistory, useLocation } = (0, import_lock_unlock.unlock)(import_router.privateApis);
|
|
33
|
+
var URL_WRITE_DEBOUNCE_MS = 300;
|
|
34
|
+
function useRevisionsURLSync(enabled, postType, postId) {
|
|
35
|
+
const location = useLocation();
|
|
36
|
+
const history = useHistory();
|
|
37
|
+
const { currentPostType, currentPostId, currentRevisionId } = (0, import_data.useSelect)(
|
|
38
|
+
(select) => {
|
|
39
|
+
const editor = select(import_editor.store);
|
|
40
|
+
return {
|
|
41
|
+
currentPostType: editor.getCurrentPostType(),
|
|
42
|
+
currentPostId: editor.getCurrentPostId(),
|
|
43
|
+
currentRevisionId: (0, import_lock_unlock.unlock)(editor).getCurrentRevisionId()
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
[]
|
|
47
|
+
);
|
|
48
|
+
const { openRevision, setCurrentRevisionId } = (0, import_lock_unlock.unlock)(
|
|
49
|
+
(0, import_data.useDispatch)(import_editor.store)
|
|
50
|
+
);
|
|
51
|
+
const entityKey = postType && postId ? `${postType}:${postId}` : null;
|
|
52
|
+
const isCurrentEntity = !!entityKey && currentPostType === postType && String(currentPostId) === String(postId);
|
|
53
|
+
const handledEntityKeyRef = (0, import_element.useRef)(null);
|
|
54
|
+
const lastURLWriteTimeRef = (0, import_element.useRef)(null);
|
|
55
|
+
(0, import_element.useEffect)(() => {
|
|
56
|
+
if (!enabled) {
|
|
57
|
+
handledEntityKeyRef.current = null;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!isCurrentEntity || !entityKey || handledEntityKeyRef.current === entityKey) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
lastURLWriteTimeRef.current = null;
|
|
64
|
+
handledEntityKeyRef.current = entityKey;
|
|
65
|
+
const revision = Number(location.query.revision);
|
|
66
|
+
if (Number.isInteger(revision) && revision > 0) {
|
|
67
|
+
openRevision(revision);
|
|
68
|
+
} else if (currentRevisionId) {
|
|
69
|
+
setCurrentRevisionId(null);
|
|
70
|
+
}
|
|
71
|
+
}, [
|
|
72
|
+
enabled,
|
|
73
|
+
isCurrentEntity,
|
|
74
|
+
entityKey,
|
|
75
|
+
location.query.revision,
|
|
76
|
+
currentRevisionId,
|
|
77
|
+
openRevision,
|
|
78
|
+
setCurrentRevisionId
|
|
79
|
+
]);
|
|
80
|
+
(0, import_element.useEffect)(() => {
|
|
81
|
+
if (!enabled || !isCurrentEntity || !entityKey || handledEntityKeyRef.current !== entityKey) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (lastURLWriteTimeRef.current === null) {
|
|
85
|
+
lastURLWriteTimeRef.current = Date.now();
|
|
86
|
+
}
|
|
87
|
+
const revisionArg = currentRevisionId ? String(currentRevisionId) : void 0;
|
|
88
|
+
if (location.query.revision === revisionArg) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const write = async () => {
|
|
92
|
+
const addressBarArg = new URLSearchParams(window.location.search).get(
|
|
93
|
+
"revision"
|
|
94
|
+
) ?? void 0;
|
|
95
|
+
if (addressBarArg !== location.query.revision) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
lastURLWriteTimeRef.current = Date.now();
|
|
99
|
+
try {
|
|
100
|
+
await history.navigate(
|
|
101
|
+
(0, import_url.addQueryArgs)(location.path, { revision: revisionArg }),
|
|
102
|
+
{ replace: true }
|
|
103
|
+
);
|
|
104
|
+
} catch {
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
if (Date.now() - lastURLWriteTimeRef.current >= URL_WRITE_DEBOUNCE_MS) {
|
|
108
|
+
write();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const timeoutId = setTimeout(write, URL_WRITE_DEBOUNCE_MS);
|
|
112
|
+
return () => clearTimeout(timeoutId);
|
|
113
|
+
}, [
|
|
114
|
+
enabled,
|
|
115
|
+
isCurrentEntity,
|
|
116
|
+
entityKey,
|
|
117
|
+
currentRevisionId,
|
|
118
|
+
location,
|
|
119
|
+
history
|
|
120
|
+
]);
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=use-revisions-url-sync.cjs.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;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuC;AACvC,qBAAkC;AAClC,oBAAqC;AACrC,oBAAiD;AACjD,iBAA6B;AAC7B,yBAAuB;AAEvB,IAAM,EAAE,YAAY,YAAY,QAAI,2BAAQ,cAAAA,WAAkB;AAK9D,IAAM,wBAAwB;AAEf,SAAR,oBAAsC,SAAS,UAAU,QAAS;AACxE,QAAM,WAAW,YAAY;AAC7B,QAAM,UAAU,WAAW;AAC3B,QAAM,EAAE,iBAAiB,eAAe,kBAAkB,QAAI;AAAA,IAC7D,CAAE,WAAY;AACb,YAAM,SAAS,OAAQ,cAAAC,KAAY;AACnC,aAAO;AAAA,QACN,iBAAiB,OAAO,mBAAmB;AAAA,QAC3C,eAAe,OAAO,iBAAiB;AAAA,QACvC,uBAAmB,2BAAQ,MAAO,EAAE,qBAAqB;AAAA,MAC1D;AAAA,IACD;AAAA,IACA,CAAC;AAAA,EACF;AACA,QAAM,EAAE,cAAc,qBAAqB,QAAI;AAAA,QAC9C,yBAAa,cAAAA,KAAY;AAAA,EAC1B;AACA,QAAM,YAAY,YAAY,SAAS,GAAI,QAAS,IAAK,MAAO,KAAK;AACrE,QAAM,kBACL,CAAC,CAAE,aACH,oBAAoB,YACpB,OAAQ,aAAc,MAA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K,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": ["routerPrivateApis", "editorStore"]
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/layout/animation.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
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;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoC;AACpC,qBAAiD;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,UAAM,uBAAO;AAInB,QAAM,EAAE,UAAU,SAAS,QAAI;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,sCAAiB,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;AAEA,UAAM,aAAa,IAAI,sBAAY;AAAA,MAClC,GAAG;AAAA,MACH,GAAG;AAAA,MACH,OAAO,SAAS;AAAA,MAChB,QAAQ,SAAS;AAAA,MACjB,QAAQ;AAAA,QACP,UAAU;AAAA,QACV,QAAQ,mBAAQ;AAAA,MACjB;AAAA,MACA,SAAU,EAAE,MAAM,GAAI;AACrB,YAAK,CAAE,IAAI,SAAU;AACpB;AAAA,QACD;AACA,YAAI,EAAE,GAAAA,IAAG,GAAAC,IAAG,OA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