@wordpress/edit-post 7.15.0 → 7.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +6 -1
- package/build/components/block-manager/category.js +1 -14
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/checklist.js +1 -5
- package/build/components/block-manager/checklist.js.map +1 -1
- package/build/components/block-manager/index.js +11 -23
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +3 -11
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build/components/browser-url/index.js +6 -23
- package/build/components/browser-url/index.js.map +1 -1
- package/build/components/device-preview/index.js +1 -11
- package/build/components/device-preview/index.js.map +1 -1
- package/build/components/editor-initialization/index.js +0 -2
- package/build/components/editor-initialization/index.js.map +1 -1
- package/build/components/editor-initialization/listener-hooks.js +1 -12
- package/build/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build/components/header/{document-title → document-actions}/index.js +11 -28
- package/build/components/header/document-actions/index.js.map +1 -0
- package/build/components/header/fullscreen-mode-close/index.js +3 -22
- package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.js +5 -22
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js +4 -25
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +6 -23
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/index.native.js +1 -13
- package/build/components/header/index.native.js.map +1 -1
- package/build/components/header/main-dashboard-button/index.js +1 -7
- package/build/components/header/main-dashboard-button/index.js.map +1 -1
- package/build/components/header/mode-switcher/index.js +23 -19
- package/build/components/header/mode-switcher/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +1 -12
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/plugin-more-menu-item/index.js +0 -8
- package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
- package/build/components/header/plugin-sidebar-more-menu-item/index.js +3 -4
- package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -1
- package/build/components/header/post-publish-button-or-toggle.js +2 -11
- package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/header/preferences-menu-item/index.js +1 -7
- package/build/components/header/preferences-menu-item/index.js.map +1 -1
- package/build/components/header/tools-more-menu-group/index.js +1 -6
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +1 -15
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -9
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +4 -25
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +4 -23
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/actions-panel.js +7 -17
- package/build/components/layout/actions-panel.js.map +1 -1
- package/build/components/layout/index.js +50 -52
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js +5 -34
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/meta-boxes/index.js +4 -12
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/meta-boxes/meta-box-visibility.js +1 -12
- package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js +0 -10
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -18
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js +3 -13
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/preferences-modal/options/enable-custom-fields.js +10 -11
- package/build/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
- package/build/components/preferences-modal/options/enable-feature.js +0 -7
- package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/options/enable-panel.js +0 -7
- package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
- package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js +1 -6
- package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
- package/build/components/preferences-modal/options/enable-publish-sidebar.js +2 -8
- package/build/components/preferences-modal/options/enable-publish-sidebar.js.map +1 -1
- package/build/components/preferences-modal/options/index.js +0 -6
- package/build/components/preferences-modal/options/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +1 -9
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-outline.js +1 -8
- package/build/components/secondary-sidebar/list-view-outline.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +34 -46
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/discussion-panel/index.js +19 -30
- package/build/components/sidebar/discussion-panel/index.js.map +1 -1
- package/build/components/sidebar/featured-image/index.js +0 -15
- package/build/components/sidebar/featured-image/index.js.map +1 -1
- package/build/components/sidebar/last-revision/index.js +1 -5
- package/build/components/sidebar/last-revision/index.js.map +1 -1
- package/build/components/sidebar/page-attributes/index.js +0 -14
- package/build/components/sidebar/page-attributes/index.js.map +1 -1
- package/build/components/sidebar/plugin-document-setting-panel/index.js +44 -61
- package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-post-publish-panel/index.js +19 -25
- package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-post-status-info/index.js +2 -5
- package/build/components/sidebar/plugin-post-status-info/index.js.map +1 -1
- package/build/components/sidebar/plugin-pre-publish-panel/index.js +19 -25
- package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +0 -8
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar/post-author/index.js +1 -5
- package/build/components/sidebar/post-author/index.js.map +1 -1
- package/build/components/sidebar/post-excerpt/index.js +0 -13
- package/build/components/sidebar/post-excerpt/index.js.map +1 -1
- package/build/components/sidebar/post-format/index.js +1 -5
- package/build/components/sidebar/post-format/index.js.map +1 -1
- package/build/components/sidebar/post-pending-status/index.js +1 -5
- package/build/components/sidebar/post-pending-status/index.js.map +1 -1
- package/build/components/sidebar/post-schedule/index.js +5 -9
- package/build/components/sidebar/post-schedule/index.js.map +1 -1
- package/build/components/sidebar/post-slug/index.js +1 -5
- package/build/components/sidebar/post-slug/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +0 -24
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/post-sticky/index.js +1 -5
- package/build/components/sidebar/post-sticky/index.js.map +1 -1
- package/build/components/sidebar/post-taxonomies/index.js +1 -6
- package/build/components/sidebar/post-taxonomies/index.js.map +1 -1
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +1 -11
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
- package/build/components/sidebar/post-template/create-modal.js +1 -16
- package/build/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build/components/sidebar/post-template/form.js +3 -16
- package/build/components/sidebar/post-template/form.js.map +1 -1
- package/build/components/sidebar/post-template/index.js +5 -24
- package/build/components/sidebar/post-template/index.js.map +1 -1
- package/build/components/sidebar/post-trash/index.js +1 -3
- package/build/components/sidebar/post-trash/index.js.map +1 -1
- package/build/components/sidebar/post-url/index.js +5 -9
- package/build/components/sidebar/post-url/index.js.map +1 -1
- package/build/components/sidebar/post-visibility/index.js +5 -10
- package/build/components/sidebar/post-visibility/index.js.map +1 -1
- package/build/components/sidebar/settings-header/index.js +12 -17
- package/build/components/sidebar/settings-header/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +2 -29
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/components/sidebar/template-summary/index.js +1 -9
- package/build/components/sidebar/template-summary/index.js.map +1 -1
- package/build/components/start-page-options/index.js +1 -15
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/text-editor/index.js +1 -8
- package/build/components/text-editor/index.js.map +1 -1
- package/build/components/view-link/index.js +3 -10
- package/build/components/view-link/index.js.map +1 -1
- package/build/components/visual-editor/block-inspector-button.js +1 -11
- package/build/components/visual-editor/block-inspector-button.js.map +1 -1
- package/build/components/visual-editor/header.native.js +1 -12
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/components/visual-editor/index.js +33 -53
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/visual-editor/index.native.js +1 -9
- package/build/components/visual-editor/index.native.js.map +1 -1
- package/build/components/welcome-guide/default.js +1 -8
- package/build/components/welcome-guide/default.js.map +1 -1
- package/build/components/welcome-guide/image.js +0 -2
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/components/welcome-guide/index.js +1 -11
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/template.js +1 -8
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/editor.js +9 -68
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +10 -35
- package/build/editor.native.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +65 -22
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/components/index.js +1 -3
- package/build/hooks/components/index.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/validate-multiple-use/index.js +10 -18
- package/build/hooks/validate-multiple-use/index.js.map +1 -1
- package/build/index.js +16 -48
- package/build/index.js.map +1 -1
- package/build/index.native.js +0 -9
- package/build/index.native.js.map +1 -1
- package/build/lock-unlock.js +1 -2
- package/build/lock-unlock.js.map +1 -1
- package/build/plugins/copy-content-menu-item/index.js +1 -10
- package/build/plugins/copy-content-menu-item/index.js.map +1 -1
- package/build/plugins/index.js +5 -22
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +1 -10
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build/plugins/welcome-guide-menu-item/index.js +1 -6
- package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
- package/build/store/actions.js +53 -120
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +2 -3
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +0 -9
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +9 -42
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +63 -91
- package/build/store/selectors.js.map +1 -1
- package/build/utils/meta-boxes.js +0 -4
- package/build/utils/meta-boxes.js.map +1 -1
- package/build-module/components/block-manager/category.js +1 -8
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/checklist.js +0 -3
- package/build-module/components/block-manager/checklist.js.map +1 -1
- package/build-module/components/block-manager/index.js +11 -14
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +2 -8
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build-module/components/browser-url/index.js +7 -14
- package/build-module/components/browser-url/index.js.map +1 -1
- package/build-module/components/device-preview/index.js +1 -3
- package/build-module/components/device-preview/index.js.map +1 -1
- package/build-module/components/editor-initialization/index.js +1 -1
- package/build-module/components/editor-initialization/index.js.map +1 -1
- package/build-module/components/editor-initialization/listener-hooks.js +3 -5
- package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build-module/components/header/{document-title → document-actions}/index.js +11 -21
- package/build-module/components/header/document-actions/index.js.map +1 -0
- package/build-module/components/header/fullscreen-mode-close/index.js +4 -13
- package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +5 -13
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js +5 -12
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.js +6 -8
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/index.native.js +2 -9
- package/build-module/components/header/index.native.js.map +1 -1
- package/build-module/components/header/main-dashboard-button/index.js +0 -5
- package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
- package/build-module/components/header/mode-switcher/index.js +25 -14
- package/build-module/components/header/mode-switcher/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +1 -4
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/plugin-more-menu-item/index.js +1 -2
- package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +3 -2
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +2 -5
- package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build-module/components/header/preferences-menu-item/index.js +1 -2
- package/build-module/components/header/preferences-menu-item/index.js.map +1 -1
- package/build-module/components/header/tools-more-menu-group/index.js +0 -3
- package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +1 -8
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -6
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +5 -13
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -5
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +4 -14
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/actions-panel.js +6 -8
- package/build-module/components/layout/actions-panel.js.map +1 -1
- package/build-module/components/layout/index.js +53 -28
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/index.native.js +6 -20
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/meta-boxes/index.js +4 -6
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/meta-boxes/meta-box-visibility.js +1 -9
- package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.js +3 -7
- package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +2 -5
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js +3 -5
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-custom-fields.js +9 -2
- package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-feature.js +1 -1
- package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-panel.js +1 -1
- package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js +1 -4
- package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-publish-sidebar.js +2 -1
- package/build-module/components/preferences-modal/options/enable-publish-sidebar.js.map +1 -1
- package/build-module/components/preferences-modal/options/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +1 -2
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-outline.js +0 -3
- package/build-module/components/secondary-sidebar/list-view-outline.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +35 -33
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/discussion-panel/index.js +22 -25
- package/build-module/components/sidebar/discussion-panel/index.js.map +1 -1
- package/build-module/components/sidebar/featured-image/index.js +2 -7
- package/build-module/components/sidebar/featured-image/index.js.map +1 -1
- package/build-module/components/sidebar/last-revision/index.js +0 -3
- package/build-module/components/sidebar/last-revision/index.js.map +1 -1
- package/build-module/components/sidebar/page-attributes/index.js +2 -7
- package/build-module/components/sidebar/page-attributes/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js +46 -55
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js +19 -22
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-post-status-info/index.js +1 -3
- package/build-module/components/sidebar/plugin-post-status-info/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +19 -22
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +2 -3
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-author/index.js +0 -1
- package/build-module/components/sidebar/post-author/index.js.map +1 -1
- package/build-module/components/sidebar/post-excerpt/index.js +2 -7
- package/build-module/components/sidebar/post-excerpt/index.js.map +1 -1
- package/build-module/components/sidebar/post-format/index.js +0 -1
- package/build-module/components/sidebar/post-format/index.js.map +1 -1
- package/build-module/components/sidebar/post-pending-status/index.js +0 -1
- package/build-module/components/sidebar/post-pending-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-schedule/index.js +4 -5
- package/build-module/components/sidebar/post-schedule/index.js.map +1 -1
- package/build-module/components/sidebar/post-slug/index.js +0 -1
- package/build-module/components/sidebar/post-slug/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +2 -6
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-sticky/index.js +0 -1
- package/build-module/components/sidebar/post-sticky/index.js.map +1 -1
- package/build-module/components/sidebar/post-taxonomies/index.js +1 -4
- package/build-module/components/sidebar/post-taxonomies/index.js.map +1 -1
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +1 -7
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
- package/build-module/components/sidebar/post-template/create-modal.js +1 -10
- package/build-module/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build-module/components/sidebar/post-template/form.js +3 -6
- package/build-module/components/sidebar/post-template/form.js.map +1 -1
- package/build-module/components/sidebar/post-template/index.js +5 -16
- package/build-module/components/sidebar/post-template/index.js.map +1 -1
- package/build-module/components/sidebar/post-trash/index.js +0 -1
- package/build-module/components/sidebar/post-trash/index.js.map +1 -1
- package/build-module/components/sidebar/post-url/index.js +4 -5
- package/build-module/components/sidebar/post-url/index.js.map +1 -1
- package/build-module/components/sidebar/post-visibility/index.js +4 -6
- package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
- package/build-module/components/sidebar/settings-header/index.js +12 -13
- package/build-module/components/sidebar/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +2 -9
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/template-summary/index.js +1 -6
- package/build-module/components/sidebar/template-summary/index.js.map +1 -1
- package/build-module/components/start-page-options/index.js +1 -8
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/text-editor/index.js +1 -2
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/components/view-link/index.js +2 -3
- package/build-module/components/view-link/index.js.map +1 -1
- package/build-module/components/visual-editor/block-inspector-button.js +1 -5
- package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/visual-editor/header.native.js +1 -4
- package/build-module/components/visual-editor/header.native.js.map +1 -1
- package/build-module/components/visual-editor/index.js +34 -43
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/index.native.js +1 -5
- package/build-module/components/visual-editor/index.native.js.map +1 -1
- package/build-module/components/welcome-guide/default.js +1 -2
- package/build-module/components/welcome-guide/default.js.map +1 -1
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +1 -6
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +1 -2
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/editor.js +9 -52
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +11 -23
- package/build-module/editor.native.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +66 -14
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/components/index.js +0 -2
- package/build-module/hooks/components/index.js.map +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/validate-multiple-use/index.js +9 -11
- package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
- package/build-module/index.js +18 -26
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +2 -3
- package/build-module/index.native.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/plugins/copy-content-menu-item/index.js +0 -3
- package/build-module/plugins/copy-content-menu-item/index.js.map +1 -1
- package/build-module/plugins/index.js +5 -11
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +1 -2
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build-module/plugins/welcome-guide-menu-item/index.js +1 -2
- package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
- package/build-module/store/actions.js +55 -66
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +2 -2
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/index.js +2 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +10 -33
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +63 -64
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/meta-boxes.js +0 -2
- package/build-module/utils/meta-boxes.js.map +1 -1
- package/build-style/style-rtl.css +40 -27
- package/build-style/style.css +40 -27
- package/package.json +32 -32
- package/src/components/header/{document-title → document-actions}/index.js +22 -23
- package/src/components/header/{document-title → document-actions}/style.scss +25 -22
- package/src/components/header/header-toolbar/index.native.js +1 -0
- package/src/components/header/header-toolbar/style.scss +4 -0
- package/src/components/header/index.js +3 -3
- package/src/components/header/mode-switcher/index.js +23 -4
- package/src/components/header/style.scss +1 -1
- package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +29 -0
- package/src/components/keyboard-shortcuts/index.js +2 -2
- package/src/components/layout/index.js +64 -3
- package/src/components/preferences-modal/options/enable-custom-fields.js +15 -4
- package/src/components/preferences-modal/options/test/enable-custom-fields.js +6 -1
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +5 -2
- package/src/components/preferences-modal/test/index.js +4 -4
- package/src/components/secondary-sidebar/list-view-sidebar.js +3 -3
- package/src/components/sidebar/discussion-panel/index.js +15 -20
- package/src/components/sidebar/plugin-document-setting-panel/index.js +54 -65
- package/src/components/sidebar/plugin-post-publish-panel/index.js +23 -27
- package/src/components/sidebar/plugin-pre-publish-panel/index.js +25 -28
- package/src/components/sidebar/post-schedule/style.scss +2 -0
- package/src/components/visual-editor/index.js +9 -8
- package/src/components/visual-editor/style.scss +5 -1
- package/src/editor.js +2 -47
- package/src/hooks/commands/use-common-commands.js +84 -22
- package/src/index.js +5 -1
- package/src/store/selectors.js +10 -3
- package/src/style.scss +1 -1
- package/src/test/editor.native.js +4 -3
- package/build/components/header/document-title/index.js.map +0 -1
- package/build-module/components/header/document-title/index.js.map +0 -1
|
@@ -4,25 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useCommonCommands;
|
|
7
|
-
|
|
8
7
|
var _data = require("@wordpress/data");
|
|
9
|
-
|
|
10
8
|
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
|
|
12
9
|
var _icons = require("@wordpress/icons");
|
|
13
|
-
|
|
14
10
|
var _commands = require("@wordpress/commands");
|
|
15
|
-
|
|
16
11
|
var _preferences = require("@wordpress/preferences");
|
|
17
|
-
|
|
18
12
|
var _interface = require("@wordpress/interface");
|
|
19
|
-
|
|
13
|
+
var _editor = require("@wordpress/editor");
|
|
14
|
+
var _notices = require("@wordpress/notices");
|
|
20
15
|
var _keyboardShortcutHelpModal = require("../../components/keyboard-shortcut-help-modal");
|
|
21
|
-
|
|
22
16
|
var _preferencesModal = require("../../components/preferences-modal");
|
|
23
|
-
|
|
24
17
|
var _store = require("../../store");
|
|
25
|
-
|
|
26
18
|
/**
|
|
27
19
|
* WordPress dependencies
|
|
28
20
|
*/
|
|
@@ -30,6 +22,7 @@ var _store = require("../../store");
|
|
|
30
22
|
/**
|
|
31
23
|
* Internal dependencies
|
|
32
24
|
*/
|
|
25
|
+
|
|
33
26
|
function useCommonCommands() {
|
|
34
27
|
const {
|
|
35
28
|
openGeneralSidebar,
|
|
@@ -43,21 +36,35 @@ function useCommonCommands() {
|
|
|
43
36
|
const {
|
|
44
37
|
editorMode,
|
|
45
38
|
activeSidebar,
|
|
46
|
-
isListViewOpen
|
|
39
|
+
isListViewOpen,
|
|
40
|
+
isPublishSidebarEnabled,
|
|
41
|
+
showBlockBreadcrumbs
|
|
47
42
|
} = (0, _data.useSelect)(select => {
|
|
48
43
|
const {
|
|
49
44
|
getEditorMode,
|
|
50
|
-
isListViewOpened
|
|
45
|
+
isListViewOpened,
|
|
46
|
+
isFeatureActive
|
|
51
47
|
} = select(_store.store);
|
|
52
48
|
return {
|
|
53
49
|
activeSidebar: select(_interface.store).getActiveComplementaryArea(_store.store.name),
|
|
54
50
|
editorMode: getEditorMode(),
|
|
55
|
-
isListViewOpen: isListViewOpened()
|
|
51
|
+
isListViewOpen: isListViewOpened(),
|
|
52
|
+
isPublishSidebarEnabled: select(_editor.store).isPublishSidebarEnabled(),
|
|
53
|
+
showBlockBreadcrumbs: isFeatureActive('showBlockBreadcrumbs')
|
|
56
54
|
};
|
|
57
55
|
}, []);
|
|
58
56
|
const {
|
|
59
57
|
toggle
|
|
60
58
|
} = (0, _data.useDispatch)(_preferences.store);
|
|
59
|
+
const {
|
|
60
|
+
createInfoNotice
|
|
61
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
62
|
+
const {
|
|
63
|
+
__unstableSaveForPreview
|
|
64
|
+
} = (0, _data.useDispatch)(_editor.store);
|
|
65
|
+
const {
|
|
66
|
+
getCurrentPostId
|
|
67
|
+
} = (0, _data.useSelect)(_editor.store);
|
|
61
68
|
(0, _commands.useCommand)({
|
|
62
69
|
name: 'core/open-settings-sidebar',
|
|
63
70
|
label: (0, _i18n.__)('Toggle settings sidebar'),
|
|
@@ -66,7 +73,6 @@ function useCommonCommands() {
|
|
|
66
73
|
close
|
|
67
74
|
}) => {
|
|
68
75
|
close();
|
|
69
|
-
|
|
70
76
|
if (activeSidebar === 'edit-post/document') {
|
|
71
77
|
closeGeneralSidebar();
|
|
72
78
|
} else {
|
|
@@ -82,7 +88,6 @@ function useCommonCommands() {
|
|
|
82
88
|
close
|
|
83
89
|
}) => {
|
|
84
90
|
close();
|
|
85
|
-
|
|
86
91
|
if (activeSidebar === 'edit-post/block') {
|
|
87
92
|
closeGeneralSidebar();
|
|
88
93
|
} else {
|
|
@@ -93,7 +98,6 @@ function useCommonCommands() {
|
|
|
93
98
|
(0, _commands.useCommand)({
|
|
94
99
|
name: 'core/toggle-distraction-free',
|
|
95
100
|
label: (0, _i18n.__)('Toggle distraction free'),
|
|
96
|
-
icon: _icons.cog,
|
|
97
101
|
callback: ({
|
|
98
102
|
close
|
|
99
103
|
}) => {
|
|
@@ -104,7 +108,6 @@ function useCommonCommands() {
|
|
|
104
108
|
(0, _commands.useCommand)({
|
|
105
109
|
name: 'core/toggle-spotlight-mode',
|
|
106
110
|
label: (0, _i18n.__)('Toggle spotlight mode'),
|
|
107
|
-
icon: _icons.cog,
|
|
108
111
|
callback: ({
|
|
109
112
|
close
|
|
110
113
|
}) => {
|
|
@@ -137,7 +140,6 @@ function useCommonCommands() {
|
|
|
137
140
|
(0, _commands.useCommand)({
|
|
138
141
|
name: 'core/toggle-top-toolbar',
|
|
139
142
|
label: (0, _i18n.__)('Toggle top toolbar'),
|
|
140
|
-
icon: _icons.cog,
|
|
141
143
|
callback: ({
|
|
142
144
|
close
|
|
143
145
|
}) => {
|
|
@@ -158,19 +160,60 @@ function useCommonCommands() {
|
|
|
158
160
|
});
|
|
159
161
|
(0, _commands.useCommand)({
|
|
160
162
|
name: 'core/open-preferences',
|
|
161
|
-
label: (0, _i18n.__)('
|
|
162
|
-
icon: _icons.cog,
|
|
163
|
+
label: (0, _i18n.__)('Editor preferences'),
|
|
163
164
|
callback: () => {
|
|
164
165
|
openModal(_preferencesModal.PREFERENCES_MODAL_NAME);
|
|
165
166
|
}
|
|
166
167
|
});
|
|
167
168
|
(0, _commands.useCommand)({
|
|
168
169
|
name: 'core/open-shortcut-help',
|
|
169
|
-
label: (0, _i18n.__)('
|
|
170
|
-
icon: _icons.
|
|
170
|
+
label: (0, _i18n.__)('Keyboard shortcuts'),
|
|
171
|
+
icon: _icons.keyboard,
|
|
171
172
|
callback: () => {
|
|
172
173
|
openModal(_keyboardShortcutHelpModal.KEYBOARD_SHORTCUT_HELP_MODAL_NAME);
|
|
173
174
|
}
|
|
174
175
|
});
|
|
176
|
+
(0, _commands.useCommand)({
|
|
177
|
+
name: 'core/toggle-breadcrumbs',
|
|
178
|
+
label: showBlockBreadcrumbs ? (0, _i18n.__)('Hide block breadcrumbs') : (0, _i18n.__)('Show block breadcrumbs'),
|
|
179
|
+
callback: ({
|
|
180
|
+
close
|
|
181
|
+
}) => {
|
|
182
|
+
toggle('core/edit-post', 'showBlockBreadcrumbs');
|
|
183
|
+
close();
|
|
184
|
+
createInfoNotice(showBlockBreadcrumbs ? (0, _i18n.__)('Breadcrumbs hidden.') : (0, _i18n.__)('Breadcrumbs visible.'), {
|
|
185
|
+
id: 'core/edit-post/toggle-breadcrumbs/notice',
|
|
186
|
+
type: 'snackbar'
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
(0, _commands.useCommand)({
|
|
191
|
+
name: 'core/toggle-publish-sidebar',
|
|
192
|
+
label: isPublishSidebarEnabled ? (0, _i18n.__)('Disable pre-publish checklist') : (0, _i18n.__)('Enable pre-publish checklist'),
|
|
193
|
+
icon: _icons.formatListBullets,
|
|
194
|
+
callback: ({
|
|
195
|
+
close
|
|
196
|
+
}) => {
|
|
197
|
+
close();
|
|
198
|
+
toggle('core/edit-post', 'isPublishSidebarEnabled');
|
|
199
|
+
createInfoNotice(isPublishSidebarEnabled ? (0, _i18n.__)('Pre-publish checklist off.') : (0, _i18n.__)('Pre-publish checklist on.'), {
|
|
200
|
+
id: 'core/edit-post/publish-sidebar/notice',
|
|
201
|
+
type: 'snackbar'
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
(0, _commands.useCommand)({
|
|
206
|
+
name: 'core/preview-link',
|
|
207
|
+
label: (0, _i18n.__)('Preview in a new tab'),
|
|
208
|
+
icon: _icons.external,
|
|
209
|
+
callback: async ({
|
|
210
|
+
close
|
|
211
|
+
}) => {
|
|
212
|
+
close();
|
|
213
|
+
const postId = getCurrentPostId();
|
|
214
|
+
const link = await __unstableSaveForPreview();
|
|
215
|
+
window.open(link, `wp-preview-${postId}`);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
175
218
|
}
|
|
176
219
|
//# sourceMappingURL=use-common-commands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"names":["useCommonCommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","setIsListViewOpened","editPostStore","openModal","interfaceStore","editorMode","activeSidebar","isListViewOpen","select","getEditorMode","isListViewOpened","getActiveComplementaryArea","name","toggle","preferencesStore","label","icon","drawerLeft","drawerRight","callback","close","blockDefault","cog","desktop","listView","code","PREFERENCES_MODAL_NAME","keyboardClose","KEYBOARD_SHORTCUT_HELP_MODAL_NAME"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAiBA;AACA;AACA;AAKe,SAASA,iBAAT,GAA6B;AAC3C,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,mBAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA;AAJK,MAKF,uBAAaC,YAAb,CALJ;AAMA,QAAM;AAAEC,IAAAA;AAAF,MAAgB,uBAAaC,gBAAb,CAAtB;AACA,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,aAAd;AAA6BC,IAAAA;AAA7B,MAAgD,qBACnDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,QAAsCF,MAAM,CAAEN,YAAF,CAAlD;AACA,WAAO;AACNI,MAAAA,aAAa,EAAEE,MAAM,CACpBJ,gBADoB,CAAN,CAEbO,0BAFa,CAEeT,aAAcU,IAF7B,CADT;AAINP,MAAAA,UAAU,EAAEI,aAAa,EAJnB;AAKNF,MAAAA,cAAc,EAAEG,gBAAgB;AAL1B,KAAP;AAOA,GAVoD,EAWrD,EAXqD,CAAtD;AAaA,QAAM;AAAEG,IAAAA;AAAF,MAAa,uBAAaC,kBAAb,CAAnB;AAEA,4BAAY;AACXF,IAAAA,IAAI,EAAE,4BADK;AAEXG,IAAAA,KAAK,EAAE,cAAI,yBAAJ,CAFI;AAGXC,IAAAA,IAAI,EAAE,qBAAUC,iBAAV,GAAuBC,k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HK;AAIXH,IAAAA,QAAQ,EAAE,MAAM;AACfhB,MAAAA,SAAS,CAAEuB,wCAAF,CAAT;AACA;AANU,GAAZ;AASA,4BAAY;AACXd,IAAAA,IAAI,EAAE,yBADK;AAEXG,IAAAA,KAAK,EAAE,cAAI,yBAAJ,CAFI;AAGXC,IAAAA,IAAI,EAAEW,oBAHK;AAIXR,IAAAA,QAAQ,EAAE,MAAM;AACfhB,MAAAA,SAAS,CAAEyB,4DAAF,CAAT;AACA;AANU,GAAZ;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tcode,\n\tcog,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tkeyboardClose,\n\tdesktop,\n\tlistView,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { store as editPostStore } from '../../store';\n\nexport default function useCommonCommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\tswitchEditorMode,\n\t\tsetIsListViewOpened,\n\t} = useDispatch( editPostStore );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { editorMode, activeSidebar, isListViewOpen } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorMode, isListViewOpened } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tactiveSidebar: select(\n\t\t\t\t\tinterfaceStore\n\t\t\t\t).getActiveComplementaryArea( editPostStore.name ),\n\t\t\t\teditorMode: getEditorMode(),\n\t\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tuseCommand( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: __( 'Toggle distraction free' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'distractionFree' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight mode' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'focusMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-fullscreen-mode',\n\t\tlabel: __( 'Toggle fullscreen mode' ),\n\t\ticon: desktop,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: __( 'Toggle list view' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fixedToolbar' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-code-editor',\n\t\tlabel: __( 'Toggle code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Open editor preferences' ),\n\t\ticon: cog,\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Open keyboard shortcuts' ),\n\t\ticon: keyboardClose,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n}\n"]}
|
|
1
|
+
{"version":3,"names":["_data","require","_i18n","_icons","_commands","_preferences","_interface","_editor","_notices","_keyboardShortcutHelpModal","_preferencesModal","_store","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","setIsListViewOpened","useDispatch","editPostStore","openModal","interfaceStore","editorMode","activeSidebar","isListViewOpen","isPublishSidebarEnabled","showBlockBreadcrumbs","useSelect","select","getEditorMode","isListViewOpened","isFeatureActive","getActiveComplementaryArea","name","editorStore","toggle","preferencesStore","createInfoNotice","noticesStore","__unstableSaveForPreview","getCurrentPostId","useCommand","label","__","icon","isRTL","drawerLeft","drawerRight","callback","close","blockDefault","desktop","listView","code","PREFERENCES_MODAL_NAME","keyboard","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","id","type","formatListBullets","external","postId","link","window","open"],"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tcode,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tkeyboard,\n\tdesktop,\n\tlistView,\n\texternal,\n\tformatListBullets,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { store as editPostStore } from '../../store';\n\nexport default function useCommonCommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\tswitchEditorMode,\n\t\tsetIsListViewOpened,\n\t} = useDispatch( editPostStore );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst {\n\t\teditorMode,\n\t\tactiveSidebar,\n\t\tisListViewOpen,\n\t\tisPublishSidebarEnabled,\n\t\tshowBlockBreadcrumbs,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorMode, isListViewOpened, isFeatureActive } =\n\t\t\tselect( editPostStore );\n\t\treturn {\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditPostStore.name\n\t\t\t),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisPublishSidebarEnabled:\n\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\tshowBlockBreadcrumbs: isFeatureActive( 'showBlockBreadcrumbs' ),\n\t\t};\n\t}, [] );\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\tconst { __unstableSaveForPreview } = useDispatch( editorStore );\n\tconst { getCurrentPostId } = useSelect( editorStore );\n\n\tuseCommand( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: __( 'Toggle distraction free' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'distractionFree' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight mode' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'focusMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-fullscreen-mode',\n\t\tlabel: __( 'Toggle fullscreen mode' ),\n\t\ticon: desktop,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: __( 'Toggle list view' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fixedToolbar' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-code-editor',\n\t\tlabel: __( 'Toggle code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-breadcrumbs',\n\t\tlabel: showBlockBreadcrumbs\n\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t: __( 'Show block breadcrumbs' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'showBlockBreadcrumbs' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-breadcrumbs/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-publish-sidebar',\n\t\tlabel: isPublishSidebarEnabled\n\t\t\t? __( 'Disable pre-publish checklist' )\n\t\t\t: __( 'Enable pre-publish checklist' ),\n\t\ticon: formatListBullets,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\ttoggle( 'core/edit-post', 'isPublishSidebarEnabled' );\n\t\t\tcreateInfoNotice(\n\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t? __( 'Pre-publish checklist off.' )\n\t\t\t\t\t: __( 'Pre-publish checklist on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/publish-sidebar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/preview-link',\n\t\tlabel: __( 'Preview in a new tab' ),\n\t\ticon: external,\n\t\tcallback: async ( { close } ) => {\n\t\t\tclose();\n\t\t\tconst postId = getCurrentPostId();\n\t\t\tconst link = await __unstableSaveForPreview();\n\t\t\twindow.open( link, `wp-preview-${ postId }` );\n\t\t},\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAWA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,0BAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AA3BA;AACA;AACA;;AAoBA;AACA;AACA;;AAKe,SAASW,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IACLC,kBAAkB;IAClBC,mBAAmB;IACnBC,gBAAgB;IAChBC;EACD,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAChC,M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EAAE,MAAAA,CAAQ;MAAEC;IAAM,CAAC,KAAM;MAChCA,KAAK,CAAC,CAAC;MACP,MAAMY,MAAM,GAAGrB,gBAAgB,CAAC,CAAC;MACjC,MAAMsB,IAAI,GAAG,MAAMvB,wBAAwB,CAAC,CAAC;MAC7CwB,MAAM,CAACC,IAAI,CAAEF,IAAI,EAAG,cAAcD,MAAQ,EAAE,CAAC;IAC9C;EACD,CAAE,CAAC;AACJ"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _hooks = require("@wordpress/hooks");
|
|
4
|
-
|
|
5
4
|
var _mediaUtils = require("@wordpress/media-utils");
|
|
6
|
-
|
|
7
5
|
/**
|
|
8
6
|
* WordPress dependencies
|
|
9
7
|
*/
|
|
10
|
-
const replaceMediaUpload = () => _mediaUtils.MediaUpload;
|
|
11
8
|
|
|
9
|
+
const replaceMediaUpload = () => _mediaUtils.MediaUpload;
|
|
12
10
|
(0, _hooks.addFilter)('editor.MediaUpload', 'core/edit-post/replace-media-upload', replaceMediaUpload);
|
|
13
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/hooks/components/index.js"],"
|
|
1
|
+
{"version":3,"names":["_hooks","require","_mediaUtils","replaceMediaUpload","MediaUpload","addFilter"],"sources":["@wordpress/edit-post/src/hooks/components/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { MediaUpload } from '@wordpress/media-utils';\n\nconst replaceMediaUpload = () => MediaUpload;\n\naddFilter(\n\t'editor.MediaUpload',\n\t'core/edit-post/replace-media-upload',\n\treplaceMediaUpload\n);\n"],"mappings":";;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAME,kBAAkB,GAAGA,CAAA,KAAMC,uBAAW;AAE5C,IAAAC,gBAAS,EACR,oBAAoB,EACpB,qCAAqC,EACrCF,kBACD,CAAC"}
|
package/build/hooks/index.js
CHANGED
package/build/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/hooks/index.js"],"
|
|
1
|
+
{"version":3,"names":["require"],"sources":["@wordpress/edit-post/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './components';\nimport './validate-multiple-use';\n"],"mappings":";;AAGAA,OAAA;AACAA,OAAA"}
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _element = require("@wordpress/element");
|
|
4
|
-
|
|
5
4
|
var _blocks = require("@wordpress/blocks");
|
|
6
|
-
|
|
7
5
|
var _components = require("@wordpress/components");
|
|
8
|
-
|
|
9
6
|
var _data = require("@wordpress/data");
|
|
10
|
-
|
|
11
7
|
var _blockEditor = require("@wordpress/block-editor");
|
|
12
|
-
|
|
13
8
|
var _hooks = require("@wordpress/hooks");
|
|
14
|
-
|
|
15
9
|
var _i18n = require("@wordpress/i18n");
|
|
16
|
-
|
|
17
10
|
var _compose = require("@wordpress/compose");
|
|
18
|
-
|
|
19
11
|
/**
|
|
20
12
|
* WordPress dependencies
|
|
21
13
|
*/
|
|
14
|
+
|
|
22
15
|
const enhance = (0, _compose.compose)(
|
|
23
16
|
/**
|
|
24
17
|
* For blocks whose block type doesn't support `multiple`, provides the
|
|
@@ -32,15 +25,16 @@ const enhance = (0, _compose.compose)(
|
|
|
32
25
|
* @return {WPComponent} Enhanced component with merged state data props.
|
|
33
26
|
*/
|
|
34
27
|
(0, _data.withSelect)((select, block) => {
|
|
35
|
-
const multiple = (0, _blocks.hasBlockSupport)(block.name, 'multiple', true);
|
|
36
|
-
// block" to be found in the content, as the block itself is valid.
|
|
28
|
+
const multiple = (0, _blocks.hasBlockSupport)(block.name, 'multiple', true);
|
|
37
29
|
|
|
30
|
+
// For block types with `multiple` support, there is no "original
|
|
31
|
+
// block" to be found in the content, as the block itself is valid.
|
|
38
32
|
if (multiple) {
|
|
39
33
|
return {};
|
|
40
|
-
}
|
|
41
|
-
// block from the current one.
|
|
42
|
-
|
|
34
|
+
}
|
|
43
35
|
|
|
36
|
+
// Otherwise, only pass `originalBlockClientId` if it refers to a different
|
|
37
|
+
// block from the current one.
|
|
44
38
|
const blocks = select(_blockEditor.store).getBlocks();
|
|
45
39
|
const firstOfSameType = blocks.find(({
|
|
46
40
|
name
|
|
@@ -61,10 +55,10 @@ const withMultipleValidation = (0, _compose.createHigherOrderComponent)(BlockEdi
|
|
|
61
55
|
...props
|
|
62
56
|
}) => {
|
|
63
57
|
if (!originalBlockClientId) {
|
|
64
|
-
return (0, _element.createElement)(BlockEdit, {
|
|
58
|
+
return (0, _element.createElement)(BlockEdit, {
|
|
59
|
+
...props
|
|
65
60
|
});
|
|
66
61
|
}
|
|
67
|
-
|
|
68
62
|
const blockType = (0, _blocks.getBlockType)(props.name);
|
|
69
63
|
const outboundType = getOutboundType(props.name);
|
|
70
64
|
return [(0, _element.createElement)("div", {
|
|
@@ -93,6 +87,7 @@ const withMultipleValidation = (0, _compose.createHigherOrderComponent)(BlockEdi
|
|
|
93
87
|
}, (0, _element.createElement)("strong", null, blockType?.title, ": "), (0, _i18n.__)('This block can only be used once.'))];
|
|
94
88
|
});
|
|
95
89
|
}, 'withMultipleValidation');
|
|
90
|
+
|
|
96
91
|
/**
|
|
97
92
|
* Given a base block name, returns the default block type to which to offer
|
|
98
93
|
* transforms.
|
|
@@ -101,7 +96,6 @@ const withMultipleValidation = (0, _compose.createHigherOrderComponent)(BlockEdi
|
|
|
101
96
|
*
|
|
102
97
|
* @return {?Object} The chosen default block type.
|
|
103
98
|
*/
|
|
104
|
-
|
|
105
99
|
function getOutboundType(blockName) {
|
|
106
100
|
// Grab the first outbound transform.
|
|
107
101
|
const transform = (0, _blocks.findTransform)((0, _blocks.getBlockTransforms)('to', blockName), ({
|
|
@@ -113,9 +107,7 @@ function getOutboundType(blockName) {
|
|
|
113
107
|
if (!transform) {
|
|
114
108
|
return null;
|
|
115
109
|
}
|
|
116
|
-
|
|
117
110
|
return (0, _blocks.getBlockType)(transform.blocks[0]);
|
|
118
111
|
}
|
|
119
|
-
|
|
120
112
|
(0, _hooks.addFilter)('editor.BlockEdit', 'core/edit-post/validate-multiple-use/with-multiple-validation', withMultipleValidation);
|
|
121
113
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_blocks","require","_components","_data","_blockEditor","_hooks","_i18n","_compose","enhance","compose","withSelect","select","block","multiple","hasBlockSupport","name","blocks","blockEditorStore","getBlocks","firstOfSameType","find","isInvalid","clientId","originalBlockClientId","withDispatch","dispatch","selectFirst","selectBlock","withMultipleValidation","createHigherOrderComponent","BlockEdit","props","_element","createElement","blockType","getBlockType","outboundType","getOutboundType","key","style","minHeight","Warning","actions","Button","variant","onClick","__","onReplace","createBlock","attributes","title","blockName","transform","findTransform","getBlockTransforms","type","length","addFilter"],"sources":["@wordpress/edit-post/src/hooks/validate-multiple-use/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { Button } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { Warning, store as blockEditorStore } from '@wordpress/block-editor';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\n\nconst enhance = compose(\n\t/**\n\t * For blocks whose block type doesn't support `multiple`, provides the\n\t * wrapped component with `originalBlockClientId` -- a reference to the\n\t * first block of the same type in the content -- if and only if that\n\t * \"original\" block is not the current one. Thus, an inexisting\n\t * `originalBlockClientId` prop signals that the block is valid.\n\t *\n\t * @param {WPComponent} WrappedBlockEdit A filtered BlockEdit instance.\n\t *\n\t * @return {WPComponent} Enhanced component with merged state data props.\n\t */\n\twithSelect( ( select, block ) => {\n\t\tconst multiple = hasBlockSupport( block.name, 'multiple', true );\n\n\t\t// For block types with `multiple` support, there is no \"original\n\t\t// block\" to be found in the content, as the block itself is valid.\n\t\tif ( multiple ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Otherwise, only pass `originalBlockClientId` if it refers to a different\n\t\t// block from the current one.\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\tconst firstOfSameType = blocks.find(\n\t\t\t( { name } ) => block.name === name\n\t\t);\n\t\tconst isInvalid =\n\t\t\tfirstOfSameType && firstOfSameType.clientId !== block.clientId;\n\t\treturn {\n\t\t\toriginalBlockClientId: isInvalid && firstOfSameType.clientId,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { originalBlockClientId } ) => ( {\n\t\tselectFirst: () =>\n\t\t\tdispatch( blockEditorStore ).selectBlock( originalBlockClientId ),\n\t} ) )\n);\n\nconst withMultipleValidation = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn enhance( ( { originalBlockClientId, selectFirst, ...props } ) => {\n\t\tif ( ! originalBlockClientId ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\tconst blockType = getBlockType( props.name );\n\t\tconst outboundType = getOutboundType( props.name );\n\n\t\treturn [\n\t\t\t<div key=\"invalid-preview\" style={ { minHeight: '60px' } }>\n\t\t\t\t<BlockEdit key=\"block-edit\" { ...props } />\n\t\t\t</div>,\n\t\t\t<Warning\n\t\t\t\tkey=\"multiple-use-warning\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"find-original\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ selectFirst }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Find original' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"remove\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ () => props.onReplace( [] ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\toutboundType && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey=\"transform\"\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tprops.onReplace(\n\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\toutboundType.name,\n\t\t\t\t\t\t\t\t\t\tprops.attributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Transform into:' ) } { outboundType.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t),\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<strong>{ blockType?.title }: </strong>\n\t\t\t\t{ __( 'This block can only be used once.' ) }\n\t\t\t</Warning>,\n\t\t];\n\t} );\n}, 'withMultipleValidation' );\n\n/**\n * Given a base block name, returns the default block type to which to offer\n * transforms.\n *\n * @param {string} blockName Base block name.\n *\n * @return {?Object} The chosen default block type.\n */\nfunction getOutboundType( blockName ) {\n\t// Grab the first outbound transform.\n\tconst transform = findTransform(\n\t\tgetBlockTransforms( 'to', blockName ),\n\t\t( { type, blocks } ) => type === 'block' && blocks.length === 1 // What about when .length > 1?\n\t);\n\n\tif ( ! transform ) {\n\t\treturn null;\n\t}\n\n\treturn getBlockType( transform.blocks[ 0 ] );\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-post/validate-multiple-use/with-multiple-validation',\n\twithMultipleValidation\n);\n"],"mappings":";;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAOA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,I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BAAkB,CAAC,EAAE,GAAC,EAAEV,YAAY,CAACc,KACpC,CACR;IACC,GAEH,IAAAlB,QAAA,CAAAC,aAAA,kBAAUC,SAAS,EAAEgB,KAAK,EAAE,IAAU,CAAC,EACrC,IAAAJ,QAAE,EAAE,mCAAoC,CAClC,CAAC,CACV;EACF,CAAE,CAAC;AACJ,CAAC,EAAE,wBAAyB,CAAC;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAST,eAAeA,CAAEc,SAAS,EAAG;EACrC;EACA,MAAMC,SAAS,GAAG,IAAAC,qBAAa,EAC9B,IAAAC,0BAAkB,EAAE,IAAI,EAAEH,SAAU,CAAC,EACrC,CAAE;IAAEI,IAAI;IAAEvC;EAAO,CAAC,KAAMuC,IAAI,KAAK,OAAO,IAAIvC,MAAM,CAACwC,MAAM,KAAK,CAAC,CAAC;EACjE,CAAC;;EAED,IAAK,CAAEJ,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,OAAO,IAAAjB,oBAAY,EAAEiB,SAAS,CAACpC,MAAM,CAAE,CAAC,CAAG,CAAC;AAC7C;AAEA,IAAAyC,gBAAS,EACR,kBAAkB,EAClB,+DAA+D,EAC/D7B,sBACD,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -73,51 +72,28 @@ Object.defineProperty(exports, "store", {
|
|
|
73
72
|
return _store.store;
|
|
74
73
|
}
|
|
75
74
|
});
|
|
76
|
-
|
|
77
75
|
var _element = require("@wordpress/element");
|
|
78
|
-
|
|
79
76
|
var _blocks = require("@wordpress/blocks");
|
|
80
|
-
|
|
81
77
|
var _blockLibrary = require("@wordpress/block-library");
|
|
82
|
-
|
|
83
78
|
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
84
|
-
|
|
85
79
|
var _data = require("@wordpress/data");
|
|
86
|
-
|
|
87
80
|
var _hooks = require("@wordpress/hooks");
|
|
88
|
-
|
|
89
81
|
var _preferences = require("@wordpress/preferences");
|
|
90
|
-
|
|
91
82
|
var _widgets = require("@wordpress/widgets");
|
|
92
|
-
|
|
93
83
|
require("./hooks");
|
|
94
|
-
|
|
95
84
|
require("./plugins");
|
|
96
|
-
|
|
97
85
|
var _editor = _interopRequireDefault(require("./editor"));
|
|
98
|
-
|
|
99
86
|
var _store = require("./store");
|
|
100
|
-
|
|
101
87
|
var _pluginBlockSettingsMenuItem = _interopRequireDefault(require("./components/block-settings-menu/plugin-block-settings-menu-item"));
|
|
102
|
-
|
|
103
88
|
var _pluginDocumentSettingPanel = _interopRequireDefault(require("./components/sidebar/plugin-document-setting-panel"));
|
|
104
|
-
|
|
105
89
|
var _pluginMoreMenuItem = _interopRequireDefault(require("./components/header/plugin-more-menu-item"));
|
|
106
|
-
|
|
107
90
|
var _pluginPostPublishPanel = _interopRequireDefault(require("./components/sidebar/plugin-post-publish-panel"));
|
|
108
|
-
|
|
109
91
|
var _pluginPostStatusInfo = _interopRequireDefault(require("./components/sidebar/plugin-post-status-info"));
|
|
110
|
-
|
|
111
92
|
var _pluginPrePublishPanel = _interopRequireDefault(require("./components/sidebar/plugin-pre-publish-panel"));
|
|
112
|
-
|
|
113
93
|
var _pluginSidebar = _interopRequireDefault(require("./components/sidebar/plugin-sidebar"));
|
|
114
|
-
|
|
115
94
|
var _pluginSidebarMoreMenuItem = _interopRequireDefault(require("./components/header/plugin-sidebar-more-menu-item"));
|
|
116
|
-
|
|
117
95
|
var _fullscreenModeClose = _interopRequireDefault(require("./components/header/fullscreen-mode-close"));
|
|
118
|
-
|
|
119
96
|
var _mainDashboardButton = _interopRequireDefault(require("./components/header/main-dashboard-button"));
|
|
120
|
-
|
|
121
97
|
/**
|
|
122
98
|
* WordPress dependencies
|
|
123
99
|
*/
|
|
@@ -156,14 +132,13 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
|
|
|
156
132
|
welcomeGuide: true,
|
|
157
133
|
welcomeGuideTemplate: true
|
|
158
134
|
});
|
|
135
|
+
(0, _data.dispatch)(_blocks.store).__experimentalReapplyBlockTypeFilters();
|
|
159
136
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if ((0, _data.select)(_store.store).isFeatureActive('showListViewByDefault')) {
|
|
137
|
+
// Check if the block list view should be open by default.
|
|
138
|
+
// If `distractionFree` mode is enabled, the block list view should not be open.
|
|
139
|
+
if ((0, _data.select)(_store.store).isFeatureActive('showListViewByDefault') && !(0, _data.select)(_store.store).isFeatureActive('distractionFree')) {
|
|
164
140
|
(0, _data.dispatch)(_store.store).setIsListViewOpened(true);
|
|
165
141
|
}
|
|
166
|
-
|
|
167
142
|
(0, _blockLibrary.registerCoreBlocks)();
|
|
168
143
|
(0, _widgets.registerLegacyWidgetBlock)({
|
|
169
144
|
inserter: false
|
|
@@ -171,79 +146,73 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
|
|
|
171
146
|
(0, _widgets.registerWidgetGroupBlock)({
|
|
172
147
|
inserter: false
|
|
173
148
|
});
|
|
174
|
-
|
|
175
149
|
if (process.env.IS_GUTENBERG_PLUGIN) {
|
|
176
150
|
(0, _blockLibrary.__experimentalRegisterExperimentalCoreBlocks)({
|
|
177
151
|
enableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks
|
|
178
152
|
});
|
|
179
153
|
}
|
|
154
|
+
|
|
180
155
|
/*
|
|
181
156
|
* Prevent adding template part in the post editor.
|
|
182
157
|
* Only add the filter when the post editor is initialized, not imported.
|
|
183
158
|
* Also only add the filter(s) after registerCoreBlocks()
|
|
184
159
|
* so that common filters in the block library are not overwritten.
|
|
185
160
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
161
|
(0, _hooks.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => {
|
|
189
162
|
if (!(0, _data.select)(_store.store).isEditingTemplate() && blockType.name === 'core/template-part') {
|
|
190
163
|
return false;
|
|
191
164
|
}
|
|
192
|
-
|
|
193
165
|
return canInsert;
|
|
194
166
|
});
|
|
167
|
+
|
|
195
168
|
/*
|
|
196
169
|
* Prevent adding post content block (except in query block) in the post editor.
|
|
197
170
|
* Only add the filter when the post editor is initialized, not imported.
|
|
198
171
|
* Also only add the filter(s) after registerCoreBlocks()
|
|
199
172
|
* so that common filters in the block library are not overwritten.
|
|
200
173
|
*/
|
|
201
|
-
|
|
202
174
|
(0, _hooks.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter', (canInsert, blockType, rootClientId, {
|
|
203
175
|
getBlockParentsByBlockName
|
|
204
176
|
}) => {
|
|
205
177
|
if (!(0, _data.select)(_store.store).isEditingTemplate() && blockType.name === 'core/post-content') {
|
|
206
178
|
return getBlockParentsByBlockName(rootClientId, 'core/query').length > 0;
|
|
207
179
|
}
|
|
208
|
-
|
|
209
180
|
return canInsert;
|
|
210
|
-
});
|
|
181
|
+
});
|
|
211
182
|
|
|
183
|
+
// Show a console log warning if the browser is not in Standards rendering mode.
|
|
212
184
|
const documentMode = document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';
|
|
213
|
-
|
|
214
185
|
if (documentMode !== 'Standards') {
|
|
215
186
|
// eslint-disable-next-line no-console
|
|
216
187
|
console.warn("Your browser is using Quirks Mode. \nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.");
|
|
217
|
-
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// This is a temporary fix for a couple of issues specific to Webkit on iOS.
|
|
218
191
|
// Without this hack the browser scrolls the mobile toolbar off-screen.
|
|
219
192
|
// Once supported in Safari we can replace this in favor of preventScroll.
|
|
220
193
|
// For details see issue #18632 and PR #18686
|
|
221
194
|
// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.
|
|
222
195
|
// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.
|
|
223
196
|
|
|
224
|
-
|
|
225
197
|
const isIphone = window.navigator.userAgent.indexOf('iPhone') !== -1;
|
|
226
|
-
|
|
227
198
|
if (isIphone) {
|
|
228
199
|
window.addEventListener('scroll', event => {
|
|
229
200
|
const editorScrollContainer = document.getElementsByClassName('interface-interface-skeleton__body')[0];
|
|
230
|
-
|
|
231
201
|
if (event.target === document) {
|
|
232
202
|
// Scroll element into view by scrolling the editor container by the same amount
|
|
233
203
|
// that Mobile Safari tried to scroll the html element upwards.
|
|
234
204
|
if (window.scrollY > 100) {
|
|
235
205
|
editorScrollContainer.scrollTop = editorScrollContainer.scrollTop + window.scrollY;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
206
|
+
}
|
|
207
|
+
// Undo unwanted scroll on html element, but only in the visual editor.
|
|
239
208
|
if (document.getElementsByClassName('is-mode-visual')[0]) {
|
|
240
209
|
window.scrollTo(0, 0);
|
|
241
210
|
}
|
|
242
211
|
}
|
|
243
212
|
});
|
|
244
|
-
}
|
|
245
|
-
|
|
213
|
+
}
|
|
246
214
|
|
|
215
|
+
// Prevent the default browser action for files dropped outside of dropzones.
|
|
247
216
|
window.addEventListener('dragover', e => e.preventDefault(), false);
|
|
248
217
|
window.addEventListener('drop', e => e.preventDefault(), false);
|
|
249
218
|
root.render((0, _element.createElement)(_editor.default, {
|
|
@@ -254,11 +223,10 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
|
|
|
254
223
|
}));
|
|
255
224
|
return root;
|
|
256
225
|
}
|
|
226
|
+
|
|
257
227
|
/**
|
|
258
228
|
* Used to reinitialize the editor after an error. Now it's a deprecated noop function.
|
|
259
229
|
*/
|
|
260
|
-
|
|
261
|
-
|
|
262
230
|
function reinitializeEditor() {
|
|
263
231
|
(0, _deprecated.default)('wp.editPost.reinitializeEditor', {
|
|
264
232
|
since: '6.2',
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/index.js"],"names":["initializeEditor","id","postType","postId","settings","initialEdits","target","document","getElementById","root","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","themeStyles","welcomeGuide","welcomeGuideTemplate","blocksStore","__experimentalReapplyBlockTypeFilters","editPostStore","isFeatureActive","setIsListViewOpened","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","canInsert","blockType","isEditingTemplate","name","rootClientId","getBlockParentsByBlockName","length","documentMode","compatMode","console","warn","isIphone","window","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","reinitializeEditor","since","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;AANA;;AACA;;AAIA;;AAEA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AA0KA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA3MA;AACA;AACA;;AAgBA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CACNC,EADM,EAENC,QAFM,EAGNC,MAHM,EAINC,QAJM,EAKNC,YALM,EAML;AACD,QAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAT,CAAyBP,EAAzB,CAAf;AACA,QAAMQ,IAAI,GAAG,yBAAYH,MAAZ,CAAb;AAEA,sBAAUI,kBAAV,EAA6BC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AP,CAAiB,CAAjB,EAAoB,CAApB;AACA;AACD;AACD,KAlBD;AAmBA,GA3HA,CA6HD;;;AACAV,EAAAA,MAAM,CAACI,gBAAP,CAAyB,UAAzB,EAAuCO,CAAF,IAASA,CAAC,CAACC,cAAF,EAA9C,EAAkE,KAAlE;AACAZ,EAAAA,MAAM,CAACI,gBAAP,CAAyB,MAAzB,EAAmCO,CAAF,IAASA,CAAC,CAACC,cAAF,EAA1C,EAA8D,KAA9D;AAEApD,EAAAA,IAAI,CAACqD,MAAL,CACC,4BAAC,eAAD;AACC,IAAA,QAAQ,EAAG1D,QADZ;AAEC,IAAA,MAAM,EAAGD,MAFV;AAGC,IAAA,QAAQ,EAAGD,QAHZ;AAIC,IAAA,YAAY,EAAGG;AAJhB,IADD;AASA,SAAOI,IAAP;AACA;AAED;AACA;AACA;;;AACO,SAASsD,kBAAT,GAA8B;AACpC,2BAAY,gCAAZ,EAA8C;AAC7CC,IAAAA,KAAK,EAAE,KADsC;AAE7CC,IAAAA,OAAO,EAAE;AAFoC,GAA9C;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\tif ( select( editPostStore ).isFeatureActive( 'showListViewByDefault' ) ) {\n\t\tdispatch( editPostStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t/*\n\t * Prevent adding template part in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t/*\n\t * Prevent adding post content block (except in query block) in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removePostContentFromInserter',\n\t\t(\n\t\t\tcanInsert,\n\t\t\tblockType,\n\t\t\trootClientId,\n\t\t\t{ getBlockParentsByBlockName }\n\t\t) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/post-content'\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\tgetBlockParentsByBlockName( rootClientId, 'core/query' )\n\t\t\t\t\t\t.length > 0\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { store } from './store';\n"]}
|
|
1
|
+
{"version":3,"names":["_element","require","_blocks","_blockLibrary","_deprecated","_interopRequireDefault","_data","_hooks","_preferences","_widgets","_editor","_store","_pluginBlockSettingsMenuItem","_pluginDocumentSettingPanel","_pluginMoreMenuItem","_pluginPostPublishPanel","_pluginPostStatusInfo","_pluginPrePublishPanel","_pluginSidebar","_pluginSidebarMoreMenuItem","_fullscreenModeClose","_mainDashboardButton","initializeEditor","id","postType","postId","settings","initialEdits","target","document","getElementById","root","createRoot","dispatch","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","themeStyles","welcomeGuide","welcomeGuideTemplate","blocksStore","__experimentalReapplyBlockTypeFilters","select","editPostStore","isFeatureActive","setIsListViewOpened","registerCoreBlocks","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","process","env","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","addFilter","canInsert","blockType","isEditingTemplate","name","rootClientId","getBlockParentsByBlockName","length","documentMode","compatMode","console","warn","isIphone","window","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","createElement","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-post/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\tif (\n\t\tselect( editPostStore ).isFeatureActive( 'showListViewByDefault' ) &&\n\t\t! select( editPostStore ).isFeatureActive( 'distractionFree' )\n\t) {\n\t\tdispatch( editPostStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t/*\n\t * Prevent adding template part in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t/*\n\t * Prevent adding post content block (except in query block) in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removePostContentFromInserter',\n\t\t(\n\t\t\tcanInsert,\n\t\t\tblockType,\n\t\t\trootClientId,\n\t\t\t{ getBlockParentsByBlockName }\n\t\t) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/post-content'\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\tgetBlockParentsByBlockName( rootClientId, 'core/query' )\n\t\t\t\t\t\t.length > 0\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAAA,QAAA,GAAAC,OAAA;AANA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAIA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAQAA,OAAA;AACAA,OAAA;AACA,IAAAS,OAAA,GAAAL,sBAAA,CAAAJ,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AA8KA,IAAAW,4BAAA,GAAAP,sBAAA,CAAAJ,OAAA;AACA,IAAAY,2BAAA,GAAAR,sBAAA,CAAAJ,OAAA;AACA,IAAAa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