@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
package/CHANGELOG.md
CHANGED
|
@@ -30,9 +30,6 @@ var import_core_data = require("@wordpress/core-data");
|
|
|
30
30
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
31
31
|
function useEditedSectionDetails() {
|
|
32
32
|
return (0, import_data.useSelect)((select) => {
|
|
33
|
-
if (!window?.__experimentalContentOnlyPatternInsertion) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
33
|
const {
|
|
37
34
|
getBlockAttributes,
|
|
38
35
|
getBlockName,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/document-bar/useEditedSectionDetails.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Hook to get details about the currently edited content-only section.\n * Only returns information when the content only pattern insertion experiment is enabled.\n *\n * @return {Object|null} Object with patternName, patternTitle, and type, or null if no section is being edited or experiment is disabled.\n */\nexport default function useEditedSectionDetails() {\n\treturn useSelect( ( select ) => {\n\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,2BAA+B;AAC/B,0BAA0C;AAC1C,uBAAmC;AAKnC,yBAAuB;AAQR,SAAR,0BAA2C;AACjD,aAAO,uBAAW,CAAE,WAAY;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Hook to get details about the currently edited content-only section.\n * Only returns information when the content only pattern insertion experiment is enabled.\n *\n * @return {Object|null} Object with patternName, patternTitle, and type, or null if no section is being edited or experiment is disabled.\n */\nexport default function useEditedSectionDetails() {\n\treturn useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockAttributes,\n\t\t\tgetBlockName,\n\t\t\t__experimentalGetParsedPattern,\n\t\t} = select( blockEditorStore );\n\t\tconst { getEditedEntityRecord, getCurrentTheme } = select( coreStore );\n\t\tconst { getEditedContentOnlySection } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\n\t\t// Get the clientId of the unlocked pattern/section\n\t\tconst editedSectionId = getEditedContentOnlySection();\n\t\tif ( ! editedSectionId ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst attributes = getBlockAttributes( editedSectionId );\n\n\t\t// Handle unsynced patterns (contentOnly patterns with patternName)\n\t\tconst patternName = attributes?.metadata?.patternName;\n\t\tif ( patternName ) {\n\t\t\t// Get pattern details if available\n\t\t\tconst pattern =\n\t\t\t\ttypeof __experimentalGetParsedPattern === 'function'\n\t\t\t\t\t? __experimentalGetParsedPattern( patternName )\n\t\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\tpatternName,\n\t\t\t\tpatternTitle: pattern?.title || attributes?.metadata?.name,\n\t\t\t\ttype: 'pattern',\n\t\t\t};\n\t\t}\n\n\t\tconst blockName = getBlockName( editedSectionId );\n\n\t\t// Handle synced patterns (core/block)\n\t\tif ( blockName === 'core/block' && !! attributes?.ref ) {\n\t\t\tconst entity = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_block',\n\t\t\t\tattributes.ref\n\t\t\t);\n\t\t\tif ( entity?.title ) {\n\t\t\t\treturn {\n\t\t\t\t\tpatternName: attributes.ref,\n\t\t\t\t\tpatternTitle: decodeEntities( entity.title ),\n\t\t\t\t\ttype: 'synced-pattern',\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Handle template parts (core/template-part)\n\t\tif ( blockName === 'core/template-part' && !! attributes?.slug ) {\n\t\t\tconst theme = attributes.theme || getCurrentTheme()?.stylesheet;\n\t\t\tconst templatePartId = theme\n\t\t\t\t? `${ theme }//${ attributes.slug }`\n\t\t\t\t: null;\n\t\t\tif ( templatePartId ) {\n\t\t\t\tconst entity = getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template_part',\n\t\t\t\t\ttemplatePartId\n\t\t\t\t);\n\t\t\t\tif ( entity?.title ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tpatternName: attributes.slug,\n\t\t\t\t\t\tpatternTitle: decodeEntities( entity.title ),\n\t\t\t\t\t\ttype: 'template-part',\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}, [] );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,2BAA+B;AAC/B,0BAA0C;AAC1C,uBAAmC;AAKnC,yBAAuB;AAQR,SAAR,0BAA2C;AACjD,aAAO,uBAAW,CAAE,WAAY;AAC/B,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,OAAQ,oBAAAA,KAAiB;AAC7B,UAAM,EAAE,uBAAuB,gBAAgB,IAAI,OAAQ,iBAAAC,KAAU;AACrE,UAAM,EAAE,4BAA4B,QAAI;AAAA,MACvC,OAAQ,oBAAAD,KAAiB;AAAA,IAC1B;AAGA,UAAM,kBAAkB,4BAA4B;AACpD,QAAK,CAAE,iBAAkB;AACxB,aAAO;AAAA,IACR;AAEA,UAAM,aAAa,mBAAoB,eAAgB;AAGvD,UAAM,cAAc,YAAY,UAAU;AAC1C,QAAK,aAAc;AAElB,YAAM,UACL,OAAO,mCAAmC,aACvC,+BAAgC,WAAY,IAC5C;AAEJ,aAAO;AAAA,QACN;AAAA,QACA,cAAc,SAAS,SAAS,YAAY,UAAU;AAAA,QACtD,MAAM;AAAA,MACP;AAAA,IACD;AAEA,UAAM,YAAY,aAAc,eAAgB;AAGhD,QAAK,cAAc,gBAAgB,CAAC,CAAE,YAAY,KAAM;AACvD,YAAM,SAAS;AAAA,QACd;AAAA,QACA;AAAA,QACA,WAAW;AAAA,MACZ;AACA,UAAK,QAAQ,OAAQ;AACpB,eAAO;AAAA,UACN,aAAa,WAAW;AAAA,UACxB,kBAAc,qCAAgB,OAAO,KAAM;AAAA,UAC3C,MAAM;AAAA,QACP;AAAA,MACD;AAAA,IACD;AAGA,QAAK,cAAc,wBAAwB,CAAC,CAAE,YAAY,MAAO;AAChE,YAAM,QAAQ,WAAW,SAAS,gBAAgB,GAAG;AACrD,YAAM,iBAAiB,QACpB,GAAI,KAAM,KAAM,WAAW,IAAK,KAChC;AACH,UAAK,gBAAiB;AACrB,cAAM,SAAS;AAAA,UACd;AAAA,UACA;AAAA,UACA;AAAA,QACD;AACA,YAAK,QAAQ,OAAQ;AACpB,iBAAO;AAAA,YACN,aAAa,WAAW;AAAA,YACxB,kBAAc,qCAAgB,OAAO,KAAM;AAAA,YAC3C,MAAM;AAAA,UACP;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAEA,WAAO;AAAA,EACR,GAAG,CAAC,CAAE;AACP;",
|
|
6
6
|
"names": ["blockEditorStore", "coreStore"]
|
|
7
7
|
}
|
|
@@ -48,10 +48,12 @@ var import_editor_notices = __toESM(require("../editor-notices/index.cjs"));
|
|
|
48
48
|
var import_header = __toESM(require("../header/index.cjs"));
|
|
49
49
|
var import_inserter_sidebar = __toESM(require("../inserter-sidebar/index.cjs"));
|
|
50
50
|
var import_list_view_sidebar = __toESM(require("../list-view-sidebar/index.cjs"));
|
|
51
|
+
var import_post_revisions_preview = require("../post-revisions-preview/index.cjs");
|
|
51
52
|
var import_save_publish_panels = __toESM(require("../save-publish-panels/index.cjs"));
|
|
52
53
|
var import_text_editor = __toESM(require("../text-editor/index.cjs"));
|
|
53
54
|
var import_visual_editor = __toESM(require("../visual-editor/index.cjs"));
|
|
54
55
|
var import_styles_canvas = __toESM(require("../styles-canvas/index.cjs"));
|
|
56
|
+
var import_media = require("../media/index.cjs");
|
|
55
57
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
56
58
|
var interfaceLabels = {
|
|
57
59
|
/* translators: accessibility text for the editor top bar landmark region. */
|
|
@@ -79,6 +81,7 @@ function EditorInterface({
|
|
|
79
81
|
}) {
|
|
80
82
|
const {
|
|
81
83
|
mode,
|
|
84
|
+
isAttachment,
|
|
82
85
|
isInserterOpened,
|
|
83
86
|
isListViewOpened,
|
|
84
87
|
isDistractionFree,
|
|
@@ -86,13 +89,16 @@ function EditorInterface({
|
|
|
86
89
|
showBlockBreadcrumbs,
|
|
87
90
|
postTypeLabel,
|
|
88
91
|
stylesPath,
|
|
89
|
-
showStylebook
|
|
92
|
+
showStylebook,
|
|
93
|
+
isRevisionsMode
|
|
90
94
|
} = (0, import_data.useSelect)((select) => {
|
|
91
95
|
const { get } = select(import_preferences.store);
|
|
92
|
-
const { getEditorSettings, getPostTypeLabel } = select(import_store.store);
|
|
93
|
-
const {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
const { getEditorSettings, getPostTypeLabel, getCurrentPostType } = select(import_store.store);
|
|
97
|
+
const {
|
|
98
|
+
getStylesPath,
|
|
99
|
+
getShowStylebook,
|
|
100
|
+
isRevisionsMode: _isRevisionsMode
|
|
101
|
+
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
96
102
|
const editorSettings = getEditorSettings();
|
|
97
103
|
let _mode = select(import_store.store).getEditorMode();
|
|
98
104
|
if (!editorSettings.richEditingEnabled && _mode === "visual") {
|
|
@@ -110,12 +116,16 @@ function EditorInterface({
|
|
|
110
116
|
showBlockBreadcrumbs: get("core", "showBlockBreadcrumbs"),
|
|
111
117
|
postTypeLabel: getPostTypeLabel(),
|
|
112
118
|
stylesPath: getStylesPath(),
|
|
113
|
-
showStylebook: getShowStylebook()
|
|
119
|
+
showStylebook: getShowStylebook(),
|
|
120
|
+
isAttachment: getCurrentPostType() === "attachment" && window?.__experimentalMediaEditor,
|
|
121
|
+
isRevisionsMode: _isRevisionsMode()
|
|
114
122
|
};
|
|
115
123
|
}, []);
|
|
116
124
|
const isLargeViewport = (0, import_compose.useViewportMatch)("medium");
|
|
117
125
|
const secondarySidebarLabel = isListViewOpened ? (0, import_i18n.__)("Document Overview") : (0, import_i18n.__)("Block Library");
|
|
118
|
-
const
|
|
126
|
+
const shouldShowMediaEditor = !!isAttachment;
|
|
127
|
+
const shouldShowStylesCanvas = !isAttachment && (showStylebook || stylesPath?.startsWith("/revisions"));
|
|
128
|
+
const shouldShowBlockEditor = !shouldShowMediaEditor && !shouldShowStylesCanvas;
|
|
119
129
|
const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0, import_element.useState)(false);
|
|
120
130
|
const closeEntitiesSavedStates = (0, import_element.useCallback)(
|
|
121
131
|
(arg) => {
|
|
@@ -126,6 +136,18 @@ function EditorInterface({
|
|
|
126
136
|
},
|
|
127
137
|
[entitiesSavedStatesCallback]
|
|
128
138
|
);
|
|
139
|
+
if (isRevisionsMode) {
|
|
140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
141
|
+
import_interface.InterfaceSkeleton,
|
|
142
|
+
{
|
|
143
|
+
className: (0, import_clsx.default)("editor-editor-interface", className),
|
|
144
|
+
labels: interfaceLabels,
|
|
145
|
+
header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_revisions_preview.RevisionsHeader, {}),
|
|
146
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_revisions_preview.RevisionsCanvas, {}),
|
|
147
|
+
sidebar: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_interface.ComplementaryArea.Slot, { scope: "core" })
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
}
|
|
129
151
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
130
152
|
import_interface.InterfaceSkeleton,
|
|
131
153
|
{
|
|
@@ -148,11 +170,13 @@ function EditorInterface({
|
|
|
148
170
|
}
|
|
149
171
|
),
|
|
150
172
|
editorNotices: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_editor_notices.default, {}),
|
|
151
|
-
secondarySidebar: !isPreviewMode && mode === "visual" && (isInserterOpened && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_inserter_sidebar.default, {}) || isListViewOpened && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_list_view_sidebar.default, {})),
|
|
173
|
+
secondarySidebar: !isAttachment && !isPreviewMode && mode === "visual" && (isInserterOpened && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_inserter_sidebar.default, {}) || isListViewOpened && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_list_view_sidebar.default, {})),
|
|
152
174
|
sidebar: !isPreviewMode && !isDistractionFree && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_interface.ComplementaryArea.Slot, { scope: "core" }),
|
|
153
175
|
content: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
154
176
|
!isDistractionFree && !isPreviewMode && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_editor_notices.default, {}),
|
|
155
|
-
|
|
177
|
+
shouldShowMediaEditor && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_media.MediaPreview, { ...iframeProps }),
|
|
178
|
+
shouldShowStylesCanvas && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles_canvas.default, {}),
|
|
179
|
+
shouldShowBlockEditor && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
156
180
|
!isPreviewMode && mode === "text" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
157
181
|
import_text_editor.default,
|
|
158
182
|
{
|
|
@@ -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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,uBAAqD;AACrD,kBAA0B;AAC1B,kBAAmB;AACnB,yBAA0C;AAC1C,0BAA8C;AAC9C,qBAAiC;AACjC,qBAAsC;AACtC,2BAA+B;AAK/B,mBAAqC;AACrC,yBAAuB;AACvB,4BAA0B;AAC1B,oBAAmB;AACnB,8BAA4B;AAC5B,+BAA4B;AAC5B,iCAA8B;AAC9B,yBAAuB;AACvB,2BAAyB;AACzB,2BAAyB;
|
|
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": "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",
|
|
6
6
|
"names": ["preferencesStore", "editorStore", "clsx", "Header", "EditorNotices", "InserterSidebar", "ListViewSidebar", "StylesCanvas", "TextEditor", "VisualEditor", "SavePublishPanels"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/editor/src/components/header/header-skeleton.js
|
|
31
|
+
var header_skeleton_exports = {};
|
|
32
|
+
__export(header_skeleton_exports, {
|
|
33
|
+
default: () => HeaderSkeleton
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(header_skeleton_exports);
|
|
36
|
+
var import_clsx = __toESM(require("clsx"));
|
|
37
|
+
var import_components = require("@wordpress/components");
|
|
38
|
+
var import_back_button = __toESM(require("./back-button.cjs"));
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
var toolbarVariations = {
|
|
41
|
+
distractionFreeDisabled: { y: "-50px" },
|
|
42
|
+
distractionFreeHover: { y: 0 },
|
|
43
|
+
distractionFreeHidden: { y: "-50px" },
|
|
44
|
+
visible: { y: 0 },
|
|
45
|
+
hidden: { y: 0 }
|
|
46
|
+
};
|
|
47
|
+
var backButtonVariations = {
|
|
48
|
+
distractionFreeDisabled: { x: "-100%" },
|
|
49
|
+
distractionFreeHover: { x: 0 },
|
|
50
|
+
distractionFreeHidden: { x: "-100%" },
|
|
51
|
+
visible: { x: 0 },
|
|
52
|
+
hidden: { x: 0 }
|
|
53
|
+
};
|
|
54
|
+
function HeaderSkeleton({
|
|
55
|
+
className,
|
|
56
|
+
toolbar,
|
|
57
|
+
center,
|
|
58
|
+
settings
|
|
59
|
+
}) {
|
|
60
|
+
const hasBackButton = (0, import_back_button.useHasBackButton)();
|
|
61
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_clsx.default)("editor-header edit-post-header", className), children: [
|
|
62
|
+
hasBackButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
63
|
+
import_components.__unstableMotion.div,
|
|
64
|
+
{
|
|
65
|
+
className: "editor-header__back-button",
|
|
66
|
+
variants: backButtonVariations,
|
|
67
|
+
transition: { type: "tween" },
|
|
68
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_back_button.default.Slot, {})
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
|
+
import_components.__unstableMotion.div,
|
|
73
|
+
{
|
|
74
|
+
variants: toolbarVariations,
|
|
75
|
+
className: "editor-header__toolbar",
|
|
76
|
+
transition: { type: "tween" },
|
|
77
|
+
children: toolbar
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
center && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
81
|
+
import_components.__unstableMotion.div,
|
|
82
|
+
{
|
|
83
|
+
variants: toolbarVariations,
|
|
84
|
+
className: "editor-header__center",
|
|
85
|
+
transition: { type: "tween" },
|
|
86
|
+
children: center
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
90
|
+
import_components.__unstableMotion.div,
|
|
91
|
+
{
|
|
92
|
+
variants: toolbarVariations,
|
|
93
|
+
transition: { type: "tween" },
|
|
94
|
+
className: "editor-header__settings",
|
|
95
|
+
children: settings
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] });
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=header-skeleton.cjs.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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAA2C;AAK3C,yBAA6C;AAyC3C;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,oBAAgB,qCAAiB;AAMvC,SACC,6CAAC,SAAI,eAAY,YAAAA,SAAM,kCAAkC,SAAU,GAChE;AAAA,qBACD;AAAA,MAAC,kBAAAC,iBAAO;AAAA,MAAP;AAAA,QACA,WAAU;AAAA,QACV,UAAW;AAAA,QACX,YAAa,EAAE,MAAM,QAAQ;AAAA,QAE7B,sDAAC,mBAAAC,QAAW,MAAX,EAAgB;AAAA;AAAA,IAClB;AAAA,IAED;AAAA,MAAC,kBAAAD,iBAAO;AAAA,MAAP;AAAA,QACA,UAAW;AAAA,QACX,WAAU;AAAA,QACV,YAAa,EAAE,MAAM,QAAQ;AAAA,QAE3B;AAAA;AAAA,IACH;AAAA,IACE,UACD;AAAA,MAAC,kBAAAA,iBAAO;AAAA,MAAP;AAAA,QACA,UAAW;AAAA,QACX,WAAU;AAAA,QACV,YAAa,EAAE,MAAM,QAAQ;AAAA,QAE3B;AAAA;AAAA,IACH;AAAA,IAED;AAAA,MAAC,kBAAAA,iBAAO;AAAA,MAAP;AAAA,QACA,UAAW;AAAA,QACX,YAAa,EAAE,MAAM,QAAQ;AAAA,QAC7B,WAAU;AAAA,QAER;AAAA;AAAA,IACH;AAAA,KACD;AAEF;",
|
|
6
|
+
"names": ["clsx", "motion", "BackButton"]
|
|
7
|
+
}
|
|
@@ -36,14 +36,13 @@ module.exports = __toCommonJS(header_exports);
|
|
|
36
36
|
var import_block_editor = require("@wordpress/block-editor");
|
|
37
37
|
var import_data = require("@wordpress/data");
|
|
38
38
|
var import_compose = require("@wordpress/compose");
|
|
39
|
-
var import_components = require("@wordpress/components");
|
|
40
39
|
var import_preferences = require("@wordpress/preferences");
|
|
41
40
|
var import_element = require("@wordpress/element");
|
|
42
41
|
var import_interface = require("@wordpress/interface");
|
|
43
|
-
var import_back_button = __toESM(require("./back-button.cjs"));
|
|
44
42
|
var import_collapsible_block_toolbar = __toESM(require("../collapsible-block-toolbar/index.cjs"));
|
|
45
43
|
var import_document_bar = __toESM(require("../document-bar/index.cjs"));
|
|
46
44
|
var import_document_tools = __toESM(require("../document-tools/index.cjs"));
|
|
45
|
+
var import_header_skeleton = __toESM(require("./header-skeleton.cjs"));
|
|
47
46
|
var import_more_menu = __toESM(require("../more-menu/index.cjs"));
|
|
48
47
|
var import_post_preview_button = __toESM(require("../post-preview-button/index.cjs"));
|
|
49
48
|
var import_post_publish_button_or_toggle = __toESM(require("../post-publish-button/post-publish-button-or-toggle.cjs"));
|
|
@@ -55,20 +54,6 @@ var import_store = require("../../store/index.cjs");
|
|
|
55
54
|
var import_constants = require("../../store/constants.cjs");
|
|
56
55
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
57
56
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
58
|
-
var toolbarVariations = {
|
|
59
|
-
distractionFreeDisabled: { y: "-50px" },
|
|
60
|
-
distractionFreeHover: { y: 0 },
|
|
61
|
-
distractionFreeHidden: { y: "-50px" },
|
|
62
|
-
visible: { y: 0 },
|
|
63
|
-
hidden: { y: 0 }
|
|
64
|
-
};
|
|
65
|
-
var backButtonVariations = {
|
|
66
|
-
distractionFreeDisabled: { x: "-100%" },
|
|
67
|
-
distractionFreeHover: { x: 0 },
|
|
68
|
-
distractionFreeHidden: { x: "-100%" },
|
|
69
|
-
visible: { x: 0 },
|
|
70
|
-
hidden: { x: 0 }
|
|
71
|
-
};
|
|
72
57
|
function Header({
|
|
73
58
|
customSaveButton,
|
|
74
59
|
forceIsDirty,
|
|
@@ -85,7 +70,8 @@ function Header({
|
|
|
85
70
|
hasFixedToolbar,
|
|
86
71
|
hasBlockSelection,
|
|
87
72
|
hasSectionRootClientId,
|
|
88
|
-
isStylesCanvasActive
|
|
73
|
+
isStylesCanvasActive,
|
|
74
|
+
isAttachment
|
|
89
75
|
} = (0, import_data.useSelect)((select) => {
|
|
90
76
|
const { get: getPreference } = select(import_preferences.store);
|
|
91
77
|
const {
|
|
@@ -107,105 +93,76 @@ function Header({
|
|
|
107
93
|
hasFixedToolbar: getPreference("core", "fixedToolbar"),
|
|
108
94
|
hasBlockSelection: !!getBlockSelectionStart(),
|
|
109
95
|
hasSectionRootClientId: !!getSectionRootClientId(),
|
|
110
|
-
isStylesCanvasActive: !!getStylesPath()?.startsWith("/revisions") || getShowStylebook()
|
|
96
|
+
isStylesCanvasActive: !!getStylesPath()?.startsWith("/revisions") || getShowStylebook(),
|
|
97
|
+
isAttachment: getCurrentPostType() === import_constants.ATTACHMENT_POST_TYPE && window?.__experimentalMediaEditor
|
|
111
98
|
};
|
|
112
99
|
}, []);
|
|
113
100
|
const canBeZoomedOut = ["post", "page", "wp_template"].includes(postType) && hasSectionRootClientId;
|
|
114
101
|
const disablePreviewOption = [
|
|
102
|
+
import_constants.ATTACHMENT_POST_TYPE,
|
|
115
103
|
import_constants.NAVIGATION_POST_TYPE,
|
|
116
104
|
import_constants.TEMPLATE_PART_POST_TYPE,
|
|
117
105
|
import_constants.PATTERN_POST_TYPE
|
|
118
106
|
].includes(postType) || isStylesCanvasActive;
|
|
119
107
|
const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0, import_element.useState)(true);
|
|
120
108
|
const hasCenter = !isTooNarrowForDocumentBar && (!hasFixedToolbar || hasFixedToolbar && (!hasBlockSelection || isBlockToolsCollapsed));
|
|
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_saved_state.default, { forceIsDirty }),
|
|
179
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_view_link.default, {}),
|
|
180
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
181
|
-
import_preview_dropdown.default,
|
|
182
|
-
{
|
|
183
|
-
forceIsAutosaveable: forceIsDirty,
|
|
184
|
-
disabled: disablePreviewOption
|
|
185
|
-
}
|
|
186
|
-
),
|
|
187
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
188
|
-
import_post_preview_button.default,
|
|
189
|
-
{
|
|
190
|
-
className: "editor-header__post-preview-button",
|
|
191
|
-
forceIsAutosaveable: forceIsDirty
|
|
192
|
-
}
|
|
193
|
-
),
|
|
194
|
-
isWideViewport && canBeZoomedOut && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_zoom_out_toggle.default, { disabled: isStylesCanvasActive }),
|
|
195
|
-
(isWideViewport || !showIconLabels) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_interface.PinnedItems.Slot, { scope: "core" }),
|
|
196
|
-
!customSaveButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
197
|
-
import_post_publish_button_or_toggle.default,
|
|
198
|
-
{
|
|
199
|
-
forceIsDirty,
|
|
200
|
-
setEntitiesSavedStatesCallback
|
|
201
|
-
}
|
|
202
|
-
),
|
|
203
|
-
customSaveButton,
|
|
204
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_more_menu.default, {})
|
|
205
|
-
]
|
|
206
|
-
}
|
|
207
|
-
)
|
|
208
|
-
] });
|
|
109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
110
|
+
import_header_skeleton.default,
|
|
111
|
+
{
|
|
112
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
113
|
+
!isAttachment && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
114
|
+
import_document_tools.default,
|
|
115
|
+
{
|
|
116
|
+
disableBlockTools: isStylesCanvasActive || isTextEditor
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
hasFixedToolbar && isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
120
|
+
import_collapsible_block_toolbar.default,
|
|
121
|
+
{
|
|
122
|
+
isCollapsed: isBlockToolsCollapsed,
|
|
123
|
+
onToggle: setIsBlockToolsCollapsed
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
] }),
|
|
127
|
+
center: hasCenter ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_document_bar.default, {}) : void 0,
|
|
128
|
+
settings: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
129
|
+
!customSaveButton && !isPublishSidebarOpened && /*
|
|
130
|
+
* This button isn't completely hidden by the publish sidebar.
|
|
131
|
+
* We can't hide the whole toolbar when the publish sidebar is open because
|
|
132
|
+
* we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
|
|
133
|
+
* We track that DOM node to return focus to the PostPublishButtonOrToggle
|
|
134
|
+
* when the publish sidebar has been closed.
|
|
135
|
+
*/
|
|
136
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_saved_state.default, { forceIsDirty }),
|
|
137
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_view_link.default, {}),
|
|
138
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
139
|
+
import_preview_dropdown.default,
|
|
140
|
+
{
|
|
141
|
+
forceIsAutosaveable: forceIsDirty,
|
|
142
|
+
disabled: disablePreviewOption
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
146
|
+
import_post_preview_button.default,
|
|
147
|
+
{
|
|
148
|
+
className: "editor-header__post-preview-button",
|
|
149
|
+
forceIsAutosaveable: forceIsDirty
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
isWideViewport && canBeZoomedOut && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_zoom_out_toggle.default, { disabled: isStylesCanvasActive }),
|
|
153
|
+
(isWideViewport || !showIconLabels) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_interface.PinnedItems.Slot, { scope: "core" }),
|
|
154
|
+
!customSaveButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
155
|
+
import_post_publish_button_or_toggle.default,
|
|
156
|
+
{
|
|
157
|
+
forceIsDirty,
|
|
158
|
+
setEntitiesSavedStatesCallback
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
customSaveButton,
|
|
162
|
+
!isAttachment && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_more_menu.default, {})
|
|
163
|
+
] })
|
|
164
|
+
}
|
|
165
|
+
);
|
|
209
166
|
}
|
|
210
167
|
var header_default = Header;
|
|
211
168
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA0C;AAC1C,kBAA0B;AAC1B,qBAAgD;AAChD,
|
|
6
|
-
"names": ["preferencesStore", "editorStore", "blockEditorStore", "
|
|
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\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{ customSaveButton }\n\t\t\t\t\t{ ! isAttachment && <MoreMenu /> }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n\nexport default Header;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA0C;AAC1C,kBAA0B;AAC1B,qBAAgD;AAChD,yBAA0C;AAC1C,qBAAyB;AACzB,uBAA4B;AAK5B,uCAAoC;AACpC,0BAAwB;AACxB,4BAA0B;AAC1B,6BAA2B;AAC3B,uBAAqB;AACrB,iCAA8B;AAC9B,2CAAsC;AACtC,8BAA2B;AAC3B,4BAAyB;AACzB,8BAA4B;AAC5B,6BAA0B;AAC1B,mBAAqC;AACrC,uBAKO;AACP,yBAAuB;AA2EnB;AAzEJ,SAAS,OAAQ;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,qBAAiB,iCAAkB,OAAQ;AACjD,QAAM,sBAAkB,iCAAkB,QAAS;AACnD,QAAM,gCAA4B,8BAAe,oBAAqB;AACtE,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,uBAAW,CAAE,WAAY;AAC5B,UAAM,EAAE,KAAK,cAAc,IAAI,OAAQ,mBAAAA,KAAiB;AACxD,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA,wBAAwB;AAAA,IACzB,IAAI,OAAQ,aAAAC,KAAY;AACxB,UAAM,EAAE,eAAe,iBAAiB,QAAI;AAAA,MAC3C,OAAQ,aAAAA,KAAY;AAAA,IACrB;AACA,UAAM,EAAE,wBAAwB,uBAAuB,QAAI;AAAA,MAC1D,OAAQ,oBAAAC,KAAiB;AAAA,IAC1B;AAEA,WAAO;AAAA,MACN,UAAU,mBAAmB;AAAA,MAC7B,cAAc,cAAc,MAAM;AAAA,MAClC,wBAAwB,wBAAwB;AAAA,MAChD,gBAAgB,cAAe,QAAQ,gBAAiB;AAAA,MACxD,iBAAiB,cAAe,QAAQ,cAAe;AAAA,MACvD,mBAAmB,CAAC,CAAE,uBAAuB;AAAA,MAC7C,wBAAwB,CAAC,CAAE,uBAAuB;AAAA,MAClD,sBACC,CAAC,CAAE,cAAc,GAAG,WAAY,YAAa,KAC7C,iBAAiB;AAAA,MAClB,cACC,mBAAmB,MAAM,yCACzB,QAAQ;AAAA,IACV;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,QAAM,iBACL,CAAE,QAAQ,QAAQ,aAAc,EAAE,SAAU,QAAS,KACrD;AAED,QAAM,uBACL;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,EAAE,SAAU,QAAS,KAAK;AAE3B,QAAM,CAAE,uBAAuB,wBAAyB,QACvD,yBAAU,IAAK;AAEhB,QAAM,YACL,CAAE,8BACA,CAAE,mBACD,oBACC,CAAE,qBAAqB;AAE5B,SACC;AAAA,IAAC,uBAAAC;AAAA,IAAA;AAAA,MACA,SACC,4EACG;AAAA,SAAE,gBACH;AAAA,UAAC,sBAAAC;AAAA,UAAA;AAAA,YACA,mBACC,wBAAwB;AAAA;AAAA,QAE1B;AAAA,QAEC,mBAAmB,mBACpB;AAAA,UAAC,iCAAAC;AAAA,UAAA;AAAA,YACA,aAAc;AAAA,YACd,UAAW;AAAA;AAAA,QACZ;AAAA,SAEF;AAAA,MAED,QAAS,YAAY,4CAAC,oBAAAC,SAAA,EAAY,IAAK;AAAA,MACvC,UACC,4EACG;AAAA,SAAE,oBAAoB,CAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAQzB,4CAAC,wBAAAC,SAAA,EAAe,cAA8B;AAAA,QAG/C,4CAAC,sBAAAC,SAAA,EAAa;AAAA,QAEd;AAAA,UAAC,wBAAAC;AAAA,UAAA;AAAA,YACA,qBAAsB;AAAA,YACtB,UAAW;AAAA;AAAA,QACZ;AAAA,QAEA;AAAA,UAAC,2BAAAC;AAAA,UAAA;AAAA,YACA,WAAU;AAAA,YACV,qBAAsB;AAAA;AAAA,QACvB;AAAA,QAEE,kBAAkB,kBACnB,4CAAC,uBAAAC,SAAA,EAAc,UAAW,sBAAuB;AAAA,SAG9C,kBAAkB,CAAE,mBACvB,4CAAC,6BAAY,MAAZ,EAAiB,OAAM,QAAO;AAAA,QAG9B,CAAE,oBACH;AAAA,UAAC,qCAAAC;AAAA,UAAA;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QAGD;AAAA,QAEC;AAAA,QACA,CAAE,gBAAgB,4CAAC,iBAAAC,SAAA,EAAS;AAAA,SAC/B;AAAA;AAAA,EAEF;AAEF;AAEA,IAAO,iBAAQ;",
|
|
6
|
+
"names": ["preferencesStore", "editorStore", "blockEditorStore", "HeaderSkeleton", "DocumentTools", "CollapsibleBlockToolbar", "DocumentBar", "PostSavedState", "PostViewLink", "PreviewDropdown", "PostPreviewButton", "ZoomOutToggle", "PostPublishButtonOrToggle", "MoreMenu"]
|
|
7
7
|
}
|