@wordpress/edit-site 5.11.0 → 5.12.1
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 +7 -0
- package/build/components/add-new-page/index.js +105 -0
- package/build/components/add-new-page/index.js.map +1 -0
- package/build/components/add-new-pattern/index.js +99 -0
- package/build/components/add-new-pattern/index.js.map +1 -0
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +4 -5
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +27 -44
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/index.js +6 -15
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/add-new-template/new-template.js +26 -35
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/add-new-template/utils.js +71 -120
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +2 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/back-button.js +6 -6
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/block-inspector-button.js +3 -4
- package/build/components/block-editor/block-inspector-button.js.map +1 -1
- package/build/components/block-editor/constants.js +9 -0
- package/build/components/block-editor/constants.js.map +1 -0
- package/build/components/block-editor/editor-canvas.js +14 -15
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/get-block-editor-provider.js +42 -0
- package/build/components/block-editor/get-block-editor-provider.js.map +1 -0
- package/build/components/block-editor/index.js +6 -129
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/inserter-media-categories.js +25 -42
- package/build/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build/components/block-editor/providers/default-block-editor-provider.js +58 -0
- package/build/components/block-editor/providers/default-block-editor-provider.js.map +1 -0
- package/build/components/block-editor/providers/navigation-block-editor-provider.js +117 -0
- package/build/components/block-editor/providers/navigation-block-editor-provider.js.map +1 -0
- package/build/components/block-editor/resizable-editor.js +6 -7
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +5 -7
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +137 -0
- package/build/components/block-editor/site-editor-canvas.js.map +1 -0
- package/build/components/block-editor/use-site-editor-settings.js +82 -0
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -0
- package/build/components/canvas-spinner/index.js +18 -1
- package/build/components/canvas-spinner/index.js.map +1 -1
- package/build/components/code-editor/code-editor-text-area.js +5 -6
- package/build/components/code-editor/code-editor-text-area.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +125 -0
- package/build/components/create-pattern-modal/index.js.map +1 -0
- package/build/components/create-template-part-modal/index.js +73 -33
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +43 -24
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +29 -12
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/error-boundary/warning.js +8 -10
- package/build/components/error-boundary/warning.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +7 -10
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/color-indicator-wrapper.js +7 -9
- package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +5 -6
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +3 -5
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +20 -26
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +5 -6
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/header.js +4 -5
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/hooks.js +3 -3
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/icon-with-current-color.js +7 -9
- package/build/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +15 -17
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +12 -16
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +43 -53
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/root-menu.js +2 -2
- package/build/components/global-styles/root-menu.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +6 -9
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +11 -12
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +3 -4
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +2 -2
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +2 -2
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +2 -2
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +12 -12
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +14 -19
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +7 -13
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/screen-root.js +5 -5
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +3 -4
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +8 -9
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +15 -8
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/subtitle.js +4 -5
- package/build/components/global-styles/subtitle.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +6 -7
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +7 -8
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/ui.js +123 -50
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +5 -6
- package/build/components/global-styles/variations-panel.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +2 -2
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +136 -24
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +8 -14
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +49 -53
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js +4 -7
- package/build/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js.map +1 -1
- package/build/components/header-edit-mode/tools-more-menu-group/index.js +5 -14
- package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
- package/build/components/header-edit-mode/undo-redo/redo.js +2 -6
- package/build/components/header-edit-mode/undo-redo/redo.js.map +1 -1
- package/build/components/header-edit-mode/undo-redo/undo.js +2 -6
- package/build/components/header-edit-mode/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +42 -51
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +7 -2
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +7 -2
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +1 -1
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/hooks.js +21 -0
- package/build/components/layout/hooks.js.map +1 -1
- package/build/components/layout/index.js +44 -34
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +13 -23
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/header.js +4 -7
- package/build/components/list/header.js.map +1 -1
- package/build/components/list/index.js +4 -6
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +35 -40
- package/build/components/list/table.js.map +1 -1
- package/build/components/page/header.js +41 -0
- package/build/components/page/header.js.map +1 -0
- package/build/components/page/index.js +49 -0
- package/build/components/page/index.js.map +1 -0
- package/build/components/page-actions/delete-page-menu-item.js +70 -0
- package/build/components/page-actions/delete-page-menu-item.js.map +1 -0
- package/build/components/page-actions/index.js +43 -0
- package/build/components/page-actions/index.js.map +1 -0
- package/build/components/page-content-focus-manager/back-to-page-notification.js +67 -0
- package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -0
- package/build/components/page-content-focus-manager/constants.js +9 -0
- package/build/components/page-content-focus-manager/constants.js.map +1 -0
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +60 -0
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -0
- package/build/components/page-content-focus-manager/edit-template-notification.js +121 -0
- package/build/components/page-content-focus-manager/edit-template-notification.js.map +1 -0
- package/build/components/page-content-focus-manager/index.js +37 -0
- package/build/components/page-content-focus-manager/index.js.map +1 -0
- package/build/components/page-library/grid-item.js +165 -0
- package/build/components/page-library/grid-item.js.map +1 -0
- package/build/components/page-library/grid.js +49 -0
- package/build/components/page-library/grid.js.map +1 -0
- package/build/components/page-library/index.js +61 -0
- package/build/components/page-library/index.js.map +1 -0
- package/build/components/page-library/no-patterns.js +20 -0
- package/build/components/page-library/no-patterns.js.map +1 -0
- package/build/components/page-library/patterns-list.js +108 -0
- package/build/components/page-library/patterns-list.js.map +1 -0
- package/build/components/page-library/search-items.js +172 -0
- package/build/components/page-library/search-items.js.map +1 -0
- package/build/components/page-library/use-library-settings.js +53 -0
- package/build/components/page-library/use-library-settings.js.map +1 -0
- package/build/components/page-library/use-patterns.js +194 -0
- package/build/components/page-library/use-patterns.js.map +1 -0
- package/build/components/page-library/utils.js +30 -0
- package/build/components/page-library/utils.js.map +1 -0
- package/build/components/page-main/index.js +46 -0
- package/build/components/page-main/index.js.map +1 -0
- package/build/components/page-templates/index.js +101 -0
- package/build/components/page-templates/index.js.map +1 -0
- package/build/components/preferences-modal/enable-feature.js +4 -7
- package/build/components/preferences-modal/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/index.js +4 -5
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +25 -15
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/revisions/index.js +14 -17
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/routes/link.js +15 -22
- package/build/components/routes/link.js.map +1 -1
- package/build/components/routes/use-title.js +3 -7
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/save-button/index.js +23 -13
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +97 -5
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-panel/index.js +63 -19
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +4 -8
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +51 -9
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +14 -8
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +2 -4
- package/build/components/sidebar-button/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/default-sidebar.js +11 -12
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +22 -8
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +13 -10
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js +84 -0
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -0
- package/build/components/sidebar-edit-mode/page-panels/index.js +99 -0
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +35 -0
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -0
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +192 -0
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -0
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +45 -0
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -0
- package/build/components/sidebar-edit-mode/page-panels/publish-date.js +98 -0
- package/build/components/sidebar-edit-mode/page-panels/publish-date.js.map +1 -0
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +8 -12
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +52 -21
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/sidebar-card/index.js +46 -0
- package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +5 -6
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
- package/build/components/sidebar-edit-mode/{template-card → template-panel}/index.js +30 -22
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +7 -8
- package/{build-module/components/sidebar-edit-mode/template-revisions/index.js.map → build/components/sidebar-edit-mode/template-panel/last-revision.js.map} +1 -1
- package/build/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +12 -16
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -0
- package/build/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +15 -19
- package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -0
- package/build/components/sidebar-navigation-item/index.js +17 -14
- package/build/components/sidebar-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +38 -20
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js +36 -0
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-details-panel/index.js +58 -0
- package/build/components/sidebar-navigation-screen-details-panel/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +22 -0
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +1 -0
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +35 -0
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -0
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +22 -0
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +1 -0
- package/build/components/sidebar-navigation-screen-global-styles/index.js +114 -24
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-library/category-item.js +48 -0
- package/build/components/sidebar-navigation-screen-library/category-item.js.map +1 -0
- package/build/components/sidebar-navigation-screen-library/index.js +112 -0
- package/build/components/sidebar-navigation-screen-library/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js +36 -0
- package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js +76 -0
- package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js +41 -0
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +1 -0
- package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js +40 -0
- package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +1 -0
- package/build/components/sidebar-navigation-screen-main/index.js +12 -13
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +5 -7
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +42 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +41 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +49 -97
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +84 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +71 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +54 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +49 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +163 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +3 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +59 -26
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +75 -31
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +23 -53
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +63 -12
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/page-details.js +150 -0
- package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -0
- package/build/components/sidebar-navigation-screen-page/status-label.js +111 -0
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pages/index.js +133 -21
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +66 -0
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +41 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +33 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +40 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +47 -0
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +82 -0
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +80 -0
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -0
- package/build/components/sidebar-navigation-screen-template/home-template-details.js +212 -0
- package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -0
- package/build/components/sidebar-navigation-screen-template/index.js +43 -23
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +23 -28
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +29 -24
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +4 -5
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/start-template-options/index.js +15 -21
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +45 -50
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +16 -6
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +4 -4
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +21 -12
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/table/index.js +29 -0
- package/build/components/table/index.js.map +1 -0
- package/build/components/{list/actions → template-actions}/index.js +34 -31
- package/build/components/template-actions/index.js.map +1 -0
- package/build/components/{list/actions → template-actions}/rename-menu-item.js +4 -5
- package/build/components/template-actions/rename-menu-item.js.map +1 -0
- package/build/components/template-part-converter/convert-to-regular.js +4 -5
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +7 -27
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/template-part-converter/index.js +12 -18
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +1 -1
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/image.js +4 -5
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/components/welcome-guide/styles.js +4 -3
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +190 -0
- package/build/hooks/commands/use-common-commands.js.map +1 -0
- package/build/hooks/commands/use-edit-mode-commands.js +71 -29
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/navigation-menu-edit.js +95 -0
- package/build/hooks/navigation-menu-edit.js.map +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js +15 -10
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/template-part-edit.js +11 -15
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +3 -6
- package/build/index.js.map +1 -1
- package/build/{private-apis.js → lock-unlock.js} +1 -1
- package/build/lock-unlock.js.map +1 -0
- package/build/store/actions.js +165 -125
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +3 -3
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +7 -10
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js +33 -33
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +70 -22
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +1 -3
- package/build/store/utils.js.map +1 -1
- package/build/utils/get-is-list-page.js +13 -7
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/is-previewing-theme.js +2 -4
- package/build/utils/is-previewing-theme.js.map +1 -1
- package/build/utils/is-template-revertable.js +1 -1
- package/build/utils/is-template-revertable.js.map +1 -1
- package/build/utils/use-activate-theme.js +3 -3
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build/utils/use-debounced-input.js +26 -0
- package/build/utils/use-debounced-input.js.map +1 -0
- package/build-module/components/add-new-page/index.js +93 -0
- package/build-module/components/add-new-page/index.js.map +1 -0
- package/build-module/components/add-new-pattern/index.js +82 -0
- package/build-module/components/add-new-pattern/index.js.map +1 -0
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +4 -5
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +25 -41
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/index.js +6 -13
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +22 -31
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +71 -120
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +1 -1
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +5 -5
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/block-inspector-button.js +3 -4
- package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/block-editor/constants.js +2 -0
- package/build-module/components/block-editor/constants.js.map +1 -0
- package/build-module/components/block-editor/editor-canvas.js +12 -12
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/get-block-editor-provider.js +31 -0
- package/build-module/components/block-editor/get-block-editor-provider.js.map +1 -0
- package/build-module/components/block-editor/index.js +9 -125
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js +25 -42
- package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build-module/components/block-editor/providers/default-block-editor-provider.js +42 -0
- package/build-module/components/block-editor/providers/default-block-editor-provider.js.map +1 -0
- package/build-module/components/block-editor/providers/navigation-block-editor-provider.js +102 -0
- package/build-module/components/block-editor/providers/navigation-block-editor-provider.js.map +1 -0
- package/build-module/components/block-editor/resizable-editor.js +6 -7
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +5 -7
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +115 -0
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +67 -0
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -0
- package/build-module/components/canvas-spinner/index.js +15 -1
- package/build-module/components/canvas-spinner/index.js.map +1 -1
- package/build-module/components/code-editor/code-editor-text-area.js +5 -6
- package/build-module/components/code-editor/code-editor-text-area.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +113 -0
- package/build-module/components/create-pattern-modal/index.js.map +1 -0
- package/build-module/components/create-template-part-modal/index.js +70 -34
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +43 -24
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +26 -10
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/error-boundary/warning.js +8 -10
- package/build-module/components/error-boundary/warning.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +7 -10
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/color-indicator-wrapper.js +7 -8
- package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +4 -5
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +2 -4
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +18 -25
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +4 -5
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/header.js +4 -5
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/icon-with-current-color.js +7 -8
- package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +15 -14
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +11 -15
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +42 -52
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/root-menu.js +1 -1
- package/build-module/components/global-styles/root-menu.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +5 -8
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +10 -11
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +3 -4
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +1 -1
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +1 -1
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +1 -1
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +9 -9
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +14 -19
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +6 -11
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +4 -4
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +3 -4
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +6 -7
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +15 -8
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/subtitle.js +4 -5
- package/build-module/components/global-styles/subtitle.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +5 -6
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +6 -7
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/ui.js +123 -50
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +5 -6
- package/build-module/components/global-styles/variations-panel.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +1 -1
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +136 -25
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +6 -12
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +49 -53
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js +4 -4
- package/build-module/components/header-edit-mode/plugin-sidebar-more-menu-item/index.js.map +1 -1
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +5 -13
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/header-edit-mode/undo-redo/redo.js +2 -3
- package/build-module/components/header-edit-mode/undo-redo/redo.js.map +1 -1
- package/build-module/components/header-edit-mode/undo-redo/undo.js +2 -3
- package/build-module/components/header-edit-mode/undo-redo/undo.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +40 -49
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +7 -2
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +7 -2
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +1 -1
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/hooks.js +21 -0
- package/build-module/components/layout/hooks.js.map +1 -1
- package/build-module/components/layout/index.js +37 -28
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +13 -23
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/header.js +4 -7
- package/build-module/components/list/header.js.map +1 -1
- package/build-module/components/list/index.js +3 -5
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +34 -39
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/page/header.js +33 -0
- package/build-module/components/page/header.js.map +1 -0
- package/build-module/components/page/index.js +37 -0
- package/build-module/components/page/index.js.map +1 -0
- package/build-module/components/page-actions/delete-page-menu-item.js +58 -0
- package/build-module/components/page-actions/delete-page-menu-item.js.map +1 -0
- package/build-module/components/page-actions/index.js +30 -0
- package/build-module/components/page-actions/index.js.map +1 -0
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js +53 -0
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -0
- package/build-module/components/page-content-focus-manager/constants.js +2 -0
- package/build-module/components/page-content-focus-manager/constants.js.map +1 -0
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +45 -0
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -0
- package/build-module/components/page-content-focus-manager/edit-template-notification.js +110 -0
- package/build-module/components/page-content-focus-manager/edit-template-notification.js.map +1 -0
- package/build-module/components/page-content-focus-manager/index.js +23 -0
- package/build-module/components/page-content-focus-manager/index.js.map +1 -0
- package/build-module/components/page-library/grid-item.js +145 -0
- package/build-module/components/page-library/grid-item.js.map +1 -0
- package/build-module/components/page-library/grid.js +38 -0
- package/build-module/components/page-library/grid.js.map +1 -0
- package/build-module/components/page-library/index.js +43 -0
- package/build-module/components/page-library/index.js.map +1 -0
- package/build-module/components/page-library/no-patterns.js +12 -0
- package/build-module/components/page-library/no-patterns.js.map +1 -0
- package/build-module/components/page-library/patterns-list.js +87 -0
- package/build-module/components/page-library/patterns-list.js.map +1 -0
- package/build-module/components/page-library/search-items.js +156 -0
- package/build-module/components/page-library/search-items.js.map +1 -0
- package/build-module/components/page-library/use-library-settings.js +40 -0
- package/build-module/components/page-library/use-library-settings.js.map +1 -0
- package/build-module/components/page-library/use-patterns.js +176 -0
- package/build-module/components/page-library/use-patterns.js.map +1 -0
- package/build-module/components/page-library/utils.js +13 -0
- package/build-module/components/page-library/utils.js.map +1 -0
- package/build-module/components/page-main/index.js +32 -0
- package/build-module/components/page-main/index.js.map +1 -0
- package/build-module/components/page-templates/index.js +80 -0
- package/build-module/components/page-templates/index.js.map +1 -0
- package/build-module/components/preferences-modal/enable-feature.js +4 -4
- package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +4 -5
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +24 -14
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/revisions/index.js +12 -14
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/routes/link.js +14 -18
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/routes/use-title.js +2 -6
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/save-button/index.js +23 -13
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +95 -8
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +62 -20
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +4 -5
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +48 -8
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +11 -7
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +2 -3
- package/build-module/components/sidebar-button/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/default-sidebar.js +11 -12
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +19 -6
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +14 -11
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +71 -0
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +78 -0
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +23 -0
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +176 -0
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +33 -0
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/page-panels/publish-date.js +85 -0
- package/build-module/components/sidebar-edit-mode/page-panels/publish-date.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +8 -9
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +50 -23
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +35 -0
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +4 -5
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +72 -0
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +7 -8
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +12 -16
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +15 -19
- package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +1 -0
- package/build-module/components/sidebar-navigation-item/index.js +17 -14
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +39 -21
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +27 -0
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js +30 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +14 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +24 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +14 -0
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +112 -21
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-library/category-item.js +37 -0
- package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-library/index.js +87 -0
- package/build-module/components/sidebar-navigation-screen-library/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js +25 -0
- package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js +61 -0
- package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js +34 -0
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js +27 -0
- package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-main/index.js +13 -13
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +4 -6
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +33 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +26 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +47 -95
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +70 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +58 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +46 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +35 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +151 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +3 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +58 -26
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +73 -28
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +24 -53
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +59 -14
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/page-details.js +131 -0
- package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +98 -0
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pages/index.js +130 -22
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +46 -0
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +28 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +22 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +27 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +34 -0
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +71 -0
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +64 -0
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js +192 -0
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js +40 -23
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +23 -27
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +28 -22
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +4 -5
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +15 -21
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +44 -48
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +15 -5
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +20 -11
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/table/index.js +21 -0
- package/build-module/components/table/index.js.map +1 -0
- package/build-module/components/{list/actions → template-actions}/index.js +34 -31
- package/build-module/components/template-actions/index.js.map +1 -0
- package/build-module/components/{list/actions → template-actions}/rename-menu-item.js +4 -5
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -0
- package/build-module/components/template-part-converter/convert-to-regular.js +4 -5
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +8 -26
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +12 -18
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +1 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/image.js +4 -5
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +5 -3
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +172 -0
- package/build-module/hooks/commands/use-common-commands.js.map +1 -0
- package/build-module/hooks/commands/use-edit-mode-commands.js +72 -30
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/navigation-menu-edit.js +77 -0
- package/build-module/hooks/navigation-menu-edit.js.map +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js +14 -9
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +10 -11
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +3 -6
- package/build-module/index.js.map +1 -1
- package/build-module/{private-apis.js → lock-unlock.js} +1 -1
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/store/actions.js +157 -126
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +7 -10
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/reducer.js +31 -33
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +62 -21
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +1 -3
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +13 -7
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/is-previewing-theme.js +2 -4
- package/build-module/utils/is-previewing-theme.js.map +1 -1
- package/build-module/utils/is-template-revertable.js +1 -1
- package/build-module/utils/is-template-revertable.js.map +1 -1
- package/build-module/utils/use-activate-theme.js +2 -2
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-module/utils/use-debounced-input.js +17 -0
- package/build-module/utils/use-debounced-input.js.map +1 -0
- package/build-style/style-rtl.css +587 -71
- package/build-style/style.css +587 -71
- package/package.json +44 -37
- package/src/components/add-new-page/index.js +105 -0
- package/src/components/add-new-pattern/index.js +94 -0
- package/src/components/add-new-template/add-custom-template-modal-content.js +1 -13
- package/src/components/add-new-template/index.js +0 -3
- package/src/components/add-new-template/new-template.js +3 -3
- package/src/components/app/index.js +1 -1
- package/src/components/block-editor/back-button.js +5 -2
- package/src/components/block-editor/constants.js +1 -0
- package/src/components/block-editor/editor-canvas.js +1 -1
- package/src/components/block-editor/get-block-editor-provider.js +29 -0
- package/src/components/block-editor/index.js +15 -188
- package/src/components/block-editor/providers/default-block-editor-provider.js +44 -0
- package/src/components/block-editor/providers/navigation-block-editor-provider.js +114 -0
- package/src/components/block-editor/site-editor-canvas.js +155 -0
- package/src/components/block-editor/style.scss +6 -0
- package/src/components/block-editor/use-site-editor-settings.js +91 -0
- package/src/components/canvas-spinner/index.js +11 -1
- package/src/components/create-pattern-modal/index.js +134 -0
- package/src/components/create-pattern-modal/style.scss +3 -0
- package/src/components/create-template-part-modal/index.js +63 -3
- package/src/components/editor/index.js +32 -17
- package/src/components/editor/style.scss +6 -11
- package/src/components/editor-canvas-container/index.js +21 -4
- package/src/components/global-styles/color-palette-panel.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +1 -1
- package/src/components/global-styles/global-styles-provider.js +10 -14
- package/src/components/global-styles/gradients-palette-panel.js +1 -1
- package/src/components/global-styles/hooks.js +1 -1
- package/src/components/global-styles/palette.js +2 -2
- package/src/components/global-styles/preview.js +1 -1
- package/src/components/global-styles/root-menu.js +1 -1
- package/src/components/global-styles/screen-block-list.js +1 -1
- package/src/components/global-styles/screen-block.js +1 -1
- package/src/components/global-styles/screen-colors.js +1 -1
- package/src/components/global-styles/screen-css.js +1 -1
- package/src/components/global-styles/screen-layout.js +1 -1
- package/src/components/global-styles/screen-revisions/index.js +1 -1
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +8 -6
- package/src/components/global-styles/screen-root.js +1 -1
- package/src/components/global-styles/screen-typography.js +1 -1
- package/src/components/global-styles/stories/index.js +1 -1
- package/src/components/global-styles/style-variations-container.js +13 -3
- package/src/components/global-styles/style.scss +11 -0
- package/src/components/global-styles/typography-panel.js +1 -1
- package/src/components/global-styles/typography-preview.js +1 -1
- package/src/components/global-styles/ui.js +132 -45
- package/src/components/global-styles-renderer/index.js +1 -1
- package/src/components/header-edit-mode/document-actions/index.js +155 -36
- package/src/components/header-edit-mode/document-actions/style.scss +72 -13
- package/src/components/header-edit-mode/index.js +4 -4
- package/src/components/header-edit-mode/tools-more-menu-group/index.js +1 -6
- package/src/components/keyboard-shortcuts/edit-mode.js +5 -1
- package/src/components/keyboard-shortcuts/index.js +5 -1
- package/src/components/keyboard-shortcuts/register.js +1 -1
- package/src/components/layout/hooks.js +21 -0
- package/src/components/layout/index.js +92 -70
- package/src/components/layout/style.scss +7 -0
- package/src/components/list/index.js +1 -1
- package/src/components/list/table.js +6 -2
- package/src/components/page/header.js +38 -0
- package/src/components/page/index.js +38 -0
- package/src/components/page/style.scss +38 -0
- package/src/components/page-actions/delete-page-menu-item.js +71 -0
- package/src/components/page-actions/index.js +36 -0
- package/src/components/page-content-focus-manager/back-to-page-notification.js +65 -0
- package/src/components/page-content-focus-manager/constants.js +5 -0
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +52 -0
- package/src/components/page-content-focus-manager/edit-template-notification.js +108 -0
- package/src/components/page-content-focus-manager/index.js +26 -0
- package/src/components/page-library/grid-item.js +179 -0
- package/src/components/page-library/grid.js +39 -0
- package/src/components/page-library/index.js +39 -0
- package/src/components/page-library/no-patterns.js +12 -0
- package/src/components/page-library/patterns-list.js +114 -0
- package/src/components/page-library/search-items.js +171 -0
- package/src/components/page-library/style.scss +105 -0
- package/src/components/page-library/use-library-settings.js +51 -0
- package/src/components/page-library/use-patterns.js +238 -0
- package/src/components/page-library/utils.js +21 -0
- package/src/components/page-main/index.js +27 -0
- package/src/components/page-templates/index.js +104 -0
- package/src/components/resizable-frame/index.js +18 -6
- package/src/components/resizable-frame/style.scss +20 -18
- package/src/components/revisions/index.js +7 -8
- package/src/components/routes/link.js +2 -2
- package/src/components/routes/use-title.js +1 -1
- package/src/components/save-button/index.js +16 -7
- package/src/components/save-hub/index.js +143 -38
- package/src/components/save-hub/style.scss +6 -0
- package/src/components/save-panel/index.js +63 -16
- package/src/components/secondary-sidebar/list-view-sidebar.js +56 -2
- package/src/components/sidebar/index.js +13 -7
- package/src/components/sidebar/style.scss +3 -4
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +42 -29
- package/src/components/sidebar-edit-mode/index.js +16 -14
- package/src/components/sidebar-edit-mode/page-panels/edit-template.js +69 -0
- package/src/components/sidebar-edit-mode/page-panels/index.js +89 -0
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +27 -0
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +233 -0
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +35 -0
- package/src/components/sidebar-edit-mode/page-panels/publish-date.js +94 -0
- package/src/components/sidebar-edit-mode/page-panels/style.scss +41 -0
- package/src/components/sidebar-edit-mode/settings-header/index.js +61 -29
- package/src/components/sidebar-edit-mode/sidebar-card/index.js +34 -0
- package/src/components/sidebar-edit-mode/sidebar-card/style.scss +34 -0
- package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +1 -1
- package/src/components/sidebar-edit-mode/template-panel/index.js +65 -0
- package/src/components/sidebar-edit-mode/{template-card → template-panel}/style.scss +2 -32
- package/src/components/sidebar-navigation-item/index.js +6 -2
- package/src/components/sidebar-navigation-item/style.scss +7 -0
- package/src/components/sidebar-navigation-screen/index.js +89 -53
- package/src/components/sidebar-navigation-screen/style.scss +66 -5
- package/src/components/sidebar-navigation-screen-details-footer/index.js +45 -0
- package/src/components/sidebar-navigation-screen-details-footer/style.scss +5 -0
- package/src/components/sidebar-navigation-screen-details-panel/index.js +40 -0
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +14 -0
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +29 -0
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +14 -0
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +25 -0
- package/src/components/sidebar-navigation-screen-global-styles/index.js +126 -14
- package/src/components/sidebar-navigation-screen-global-styles/style.scss +12 -0
- package/src/components/sidebar-navigation-screen-library/category-item.js +43 -0
- package/src/components/sidebar-navigation-screen-library/index.js +136 -0
- package/src/components/sidebar-navigation-screen-library/style.scss +7 -0
- package/src/components/sidebar-navigation-screen-library/use-default-pattern-categories.js +32 -0
- package/src/components/sidebar-navigation-screen-library/use-pattern-categories.js +64 -0
- package/src/components/sidebar-navigation-screen-library/use-template-part-areas.js +33 -0
- package/src/components/sidebar-navigation-screen-library/use-theme-patterns.js +44 -0
- package/src/components/sidebar-navigation-screen-main/index.js +11 -14
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +45 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +24 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +50 -96
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +89 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +51 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +51 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +39 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/style.scss +15 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +175 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +3 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +43 -7
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +61 -2
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +25 -47
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +5 -1
- package/src/components/sidebar-navigation-screen-page/index.js +98 -24
- package/src/components/sidebar-navigation-screen-page/page-details.js +166 -0
- package/src/components/sidebar-navigation-screen-page/status-label.js +105 -0
- package/src/components/sidebar-navigation-screen-page/style.scss +63 -0
- package/src/components/sidebar-navigation-screen-pages/index.js +181 -44
- package/src/components/sidebar-navigation-screen-pattern/index.js +44 -0
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +28 -0
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +21 -0
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +30 -0
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +33 -0
- package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +71 -0
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +86 -0
- package/src/components/sidebar-navigation-screen-template/home-template-details.js +230 -0
- package/src/components/sidebar-navigation-screen-template/index.js +44 -27
- package/src/components/sidebar-navigation-screen-template/style.scss +23 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +19 -26
- package/src/components/site-hub/index.js +26 -7
- package/src/components/site-hub/style.scss +26 -0
- package/src/components/style-book/index.js +1 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +16 -3
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +11 -1
- package/src/components/table/index.js +33 -0
- package/src/components/table/style.scss +37 -0
- package/src/components/{list/actions → template-actions}/index.js +19 -6
- package/src/components/template-part-converter/convert-to-template-part.js +4 -27
- package/src/components/welcome-guide/editor.js +1 -1
- package/src/components/welcome-guide/styles.js +5 -3
- package/src/hooks/commands/use-common-commands.js +167 -0
- package/src/hooks/commands/use-edit-mode-commands.js +61 -25
- package/src/hooks/index.js +1 -0
- package/src/hooks/navigation-menu-edit.js +95 -0
- package/src/hooks/push-changes-to-global-styles/index.js +14 -8
- package/src/hooks/template-part-edit.js +1 -1
- package/src/store/actions.js +52 -1
- package/src/store/index.js +1 -1
- package/src/store/reducer.js +21 -0
- package/src/store/selectors.js +54 -5
- package/src/store/test/actions.js +31 -0
- package/src/store/test/reducer.js +44 -0
- package/src/store/test/selectors.js +57 -0
- package/src/style.scss +17 -4
- package/src/utils/get-is-list-page.js +16 -4
- package/src/utils/is-previewing-theme.js +2 -3
- package/src/utils/use-activate-theme.js +3 -2
- package/src/utils/use-debounced-input.js +17 -0
- package/build/components/add-new-template/new-template-part.js +0 -116
- package/build/components/add-new-template/new-template-part.js.map +0 -1
- package/build/components/list/actions/index.js.map +0 -1
- package/build/components/list/actions/rename-menu-item.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-card/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-card/template-actions.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-card/template-areas.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-revisions/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +0 -53
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +0 -1
- package/build/components/sidebar-navigation-subtitle/index.js +0 -18
- package/build/components/sidebar-navigation-subtitle/index.js.map +0 -1
- package/build/private-apis.js.map +0 -1
- package/build-module/components/add-new-template/new-template-part.js +0 -96
- package/build-module/components/add-new-template/new-template-part.js.map +0 -1
- package/build-module/components/list/actions/index.js.map +0 -1
- package/build-module/components/list/actions/rename-menu-item.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-card/index.js +0 -68
- package/build-module/components/sidebar-edit-mode/template-card/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-card/template-actions.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-card/template-areas.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +0 -40
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +0 -1
- package/build-module/components/sidebar-navigation-subtitle/index.js +0 -10
- package/build-module/components/sidebar-navigation-subtitle/index.js.map +0 -1
- package/build-module/private-apis.js.map +0 -1
- package/src/components/add-new-template/new-template-part.js +0 -109
- package/src/components/sidebar-edit-mode/template-card/index.js +0 -59
- package/src/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +0 -47
- package/src/components/sidebar-navigation-screen-pages/style.scss +0 -4
- package/src/components/sidebar-navigation-screen-templates/style.scss +0 -4
- package/src/components/sidebar-navigation-subtitle/index.js +0 -5
- package/src/components/sidebar-navigation-subtitle/style.scss +0 -7
- /package/src/components/sidebar-edit-mode/{template-revisions/index.js → template-panel/last-revision.js} +0 -0
- /package/src/components/sidebar-edit-mode/{template-card → template-panel}/template-actions.js +0 -0
- /package/src/components/sidebar-edit-mode/{template-card → template-panel}/template-areas.js +0 -0
- /package/src/components/{list/actions → template-actions}/rename-menu-item.js +0 -0
- /package/src/{private-apis.js → lock-unlock.js} +0 -0
|
@@ -9,35 +9,21 @@ exports.default = BlockEditor;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
12
|
var _data = require("@wordpress/data");
|
|
15
13
|
|
|
16
|
-
var _coreData = require("@wordpress/core-data");
|
|
17
|
-
|
|
18
14
|
var _blockEditor = require("@wordpress/block-editor");
|
|
19
15
|
|
|
20
|
-
var _compose = require("@wordpress/compose");
|
|
21
|
-
|
|
22
16
|
var _reusableBlocks = require("@wordpress/reusable-blocks");
|
|
23
17
|
|
|
24
|
-
var _inserterMediaCategories = _interopRequireDefault(require("./inserter-media-categories"));
|
|
25
|
-
|
|
26
18
|
var _templatePartConverter = _interopRequireDefault(require("../template-part-converter"));
|
|
27
19
|
|
|
28
20
|
var _sidebarEditMode = require("../sidebar-edit-mode");
|
|
29
21
|
|
|
30
22
|
var _store = require("../../store");
|
|
31
23
|
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
var _resizableEditor = _interopRequireDefault(require("./resizable-editor"));
|
|
35
|
-
|
|
36
|
-
var _editorCanvas = _interopRequireDefault(require("./editor-canvas"));
|
|
24
|
+
var _siteEditorCanvas = _interopRequireDefault(require("./site-editor-canvas"));
|
|
37
25
|
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
var _editorCanvasContainer = _interopRequireDefault(require("../editor-canvas-container"));
|
|
26
|
+
var _getBlockEditorProvider = _interopRequireDefault(require("./get-block-editor-provider"));
|
|
41
27
|
|
|
42
28
|
/**
|
|
43
29
|
* External dependencies
|
|
@@ -50,120 +36,11 @@ var _editorCanvasContainer = _interopRequireDefault(require("../editor-canvas-co
|
|
|
50
36
|
/**
|
|
51
37
|
* Internal dependencies
|
|
52
38
|
*/
|
|
53
|
-
const {
|
|
54
|
-
ExperimentalBlockEditorProvider
|
|
55
|
-
} = (0, _privateApis.unlock)(_blockEditor.privateApis);
|
|
56
|
-
const LAYOUT = {
|
|
57
|
-
type: 'default',
|
|
58
|
-
// At the root level of the site editor, no alignments should be allowed.
|
|
59
|
-
alignments: []
|
|
60
|
-
};
|
|
61
|
-
|
|
62
39
|
function BlockEditor() {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const {
|
|
66
|
-
setIsInserterOpened
|
|
67
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
68
|
-
const {
|
|
69
|
-
storedSettings,
|
|
70
|
-
templateType,
|
|
71
|
-
canvasMode
|
|
72
|
-
} = (0, _data.useSelect)(select => {
|
|
73
|
-
const {
|
|
74
|
-
getSettings,
|
|
75
|
-
getEditedPostType,
|
|
76
|
-
getCanvasMode
|
|
77
|
-
} = (0, _privateApis.unlock)(select(_store.store));
|
|
78
|
-
return {
|
|
79
|
-
storedSettings: getSettings(setIsInserterOpened),
|
|
80
|
-
templateType: getEditedPostType(),
|
|
81
|
-
canvasMode: getCanvasMode()
|
|
82
|
-
};
|
|
83
|
-
}, [setIsInserterOpened]);
|
|
84
|
-
const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp : // WP 6.0
|
|
85
|
-
storedSettings.__experimentalBlockPatterns; // WP 5.9
|
|
86
|
-
|
|
87
|
-
const settingsBlockPatternCategories = (_storedSettings$__exp2 = storedSettings.__experimentalAdditionalBlockPatternCategories) !== null && _storedSettings$__exp2 !== void 0 ? _storedSettings$__exp2 : // WP 6.0
|
|
88
|
-
storedSettings.__experimentalBlockPatternCategories; // WP 5.9
|
|
89
|
-
|
|
90
|
-
const {
|
|
91
|
-
restBlockPatterns,
|
|
92
|
-
restBlockPatternCategories
|
|
93
|
-
} = (0, _data.useSelect)(select => ({
|
|
94
|
-
restBlockPatterns: select(_coreData.store).getBlockPatterns(),
|
|
95
|
-
restBlockPatternCategories: select(_coreData.store).getBlockPatternCategories()
|
|
96
|
-
}), []);
|
|
97
|
-
const blockPatterns = (0, _element.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)).filter(_ref => {
|
|
98
|
-
let {
|
|
99
|
-
postTypes
|
|
100
|
-
} = _ref;
|
|
101
|
-
return !postTypes || Array.isArray(postTypes) && postTypes.includes(templateType);
|
|
102
|
-
}), [settingsBlockPatterns, restBlockPatterns, templateType]);
|
|
103
|
-
const blockPatternCategories = (0, _element.useMemo)(() => [...(settingsBlockPatternCategories || []), ...(restBlockPatternCategories || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)), [settingsBlockPatternCategories, restBlockPatternCategories]);
|
|
104
|
-
const settings = (0, _element.useMemo)(() => {
|
|
105
|
-
const {
|
|
106
|
-
__experimentalAdditionalBlockPatterns,
|
|
107
|
-
__experimentalAdditionalBlockPatternCategories,
|
|
108
|
-
...restStoredSettings
|
|
109
|
-
} = storedSettings;
|
|
110
|
-
return { ...restStoredSettings,
|
|
111
|
-
inserterMediaCategories: _inserterMediaCategories.default,
|
|
112
|
-
__experimentalBlockPatterns: blockPatterns,
|
|
113
|
-
__experimentalBlockPatternCategories: blockPatternCategories
|
|
114
|
-
};
|
|
115
|
-
}, [storedSettings, blockPatterns, blockPatternCategories]);
|
|
116
|
-
const [blocks, onInput, onChange] = (0, _coreData.useEntityBlockEditor)('postType', templateType);
|
|
117
|
-
const contentRef = (0, _element.useRef)();
|
|
118
|
-
const mergedRefs = (0, _compose.useMergeRefs)([contentRef, (0, _blockEditor.__unstableUseClipboardHandler)(), (0, _blockEditor.__unstableUseTypingObserver)()]);
|
|
119
|
-
const isMobileViewport = (0, _compose.useViewportMatch)('small', '<');
|
|
120
|
-
const {
|
|
121
|
-
clearSelectedBlock
|
|
122
|
-
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
123
|
-
const [resizeObserver, sizes] = (0, _compose.useResizeObserver)();
|
|
124
|
-
const isTemplatePart = templateType === 'wp_template_part';
|
|
125
|
-
const hasBlocks = blocks.length !== 0;
|
|
126
|
-
const enableResizing = isTemplatePart && canvasMode !== 'view' && // Disable resizing in mobile viewport.
|
|
127
|
-
!isMobileViewport;
|
|
128
|
-
const isViewMode = canvasMode === 'view';
|
|
129
|
-
const showBlockAppender = isTemplatePart && hasBlocks || isViewMode ? false : undefined;
|
|
130
|
-
return (0, _element.createElement)(ExperimentalBlockEditorProvider, {
|
|
131
|
-
settings: settings,
|
|
132
|
-
value: blocks,
|
|
133
|
-
onInput: onInput,
|
|
134
|
-
onChange: onChange,
|
|
135
|
-
useSubRegistry: false
|
|
136
|
-
}, (0, _element.createElement)(_templatePartConverter.default, null), (0, _element.createElement)(_sidebarEditMode.SidebarInspectorFill, null, (0, _element.createElement)(_blockEditor.BlockInspector, null)), (0, _element.createElement)(_editorCanvasContainer.default.Slot, null, _ref2 => {
|
|
137
|
-
var _sizes$height;
|
|
40
|
+
const entityType = (0, _data.useSelect)(select => select(_store.store).getEditedPostType(), []); // Choose the provider based on the entity type currently
|
|
41
|
+
// being edited.
|
|
138
42
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
className: "edit-site-visual-editor is-focus-mode"
|
|
142
|
-
}, editorCanvasView) : (0, _element.createElement)(_blockEditor.BlockTools, {
|
|
143
|
-
className: (0, _classnames.default)('edit-site-visual-editor', {
|
|
144
|
-
'is-focus-mode': isTemplatePart || !!editorCanvasView,
|
|
145
|
-
'is-view-mode': isViewMode
|
|
146
|
-
}),
|
|
147
|
-
__unstableContentRef: contentRef,
|
|
148
|
-
onClick: event => {
|
|
149
|
-
// Clear selected block when clicking on the gray background.
|
|
150
|
-
if (event.target === event.currentTarget) {
|
|
151
|
-
clearSelectedBlock();
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}, (0, _element.createElement)(_blockEditor.BlockEditorKeyboardShortcuts.Register, null), (0, _element.createElement)(_backButton.default, null), (0, _element.createElement)(_resizableEditor.default, {
|
|
155
|
-
enableResizing: enableResizing,
|
|
156
|
-
height: (_sizes$height = sizes.height) !== null && _sizes$height !== void 0 ? _sizes$height : '100%'
|
|
157
|
-
}, (0, _element.createElement)(_editorCanvas.default, {
|
|
158
|
-
enableResizing: enableResizing,
|
|
159
|
-
settings: settings,
|
|
160
|
-
contentRef: mergedRefs,
|
|
161
|
-
readonly: canvasMode === 'view'
|
|
162
|
-
}, resizeObserver, (0, _element.createElement)(_blockEditor.BlockList, {
|
|
163
|
-
className: "edit-site-block-editor__block-list wp-site-blocks",
|
|
164
|
-
__experimentalLayout: LAYOUT,
|
|
165
|
-
renderAppender: showBlockAppender
|
|
166
|
-
}))));
|
|
167
|
-
}), (0, _element.createElement)(_reusableBlocks.ReusableBlocksMenuItems, null));
|
|
43
|
+
const BlockEditorProvider = (0, _getBlockEditorProvider.default)(entityType);
|
|
44
|
+
return (0, _element.createElement)(BlockEditorProvider, null, (0, _element.createElement)(_templatePartConverter.default, null), (0, _element.createElement)(_sidebarEditMode.SidebarInspectorFill, null, (0, _element.createElement)(_blockEditor.BlockInspector, null)), (0, _element.createElement)(_siteEditorCanvas.default, null), (0, _element.createElement)(_reusableBlocks.ReusableBlocksMenuItems, null));
|
|
168
45
|
}
|
|
169
46
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["ExperimentalBlockEditorProvider","blockEditorPrivateApis","LAYOUT","type","alignments","BlockEditor","setIsInserterOpened","editSiteStore","storedSettings","templateType","canvasMode","select","getSettings","getEditedPostType","getCanvasMode","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","coreStore","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","settings","restStoredSettings","inserterMediaCategories","blocks","onInput","onChange","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","blockEditorStore","resizeObserver","sizes","isTemplatePart","hasBlocks","length","enableResizing","isViewMode","showBlockAppender","undefined","editorCanvasView","event","target","currentTarget","height"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAUA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvCA;AACA;AACA;;AAGA;AACA;AACA;;AAqBA;AACA;AACA;AAWA,MAAM;AAAEA,EAAAA;AAAF,IAAsC,yBAAQC,wBAAR,CAA5C;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,IAAI,EAAE,SADQ;AAEd;AACAC,EAAAA,UAAU,EAAE;AAHE,CAAf;;AAMe,SAASC,WAAT,GAAuB;AAAA;;AACrC,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,YAAb,CAAhC;AACA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,YAAlB;AAAgCC,IAAAA;AAAhC,MAA+C,qBAClDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,WAAF;AAAeC,MAAAA,iBAAf;AAAkCC,MAAAA;AAAlC,QAAoD,yBACzDH,MAAM,CAAEJ,YAAF,CADmD,CAA1D;AAIA,WAAO;AACNC,MAAAA,cAAc,EAAEI,WAAW,CAAEN,mBAAF,CADrB;AAENG,MAAAA,YAAY,EAAEI,iBAAiB,EAFzB;AAGNH,MAAAA,UAAU,EAAEI,aAAa;AAHnB,KAAP;AAKA,GAXmD,EAYpD,CAAER,mBAAF,CAZoD,CAArD;AAeA,QAAMS,qBAAqB,4BAC1BP,cAAc,CAACQ,qCADW,yEAC8B;AACxDR,EAAAA,cAAc,CAACS,2BAFhB,CAjBqC,CAmBQ;;AAC7C,QAAMC,8BAA8B,6BACnCV,cAAc,CAACW,8CADoB,2EAC8B;AACjEX,EAAAA,cA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A,cAAc,EAAG;AALlB,KAOC,4BAAC,8BAAD,OAPD,EAQC,4BAAC,qCAAD,QACC,4BAAC,2BAAD,OADD,CARD,EAWC,4BAAC,8BAAD,CAAuB,IAAvB,QACG;AAAA;;AAAA,QAAE,CAAEe,gBAAF,CAAF;AAAA,WACDA,gBAAgB,GACf;AAAK,MAAA,SAAS,EAAC;AAAf,OACGA,gBADH,CADe,GAKf,4BAAC,uBAAD;AACC,MAAA,SAAS,EAAG,yBAAY,yBAAZ,EAAuC;AAClD,yBACCP,cAAc,IAAI,CAAC,CAAEO,gBAF4B;AAGlD,wBAAgBH;AAHkC,OAAvC,CADb;AAMC,MAAA,oBAAoB,EAAGX,UANxB;AAOC,MAAA,OAAO,EAAKe,KAAF,IAAa;AACtB;AACA,YAAKA,KAAK,CAACC,MAAN,KAAiBD,KAAK,CAACE,aAA5B,EAA4C;AAC3Cd,UAAAA,kBAAkB;AAClB;AACD;AAZF,OAcC,4BAAC,yCAAD,CAA8B,QAA9B,OAdD,EAeC,4BAAC,mBAAD,OAfD,EAgBC,4BAAC,wBAAD;AACC,MAAA,cAAc,EAAGO,cADlB;AAEC,MAAA,MAAM,mBAAGJ,KAAK,CAACY,MAAT,yDAAmB;AAF1B,OAIC,4BAAC,qBAAD;AACC,MAAA,cAAc,EAAGR,cADlB;AAEC,MAAA,QAAQ,EAAGhB,QAFZ;AAGC,MAAA,UAAU,EAAGO,UAHd;AAIC,MAAA,QAAQ,EAAGpC,UAAU,KAAK;AAJ3B,OAMGwC,cANH,EAOC,4BAAC,sBAAD;AACC,MAAA,SAAS,EAAC,mDADX;AAEC,MAAA,oBAAoB,EAAGhD,MAFxB;AAGC,MAAA,cAAc,EAAGuD;AAHlB,MAPD,CAJD,CAhBD,CANA;AAAA,GADH,CAXD,EAwDC,4BAAC,uCAAD,OAxDD,CADD;AA4DA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tuseMergeRefs,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from './inserter-media-categories';\nimport TemplatePartConverter from '../template-part-converter';\nimport { SidebarInspectorFill } from '../sidebar-edit-mode';\nimport { store as editSiteStore } from '../../store';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\nimport EditorCanvas from './editor-canvas';\nimport { unlock } from '../../private-apis';\nimport EditorCanvasContainer from '../editor-canvas-container';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor() {\n\tconst { setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst { storedSettings, templateType, canvasMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, getEditedPostType, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( setIsInserterOpened ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpened ]\n\t);\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tstoredSettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( templateType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, templateType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst {\n\t\t\t__experimentalAdditionalBlockPatterns,\n\t\t\t__experimentalAdditionalBlockPatternCategories,\n\t\t\t...restStoredSettings\n\t\t} = storedSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t};\n\t}, [ storedSettings, blockPatterns, blockPatternCategories ] );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [\n\t\tcontentRef,\n\t\tuseClipboardHandler(),\n\t\tuseTypingObserver(),\n\t] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\tconst hasBlocks = blocks.length !== 0;\n\tconst enableResizing =\n\t\tisTemplatePart &&\n\t\tcanvasMode !== 'view' &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport;\n\tconst isViewMode = canvasMode === 'view';\n\tconst showBlockAppender =\n\t\t( isTemplatePart && hasBlocks ) || isViewMode ? false : undefined;\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<TemplatePartConverter />\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<EditorCanvasContainer.Slot>\n\t\t\t\t{ ( [ editorCanvasView ] ) =>\n\t\t\t\t\teditorCanvasView ? (\n\t\t\t\t\t\t<div className=\"edit-site-visual-editor is-focus-mode\">\n\t\t\t\t\t\t\t{ editorCanvasView }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BlockTools\n\t\t\t\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t\t\t\t'is-focus-mode':\n\t\t\t\t\t\t\t\t\tisTemplatePart || !! editorCanvasView,\n\t\t\t\t\t\t\t\t'is-view-mode': isViewMode,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\t\t\t\tclearSelectedBlock();\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\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t\t\t\t<BackButton />\n\t\t\t\t\t\t\t<ResizableEditor\n\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\theight={ sizes.height ?? '100%' }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EditorCanvas\n\t\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t\t\t\t\t\treadonly={ canvasMode === 'view' }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ resizeObserver }\n\t\t\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\t\t\t\t\trenderAppender={ showBlockAppender }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</EditorCanvas>\n\t\t\t\t\t\t\t</ResizableEditor>\n\t\t\t\t\t\t</BlockTools>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</EditorCanvasContainer.Slot>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["BlockEditor","entityType","select","editSiteStore","getEditedPostType","BlockEditorProvider"],"mappings":";;;;;;;;;;;AAOA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAEA;AACA;AACA;;AAMA;AACA;AACA;AAOe,SAASA,WAAT,GAAuB;AACrC,QAAMC,UAAU,GAAG,qBAChBC,MAAF,IAAcA,MAAM,CAAEC,YAAF,CAAN,CAAwBC,iBAAxB,EADI,EAElB,EAFkB,CAAnB,CADqC,CAMrC;AACA;;AACA,QAAMC,mBAAmB,GAAG,qCAAwBJ,UAAxB,CAA5B;AAEA,SACC,4BAAC,mBAAD,QACC,4BAAC,8BAAD,OADD,EAEC,4BAAC,qCAAD,QACC,4BAAC,2BAAD,OADD,CAFD,EAMC,4BAAC,yBAAD,OAND,EAQC,4BAAC,uCAAD,OARD,CADD;AAYA","sourcesContent":["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { BlockInspector } from '@wordpress/block-editor';\n\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport { SidebarInspectorFill } from '../sidebar-edit-mode';\nimport { store as editSiteStore } from '../../store';\nimport SiteEditorCanvas from './site-editor-canvas';\nimport getBlockEditorProvider from './get-block-editor-provider';\n\nexport default function BlockEditor() {\n\tconst entityType = useSelect(\n\t\t( select ) => select( editSiteStore ).getEditedPostType(),\n\t\t[]\n\t);\n\n\t// Choose the provider based on the entity type currently\n\t// being edited.\n\tconst BlockEditorProvider = getBlockEditorProvider( entityType );\n\n\treturn (\n\t\t<BlockEditorProvider>\n\t\t\t<TemplatePartConverter />\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\n\t\t\t<SiteEditorCanvas />\n\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
|
|
@@ -110,21 +110,16 @@ const getOpenverseCaption = item => {
|
|
|
110
110
|
return _caption.replace(/\s{2}/g, ' ');
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
const coreMediaFetch = async
|
|
114
|
-
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
113
|
+
const coreMediaFetch = async (query = {}) => {
|
|
115
114
|
const mediaItems = await (0, _data.resolveSelect)(_coreData.store).getMediaItems({ ...query,
|
|
116
|
-
orderBy: !!
|
|
117
|
-
});
|
|
118
|
-
return mediaItems.map(mediaItem => {
|
|
119
|
-
var _mediaItem$media_deta, _mediaItem$media_deta2, _mediaItem$media_deta3, _mediaItem$caption;
|
|
120
|
-
|
|
121
|
-
return { ...mediaItem,
|
|
122
|
-
alt: mediaItem.alt_text,
|
|
123
|
-
url: mediaItem.source_url,
|
|
124
|
-
previewUrl: (_mediaItem$media_deta = mediaItem.media_details) === null || _mediaItem$media_deta === void 0 ? void 0 : (_mediaItem$media_deta2 = _mediaItem$media_deta.sizes) === null || _mediaItem$media_deta2 === void 0 ? void 0 : (_mediaItem$media_deta3 = _mediaItem$media_deta2.medium) === null || _mediaItem$media_deta3 === void 0 ? void 0 : _mediaItem$media_deta3.source_url,
|
|
125
|
-
caption: (_mediaItem$caption = mediaItem.caption) === null || _mediaItem$caption === void 0 ? void 0 : _mediaItem$caption.raw
|
|
126
|
-
};
|
|
115
|
+
orderBy: !!query?.search ? 'relevance' : 'date'
|
|
127
116
|
});
|
|
117
|
+
return mediaItems.map(mediaItem => ({ ...mediaItem,
|
|
118
|
+
alt: mediaItem.alt_text,
|
|
119
|
+
url: mediaItem.source_url,
|
|
120
|
+
previewUrl: mediaItem.media_details?.sizes?.medium?.source_url,
|
|
121
|
+
caption: mediaItem.caption?.raw
|
|
122
|
+
}));
|
|
128
123
|
};
|
|
129
124
|
/** @type {InserterMediaCategory[]} */
|
|
130
125
|
|
|
@@ -137,8 +132,7 @@ const inserterMediaCategories = [{
|
|
|
137
132
|
},
|
|
138
133
|
mediaType: 'image',
|
|
139
134
|
|
|
140
|
-
async fetch() {
|
|
141
|
-
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
135
|
+
async fetch(query = {}) {
|
|
142
136
|
return coreMediaFetch({ ...query,
|
|
143
137
|
media_type: 'image'
|
|
144
138
|
});
|
|
@@ -152,8 +146,7 @@ const inserterMediaCategories = [{
|
|
|
152
146
|
},
|
|
153
147
|
mediaType: 'video',
|
|
154
148
|
|
|
155
|
-
async fetch() {
|
|
156
|
-
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
149
|
+
async fetch(query = {}) {
|
|
157
150
|
return coreMediaFetch({ ...query,
|
|
158
151
|
media_type: 'video'
|
|
159
152
|
});
|
|
@@ -167,8 +160,7 @@ const inserterMediaCategories = [{
|
|
|
167
160
|
},
|
|
168
161
|
mediaType: 'audio',
|
|
169
162
|
|
|
170
|
-
async fetch() {
|
|
171
|
-
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
163
|
+
async fetch(query = {}) {
|
|
172
164
|
return coreMediaFetch({ ...query,
|
|
173
165
|
media_type: 'audio'
|
|
174
166
|
});
|
|
@@ -182,8 +174,7 @@ const inserterMediaCategories = [{
|
|
|
182
174
|
},
|
|
183
175
|
mediaType: 'image',
|
|
184
176
|
|
|
185
|
-
async fetch() {
|
|
186
|
-
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
177
|
+
async fetch(query = {}) {
|
|
187
178
|
const defaultArgs = {
|
|
188
179
|
mature: false,
|
|
189
180
|
excluded_source: 'flickr,inaturalist,wikimedia',
|
|
@@ -197,8 +188,7 @@ const inserterMediaCategories = [{
|
|
|
197
188
|
search: 'q'
|
|
198
189
|
};
|
|
199
190
|
const url = new URL('https://api.openverse.engineering/v1/images/');
|
|
200
|
-
Object.entries(finalQuery).forEach(
|
|
201
|
-
let [key, value] = _ref;
|
|
191
|
+
Object.entries(finalQuery).forEach(([key, value]) => {
|
|
202
192
|
const queryKey = mapFromInserterMediaRequest[key] || key;
|
|
203
193
|
url.searchParams.set(queryKey, value);
|
|
204
194
|
});
|
|
@@ -209,27 +199,20 @@ const inserterMediaCategories = [{
|
|
|
209
199
|
});
|
|
210
200
|
const jsonResponse = await response.json();
|
|
211
201
|
const results = jsonResponse.results;
|
|
212
|
-
return results.map(result => {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
caption: getOpenverseCaption(result),
|
|
222
|
-
previewUrl: result.thumbnail
|
|
223
|
-
};
|
|
224
|
-
});
|
|
202
|
+
return results.map(result => ({ ...result,
|
|
203
|
+
// This is a temp solution for better titles, until Openverse API
|
|
204
|
+
// completes the cleaning up of some titles of their upstream data.
|
|
205
|
+
title: result.title?.toLowerCase().startsWith('file:') ? result.title.slice(5) : result.title,
|
|
206
|
+
sourceId: result.id,
|
|
207
|
+
id: undefined,
|
|
208
|
+
caption: getOpenverseCaption(result),
|
|
209
|
+
previewUrl: result.thumbnail
|
|
210
|
+
}));
|
|
225
211
|
},
|
|
226
212
|
|
|
227
|
-
getReportUrl:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
} = _ref2;
|
|
231
|
-
return `https://wordpress.org/openverse/image/${sourceId}/report/`;
|
|
232
|
-
},
|
|
213
|
+
getReportUrl: ({
|
|
214
|
+
sourceId
|
|
215
|
+
}) => `https://wordpress.org/openverse/image/${sourceId}/report/`,
|
|
233
216
|
isExternalResource: true
|
|
234
217
|
}];
|
|
235
218
|
var _default = inserterMediaCategories;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/inserter-media-categories.js"],"names":["getExternalLink","url","text","getExternalLinkAttributes","getOpenverseLicense","license","licenseVersion","licenseName","trim","toUpperCase","replace","includes","getOpenverseCaption","item","title","foreign_landing_url","foreignLandingUrl","creator","creator_url","creatorUrl","license_version","license_url","licenseUrl","fullLicense","_creator","_caption","coreMediaFetch","query","mediaItems","coreStore","getMediaItems","orderBy","search","map","mediaItem","alt","alt_text","source_url","previewUrl","media_details","sizes","medium","caption","raw","inserterMediaCategories","name","labels","search_items","mediaType","fetch","media_type","defaultArgs","mature","excluded_source","finalQuery","mapFromInserterMediaRequest","per_page","URL","Object","entries","forEach","key","value","queryKey","searchParams","set","response","window","headers","jsonResponse","json","results","result","toLowerCase","startsWith","slice","sourceId","id","undefined","thumbnail","getReportUrl","isExternalResource"],"mappings":";;;;;;;AAWA;;AACA;;AACA;;AAKA;;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,eAAe,GAAG,CAAEC,GAAF,EAAOC,IAAP,KACtB,MAAMC,yBAAyB,CAAEF,GAAF,CAAS,IAAIC,IAAM,MADpD;;AAGA,MAAMC,yBAAyB,GAAKF,GAAF,IAChC,SAASA,GAAK,6CADhB;;AAGA,MAAMG,mBAAmB,GAAG,CAAEC,OAAF,EAAWC,cAAX,KAA+B;AAC1D,MAAIC,WAAW,GAAGF,OAAO,CAACG,IAAR,EAAlB,CAD0D,CAE1D;;AACA,MAAKH,OAAO,KAAK,KAAjB,EAAyB;AACxBE,IAAAA,WAAW,GAAGF,OAAO,CAACI,WAAR,GAAsBC,OAAtB,CAA+B,UAA/B,EAA2C,UAA3C,CAAd;AACA,GALyD,CAM1D;AACA;AACA;;;AACA,MAAKJ,cAAL,EAAsB;AACrBC,IAAAA,WAAW,IAAK,IAAID,cAAgB,EAApC;AACA,GAXyD,CAY1D;;;AACA,MAAK,CAAE,CAAE,KAAF,EAAS,KAAT,EAAiBK,QAAjB,CAA2BN,OAA3B,CA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K,EAPkB;AAQnCA,QAAAA,EAAE,EAAEC,SAR+B;AASnCpC,QAAAA,OAAO,EAAE9B,mBAAmB,CAAE4D,MAAF,CATO;AAUnClC,QAAAA,UAAU,EAAEkC,MAAM,CAACO;AAVgB,OAAhB;AAAA,KAAb,CAAP;AAYA,GA5CF;;AA6CCC,EAAAA,YAAY,EAAE;AAAA,QAAE;AAAEJ,MAAAA;AAAF,KAAF;AAAA,WACZ,yCAAyCA,QAAU,UADvC;AAAA,GA7Cf;AA+CCK,EAAAA,kBAAkB,EAAE;AA/CrB,CAlC+B,CAAhC;eAqFerC,uB","sourcesContent":["/**\n * The `edit-site` settings here need to be in sync with the corresponding ones in `site-editor` package.\n * See `packages/edit-site/src/components/block-editor/inserter-media-categories.js`.\n *\n * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`.\n * The rest of the settings would still need to be in sync though.\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\n\n/** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */\n/** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */\n/**\n * Interface for inserter media category labels.\n *\n * @typedef {Object} InserterMediaCategoryLabels\n * @property {string} name General name of the media category. It's used in the inserter media items list.\n * @property {string} [search_items='Search'] Label for searching items. Default is ‘Search Posts’ / ‘Search Pages’.\n */\n/**\n * Interface for inserter media category.\n *\n * @typedef {Object} InserterMediaCategory\n * @property {string} name The name of the media category, that should be unique among all media categories.\n * @property {InserterMediaCategoryLabels} labels Labels for the media category.\n * @property {('image'|'audio'|'video')} mediaType The media type of the media category.\n * @property {(InserterMediaRequest) => Promise<InserterMediaItem[]>} fetch The function to fetch media items for the category.\n * @property {(InserterMediaItem) => string} [getReportUrl] If the media category supports reporting media items, this function should return\n * the report url for the media item. It accepts the `InserterMediaItem` as an argument.\n * @property {boolean} [isExternalResource] If the media category is an external resource, this should be set to true.\n * This is used to avoid making a request to the external resource when the user\n * opens the inserter for the first time.\n */\n\nconst getExternalLink = ( url, text ) =>\n\t`<a ${ getExternalLinkAttributes( url ) }>${ text }</a>`;\n\nconst getExternalLinkAttributes = ( url ) =>\n\t`href=\"${ url }\" target=\"_blank\" rel=\"noreferrer noopener\"`;\n\nconst getOpenverseLicense = ( license, licenseVersion ) => {\n\tlet licenseName = license.trim();\n\t// PDM has no abbreviation\n\tif ( license !== 'pdm' ) {\n\t\tlicenseName = license.toUpperCase().replace( 'SAMPLING', 'Sampling' );\n\t}\n\t// If version is known, append version to the name.\n\t// The license has to have a version to be valid. Only\n\t// PDM (public domain mark) doesn't have a version.\n\tif ( licenseVersion ) {\n\t\tlicenseName += ` ${ licenseVersion }`;\n\t}\n\t// For licenses other than public-domain marks, prepend 'CC' to the name.\n\tif ( ! [ 'pdm', 'cc0' ].includes( license ) ) {\n\t\tlicenseName = `CC ${ licenseName }`;\n\t}\n\treturn licenseName;\n};\n\nconst getOpenverseCaption = ( item ) => {\n\tconst {\n\t\ttitle,\n\t\tforeign_landing_url: foreignLandingUrl,\n\t\tcreator,\n\t\tcreator_url: creatorUrl,\n\t\tlicense,\n\t\tlicense_version: licenseVersion,\n\t\tlicense_url: licenseUrl,\n\t} = item;\n\tconst fullLicense = getOpenverseLicense( license, licenseVersion );\n\tconst _creator = decodeEntities( creator );\n\tlet _caption;\n\tif ( _creator ) {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\" by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a> by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t} else {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\"/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a>/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t}\n\treturn _caption.replace( /\\s{2}/g, ' ' );\n};\n\nconst coreMediaFetch = async ( query = {} ) => {\n\tconst mediaItems = await resolveSelect( coreStore ).getMediaItems( {\n\t\t...query,\n\t\torderBy: !! query?.search ? 'relevance' : 'date',\n\t} );\n\treturn mediaItems.map( ( mediaItem ) => ( {\n\t\t...mediaItem,\n\t\talt: mediaItem.alt_text,\n\t\turl: mediaItem.source_url,\n\t\tpreviewUrl: mediaItem.media_details?.sizes?.medium?.source_url,\n\t\tcaption: mediaItem.caption?.raw,\n\t} ) );\n};\n\n/** @type {InserterMediaCategory[]} */\nconst inserterMediaCategories = [\n\t{\n\t\tname: 'images',\n\t\tlabels: {\n\t\t\tname: __( 'Images' ),\n\t\t\tsearch_items: __( 'Search images' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'image' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'videos',\n\t\tlabels: {\n\t\t\tname: __( 'Videos' ),\n\t\t\tsearch_items: __( 'Search videos' ),\n\t\t},\n\t\tmediaType: 'video',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'video' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'audio',\n\t\tlabels: {\n\t\t\tname: __( 'Audio' ),\n\t\t\tsearch_items: __( 'Search audio' ),\n\t\t},\n\t\tmediaType: 'audio',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'audio' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'openverse',\n\t\tlabels: {\n\t\t\tname: __( 'Openverse' ),\n\t\t\tsearch_items: __( 'Search Openverse' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\tconst defaultArgs = {\n\t\t\t\tmature: false,\n\t\t\t\texcluded_source: 'flickr,inaturalist,wikimedia',\n\t\t\t\tlicense: 'pdm,cc0',\n\t\t\t};\n\t\t\tconst finalQuery = { ...query, ...defaultArgs };\n\t\t\tconst mapFromInserterMediaRequest = {\n\t\t\t\tper_page: 'page_size',\n\t\t\t\tsearch: 'q',\n\t\t\t};\n\t\t\tconst url = new URL(\n\t\t\t\t'https://api.openverse.engineering/v1/images/'\n\t\t\t);\n\t\t\tObject.entries( finalQuery ).forEach( ( [ key, value ] ) => {\n\t\t\t\tconst queryKey = mapFromInserterMediaRequest[ key ] || key;\n\t\t\t\turl.searchParams.set( queryKey, value );\n\t\t\t} );\n\t\t\tconst response = await window.fetch( url, {\n\t\t\t\theaders: {\n\t\t\t\t\t'User-Agent': 'WordPress/inserter-media-fetch',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst jsonResponse = await response.json();\n\t\t\tconst results = jsonResponse.results;\n\t\t\treturn results.map( ( result ) => ( {\n\t\t\t\t...result,\n\t\t\t\t// This is a temp solution for better titles, until Openverse API\n\t\t\t\t// completes the cleaning up of some titles of their upstream data.\n\t\t\t\ttitle: result.title?.toLowerCase().startsWith( 'file:' )\n\t\t\t\t\t? result.title.slice( 5 )\n\t\t\t\t\t: result.title,\n\t\t\t\tsourceId: result.id,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: getOpenverseCaption( result ),\n\t\t\t\tpreviewUrl: result.thumbnail,\n\t\t\t} ) );\n\t\t},\n\t\tgetReportUrl: ( { sourceId } ) =>\n\t\t\t`https://wordpress.org/openverse/image/${ sourceId }/report/`,\n\t\tisExternalResource: true,\n\t},\n];\n\nexport default inserterMediaCategories;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/inserter-media-categories.js"],"names":["getExternalLink","url","text","getExternalLinkAttributes","getOpenverseLicense","license","licenseVersion","licenseName","trim","toUpperCase","replace","includes","getOpenverseCaption","item","title","foreign_landing_url","foreignLandingUrl","creator","creator_url","creatorUrl","license_version","license_url","licenseUrl","fullLicense","_creator","_caption","coreMediaFetch","query","mediaItems","coreStore","getMediaItems","orderBy","search","map","mediaItem","alt","alt_text","source_url","previewUrl","media_details","sizes","medium","caption","raw","inserterMediaCategories","name","labels","search_items","mediaType","fetch","media_type","defaultArgs","mature","excluded_source","finalQuery","mapFromInserterMediaRequest","per_page","URL","Object","entries","forEach","key","value","queryKey","searchParams","set","response","window","headers","jsonResponse","json","results","result","toLowerCase","startsWith","slice","sourceId","id","undefined","thumbnail","getReportUrl","isExternalResource"],"mappings":";;;;;;;AAWA;;AACA;;AACA;;AAKA;;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,eAAe,GAAG,CAAEC,GAAF,EAAOC,IAAP,KACtB,MAAMC,yBAAyB,CAAEF,GAAF,CAAS,IAAIC,IAAM,MADpD;;AAGA,MAAMC,yBAAyB,GAAKF,GAAF,IAChC,SAASA,GAAK,6CADhB;;AAGA,MAAMG,mBAAmB,GAAG,CAAEC,OAAF,EAAWC,cAAX,KAA+B;AAC1D,MAAIC,WAAW,GAAGF,OAAO,CAACG,IAAR,EAAlB,CAD0D,CAE1D;;AACA,MAAKH,OAAO,KAAK,KAAjB,EAAyB;AACxBE,IAAAA,WAAW,GAAGF,OAAO,CAACI,WAAR,GAAsBC,OAAtB,CAA+B,UAA/B,EAA2C,UAA3C,CAAd;AACA,GALyD,CAM1D;AACA;AACA;;;AACA,MAAKJ,cAAL,EAAsB;AACr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EAAE,EAAEC,SAR+B;AASnCpC,MAAAA,OAAO,EAAE9B,mBAAmB,CAAE4D,MAAF,CATO;AAUnClC,MAAAA,UAAU,EAAEkC,MAAM,CAACO;AAVgB,KAAhB,CAAb,CAAP;AAYA,GA5CF;;AA6CCC,EAAAA,YAAY,EAAE,CAAE;AAAEJ,IAAAA;AAAF,GAAF,KACZ,yCAAyCA,QAAU,UA9CtD;AA+CCK,EAAAA,kBAAkB,EAAE;AA/CrB,CAlC+B,CAAhC;eAqFerC,uB","sourcesContent":["/**\n * The `edit-site` settings here need to be in sync with the corresponding ones in `site-editor` package.\n * See `packages/edit-site/src/components/block-editor/inserter-media-categories.js`.\n *\n * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`.\n * The rest of the settings would still need to be in sync though.\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\n\n/** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */\n/** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */\n/**\n * Interface for inserter media category labels.\n *\n * @typedef {Object} InserterMediaCategoryLabels\n * @property {string} name General name of the media category. It's used in the inserter media items list.\n * @property {string} [search_items='Search'] Label for searching items. Default is ‘Search Posts’ / ‘Search Pages’.\n */\n/**\n * Interface for inserter media category.\n *\n * @typedef {Object} InserterMediaCategory\n * @property {string} name The name of the media category, that should be unique among all media categories.\n * @property {InserterMediaCategoryLabels} labels Labels for the media category.\n * @property {('image'|'audio'|'video')} mediaType The media type of the media category.\n * @property {(InserterMediaRequest) => Promise<InserterMediaItem[]>} fetch The function to fetch media items for the category.\n * @property {(InserterMediaItem) => string} [getReportUrl] If the media category supports reporting media items, this function should return\n * the report url for the media item. It accepts the `InserterMediaItem` as an argument.\n * @property {boolean} [isExternalResource] If the media category is an external resource, this should be set to true.\n * This is used to avoid making a request to the external resource when the user\n * opens the inserter for the first time.\n */\n\nconst getExternalLink = ( url, text ) =>\n\t`<a ${ getExternalLinkAttributes( url ) }>${ text }</a>`;\n\nconst getExternalLinkAttributes = ( url ) =>\n\t`href=\"${ url }\" target=\"_blank\" rel=\"noreferrer noopener\"`;\n\nconst getOpenverseLicense = ( license, licenseVersion ) => {\n\tlet licenseName = license.trim();\n\t// PDM has no abbreviation\n\tif ( license !== 'pdm' ) {\n\t\tlicenseName = license.toUpperCase().replace( 'SAMPLING', 'Sampling' );\n\t}\n\t// If version is known, append version to the name.\n\t// The license has to have a version to be valid. Only\n\t// PDM (public domain mark) doesn't have a version.\n\tif ( licenseVersion ) {\n\t\tlicenseName += ` ${ licenseVersion }`;\n\t}\n\t// For licenses other than public-domain marks, prepend 'CC' to the name.\n\tif ( ! [ 'pdm', 'cc0' ].includes( license ) ) {\n\t\tlicenseName = `CC ${ licenseName }`;\n\t}\n\treturn licenseName;\n};\n\nconst getOpenverseCaption = ( item ) => {\n\tconst {\n\t\ttitle,\n\t\tforeign_landing_url: foreignLandingUrl,\n\t\tcreator,\n\t\tcreator_url: creatorUrl,\n\t\tlicense,\n\t\tlicense_version: licenseVersion,\n\t\tlicense_url: licenseUrl,\n\t} = item;\n\tconst fullLicense = getOpenverseLicense( license, licenseVersion );\n\tconst _creator = decodeEntities( creator );\n\tlet _caption;\n\tif ( _creator ) {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\" by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a> by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t} else {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\"/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a>/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t}\n\treturn _caption.replace( /\\s{2}/g, ' ' );\n};\n\nconst coreMediaFetch = async ( query = {} ) => {\n\tconst mediaItems = await resolveSelect( coreStore ).getMediaItems( {\n\t\t...query,\n\t\torderBy: !! query?.search ? 'relevance' : 'date',\n\t} );\n\treturn mediaItems.map( ( mediaItem ) => ( {\n\t\t...mediaItem,\n\t\talt: mediaItem.alt_text,\n\t\turl: mediaItem.source_url,\n\t\tpreviewUrl: mediaItem.media_details?.sizes?.medium?.source_url,\n\t\tcaption: mediaItem.caption?.raw,\n\t} ) );\n};\n\n/** @type {InserterMediaCategory[]} */\nconst inserterMediaCategories = [\n\t{\n\t\tname: 'images',\n\t\tlabels: {\n\t\t\tname: __( 'Images' ),\n\t\t\tsearch_items: __( 'Search images' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'image' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'videos',\n\t\tlabels: {\n\t\t\tname: __( 'Videos' ),\n\t\t\tsearch_items: __( 'Search videos' ),\n\t\t},\n\t\tmediaType: 'video',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'video' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'audio',\n\t\tlabels: {\n\t\t\tname: __( 'Audio' ),\n\t\t\tsearch_items: __( 'Search audio' ),\n\t\t},\n\t\tmediaType: 'audio',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'audio' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'openverse',\n\t\tlabels: {\n\t\t\tname: __( 'Openverse' ),\n\t\t\tsearch_items: __( 'Search Openverse' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\tconst defaultArgs = {\n\t\t\t\tmature: false,\n\t\t\t\texcluded_source: 'flickr,inaturalist,wikimedia',\n\t\t\t\tlicense: 'pdm,cc0',\n\t\t\t};\n\t\t\tconst finalQuery = { ...query, ...defaultArgs };\n\t\t\tconst mapFromInserterMediaRequest = {\n\t\t\t\tper_page: 'page_size',\n\t\t\t\tsearch: 'q',\n\t\t\t};\n\t\t\tconst url = new URL(\n\t\t\t\t'https://api.openverse.engineering/v1/images/'\n\t\t\t);\n\t\t\tObject.entries( finalQuery ).forEach( ( [ key, value ] ) => {\n\t\t\t\tconst queryKey = mapFromInserterMediaRequest[ key ] || key;\n\t\t\t\turl.searchParams.set( queryKey, value );\n\t\t\t} );\n\t\t\tconst response = await window.fetch( url, {\n\t\t\t\theaders: {\n\t\t\t\t\t'User-Agent': 'WordPress/inserter-media-fetch',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst jsonResponse = await response.json();\n\t\t\tconst results = jsonResponse.results;\n\t\t\treturn results.map( ( result ) => ( {\n\t\t\t\t...result,\n\t\t\t\t// This is a temp solution for better titles, until Openverse API\n\t\t\t\t// completes the cleaning up of some titles of their upstream data.\n\t\t\t\ttitle: result.title?.toLowerCase().startsWith( 'file:' )\n\t\t\t\t\t? result.title.slice( 5 )\n\t\t\t\t\t: result.title,\n\t\t\t\tsourceId: result.id,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: getOpenverseCaption( result ),\n\t\t\t\tpreviewUrl: result.thumbnail,\n\t\t\t} ) );\n\t\t},\n\t\tgetReportUrl: ( { sourceId } ) =>\n\t\t\t`https://wordpress.org/openverse/image/${ sourceId }/report/`,\n\t\tisExternalResource: true,\n\t},\n];\n\nexport default inserterMediaCategories;\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = DefaultBlockEditorProvider;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _coreData = require("@wordpress/core-data");
|
|
13
|
+
|
|
14
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
15
|
+
|
|
16
|
+
var _data = require("@wordpress/data");
|
|
17
|
+
|
|
18
|
+
var _store = require("../../../store");
|
|
19
|
+
|
|
20
|
+
var _lockUnlock = require("../../../lock-unlock");
|
|
21
|
+
|
|
22
|
+
var _useSiteEditorSettings = _interopRequireDefault(require("../use-site-editor-settings"));
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* WordPress dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal dependencies
|
|
30
|
+
*/
|
|
31
|
+
const {
|
|
32
|
+
ExperimentalBlockEditorProvider
|
|
33
|
+
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
34
|
+
|
|
35
|
+
function DefaultBlockEditorProvider({
|
|
36
|
+
children
|
|
37
|
+
}) {
|
|
38
|
+
const settings = (0, _useSiteEditorSettings.default)();
|
|
39
|
+
const {
|
|
40
|
+
templateType
|
|
41
|
+
} = (0, _data.useSelect)(select => {
|
|
42
|
+
const {
|
|
43
|
+
getEditedPostType
|
|
44
|
+
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
45
|
+
return {
|
|
46
|
+
templateType: getEditedPostType()
|
|
47
|
+
};
|
|
48
|
+
}, []);
|
|
49
|
+
const [blocks, onInput, onChange] = (0, _coreData.useEntityBlockEditor)('postType', templateType);
|
|
50
|
+
return (0, _element.createElement)(ExperimentalBlockEditorProvider, {
|
|
51
|
+
settings: settings,
|
|
52
|
+
value: blocks,
|
|
53
|
+
onInput: onInput,
|
|
54
|
+
onChange: onChange,
|
|
55
|
+
useSubRegistry: false
|
|
56
|
+
}, children);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=default-block-editor-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/providers/default-block-editor-provider.js"],"names":["ExperimentalBlockEditorProvider","blockEditorPrivateApis","DefaultBlockEditorProvider","children","settings","templateType","select","getEditedPostType","editSiteStore","blocks","onInput","onChange"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAZA;AACA;AACA;;AAKA;AACA;AACA;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAsC,wBAAQC,wBAAR,CAA5C;;AAEe,SAASC,0BAAT,CAAqC;AAAEC,EAAAA;AAAF,CAArC,EAAoD;AAClE,QAAMC,QAAQ,GAAG,qCAAjB;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAmB,qBAAaC,MAAF,IAAc;AACjD,UAAM;AAAEC,MAAAA;AAAF,QAAwB,wBAAQD,MAAM,CAAEE,YAAF,CAAd,CAA9B;AAEA,WAAO;AACNH,MAAAA,YAAY,EAAEE,iBAAiB;AADzB,KAAP;AAGA,GANwB,EAMtB,EANsB,CAAzB;AAQA,QAAM,CAAEE,MAAF,EAAUC,OAAV,EAAmBC,QAAnB,IAAgC,oCACrC,UADqC,EAErCN,YAFqC,CAAtC;AAKA,SACC,4BAAC,+BAAD;AACC,IAAA,QAAQ,EAAGD,QADZ;AAEC,IAAA,KAAK,EAAGK,MAFT;AAGC,IAAA,OAAO,EAAGC,OAHX;AAIC,IAAA,QAAQ,EAAGC,QAJZ;AAKC,IAAA,cAAc,EAAG;AALlB,KAOGR,QAPH,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\nimport useSiteEditorSettings from '../use-site-editor-settings';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nexport default function DefaultBlockEditorProvider( { children } ) {\n\tconst settings = useSiteEditorSettings();\n\n\tconst { templateType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\ttemplateType: getEditedPostType(),\n\t\t};\n\t}, [] );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t{ children }\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = NavigationBlockEditorProvider;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _data = require("@wordpress/data");
|
|
13
|
+
|
|
14
|
+
var _coreData = require("@wordpress/core-data");
|
|
15
|
+
|
|
16
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
17
|
+
|
|
18
|
+
var _blocks = require("@wordpress/blocks");
|
|
19
|
+
|
|
20
|
+
var _lockUnlock = require("../../../lock-unlock");
|
|
21
|
+
|
|
22
|
+
var _useSiteEditorSettings = _interopRequireDefault(require("../use-site-editor-settings"));
|
|
23
|
+
|
|
24
|
+
var _store = require("../../../store");
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* WordPress dependencies
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Internal dependencies
|
|
32
|
+
*/
|
|
33
|
+
const {
|
|
34
|
+
ExperimentalBlockEditorProvider
|
|
35
|
+
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
36
|
+
|
|
37
|
+
const noop = () => {};
|
|
38
|
+
/**
|
|
39
|
+
* Block editor component for editing navigation menus.
|
|
40
|
+
*
|
|
41
|
+
* Note: Navigation entities require a wrapping Navigation block to provide
|
|
42
|
+
* them with some basic layout and styling. Therefore we create a "ghost" block
|
|
43
|
+
* and provide it will a reference to the navigation entity ID being edited.
|
|
44
|
+
*
|
|
45
|
+
* In this scenario it is the **block** that handles syncing the entity content
|
|
46
|
+
* whereas for other entities this is handled by entity block editor.
|
|
47
|
+
*
|
|
48
|
+
* @param {number} navigationMenuId the navigation menu ID
|
|
49
|
+
* @return {[WPBlock[], Function, Function]} The block array and setters.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
function NavigationBlockEditorProvider({
|
|
54
|
+
children
|
|
55
|
+
}) {
|
|
56
|
+
const defaultSettings = (0, _useSiteEditorSettings.default)();
|
|
57
|
+
const navigationMenuId = (0, _coreData.useEntityId)('postType', 'wp_navigation');
|
|
58
|
+
const blocks = (0, _element.useMemo)(() => {
|
|
59
|
+
return [(0, _blocks.createBlock)('core/navigation', {
|
|
60
|
+
ref: navigationMenuId,
|
|
61
|
+
// As the parent editor is locked with `templateLock`, the template locking
|
|
62
|
+
// must be explicitly "unset" on the block itself to allow the user to modify
|
|
63
|
+
// the block's content.
|
|
64
|
+
templateLock: false
|
|
65
|
+
})];
|
|
66
|
+
}, [navigationMenuId]);
|
|
67
|
+
const {
|
|
68
|
+
isEditMode
|
|
69
|
+
} = (0, _data.useSelect)(select => {
|
|
70
|
+
const {
|
|
71
|
+
getCanvasMode
|
|
72
|
+
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
73
|
+
return {
|
|
74
|
+
isEditMode: getCanvasMode() === 'edit'
|
|
75
|
+
};
|
|
76
|
+
}, []);
|
|
77
|
+
const {
|
|
78
|
+
selectBlock,
|
|
79
|
+
setBlockEditingMode,
|
|
80
|
+
unsetBlockEditingMode
|
|
81
|
+
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_blockEditor.store));
|
|
82
|
+
const navigationBlockClientId = blocks && blocks[0]?.clientId;
|
|
83
|
+
const settings = (0, _element.useMemo)(() => {
|
|
84
|
+
return { ...defaultSettings,
|
|
85
|
+
// Lock the editor to allow the root ("ghost") Navigation block only.
|
|
86
|
+
templateLock: 'insert',
|
|
87
|
+
template: [['core/navigation', {}, []]]
|
|
88
|
+
};
|
|
89
|
+
}, [defaultSettings]); // Auto-select the Navigation block when entering Navigation focus mode.
|
|
90
|
+
|
|
91
|
+
(0, _element.useEffect)(() => {
|
|
92
|
+
if (navigationBlockClientId && isEditMode) {
|
|
93
|
+
selectBlock(navigationBlockClientId);
|
|
94
|
+
}
|
|
95
|
+
}, [navigationBlockClientId, isEditMode, selectBlock]); // Set block editing mode to contentOnly when entering Navigation focus mode.
|
|
96
|
+
// This ensures that non-content controls on the block will be hidden and thus
|
|
97
|
+
// the user can focus on editing the Navigation Menu content only.
|
|
98
|
+
|
|
99
|
+
(0, _element.useEffect)(() => {
|
|
100
|
+
if (!navigationBlockClientId) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
setBlockEditingMode(navigationBlockClientId, 'contentOnly');
|
|
105
|
+
return () => {
|
|
106
|
+
unsetBlockEditingMode(navigationBlockClientId);
|
|
107
|
+
};
|
|
108
|
+
}, [navigationBlockClientId, unsetBlockEditingMode, setBlockEditingMode]);
|
|
109
|
+
return (0, _element.createElement)(ExperimentalBlockEditorProvider, {
|
|
110
|
+
settings: settings,
|
|
111
|
+
value: blocks,
|
|
112
|
+
onInput: noop,
|
|
113
|
+
onChange: noop,
|
|
114
|
+
useSubRegistry: false
|
|
115
|
+
}, children);
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=navigation-block-editor-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/providers/navigation-block-editor-provider.js"],"names":["ExperimentalBlockEditorProvider","blockEditorPrivateApis","noop","NavigationBlockEditorProvider","children","defaultSettings","navigationMenuId","blocks","ref","templateLock","isEditMode","select","getCanvasMode","editSiteStore","selectBlock","setBlockEditingMode","unsetBlockEditingMode","blockEditorStore","navigationBlockClientId","clientId","settings","template"],"mappings":";;;;;;;;;AAIA;;AADA;;AAEA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAUA;AACA;AACA;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAsC,wBAAQC,wBAAR,CAA5C;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACe,SAASC,6BAAT,CAAwC;AAAEC,EAAAA;AAAF,CAAxC,EAAuD;AACrE,QAAMC,eAAe,GAAG,qCAAxB;AAEA,QAAMC,gBAAgB,GAAG,2BAAa,UAAb,EAAyB,eAAzB,CAAzB;AAEA,QAAMC,MAAM,GAAG,sBAAS,MAAM;AAC7B,WAAO,CACN,yBAAa,iBAAb,EAAgC;AAC/BC,MAAAA,GAAG,EAAEF,gBAD0B;AAE/B;AACA;AACA;AACAG,MAAAA,YAAY,EAAE;AALiB,KAAhC,CADM,CAAP;AASA,GAVc,EAUZ,CAAEH,gBAAF,CAVY,CAAf;AAYA,QAAM;AAAEI,IAAAA;AAAF,MAAiB,qBAAaC,MAAF,IAAc;AAC/C,UAAM;AAAEC,MAAAA;AAAF,QAAoB,wBAAQD,MAAM,CAAEE,YAAF,CAAd,CAA1B;AAEA,WAAO;AACNH,MAAAA,UAAU,E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{ useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { useEntityId } from '@wordpress/core-data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\nimport useSiteEditorSettings from '../use-site-editor-settings';\nimport { store as editSiteStore } from '../../../store';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nconst noop = () => {};\n\n/**\n * Block editor component for editing navigation menus.\n *\n * Note: Navigation entities require a wrapping Navigation block to provide\n * them with some basic layout and styling. Therefore we create a \"ghost\" block\n * and provide it will a reference to the navigation entity ID being edited.\n *\n * In this scenario it is the **block** that handles syncing the entity content\n * whereas for other entities this is handled by entity block editor.\n *\n * @param {number} navigationMenuId the navigation menu ID\n * @return {[WPBlock[], Function, Function]} The block array and setters.\n */\nexport default function NavigationBlockEditorProvider( { children } ) {\n\tconst defaultSettings = useSiteEditorSettings();\n\n\tconst navigationMenuId = useEntityId( 'postType', 'wp_navigation' );\n\n\tconst blocks = useMemo( () => {\n\t\treturn [\n\t\t\tcreateBlock( 'core/navigation', {\n\t\t\t\tref: navigationMenuId,\n\t\t\t\t// As the parent editor is locked with `templateLock`, the template locking\n\t\t\t\t// must be explicitly \"unset\" on the block itself to allow the user to modify\n\t\t\t\t// the block's content.\n\t\t\t\ttemplateLock: false,\n\t\t\t} ),\n\t\t];\n\t}, [ navigationMenuId ] );\n\n\tconst { isEditMode } = useSelect( ( select ) => {\n\t\tconst { getCanvasMode } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tisEditMode: getCanvasMode() === 'edit',\n\t\t};\n\t}, [] );\n\n\tconst { selectBlock, setBlockEditingMode, unsetBlockEditingMode } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst navigationBlockClientId = blocks && blocks[ 0 ]?.clientId;\n\n\tconst settings = useMemo( () => {\n\t\treturn {\n\t\t\t...defaultSettings,\n\t\t\t// Lock the editor to allow the root (\"ghost\") Navigation block only.\n\t\t\ttemplateLock: 'insert',\n\t\t\ttemplate: [ [ 'core/navigation', {}, [] ] ],\n\t\t};\n\t}, [ defaultSettings ] );\n\n\t// Auto-select the Navigation block when entering Navigation focus mode.\n\tuseEffect( () => {\n\t\tif ( navigationBlockClientId && isEditMode ) {\n\t\t\tselectBlock( navigationBlockClientId );\n\t\t}\n\t}, [ navigationBlockClientId, isEditMode, selectBlock ] );\n\n\t// Set block editing mode to contentOnly when entering Navigation focus mode.\n\t// This ensures that non-content controls on the block will be hidden and thus\n\t// the user can focus on editing the Navigation Menu content only.\n\tuseEffect( () => {\n\t\tif ( ! navigationBlockClientId ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetBlockEditingMode( navigationBlockClientId, 'contentOnly' );\n\n\t\treturn () => {\n\t\t\tunsetBlockEditingMode( navigationBlockClientId );\n\t\t};\n\t}, [\n\t\tnavigationBlockClientId,\n\t\tunsetBlockEditingMode,\n\t\tsetBlockEditingMode,\n\t] );\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ noop }\n\t\t\tonChange={ noop }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t{ children }\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"]}
|
|
@@ -33,12 +33,11 @@ const HANDLE_STYLES_OVERRIDE = {
|
|
|
33
33
|
left: undefined
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
function ResizableEditor(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} = _ref;
|
|
36
|
+
function ResizableEditor({
|
|
37
|
+
enableResizing,
|
|
38
|
+
height,
|
|
39
|
+
children
|
|
40
|
+
}) {
|
|
42
41
|
const [width, setWidth] = (0, _element.useState)('100%');
|
|
43
42
|
const resizableRef = (0, _element.useRef)();
|
|
44
43
|
const resizeWidthBy = (0, _element.useCallback)(deltaPixels => {
|
|
@@ -48,7 +47,7 @@ function ResizableEditor(_ref) {
|
|
|
48
47
|
}, []);
|
|
49
48
|
return (0, _element.createElement)(_components.ResizableBox, {
|
|
50
49
|
ref: api => {
|
|
51
|
-
resizableRef.current = api
|
|
50
|
+
resizableRef.current = api?.resizable;
|
|
52
51
|
},
|
|
53
52
|
size: {
|
|
54
53
|
width: enableResizing ? width : '100%',
|