@wordpress/editor 13.33.0 → 13.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +132 -20
- package/build/components/autosave-monitor/index.js +15 -12
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/character-count/index.js +5 -0
- package/build/components/character-count/index.js.map +1 -1
- package/build/components/collapsible-block-toolbar/index.js +73 -0
- package/build/components/collapsible-block-toolbar/index.js.map +1 -0
- package/build/components/document-outline/check.js +8 -0
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/document-outline/index.js +11 -0
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-tools/index.js +0 -7
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build/components/editor-history/redo.js +11 -0
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +11 -0
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-snackbars/index.js +6 -0
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +7 -0
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +34 -0
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +1 -4
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/list-view-sidebar/index.js +1 -1
- package/build/components/list-view-sidebar/index.js.map +1 -1
- package/build/components/more-menu/copy-content-menu-item.js +59 -0
- package/build/components/more-menu/copy-content-menu-item.js.map +1 -0
- package/build/components/more-menu/index.js +119 -0
- package/build/components/more-menu/index.js.map +1 -0
- package/build/components/more-menu/tools-more-menu-group.js +23 -0
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build/components/more-menu/view-more-menu-group.js +24 -0
- package/build/components/more-menu/view-more-menu-group.js.map +1 -0
- package/build/components/page-attributes/check.js +8 -0
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/order.js +7 -0
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/panel.js +14 -8
- package/build/components/page-attributes/panel.js.map +1 -1
- package/build/components/page-attributes/parent.js +7 -0
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-post-publish-panel/index.js +1 -1
- package/build/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/plugin-pre-publish-panel/index.js +1 -1
- package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +1 -1
- package/build/components/plugin-sidebar/index.js.map +1 -1
- package/build/components/post-actions/actions.js +100 -5
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +30 -7
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/check.js +9 -0
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/index.js +6 -0
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/panel.js +5 -0
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-card-panel/index.js +14 -49
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-content-information/index.js +72 -0
- package/build/components/post-content-information/index.js.map +1 -0
- package/build/components/post-discussion/panel.js +9 -7
- package/build/components/post-discussion/panel.js.map +1 -1
- package/build/components/post-excerpt/check.js +0 -19
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js +52 -12
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js +118 -7
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-excerpt/plugin.js +2 -2
- package/build/components/post-excerpt/plugin.js.map +1 -1
- package/build/components/post-featured-image/index.js +1 -1
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-last-edited-panel/index.js +33 -0
- package/build/components/post-last-edited-panel/index.js.map +1 -0
- package/build/components/post-publish-button/post-publish-button-or-toggle.js +100 -0
- package/build/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
- package/build/components/post-schedule/panel.js +1 -1
- package/build/components/post-schedule/panel.js.map +1 -1
- package/build/components/post-status/index.js +9 -9
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-template/block-theme.js +2 -2
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js +0 -1
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/swap-template-button.js +2 -5
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-url/index.js +2 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/panel.js +1 -1
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/preferences-modal/enable-publish-sidebar.js +34 -0
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
- package/build/components/preferences-modal/index.js +8 -2
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +3 -1
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +23 -16
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/save-publish-panels/index.js +89 -0
- package/build/components/save-publish-panels/index.js.map +1 -0
- package/build/components/start-page-options/index.js +5 -1
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/private-apis.js +18 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/selectors.js +3 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/autosave-monitor/index.js +15 -13
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/character-count/index.js +6 -0
- package/build-module/components/character-count/index.js.map +1 -1
- package/build-module/components/collapsible-block-toolbar/index.js +65 -0
- package/build-module/components/collapsible-block-toolbar/index.js.map +1 -0
- package/build-module/components/document-outline/check.js +9 -0
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/document-outline/index.js +11 -0
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-tools/index.js +1 -8
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/editor-history/redo.js +11 -0
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +11 -0
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +6 -0
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +8 -0
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +35 -0
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +2 -5
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/list-view-sidebar/index.js +1 -1
- package/build-module/components/list-view-sidebar/index.js.map +1 -1
- package/build-module/components/more-menu/copy-content-menu-item.js +52 -0
- package/build-module/components/more-menu/copy-content-menu-item.js.map +1 -0
- package/build-module/components/more-menu/index.js +111 -0
- package/build-module/components/more-menu/index.js.map +1 -0
- package/build-module/components/more-menu/tools-more-menu-group.js +16 -0
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build-module/components/more-menu/view-more-menu-group.js +17 -0
- package/build-module/components/more-menu/view-more-menu-group.js.map +1 -0
- package/build-module/components/page-attributes/check.js +9 -0
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js +7 -0
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/panel.js +13 -6
- package/build-module/components/page-attributes/panel.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +7 -0
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-post-publish-panel/index.js +1 -1
- package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +1 -1
- package/build-module/components/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +100 -6
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +31 -8
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/check.js +10 -0
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/index.js +6 -0
- package/build-module/components/post-author/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +6 -0
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +16 -51
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-content-information/index.js +66 -0
- package/build-module/components/post-content-information/index.js.map +1 -0
- package/build-module/components/post-discussion/panel.js +8 -6
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/check.js +0 -19
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +52 -11
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +118 -8
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-excerpt/plugin.js +2 -2
- package/build-module/components/post-excerpt/plugin.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +1 -1
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-last-edited-panel/index.js +26 -0
- package/build-module/components/post-last-edited-panel/index.js.map +1 -0
- package/build-module/components/post-publish-button/post-publish-button-or-toggle.js +91 -0
- package/build-module/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
- package/build-module/components/post-schedule/panel.js +1 -1
- package/build-module/components/post-schedule/panel.js.map +1 -1
- package/build-module/components/post-status/index.js +9 -9
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +2 -2
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +0 -1
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +3 -6
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-url/index.js +2 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/panel.js +1 -1
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/preferences-modal/enable-publish-sidebar.js +27 -0
- package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +8 -2
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +3 -1
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +24 -17
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +80 -0
- package/build-module/components/save-publish-panels/index.js.map +1 -0
- package/build-module/components/start-page-options/index.js +5 -1
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/private-apis.js +18 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/selectors.js +3 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +207 -30
- package/build-style/style.css +207 -30
- package/package.json +35 -35
- package/src/components/autosave-monitor/index.js +15 -12
- package/src/components/character-count/index.js +5 -0
- package/src/components/collapsible-block-toolbar/index.js +77 -0
- package/src/components/collapsible-block-toolbar/style.scss +80 -0
- package/src/components/document-outline/check.js +8 -0
- package/src/components/document-outline/index.js +10 -0
- package/src/components/document-tools/index.js +0 -5
- package/src/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/src/components/editor-history/redo.js +10 -0
- package/src/components/editor-history/undo.js +10 -0
- package/src/components/editor-snackbars/index.js +5 -0
- package/src/components/entities-saved-states/style.scss +7 -0
- package/src/components/global-keyboard-shortcuts/index.js +7 -0
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +41 -0
- package/src/components/inserter-sidebar/index.js +2 -5
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
- package/src/components/list-view-sidebar/index.js +1 -1
- package/src/components/list-view-sidebar/style.scss +2 -2
- package/src/components/more-menu/copy-content-menu-item.js +51 -0
- package/src/components/more-menu/index.js +158 -0
- package/src/components/more-menu/tools-more-menu-group.js +11 -0
- package/src/components/more-menu/view-more-menu-group.js +13 -0
- package/src/components/page-attributes/check.js +8 -0
- package/src/components/page-attributes/order.js +6 -0
- package/src/components/page-attributes/panel.js +21 -17
- package/src/components/page-attributes/parent.js +6 -0
- package/src/components/plugin-post-publish-panel/index.js +1 -1
- package/src/components/plugin-pre-publish-panel/index.js +1 -1
- package/src/components/plugin-sidebar/index.js +1 -1
- package/src/components/post-actions/actions.js +120 -5
- package/src/components/post-actions/index.js +41 -7
- package/src/components/post-author/check.js +9 -0
- package/src/components/post-author/index.js +5 -0
- package/src/components/post-author/panel.js +5 -0
- package/src/components/post-card-panel/index.js +27 -82
- package/src/components/post-card-panel/style.scss +2 -6
- package/src/components/post-content-information/index.js +83 -0
- package/src/components/post-content-information/style.scss +6 -0
- package/src/components/post-discussion/panel.js +24 -20
- package/src/components/post-excerpt/check.js +0 -18
- package/src/components/post-excerpt/index.js +66 -15
- package/src/components/post-excerpt/panel.js +196 -19
- package/src/components/post-excerpt/plugin.js +2 -2
- package/src/components/post-excerpt/style.scss +24 -0
- package/src/components/post-featured-image/index.js +1 -1
- package/src/components/post-featured-image/style.scss +2 -8
- package/src/components/post-last-edited-panel/index.js +35 -0
- package/src/components/post-last-edited-panel/style.scss +6 -0
- package/src/components/post-panel-row/style.scss +3 -3
- package/src/components/post-publish-button/post-publish-button-or-toggle.js +102 -0
- package/src/components/post-publish-button/test/post-publish-button-or-toggle.js +63 -0
- package/src/components/post-publish-panel/style.scss +43 -0
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +225 -75
- package/src/components/post-schedule/panel.js +1 -1
- package/src/components/post-schedule/style.scss +2 -4
- package/src/components/post-status/index.js +84 -76
- package/src/components/post-status/style.scss +0 -1
- package/src/components/post-template/block-theme.js +2 -2
- package/src/components/post-template/classic-theme.js +0 -1
- package/src/components/post-template/swap-template-button.js +3 -6
- package/src/components/post-text-editor/style.scss +1 -1
- package/src/components/post-title/style.scss +1 -1
- package/src/components/post-url/index.js +1 -0
- package/src/components/post-url/panel.js +1 -1
- package/src/components/preferences-modal/enable-publish-sidebar.js +28 -0
- package/src/components/preferences-modal/index.js +14 -0
- package/src/components/preview-dropdown/index.js +3 -1
- package/src/components/provider/disable-non-page-content-blocks.js +23 -21
- package/src/components/save-publish-panels/index.js +96 -0
- package/src/components/save-publish-panels/style.scss +36 -0
- package/src/components/start-page-options/index.js +6 -1
- package/src/private-apis.js +18 -2
- package/src/store/selectors.js +3 -1
- package/src/style.scss +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useViewportMatch","DropdownMenu","MenuGroup","MenuItem","VisuallyHidden","Icon","__","check","desktop","mobile","tablet","external","useSelect","useDispatch","store","coreStore","preferencesStore","editorStore","PostPreviewButton","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","homeUrl","isTemplate","isViewable","showIconLabels","select","_getPostType$viewable","getDeviceType","getCurrentPostType","getUnstableBase","getPostType","get","_currentPostType","home","viewable","setDeviceType","isMobile","popoverProps","placement","toggleProps","className","size","showTooltip","__experimentalIsFocusable","menuProps","deviceIcons","createElement","icon","toLowerCase","label","disableOpenOnArrowDown","onClose","Fragment","onClick","href","target","as","role","textContent","onPreview"],"sources":["@wordpress/editor/src/components/preview-dropdown/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check, desktop, mobile, tablet, external } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostPreviewButton from '../post-preview-button';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst { deviceType, homeUrl, isTemplate, isViewable, showIconLabels } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getDeviceType, getCurrentPostType } = select( editorStore );\n\t\t\tconst { getUnstableBase, getPostType } = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst _currentPostType = getCurrentPostType();\n\t\t\treturn {\n\t\t\t\tdeviceType: getDeviceType(),\n\t\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t\t\tisTemplate: _currentPostType === 'wp_template',\n\t\t\t\tisViewable: getPostType( _currentPostType )?.viewable ?? false,\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t};\n\t\t}, [] );\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tif ( isMobile )
|
|
1
|
+
{"version":3,"names":["useViewportMatch","DropdownMenu","MenuGroup","MenuItem","VisuallyHidden","Icon","__","check","desktop","mobile","tablet","external","useSelect","useDispatch","store","coreStore","preferencesStore","editorStore","PostPreviewButton","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","homeUrl","isTemplate","isViewable","showIconLabels","select","_getPostType$viewable","getDeviceType","getCurrentPostType","getUnstableBase","getPostType","get","_currentPostType","home","viewable","setDeviceType","isMobile","popoverProps","placement","toggleProps","className","size","showTooltip","__experimentalIsFocusable","menuProps","deviceIcons","createElement","icon","toLowerCase","label","disableOpenOnArrowDown","onClose","Fragment","onClick","href","target","as","role","textContent","onPreview"],"sources":["@wordpress/editor/src/components/preview-dropdown/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check, desktop, mobile, tablet, external } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostPreviewButton from '../post-preview-button';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst { deviceType, homeUrl, isTemplate, isViewable, showIconLabels } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getDeviceType, getCurrentPostType } = select( editorStore );\n\t\t\tconst { getUnstableBase, getPostType } = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst _currentPostType = getCurrentPostType();\n\t\t\treturn {\n\t\t\t\tdeviceType: getDeviceType(),\n\t\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t\t\tisTemplate: _currentPostType === 'wp_template',\n\t\t\t\tisViewable: getPostType( _currentPostType )?.viewable ?? false,\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t};\n\t\t}, [] );\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tif ( isMobile ) {\n\t\treturn null;\n\t}\n\n\tconst popoverProps = {\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'editor-preview-dropdown__toggle',\n\t\tsize: 'compact',\n\t\tshowTooltip: ! showIconLabels,\n\t\tdisabled,\n\t\t__experimentalIsFocusable: disabled,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tmobile,\n\t\ttablet,\n\t\tdesktop,\n\t};\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"editor-preview-dropdown\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\tlabel={ __( 'View' ) }\n\t\t\tdisableOpenOnArrowDown={ disabled }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Desktop' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Desktop' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Desktop' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Tablet' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Tablet' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Tablet' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Mobile' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Mobile' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Mobile' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ isTemplate && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\t\tclassName=\"editor-preview-dropdown__button-external\"\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\tforceIsAutosaveable={ forceIsAutosaveable }\n\t\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\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\tonPreview={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SACCC,YAAY,EACZC,SAAS,EACTC,QAAQ,EACRC,cAAc,EACdC,IAAI,QACE,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,EAAEC,OAAO,EAAEC,MAAM,EAAEC,MAAM,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lB,aAAa,CAAE,QAAS,CAAG;IAC3CY,IAAI,EAAG3B,UAAU,KAAK,QAAQ,IAAIf;EAAO,GAEvCD,EAAE,CAAE,QAAS,CACN,CACA,CAAC,EACVkB,UAAU,IACXwB,aAAA,CAAC9C,SAAS,QACT8C,aAAA,CAAC7C,QAAQ;IACRqD,IAAI,EAAGjC,OAAS;IAChBkC,MAAM,EAAC,QAAQ;IACfR,IAAI,EAAGtC,QAAU;IACjB4C,OAAO,EAAGF;EAAS,GAEjB/C,EAAE,CAAE,WAAY,CAAC,EACnB0C,aAAA,CAAC5C,cAAc;IAACsD,EAAE,EAAC;EAAM,GAEvB;EACApD,EAAE,CAAE,sBAAuB,CAEb,CACP,CACA,CACX,EACCmB,UAAU,IACXuB,aAAA,CAAC9C,SAAS,QACT8C,aAAA,CAAC9B,iBAAiB;IACjBwB,SAAS,EAAC,0CAA0C;IACpDiB,IAAI,EAAC,UAAU;IACfvC,mBAAmB,EAAGA,mBAAqB;IAC3CwC,WAAW,EACVZ,aAAA,CAAAM,QAAA,QACGhD,EAAE,CAAE,oBAAqB,CAAC,EAC5B0C,aAAA,CAAC3C,IAAI;MAAC4C,IAAI,EAAGtC;IAAU,CAAE,CACxB,CACF;IACDkD,SAAS,EAAGR;EAAS,CACrB,CACS,CAEX,CAEU,CAAC;AAEjB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSelect,
|
|
4
|
+
import { useSelect, useRegistry } from '@wordpress/data';
|
|
5
5
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
6
6
|
import { useEffect } from '@wordpress/element';
|
|
7
7
|
import { applyFilters } from '@wordpress/hooks';
|
|
@@ -12,6 +12,8 @@ const CONTENT_ONLY_BLOCKS = applyFilters('editor.postContentBlockTypes', ['core/
|
|
|
12
12
|
* page content to be edited.
|
|
13
13
|
*/
|
|
14
14
|
export default function DisableNonPageContentBlocks() {
|
|
15
|
+
// Note that there are two separate subscription because the result for each
|
|
16
|
+
// returns a new array.
|
|
15
17
|
const contentOnlyIds = useSelect(select => {
|
|
16
18
|
const {
|
|
17
19
|
getBlocksByName,
|
|
@@ -35,28 +37,33 @@ export default function DisableNonPageContentBlocks() {
|
|
|
35
37
|
} = select(blockEditorStore);
|
|
36
38
|
return getBlocksByName(['core/template-part']).flatMap(clientId => getBlockOrder(clientId));
|
|
37
39
|
}, []);
|
|
38
|
-
const
|
|
39
|
-
setBlockEditingMode,
|
|
40
|
-
unsetBlockEditingMode
|
|
41
|
-
} = useDispatch(blockEditorStore);
|
|
40
|
+
const registry = useRegistry();
|
|
42
41
|
useEffect(() => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
setBlockEditingMode(
|
|
49
|
-
}
|
|
50
|
-
return () => {
|
|
51
|
-
unsetBlockEditingMode('');
|
|
42
|
+
const {
|
|
43
|
+
setBlockEditingMode,
|
|
44
|
+
unsetBlockEditingMode
|
|
45
|
+
} = registry.dispatch(blockEditorStore);
|
|
46
|
+
registry.batch(() => {
|
|
47
|
+
setBlockEditingMode('', 'disabled');
|
|
52
48
|
for (const clientId of contentOnlyIds) {
|
|
53
|
-
|
|
49
|
+
setBlockEditingMode(clientId, 'contentOnly');
|
|
54
50
|
}
|
|
55
51
|
for (const clientId of disabledIds) {
|
|
56
|
-
|
|
52
|
+
setBlockEditingMode(clientId, 'disabled');
|
|
57
53
|
}
|
|
54
|
+
});
|
|
55
|
+
return () => {
|
|
56
|
+
registry.batch(() => {
|
|
57
|
+
unsetBlockEditingMode('');
|
|
58
|
+
for (const clientId of contentOnlyIds) {
|
|
59
|
+
unsetBlockEditingMode(clientId);
|
|
60
|
+
}
|
|
61
|
+
for (const clientId of disabledIds) {
|
|
62
|
+
unsetBlockEditingMode(clientId);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
58
65
|
};
|
|
59
|
-
}, [contentOnlyIds, disabledIds,
|
|
66
|
+
}, [contentOnlyIds, disabledIds, registry]);
|
|
60
67
|
return null;
|
|
61
68
|
}
|
|
62
69
|
//# sourceMappingURL=disable-non-page-content-blocks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","
|
|
1
|
+
{"version":3,"names":["useSelect","useRegistry","store","blockEditorStore","useEffect","applyFilters","CONTENT_ONLY_BLOCKS","DisableNonPageContentBlocks","contentOnlyIds","select","getBlocksByName","getBlockParents","getBlockName","filter","clientId","every","parentClientId","parentBlockName","includes","disabledIds","getBlockOrder","flatMap","registry","setBlockEditingMode","unsetBlockEditingMode","dispatch","batch"],"sources":["@wordpress/editor/src/components/provider/disable-non-page-content-blocks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useRegistry } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { applyFilters } from '@wordpress/hooks';\n\nconst CONTENT_ONLY_BLOCKS = applyFilters( 'editor.postContentBlockTypes', [\n\t'core/post-title',\n\t'core/post-featured-image',\n\t'core/post-content',\n\t'core/template-part',\n] );\n\n/**\n * Component that when rendered, makes it so that the site editor allows only\n * page content to be edited.\n */\nexport default function DisableNonPageContentBlocks() {\n\t// Note that there are two separate subscription because the result for each\n\t// returns a new array.\n\tconst contentOnlyIds = useSelect( ( select ) => {\n\t\tconst { getBlocksByName, getBlockParents, getBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\treturn getBlocksByName( CONTENT_ONLY_BLOCKS ).filter( ( clientId ) =>\n\t\t\tgetBlockParents( clientId ).every( ( parentClientId ) => {\n\t\t\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\t\t\treturn (\n\t\t\t\t\t// Ignore descendents of the query block.\n\t\t\t\t\tparentBlockName !== 'core/query' &&\n\t\t\t\t\t// Enable only the top-most block.\n\t\t\t\t\t! CONTENT_ONLY_BLOCKS.includes( parentBlockName )\n\t\t\t\t);\n\t\t\t} )\n\t\t);\n\t}, [] );\n\tconst disabledIds = useSelect( ( select ) => {\n\t\tconst { getBlocksByName, getBlockOrder } = select( blockEditorStore );\n\t\treturn getBlocksByName( [ 'core/template-part' ] ).flatMap(\n\t\t\t( clientId ) => getBlockOrder( clientId )\n\t\t);\n\t}, [] );\n\n\tconst registry = useRegistry();\n\n\tuseEffect( () => {\n\t\tconst { setBlockEditingMode, unsetBlockEditingMode } =\n\t\t\tregistry.dispatch( blockEditorStore );\n\n\t\tregistry.batch( () => {\n\t\t\tsetBlockEditingMode( '', 'disabled' );\n\t\t\tfor ( const clientId of contentOnlyIds ) {\n\t\t\t\tsetBlockEditingMode( clientId, 'contentOnly' );\n\t\t\t}\n\t\t\tfor ( const clientId of disabledIds ) {\n\t\t\t\tsetBlockEditingMode( clientId, 'disabled' );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tregistry.batch( () => {\n\t\t\t\tunsetBlockEditingMode( '' );\n\t\t\t\tfor ( const clientId of contentOnlyIds ) {\n\t\t\t\t\tunsetBlockEditingMode( clientId );\n\t\t\t\t}\n\t\t\t\tfor ( const clientId of disabledIds ) {\n\t\t\t\t\tunsetBlockEditingMode( clientId );\n\t\t\t\t}\n\t\t\t} );\n\t\t};\n\t}, [ contentOnlyIds, disabledIds, registry ] );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,YAAY,QAAQ,kBAAkB;AAE/C,MAAMC,mBAAmB,GAAGD,YAAY,CAAE,8BAA8B,EAAE,CACzE,iBAAiB,EACjB,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,CACnB,CAAC;;AAEH;AACA;AACA;AACA;AACA,eAAe,SAASE,2BAA2BA,CAAA,EAAG;EACrD;EACA;EAC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H,OAAO,MAAM;MACZQ,QAAQ,CAACI,KAAK,CAAE,MAAM;QACrBF,qBAAqB,CAAE,EAAG,CAAC;QAC3B,KAAM,MAAMV,QAAQ,IAAIN,cAAc,EAAG;UACxCgB,qBAAqB,CAAEV,QAAS,CAAC;QAClC;QACA,KAAM,MAAMA,QAAQ,IAAIK,WAAW,EAAG;UACrCK,qBAAqB,CAAEV,QAAS,CAAC;QAClC;MACD,CAAE,CAAC;IACJ,CAAC;EACF,CAAC,EAAE,CAAEN,cAAc,EAAEW,WAAW,EAAEG,QAAQ,CAAG,CAAC;EAE9C,OAAO,IAAI;AACZ","ignoreList":[]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
+
import { Button, createSlotFill } from '@wordpress/components';
|
|
7
|
+
import { __ } from '@wordpress/i18n';
|
|
8
|
+
import { useCallback } from '@wordpress/element';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import EntitiesSavedStates from '../entities-saved-states';
|
|
14
|
+
import PostPublishPanel from '../post-publish-panel';
|
|
15
|
+
import PluginPrePublishPanel from '../plugin-pre-publish-panel';
|
|
16
|
+
import PluginPostPublishPanel from '../plugin-post-publish-panel';
|
|
17
|
+
import { store as editorStore } from '../../store';
|
|
18
|
+
const {
|
|
19
|
+
Fill,
|
|
20
|
+
Slot
|
|
21
|
+
} = createSlotFill('ActionsPanel');
|
|
22
|
+
export const ActionsPanelFill = Fill;
|
|
23
|
+
export default function SavePublishPanels({
|
|
24
|
+
setEntitiesSavedStatesCallback,
|
|
25
|
+
closeEntitiesSavedStates,
|
|
26
|
+
isEntitiesSavedStatesOpen,
|
|
27
|
+
forceIsDirtyPublishPanel
|
|
28
|
+
}) {
|
|
29
|
+
const {
|
|
30
|
+
closePublishSidebar,
|
|
31
|
+
togglePublishSidebar
|
|
32
|
+
} = useDispatch(editorStore);
|
|
33
|
+
const {
|
|
34
|
+
publishSidebarOpened,
|
|
35
|
+
hasNonPostEntityChanges
|
|
36
|
+
} = useSelect(select => ({
|
|
37
|
+
publishSidebarOpened: select(editorStore).isPublishSidebarOpened(),
|
|
38
|
+
hasNonPostEntityChanges: select(editorStore).hasNonPostEntityChanges()
|
|
39
|
+
}), []);
|
|
40
|
+
const openEntitiesSavedStates = useCallback(() => setEntitiesSavedStatesCallback(true), []);
|
|
41
|
+
|
|
42
|
+
// It is ok for these components to be unmounted when not in visual use.
|
|
43
|
+
// We don't want more than one present at a time, decide which to render.
|
|
44
|
+
let unmountableContent;
|
|
45
|
+
if (publishSidebarOpened) {
|
|
46
|
+
unmountableContent = createElement(PostPublishPanel, {
|
|
47
|
+
onClose: closePublishSidebar,
|
|
48
|
+
forceIsDirty: forceIsDirtyPublishPanel,
|
|
49
|
+
PrePublishExtension: PluginPrePublishPanel.Slot,
|
|
50
|
+
PostPublishExtension: PluginPostPublishPanel.Slot
|
|
51
|
+
});
|
|
52
|
+
} else if (hasNonPostEntityChanges) {
|
|
53
|
+
unmountableContent = createElement("div", {
|
|
54
|
+
className: "editor-layout__toggle-entities-saved-states-panel"
|
|
55
|
+
}, createElement(Button, {
|
|
56
|
+
variant: "secondary",
|
|
57
|
+
className: "editor-layout__toggle-entities-saved-states-panel-button",
|
|
58
|
+
onClick: openEntitiesSavedStates,
|
|
59
|
+
"aria-expanded": false
|
|
60
|
+
}, __('Open save panel')));
|
|
61
|
+
} else {
|
|
62
|
+
unmountableContent = createElement("div", {
|
|
63
|
+
className: "editor-layout__toggle-publish-panel"
|
|
64
|
+
}, createElement(Button, {
|
|
65
|
+
variant: "secondary",
|
|
66
|
+
className: "editor-layout__toggle-publish-panel-button",
|
|
67
|
+
onClick: togglePublishSidebar,
|
|
68
|
+
"aria-expanded": false
|
|
69
|
+
}, __('Open publish panel')));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Since EntitiesSavedStates controls its own panel, we can keep it
|
|
73
|
+
// always mounted to retain its own component state (such as checkboxes).
|
|
74
|
+
return createElement(Fragment, null, isEntitiesSavedStatesOpen && createElement(EntitiesSavedStates, {
|
|
75
|
+
close: closeEntitiesSavedStates
|
|
76
|
+
}), createElement(Slot, {
|
|
77
|
+
bubblesVirtually: true
|
|
78
|
+
}), !isEntitiesSavedStatesOpen && unmountableContent);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","Button","createSlotFill","__","useCallback","EntitiesSavedStates","PostPublishPanel","PluginPrePublishPanel","PluginPostPublishPanel","store","editorStore","Fill","Slot","ActionsPanelFill","SavePublishPanels","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","isEntitiesSavedStatesOpen","forceIsDirtyPublishPanel","closePublishSidebar","togglePublishSidebar","publishSidebarOpened","hasNonPostEntityChanges","select","isPublishSidebarOpened","openEntitiesSavedStates","unmountableContent","createElement","onClose","forceIsDirty","PrePublishExtension","PostPublishExtension","className","variant","onClick","Fragment","close","bubblesVirtually"],"sources":["@wordpress/editor/src/components/save-publish-panels/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, createSlotFill } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EntitiesSavedStates from '../entities-saved-states';\nimport PostPublishPanel from '../post-publish-panel';\nimport PluginPrePublishPanel from '../plugin-pre-publish-panel';\nimport PluginPostPublishPanel from '../plugin-post-publish-panel';\nimport { store as editorStore } from '../../store';\n\nconst { Fill, Slot } = createSlotFill( 'ActionsPanel' );\n\nexport const ActionsPanelFill = Fill;\n\nexport default function SavePublishPanels( {\n\tsetEntitiesSavedStatesCallback,\n\tcloseEntitiesSavedStates,\n\tisEntitiesSavedStatesOpen,\n\tforceIsDirtyPublishPanel,\n} ) {\n\tconst { closePublishSidebar, togglePublishSidebar } =\n\t\tuseDispatch( editorStore );\n\tconst { publishSidebarOpened, hasNonPostEntityChanges } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpublishSidebarOpened:\n\t\t\t\tselect( editorStore ).isPublishSidebarOpened(),\n\t\t\thasNonPostEntityChanges:\n\t\t\t\tselect( editorStore ).hasNonPostEntityChanges(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst openEntitiesSavedStates = useCallback(\n\t\t() => setEntitiesSavedStatesCallback( true ),\n\t\t[]\n\t);\n\n\t// It is ok for these components to be unmounted when not in visual use.\n\t// We don't want more than one present at a time, decide which to render.\n\tlet unmountableContent;\n\tif ( publishSidebarOpened ) {\n\t\tunmountableContent = (\n\t\t\t<PostPublishPanel\n\t\t\t\tonClose={ closePublishSidebar }\n\t\t\t\tforceIsDirty={ forceIsDirtyPublishPanel }\n\t\t\t\tPrePublishExtension={ PluginPrePublishPanel.Slot }\n\t\t\t\tPostPublishExtension={ PluginPostPublishPanel.Slot }\n\t\t\t/>\n\t\t);\n\t} else if ( hasNonPostEntityChanges ) {\n\t\tunmountableContent = (\n\t\t\t<div className=\"editor-layout__toggle-entities-saved-states-panel\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"editor-layout__toggle-entities-saved-states-panel-button\"\n\t\t\t\t\tonClick={ openEntitiesSavedStates }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\tunmountableContent = (\n\t\t\t<div className=\"editor-layout__toggle-publish-panel\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"editor-layout__toggle-publish-panel-button\"\n\t\t\t\t\tonClick={ togglePublishSidebar }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open publish panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Since EntitiesSavedStates controls its own panel, we can keep it\n\t// always mounted to retain its own component state (such as checkboxes).\n\treturn (\n\t\t<>\n\t\t\t{ isEntitiesSavedStatesOpen && (\n\t\t\t\t<EntitiesSavedStates close={ closeEntitiesSavedStates } />\n\t\t\t) }\n\t\t\t<Slot bubblesVirtually />\n\t\t\t{ ! isEntitiesSavedStatesOpen && unmountableContent }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,cAAc,QAAQ,uBAAuB;AAC9D,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,gBAAgB,MAAM,uBAAuB;AACpD,OAAOC,qBAAqB,MAAM,6BAA6B;AAC/D,OAAOC,sBAAsB,MAAM,8BAA8B;AACjE,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,MAAM;EAAEC,IAAI;EAAEC;AAAK,CAAC,GAAGV,cAAc,CAAE,cAAe,CAAC;AAEvD,OAAO,MAAMW,gBAAgB,GAAGF,IAAI;AAEpC,eAAe,SAASG,iBAAiBA,CAAE;EAC1CC,8BAA8B;EAC9BC,wBAAwB;EACxBC,yBAAyB;EACzBC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC,mBAAmB;IAAEC;EAAqB,CAAC,GAClDpB,WAAW,CAAEU,WAAY,CAAC;EAC3B,MAAM;IAAEW,oBAAoB;IAAEC;EAAwB,CAAC,GAAGvB,SAAS,CAChEwB,MAAM,KAAQ;IACfF,oBAAoB,EACnBE,MAAM,CAAEb,WAAY,CAAC,CAACc,sBAAsB,CAA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","ignoreList":[]}
|
|
@@ -9,6 +9,7 @@ import { store as blockEditorStore, __experimentalBlockPatternsList as BlockPatt
|
|
|
9
9
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
10
|
import { useAsyncList } from '@wordpress/compose';
|
|
11
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
12
|
+
import { __unstableSerializeAndClean } from '@wordpress/blocks';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
@@ -70,7 +71,10 @@ function PatternSelection({
|
|
|
70
71
|
shownPatterns: shownBlockPatterns,
|
|
71
72
|
onClickPattern: (_pattern, blocks) => {
|
|
72
73
|
editEntityRecord('postType', postType, postId, {
|
|
73
|
-
blocks
|
|
74
|
+
blocks,
|
|
75
|
+
content: ({
|
|
76
|
+
blocks: blocksForSerialization = []
|
|
77
|
+
}) => __unstableSerializeAndClean(blocksForSerialization)
|
|
74
78
|
});
|
|
75
79
|
onChoosePattern();
|
|
76
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Modal","__","useState","useMemo","useEffect","store","blockEditorStore","__experimentalBlockPatternsList","BlockPatternsList","useSelect","useDispatch","useAsyncList","coreStore","editorStore","useStartPatterns","blockPatternsWithPostContentBlockType","postType","select","getPatternsByBlockTypes","getBlocksByName","getCurrentPostType","getRenderingMode","rootClientId","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","shownBlockPatterns","editEntityRecord","postId","getCurrentPostId","createElement","shownPatterns","onClickPattern","_pattern","blocks","StartPageOptionsModal","onClose","startPatterns","hasStartPattern","length","title","isFullScreen","onRequestClose","className","StartPageOptions","isClosed","setIsClosed","shouldEnableModal","isEditedPostDirty","isEditedPostEmpty","getEditorSettings","__unstableIsPreviewMode","isPreviewMode"],"sources":["@wordpress/editor/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction useStartPatterns() {\n\t// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,\n\t// and it has no postTypes declared and the current post type is page or if\n\t// the current post type is part of the postTypes declared.\n\tconst { blockPatternsWithPostContentBlockType, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPatternsByBlockTypes, getBlocksByName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getCurrentPostType, getRenderingMode } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst rootClientId =\n\t\t\t\tgetRenderingMode() === 'post-only'\n\t\t\t\t\t? ''\n\t\t\t\t\t: getBlocksByName( 'core/post-content' )?.[ 0 ];\n\t\t\treturn {\n\t\t\t\tblockPatternsWithPostContentBlockType: getPatternsByBlockTypes(\n\t\t\t\t\t'core/post-content',\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn useMemo( () => {\n\t\t// filter patterns without postTypes declared if the current postType is page\n\t\t// or patterns that declare the current postType in its post type array.\n\t\treturn blockPatternsWithPostContentBlockType.filter( ( pattern ) => {\n\t\t\treturn (\n\t\t\t\t( postType === 'page' && ! pattern.postTypes ) ||\n\t\t\t\t( Array.isArray( pattern.postTypes ) &&\n\t\t\t\t\tpattern.postTypes.includes( postType ) )\n\t\t\t);\n\t\t} );\n\t}, [ postType, blockPatternsWithPostContentBlockType ] );\n}\n\nfunction PatternSelection( { blockPatterns, onChoosePattern } ) {\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\tonClickPattern={ ( _pattern, blocks ) => {\n\t\t\t\teditEntityRecord( 'postType', postType, postId, { blocks } );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartPageOptionsModal( { onClose } ) {\n\tconst startPatterns = useStartPatterns();\n\tconst hasStartPattern = startPatterns.length > 0;\n\n\tif ( ! hasStartPattern ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tisFullScreen\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<div className=\"editor-start-page-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tblockPatterns={ startPatterns }\n\t\t\t\t\tonChoosePattern={ onClose }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartPageOptions() {\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { shouldEnableModal, postType, postId } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditedPostDirty,\n\t\t\tisEditedPostEmpty,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t} = select( editorStore );\n\t\tconst { __unstableIsPreviewMode: isPreviewMode } = getEditorSettings();\n\n\t\treturn {\n\t\t\tshouldEnableModal:\n\t\t\t\t! isPreviewMode && ! isEditedPostDirty() && isEditedPostEmpty(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t// Should reset the modal state when navigating to a new page/post.\n\t\tsetIsClosed( false );\n\t}, [ postType, postId ] );\n\n\tif ( ! shouldEnableModal || isClosed ) {\n\t\treturn null;\n\t}\n\n\treturn <StartPageOptionsModal onClose={ () => setIsClosed( true ) } />;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACjE,SACCC,KAAK,IAAIC,gBAAgB,EACzBC,+BAA+B,IAAIC,iBAAiB,QAC9C,yBAAyB;AAChC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASN,KAAK,IAAIO,SAAS,QAAQ,sBAAsB;;
|
|
1
|
+
{"version":3,"names":["Modal","__","useState","useMemo","useEffect","store","blockEditorStore","__experimentalBlockPatternsList","BlockPatternsList","useSelect","useDispatch","useAsyncList","coreStore","__unstableSerializeAndClean","editorStore","useStartPatterns","blockPatternsWithPostContentBlockType","postType","select","getPatternsByBlockTypes","getBlocksByName","getCurrentPostType","getRenderingMode","rootClientId","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","shownBlockPatterns","editEntityRecord","postId","getCurrentPostId","createElement","shownPatterns","onClickPattern","_pattern","blocks","content","blocksForSerialization","StartPageOptionsModal","onClose","startPatterns","hasStartPattern","length","title","isFullScreen","onRequestClose","className","StartPageOptions","isClosed","setIsClosed","shouldEnableModal","isEditedPostDirty","isEditedPostEmpty","getEditorSettings","__unstableIsPreviewMode","isPreviewMode"],"sources":["@wordpress/editor/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction useStartPatterns() {\n\t// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,\n\t// and it has no postTypes declared and the current post type is page or if\n\t// the current post type is part of the postTypes declared.\n\tconst { blockPatternsWithPostContentBlockType, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPatternsByBlockTypes, getBlocksByName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getCurrentPostType, getRenderingMode } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst rootClientId =\n\t\t\t\tgetRenderingMode() === 'post-only'\n\t\t\t\t\t? ''\n\t\t\t\t\t: getBlocksByName( 'core/post-content' )?.[ 0 ];\n\t\t\treturn {\n\t\t\t\tblockPatternsWithPostContentBlockType: getPatternsByBlockTypes(\n\t\t\t\t\t'core/post-content',\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn useMemo( () => {\n\t\t// filter patterns without postTypes declared if the current postType is page\n\t\t// or patterns that declare the current postType in its post type array.\n\t\treturn blockPatternsWithPostContentBlockType.filter( ( pattern ) => {\n\t\t\treturn (\n\t\t\t\t( postType === 'page' && ! pattern.postTypes ) ||\n\t\t\t\t( Array.isArray( pattern.postTypes ) &&\n\t\t\t\t\tpattern.postTypes.includes( postType ) )\n\t\t\t);\n\t\t} );\n\t}, [ postType, blockPatternsWithPostContentBlockType ] );\n}\n\nfunction PatternSelection( { blockPatterns, onChoosePattern } ) {\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\tonClickPattern={ ( _pattern, blocks ) => {\n\t\t\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\t\t\tblocks,\n\t\t\t\t\tcontent: ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t\t\t\t__unstableSerializeAndClean( blocksForSerialization ),\n\t\t\t\t} );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartPageOptionsModal( { onClose } ) {\n\tconst startPatterns = useStartPatterns();\n\tconst hasStartPattern = startPatterns.length > 0;\n\n\tif ( ! hasStartPattern ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tisFullScreen\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<div className=\"editor-start-page-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tblockPatterns={ startPatterns }\n\t\t\t\t\tonChoosePattern={ onClose }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartPageOptions() {\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { shouldEnableModal, postType, postId } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditedPostDirty,\n\t\t\tisEditedPostEmpty,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t} = select( editorStore );\n\t\tconst { __unstableIsPreviewMode: isPreviewMode } = getEditorSettings();\n\n\t\treturn {\n\t\t\tshouldEnableModal:\n\t\t\t\t! isPreviewMode && ! isEditedPostDirty() && isEditedPostEmpty(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t// Should reset the modal state when navigating to a new page/post.\n\t\tsetIsClosed( false );\n\t}, [ postType, postId ] );\n\n\tif ( ! shouldEnableModal || isClosed ) {\n\t\treturn null;\n\t}\n\n\treturn <StartPageOptionsModal onClose={ () => setIsClosed( true ) } />;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACjE,SACCC,KAAK,IAAIC,gBAAgB,EACzBC,+BAA+B,IAAIC,iBAAiB,QAC9C,yBAAyB;AAChC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASN,KAAK,IAAIO,SAAS,QAAQ,sBAAsB;AACzD,SAASC,2BAA2B,QAAQ,mBAAmB;;AAE/D;AACA;AACA;AACA,SAASR,KAAK,IAAIS,WAAW,QAAQ,aAAa;AAElD,SAASC,gBAAgBA,CAAA,EAAG;EAC3B;EACA;EACA;EACA,MAAM;IAAEC,qCAAqC;IAAEC;EAAS,CAAC,GAAGR,SAAS,CAClES,MAAM,IAAM;IACb,MAAM;MAAEC,uBAAuB;MAAEC;IAAgB,CAAC,GACjDF,MAAM,CAAEZ,gBAAiB,CAAC;IAC3B,MAAM;MAAEe,kBAAkB;MAAEC;IAAiB,CAAC,GAC7CJ,MAAM,CAAEJ,WAAY,CAAC;IACtB,MAAMS,YAAY,GACjBD,gBAAgB,CAAC,CAAC,KAAK,WAAW,GAC/B,EAAE,GACFF,eAAe,CAAE,mBAAoB,CAAC,GAAI,CAAC,CAAE;IACjD,OAAO;MACNJ,qCAAqC,EAAEG,uBAAuB,CAC7D,mBAAmB,EACnBI,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AAE,EAAG,CAAC;EAEPhC,SAAS,CAAE,MAAM;IAChB;IACAmD,WAAW,CAAE,KAAM,CAAC;EACrB,CAAC,EAAE,CAAEtC,QAAQ,EAAEkB,MAAM,CAAG,CAAC;EAEzB,IAAK,CAAEqB,iBAAiB,IAAIF,QAAQ,EAAG;IACtC,OAAO,IAAI;EACZ;EAEA,OAAOjB,aAAA,CAACO,qBAAqB;IAACC,OAAO,EAAGA,CAAA,KAAMU,WAAW,CAAE,IAAK;EAAG,CAAE,CAAC;AACvE","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ import * as interfaceApis from '@wordpress/interface';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
+
import CollapsableBlockToolbar from './components/collapsible-block-toolbar';
|
|
9
10
|
import EditorCanvas from './components/editor-canvas';
|
|
10
11
|
import { ExperimentalEditorProvider } from './components/provider';
|
|
11
12
|
import { lock } from './lock-unlock';
|
|
@@ -15,7 +16,7 @@ import useBlockEditorSettings from './components/provider/use-block-editor-setti
|
|
|
15
16
|
import DocumentTools from './components/document-tools';
|
|
16
17
|
import InserterSidebar from './components/inserter-sidebar';
|
|
17
18
|
import ListViewSidebar from './components/list-view-sidebar';
|
|
18
|
-
import
|
|
19
|
+
import MoreMenu from './components/more-menu';
|
|
19
20
|
import PatternOverridesPanel from './components/pattern-overrides-panel';
|
|
20
21
|
import PluginPostExcerpt from './components/post-excerpt/plugin';
|
|
21
22
|
import PostPanelRow from './components/post-panel-row';
|
|
@@ -26,19 +27,27 @@ import PostActions from './components/post-actions';
|
|
|
26
27
|
import { usePostActions } from './components/post-actions/actions';
|
|
27
28
|
import PostCardPanel from './components/post-card-panel';
|
|
28
29
|
import PostStatus from './components/post-status';
|
|
30
|
+
import ToolsMoreMenuGroup from './components/more-menu/tools-more-menu-group';
|
|
31
|
+
import ViewMoreMenuGroup from './components/more-menu/view-more-menu-group';
|
|
32
|
+
import { PrivatePostExcerptPanel } from './components/post-excerpt/panel';
|
|
33
|
+
import PostPublishButtonOrToggle from './components/post-publish-button/post-publish-button-or-toggle';
|
|
34
|
+
import SavePublishPanels from './components/save-publish-panels';
|
|
35
|
+
import PostContentInformation from './components/post-content-information';
|
|
36
|
+
import PostLastEditedPanel from './components/post-last-edited-panel';
|
|
29
37
|
const {
|
|
30
38
|
store: interfaceStore,
|
|
31
39
|
...remainingInterfaceApis
|
|
32
40
|
} = interfaceApis;
|
|
33
41
|
export const privateApis = {};
|
|
34
42
|
lock(privateApis, {
|
|
43
|
+
CollapsableBlockToolbar,
|
|
35
44
|
DocumentTools,
|
|
36
45
|
EditorCanvas,
|
|
37
46
|
ExperimentalEditorProvider,
|
|
38
47
|
EntitiesSavedStatesExtensible,
|
|
39
48
|
InserterSidebar,
|
|
40
49
|
ListViewSidebar,
|
|
41
|
-
|
|
50
|
+
MoreMenu,
|
|
42
51
|
PatternOverridesPanel,
|
|
43
52
|
PluginPostExcerpt,
|
|
44
53
|
PostActions,
|
|
@@ -49,6 +58,13 @@ lock(privateApis, {
|
|
|
49
58
|
usePostActions,
|
|
50
59
|
PostCardPanel,
|
|
51
60
|
PostStatus,
|
|
61
|
+
ToolsMoreMenuGroup,
|
|
62
|
+
ViewMoreMenuGroup,
|
|
63
|
+
PrivatePostExcerptPanel,
|
|
64
|
+
PostPublishButtonOrToggle,
|
|
65
|
+
SavePublishPanels,
|
|
66
|
+
PostContentInformation,
|
|
67
|
+
PostLastEditedPanel,
|
|
52
68
|
// This is a temporary private API while we're updating the site editor to use EditorProvider.
|
|
53
69
|
useAutoSwitchEditorSidebars,
|
|
54
70
|
useBlockEditorSettings,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["interfaceApis","EditorCanvas","ExperimentalEditorProvider","lock","EntitiesSavedStatesExtensible","useAutoSwitchEditorSidebars","useBlockEditorSettings","DocumentTools","InserterSidebar","ListViewSidebar","
|
|
1
|
+
{"version":3,"names":["interfaceApis","CollapsableBlockToolbar","EditorCanvas","ExperimentalEditorProvider","lock","EntitiesSavedStatesExtensible","useAutoSwitchEditorSidebars","useBlockEditorSettings","DocumentTools","InserterSidebar","ListViewSidebar","MoreMenu","PatternOverridesPanel","PluginPostExcerpt","PostPanelRow","PostViewLink","PreviewDropdown","PreferencesModal","PostActions","usePostActions","PostCardPanel","PostStatus","ToolsMoreMenuGroup","ViewMoreMenuGroup","PrivatePostExcerptPanel","PostPublishButtonOrToggle","SavePublishPanels","PostContentInformation","PostLastEditedPanel","store","interfaceStore","remainingInterfaceApis","privateApis"],"sources":["@wordpress/editor/src/private-apis.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport * as interfaceApis from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport CollapsableBlockToolbar from './components/collapsible-block-toolbar';\nimport EditorCanvas from './components/editor-canvas';\nimport { ExperimentalEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { EntitiesSavedStatesExtensible } from './components/entities-saved-states';\nimport useAutoSwitchEditorSidebars from './components/provider/use-auto-switch-editor-sidebars';\nimport useBlockEditorSettings from './components/provider/use-block-editor-settings';\nimport DocumentTools from './components/document-tools';\nimport InserterSidebar from './components/inserter-sidebar';\nimport ListViewSidebar from './components/list-view-sidebar';\nimport MoreMenu from './components/more-menu';\nimport PatternOverridesPanel from './components/pattern-overrides-panel';\nimport PluginPostExcerpt from './components/post-excerpt/plugin';\nimport PostPanelRow from './components/post-panel-row';\nimport PostViewLink from './components/post-view-link';\nimport PreviewDropdown from './components/preview-dropdown';\nimport PreferencesModal from './components/preferences-modal';\nimport PostActions from './components/post-actions';\nimport { usePostActions } from './components/post-actions/actions';\nimport PostCardPanel from './components/post-card-panel';\nimport PostStatus from './components/post-status';\nimport ToolsMoreMenuGroup from './components/more-menu/tools-more-menu-group';\nimport ViewMoreMenuGroup from './components/more-menu/view-more-menu-group';\nimport { PrivatePostExcerptPanel } from './components/post-excerpt/panel';\nimport PostPublishButtonOrToggle from './components/post-publish-button/post-publish-button-or-toggle';\nimport SavePublishPanels from './components/save-publish-panels';\nimport PostContentInformation from './components/post-content-information';\nimport PostLastEditedPanel from './components/post-last-edited-panel';\n\nconst { store: interfaceStore, ...remainingInterfaceApis } = interfaceApis;\n\nexport const privateApis = {};\nlock( privateApis, {\n\tCollapsableBlockToolbar,\n\tDocumentTools,\n\tEditorCanvas,\n\tExperimentalEditorProvider,\n\tEntitiesSavedStatesExtensible,\n\tInserterSidebar,\n\tListViewSidebar,\n\tMoreMenu,\n\tPatternOverridesPanel,\n\tPluginPostExcerpt,\n\tPostActions,\n\tPostPanelRow,\n\tPostViewLink,\n\tPreviewDropdown,\n\tPreferencesModal,\n\tusePostActions,\n\tPostCardPanel,\n\tPostStatus,\n\tToolsMoreMenuGroup,\n\tViewMoreMenuGroup,\n\tPrivatePostExcerptPanel,\n\tPostPublishButtonOrToggle,\n\tSavePublishPanels,\n\tPostContentInformation,\n\tPostLastEditedPanel,\n\n\t// This is a temporary private API while we're updating the site editor to use EditorProvider.\n\tuseAutoSwitchEditorSidebars,\n\tuseBlockEditorSettings,\n\tinterfaceStore,\n\t...remainingInterfaceApis,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,aAAa,MAAM,sBAAsB;;AAErD;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,wCAAwC;AAC5E,OAAOC,YAAY,MAAM,4BAA4B;AACrD,SAASC,0BAA0B,QAAQ,uBAAuB;AAClE,SAASC,IAAI,QAAQ,eAAe;AACpC,SAASC,6BAA6B,QAAQ,oCAAoC;AAClF,OAAOC,2BAA2B,MAAM,uDAAuD;AAC/F,OAAOC,sBAAsB,MAAM,iDAAiD;AACpF,OAAOC,aAAa,MAAM,6BAA6B;AACvD,OAAOC,eAAe,MAAM,+BAA+B;AAC3D,OAAOC,eAAe,MAAM,gCAAgC;AAC5D,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,OAAOC,qBAAqB,MAAM,sCAAsC;AACxE,OAAOC,iBAAiB,MAAM,kC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estedPostFormat = createRegistrySelector(select => () => {
|
|
708
708
|
const blocks = select(blockEditorStore).getBlocks();
|
|
709
|
-
if (blocks.length > 2)
|
|
709
|
+
if (blocks.length > 2) {
|
|
710
|
+
return null;
|
|
711
|
+
}
|
|
710
712
|
let name;
|
|
711
713
|
// If there is only one block in the content of the post grab its name
|
|
712
714
|
// so we can derive a suitable post format from it.
|