@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
|
@@ -59,7 +59,9 @@ function PreviewDropdown({
|
|
|
59
59
|
setDeviceType
|
|
60
60
|
} = (0, _data.useDispatch)(_store.store);
|
|
61
61
|
const isMobile = (0, _compose.useViewportMatch)('medium', '<');
|
|
62
|
-
if (isMobile)
|
|
62
|
+
if (isMobile) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
63
65
|
const popoverProps = {
|
|
64
66
|
placement: 'bottom-end'
|
|
65
67
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_components","_i18n","_icons","_data","_coreData","_preferences","_store","_postPreviewButton","_interopRequireDefault","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","homeUrl","isTemplate","isViewable","showIconLabels","useSelect","select","_getPostType$viewable","getDeviceType","getCurrentPostType","editorStore","getUnstableBase","getPostType","coreStore","get","preferencesStore","_currentPostType","home","viewable","setDeviceType","useDispatch","isMobile","useViewportMatch","popoverProps","placement","toggleProps","className","size","showTooltip","__experimentalIsFocusable","menuProps","__","deviceIcons","mobile","tablet","desktop","_react","createElement","DropdownMenu","icon","toLowerCase","label","disableOpenOnArrowDown","onClose","Fragment","MenuGroup","MenuItem","onClick","check","href","target","external","VisuallyHidden","as","default","role","textContent","Icon","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":["_compose","require","_components","_i18n","_icons","_data","_coreData","_preferences","_store","_postPreviewButton","_interopRequireDefault","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","homeUrl","isTemplate","isViewable","showIconLabels","useSelect","select","_getPostType$viewable","getDeviceType","getCurrentPostType","editorStore","getUnstableBase","getPostType","coreStore","get","preferencesStore","_currentPostType","home","viewable","setDeviceType","useDispatch","isMobile","useViewportMatch","popoverProps","placement","toggleProps","className","size","showTooltip","__experimentalIsFocusable","menuProps","__","deviceIcons","mobile","tablet","desktop","_react","createElement","DropdownMenu","icon","toLowerCase","label","disableOpenOnArrowDown","onClose","Fragment","MenuGroup","MenuItem","onClick","check","href","target","external","VisuallyHidden","as","default","role","textContent","Icon","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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6B,IAAI,EAAC,UAAU;IACfzD,mBAAmB,EAAGA,mBAAqB;IAC3C0D,WAAW,EACV,IAAApB,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAQ,QAAA,QACG,IAAAb,QAAE,EAAE,oBAAqB,CAAC,EAC5B,IAAAK,MAAA,CAAAC,aAAA,EAACjD,WAAA,CAAAqE,IAAI;MAAClB,IAAI,EAAGY;IAAU,CAAE,CACxB,CACF;IACDO,SAAS,EAAGf;EAAS,CACrB,CACS,CAEX,CAEU,CAAC;AAEjB","ignoreList":[]}
|
|
@@ -19,6 +19,8 @@ const CONTENT_ONLY_BLOCKS = (0, _hooks.applyFilters)('editor.postContentBlockTyp
|
|
|
19
19
|
* page content to be edited.
|
|
20
20
|
*/
|
|
21
21
|
function DisableNonPageContentBlocks() {
|
|
22
|
+
// Note that there are two separate subscription because the result for each
|
|
23
|
+
// returns a new array.
|
|
22
24
|
const contentOnlyIds = (0, _data.useSelect)(select => {
|
|
23
25
|
const {
|
|
24
26
|
getBlocksByName,
|
|
@@ -42,28 +44,33 @@ function DisableNonPageContentBlocks() {
|
|
|
42
44
|
} = select(_blockEditor.store);
|
|
43
45
|
return getBlocksByName(['core/template-part']).flatMap(clientId => getBlockOrder(clientId));
|
|
44
46
|
}, []);
|
|
45
|
-
const
|
|
46
|
-
setBlockEditingMode,
|
|
47
|
-
unsetBlockEditingMode
|
|
48
|
-
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
47
|
+
const registry = (0, _data.useRegistry)();
|
|
49
48
|
(0, _element.useEffect)(() => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
setBlockEditingMode(
|
|
56
|
-
}
|
|
57
|
-
return () => {
|
|
58
|
-
unsetBlockEditingMode('');
|
|
49
|
+
const {
|
|
50
|
+
setBlockEditingMode,
|
|
51
|
+
unsetBlockEditingMode
|
|
52
|
+
} = registry.dispatch(_blockEditor.store);
|
|
53
|
+
registry.batch(() => {
|
|
54
|
+
setBlockEditingMode('', 'disabled');
|
|
59
55
|
for (const clientId of contentOnlyIds) {
|
|
60
|
-
|
|
56
|
+
setBlockEditingMode(clientId, 'contentOnly');
|
|
61
57
|
}
|
|
62
58
|
for (const clientId of disabledIds) {
|
|
63
|
-
|
|
59
|
+
setBlockEditingMode(clientId, 'disabled');
|
|
64
60
|
}
|
|
61
|
+
});
|
|
62
|
+
return () => {
|
|
63
|
+
registry.batch(() => {
|
|
64
|
+
unsetBlockEditingMode('');
|
|
65
|
+
for (const clientId of contentOnlyIds) {
|
|
66
|
+
unsetBlockEditingMode(clientId);
|
|
67
|
+
}
|
|
68
|
+
for (const clientId of disabledIds) {
|
|
69
|
+
unsetBlockEditingMode(clientId);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
65
72
|
};
|
|
66
|
-
}, [contentOnlyIds, disabledIds,
|
|
73
|
+
}, [contentOnlyIds, disabledIds, registry]);
|
|
67
74
|
return null;
|
|
68
75
|
}
|
|
69
76
|
//# sourceMappingURL=disable-non-page-content-blocks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blockEditor","_element","_hooks","CONTENT_ONLY_BLOCKS","applyFilters","DisableNonPageContentBlocks","contentOnlyIds","useSelect","select","getBlocksByName","getBlockParents","getBlockName","blockEditorStore","filter","clientId","every","parentClientId","parentBlockName","includes","disabledIds","getBlockOrder","flatMap","setBlockEditingMode","unsetBlockEditingMode","
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","_element","_hooks","CONTENT_ONLY_BLOCKS","applyFilters","DisableNonPageContentBlocks","contentOnlyIds","useSelect","select","getBlocksByName","getBlockParents","getBlockName","blockEditorStore","filter","clientId","every","parentClientId","parentBlockName","includes","disabledIds","getBlockOrder","flatMap","registry","useRegistry","useEffect","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":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMA,MAAMI,mBAAmB,GAAG,IAAAC,mBAAY,EAAE,8BAA8B,EAAE,CACzE,iBAAiB,EACjB,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,CACnB,CAAC;;AAEH;AACA;AACA;AACA;AACe,SAASC,2BAA2BA,CAAA,EAAG;EACrD;EACA;EACA,MAAMC,cAAc,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC/C,MAAM;MAAEC,eAAe;MAAEC,eAAe;MAAEC;IAAa,CAAC,GACvDH,MAAM,CAAEI,kBAAiB,CAAC;IAC3B,OAAOH,eAAe,CAAEN,mBAAoB,CAAC,CAACU,MAAM,CAAIC,QAAQ,IAC/DJ,eAAe,CAAEI,QAAS,CAAC,CAACC,KAAK,CAAIC,cAAc,IAAM;MACxD,MAAMC,eAAe,GAAGN,YAAY,CAAEK,cAAe,CAAC;MACtD;QACC;QACAC,eAAe,KAAK,YAAY;QAChC;QACA,CAAEd,mBAAmB,CAACe,QAAQ,CAAED,eAAgB;MAAC;IAEnD,CAAE,CACH,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAME,WAAW,GAAG,IAAAZ,eAAS,E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ime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ActionsPanelFill = void 0;
|
|
8
|
+
exports.default = SavePublishPanels;
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _data = require("@wordpress/data");
|
|
11
|
+
var _components = require("@wordpress/components");
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
var _element = require("@wordpress/element");
|
|
14
|
+
var _entitiesSavedStates = _interopRequireDefault(require("../entities-saved-states"));
|
|
15
|
+
var _postPublishPanel = _interopRequireDefault(require("../post-publish-panel"));
|
|
16
|
+
var _pluginPrePublishPanel = _interopRequireDefault(require("../plugin-pre-publish-panel"));
|
|
17
|
+
var _pluginPostPublishPanel = _interopRequireDefault(require("../plugin-post-publish-panel"));
|
|
18
|
+
var _store = require("../../store");
|
|
19
|
+
/**
|
|
20
|
+
* WordPress dependencies
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Internal dependencies
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const {
|
|
28
|
+
Fill,
|
|
29
|
+
Slot
|
|
30
|
+
} = (0, _components.createSlotFill)('ActionsPanel');
|
|
31
|
+
const ActionsPanelFill = exports.ActionsPanelFill = Fill;
|
|
32
|
+
function SavePublishPanels({
|
|
33
|
+
setEntitiesSavedStatesCallback,
|
|
34
|
+
closeEntitiesSavedStates,
|
|
35
|
+
isEntitiesSavedStatesOpen,
|
|
36
|
+
forceIsDirtyPublishPanel
|
|
37
|
+
}) {
|
|
38
|
+
const {
|
|
39
|
+
closePublishSidebar,
|
|
40
|
+
togglePublishSidebar
|
|
41
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
42
|
+
const {
|
|
43
|
+
publishSidebarOpened,
|
|
44
|
+
hasNonPostEntityChanges
|
|
45
|
+
} = (0, _data.useSelect)(select => ({
|
|
46
|
+
publishSidebarOpened: select(_store.store).isPublishSidebarOpened(),
|
|
47
|
+
hasNonPostEntityChanges: select(_store.store).hasNonPostEntityChanges()
|
|
48
|
+
}), []);
|
|
49
|
+
const openEntitiesSavedStates = (0, _element.useCallback)(() => setEntitiesSavedStatesCallback(true), []);
|
|
50
|
+
|
|
51
|
+
// It is ok for these components to be unmounted when not in visual use.
|
|
52
|
+
// We don't want more than one present at a time, decide which to render.
|
|
53
|
+
let unmountableContent;
|
|
54
|
+
if (publishSidebarOpened) {
|
|
55
|
+
unmountableContent = (0, _react.createElement)(_postPublishPanel.default, {
|
|
56
|
+
onClose: closePublishSidebar,
|
|
57
|
+
forceIsDirty: forceIsDirtyPublishPanel,
|
|
58
|
+
PrePublishExtension: _pluginPrePublishPanel.default.Slot,
|
|
59
|
+
PostPublishExtension: _pluginPostPublishPanel.default.Slot
|
|
60
|
+
});
|
|
61
|
+
} else if (hasNonPostEntityChanges) {
|
|
62
|
+
unmountableContent = (0, _react.createElement)("div", {
|
|
63
|
+
className: "editor-layout__toggle-entities-saved-states-panel"
|
|
64
|
+
}, (0, _react.createElement)(_components.Button, {
|
|
65
|
+
variant: "secondary",
|
|
66
|
+
className: "editor-layout__toggle-entities-saved-states-panel-button",
|
|
67
|
+
onClick: openEntitiesSavedStates,
|
|
68
|
+
"aria-expanded": false
|
|
69
|
+
}, (0, _i18n.__)('Open save panel')));
|
|
70
|
+
} else {
|
|
71
|
+
unmountableContent = (0, _react.createElement)("div", {
|
|
72
|
+
className: "editor-layout__toggle-publish-panel"
|
|
73
|
+
}, (0, _react.createElement)(_components.Button, {
|
|
74
|
+
variant: "secondary",
|
|
75
|
+
className: "editor-layout__toggle-publish-panel-button",
|
|
76
|
+
onClick: togglePublishSidebar,
|
|
77
|
+
"aria-expanded": false
|
|
78
|
+
}, (0, _i18n.__)('Open publish panel')));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Since EntitiesSavedStates controls its own panel, we can keep it
|
|
82
|
+
// always mounted to retain its own component state (such as checkboxes).
|
|
83
|
+
return (0, _react.createElement)(_react.Fragment, null, isEntitiesSavedStatesOpen && (0, _react.createElement)(_entitiesSavedStates.default, {
|
|
84
|
+
close: closeEntitiesSavedStates
|
|
85
|
+
}), (0, _react.createElement)(Slot, {
|
|
86
|
+
bubblesVirtually: true
|
|
87
|
+
}), !isEntitiesSavedStatesOpen && unmountableContent);
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_components","_i18n","_element","_entitiesSavedStates","_interopRequireDefault","_postPublishPanel","_pluginPrePublishPanel","_pluginPostPublishPanel","_store","Fill","Slot","createSlotFill","ActionsPanelFill","exports","SavePublishPanels","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","isEntitiesSavedStatesOpen","forceIsDirtyPublishPanel","closePublishSidebar","togglePublishSidebar","useDispatch","editorStore","publishSidebarOpened","hasNonPostEntityChanges","useSelect","select","isPublishSidebarOpened","openEntitiesSavedStates","useCallback","unmountableContent","_react","createElement","default","onClose","forceIsDirty","PrePublishExtension","PluginPrePublishPanel","PostPublishExtension","PluginPostPublishPanel","className","Button","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":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,oBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,sBAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,uBAAA,GAAAH,sBAAA,CAAAL,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAfA;AACA;AACA;;AAMA;AACA;AACA;;AAOA,MAAM;EAAEU,IAAI;EAAEC;AAAK,CAAC,GAAG,IAAAC,0BAAc,EAAE,cAAe,CAAC;AAEhD,MAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAGH,IAAI;AAErB,SAASK,iBAAiBA,CAAE;EAC1CC,8BAA8B;EAC9BC,wBAAwB;EACxBC,yBAAyB;EACzBC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC,mBAAmB;IAAEC;EAAqB,CAAC,GAClD,IAAAC,iBAAW,EAAEC,YAAY,CAAC;EAC3B,MAAM;IAAEC,oBAAoB;IAAEC;EAAwB,CAAC,GAAG,IAAAC,eAAS,EAChEC,MAAM,KAAQ;IACfH,oBAAoB,EACnBG,MAAM,CAAEJ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AA,EAAAD,MAAA,CAAAc,QAAA,QACG5B,yBAAyB,IAC1B,IAAAc,MAAA,CAAAC,aAAA,EAAC7B,oBAAA,CAAA8B,OAAmB;IAACa,KAAK,EAAG9B;EAA0B,CAAE,CACzD,EACD,IAAAe,MAAA,CAAAC,aAAA,EAACtB,IAAI;IAACqC,gBAAgB;EAAA,CAAE,CAAC,EACvB,CAAE9B,yBAAyB,IAAIa,kBAChC,CAAC;AAEL","ignoreList":[]}
|
|
@@ -12,6 +12,7 @@ var _blockEditor = require("@wordpress/block-editor");
|
|
|
12
12
|
var _data = require("@wordpress/data");
|
|
13
13
|
var _compose = require("@wordpress/compose");
|
|
14
14
|
var _coreData = require("@wordpress/core-data");
|
|
15
|
+
var _blocks = require("@wordpress/blocks");
|
|
15
16
|
var _store = require("../../store");
|
|
16
17
|
/**
|
|
17
18
|
* WordPress dependencies
|
|
@@ -77,7 +78,10 @@ function PatternSelection({
|
|
|
77
78
|
shownPatterns: shownBlockPatterns,
|
|
78
79
|
onClickPattern: (_pattern, blocks) => {
|
|
79
80
|
editEntityRecord('postType', postType, postId, {
|
|
80
|
-
blocks
|
|
81
|
+
blocks,
|
|
82
|
+
content: ({
|
|
83
|
+
blocks: blocksForSerialization = []
|
|
84
|
+
}) => (0, _blocks.__unstableSerializeAndClean)(blocksForSerialization)
|
|
81
85
|
});
|
|
82
86
|
onChoosePattern();
|
|
83
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_element","_blockEditor","_data","_compose","_coreData","_store","useStartPatterns","blockPatternsWithPostContentBlockType","postType","useSelect","select","getPatternsByBlockTypes","getBlocksByName","blockEditorStore","getCurrentPostType","getRenderingMode","editorStore","rootClientId","useMemo","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","shownBlockPatterns","useAsyncList","editEntityRecord","useDispatch","coreStore","postId","getCurrentPostId","_react","createElement","__experimentalBlockPatternsList","shownPatterns","onClickPattern","_pattern","blocks","StartPageOptionsModal","onClose","startPatterns","hasStartPattern","length","Modal","title","__","isFullScreen","onRequestClose","className","StartPageOptions","isClosed","setIsClosed","useState","shouldEnableModal","isEditedPostDirty","isEditedPostEmpty","getEditorSettings","__unstableIsPreviewMode","isPreviewMode","useEffect"],"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":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_element","_blockEditor","_data","_compose","_coreData","_blocks","_store","useStartPatterns","blockPatternsWithPostContentBlockType","postType","useSelect","select","getPatternsByBlockTypes","getBlocksByName","blockEditorStore","getCurrentPostType","getRenderingMode","editorStore","rootClientId","useMemo","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","shownBlockPatterns","useAsyncList","editEntityRecord","useDispatch","coreStore","postId","getCurrentPostId","_react","createElement","__experimentalBlockPatternsList","shownPatterns","onClickPattern","_pattern","blocks","content","blocksForSerialization","__unstableSerializeAndClean","StartPageOptionsModal","onClose","startPatterns","hasStartPattern","length","Modal","title","__","isFullScreen","onRequestClose","className","StartPageOptions","isClosed","setIsClosed","useState","shouldEnableModal","isEditedPostDirty","isEditedPostEmpty","getEditorSettings","__unstableIsPreviewMode","isPreviewMode","useEffect"],"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":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AAlBA;AACA;AACA;;AAaA;AACA;AACA;;AAGA,SAASS,gBAAgBA,CAAA,EAAG;EAC3B;EACA;EACA;EACA,MAAM;IAAEC,qCAAqC;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EAClEC,MAAM,IAAM;IACb,MAAM;MAAEC,uBAAuB;MAAEC;IAAgB,CAAC,GACjDF,MAAM,CAAEG,kBAAiB,CAAC;IAC3B,MAAM;MAAEC,kBAAkB;MAAEC;IAAiB,CAAC,GAC7CL,MAAM,CAAEM,YAAY,CAAC;IACtB,MAAMC,YAAY,GACjBF,gBAAgB,CAAC,CAAC,KAAK,WAAW,GAC/B,EAAE,GACFH,eAAe,CAAE,mBAAoB,C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B,CAAC,CAAC;IAEtE,OAAO;MACNH,iBAAiB,EAChB,CAAEK,aAAa,IAAI,CAAEJ,iBAAiB,CAAC,CAAC,IAAIC,iBAAiB,CAAC,CAAC;MAChEtD,QAAQ,EAAEM,kBAAkB,CAAC,CAAC;MAC9BmB,MAAM,EAAEC,gBAAgB,CAAC;IAC1B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAAgC,kBAAS,EAAE,MAAM;IAChB;IACAR,WAAW,CAAE,KAAM,CAAC;EACrB,CAAC,EAAE,CAAElD,QAAQ,EAAEyB,MAAM,CAAG,CAAC;EAEzB,IAAK,CAAE2B,iBAAiB,IAAIH,QAAQ,EAAG;IACtC,OAAO,IAAI;EACZ;EAEA,OAAO,IAAAtB,MAAA,CAAAC,aAAA,EAACS,qBAAqB;IAACC,OAAO,EAAGA,CAAA,KAAMY,WAAW,CAAE,IAAK;EAAG,CAAE,CAAC;AACvE","ignoreList":[]}
|
package/build/private-apis.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.privateApis = void 0;
|
|
8
8
|
var interfaceApis = _interopRequireWildcard(require("@wordpress/interface"));
|
|
9
|
+
var _collapsibleBlockToolbar = _interopRequireDefault(require("./components/collapsible-block-toolbar"));
|
|
9
10
|
var _editorCanvas = _interopRequireDefault(require("./components/editor-canvas"));
|
|
10
11
|
var _provider = require("./components/provider");
|
|
11
12
|
var _lockUnlock = require("./lock-unlock");
|
|
@@ -15,7 +16,7 @@ var _useBlockEditorSettings = _interopRequireDefault(require("./components/provi
|
|
|
15
16
|
var _documentTools = _interopRequireDefault(require("./components/document-tools"));
|
|
16
17
|
var _inserterSidebar = _interopRequireDefault(require("./components/inserter-sidebar"));
|
|
17
18
|
var _listViewSidebar = _interopRequireDefault(require("./components/list-view-sidebar"));
|
|
18
|
-
var
|
|
19
|
+
var _moreMenu = _interopRequireDefault(require("./components/more-menu"));
|
|
19
20
|
var _patternOverridesPanel = _interopRequireDefault(require("./components/pattern-overrides-panel"));
|
|
20
21
|
var _plugin = _interopRequireDefault(require("./components/post-excerpt/plugin"));
|
|
21
22
|
var _postPanelRow = _interopRequireDefault(require("./components/post-panel-row"));
|
|
@@ -26,6 +27,13 @@ var _postActions = _interopRequireDefault(require("./components/post-actions"));
|
|
|
26
27
|
var _actions = require("./components/post-actions/actions");
|
|
27
28
|
var _postCardPanel = _interopRequireDefault(require("./components/post-card-panel"));
|
|
28
29
|
var _postStatus = _interopRequireDefault(require("./components/post-status"));
|
|
30
|
+
var _toolsMoreMenuGroup = _interopRequireDefault(require("./components/more-menu/tools-more-menu-group"));
|
|
31
|
+
var _viewMoreMenuGroup = _interopRequireDefault(require("./components/more-menu/view-more-menu-group"));
|
|
32
|
+
var _panel = require("./components/post-excerpt/panel");
|
|
33
|
+
var _postPublishButtonOrToggle = _interopRequireDefault(require("./components/post-publish-button/post-publish-button-or-toggle"));
|
|
34
|
+
var _savePublishPanels = _interopRequireDefault(require("./components/save-publish-panels"));
|
|
35
|
+
var _postContentInformation = _interopRequireDefault(require("./components/post-content-information"));
|
|
36
|
+
var _postLastEditedPanel = _interopRequireDefault(require("./components/post-last-edited-panel"));
|
|
29
37
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
30
38
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
31
39
|
/**
|
|
@@ -42,13 +50,14 @@ const {
|
|
|
42
50
|
} = interfaceApis;
|
|
43
51
|
const privateApis = exports.privateApis = {};
|
|
44
52
|
(0, _lockUnlock.lock)(privateApis, {
|
|
53
|
+
CollapsableBlockToolbar: _collapsibleBlockToolbar.default,
|
|
45
54
|
DocumentTools: _documentTools.default,
|
|
46
55
|
EditorCanvas: _editorCanvas.default,
|
|
47
56
|
ExperimentalEditorProvider: _provider.ExperimentalEditorProvider,
|
|
48
57
|
EntitiesSavedStatesExtensible: _entitiesSavedStates.EntitiesSavedStatesExtensible,
|
|
49
58
|
InserterSidebar: _inserterSidebar.default,
|
|
50
59
|
ListViewSidebar: _listViewSidebar.default,
|
|
51
|
-
|
|
60
|
+
MoreMenu: _moreMenu.default,
|
|
52
61
|
PatternOverridesPanel: _patternOverridesPanel.default,
|
|
53
62
|
PluginPostExcerpt: _plugin.default,
|
|
54
63
|
PostActions: _postActions.default,
|
|
@@ -59,6 +68,13 @@ const privateApis = exports.privateApis = {};
|
|
|
59
68
|
usePostActions: _actions.usePostActions,
|
|
60
69
|
PostCardPanel: _postCardPanel.default,
|
|
61
70
|
PostStatus: _postStatus.default,
|
|
71
|
+
ToolsMoreMenuGroup: _toolsMoreMenuGroup.default,
|
|
72
|
+
ViewMoreMenuGroup: _viewMoreMenuGroup.default,
|
|
73
|
+
PrivatePostExcerptPanel: _panel.PrivatePostExcerptPanel,
|
|
74
|
+
PostPublishButtonOrToggle: _postPublishButtonOrToggle.default,
|
|
75
|
+
SavePublishPanels: _savePublishPanels.default,
|
|
76
|
+
PostContentInformation: _postContentInformation.default,
|
|
77
|
+
PostLastEditedPanel: _postLastEditedPanel.default,
|
|
62
78
|
// This is a temporary private API while we're updating the site editor to use EditorProvider.
|
|
63
79
|
useAutoSwitchEditorSidebars: _useAutoSwitchEditorSidebars.default,
|
|
64
80
|
useBlockEditorSettings: _useBlockEditorSettings.default,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["interfaceApis","_interopRequireWildcard","require","
|
|
1
|
+
{"version":3,"names":["interfaceApis","_interopRequireWildcard","require","_collapsibleBlockToolbar","_interopRequireDefault","_editorCanvas","_provider","_lockUnlock","_entitiesSavedStates","_useAutoSwitchEditorSidebars","_useBlockEditorSettings","_documentTools","_inserterSidebar","_listViewSidebar","_moreMenu","_patternOverridesPanel","_plugin","_postPanelRow","_postViewLink","_previewDropdown","_preferencesModal","_postActions","_actions","_postCardPanel","_postStatus","_toolsMoreMenuGroup","_viewMoreMenuGroup","_panel","_postPublishButtonOrToggle","_savePublishPanels","_postContentInformation","_postLastEditedPanel","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","store","interfaceStore","remainingInterfaceApis","privateApis","exports","lock","CollapsableBlockToolbar","DocumentTools","EditorCanvas","ExperimentalEditorProvider","EntitiesSavedStatesExtensible","InserterSidebar","ListViewSidebar","MoreMenu","PatternOverridesPanel","PluginPostExcerpt","PostActions","PostPanelRow","PostViewLink","PreviewDropdown","PreferencesModal","usePostActions","PostCardPanel","PostStatus","ToolsMoreMenuGroup","ViewMoreMenuGroup","PrivatePostExcerptPanel","PostPublishButtonOrToggle","SavePublishPanels","PostContentInformation","PostLastEditedPanel","useAutoSwitchEditorSidebars","useBlockEditorSettings"],"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":";;;;;;;AAGA,IAAAA,aAAA,GA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,GAAGtD,aAAa;AAEnE,MAAMuD,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,CAAC,CAAC;AAC7B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,uBAAuB,EAAvBA,gCAAuB;EACvBC,aAAa,EAAbA,sBAAa;EACbC,YAAY,EAAZA,qBAAY;EACZC,0BAA0B,EAA1BA,oCAA0B;EAC1BC,6BAA6B,EAA7BA,kDAA6B;EAC7BC,eAAe,EAAfA,wBAAe;EACfC,eAAe,EAAfA,wBAAe;EACfC,QAAQ,EAARA,iBAAQ;EACRC,qBAAqB,EAArBA,8BAAqB;EACrBC,iBAAiB,EAAjBA,eAAiB;EACjBC,WAAW,EAAXA,oBAAW;EACXC,YAAY,EAAZA,qBAAY;EACZC,YAAY,EAAZA,qBAAY;EACZC,eAAe,EAAfA,wBAAe;EACfC,gBAAgB,EAAhBA,yBAAgB;EAChBC,cAAc,EAAdA,uBAAc;EACdC,aAAa,EAAbA,sBAAa;EACbC,UAAU,EAAVA,mBAAU;EACVC,kBAAkB,EAAlBA,2BAAkB;EAClBC,iBAAiB,EAAjBA,0BAAiB;EACjBC,uBAAuB,EAAvBA,8BAAuB;EACvBC,yBAAyB,EAAzBA,kCAAyB;EACzBC,iBAAiB,EAAjBA,0BAAiB;EACjBC,sBAAsB,EAAtBA,+BAAsB;EACtBC,mBAAmB,EAAnBA,4BAAmB;EAEnB;EACAC,2BAA2B,EAA3BA,oCAA2B;EAC3BC,sBAAsB,EAAtBA,+BAAsB;EACtB/B,cAAc;EACd,GAAGC;AACJ,CAAE,CAAC","ignoreList":[]}
|
package/build/store/selectors.js
CHANGED
|
@@ -784,7 +784,9 @@ function getEditedPostPreviewLink(state) {
|
|
|
784
784
|
*/
|
|
785
785
|
const getSuggestedPostFormat = exports.getSuggestedPostFormat = (0, _data.createRegistrySelector)(select => () => {
|
|
786
786
|
const blocks = select(_blockEditor.store).getBlocks();
|
|
787
|
-
if (blocks.length > 2)
|
|
787
|
+
if (blocks.length > 2) {
|
|
788
|
+
return null;
|
|
789
|
+
}
|
|
788
790
|
let name;
|
|
789
791
|
// If there is only one block in the content of the post grab its name
|
|
790
792
|
// so we can derive a suitable post format from it.
|