@wordpress/editor 14.38.0 → 14.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/document-bar/useEditedSectionDetails.cjs +0 -3
- package/build/components/document-bar/useEditedSectionDetails.cjs.map +2 -2
- package/build/components/editor-interface/index.cjs +33 -9
- package/build/components/editor-interface/index.cjs.map +2 -2
- package/build/components/header/header-skeleton.cjs +100 -0
- package/build/components/header/header-skeleton.cjs.map +7 -0
- package/build/components/header/index.cjs +63 -106
- package/build/components/header/index.cjs.map +3 -3
- package/build/components/media/index.cjs +44 -0
- package/build/components/media/index.cjs.map +7 -0
- package/build/components/media/metadata-panel.cjs +96 -0
- package/build/components/media/metadata-panel.cjs.map +7 -0
- package/build/components/media/preview.cjs +39 -0
- package/build/components/media/preview.cjs.map +7 -0
- package/build/components/more-menu/index.cjs +3 -2
- package/build/components/more-menu/index.cjs.map +2 -2
- package/build/components/post-card-panel/index.cjs +33 -4
- package/build/components/post-card-panel/index.cjs.map +3 -3
- package/build/components/post-content-information/index.cjs +9 -0
- package/build/components/post-content-information/index.cjs.map +2 -2
- package/build/components/post-last-edited-panel/index.cjs +5 -6
- package/build/components/post-last-edited-panel/index.cjs.map +2 -2
- package/build/components/post-last-revision/index.cjs +5 -7
- package/build/components/post-last-revision/index.cjs.map +2 -2
- package/build/components/post-publish-button/label.cjs +6 -1
- package/build/components/post-publish-button/label.cjs.map +2 -2
- package/build/components/post-publish-button/post-publish-button-or-toggle.cjs +8 -3
- package/build/components/post-publish-button/post-publish-button-or-toggle.cjs.map +2 -2
- package/build/components/post-revisions-preview/index.cjs +44 -0
- package/build/components/post-revisions-preview/index.cjs.map +7 -0
- package/build/components/post-revisions-preview/revisions-canvas.cjs +82 -0
- package/build/components/post-revisions-preview/revisions-canvas.cjs.map +7 -0
- package/build/components/post-revisions-preview/revisions-header.cjs +119 -0
- package/build/components/post-revisions-preview/revisions-header.cjs.map +7 -0
- package/build/components/post-revisions-preview/revisions-slider.cjs +110 -0
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +7 -0
- package/build/components/post-saved-state/index.cjs +8 -2
- package/build/components/post-saved-state/index.cjs.map +2 -2
- package/build/components/post-title/index.cjs +5 -4
- package/build/components/post-title/index.cjs.map +2 -2
- package/build/components/provider/index.cjs +19 -0
- package/build/components/provider/index.cjs.map +3 -3
- package/build/components/provider/use-block-editor-settings.cjs +2 -1
- package/build/components/provider/use-block-editor-settings.cjs.map +2 -2
- package/build/components/revision-author-panel/index.cjs +59 -0
- package/build/components/revision-author-panel/index.cjs.map +7 -0
- package/build/components/revision-created-panel/index.cjs +47 -0
- package/build/components/revision-created-panel/index.cjs.map +7 -0
- package/build/components/sidebar/header.cjs +27 -12
- package/build/components/sidebar/header.cjs.map +3 -3
- package/build/components/sidebar/index.cjs +36 -15
- package/build/components/sidebar/index.cjs.map +3 -3
- package/build/components/sidebar/post-summary.cjs +44 -19
- package/build/components/sidebar/post-summary.cjs.map +3 -3
- package/build/components/start-page-options/index.cjs +1 -1
- package/build/components/start-page-options/index.cjs.map +2 -2
- package/build/dataviews/store/private-actions.cjs +47 -26
- package/build/dataviews/store/private-actions.cjs.map +3 -3
- package/build/store/constants.cjs +3 -0
- package/build/store/constants.cjs.map +2 -2
- package/build/store/private-actions.cjs +40 -0
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +33 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +10 -0
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +3 -0
- package/build/store/selectors.cjs.map +2 -2
- package/build/store/utils/notice-builder.cjs +4 -0
- package/build/store/utils/notice-builder.cjs.map +2 -2
- package/build-module/components/document-bar/useEditedSectionDetails.mjs +0 -3
- package/build-module/components/document-bar/useEditedSectionDetails.mjs.map +2 -2
- package/build-module/components/editor-interface/index.mjs +33 -9
- package/build-module/components/editor-interface/index.mjs.map +2 -2
- package/build-module/components/header/header-skeleton.mjs +69 -0
- package/build-module/components/header/header-skeleton.mjs.map +7 -0
- package/build-module/components/header/index.mjs +65 -107
- package/build-module/components/header/index.mjs.map +2 -2
- package/build-module/components/media/index.mjs +8 -0
- package/build-module/components/media/index.mjs.map +7 -0
- package/build-module/components/media/metadata-panel.mjs +65 -0
- package/build-module/components/media/metadata-panel.mjs.map +7 -0
- package/build-module/components/media/preview.mjs +21 -0
- package/build-module/components/media/preview.mjs.map +7 -0
- package/build-module/components/more-menu/index.mjs +3 -2
- package/build-module/components/more-menu/index.mjs.map +2 -2
- package/build-module/components/post-card-panel/index.mjs +35 -5
- package/build-module/components/post-card-panel/index.mjs.map +3 -3
- package/build-module/components/post-content-information/index.mjs +9 -0
- package/build-module/components/post-content-information/index.mjs.map +2 -2
- package/build-module/components/post-last-edited-panel/index.mjs +5 -6
- package/build-module/components/post-last-edited-panel/index.mjs.map +2 -2
- package/build-module/components/post-last-revision/index.mjs +6 -8
- package/build-module/components/post-last-revision/index.mjs.map +2 -2
- package/build-module/components/post-publish-button/label.mjs +6 -1
- package/build-module/components/post-publish-button/label.mjs.map +2 -2
- package/build-module/components/post-publish-button/post-publish-button-or-toggle.mjs +8 -3
- package/build-module/components/post-publish-button/post-publish-button-or-toggle.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/index.mjs +8 -0
- package/build-module/components/post-revisions-preview/index.mjs.map +7 -0
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs +54 -0
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +7 -0
- package/build-module/components/post-revisions-preview/revisions-header.mjs +92 -0
- package/build-module/components/post-revisions-preview/revisions-header.mjs.map +7 -0
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +89 -0
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +7 -0
- package/build-module/components/post-saved-state/index.mjs +8 -2
- package/build-module/components/post-saved-state/index.mjs.map +2 -2
- package/build-module/components/post-title/index.mjs +5 -4
- package/build-module/components/post-title/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +19 -0
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +2 -1
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/revision-author-panel/index.mjs +28 -0
- package/build-module/components/revision-author-panel/index.mjs.map +7 -0
- package/build-module/components/revision-created-panel/index.mjs +26 -0
- package/build-module/components/revision-created-panel/index.mjs.map +7 -0
- package/build-module/components/sidebar/header.mjs +22 -7
- package/build-module/components/sidebar/header.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +38 -16
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/sidebar/post-summary.mjs +48 -20
- package/build-module/components/sidebar/post-summary.mjs.map +2 -2
- package/build-module/components/start-page-options/index.mjs +2 -1
- package/build-module/components/start-page-options/index.mjs.map +2 -2
- package/build-module/dataviews/store/private-actions.mjs +59 -27
- package/build-module/dataviews/store/private-actions.mjs.map +2 -2
- package/build-module/store/constants.mjs +2 -0
- package/build-module/store/constants.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +38 -0
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +29 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +9 -0
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +4 -0
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/store/utils/notice-builder.mjs +4 -0
- package/build-module/store/utils/notice-builder.mjs.map +2 -2
- package/build-style/style-rtl.css +182 -16
- package/build-style/style.css +182 -16
- package/build-types/components/document-bar/useEditedSectionDetails.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/header/header-skeleton.d.ts +17 -0
- package/build-types/components/header/header-skeleton.d.ts.map +1 -0
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/media/index.d.ts +3 -0
- package/build-types/components/media/index.d.ts.map +1 -0
- package/build-types/components/media/metadata-panel.d.ts +12 -0
- package/build-types/components/media/metadata-panel.d.ts.map +1 -0
- package/build-types/components/media/preview.d.ts +9 -0
- package/build-types/components/media/preview.d.ts.map +1 -0
- package/build-types/components/more-menu/index.d.ts +3 -1
- package/build-types/components/more-menu/index.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-content-information/index.d.ts.map +1 -1
- package/build-types/components/post-last-edited-panel/index.d.ts.map +1 -1
- package/build-types/components/post-last-revision/index.d.ts.map +1 -1
- package/build-types/components/post-publish-button/label.d.ts.map +1 -1
- package/build-types/components/post-publish-button/post-publish-button-or-toggle.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/index.d.ts +3 -0
- package/build-types/components/post-revisions-preview/index.d.ts.map +1 -0
- package/build-types/components/post-revisions-preview/revisions-canvas.d.ts +7 -0
- package/build-types/components/post-revisions-preview/revisions-canvas.d.ts.map +1 -0
- package/build-types/components/post-revisions-preview/revisions-header.d.ts +8 -0
- package/build-types/components/post-revisions-preview/revisions-header.d.ts.map +1 -0
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts +8 -0
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -0
- package/build-types/components/post-saved-state/index.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/revision-author-panel/index.d.ts +2 -0
- package/build-types/components/revision-author-panel/index.d.ts.map +1 -0
- package/build-types/components/revision-created-panel/index.d.ts +2 -0
- package/build-types/components/revision-created-panel/index.d.ts.map +1 -0
- 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/start-page-options/index.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts +1 -0
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/store/constants.d.ts +1 -0
- package/build-types/store/constants.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +13 -0
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +25 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +11 -0
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/store/utils/notice-builder.d.ts.map +1 -1
- package/package.json +42 -40
- package/src/components/document-bar/useEditedSectionDetails.js +0 -5
- package/src/components/editor-interface/index.js +39 -9
- package/src/components/header/header-skeleton.js +90 -0
- package/src/components/header/index.js +69 -102
- package/src/components/header/style.scss +4 -0
- package/src/components/media/index.js +2 -0
- package/src/components/media/metadata-panel.js +77 -0
- package/src/components/media/preview.js +35 -0
- package/src/components/more-menu/index.js +2 -1
- package/src/components/post-card-panel/index.js +43 -7
- package/src/components/post-content-information/index.js +11 -0
- package/src/components/post-last-edited-panel/index.js +8 -9
- package/src/components/post-last-revision/index.js +7 -8
- package/src/components/post-publish-button/label.js +9 -0
- package/src/components/post-publish-button/post-publish-button-or-toggle.js +13 -5
- package/src/components/post-revisions-preview/index.js +2 -0
- package/src/components/post-revisions-preview/revisions-canvas.js +73 -0
- package/src/components/post-revisions-preview/revisions-header.js +108 -0
- package/src/components/post-revisions-preview/revisions-slider.js +123 -0
- package/src/components/post-revisions-preview/style.scss +22 -0
- package/src/components/post-saved-state/index.js +8 -0
- package/src/components/post-title/index.js +4 -3
- package/src/components/provider/index.js +26 -0
- package/src/components/provider/use-block-editor-settings.js +2 -3
- package/src/components/revision-author-panel/index.js +36 -0
- package/src/components/revision-created-panel/index.js +36 -0
- package/src/components/sidebar/header.js +35 -14
- package/src/components/sidebar/index.js +40 -13
- package/src/components/sidebar/post-summary.js +45 -11
- package/src/components/sidebar/style.scss +7 -0
- package/src/components/start-page-options/index.js +2 -0
- package/src/dataviews/store/private-actions.ts +79 -33
- package/src/store/constants.ts +1 -0
- package/src/store/private-actions.js +70 -0
- package/src/store/private-selectors.js +54 -0
- package/src/store/reducer.js +17 -0
- package/src/store/selectors.js +6 -0
- package/src/store/test/selectors.js +7 -0
- package/src/store/utils/notice-builder.js +9 -0
- package/src/style.scss +2 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor-interface/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { InterfaceSkeleton, ComplementaryArea } from '@wordpress/interface';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { BlockBreadcrumb, BlockToolbar } from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useState, useCallback } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport EditorNotices from '../editor-notices';\nimport Header from '../header';\nimport InserterSidebar from '../inserter-sidebar';\nimport ListViewSidebar from '../list-view-sidebar';\nimport SavePublishPanels from '../save-publish-panels';\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport StylesCanvas from '../styles-canvas';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nexport default function EditorInterface( {\n\tclassName,\n\tchildren,\n\tforceIsDirty,\n\tcontentRef,\n\tdisableIframe,\n\tautoFocus,\n\tcustomSaveButton,\n\tcustomSavePanel,\n\tforceDisableBlockTools,\n\tiframeProps,\n} ) {\n\tconst {\n\t\tmode,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tisDistractionFree,\n\t\tisPreviewMode,\n\t\tshowBlockBreadcrumbs,\n\t\tpostTypeLabel,\n\t\tstylesPath,\n\t\tshowStylebook,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditorSettings, getPostTypeLabel }
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,mBAAmB,yBAAyB;AACrD,SAAS,iBAAiB;AAC1B,SAAS,UAAU;AACnB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,wBAAwB;AACjC,SAAS,UAAU,mBAAmB;AACtC,SAAS,sBAAsB;AAK/B,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AACvB,OAAO,mBAAmB;AAC1B,OAAO,YAAY;AACnB,OAAO,qBAAqB;AAC5B,OAAO,qBAAqB;AAC5B,OAAO,uBAAuB;AAC9B,OAAO,gBAAgB;AACvB,OAAO,kBAAkB;AACzB,OAAO,kBAAkB;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { InterfaceSkeleton, ComplementaryArea } from '@wordpress/interface';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { BlockBreadcrumb, BlockToolbar } from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useState, useCallback } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport EditorNotices from '../editor-notices';\nimport Header from '../header';\nimport InserterSidebar from '../inserter-sidebar';\nimport ListViewSidebar from '../list-view-sidebar';\nimport { RevisionsHeader, RevisionsCanvas } from '../post-revisions-preview';\nimport SavePublishPanels from '../save-publish-panels';\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport StylesCanvas from '../styles-canvas';\nimport { MediaPreview } from '../media';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nexport default function EditorInterface( {\n\tclassName,\n\tchildren,\n\tforceIsDirty,\n\tcontentRef,\n\tdisableIframe,\n\tautoFocus,\n\tcustomSaveButton,\n\tcustomSavePanel,\n\tforceDisableBlockTools,\n\tiframeProps,\n} ) {\n\tconst {\n\t\tmode,\n\t\tisAttachment,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tisDistractionFree,\n\t\tisPreviewMode,\n\t\tshowBlockBreadcrumbs,\n\t\tpostTypeLabel,\n\t\tstylesPath,\n\t\tshowStylebook,\n\t\tisRevisionsMode,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditorSettings, getPostTypeLabel, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst {\n\t\t\tgetStylesPath,\n\t\t\tgetShowStylebook,\n\t\t\tisRevisionsMode: _isRevisionsMode,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst editorSettings = getEditorSettings();\n\n\t\tlet _mode = select( editorStore ).getEditorMode();\n\t\tif ( ! editorSettings.richEditingEnabled && _mode === 'visual' ) {\n\t\t\t_mode = 'text';\n\t\t}\n\t\tif ( ! editorSettings.codeEditingEnabled && _mode === 'text' ) {\n\t\t\t_mode = 'visual';\n\t\t}\n\n\t\treturn {\n\t\t\tmode: _mode,\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpened: select( editorStore ).isListViewOpened(),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisPreviewMode: editorSettings.isPreviewMode,\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tpostTypeLabel: getPostTypeLabel(),\n\t\t\tstylesPath: getStylesPath(),\n\t\t\tshowStylebook: getShowStylebook(),\n\t\t\tisAttachment:\n\t\t\t\tgetCurrentPostType() === 'attachment' &&\n\t\t\t\twindow?.__experimentalMediaEditor,\n\t\t\tisRevisionsMode: _isRevisionsMode(),\n\t\t};\n\t}, [] );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'Document Overview' )\n\t\t: __( 'Block Library' );\n\tconst shouldShowMediaEditor = !! isAttachment;\n\tconst shouldShowStylesCanvas =\n\t\t! isAttachment &&\n\t\t( showStylebook || stylesPath?.startsWith( '/revisions' ) );\n\tconst shouldShowBlockEditor =\n\t\t! shouldShowMediaEditor && ! shouldShowStylesCanvas;\n\n\t// Local state for save panel.\n\t// Note 'truthy' callback implies an open panel.\n\tconst [ entitiesSavedStatesCallback, setEntitiesSavedStatesCallback ] =\n\t\tuseState( false );\n\tconst closeEntitiesSavedStates = useCallback(\n\t\t( arg ) => {\n\t\t\tif ( typeof entitiesSavedStatesCallback === 'function' ) {\n\t\t\t\tentitiesSavedStatesCallback( arg );\n\t\t\t}\n\t\t\tsetEntitiesSavedStatesCallback( false );\n\t\t},\n\t\t[ entitiesSavedStatesCallback ]\n\t);\n\n\t// When in revisions mode, render the revisions interface.\n\tif ( isRevisionsMode ) {\n\t\treturn (\n\t\t\t<InterfaceSkeleton\n\t\t\t\tclassName={ clsx( 'editor-editor-interface', className ) }\n\t\t\t\tlabels={ interfaceLabels }\n\t\t\t\theader={ <RevisionsHeader /> }\n\t\t\t\tcontent={ <RevisionsCanvas /> }\n\t\t\t\tsidebar={ <ComplementaryArea.Slot scope=\"core\" /> }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\tclassName={ clsx( 'editor-editor-interface', className, {\n\t\t\t\t'is-entity-save-view-open': !! entitiesSavedStatesCallback,\n\t\t\t\t'is-distraction-free': isDistractionFree && ! isPreviewMode,\n\t\t\t} ) }\n\t\t\tlabels={ {\n\t\t\t\t...interfaceLabels,\n\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t} }\n\t\t\theader={\n\t\t\t\t! isPreviewMode && (\n\t\t\t\t\t<Header\n\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcustomSaveButton={ customSaveButton }\n\t\t\t\t\t\tforceDisableBlockTools={ forceDisableBlockTools }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\teditorNotices={ <EditorNotices /> }\n\t\t\tsecondarySidebar={\n\t\t\t\t! isAttachment &&\n\t\t\t\t! isPreviewMode &&\n\t\t\t\tmode === 'visual' &&\n\t\t\t\t( ( isInserterOpened && <InserterSidebar /> ) ||\n\t\t\t\t\t( isListViewOpened && <ListViewSidebar /> ) )\n\t\t\t}\n\t\t\tsidebar={\n\t\t\t\t! isPreviewMode &&\n\t\t\t\t! isDistractionFree && <ComplementaryArea.Slot scope=\"core\" />\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ ! isDistractionFree && ! isPreviewMode && (\n\t\t\t\t\t\t<EditorNotices />\n\t\t\t\t\t) }\n\t\t\t\t\t{ shouldShowMediaEditor && (\n\t\t\t\t\t\t<MediaPreview { ...iframeProps } />\n\t\t\t\t\t) }\n\t\t\t\t\t{ shouldShowStylesCanvas && <StylesCanvas /> }\n\t\t\t\t\t{ shouldShowBlockEditor && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isPreviewMode && mode === 'text' && (\n\t\t\t\t\t\t\t\t<TextEditor\n\t\t\t\t\t\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\t\t\t\tautoFocus={ autoFocus }\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{ ! isPreviewMode &&\n\t\t\t\t\t\t\t\t! isLargeViewport &&\n\t\t\t\t\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ( isPreviewMode || mode === 'visual' ) && (\n\t\t\t\t\t\t\t\t<VisualEditor\n\t\t\t\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\t\t\t\tdisableIframe={ disableIframe }\n\t\t\t\t\t\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\t\t\t\tautoFocus={ autoFocus }\n\t\t\t\t\t\t\t\t\tiframeProps={ iframeProps }\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{ children }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t! isPreviewMode &&\n\t\t\t\t! isDistractionFree &&\n\t\t\t\tisLargeViewport &&\n\t\t\t\tshowBlockBreadcrumbs &&\n\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\trootLabelText={\n\t\t\t\t\t\t\tpostTypeLabel\n\t\t\t\t\t\t\t\t? decodeEntities( postTypeLabel )\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tactions={\n\t\t\t\t! isPreviewMode\n\t\t\t\t\t? customSavePanel || (\n\t\t\t\t\t\t\t<SavePublishPanels\n\t\t\t\t\t\t\t\tcloseEntitiesSavedStates={\n\t\t\t\t\t\t\t\t\tcloseEntitiesSavedStates\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisEntitiesSavedStatesOpen={\n\t\t\t\t\t\t\t\t\tentitiesSavedStatesCallback\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tforceIsDirtyPublishPanel={ forceIsDirty }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,mBAAmB,yBAAyB;AACrD,SAAS,iBAAiB;AAC1B,SAAS,UAAU;AACnB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,wBAAwB;AACjC,SAAS,UAAU,mBAAmB;AACtC,SAAS,sBAAsB;AAK/B,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AACvB,OAAO,mBAAmB;AAC1B,OAAO,YAAY;AACnB,OAAO,qBAAqB;AAC5B,OAAO,qBAAqB;AAC5B,SAAS,iBAAiB,uBAAuB;AACjD,OAAO,uBAAuB;AAC9B,OAAO,gBAAgB;AACvB,OAAO,kBAAkB;AACzB,OAAO,kBAAkB;AACzB,SAAS,oBAAoB;AAyGhB,SAoDP,UApDO,KAoDP,YApDO;AAvGb,IAAM,kBAAkB;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BACC,CAAE,gBACF,CAAE,iBACF,SAAS,aACL,oBAAoB,oBAAC,mBAAgB,KACtC,oBAAoB,oBAAC,mBAAgB;AAAA,MAEzC,SACC,CAAE,iBACF,CAAE,qBAAqB,oBAAC,kBAAkB,MAAlB,EAAuB,OAAM,QAAO;AAAA,MAE7D,SACC,iCACG;AAAA,SAAE,qBAAqB,CAAE,iBAC1B,oBAAC,iBAAc;AAAA,QAEd,yBACD,oBAAC,gBAAe,GAAG,aAAc;AAAA,QAEhC,0BAA0B,oBAAC,gBAAa;AAAA,QACxC,yBACD,iCACG;AAAA,WAAE,iBAAiB,SAAS,UAC7B;AAAA,YAAC;AAAA;AAAA,cAGA;AAAA;AAAA,UACD;AAAA,UAEC,CAAE,iBACH,CAAE,mBACF,SAAS,YACR,oBAAC,gBAAa,gBAAc,MAAC;AAAA,WAE3B,iBAAiB,SAAS,aAC7B;AAAA,YAAC;AAAA;AAAA,cACA;AAAA,cACA;AAAA,cAGA;AAAA,cACA;AAAA;AAAA,UACD;AAAA,UAEC;AAAA,WACH;AAAA,SAEF;AAAA,MAED,QACC,CAAE,iBACF,CAAE,qBACF,mBACA,wBACA,SAAS,YACR;AAAA,QAAC;AAAA;AAAA,UACA,eACC,gBACG,eAAgB,aAAc,IAC9B;AAAA;AAAA,MAEL;AAAA,MAGF,SACC,CAAE,gBACC,mBACA;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UAGA,2BACC;AAAA,UAED;AAAA,UAGA,0BAA2B;AAAA;AAAA,MAC5B,IAEA;AAAA;AAAA,EAEL;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// packages/editor/src/components/header/header-skeleton.js
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { __unstableMotion as motion } from "@wordpress/components";
|
|
4
|
+
import BackButton, { useHasBackButton } from "./back-button.mjs";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var toolbarVariations = {
|
|
7
|
+
distractionFreeDisabled: { y: "-50px" },
|
|
8
|
+
distractionFreeHover: { y: 0 },
|
|
9
|
+
distractionFreeHidden: { y: "-50px" },
|
|
10
|
+
visible: { y: 0 },
|
|
11
|
+
hidden: { y: 0 }
|
|
12
|
+
};
|
|
13
|
+
var backButtonVariations = {
|
|
14
|
+
distractionFreeDisabled: { x: "-100%" },
|
|
15
|
+
distractionFreeHover: { x: 0 },
|
|
16
|
+
distractionFreeHidden: { x: "-100%" },
|
|
17
|
+
visible: { x: 0 },
|
|
18
|
+
hidden: { x: 0 }
|
|
19
|
+
};
|
|
20
|
+
function HeaderSkeleton({
|
|
21
|
+
className,
|
|
22
|
+
toolbar,
|
|
23
|
+
center,
|
|
24
|
+
settings
|
|
25
|
+
}) {
|
|
26
|
+
const hasBackButton = useHasBackButton();
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx("editor-header edit-post-header", className), children: [
|
|
28
|
+
hasBackButton && /* @__PURE__ */ jsx(
|
|
29
|
+
motion.div,
|
|
30
|
+
{
|
|
31
|
+
className: "editor-header__back-button",
|
|
32
|
+
variants: backButtonVariations,
|
|
33
|
+
transition: { type: "tween" },
|
|
34
|
+
children: /* @__PURE__ */ jsx(BackButton.Slot, {})
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
/* @__PURE__ */ jsx(
|
|
38
|
+
motion.div,
|
|
39
|
+
{
|
|
40
|
+
variants: toolbarVariations,
|
|
41
|
+
className: "editor-header__toolbar",
|
|
42
|
+
transition: { type: "tween" },
|
|
43
|
+
children: toolbar
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
center && /* @__PURE__ */ jsx(
|
|
47
|
+
motion.div,
|
|
48
|
+
{
|
|
49
|
+
variants: toolbarVariations,
|
|
50
|
+
className: "editor-header__center",
|
|
51
|
+
transition: { type: "tween" },
|
|
52
|
+
children: center
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ jsx(
|
|
56
|
+
motion.div,
|
|
57
|
+
{
|
|
58
|
+
variants: toolbarVariations,
|
|
59
|
+
transition: { type: "tween" },
|
|
60
|
+
className: "editor-header__settings",
|
|
61
|
+
children: settings
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] });
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
HeaderSkeleton as default
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=header-skeleton.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/header/header-skeleton.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __unstableMotion as motion } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BackButton, { useHasBackButton } from './back-button';\n\nconst toolbarVariations = {\n\tdistractionFreeDisabled: { y: '-50px' },\n\tdistractionFreeHover: { y: 0 },\n\tdistractionFreeHidden: { y: '-50px' },\n\tvisible: { y: 0 },\n\thidden: { y: 0 },\n};\n\nconst backButtonVariations = {\n\tdistractionFreeDisabled: { x: '-100%' },\n\tdistractionFreeHover: { x: 0 },\n\tdistractionFreeHidden: { x: '-100%' },\n\tvisible: { x: 0 },\n\thidden: { x: 0 },\n};\n\n/**\n * Header skeleton component providing the common layout structure.\n *\n * @param {Object} props Component props.\n * @param {string} props.className Additional class name.\n * @param {JSX.Element} props.toolbar Content for the left toolbar area.\n * @param {JSX.Element} props.center Content for the center area.\n * @param {JSX.Element} props.settings Content for the right settings area.\n * @return {JSX.Element} The header skeleton component.\n */\nexport default function HeaderSkeleton( {\n\tclassName,\n\ttoolbar,\n\tcenter,\n\tsettings,\n} ) {\n\tconst hasBackButton = useHasBackButton();\n\n\t/*\n\t * The edit-post-header classname is only kept for backward compatibility\n\t * as some plugins might be relying on its presence.\n\t */\n\treturn (\n\t\t<div className={ clsx( 'editor-header edit-post-header', className ) }>\n\t\t\t{ hasBackButton && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__back-button\"\n\t\t\t\t\tvariants={ backButtonVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<BackButton.Slot />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\tclassName=\"editor-header__toolbar\"\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t>\n\t\t\t\t{ toolbar }\n\t\t\t</motion.div>\n\t\t\t{ center && (\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\t\tclassName=\"editor-header__center\"\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t{ center }\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\tclassName=\"editor-header__settings\"\n\t\t\t>\n\t\t\t\t{ settings }\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,oBAAoB,cAAc;AAK3C,OAAO,cAAc,wBAAwB;AAyC3C,SAOG,KAPH;AAvCF,IAAM,oBAAoB;AAAA,EACzB,yBAAyB,EAAE,GAAG,QAAQ;AAAA,EACtC,sBAAsB,EAAE,GAAG,EAAE;AAAA,EAC7B,uBAAuB,EAAE,GAAG,QAAQ;AAAA,EACpC,SAAS,EAAE,GAAG,EAAE;AAAA,EAChB,QAAQ,EAAE,GAAG,EAAE;AAChB;AAEA,IAAM,uBAAuB;AAAA,EAC5B,yBAAyB,EAAE,GAAG,QAAQ;AAAA,EACtC,sBAAsB,EAAE,GAAG,EAAE;AAAA,EAC7B,uBAAuB,EAAE,GAAG,QAAQ;AAAA,EACpC,SAAS,EAAE,GAAG,EAAE;AAAA,EAChB,QAAQ,EAAE,GAAG,EAAE;AAChB;AAYe,SAAR,eAAiC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,gBAAgB,iBAAiB;AAMvC,SACC,qBAAC,SAAI,WAAY,KAAM,kCAAkC,SAAU,GAChE;AAAA,qBACD;AAAA,MAAC,OAAO;AAAA,MAAP;AAAA,QACA,WAAU;AAAA,QACV,UAAW;AAAA,QACX,YAAa,EAAE,MAAM,QAAQ;AAAA,QAE7B,8BAAC,WAAW,MAAX,EAAgB;AAAA;AAAA,IAClB;AAAA,IAED;AAAA,MAAC,OAAO;AAAA,MAAP;AAAA,QACA,UAAW;AAAA,QACX,WAAU;AAAA,QACV,YAAa,EAAE,MAAM,QAAQ;AAAA,QAE3B;AAAA;AAAA,IACH;AAAA,IACE,UACD;AAAA,MAAC,OAAO;AAAA,MAAP;AAAA,QACA,UAAW;AAAA,QACX,WAAU;AAAA,QACV,YAAa,EAAE,MAAM,QAAQ;AAAA,QAE3B;AAAA;AAAA,IACH;AAAA,IAED;AAAA,MAAC,OAAO;AAAA,MAAP;AAAA,QACA,UAAW;AAAA,QACX,YAAa,EAAE,MAAM,QAAQ;AAAA,QAC7B,WAAU;AAAA,QAER;AAAA;AAAA,IACH;AAAA,KACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
import { store as blockEditorStore } from "@wordpress/block-editor";
|
|
3
3
|
import { useSelect } from "@wordpress/data";
|
|
4
4
|
import { useMediaQuery, useViewportMatch } from "@wordpress/compose";
|
|
5
|
-
import { __unstableMotion as motion } from "@wordpress/components";
|
|
6
5
|
import { store as preferencesStore } from "@wordpress/preferences";
|
|
7
6
|
import { useState } from "@wordpress/element";
|
|
8
7
|
import { PinnedItems } from "@wordpress/interface";
|
|
9
|
-
import BackButton, { useHasBackButton } from "./back-button.mjs";
|
|
10
8
|
import CollapsibleBlockToolbar from "../collapsible-block-toolbar/index.mjs";
|
|
11
9
|
import DocumentBar from "../document-bar/index.mjs";
|
|
12
10
|
import DocumentTools from "../document-tools/index.mjs";
|
|
11
|
+
import HeaderSkeleton from "./header-skeleton.mjs";
|
|
13
12
|
import MoreMenu from "../more-menu/index.mjs";
|
|
14
13
|
import PostPreviewButton from "../post-preview-button/index.mjs";
|
|
15
14
|
import PostPublishButtonOrToggle from "../post-publish-button/post-publish-button-or-toggle.mjs";
|
|
@@ -19,26 +18,13 @@ import PreviewDropdown from "../preview-dropdown/index.mjs";
|
|
|
19
18
|
import ZoomOutToggle from "../zoom-out-toggle/index.mjs";
|
|
20
19
|
import { store as editorStore } from "../../store/index.mjs";
|
|
21
20
|
import {
|
|
21
|
+
ATTACHMENT_POST_TYPE,
|
|
22
22
|
TEMPLATE_PART_POST_TYPE,
|
|
23
23
|
PATTERN_POST_TYPE,
|
|
24
24
|
NAVIGATION_POST_TYPE
|
|
25
25
|
} from "../../store/constants.mjs";
|
|
26
26
|
import { unlock } from "../../lock-unlock.mjs";
|
|
27
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
28
|
-
var toolbarVariations = {
|
|
29
|
-
distractionFreeDisabled: { y: "-50px" },
|
|
30
|
-
distractionFreeHover: { y: 0 },
|
|
31
|
-
distractionFreeHidden: { y: "-50px" },
|
|
32
|
-
visible: { y: 0 },
|
|
33
|
-
hidden: { y: 0 }
|
|
34
|
-
};
|
|
35
|
-
var backButtonVariations = {
|
|
36
|
-
distractionFreeDisabled: { x: "-100%" },
|
|
37
|
-
distractionFreeHover: { x: 0 },
|
|
38
|
-
distractionFreeHidden: { x: "-100%" },
|
|
39
|
-
visible: { x: 0 },
|
|
40
|
-
hidden: { x: 0 }
|
|
41
|
-
};
|
|
27
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
42
28
|
function Header({
|
|
43
29
|
customSaveButton,
|
|
44
30
|
forceIsDirty,
|
|
@@ -55,7 +41,8 @@ function Header({
|
|
|
55
41
|
hasFixedToolbar,
|
|
56
42
|
hasBlockSelection,
|
|
57
43
|
hasSectionRootClientId,
|
|
58
|
-
isStylesCanvasActive
|
|
44
|
+
isStylesCanvasActive,
|
|
45
|
+
isAttachment
|
|
59
46
|
} = useSelect((select) => {
|
|
60
47
|
const { get: getPreference } = select(preferencesStore);
|
|
61
48
|
const {
|
|
@@ -77,105 +64,76 @@ function Header({
|
|
|
77
64
|
hasFixedToolbar: getPreference("core", "fixedToolbar"),
|
|
78
65
|
hasBlockSelection: !!getBlockSelectionStart(),
|
|
79
66
|
hasSectionRootClientId: !!getSectionRootClientId(),
|
|
80
|
-
isStylesCanvasActive: !!getStylesPath()?.startsWith("/revisions") || getShowStylebook()
|
|
67
|
+
isStylesCanvasActive: !!getStylesPath()?.startsWith("/revisions") || getShowStylebook(),
|
|
68
|
+
isAttachment: getCurrentPostType() === ATTACHMENT_POST_TYPE && window?.__experimentalMediaEditor
|
|
81
69
|
};
|
|
82
70
|
}, []);
|
|
83
71
|
const canBeZoomedOut = ["post", "page", "wp_template"].includes(postType) && hasSectionRootClientId;
|
|
84
72
|
const disablePreviewOption = [
|
|
73
|
+
ATTACHMENT_POST_TYPE,
|
|
85
74
|
NAVIGATION_POST_TYPE,
|
|
86
75
|
TEMPLATE_PART_POST_TYPE,
|
|
87
76
|
PATTERN_POST_TYPE
|
|
88
77
|
].includes(postType) || isStylesCanvasActive;
|
|
89
78
|
const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = useState(true);
|
|
90
79
|
const hasCenter = !isTooNarrowForDocumentBar && (!hasFixedToolbar || hasFixedToolbar && (!hasBlockSelection || isBlockToolsCollapsed));
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
/* @__PURE__ */ jsx(PostSavedState, { forceIsDirty }),
|
|
149
|
-
/* @__PURE__ */ jsx(PostViewLink, {}),
|
|
150
|
-
/* @__PURE__ */ jsx(
|
|
151
|
-
PreviewDropdown,
|
|
152
|
-
{
|
|
153
|
-
forceIsAutosaveable: forceIsDirty,
|
|
154
|
-
disabled: disablePreviewOption
|
|
155
|
-
}
|
|
156
|
-
),
|
|
157
|
-
/* @__PURE__ */ jsx(
|
|
158
|
-
PostPreviewButton,
|
|
159
|
-
{
|
|
160
|
-
className: "editor-header__post-preview-button",
|
|
161
|
-
forceIsAutosaveable: forceIsDirty
|
|
162
|
-
}
|
|
163
|
-
),
|
|
164
|
-
isWideViewport && canBeZoomedOut && /* @__PURE__ */ jsx(ZoomOutToggle, { disabled: isStylesCanvasActive }),
|
|
165
|
-
(isWideViewport || !showIconLabels) && /* @__PURE__ */ jsx(PinnedItems.Slot, { scope: "core" }),
|
|
166
|
-
!customSaveButton && /* @__PURE__ */ jsx(
|
|
167
|
-
PostPublishButtonOrToggle,
|
|
168
|
-
{
|
|
169
|
-
forceIsDirty,
|
|
170
|
-
setEntitiesSavedStatesCallback
|
|
171
|
-
}
|
|
172
|
-
),
|
|
173
|
-
customSaveButton,
|
|
174
|
-
/* @__PURE__ */ jsx(MoreMenu, {})
|
|
175
|
-
]
|
|
176
|
-
}
|
|
177
|
-
)
|
|
178
|
-
] });
|
|
80
|
+
return /* @__PURE__ */ jsx(
|
|
81
|
+
HeaderSkeleton,
|
|
82
|
+
{
|
|
83
|
+
toolbar: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
84
|
+
!isAttachment && /* @__PURE__ */ jsx(
|
|
85
|
+
DocumentTools,
|
|
86
|
+
{
|
|
87
|
+
disableBlockTools: isStylesCanvasActive || isTextEditor
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
hasFixedToolbar && isLargeViewport && /* @__PURE__ */ jsx(
|
|
91
|
+
CollapsibleBlockToolbar,
|
|
92
|
+
{
|
|
93
|
+
isCollapsed: isBlockToolsCollapsed,
|
|
94
|
+
onToggle: setIsBlockToolsCollapsed
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
] }),
|
|
98
|
+
center: hasCenter ? /* @__PURE__ */ jsx(DocumentBar, {}) : void 0,
|
|
99
|
+
settings: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
100
|
+
!customSaveButton && !isPublishSidebarOpened && /*
|
|
101
|
+
* This button isn't completely hidden by the publish sidebar.
|
|
102
|
+
* We can't hide the whole toolbar when the publish sidebar is open because
|
|
103
|
+
* we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
|
|
104
|
+
* We track that DOM node to return focus to the PostPublishButtonOrToggle
|
|
105
|
+
* when the publish sidebar has been closed.
|
|
106
|
+
*/
|
|
107
|
+
/* @__PURE__ */ jsx(PostSavedState, { forceIsDirty }),
|
|
108
|
+
/* @__PURE__ */ jsx(PostViewLink, {}),
|
|
109
|
+
/* @__PURE__ */ jsx(
|
|
110
|
+
PreviewDropdown,
|
|
111
|
+
{
|
|
112
|
+
forceIsAutosaveable: forceIsDirty,
|
|
113
|
+
disabled: disablePreviewOption
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
PostPreviewButton,
|
|
118
|
+
{
|
|
119
|
+
className: "editor-header__post-preview-button",
|
|
120
|
+
forceIsAutosaveable: forceIsDirty
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
isWideViewport && canBeZoomedOut && /* @__PURE__ */ jsx(ZoomOutToggle, { disabled: isStylesCanvasActive }),
|
|
124
|
+
(isWideViewport || !showIconLabels) && /* @__PURE__ */ jsx(PinnedItems.Slot, { scope: "core" }),
|
|
125
|
+
!customSaveButton && /* @__PURE__ */ jsx(
|
|
126
|
+
PostPublishButtonOrToggle,
|
|
127
|
+
{
|
|
128
|
+
forceIsDirty,
|
|
129
|
+
setEntitiesSavedStatesCallback
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
customSaveButton,
|
|
133
|
+
!isAttachment && /* @__PURE__ */ jsx(MoreMenu, {})
|
|
134
|
+
] })
|
|
135
|
+
}
|
|
136
|
+
);
|
|
179
137
|
}
|
|
180
138
|
var header_default = Header;
|
|
181
139
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/header/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMediaQuery, useViewportMatch } from '@wordpress/compose';\nimport {
|
|
5
|
-
"mappings": ";AAGA,SAAS,SAAS,wBAAwB;AAC1C,SAAS,iBAAiB;AAC1B,SAAS,eAAe,wBAAwB;AAChD,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMediaQuery, useViewportMatch } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport CollapsibleBlockToolbar from '../collapsible-block-toolbar';\nimport DocumentBar from '../document-bar';\nimport DocumentTools from '../document-tools';\nimport HeaderSkeleton from './header-skeleton';\nimport MoreMenu from '../more-menu';\nimport PostPreviewButton from '../post-preview-button';\nimport PostPublishButtonOrToggle from '../post-publish-button/post-publish-button-or-toggle';\nimport PostSavedState from '../post-saved-state';\nimport PostViewLink from '../post-view-link';\nimport PreviewDropdown from '../preview-dropdown';\nimport ZoomOutToggle from '../zoom-out-toggle';\nimport { store as editorStore } from '../../store';\nimport {\n\tATTACHMENT_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\n\nfunction Header( {\n\tcustomSaveButton,\n\tforceIsDirty,\n\tsetEntitiesSavedStatesCallback,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isTooNarrowForDocumentBar = useMediaQuery( '(max-width: 403px)' );\n\tconst {\n\t\tpostType,\n\t\tisTextEditor,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasFixedToolbar,\n\t\thasBlockSelection,\n\t\thasSectionRootClientId,\n\t\tisStylesCanvasActive,\n\t\tisAttachment,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorMode,\n\t\t\tgetCurrentPostType,\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened,\n\t\t} = select( editorStore );\n\t\tconst { getStylesPath, getShowStylebook } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\tconst { getBlockSelectionStart, getSectionRootClientId } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\thasBlockSelection: !! getBlockSelectionStart(),\n\t\t\thasSectionRootClientId: !! getSectionRootClientId(),\n\t\t\tisStylesCanvasActive:\n\t\t\t\t!! getStylesPath()?.startsWith( '/revisions' ) ||\n\t\t\t\tgetShowStylebook(),\n\t\t\tisAttachment:\n\t\t\t\tgetCurrentPostType() === ATTACHMENT_POST_TYPE &&\n\t\t\t\twindow?.__experimentalMediaEditor,\n\t\t};\n\t}, [] );\n\n\tconst canBeZoomedOut =\n\t\t[ 'post', 'page', 'wp_template' ].includes( postType ) &&\n\t\thasSectionRootClientId;\n\n\tconst disablePreviewOption =\n\t\t[\n\t\t\tATTACHMENT_POST_TYPE,\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\tPATTERN_POST_TYPE,\n\t\t].includes( postType ) || isStylesCanvasActive;\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasCenter =\n\t\t! isTooNarrowForDocumentBar &&\n\t\t( ! hasFixedToolbar ||\n\t\t\t( hasFixedToolbar &&\n\t\t\t\t( ! hasBlockSelection || isBlockToolsCollapsed ) ) );\n\n\treturn (\n\t\t<HeaderSkeleton\n\t\t\ttoolbar={\n\t\t\t\t<>\n\t\t\t\t\t{ ! isAttachment && (\n\t\t\t\t\t\t<DocumentTools\n\t\t\t\t\t\t\tdisableBlockTools={\n\t\t\t\t\t\t\t\tisStylesCanvasActive || isTextEditor\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\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t\t<CollapsibleBlockToolbar\n\t\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tcenter={ hasCenter ? <DocumentBar /> : undefined }\n\t\t\tsettings={\n\t\t\t\t<>\n\t\t\t\t\t{ ! customSaveButton && ! isPublishSidebarOpened && (\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t\t * We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t\t * we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t\t * We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t\t * when the publish sidebar has been closed.\n\t\t\t\t\t\t */\n\t\t\t\t\t\t<PostSavedState forceIsDirty={ forceIsDirty } />\n\t\t\t\t\t) }\n\n\t\t\t\t\t<PostViewLink />\n\n\t\t\t\t\t<PreviewDropdown\n\t\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\t\tdisabled={ disablePreviewOption }\n\t\t\t\t\t/>\n\n\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\tclassName=\"editor-header__post-preview-button\"\n\t\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\t/>\n\n\t\t\t\t\t{ isWideViewport && canBeZoomedOut && (\n\t\t\t\t\t\t<ZoomOutToggle disabled={ isStylesCanvasActive } />\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! customSaveButton && (\n\t\t\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t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AAAA;AAAA,YACA,qBAAsB;AAAA,YACtB,UAAW;AAAA;AAAA,QACZ;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,qBAAsB;AAAA;AAAA,QACvB;AAAA,QAEE,kBAAkB,kBACnB,oBAAC,iBAAc,UAAW,sBAAuB;AAAA,SAG9C,kBAAkB,CAAE,mBACvB,oBAAC,YAAY,MAAZ,EAAiB,OAAM,QAAO;AAAA,QAG9B,CAAE,oBACH;AAAA,UAAC;AAAA;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QAGD;AAAA,QAEC;AAAA,QACA,CAAE,gBAAgB,oBAAC,YAAS;AAAA,SAC/B;AAAA;AAAA,EAEF;AAEF;AAEA,IAAO,iBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// packages/editor/src/components/media/index.js
|
|
2
|
+
import { default as default2 } from "./preview.mjs";
|
|
3
|
+
import { default as default3 } from "./metadata-panel.mjs";
|
|
4
|
+
export {
|
|
5
|
+
default3 as MediaMetadataPanel,
|
|
6
|
+
default2 as MediaPreview
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/media/index.js"],
|
|
4
|
+
"sourcesContent": ["export { default as MediaPreview } from './preview';\nexport { default as MediaMetadataPanel } from './metadata-panel';\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAoB,WAAXA,gBAA+B;AACxC,SAAoB,WAAXA,gBAAqC;",
|
|
6
|
+
"names": ["default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// packages/editor/src/components/media/metadata-panel.js
|
|
2
|
+
import { MediaEditorProvider, MediaForm } from "@wordpress/media-editor";
|
|
3
|
+
import { useSelect, useDispatch } from "@wordpress/data";
|
|
4
|
+
import { useMemo } from "@wordpress/element";
|
|
5
|
+
import { store as coreStore } from "@wordpress/core-data";
|
|
6
|
+
import { store as editorStore } from "../../store/index.mjs";
|
|
7
|
+
import usePostFields from "../post-fields/index.mjs";
|
|
8
|
+
import PostCardPanel from "../post-card-panel/index.mjs";
|
|
9
|
+
import PostPanelSection from "../post-panel-section/index.mjs";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
function MediaMetadataPanel({ onActionPerformed }) {
|
|
12
|
+
const { media, postType, postId } = useSelect((select) => {
|
|
13
|
+
const _postType = select(editorStore).getCurrentPostType();
|
|
14
|
+
const _postId = select(editorStore).getCurrentPostId();
|
|
15
|
+
const currentPost = select(coreStore).getEditedEntityRecord(
|
|
16
|
+
"postType",
|
|
17
|
+
_postType,
|
|
18
|
+
_postId,
|
|
19
|
+
{
|
|
20
|
+
_embed: "author,wp:attached-to"
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
return {
|
|
24
|
+
media: currentPost,
|
|
25
|
+
postType: _postType,
|
|
26
|
+
postId: _postId
|
|
27
|
+
};
|
|
28
|
+
}, []);
|
|
29
|
+
const { editPost } = useDispatch(editorStore);
|
|
30
|
+
const fields = usePostFields({ postType: "attachment" });
|
|
31
|
+
const settings = useMemo(
|
|
32
|
+
() => ({
|
|
33
|
+
fields
|
|
34
|
+
}),
|
|
35
|
+
[fields]
|
|
36
|
+
);
|
|
37
|
+
const handleUpdate = (updates) => {
|
|
38
|
+
editPost(updates);
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ jsx(PostPanelSection, { className: "editor-media-metadata-panel", children: /* @__PURE__ */ jsx(
|
|
41
|
+
MediaEditorProvider,
|
|
42
|
+
{
|
|
43
|
+
value: media,
|
|
44
|
+
settings,
|
|
45
|
+
onChange: handleUpdate,
|
|
46
|
+
children: /* @__PURE__ */ jsx(
|
|
47
|
+
MediaForm,
|
|
48
|
+
{
|
|
49
|
+
header: /* @__PURE__ */ jsx(
|
|
50
|
+
PostCardPanel,
|
|
51
|
+
{
|
|
52
|
+
postType,
|
|
53
|
+
postId,
|
|
54
|
+
onActionPerformed
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
) });
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
MediaMetadataPanel as default
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=metadata-panel.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/media/metadata-panel.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { MediaEditorProvider, MediaForm } from '@wordpress/media-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport usePostFields from '../post-fields';\nimport PostCardPanel from '../post-card-panel';\nimport PostPanelSection from '../post-panel-section';\n\n/**\n * Media metadata panel for the editor sidebar.\n * Displays a form for editing media properties with PostCardPanel header.\n *\n * @param {Object} props - Component props.\n * @param {Function} props.onActionPerformed - Callback when an action is performed.\n * @return {Element} The MediaMetadataPanel component.\n */\nexport default function MediaMetadataPanel( { onActionPerformed } ) {\n\tconst { media, postType, postId } = useSelect( ( select ) => {\n\t\tconst _postType = select( editorStore ).getCurrentPostType();\n\t\tconst _postId = select( editorStore ).getCurrentPostId();\n\t\tconst currentPost = select( coreStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId,\n\t\t\t{\n\t\t\t\t_embed: 'author,wp:attached-to',\n\t\t\t}\n\t\t);\n\t\treturn {\n\t\t\tmedia: currentPost,\n\t\t\tpostType: _postType,\n\t\t\tpostId: _postId,\n\t\t};\n\t}, [] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst fields = usePostFields( { postType: 'attachment' } );\n\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\tfields,\n\t\t} ),\n\t\t[ fields ]\n\t);\n\n\tconst handleUpdate = ( updates ) => {\n\t\teditPost( updates );\n\t};\n\n\treturn (\n\t\t<PostPanelSection className=\"editor-media-metadata-panel\">\n\t\t\t<MediaEditorProvider\n\t\t\t\tvalue={ media }\n\t\t\t\tsettings={ settings }\n\t\t\t\tonChange={ handleUpdate }\n\t\t\t>\n\t\t\t\t<MediaForm\n\t\t\t\t\theader={\n\t\t\t\t\t\t<PostCardPanel\n\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</MediaEditorProvider>\n\t\t</PostPanelSection>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,qBAAqB,iBAAiB;AAC/C,SAAS,WAAW,mBAAmB;AACvC,SAAS,eAAe;AACxB,SAAS,SAAS,iBAAiB;AAKnC,SAAS,SAAS,mBAAmB;AACrC,OAAO,mBAAmB;AAC1B,OAAO,mBAAmB;AAC1B,OAAO,sBAAsB;AAoDvB;AA1CS,SAAR,mBAAqC,EAAE,kBAAkB,GAAI;AACnE,QAAM,EAAE,OAAO,UAAU,OAAO,IAAI,UAAW,CAAE,WAAY;AAC5D,UAAM,YAAY,OAAQ,WAAY,EAAE,mBAAmB;AAC3D,UAAM,UAAU,OAAQ,WAAY,EAAE,iBAAiB;AACvD,UAAM,cAAc,OAAQ,SAAU,EAAE;AAAA,MACvC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACC,QAAQ;AAAA,MACT;AAAA,IACD;AACA,WAAO;AAAA,MACN,OAAO;AAAA,MACP,UAAU;AAAA,MACV,QAAQ;AAAA,IACT;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,QAAM,EAAE,SAAS,IAAI,YAAa,WAAY;AAC9C,QAAM,SAAS,cAAe,EAAE,UAAU,aAAa,CAAE;AAEzD,QAAM,WAAW;AAAA,IAChB,OAAQ;AAAA,MACP;AAAA,IACD;AAAA,IACA,CAAE,MAAO;AAAA,EACV;AAEA,QAAM,eAAe,CAAE,YAAa;AACnC,aAAU,OAAQ;AAAA,EACnB;AAEA,SACC,oBAAC,oBAAiB,WAAU,+BAC3B;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ;AAAA,MACR;AAAA,MACA,UAAW;AAAA,MAEX;AAAA,QAAC;AAAA;AAAA,UACA,QACC;AAAA,YAAC;AAAA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UACD;AAAA;AAAA,MAEF;AAAA;AAAA,EACD,GACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// packages/editor/src/components/media/preview.js
|
|
2
|
+
import {
|
|
3
|
+
MediaEditorProvider,
|
|
4
|
+
MediaPreview as BaseMediaPreview
|
|
5
|
+
} from "@wordpress/media-editor";
|
|
6
|
+
import { useSelect } from "@wordpress/data";
|
|
7
|
+
import { store as editorStore } from "../../store/index.mjs";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
function MediaPreview(props) {
|
|
10
|
+
const { media } = useSelect((select) => {
|
|
11
|
+
const currentPost = select(editorStore).getCurrentPost();
|
|
12
|
+
return {
|
|
13
|
+
media: currentPost
|
|
14
|
+
};
|
|
15
|
+
}, []);
|
|
16
|
+
return /* @__PURE__ */ jsx(MediaEditorProvider, { value: media, children: /* @__PURE__ */ jsx(BaseMediaPreview, { ...props }) });
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
MediaPreview as default
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=preview.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/media/preview.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tMediaEditorProvider,\n\tMediaPreview as BaseMediaPreview,\n} from '@wordpress/media-editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Media preview component for the editor.\n * Connects the base MediaPreview component to the editor store.\n *\n * @param {Object} props - Additional props to spread on MediaPreview.\n * @return {Element} The MediaPreview component.\n */\nexport default function MediaPreview( props ) {\n\tconst { media } = useSelect( ( select ) => {\n\t\tconst currentPost = select( editorStore ).getCurrentPost();\n\t\treturn {\n\t\t\tmedia: currentPost,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<MediaEditorProvider value={ media }>\n\t\t\t<BaseMediaPreview { ...props } />\n\t\t</MediaEditorProvider>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,gBAAgB;AAAA,OACV;AACP,SAAS,iBAAiB;AAK1B,SAAS,SAAS,mBAAmB;AAmBlC;AAVY,SAAR,aAA+B,OAAQ;AAC7C,QAAM,EAAE,MAAM,IAAI,UAAW,CAAE,WAAY;AAC1C,UAAM,cAAc,OAAQ,WAAY,EAAE,eAAe;AACzD,WAAO;AAAA,MACN,OAAO;AAAA,IACR;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,SACC,oBAAC,uBAAoB,OAAQ,OAC5B,8BAAC,oBAAmB,GAAG,OAAQ,GAChC;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -20,7 +20,7 @@ import ToolsMoreMenuGroup from "./tools-more-menu-group.mjs";
|
|
|
20
20
|
import ViewMoreMenuGroup from "./view-more-menu-group.mjs";
|
|
21
21
|
import { store as editorStore } from "../../store/index.mjs";
|
|
22
22
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
-
function MoreMenu() {
|
|
23
|
+
function MoreMenu({ disabled = false }) {
|
|
24
24
|
const { openModal } = useDispatch(interfaceStore);
|
|
25
25
|
const { set: setPreference } = useDispatch(preferencesStore);
|
|
26
26
|
const { toggleDistractionFree } = useDispatch(editorStore);
|
|
@@ -44,7 +44,8 @@ function MoreMenu() {
|
|
|
44
44
|
showTooltip: !showIconLabels,
|
|
45
45
|
...showIconLabels && { variant: "tertiary" },
|
|
46
46
|
tooltipPosition: "bottom",
|
|
47
|
-
size: "compact"
|
|
47
|
+
size: "compact",
|
|
48
|
+
disabled
|
|
48
49
|
},
|
|
49
50
|
children: ({ onClose }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
51
|
/* @__PURE__ */ jsxs(MenuGroup, { label: _x("View", "noun"), children: [
|