@wordpress/editor 14.49.1 → 14.51.1-next.v.202607070741.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 +12 -0
- package/build/components/collab-sidebar/format.cjs +83 -0
- package/build/components/collab-sidebar/format.cjs.map +7 -0
- package/build/components/collab-sidebar/hooks.cjs +117 -16
- package/build/components/collab-sidebar/hooks.cjs.map +2 -2
- package/build/components/collab-sidebar/index.cjs +18 -2
- package/build/components/collab-sidebar/index.cjs.map +2 -2
- package/build/components/collab-sidebar/note-highlight-styles.cjs +67 -0
- package/build/components/collab-sidebar/note-highlight-styles.cjs.map +7 -0
- package/build/components/collab-sidebar/utils.cjs +139 -0
- package/build/components/collab-sidebar/utils.cjs.map +2 -2
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs +55 -30
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs.map +2 -2
- package/build/components/commands/index.cjs +99 -3
- package/build/components/commands/index.cjs.map +2 -2
- package/build/components/document-bar/index.cjs +28 -34
- package/build/components/document-bar/index.cjs.map +2 -2
- package/build/components/entities-saved-states/index.cjs +1 -4
- package/build/components/entities-saved-states/index.cjs.map +2 -2
- package/build/components/header/index.cjs +1 -8
- package/build/components/header/index.cjs.map +2 -2
- package/build/components/media-categories/index.cjs +92 -6
- package/build/components/media-categories/index.cjs.map +2 -2
- package/build/components/page-attributes/parent.cjs +0 -1
- package/build/components/page-attributes/parent.cjs.map +2 -2
- package/build/components/post-author/combobox.cjs +0 -1
- package/build/components/post-author/combobox.cjs.map +2 -2
- package/build/components/post-author/select.cjs +0 -1
- package/build/components/post-author/select.cjs.map +2 -2
- package/build/components/post-preview-button/index.cjs +29 -2
- package/build/components/post-preview-button/index.cjs.map +2 -2
- package/build/components/post-publish-panel/maybe-upload-media.cjs +15 -26
- package/build/components/post-publish-panel/maybe-upload-media.cjs.map +3 -3
- package/build/components/post-revisions-preview/revisions-slider.cjs +3 -1
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
- package/build/components/post-taxonomies/flat-term-selector.cjs +0 -1
- package/build/components/post-taxonomies/flat-term-selector.cjs.map +2 -2
- package/build/components/post-taxonomies/hierarchical-term-selector.cjs +0 -2
- package/build/components/post-taxonomies/hierarchical-term-selector.cjs.map +2 -2
- package/build/components/post-template/classic-theme.cjs +0 -1
- package/build/components/post-template/classic-theme.cjs.map +2 -2
- package/build/components/preferences-modal/index.cjs +54 -28
- package/build/components/preferences-modal/index.cjs.map +2 -2
- package/build/components/preview-dropdown/index.cjs +38 -9
- package/build/components/preview-dropdown/index.cjs.map +3 -3
- package/build/components/provider/use-block-editor-settings.cjs +23 -9
- package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
- package/build/components/resizable-editor/index.cjs +54 -9
- package/build/components/resizable-editor/index.cjs.map +3 -3
- package/build/components/sidebar/dataform-post-summary.cjs +5 -1
- package/build/components/sidebar/dataform-post-summary.cjs.map +3 -3
- package/build/components/sidebar/index.cjs +29 -38
- package/build/components/sidebar/index.cjs.map +3 -3
- package/build/components/sidebar/post-summary.cjs +0 -13
- package/build/components/sidebar/post-summary.cjs.map +3 -3
- package/build/components/visual-editor/index.cjs +15 -11
- package/build/components/visual-editor/index.cjs.map +3 -3
- package/build/dataviews/store/private-actions.cjs +24 -19
- package/build/dataviews/store/private-actions.cjs.map +2 -2
- package/build/store/actions.cjs +5 -3
- package/build/store/actions.cjs.map +2 -2
- package/build/store/constants.cjs +26 -0
- package/build/store/constants.cjs.map +2 -2
- package/build/store/private-actions.cjs +25 -18
- package/build/store/private-actions.cjs.map +3 -3
- package/build/store/private-selectors.cjs +5 -0
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +6 -6
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +3 -1
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/device-type.cjs +52 -0
- package/build/utils/device-type.cjs.map +7 -0
- package/build/utils/media-sideload-from-url/index.cjs +63 -0
- package/build/utils/media-sideload-from-url/index.cjs.map +7 -0
- package/build-module/components/collab-sidebar/format.mjs +57 -0
- package/build-module/components/collab-sidebar/format.mjs.map +7 -0
- package/build-module/components/collab-sidebar/hooks.mjs +121 -16
- package/build-module/components/collab-sidebar/hooks.mjs.map +2 -2
- package/build-module/components/collab-sidebar/index.mjs +21 -5
- package/build-module/components/collab-sidebar/index.mjs.map +2 -2
- package/build-module/components/collab-sidebar/note-highlight-styles.mjs +41 -0
- package/build-module/components/collab-sidebar/note-highlight-styles.mjs.map +7 -0
- package/build-module/components/collab-sidebar/utils.mjs +133 -0
- package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs +55 -30
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map +2 -2
- package/build-module/components/commands/index.mjs +99 -3
- package/build-module/components/commands/index.mjs.map +2 -2
- package/build-module/components/document-bar/index.mjs +28 -34
- package/build-module/components/document-bar/index.mjs.map +2 -2
- package/build-module/components/entities-saved-states/index.mjs +1 -4
- package/build-module/components/entities-saved-states/index.mjs.map +2 -2
- package/build-module/components/header/index.mjs +1 -13
- package/build-module/components/header/index.mjs.map +2 -2
- package/build-module/components/media-categories/index.mjs +93 -7
- package/build-module/components/media-categories/index.mjs.map +2 -2
- package/build-module/components/page-attributes/parent.mjs +0 -1
- package/build-module/components/page-attributes/parent.mjs.map +2 -2
- package/build-module/components/post-author/combobox.mjs +0 -1
- package/build-module/components/post-author/combobox.mjs.map +2 -2
- package/build-module/components/post-author/select.mjs +0 -1
- package/build-module/components/post-author/select.mjs.map +2 -2
- package/build-module/components/post-preview-button/index.mjs +29 -2
- package/build-module/components/post-preview-button/index.mjs.map +2 -2
- package/build-module/components/post-publish-panel/maybe-upload-media.mjs +19 -27
- package/build-module/components/post-publish-panel/maybe-upload-media.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +3 -1
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/post-taxonomies/flat-term-selector.mjs +0 -1
- package/build-module/components/post-taxonomies/flat-term-selector.mjs.map +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs +0 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs.map +2 -2
- package/build-module/components/post-template/classic-theme.mjs +0 -1
- package/build-module/components/post-template/classic-theme.mjs.map +2 -2
- package/build-module/components/preferences-modal/index.mjs +54 -28
- package/build-module/components/preferences-modal/index.mjs.map +2 -2
- package/build-module/components/preview-dropdown/index.mjs +38 -9
- package/build-module/components/preview-dropdown/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +23 -9
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/resizable-editor/index.mjs +55 -10
- package/build-module/components/resizable-editor/index.mjs.map +2 -2
- package/build-module/components/sidebar/dataform-post-summary.mjs +6 -2
- package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +29 -42
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/sidebar/post-summary.mjs +0 -13
- package/build-module/components/sidebar/post-summary.mjs.map +2 -2
- package/build-module/components/visual-editor/index.mjs +16 -13
- package/build-module/components/visual-editor/index.mjs.map +2 -2
- package/build-module/dataviews/store/private-actions.mjs +26 -19
- package/build-module/dataviews/store/private-actions.mjs.map +2 -2
- package/build-module/store/actions.mjs +5 -3
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/constants.mjs +25 -0
- package/build-module/store/constants.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +27 -17
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +4 -0
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +5 -5
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +3 -1
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/device-type.mjs +25 -0
- package/build-module/utils/device-type.mjs.map +7 -0
- package/build-module/utils/media-sideload-from-url/index.mjs +32 -0
- package/build-module/utils/media-sideload-from-url/index.mjs.map +7 -0
- package/build-style/style-rtl.css +84 -39
- package/build-style/style.css +84 -39
- package/build-types/components/collab-sidebar/format.d.ts +17 -0
- package/build-types/components/collab-sidebar/format.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/note-highlight-styles.d.ts +31 -0
- package/build-types/components/collab-sidebar/note-highlight-styles.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/utils.d.ts +82 -2
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts.map +1 -1
- package/build-types/components/commands/index.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/media-categories/index.d.ts +12 -3
- package/build-types/components/media-categories/index.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/post-author/combobox.d.ts.map +1 -1
- package/build-types/components/post-author/select.d.ts.map +1 -1
- package/build-types/components/post-preview-button/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
- package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/resizable-editor/index.d.ts.map +1 -1
- package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/constants.d.ts +6 -0
- package/build-types/store/constants.d.ts.map +1 -1
- package/build-types/store/index.d.ts +2 -2
- package/build-types/store/private-actions.d.ts +9 -15
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +7 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +6 -7
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +1 -1
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/device-type.d.ts +23 -0
- package/build-types/utils/device-type.d.ts.map +1 -0
- package/build-types/utils/get-template-part-icon.d.ts.map +1 -1
- package/build-types/utils/media-sideload-from-url/index.d.ts +18 -0
- package/build-types/utils/media-sideload-from-url/index.d.ts.map +1 -0
- package/package.json +48 -46
- package/src/components/collab-sidebar/format.js +72 -0
- package/src/components/collab-sidebar/hooks.js +203 -22
- package/src/components/collab-sidebar/index.js +19 -5
- package/src/components/collab-sidebar/note-highlight-styles.js +83 -0
- package/src/components/collab-sidebar/style.scss +9 -0
- package/src/components/collab-sidebar/test/note-highlight-styles.js +106 -0
- package/src/components/collab-sidebar/test/utils.js +471 -0
- package/src/components/collab-sidebar/utils.js +225 -2
- package/src/components/collaborators-presence/test/use-collaborator-notifications.ts +265 -262
- package/src/components/collaborators-presence/use-collaborator-notifications.ts +70 -34
- package/src/components/commands/index.js +142 -0
- package/src/components/document-bar/index.js +0 -9
- package/src/components/document-bar/style.scss +0 -17
- package/src/components/entities-saved-states/index.js +1 -5
- package/src/components/header/index.js +1 -15
- package/src/components/header/style.scss +7 -3
- package/src/components/media-categories/index.js +160 -6
- package/src/components/media-categories/test/index.js +202 -0
- package/src/components/page-attributes/parent.js +0 -1
- package/src/components/post-author/combobox.js +0 -1
- package/src/components/post-author/select.js +0 -1
- package/src/components/post-preview-button/index.js +68 -2
- package/src/components/post-publish-panel/maybe-upload-media.js +25 -30
- package/src/components/post-publish-panel/style.scss +1 -1
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +11 -127
- package/src/components/post-revisions-preview/revisions-slider.js +4 -1
- package/src/components/post-revisions-preview/test/block-diff.js +2 -2
- package/src/components/post-taxonomies/flat-term-selector.js +0 -1
- package/src/components/post-taxonomies/hierarchical-term-selector.js +0 -2
- package/src/components/post-template/classic-theme.js +0 -1
- package/src/components/preferences-modal/index.js +40 -22
- package/src/components/preferences-modal/test/index.js +83 -0
- package/src/components/preview-dropdown/index.js +42 -3
- package/src/components/provider/use-block-editor-settings.js +42 -7
- package/src/components/resizable-editor/index.js +71 -9
- package/src/components/resizable-editor/style.scss +7 -0
- package/src/components/sidebar/dataform-post-summary.js +13 -1
- package/src/components/sidebar/index.js +32 -47
- package/src/components/sidebar/post-summary.js +0 -17
- package/src/components/styles-canvas/style.scss +1 -2
- package/src/components/visual-editor/index.js +19 -15
- package/src/components/visual-editor/style.scss +11 -4
- package/src/dataviews/store/private-actions.ts +30 -26
- package/src/store/actions.js +6 -3
- package/src/store/constants.ts +45 -0
- package/src/store/private-actions.js +38 -28
- package/src/store/private-selectors.js +10 -0
- package/src/store/reducer.js +7 -9
- package/src/store/selectors.js +3 -1
- package/src/store/test/actions.js +31 -22
- package/src/utils/device-type.js +46 -0
- package/src/utils/media-sideload-from-url/index.js +54 -0
- package/src/utils/media-sideload-from-url/test/index.js +162 -0
- package/build/components/post-publish-panel/media-util.cjs +0 -72
- package/build/components/post-publish-panel/media-util.cjs.map +0 -7
- package/build-module/components/post-publish-panel/media-util.mjs +0 -46
- package/build-module/components/post-publish-panel/media-util.mjs.map +0 -7
- package/build-types/components/post-publish-panel/media-util.d.ts +0 -20
- package/build-types/components/post-publish-panel/media-util.d.ts.map +0 -1
- package/src/components/post-publish-panel/media-util.js +0 -87
- package/src/components/post-publish-panel/test/media-util.js +0 -118
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/preview-dropdown/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tIcon as WCIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { desktop, mobile, tablet, external, check } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ActionItem } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { VisuallyHidden } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostPreviewButton from '../post-preview-button';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst {\n\t\tdeviceType,\n\t\thomeUrl,\n\t\tisTemplate,\n\t\tisViewable,\n\t\tshowIconLabels,\n\t\tisTemplateHidden,\n\t\ttemplateId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAiC;AACjC,wBAMO;AACP,kBAAmB;AACnB,mBAAyD;AACzD,kBAAuC;AACvC,uBAAmC;AACnC,yBAA0C;AAC1C,uBAA2B;AAC3B,0BAA0C;AAC1C,gBAA+B;AAK/B,mBAAqC;AACrC,iCAA8B;AAC9B,yBAAuB;
|
|
6
|
-
"names": ["editorStore", "
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tIcon as WCIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { desktop, mobile, tablet, external, check } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ActionItem } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { VisuallyHidden } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostPreviewButton from '../post-preview-button';\nimport { VIEWPORT_STATE_BY_DEVICE_TYPE } from '../../utils/device-type';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst {\n\t\tdeviceType,\n\t\thomeUrl,\n\t\tisTemplate,\n\t\tisViewable,\n\t\tshowIconLabels,\n\t\tisTemplateHidden,\n\t\ttemplateId,\n\t\tisResponsiveEditing,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentTemplateId,\n\t\t\tgetRenderingMode,\n\t\t\tgetDeviceType,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst { isResponsiveEditing: _isResponsiveEditing } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\t\tconst { getEntityRecord, getPostType } = select( coreStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst _currentPostType = getCurrentPostType();\n\t\treturn {\n\t\t\tdeviceType: getDeviceType(),\n\t\t\thomeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,\n\t\t\tisTemplate: _currentPostType === 'wp_template',\n\t\t\tisViewable: getPostType( _currentPostType )?.viewable ?? false,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\tisResponsiveEditing: _isResponsiveEditing(),\n\t\t};\n\t}, [] );\n\tconst { setDeviceType, setRenderingMode, setDefaultRenderingMode } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst { resetZoomLevel, setStyleStateViewport, setResponsiveEditing } =\n\t\tunlock( useDispatch( blockEditorStore ) );\n\n\tconst handleDevicePreviewChange = ( newDeviceType ) => {\n\t\tsetDeviceType( newDeviceType );\n\t\tresetZoomLevel();\n\t};\n\n\tconst handleResponsiveEditingChange = () => {\n\t\tconst newIsResponsiveEditing = ! isResponsiveEditing;\n\t\tsetResponsiveEditing( newIsResponsiveEditing );\n\t\tsetStyleStateViewport(\n\t\t\tnewIsResponsiveEditing\n\t\t\t\t? VIEWPORT_STATE_BY_DEVICE_TYPE[ deviceType ] ?? 'default'\n\t\t\t\t: 'default'\n\t\t);\n\t};\n\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\ticonPosition: 'right',\n\t\tsize: 'compact',\n\t\tshowTooltip: ! showIconLabels,\n\t\tdisabled,\n\t\taccessibleWhenDisabled: disabled,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tdesktop,\n\t\tmobile,\n\t\ttablet,\n\t};\n\n\t/**\n\t * The choices for the device type.\n\t * Duplicated in block-editor block-visibility constants and edit-site\n\t * use-viewport-sync. Update all three when adding new viewport types.\n\t *\n\t * @type {Array}\n\t */\n\tconst choices = [\n\t\t{\n\t\t\tvalue: 'Desktop',\n\t\t\tlabel: __( 'Desktop' ),\n\t\t\ticon: desktop,\n\t\t\tinfo: isResponsiveEditing\n\t\t\t\t? __( 'Edit across all breakpoints.' )\n\t\t\t\t: __( 'Preview desktop viewport.' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'Tablet',\n\t\t\tlabel: __( 'Tablet' ),\n\t\t\ticon: tablet,\n\t\t\tinfo: isResponsiveEditing\n\t\t\t\t? __( 'Make tablet exclusive style changes.' )\n\t\t\t\t: __( 'Preview tablet viewport.' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'Mobile',\n\t\t\tlabel: __( 'Mobile' ),\n\t\t\ticon: mobile,\n\t\t\tinfo: isResponsiveEditing\n\t\t\t\t? __( 'Make mobile exclusive style changes.' )\n\t\t\t\t: __( 'Preview mobile viewport.' ),\n\t\t},\n\t];\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-preview-dropdown',\n\t\t\t\t`editor-preview-dropdown--${ deviceType.toLowerCase() }`\n\t\t\t) }\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<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ choices }\n\t\t\t\t\t\t\tvalue={ deviceType }\n\t\t\t\t\t\t\tonSelect={ handleDevicePreviewChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ isResponsiveEditing ? check : undefined }\n\t\t\t\t\t\t\tisSelected={ isResponsiveEditing }\n\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\tonClick={ handleResponsiveEditingChange }\n\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t'Style changes apply only to the current viewport.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Responsive editing' ) }\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 render={ <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{ ! isTemplate && !! templateId && (\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\ticon={ ! isTemplateHidden ? check : undefined }\n\t\t\t\t\t\t\t\tisSelected={ ! isTemplateHidden }\n\t\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tconst newRenderingMode = isTemplateHidden\n\t\t\t\t\t\t\t\t\t\t? 'template-locked'\n\t\t\t\t\t\t\t\t\t\t: 'post-only';\n\t\t\t\t\t\t\t\t\tsetRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t\tsetDefaultRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Show template' ) }\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\taria-label={ __( 'Preview in new tab' ) }\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<WCIcon 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\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/plugin-preview-menu\"\n\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAiC;AACjC,wBAMO;AACP,kBAAmB;AACnB,mBAAyD;AACzD,kBAAuC;AACvC,uBAAmC;AACnC,yBAA0C;AAC1C,uBAA2B;AAC3B,0BAA0C;AAC1C,gBAA+B;AAK/B,mBAAqC;AACrC,iCAA8B;AAC9B,yBAA8C;AAC9C,yBAAuB;AAqIjB;AAnIS,SAAR,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AAS,QAAQ;AAAA;AAAA,QAChC;AAAA,SACD;AAAA;AAAA,EAEF;AAEF;",
|
|
6
|
+
"names": ["editorStore", "blockEditorStore", "coreStore", "preferencesStore", "clsx", "PostPreviewButton", "WCIcon"]
|
|
7
7
|
}
|
|
@@ -46,6 +46,7 @@ var import_media_categories = __toESM(require("../media-categories/index.cjs"));
|
|
|
46
46
|
var import_utils = require("../../utils/index.cjs");
|
|
47
47
|
var import_on_success = __toESM(require("../../utils/media-upload/on-success.cjs"));
|
|
48
48
|
var import_media_sideload = __toESM(require("../../utils/media-sideload/index.cjs"));
|
|
49
|
+
var import_media_sideload_from_url = __toESM(require("../../utils/media-sideload-from-url/index.cjs"));
|
|
49
50
|
var import_media_finalize = __toESM(require("../../utils/media-finalize/index.cjs"));
|
|
50
51
|
var import_media_delete = __toESM(require("../../utils/media-delete/index.cjs"));
|
|
51
52
|
var import_store = require("../../store/index.cjs");
|
|
@@ -128,10 +129,10 @@ var {
|
|
|
128
129
|
getMediaSelectKey,
|
|
129
130
|
isIsolatedEditorKey,
|
|
130
131
|
deviceTypeKey,
|
|
131
|
-
onViewportStateChangeKey,
|
|
132
132
|
isNavigationOverlayContextKey,
|
|
133
133
|
isNavigationPostEditorKey,
|
|
134
134
|
mediaUploadOnSuccessKey,
|
|
135
|
+
mediaSideloadFromUrlKey,
|
|
135
136
|
openMediaEditorModalKey
|
|
136
137
|
} = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
137
138
|
function useBlockEditorSettings(settings, postType, postId, renderingMode) {
|
|
@@ -155,17 +156,21 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
|
|
|
155
156
|
sectionRootClientId,
|
|
156
157
|
deviceType,
|
|
157
158
|
isNavigationOverlayContext,
|
|
158
|
-
isRevisionsMode
|
|
159
|
+
isRevisionsMode,
|
|
160
|
+
viewablePostTypeLabel,
|
|
161
|
+
currentPostId
|
|
159
162
|
} = (0, import_data.useSelect)(
|
|
160
163
|
(select) => {
|
|
161
164
|
const {
|
|
162
165
|
canUser,
|
|
163
166
|
getRawEntityRecord,
|
|
164
167
|
getEntityRecord,
|
|
165
|
-
getBlockPatternCategories
|
|
168
|
+
getBlockPatternCategories,
|
|
169
|
+
getPostType
|
|
166
170
|
} = select(import_core_data.store);
|
|
167
171
|
const { get } = select(import_preferences.store);
|
|
168
172
|
const { getBlockTypes } = select(import_blocks.store);
|
|
173
|
+
const { getCurrentPostId, getCurrentPostType } = select(import_store.store);
|
|
169
174
|
const { getDeviceType, isRevisionsMode: _isRevisionsMode } = (0, import_lock_unlock.unlock)(
|
|
170
175
|
select(import_store.store)
|
|
171
176
|
);
|
|
@@ -175,6 +180,8 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
|
|
|
175
180
|
name: "site"
|
|
176
181
|
}) ? getEntityRecord("root", "site") : void 0;
|
|
177
182
|
const baseData = getEntityRecord("root", "__unstableBase");
|
|
183
|
+
const currentPostType = getCurrentPostType();
|
|
184
|
+
const postTypeObject = currentPostType ? getPostType(currentPostType) : void 0;
|
|
178
185
|
function getSectionRootBlock() {
|
|
179
186
|
if (renderingMode === "template-locked") {
|
|
180
187
|
return getBlocksByName("core/post-content")?.[0] ?? "";
|
|
@@ -211,6 +218,12 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
|
|
|
211
218
|
}),
|
|
212
219
|
pageOnFront: siteSettings?.page_on_front,
|
|
213
220
|
pageForPosts: siteSettings?.page_for_posts,
|
|
221
|
+
// The post type's singular name, but only for real, front-end
|
|
222
|
+
// rendered content (`viewable`). Empty for synced patterns,
|
|
223
|
+
// navigation and templates, which gates the attached-images
|
|
224
|
+
// category off for them and words its copy for everything else.
|
|
225
|
+
viewablePostTypeLabel: postTypeObject?.viewable ? postTypeObject?.labels?.singular_name : void 0,
|
|
226
|
+
currentPostId: getCurrentPostId(),
|
|
214
227
|
restBlockPatternCategories: getBlockPatternCategories(),
|
|
215
228
|
sectionRootClientId: getSectionRootBlock(),
|
|
216
229
|
deviceType: getDeviceType(),
|
|
@@ -249,9 +262,6 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
|
|
|
249
262
|
[settingsBlockPatternCategories, restBlockPatternCategories]
|
|
250
263
|
);
|
|
251
264
|
const { undo, setIsInserterOpened } = (0, import_data.useDispatch)(import_store.store);
|
|
252
|
-
const { updateDeviceTypeForViewportState } = (0, import_lock_unlock.unlock)(
|
|
253
|
-
(0, import_data.useDispatch)(import_store.store)
|
|
254
|
-
);
|
|
255
265
|
const { editMediaEntity } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_core_data.store));
|
|
256
266
|
const { saveEntityRecord } = (0, import_data.useDispatch)(import_core_data.store);
|
|
257
267
|
const { openMediaEditorModal } = (0, import_data.useDispatch)(mediaEditorStore);
|
|
@@ -278,6 +288,10 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
|
|
|
278
288
|
return settings.allowedBlockTypes;
|
|
279
289
|
}, [settings.allowedBlockTypes, hiddenBlockTypes, blockTypes]);
|
|
280
290
|
const forceDisableFocusMode = settings.focusMode === false;
|
|
291
|
+
const inserterMediaCategories = (0, import_element.useMemo)(
|
|
292
|
+
() => (0, import_media_categories.default)(currentPostId, viewablePostTypeLabel),
|
|
293
|
+
[currentPostId, viewablePostTypeLabel]
|
|
294
|
+
);
|
|
281
295
|
return (0, import_element.useMemo)(() => {
|
|
282
296
|
const blockEditorSettings = {
|
|
283
297
|
...Object.fromEntries(
|
|
@@ -307,6 +321,7 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
|
|
|
307
321
|
mediaUpload: hasUploadPermissions ? import_utils.mediaUpload : void 0,
|
|
308
322
|
[mediaUploadOnSuccessKey]: hasUploadPermissions ? import_on_success.default : void 0,
|
|
309
323
|
mediaSideload: hasUploadPermissions ? import_media_sideload.default : void 0,
|
|
324
|
+
[mediaSideloadFromUrlKey]: hasUploadPermissions ? import_media_sideload_from_url.default : void 0,
|
|
310
325
|
mediaFinalize: hasUploadPermissions ? import_media_finalize.default : void 0,
|
|
311
326
|
mediaDelete: hasUploadPermissions ? import_media_delete.default : void 0,
|
|
312
327
|
__experimentalBlockPatterns: blockPatterns,
|
|
@@ -319,7 +334,7 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
|
|
|
319
334
|
[userPatternCategoriesSelectKey]: __experimentalUserPatternCategoriesSelect,
|
|
320
335
|
__experimentalBlockPatternCategories: blockPatternCategories,
|
|
321
336
|
__experimentalFetchLinkSuggestions: (search, searchOptions) => (0, import_core_data.__experimentalFetchLinkSuggestions)(search, searchOptions, settings),
|
|
322
|
-
inserterMediaCategories
|
|
337
|
+
inserterMediaCategories,
|
|
323
338
|
__experimentalFetchRichUrlData: import_core_data.__experimentalFetchUrlData,
|
|
324
339
|
// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.
|
|
325
340
|
// This might be better as a generic "canUser" selector.
|
|
@@ -352,7 +367,6 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
|
|
|
352
367
|
// don't treat template parts as contentOnly sections.
|
|
353
368
|
disableContentOnlyForTemplateParts: renderingMode === "template-locked" || settings.disableContentOnlyForTemplateParts,
|
|
354
369
|
...deviceType ? { [deviceTypeKey]: deviceType } : {},
|
|
355
|
-
[onViewportStateChangeKey]: updateDeviceTypeForViewportState,
|
|
356
370
|
[isNavigationOverlayContextKey]: isNavigationOverlayContext
|
|
357
371
|
};
|
|
358
372
|
if (isRevisionsMode) {
|
|
@@ -372,6 +386,7 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
|
|
|
372
386
|
hasUploadPermissions,
|
|
373
387
|
blockPatterns,
|
|
374
388
|
blockPatternCategories,
|
|
389
|
+
inserterMediaCategories,
|
|
375
390
|
canUseUnfilteredHTML,
|
|
376
391
|
undo,
|
|
377
392
|
createPageEntity,
|
|
@@ -386,7 +401,6 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
|
|
|
386
401
|
renderingMode,
|
|
387
402
|
editMediaEntity,
|
|
388
403
|
openMediaEditorModal,
|
|
389
|
-
updateDeviceTypeForViewportState,
|
|
390
404
|
deviceType,
|
|
391
405
|
allImageSizes,
|
|
392
406
|
bigImageSizeThreshold,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/provider/use-block-editor-settings.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n\tprivateApis as coreDataPrivateApis,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tprivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { privateApis as mediaEditorPrivateApis } from '@wordpress/media-editor';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport mediaUploadOnSuccess from '../../utils/media-upload/on-success';\nimport { default as mediaSideload } from '../../utils/media-sideload';\nimport { default as mediaFinalize } from '../../utils/media-finalize';\nimport { default as mediaDelete } from '../../utils/media-delete';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useGlobalStyles } from '../global-styles';\n\nconst { store: mediaEditorStore } = unlock( mediaEditorPrivateApis );\n\nconst EMPTY_OBJECT = {};\n\nfunction __experimentalReusableBlocksSelect( select ) {\n\tconst { RECEIVE_INTERMEDIATE_RESULTS } = unlock( coreDataPrivateApis );\n\tconst { getEntityRecords } = select( coreStore );\n\treturn getEntityRecords( 'postType', 'wp_block', {\n\t\tper_page: -1,\n\t\t[ RECEIVE_INTERMEDIATE_RESULTS ]: true,\n\t} );\n}\n\nfunction __experimentalUserPatternCategoriesSelect( select ) {\n\treturn select( coreStore ).getUserPatternCategories();\n}\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockBindingsSupportedAttributes',\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'allImageSizes',\n\t'alignWide',\n\t'blockInspectorTabs',\n\t'maxUploadFileSize',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canEditCSS',\n\t'canLockBlocks',\n\t'canUpdateBlockBindings',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableContentOnlyForTemplateParts',\n\t'disableContentOnlyForUnsyncedPatterns',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'onNavigateToEntityRecord',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isPreviewMode',\n\t'isRTL',\n\t'locale',\n\t'maxWidth',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n];\n\nconst {\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tuserPatternCategoriesSelectKey,\n\tsectionRootClientIdKey,\n\tmediaEditKey,\n\tgetMediaSelectKey,\n\tisIsolatedEditorKey,\n\tdeviceTypeKey,\n\tonViewportStateChangeKey,\n\tisNavigationOverlayContextKey,\n\tisNavigationPostEditorKey,\n\tmediaUploadOnSuccessKey,\n\topenMediaEditorModalKey,\n} = unlock( privateApis );\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {string} postType Editor root level post type.\n * @param {string} postId Editor root level post ID.\n * @param {string} renderingMode Editor rendering mode.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, postType, postId, renderingMode ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tallImageSizes,\n\t\tbigImageSizeThreshold,\n\t\tallowRightClickOverrides,\n\t\tblockTypes,\n\t\tfocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\thasUploadPermissions,\n\t\thiddenBlockTypes,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\trestBlockPatternCategories,\n\t\tsectionRootClientId,\n\t\tdeviceType,\n\t\tisNavigationOverlayContext,\n\t\tisRevisionsMode,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanUser,\n\t\t\t\tgetRawEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetBlockPatternCategories,\n\t\t\t} = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst { getDeviceType, isRevisionsMode: _isRevisionsMode } = unlock(\n\t\t\t\tselect( editorStore )\n\t\t\t);\n\t\t\tconst { getBlocksByName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\t// Fetch image sizes from REST API index for client-side media processing.\n\t\t\tconst baseData = getEntityRecord( 'root', '__unstableBase' );\n\n\t\t\tfunction getSectionRootBlock() {\n\t\t\t\tif ( renderingMode === 'template-locked' ) {\n\t\t\t\t\treturn getBlocksByName( 'core/post-content' )?.[ 0 ] ?? '';\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tgetBlocksByName( 'core/group' ).find(\n\t\t\t\t\t\t( clientId ) =>\n\t\t\t\t\t\t\tgetBlockAttributes( clientId )?.tagName === 'main'\n\t\t\t\t\t) ?? ''\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tallImageSizes: baseData?.image_sizes,\n\t\t\t\tbigImageSizeThreshold: baseData?.image_size_threshold,\n\t\t\t\tallowRightClickOverrides: get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'allowRightClickOverrides'\n\t\t\t\t),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tcanUseUnfilteredHTML: getRawEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),\n\t\t\t\tfocusMode: get( 'core', 'focusMode' ),\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tget( 'core', 'fixedToolbar' ) || ! isLargeViewport,\n\t\t\t\thiddenBlockTypes: get( 'core', 'hiddenBlockTypes' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tkeepCaretInsideBlock: get( 'core', 'keepCaretInsideBlock' ),\n\t\t\t\thasUploadPermissions:\n\t\t\t\t\tcanUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'attachment',\n\t\t\t\t\t} ) ?? true,\n\t\t\t\tuserCanCreatePages: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'page',\n\t\t\t\t} ),\n\t\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\t\trestBlockPatternCategories: getBlockPatternCategories(),\n\t\t\t\tsectionRootClientId: getSectionRootBlock(),\n\t\t\t\tdeviceType: getDeviceType(),\n\t\t\t\tisNavigationOverlayContext:\n\t\t\t\t\tpostType === 'wp_template_part' && postId\n\t\t\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t'wp_template_part',\n\t\t\t\t\t\t\t\tpostId\n\t\t\t\t\t\t )?.area === 'navigation-overlay'\n\t\t\t\t\t\t: false,\n\t\t\t\tisRevisionsMode: _isRevisionsMode(),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, isLargeViewport, renderingMode ]\n\t);\n\n\tconst { merged: mergedGlobalStyles } = useGlobalStyles();\n\tconst globalStylesData = mergedGlobalStyles.styles ?? EMPTY_OBJECT;\n\tconst globalStylesLinksData = mergedGlobalStyles._links ?? EMPTY_OBJECT;\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( settingsBlockPatterns || [] ) ].filter(\n\t\t\t\t( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t),\n\t\t[ settingsBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo, setIsInserterOpened } = useDispatch( editorStore );\n\tconst { updateDeviceTypeForViewportState } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst { editMediaEntity } = unlock( useDispatch( coreStore ) );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { openMediaEditorModal } = useDispatch( mediaEditorStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\n\t);\n\n\tconst allowedBlockTypes = useMemo( () => {\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes && hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\treturn defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings.allowedBlockTypes;\n\t}, [ settings.allowedBlockTypes, hiddenBlockTypes, blockTypes ] );\n\n\tconst forceDisableFocusMode = settings.focusMode === false;\n\n\treturn useMemo( () => {\n\t\tconst blockEditorSettings = {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\t[ globalStylesDataKey ]: globalStylesData,\n\t\t\t[ globalStylesLinksDataKey ]: globalStylesLinksData,\n\t\t\tallImageSizes,\n\t\t\tbigImageSizeThreshold,\n\t\t\tallowedBlockTypes,\n\t\t\tallowRightClickOverrides,\n\t\t\tfocusMode: focusMode && ! forceDisableFocusMode,\n\t\t\thasFixedToolbar,\n\t\t\tisDistractionFree,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t[ getMediaSelectKey ]: ( select, attachmentId ) => {\n\t\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tattachmentId\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ mediaEditKey ]: hasUploadPermissions\n\t\t\t\t? editMediaEntity\n\t\t\t\t: undefined,\n\t\t\t[ openMediaEditorModalKey ]: ( { id, onUpdate, onClose } ) =>\n\t\t\t\topenMediaEditorModal( { id, onUpdate, onClose } ),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t[ mediaUploadOnSuccessKey ]: hasUploadPermissions\n\t\t\t\t? mediaUploadOnSuccess\n\t\t\t\t: undefined,\n\t\t\tmediaSideload: hasUploadPermissions ? mediaSideload : undefined,\n\t\t\tmediaFinalize: hasUploadPermissions ? mediaFinalize : undefined,\n\t\t\tmediaDelete: hasUploadPermissions ? mediaDelete : undefined,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t[ selectBlockPatternsKey ]: ( select ) => {\n\t\t\t\tconst { hasFinishedResolution, getBlockPatternsForPostType } =\n\t\t\t\t\tunlock( select( coreStore ) );\n\t\t\t\tconst patterns = getBlockPatternsForPostType( postType );\n\t\t\t\treturn hasFinishedResolution( 'getBlockPatterns' )\n\t\t\t\t\t? patterns\n\t\t\t\t\t: undefined;\n\t\t\t},\n\t\t\t[ reusableBlocksSelectKey ]: __experimentalReusableBlocksSelect,\n\t\t\t[ userPatternCategoriesSelectKey ]:\n\t\t\t\t__experimentalUserPatternCategoriesSelect,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.\n\t\t\t// This might be better as a generic \"canUser\" selector.\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t//Todo: this is only needed for native and should probably be removed.\n\t\t\t__experimentalUndo: undo,\n\t\t\t// Check whether we want all site editor frames to have outlines\n\t\t\t// including the navigation / pattern / parts editors.\n\t\t\toutlineMode: ! isDistractionFree && postType === 'wp_template',\n\t\t\t// Check these two properties: they were not present in the site editor.\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\t__experimentalPreferPatternsOnRoot: postType === 'wp_template',\n\t\t\ttemplateLock:\n\t\t\t\tpostType === 'wp_navigation' ? 'insert' : settings.templateLock,\n\t\t\ttemplate:\n\t\t\t\tpostType === 'wp_navigation'\n\t\t\t\t\t? [ [ 'core/navigation', {}, [] ] ]\n\t\t\t\t\t: settings.template,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\t[ sectionRootClientIdKey ]: sectionRootClientId,\n\t\t\teditorTool:\n\t\t\t\trenderingMode === 'post-only' && postType !== 'wp_template'\n\t\t\t\t\t? 'edit'\n\t\t\t\t\t: undefined,\n\t\t\t// When editing template parts, patterns, or navigation directly,\n\t\t\t// we're in an isolated editing context (focused on that entity alone).\n\t\t\t[ isIsolatedEditorKey ]: [\n\t\t\t\t'wp_template_part',\n\t\t\t\t'wp_block',\n\t\t\t\t'wp_navigation',\n\t\t\t].includes( postType ),\n\t\t\t[ isNavigationPostEditorKey ]: postType === 'wp_navigation',\n\t\t\t// When in template-locked mode (e.g., \"Show Template\" in the post editor),\n\t\t\t// don't treat template parts as contentOnly sections.\n\t\t\tdisableContentOnlyForTemplateParts:\n\t\t\t\trenderingMode === 'template-locked' ||\n\t\t\t\tsettings.disableContentOnlyForTemplateParts,\n\t\t\t...( deviceType ? { [ deviceTypeKey ]: deviceType } : {} ),\n\t\t\t[ onViewportStateChangeKey ]: updateDeviceTypeForViewportState,\n\t\t\t[ isNavigationOverlayContextKey ]: isNavigationOverlayContext,\n\t\t};\n\n\t\tif ( isRevisionsMode ) {\n\t\t\tblockEditorSettings.isPreviewMode = true;\n\t\t}\n\n\t\treturn blockEditorSettings;\n\t}, [\n\t\tisRevisionsMode,\n\t\tallowedBlockTypes,\n\t\tallowRightClickOverrides,\n\t\tfocusMode,\n\t\tforceDisableFocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\tsettings,\n\t\thasUploadPermissions,\n\t\tblockPatterns,\n\t\tblockPatternCategories,\n\t\tcanUseUnfilteredHTML,\n\t\tundo,\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tpostType,\n\t\tsetIsInserterOpened,\n\t\tsectionRootClientId,\n\t\tglobalStylesData,\n\t\tglobalStylesLinksData,\n\t\trenderingMode,\n\t\teditMediaEntity,\n\t\topenMediaEditorModal,\n\t\tupdateDeviceTypeForViewportState,\n\t\tdeviceType,\n\t\tallImageSizes,\n\t\tbigImageSizeThreshold,\n\t\tisNavigationOverlayContext,\n\t] );\n}\n\nexport default useBlockEditorSettings;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAqC;AACrC,kBAAuC;AACvC,uBAKO;AACP,kBAAmB;AACnB,yBAA0C;AAC1C,qBAAiC;AACjC,oBAAqC;AACrC,0BAGO;AACP,0BAAsD;AAKtD,
|
|
6
|
-
"names": ["mediaEditorPrivateApis", "coreDataPrivateApis", "coreStore", "preferencesStore", "blocksStore", "editorStore", "blockEditorStore", "mediaUploadOnSuccess", "mediaSideload", "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n\tprivateApis as coreDataPrivateApis,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tprivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { privateApis as mediaEditorPrivateApis } from '@wordpress/media-editor';\n\n/**\n * Internal dependencies\n */\nimport getInserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport mediaUploadOnSuccess from '../../utils/media-upload/on-success';\nimport { default as mediaSideload } from '../../utils/media-sideload';\nimport { default as mediaSideloadFromUrl } from '../../utils/media-sideload-from-url';\nimport { default as mediaFinalize } from '../../utils/media-finalize';\nimport { default as mediaDelete } from '../../utils/media-delete';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useGlobalStyles } from '../global-styles';\n\nconst { store: mediaEditorStore } = unlock( mediaEditorPrivateApis );\n\nconst EMPTY_OBJECT = {};\n\nfunction __experimentalReusableBlocksSelect( select ) {\n\tconst { RECEIVE_INTERMEDIATE_RESULTS } = unlock( coreDataPrivateApis );\n\tconst { getEntityRecords } = select( coreStore );\n\treturn getEntityRecords( 'postType', 'wp_block', {\n\t\tper_page: -1,\n\t\t[ RECEIVE_INTERMEDIATE_RESULTS ]: true,\n\t} );\n}\n\nfunction __experimentalUserPatternCategoriesSelect( select ) {\n\treturn select( coreStore ).getUserPatternCategories();\n}\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockBindingsSupportedAttributes',\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'allImageSizes',\n\t'alignWide',\n\t'blockInspectorTabs',\n\t'maxUploadFileSize',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canEditCSS',\n\t'canLockBlocks',\n\t'canUpdateBlockBindings',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableContentOnlyForTemplateParts',\n\t'disableContentOnlyForUnsyncedPatterns',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'onNavigateToEntityRecord',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isPreviewMode',\n\t'isRTL',\n\t'locale',\n\t'maxWidth',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n];\n\nconst {\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tuserPatternCategoriesSelectKey,\n\tsectionRootClientIdKey,\n\tmediaEditKey,\n\tgetMediaSelectKey,\n\tisIsolatedEditorKey,\n\tdeviceTypeKey,\n\tisNavigationOverlayContextKey,\n\tisNavigationPostEditorKey,\n\tmediaUploadOnSuccessKey,\n\tmediaSideloadFromUrlKey,\n\topenMediaEditorModalKey,\n} = unlock( privateApis );\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {string} postType Editor root level post type.\n * @param {string} postId Editor root level post ID.\n * @param {string} renderingMode Editor rendering mode.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, postType, postId, renderingMode ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tallImageSizes,\n\t\tbigImageSizeThreshold,\n\t\tallowRightClickOverrides,\n\t\tblockTypes,\n\t\tfocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\thasUploadPermissions,\n\t\thiddenBlockTypes,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\trestBlockPatternCategories,\n\t\tsectionRootClientId,\n\t\tdeviceType,\n\t\tisNavigationOverlayContext,\n\t\tisRevisionsMode,\n\t\tviewablePostTypeLabel,\n\t\tcurrentPostId,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanUser,\n\t\t\t\tgetRawEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetBlockPatternCategories,\n\t\t\t\tgetPostType,\n\t\t\t} = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst { getCurrentPostId, getCurrentPostType } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getDeviceType, isRevisionsMode: _isRevisionsMode } = unlock(\n\t\t\t\tselect( editorStore )\n\t\t\t);\n\t\t\tconst { getBlocksByName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\t// Fetch image sizes from REST API index for client-side media processing.\n\t\t\tconst baseData = getEntityRecord( 'root', '__unstableBase' );\n\n\t\t\t// The attached-images category follows the post being edited, not the\n\t\t\t// root-level entity in `postType`/`postId`. With \"Show template\" on,\n\t\t\t// the root becomes the template (wp_template), but media still attaches\n\t\t\t// to the page being edited.\n\t\t\t//\n\t\t\t// Guard on a truthy slug: `getPostType()` with no slug resolves the\n\t\t\t// whole `/wp/v2/types` collection rather than the single, already\n\t\t\t// fetched record for the current type.\n\t\t\tconst currentPostType = getCurrentPostType();\n\t\t\tconst postTypeObject = currentPostType\n\t\t\t\t? getPostType( currentPostType )\n\t\t\t\t: undefined;\n\n\t\t\tfunction getSectionRootBlock() {\n\t\t\t\tif ( renderingMode === 'template-locked' ) {\n\t\t\t\t\treturn getBlocksByName( 'core/post-content' )?.[ 0 ] ?? '';\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tgetBlocksByName( 'core/group' ).find(\n\t\t\t\t\t\t( clientId ) =>\n\t\t\t\t\t\t\tgetBlockAttributes( clientId )?.tagName === 'main'\n\t\t\t\t\t) ?? ''\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tallImageSizes: baseData?.image_sizes,\n\t\t\t\tbigImageSizeThreshold: baseData?.image_size_threshold,\n\t\t\t\tallowRightClickOverrides: get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'allowRightClickOverrides'\n\t\t\t\t),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tcanUseUnfilteredHTML: getRawEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),\n\t\t\t\tfocusMode: get( 'core', 'focusMode' ),\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tget( 'core', 'fixedToolbar' ) || ! isLargeViewport,\n\t\t\t\thiddenBlockTypes: get( 'core', 'hiddenBlockTypes' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tkeepCaretInsideBlock: get( 'core', 'keepCaretInsideBlock' ),\n\t\t\t\thasUploadPermissions:\n\t\t\t\t\tcanUser( 'create', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'attachment',\n\t\t\t\t\t} ) ?? true,\n\t\t\t\tuserCanCreatePages: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'page',\n\t\t\t\t} ),\n\t\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\t\t// The post type's singular name, but only for real, front-end\n\t\t\t\t// rendered content (`viewable`). Empty for synced patterns,\n\t\t\t\t// navigation and templates, which gates the attached-images\n\t\t\t\t// category off for them and words its copy for everything else.\n\t\t\t\tviewablePostTypeLabel: postTypeObject?.viewable\n\t\t\t\t\t? postTypeObject?.labels?.singular_name\n\t\t\t\t\t: undefined,\n\t\t\t\tcurrentPostId: getCurrentPostId(),\n\t\t\t\trestBlockPatternCategories: getBlockPatternCategories(),\n\t\t\t\tsectionRootClientId: getSectionRootBlock(),\n\t\t\t\tdeviceType: getDeviceType(),\n\t\t\t\tisNavigationOverlayContext:\n\t\t\t\t\tpostType === 'wp_template_part' && postId\n\t\t\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t'wp_template_part',\n\t\t\t\t\t\t\t\tpostId\n\t\t\t\t\t\t )?.area === 'navigation-overlay'\n\t\t\t\t\t\t: false,\n\t\t\t\tisRevisionsMode: _isRevisionsMode(),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, isLargeViewport, renderingMode ]\n\t);\n\n\tconst { merged: mergedGlobalStyles } = useGlobalStyles();\n\tconst globalStylesData = mergedGlobalStyles.styles ?? EMPTY_OBJECT;\n\tconst globalStylesLinksData = mergedGlobalStyles._links ?? EMPTY_OBJECT;\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( settingsBlockPatterns || [] ) ].filter(\n\t\t\t\t( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t),\n\t\t[ settingsBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo, setIsInserterOpened } = useDispatch( editorStore );\n\tconst { editMediaEntity } = unlock( useDispatch( coreStore ) );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { openMediaEditorModal } = useDispatch( mediaEditorStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\n\t);\n\n\tconst allowedBlockTypes = useMemo( () => {\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes && hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\treturn defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings.allowedBlockTypes;\n\t}, [ settings.allowedBlockTypes, hiddenBlockTypes, blockTypes ] );\n\n\tconst forceDisableFocusMode = settings.focusMode === false;\n\n\t// The \"Attachments\" media category depends on the edited post and its post\n\t// type label (which gates whether it's offered and words its copy), so the\n\t// categories are derived rather than being a static list.\n\tconst inserterMediaCategories = useMemo(\n\t\t() =>\n\t\t\tgetInserterMediaCategories( currentPostId, viewablePostTypeLabel ),\n\t\t[ currentPostId, viewablePostTypeLabel ]\n\t);\n\n\treturn useMemo( () => {\n\t\tconst blockEditorSettings = {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\t[ globalStylesDataKey ]: globalStylesData,\n\t\t\t[ globalStylesLinksDataKey ]: globalStylesLinksData,\n\t\t\tallImageSizes,\n\t\t\tbigImageSizeThreshold,\n\t\t\tallowedBlockTypes,\n\t\t\tallowRightClickOverrides,\n\t\t\tfocusMode: focusMode && ! forceDisableFocusMode,\n\t\t\thasFixedToolbar,\n\t\t\tisDistractionFree,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t[ getMediaSelectKey ]: ( select, attachmentId ) => {\n\t\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tattachmentId\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ mediaEditKey ]: hasUploadPermissions\n\t\t\t\t? editMediaEntity\n\t\t\t\t: undefined,\n\t\t\t[ openMediaEditorModalKey ]: ( { id, onUpdate, onClose } ) =>\n\t\t\t\topenMediaEditorModal( { id, onUpdate, onClose } ),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t[ mediaUploadOnSuccessKey ]: hasUploadPermissions\n\t\t\t\t? mediaUploadOnSuccess\n\t\t\t\t: undefined,\n\t\t\tmediaSideload: hasUploadPermissions ? mediaSideload : undefined,\n\t\t\t[ mediaSideloadFromUrlKey ]: hasUploadPermissions\n\t\t\t\t? mediaSideloadFromUrl\n\t\t\t\t: undefined,\n\t\t\tmediaFinalize: hasUploadPermissions ? mediaFinalize : undefined,\n\t\t\tmediaDelete: hasUploadPermissions ? mediaDelete : undefined,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t[ selectBlockPatternsKey ]: ( select ) => {\n\t\t\t\tconst { hasFinishedResolution, getBlockPatternsForPostType } =\n\t\t\t\t\tunlock( select( coreStore ) );\n\t\t\t\tconst patterns = getBlockPatternsForPostType( postType );\n\t\t\t\treturn hasFinishedResolution( 'getBlockPatterns' )\n\t\t\t\t\t? patterns\n\t\t\t\t\t: undefined;\n\t\t\t},\n\t\t\t[ reusableBlocksSelectKey ]: __experimentalReusableBlocksSelect,\n\t\t\t[ userPatternCategoriesSelectKey ]:\n\t\t\t\t__experimentalUserPatternCategoriesSelect,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.\n\t\t\t// This might be better as a generic \"canUser\" selector.\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t//Todo: this is only needed for native and should probably be removed.\n\t\t\t__experimentalUndo: undo,\n\t\t\t// Check whether we want all site editor frames to have outlines\n\t\t\t// including the navigation / pattern / parts editors.\n\t\t\toutlineMode: ! isDistractionFree && postType === 'wp_template',\n\t\t\t// Check these two properties: they were not present in the site editor.\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\t__experimentalPreferPatternsOnRoot: postType === 'wp_template',\n\t\t\ttemplateLock:\n\t\t\t\tpostType === 'wp_navigation' ? 'insert' : settings.templateLock,\n\t\t\ttemplate:\n\t\t\t\tpostType === 'wp_navigation'\n\t\t\t\t\t? [ [ 'core/navigation', {}, [] ] ]\n\t\t\t\t\t: settings.template,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\t[ sectionRootClientIdKey ]: sectionRootClientId,\n\t\t\teditorTool:\n\t\t\t\trenderingMode === 'post-only' && postType !== 'wp_template'\n\t\t\t\t\t? 'edit'\n\t\t\t\t\t: undefined,\n\t\t\t// When editing template parts, patterns, or navigation directly,\n\t\t\t// we're in an isolated editing context (focused on that entity alone).\n\t\t\t[ isIsolatedEditorKey ]: [\n\t\t\t\t'wp_template_part',\n\t\t\t\t'wp_block',\n\t\t\t\t'wp_navigation',\n\t\t\t].includes( postType ),\n\t\t\t[ isNavigationPostEditorKey ]: postType === 'wp_navigation',\n\t\t\t// When in template-locked mode (e.g., \"Show Template\" in the post editor),\n\t\t\t// don't treat template parts as contentOnly sections.\n\t\t\tdisableContentOnlyForTemplateParts:\n\t\t\t\trenderingMode === 'template-locked' ||\n\t\t\t\tsettings.disableContentOnlyForTemplateParts,\n\t\t\t...( deviceType ? { [ deviceTypeKey ]: deviceType } : {} ),\n\t\t\t[ isNavigationOverlayContextKey ]: isNavigationOverlayContext,\n\t\t};\n\n\t\tif ( isRevisionsMode ) {\n\t\t\tblockEditorSettings.isPreviewMode = true;\n\t\t}\n\n\t\treturn blockEditorSettings;\n\t}, [\n\t\tisRevisionsMode,\n\t\tallowedBlockTypes,\n\t\tallowRightClickOverrides,\n\t\tfocusMode,\n\t\tforceDisableFocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\tsettings,\n\t\thasUploadPermissions,\n\t\tblockPatterns,\n\t\tblockPatternCategories,\n\t\tinserterMediaCategories,\n\t\tcanUseUnfilteredHTML,\n\t\tundo,\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tpostType,\n\t\tsetIsInserterOpened,\n\t\tsectionRootClientId,\n\t\tglobalStylesData,\n\t\tglobalStylesLinksData,\n\t\trenderingMode,\n\t\teditMediaEntity,\n\t\topenMediaEditorModal,\n\t\tdeviceType,\n\t\tallImageSizes,\n\t\tbigImageSizeThreshold,\n\t\tisNavigationOverlayContext,\n\t] );\n}\n\nexport default useBlockEditorSettings;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAqC;AACrC,kBAAuC;AACvC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E,yBAA0B,GAAG,aAAa;AAAA;AAAA;AAAA,MAG5C,oCACC,kBAAkB,qBAClB,SAAS;AAAA,MACV,GAAK,aAAa,EAAE,CAAE,aAAc,GAAG,WAAW,IAAI,CAAC;AAAA,MACvD,CAAE,6BAA8B,GAAG;AAAA,IACpC;AAEA,QAAK,iBAAkB;AACtB,0BAAoB,gBAAgB;AAAA,IACrC;AAEA,WAAO;AAAA,EACR,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;AAEA,IAAO,oCAAQ;",
|
|
6
|
+
"names": ["mediaEditorPrivateApis", "coreDataPrivateApis", "coreStore", "preferencesStore", "blocksStore", "editorStore", "blockEditorStore", "getInserterMediaCategories", "mediaUploadOnSuccess", "mediaSideload", "mediaSideloadFromUrl", "mediaFinalize", "mediaDelete", "fetchLinkSuggestions", "fetchUrlData"]
|
|
7
7
|
}
|
|
@@ -34,9 +34,12 @@ __export(resizable_editor_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(resizable_editor_exports);
|
|
36
36
|
var import_clsx = __toESM(require("clsx"));
|
|
37
|
+
var import_data = require("@wordpress/data");
|
|
37
38
|
var import_element = require("@wordpress/element");
|
|
38
39
|
var import_components = require("@wordpress/components");
|
|
39
40
|
var import_resize_handle = __toESM(require("./resize-handle.cjs"));
|
|
41
|
+
var import_store = require("../../store/index.cjs");
|
|
42
|
+
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
40
43
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
44
|
var HANDLE_STYLES_OVERRIDE = {
|
|
42
45
|
position: void 0,
|
|
@@ -49,29 +52,71 @@ var HANDLE_STYLES_OVERRIDE = {
|
|
|
49
52
|
bottom: void 0,
|
|
50
53
|
left: void 0
|
|
51
54
|
};
|
|
55
|
+
function isAtMaxWidth(currentWidth, containerWidth, tolerance = 0) {
|
|
56
|
+
return containerWidth > 0 && currentWidth >= containerWidth - tolerance;
|
|
57
|
+
}
|
|
52
58
|
function ResizableEditor({ className, enableResizing, height, children }) {
|
|
53
|
-
const [
|
|
59
|
+
const [isResizing, setIsResizing] = (0, import_element.useState)(false);
|
|
60
|
+
const { setCanvasWidth } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_store.store));
|
|
61
|
+
const canvasWidth = (0, import_data.useSelect)(
|
|
62
|
+
(select) => {
|
|
63
|
+
if (!enableResizing) {
|
|
64
|
+
return void 0;
|
|
65
|
+
}
|
|
66
|
+
const { getCanvasWidth } = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
67
|
+
return getCanvasWidth();
|
|
68
|
+
},
|
|
69
|
+
[enableResizing]
|
|
70
|
+
);
|
|
54
71
|
const resizableRef = (0, import_element.useRef)();
|
|
55
|
-
const resizeWidthBy = (0, import_element.useCallback)(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
72
|
+
const resizeWidthBy = (0, import_element.useCallback)(
|
|
73
|
+
(deltaPixels) => {
|
|
74
|
+
if (resizableRef.current) {
|
|
75
|
+
const _isAtMaxWidth = isAtMaxWidth(
|
|
76
|
+
resizableRef.current.offsetWidth + deltaPixels,
|
|
77
|
+
resizableRef.current.parentElement?.offsetWidth ?? 0,
|
|
78
|
+
80
|
|
79
|
+
);
|
|
80
|
+
setCanvasWidth(
|
|
81
|
+
_isAtMaxWidth ? void 0 : resizableRef.current.offsetWidth + deltaPixels
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
[setCanvasWidth]
|
|
86
|
+
);
|
|
87
|
+
const updateCanvasWidth = (0, import_element.useCallback)(
|
|
88
|
+
(element) => {
|
|
89
|
+
const currentWidth = element.offsetWidth;
|
|
90
|
+
const containerWidth = element.parentElement?.offsetWidth ?? 0;
|
|
91
|
+
setCanvasWidth(
|
|
92
|
+
isAtMaxWidth(currentWidth, containerWidth, 80) ? void 0 : currentWidth
|
|
93
|
+
);
|
|
94
|
+
},
|
|
95
|
+
[setCanvasWidth]
|
|
96
|
+
);
|
|
60
97
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
61
98
|
import_components.ResizableBox,
|
|
62
99
|
{
|
|
63
100
|
className: (0, import_clsx.default)("editor-resizable-editor", className, {
|
|
64
|
-
"is-resizable": enableResizing
|
|
101
|
+
"is-resizable": enableResizing,
|
|
102
|
+
"is-resizing": isResizing
|
|
65
103
|
}),
|
|
66
104
|
ref: (api) => {
|
|
67
105
|
resizableRef.current = api?.resizable;
|
|
68
106
|
},
|
|
69
107
|
size: {
|
|
70
|
-
width: enableResizing ?
|
|
108
|
+
width: enableResizing && canvasWidth ? canvasWidth + "px" : "100%",
|
|
71
109
|
height: enableResizing && height ? height : "100%"
|
|
72
110
|
},
|
|
111
|
+
onResizeStart: () => {
|
|
112
|
+
setIsResizing(true);
|
|
113
|
+
},
|
|
114
|
+
onResize: (event, direction, element) => {
|
|
115
|
+
updateCanvasWidth(element);
|
|
116
|
+
},
|
|
73
117
|
onResizeStop: (event, direction, element) => {
|
|
74
|
-
|
|
118
|
+
setIsResizing(false);
|
|
119
|
+
updateCanvasWidth(element);
|
|
75
120
|
},
|
|
76
121
|
minWidth: 300,
|
|
77
122
|
maxWidth: "100%",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/resizable-editor/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAA8C;AAC9C,wBAA6B;AAK7B,2BAAyB;
|
|
6
|
-
"names": ["clsx", "ResizeHandle"]
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRef, useCallback, useState } from '@wordpress/element';\nimport { ResizableBox } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ResizeHandle from './resize-handle';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n/**\n * Checks if the current width is at the max width.\n *\n * @param {number} currentWidth - The current width of the editor.\n * @param {number} containerWidth - The width of the container.\n * @param {number} tolerance - The tolerance for the max width in pixels.\n * @return {boolean} - True if the current width is at the max width, false otherwise.\n */\nfunction isAtMaxWidth( currentWidth, containerWidth, tolerance = 0 ) {\n\treturn containerWidth > 0 && currentWidth >= containerWidth - tolerance;\n}\n\nfunction ResizableEditor( { className, enableResizing, height, children } ) {\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst { setCanvasWidth } = unlock( useDispatch( editorStore ) );\n\tconst canvasWidth = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! enableResizing ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst { getCanvasWidth } = unlock( select( editorStore ) );\n\t\t\treturn getCanvasWidth();\n\t\t},\n\t\t[ enableResizing ]\n\t);\n\n\tconst resizableRef = useRef();\n\tconst resizeWidthBy = useCallback(\n\t\t( deltaPixels ) => {\n\t\t\tif ( resizableRef.current ) {\n\t\t\t\tconst _isAtMaxWidth = isAtMaxWidth(\n\t\t\t\t\tresizableRef.current.offsetWidth + deltaPixels,\n\t\t\t\t\tresizableRef.current.parentElement?.offsetWidth ?? 0,\n\t\t\t\t\t80\n\t\t\t\t);\n\t\t\t\tsetCanvasWidth(\n\t\t\t\t\t_isAtMaxWidth\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: resizableRef.current.offsetWidth + deltaPixels\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ setCanvasWidth ]\n\t);\n\n\tconst updateCanvasWidth = useCallback(\n\t\t( element ) => {\n\t\t\tconst currentWidth = element.offsetWidth;\n\t\t\tconst containerWidth = element.parentElement?.offsetWidth ?? 0;\n\t\t\tsetCanvasWidth(\n\t\t\t\tisAtMaxWidth( currentWidth, containerWidth, 80 )\n\t\t\t\t\t? undefined\n\t\t\t\t\t: currentWidth\n\t\t\t);\n\t\t},\n\t\t[ setCanvasWidth ]\n\t);\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tclassName={ clsx( 'editor-resizable-editor', className, {\n\t\t\t\t'is-resizable': enableResizing,\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t} ) }\n\t\t\tref={ ( api ) => {\n\t\t\t\tresizableRef.current = api?.resizable;\n\t\t\t} }\n\t\t\tsize={ {\n\t\t\t\twidth:\n\t\t\t\t\tenableResizing && canvasWidth ? canvasWidth + 'px' : '100%',\n\t\t\t\theight: enableResizing && height ? height : '100%',\n\t\t\t} }\n\t\t\tonResizeStart={ () => {\n\t\t\t\tsetIsResizing( true );\n\t\t\t} }\n\t\t\tonResize={ ( event, direction, element ) => {\n\t\t\t\tupdateCanvasWidth( element );\n\t\t\t} }\n\t\t\tonResizeStop={ ( event, direction, element ) => {\n\t\t\t\tsetIsResizing( false );\n\t\t\t\tupdateCanvasWidth( element );\n\t\t\t} }\n\t\t\tminWidth={ 300 }\n\t\t\tmaxWidth=\"100%\"\n\t\t\tmaxHeight=\"100%\"\n\t\t\tenable={ {\n\t\t\t\tleft: enableResizing,\n\t\t\t\tright: enableResizing,\n\t\t\t} }\n\t\t\tshowHandle={ enableResizing }\n\t\t\t// The editor is centered horizontally, resizing it only\n\t\t\t// moves half the distance. Hence double the ratio to correctly\n\t\t\t// align the cursor to the resizer handle.\n\t\t\tresizeRatio={ 2 }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"left\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tright: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"right\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t} }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableEditor;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAuC;AACvC,qBAA8C;AAC9C,wBAA6B;AAK7B,2BAAyB;AACzB,mBAAqC;AACrC,yBAAuB;AA+GlB;AA5GL,IAAM,yBAAyB;AAAA,EAC9B,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACP;AAUA,SAAS,aAAc,cAAc,gBAAgB,YAAY,GAAI;AACpE,SAAO,iBAAiB,KAAK,gBAAgB,iBAAi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kBAAkB,SAAS,SAAS;AAAA,MAC7C;AAAA,MACA,eAAgB,MAAM;AACrB,sBAAe,IAAK;AAAA,MACrB;AAAA,MACA,UAAW,CAAE,OAAO,WAAW,YAAa;AAC3C,0BAAmB,OAAQ;AAAA,MAC5B;AAAA,MACA,cAAe,CAAE,OAAO,WAAW,YAAa;AAC/C,sBAAe,KAAM;AACrB,0BAAmB,OAAQ;AAAA,MAC5B;AAAA,MACA,UAAW;AAAA,MACX,UAAS;AAAA,MACT,WAAU;AAAA,MACV,QAAS;AAAA,QACR,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA,YAAa;AAAA,MAIb,aAAc;AAAA,MACd,iBAAkB;AAAA,QACjB,MACC;AAAA,UAAC,qBAAAC;AAAA,UAAA;AAAA,YACA,WAAU;AAAA,YACV;AAAA;AAAA,QACD;AAAA,QAED,OACC;AAAA,UAAC,qBAAAA;AAAA,UAAA;AAAA,YACA,WAAU;AAAA,YACV;AAAA;AAAA,QACD;AAAA,MAEF;AAAA,MACA,eAAgB;AAAA,MAChB,cAAe;AAAA,QACd,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MAEE;AAAA;AAAA,EACH;AAEF;AAEA,IAAO,2BAAQ;",
|
|
6
|
+
"names": ["editorStore", "clsx", "ResizeHandle"]
|
|
7
7
|
}
|
|
@@ -41,6 +41,7 @@ var import_ui = require("@wordpress/ui");
|
|
|
41
41
|
var import_element = require("@wordpress/element");
|
|
42
42
|
var import_views = require("@wordpress/views");
|
|
43
43
|
var import_post_card_panel = __toESM(require("../post-card-panel/index.cjs"));
|
|
44
|
+
var import_plugin_post_status_info = __toESM(require("../plugin-post-status-info/index.cjs"));
|
|
44
45
|
var import_post_panel_section = __toESM(require("../post-panel-section/index.cjs"));
|
|
45
46
|
var import_store = require("../../store/index.cjs");
|
|
46
47
|
var import_post_trash = __toESM(require("../post-trash/index.cjs"));
|
|
@@ -306,7 +307,10 @@ function DataFormPostSummary({ onActionPerformed }) {
|
|
|
306
307
|
onChange
|
|
307
308
|
}
|
|
308
309
|
),
|
|
309
|
-
!isPostStatusRemoved && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
310
|
+
!isPostStatusRemoved && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
311
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_post_status_info.default.Slot, { children: (fills) => fills.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Stack, { direction: "column", gap: "xs", children: fills }) }),
|
|
312
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_trash.default, { onActionPerformed })
|
|
313
|
+
] })
|
|
310
314
|
] }) });
|
|
311
315
|
}
|
|
312
316
|
//# sourceMappingURL=dataform-post-summary.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar/dataform-post-summary.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { DataForm } from '@wordpress/dataviews';\nimport { Stack } from '@wordpress/ui';\nimport { useMemo } from '@wordpress/element';\nimport { useViewConfig } from '@wordpress/views';\n\n/**\n * Internal dependencies\n */\nimport PostCardPanel from '../post-card-panel';\nimport PostPanelSection from '../post-panel-section';\nimport { store as editorStore } from '../../store';\nimport PostTrash from '../post-trash';\nimport usePostFields from '../post-fields';\nimport { usePostTemplatePanelMode } from '../post-template/hooks';\nimport revisionsField from '../../dataviews/fields/revisions';\n\nconst EMPTY_FORM = { layout: { type: 'panel' }, fields: [] };\nconst VIEW_CONFIG_FIELDS = [ 'form' ];\n\n/**\n * Bridges the legacy editor-panel visibility controls onto the DataForm summary,\n * returning the form with the hidden fields removed. The new inspector has no\n * concept of the Preferences → Panels switches or of `removeEditorPanel`, so we\n * reproduce their effect on the form.\n *\n * @param {Object} form The DataForm summary form configuration.\n * @return {Object} The form with the hidden fields removed.\n */\nfunction useInspectorPanelVisibility( form ) {\n\tconst {\n\t\tisPostStatusRemoved,\n\t\tfeaturedImageEnabled,\n\t\texcerptEnabled,\n\t\tdiscussionEnabled,\n\t\tpageAttributesEnabled,\n\t} = useSelect( ( select ) => {\n\t\tconst { isEditorPanelRemoved, isEditorPanelEnabled } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisPostStatusRemoved: isEditorPanelRemoved( 'post-status' ),\n\t\t\tfeaturedImageEnabled: isEditorPanelEnabled( 'featured-image' ),\n\t\t\texcerptEnabled: isEditorPanelEnabled( 'post-excerpt' ),\n\t\t\tdiscussionEnabled: isEditorPanelEnabled( 'discussion-panel' ),\n\t\t\tpageAttributesEnabled: isEditorPanelEnabled( 'page-attributes' ),\n\t\t};\n\t}, [] );\n\n\tconst visibleForm = useMemo( () => {\n\t\tif ( ! form.fields?.length ) {\n\t\t\treturn form;\n\t\t}\n\t\t// `featured_media`/`excerpt` are their own top-level panels and\n\t\t// `post-content-info` is always shown, so they survive. Everything else\n\t\t// belongs to the `post-status` summary panel: `discussion`/`parent` honor\n\t\t// their own switch, but every one of them is hidden while the `post-status`\n\t\t// panel is removed.\n\t\tconst visibilityById = {\n\t\t\tfeatured_media: featuredImageEnabled,\n\t\t\texcerpt: excerptEnabled,\n\t\t\t'post-content-info': true,\n\t\t\tdiscussion: discussionEnabled && ! isPostStatusRemoved,\n\t\t\tparent: pageAttributesEnabled && ! isPostStatusRemoved,\n\t\t};\n\t\tconst isFieldVisible = ( id ) =>\n\t\t\tid in visibilityById ? visibilityById[ id ] : ! isPostStatusRemoved;\n\t\t// Recurse into `children` so a panel-tied field is dropped wherever it\n\t\t// sits in the form: the PHP view-config filter can nest such a field\n\t\t// inside another field's group.\n\t\tconst filterFields = ( fields ) =>\n\t\t\tfields.reduce( ( acc, field ) => {\n\t\t\t\tconst id = typeof field === 'string' ? field : field.id;\n\t\t\t\tif ( ! isFieldVisible( id ) ) {\n\t\t\t\t\treturn acc;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\ttypeof field !== 'string' &&\n\t\t\t\t\tArray.isArray( field.children )\n\t\t\t\t) {\n\t\t\t\t\tconst children = filterFields( field.children );\n\t\t\t\t\t// A group whose children were all removed would render as\n\t\t\t\t\t// an empty panel, so drop it too.\n\t\t\t\t\tif ( ! children.length ) {\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}\n\t\t\t\t\tacc.push( { ...field, children } );\n\t\t\t\t\treturn acc;\n\t\t\t\t}\n\t\t\t\tacc.push( field );\n\t\t\t\treturn acc;\n\t\t\t}, [] );\n\t\treturn { ...form, fields: filterFields( form.fields ) };\n\t}, [\n\t\tform,\n\t\tisPostStatusRemoved,\n\t\tfeaturedImageEnabled,\n\t\texcerptEnabled,\n\t\tdiscussionEnabled,\n\t\tpageAttributesEnabled,\n\t] );\n\n\treturn visibleForm;\n}\n\n// Some post types expose summary fields that edit entities other than the one\n// being edited. Keyed by the post type that needs them, the related records are\n// merged into the form data under a `${ kind }_${ name }` namespace key so that\n// a single DataForm can read and write all of them, and edits to those keys are\n// routed back to their entity.\n//\n// The fields themselves are namespace-agnostic: they read and write a plain\n// record. The `fields` list ties each one to the entity it edits, and this\n// component overrides their `getValue`/`setValue`/`render` to operate on the\n// namespaced record, plus their `isVisible` to only show where that record is\n// present (e.g. the `home`/`index` template summary).\n//\n// Currently only `wp_template` uses this: `posts_per_page` and\n// `default_comment_status` target `root/site`, and `posts_page_title` targets\n// the posts page (the `page` assigned as `page_for_posts`).\nconst ENTITIES = {\n\twp_template: {\n\t\troot_site: {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t\tfields: [ 'posts_per_page', 'default_comment_status' ],\n\t\t\tisVisible: ( item ) =>\n\t\t\t\t[ 'home', 'index' ].includes( item.slug ?? '' ),\n\t\t},\n\t\tposttype_page: {\n\t\t\tkind: 'postType',\n\t\t\tname: 'page',\n\t\t\tgetId: ( select ) =>\n\t\t\t\tselect( coreDataStore ).getEditedEntityRecord( 'root', 'site' )\n\t\t\t\t\t?.page_for_posts,\n\t\t\tfields: [ 'posts_page_title' ],\n\t\t\tisVisible: ( item ) =>\n\t\t\t\t[ 'home', 'index' ].includes( item.slug ?? '' ),\n\t\t},\n\t},\n};\n\n// Rebinds a namespace-agnostic field to the namespaced record it edits. Every\n// field callback that receives the form `item` is redirected to the\n// `item[ namespace ]` sub-record so the field operates on its own entity:\n// `getValue`/`setValue`/`render` here, and the rest indirectly because they all\n// funnel through the (remapped) `getValue` (default `render`, `getValueFormatted`\n// and `isValid` range/`custom` validation). Edits are wrapped back under the\n// namespace key. The caller-supplied `isVisible` encodes entity-specific\n// conditions (e.g. only for `home`/`index` templates); the generic guard\n// `!! item[ namespace ]` ensures the field is hidden when the sub-record\n// hasn't been fetched.\nfunction bindFieldToNamespace( field, namespace, isVisible = () => true ) {\n\tconst subItem = ( item ) => item?.[ namespace ] ?? {};\n\treturn {\n\t\t...field,\n\t\tgetValue: ( { item } ) =>\n\t\t\tfield.getValue\n\t\t\t\t? field.getValue( { item: subItem( item ) } )\n\t\t\t\t: subItem( item )[ field.id ],\n\t\tsetValue: ( { item, value } ) => ( {\n\t\t\t[ namespace ]: field.setValue( { item: subItem( item ), value } ),\n\t\t} ),\n\t\trender: field.render\n\t\t\t? ( props ) =>\n\t\t\t\t\tfield.render( { ...props, item: subItem( props.item ) } )\n\t\t\t: undefined,\n\t\tisVisible: ( item ) => isVisible( item ) && !! item[ namespace ],\n\t};\n}\n\nexport default function DataFormPostSummary( { onActionPerformed } ) {\n\tconst { postType, postId, isPostStatusRemoved, availableTemplates } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tisEditorPanelRemoved,\n\t\t\t\tgetEditorSettings,\n\t\t\t} = select( editorStore );\n\t\t\tconst _availableTemplates = select(\n\t\t\t\tcoreDataStore\n\t\t\t).getCurrentTheme()?.is_block_theme\n\t\t\t\t? null\n\t\t\t\t: getEditorSettings().availableTemplates ?? null;\n\t\t\treturn {\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t\tisPostStatusRemoved: isEditorPanelRemoved( 'post-status' ),\n\t\t\t\tavailableTemplates: _availableTemplates,\n\t\t\t};\n\t\t}, [] );\n\tconst { form: formConfig } = useViewConfig( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t\tfields: VIEW_CONFIG_FIELDS,\n\t} );\n\t// Bridge the legacy editor-panel visibility (Preferences → Panels and\n\t// programmatic panel removal) onto the form by dropping hidden fields.\n\tconst form = useInspectorPanelVisibility( formConfig ?? EMPTY_FORM );\n\tconst record = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postType || ! postId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn select( coreDataStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst templatePanelMode = usePostTemplatePanelMode();\n\n\tconst entityRecords = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, canUser } = select( coreDataStore );\n\n\t\t\tconst records = {};\n\n\t\t\t// Other entities the current post type needs merged into its form.\n\t\t\tfor ( const [ namespace, entity ] of Object.entries(\n\t\t\t\tENTITIES[ postType ] ?? {}\n\t\t\t) ) {\n\t\t\t\tif (\n\t\t\t\t\t! canUser( 'read', {\n\t\t\t\t\t\tkind: entity.kind,\n\t\t\t\t\t\tname: entity.name,\n\t\t\t\t\t} )\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst id = entity.getId ? entity.getId( select ) : undefined;\n\t\t\t\t// Entities resolved through another record need a valid id.\n\t\t\t\tif ( entity.getId && ! id ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\trecords[ namespace ] = getEditedEntityRecord(\n\t\t\t\t\tentity.kind,\n\t\t\t\t\tentity.name,\n\t\t\t\t\tid\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn records;\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t// Merge the supplementary data onto the record.\n\tconst data = useMemo( () => {\n\t\tif ( ! record ) {\n\t\t\treturn record;\n\t\t}\n\t\tconst extra = { ...entityRecords };\n\t\tif ( availableTemplates && Object.keys( availableTemplates ).length ) {\n\t\t\textra.available_templates = availableTemplates;\n\t\t}\n\t\treturn { ...record, ...extra };\n\t}, [ record, entityRecords, availableTemplates ] );\n\n\tconst { editEntityRecord } = useDispatch( coreDataStore );\n\tconst registry = useRegistry();\n\n\t// Map of namespaced field id to the namespace key its entity is merged under.\n\tconst fieldNamespaces = useMemo( () => {\n\t\tconst map = {};\n\t\tfor ( const [ namespace, entity ] of Object.entries(\n\t\t\tENTITIES[ postType ] ?? {}\n\t\t) ) {\n\t\t\tfor ( const id of entity.fields ?? [] ) {\n\t\t\t\tmap[ id ] = namespace;\n\t\t\t}\n\t\t}\n\t\treturn map;\n\t}, [ postType ] );\n\n\tconst _fields = usePostFields( { postType } );\n\tconst fields = useMemo(\n\t\t() =>\n\t\t\t_fields\n\t\t\t\t?.map( ( field ) => {\n\t\t\t\t\tconst namespace = fieldNamespaces[ field.id ];\n\t\t\t\t\tif ( namespace ) {\n\t\t\t\t\t\treturn bindFieldToNamespace(\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\t\tENTITIES[ postType ]?.[ namespace ]?.isVisible\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif ( field.id === 'status' ) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\telements: field.elements.filter(\n\t\t\t\t\t\t\t\t( element ) => element.value !== 'trash'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tif ( field.id === 'template' ) {\n\t\t\t\t\t\t// `usePostTemplatePanelMode` is reused in the Post Template panel to match\n\t\t\t\t\t\t// the existing behavior. If the panel rendered nothing we should exclude the\n\t\t\t\t\t\t// template field from the form.\n\t\t\t\t\t\tif ( ! templatePanelMode ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// In classic themes without available templates we need to make the field read-only.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttemplatePanelMode === 'classic' &&\n\t\t\t\t\t\t\tObject.keys( availableTemplates ?? {} ).length === 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\t\treadOnly: true,\n\t\t\t\t\t\t\t\trender: () => __( 'Default template' ),\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn field;\n\t\t\t\t\t}\n\t\t\t\t\treturn field;\n\t\t\t\t} )\n\t\t\t\t.filter( Boolean )\n\t\t\t\t// Editor-only field, injected here rather than registered\n\t\t\t\t// so it never leaks into the site editor list / quick-edit fields.\n\t\t\t\t.concat( revisionsField ),\n\t\t[\n\t\t\t_fields,\n\t\t\ttemplatePanelMode,\n\t\t\tavailableTemplates,\n\t\t\tfieldNamespaces,\n\t\t\tpostType,\n\t\t]\n\t);\n\n\tconst onChange = ( edits ) => {\n\t\t// Route edits that target another entity (merged in under a namespace)\n\t\t// back to that entity; collect the rest for the post being edited.\n\t\tconst entities = ENTITIES[ postType ] ?? {};\n\t\tconst baseEdits = {};\n\t\tfor ( const [ key, value ] of Object.entries( edits ) ) {\n\t\t\tconst entity = entities[ key ];\n\t\t\tif ( entity ) {\n\t\t\t\t// Resolve the id the same way it was resolved to read the\n\t\t\t\t// record, so the save targets the right entity regardless of\n\t\t\t\t// its key field (`undefined` for the `root/site` singleton).\n\t\t\t\tconst id = entity.getId\n\t\t\t\t\t? entity.getId( registry.select )\n\t\t\t\t\t: undefined;\n\t\t\t\teditEntityRecord( entity.kind, entity.name, id, value );\n\t\t\t} else {\n\t\t\t\tbaseEdits[ key ] = value;\n\t\t\t}\n\t\t}\n\n\t\tif ( ! Object.keys( baseEdits ).length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tbaseEdits.status &&\n\t\t\tbaseEdits.status !== 'future' &&\n\t\t\trecord?.status === 'future' &&\n\t\t\tnew Date( record.date ) > new Date()\n\t\t) {\n\t\t\tbaseEdits.date = null;\n\t\t}\n\t\tif (\n\t\t\tbaseEdits.status &&\n\t\t\tbaseEdits.status === 'private' &&\n\t\t\trecord?.password\n\t\t) {\n\t\t\tbaseEdits.password = '';\n\t\t}\n\n\t\teditEntityRecord( 'postType', postType, postId, baseEdits );\n\t};\n\treturn (\n\t\t<PostPanelSection className=\"editor-post-summary\">\n\t\t\t<Stack direction=\"column\" gap=\"lg\">\n\t\t\t\t<PostCardPanel\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t/>\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t\t{ ! isPostStatusRemoved && (\n\t\t\t\t\t<PostTrash onActionPerformed={ onActionPerformed } />\n\t\t\t\t) }\n\t\t\t</Stack>\n\t\t</PostPanelSection>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,kBAAoD;AACpD,uBAAuC;AACvC,uBAAyB;AACzB,gBAAsB;AACtB,qBAAwB;AACxB,mBAA8B;AAK9B,6BAA0B;AAC1B,gCAA6B;AAC7B,mBAAqC;AACrC,wBAAsB;AACtB,yBAA0B;AAC1B,mBAAyC;AACzC,uBAA2B;
|
|
6
|
-
"names": ["editorStore", "coreDataStore", "usePostFields", "revisionsField", "PostPanelSection", "PostCardPanel", "PostTrash"]
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { DataForm } from '@wordpress/dataviews';\nimport { Stack } from '@wordpress/ui';\nimport { useMemo } from '@wordpress/element';\nimport { useViewConfig } from '@wordpress/views';\n\n/**\n * Internal dependencies\n */\nimport PostCardPanel from '../post-card-panel';\nimport PluginPostStatusInfo from '../plugin-post-status-info';\nimport PostPanelSection from '../post-panel-section';\nimport { store as editorStore } from '../../store';\nimport PostTrash from '../post-trash';\nimport usePostFields from '../post-fields';\nimport { usePostTemplatePanelMode } from '../post-template/hooks';\nimport revisionsField from '../../dataviews/fields/revisions';\n\nconst EMPTY_FORM = { layout: { type: 'panel' }, fields: [] };\nconst VIEW_CONFIG_FIELDS = [ 'form' ];\n\n/**\n * Bridges the legacy editor-panel visibility controls onto the DataForm summary,\n * returning the form with the hidden fields removed. The new inspector has no\n * concept of the Preferences → Panels switches or of `removeEditorPanel`, so we\n * reproduce their effect on the form.\n *\n * @param {Object} form The DataForm summary form configuration.\n * @return {Object} The form with the hidden fields removed.\n */\nfunction useInspectorPanelVisibility( form ) {\n\tconst {\n\t\tisPostStatusRemoved,\n\t\tfeaturedImageEnabled,\n\t\texcerptEnabled,\n\t\tdiscussionEnabled,\n\t\tpageAttributesEnabled,\n\t} = useSelect( ( select ) => {\n\t\tconst { isEditorPanelRemoved, isEditorPanelEnabled } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisPostStatusRemoved: isEditorPanelRemoved( 'post-status' ),\n\t\t\tfeaturedImageEnabled: isEditorPanelEnabled( 'featured-image' ),\n\t\t\texcerptEnabled: isEditorPanelEnabled( 'post-excerpt' ),\n\t\t\tdiscussionEnabled: isEditorPanelEnabled( 'discussion-panel' ),\n\t\t\tpageAttributesEnabled: isEditorPanelEnabled( 'page-attributes' ),\n\t\t};\n\t}, [] );\n\n\tconst visibleForm = useMemo( () => {\n\t\tif ( ! form.fields?.length ) {\n\t\t\treturn form;\n\t\t}\n\t\t// `featured_media`/`excerpt` are their own top-level panels and\n\t\t// `post-content-info` is always shown, so they survive. Everything else\n\t\t// belongs to the `post-status` summary panel: `discussion`/`parent` honor\n\t\t// their own switch, but every one of them is hidden while the `post-status`\n\t\t// panel is removed.\n\t\tconst visibilityById = {\n\t\t\tfeatured_media: featuredImageEnabled,\n\t\t\texcerpt: excerptEnabled,\n\t\t\t'post-content-info': true,\n\t\t\tdiscussion: discussionEnabled && ! isPostStatusRemoved,\n\t\t\tparent: pageAttributesEnabled && ! isPostStatusRemoved,\n\t\t};\n\t\tconst isFieldVisible = ( id ) =>\n\t\t\tid in visibilityById ? visibilityById[ id ] : ! isPostStatusRemoved;\n\t\t// Recurse into `children` so a panel-tied field is dropped wherever it\n\t\t// sits in the form: the PHP view-config filter can nest such a field\n\t\t// inside another field's group.\n\t\tconst filterFields = ( fields ) =>\n\t\t\tfields.reduce( ( acc, field ) => {\n\t\t\t\tconst id = typeof field === 'string' ? field : field.id;\n\t\t\t\tif ( ! isFieldVisible( id ) ) {\n\t\t\t\t\treturn acc;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\ttypeof field !== 'string' &&\n\t\t\t\t\tArray.isArray( field.children )\n\t\t\t\t) {\n\t\t\t\t\tconst children = filterFields( field.children );\n\t\t\t\t\t// A group whose children were all removed would render as\n\t\t\t\t\t// an empty panel, so drop it too.\n\t\t\t\t\tif ( ! children.length ) {\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}\n\t\t\t\t\tacc.push( { ...field, children } );\n\t\t\t\t\treturn acc;\n\t\t\t\t}\n\t\t\t\tacc.push( field );\n\t\t\t\treturn acc;\n\t\t\t}, [] );\n\t\treturn { ...form, fields: filterFields( form.fields ) };\n\t}, [\n\t\tform,\n\t\tisPostStatusRemoved,\n\t\tfeaturedImageEnabled,\n\t\texcerptEnabled,\n\t\tdiscussionEnabled,\n\t\tpageAttributesEnabled,\n\t] );\n\n\treturn visibleForm;\n}\n\n// Some post types expose summary fields that edit entities other than the one\n// being edited. Keyed by the post type that needs them, the related records are\n// merged into the form data under a `${ kind }_${ name }` namespace key so that\n// a single DataForm can read and write all of them, and edits to those keys are\n// routed back to their entity.\n//\n// The fields themselves are namespace-agnostic: they read and write a plain\n// record. The `fields` list ties each one to the entity it edits, and this\n// component overrides their `getValue`/`setValue`/`render` to operate on the\n// namespaced record, plus their `isVisible` to only show where that record is\n// present (e.g. the `home`/`index` template summary).\n//\n// Currently only `wp_template` uses this: `posts_per_page` and\n// `default_comment_status` target `root/site`, and `posts_page_title` targets\n// the posts page (the `page` assigned as `page_for_posts`).\nconst ENTITIES = {\n\twp_template: {\n\t\troot_site: {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t\tfields: [ 'posts_per_page', 'default_comment_status' ],\n\t\t\tisVisible: ( item ) =>\n\t\t\t\t[ 'home', 'index' ].includes( item.slug ?? '' ),\n\t\t},\n\t\tposttype_page: {\n\t\t\tkind: 'postType',\n\t\t\tname: 'page',\n\t\t\tgetId: ( select ) =>\n\t\t\t\tselect( coreDataStore ).getEditedEntityRecord( 'root', 'site' )\n\t\t\t\t\t?.page_for_posts,\n\t\t\tfields: [ 'posts_page_title' ],\n\t\t\tisVisible: ( item ) =>\n\t\t\t\t[ 'home', 'index' ].includes( item.slug ?? '' ),\n\t\t},\n\t},\n};\n\n// Rebinds a namespace-agnostic field to the namespaced record it edits. Every\n// field callback that receives the form `item` is redirected to the\n// `item[ namespace ]` sub-record so the field operates on its own entity:\n// `getValue`/`setValue`/`render` here, and the rest indirectly because they all\n// funnel through the (remapped) `getValue` (default `render`, `getValueFormatted`\n// and `isValid` range/`custom` validation). Edits are wrapped back under the\n// namespace key. The caller-supplied `isVisible` encodes entity-specific\n// conditions (e.g. only for `home`/`index` templates); the generic guard\n// `!! item[ namespace ]` ensures the field is hidden when the sub-record\n// hasn't been fetched.\nfunction bindFieldToNamespace( field, namespace, isVisible = () => true ) {\n\tconst subItem = ( item ) => item?.[ namespace ] ?? {};\n\treturn {\n\t\t...field,\n\t\tgetValue: ( { item } ) =>\n\t\t\tfield.getValue\n\t\t\t\t? field.getValue( { item: subItem( item ) } )\n\t\t\t\t: subItem( item )[ field.id ],\n\t\tsetValue: ( { item, value } ) => ( {\n\t\t\t[ namespace ]: field.setValue( { item: subItem( item ), value } ),\n\t\t} ),\n\t\trender: field.render\n\t\t\t? ( props ) =>\n\t\t\t\t\tfield.render( { ...props, item: subItem( props.item ) } )\n\t\t\t: undefined,\n\t\tisVisible: ( item ) => isVisible( item ) && !! item[ namespace ],\n\t};\n}\n\nexport default function DataFormPostSummary( { onActionPerformed } ) {\n\tconst { postType, postId, isPostStatusRemoved, availableTemplates } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tisEditorPanelRemoved,\n\t\t\t\tgetEditorSettings,\n\t\t\t} = select( editorStore );\n\t\t\tconst _availableTemplates = select(\n\t\t\t\tcoreDataStore\n\t\t\t).getCurrentTheme()?.is_block_theme\n\t\t\t\t? null\n\t\t\t\t: getEditorSettings().availableTemplates ?? null;\n\t\t\treturn {\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t\tisPostStatusRemoved: isEditorPanelRemoved( 'post-status' ),\n\t\t\t\tavailableTemplates: _availableTemplates,\n\t\t\t};\n\t\t}, [] );\n\tconst { form: formConfig } = useViewConfig( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t\tfields: VIEW_CONFIG_FIELDS,\n\t} );\n\t// Bridge the legacy editor-panel visibility (Preferences → Panels and\n\t// programmatic panel removal) onto the form by dropping hidden fields.\n\tconst form = useInspectorPanelVisibility( formConfig ?? EMPTY_FORM );\n\tconst record = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postType || ! postId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn select( coreDataStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst templatePanelMode = usePostTemplatePanelMode();\n\n\tconst entityRecords = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, canUser } = select( coreDataStore );\n\n\t\t\tconst records = {};\n\n\t\t\t// Other entities the current post type needs merged into its form.\n\t\t\tfor ( const [ namespace, entity ] of Object.entries(\n\t\t\t\tENTITIES[ postType ] ?? {}\n\t\t\t) ) {\n\t\t\t\tif (\n\t\t\t\t\t! canUser( 'read', {\n\t\t\t\t\t\tkind: entity.kind,\n\t\t\t\t\t\tname: entity.name,\n\t\t\t\t\t} )\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst id = entity.getId ? entity.getId( select ) : undefined;\n\t\t\t\t// Entities resolved through another record need a valid id.\n\t\t\t\tif ( entity.getId && ! id ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\trecords[ namespace ] = getEditedEntityRecord(\n\t\t\t\t\tentity.kind,\n\t\t\t\t\tentity.name,\n\t\t\t\t\tid\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn records;\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t// Merge the supplementary data onto the record.\n\tconst data = useMemo( () => {\n\t\tif ( ! record ) {\n\t\t\treturn record;\n\t\t}\n\t\tconst extra = { ...entityRecords };\n\t\tif ( availableTemplates && Object.keys( availableTemplates ).length ) {\n\t\t\textra.available_templates = availableTemplates;\n\t\t}\n\t\treturn { ...record, ...extra };\n\t}, [ record, entityRecords, availableTemplates ] );\n\n\tconst { editEntityRecord } = useDispatch( coreDataStore );\n\tconst registry = useRegistry();\n\n\t// Map of namespaced field id to the namespace key its entity is merged under.\n\tconst fieldNamespaces = useMemo( () => {\n\t\tconst map = {};\n\t\tfor ( const [ namespace, entity ] of Object.entries(\n\t\t\tENTITIES[ postType ] ?? {}\n\t\t) ) {\n\t\t\tfor ( const id of entity.fields ?? [] ) {\n\t\t\t\tmap[ id ] = namespace;\n\t\t\t}\n\t\t}\n\t\treturn map;\n\t}, [ postType ] );\n\n\tconst _fields = usePostFields( { postType } );\n\tconst fields = useMemo(\n\t\t() =>\n\t\t\t_fields\n\t\t\t\t?.map( ( field ) => {\n\t\t\t\t\tconst namespace = fieldNamespaces[ field.id ];\n\t\t\t\t\tif ( namespace ) {\n\t\t\t\t\t\treturn bindFieldToNamespace(\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\t\tENTITIES[ postType ]?.[ namespace ]?.isVisible\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif ( field.id === 'status' ) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\telements: field.elements.filter(\n\t\t\t\t\t\t\t\t( element ) => element.value !== 'trash'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tif ( field.id === 'template' ) {\n\t\t\t\t\t\t// `usePostTemplatePanelMode` is reused in the Post Template panel to match\n\t\t\t\t\t\t// the existing behavior. If the panel rendered nothing we should exclude the\n\t\t\t\t\t\t// template field from the form.\n\t\t\t\t\t\tif ( ! templatePanelMode ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// In classic themes without available templates we need to make the field read-only.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttemplatePanelMode === 'classic' &&\n\t\t\t\t\t\t\tObject.keys( availableTemplates ?? {} ).length === 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...field,\n\t\t\t\t\t\t\t\treadOnly: true,\n\t\t\t\t\t\t\t\trender: () => __( 'Default template' ),\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn field;\n\t\t\t\t\t}\n\t\t\t\t\treturn field;\n\t\t\t\t} )\n\t\t\t\t.filter( Boolean )\n\t\t\t\t// Editor-only field, injected here rather than registered\n\t\t\t\t// so it never leaks into the site editor list / quick-edit fields.\n\t\t\t\t.concat( revisionsField ),\n\t\t[\n\t\t\t_fields,\n\t\t\ttemplatePanelMode,\n\t\t\tavailableTemplates,\n\t\t\tfieldNamespaces,\n\t\t\tpostType,\n\t\t]\n\t);\n\n\tconst onChange = ( edits ) => {\n\t\t// Route edits that target another entity (merged in under a namespace)\n\t\t// back to that entity; collect the rest for the post being edited.\n\t\tconst entities = ENTITIES[ postType ] ?? {};\n\t\tconst baseEdits = {};\n\t\tfor ( const [ key, value ] of Object.entries( edits ) ) {\n\t\t\tconst entity = entities[ key ];\n\t\t\tif ( entity ) {\n\t\t\t\t// Resolve the id the same way it was resolved to read the\n\t\t\t\t// record, so the save targets the right entity regardless of\n\t\t\t\t// its key field (`undefined` for the `root/site` singleton).\n\t\t\t\tconst id = entity.getId\n\t\t\t\t\t? entity.getId( registry.select )\n\t\t\t\t\t: undefined;\n\t\t\t\teditEntityRecord( entity.kind, entity.name, id, value );\n\t\t\t} else {\n\t\t\t\tbaseEdits[ key ] = value;\n\t\t\t}\n\t\t}\n\n\t\tif ( ! Object.keys( baseEdits ).length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tbaseEdits.status &&\n\t\t\tbaseEdits.status !== 'future' &&\n\t\t\trecord?.status === 'future' &&\n\t\t\tnew Date( record.date ) > new Date()\n\t\t) {\n\t\t\tbaseEdits.date = null;\n\t\t}\n\t\tif (\n\t\t\tbaseEdits.status &&\n\t\t\tbaseEdits.status === 'private' &&\n\t\t\trecord?.password\n\t\t) {\n\t\t\tbaseEdits.password = '';\n\t\t}\n\n\t\teditEntityRecord( 'postType', postType, postId, baseEdits );\n\t};\n\treturn (\n\t\t<PostPanelSection className=\"editor-post-summary\">\n\t\t\t<Stack direction=\"column\" gap=\"lg\">\n\t\t\t\t<PostCardPanel\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t/>\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t\t{ ! isPostStatusRemoved && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PluginPostStatusInfo.Slot>\n\t\t\t\t\t\t\t{ ( fills ) =>\n\t\t\t\t\t\t\t\tfills.length > 0 && (\n\t\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap=\"xs\">\n\t\t\t\t\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</PluginPostStatusInfo.Slot>\n\t\t\t\t\t\t<PostTrash onActionPerformed={ onActionPerformed } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</Stack>\n\t\t</PostPanelSection>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,kBAAoD;AACpD,uBAAuC;AACvC,uBAAyB;AACzB,gBAAsB;AACtB,qBAAwB;AACxB,mBAA8B;AAK9B,6BAA0B;AAC1B,qCAAiC;AACjC,gCAA6B;AAC7B,mBAAqC;AACrC,wBAAsB;AACtB,yBAA0B;AAC1B,mBAAyC;AACzC,uBAA2B;AA4WvB;AA1WJ,IAAM,aAAa,EAAE,QAAQ,E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oBAAI,KAAK,GAClC;AACD,gBAAU,OAAO;AAAA,IAClB;AACA,QACC,UAAU,UACV,UAAU,WAAW,aACrB,QAAQ,UACP;AACD,gBAAU,WAAW;AAAA,IACtB;AAEA,qBAAkB,YAAY,UAAU,QAAQ,SAAU;AAAA,EAC3D;AACA,SACC,4CAAC,0BAAAC,SAAA,EAAiB,WAAU,uBAC3B,uDAAC,mBAAM,WAAU,UAAS,KAAI,MAC7B;AAAA;AAAA,MAAC,uBAAAC;AAAA,MAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IACE,CAAE,uBACH,4EACC;AAAA,kDAAC,+BAAAC,QAAqB,MAArB,EACE,WAAE,UACH,MAAM,SAAS,KACd,4CAAC,mBAAM,WAAU,UAAS,KAAI,MAC3B,iBACH,GAGH;AAAA,MACA,4CAAC,kBAAAC,SAAA,EAAU,mBAAwC;AAAA,OACpD;AAAA,KAEF,GACD;AAEF;",
|
|
6
|
+
"names": ["editorStore", "coreDataStore", "usePostFields", "revisionsField", "PostPanelSection", "PostCardPanel", "PluginPostStatusInfo", "PostTrash"]
|
|
7
7
|
}
|