@wordpress/editor 14.7.0 → 14.7.1-next.1f6eadc42.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/README.md +4 -0
- package/build/bindings/post-meta.js +2 -1
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/block-manager/index.js +2 -4
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/editor/index.js +2 -2
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-history/redo.js +2 -4
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +2 -4
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/error-boundary/index.js +2 -4
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-styles-provider/index.js +3 -4
- package/build/components/global-styles-provider/index.js.map +1 -1
- package/build/components/header/index.js +6 -4
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +2 -5
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js +2 -5
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-featured-image/index.js +6 -12
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/index.js +2 -4
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/index.js +2 -4
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +4 -8
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +2 -4
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +2 -4
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +153 -36
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/media-util.js +79 -0
- package/build/components/post-publish-panel/media-util.js.map +1 -0
- package/build/components/post-trash/check.js +2 -1
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-trash/index.js +22 -8
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +28 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +5 -57
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.js +34 -8
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +9 -4
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/sidebar/post-summary.js +3 -0
- package/build/components/sidebar/post-summary.js.map +1 -1
- package/build/components/start-page-options/index.js +16 -19
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/start-template-options/index.js +2 -4
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/table-of-contents/index.js +2 -4
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/text-editor/index.js +2 -4
- package/build/components/text-editor/index.js.map +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build/components/zoom-out-toggle/index.js +38 -0
- package/build/components/zoom-out-toggle/index.js.map +1 -0
- package/build/dataviews/actions/reset-post.js +4 -8
- package/build/dataviews/actions/reset-post.js.map +1 -1
- package/build/dataviews/actions/trash-post.js +4 -8
- package/build/dataviews/actions/trash-post.js.map +1 -1
- package/build/dataviews/store/private-actions.js +4 -10
- package/build/dataviews/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +7 -3
- package/build/store/selectors.js.map +1 -1
- package/build-module/bindings/post-meta.js +2 -1
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/block-manager/index.js +2 -4
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/editor/index.js +2 -2
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-history/redo.js +2 -4
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +2 -4
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/error-boundary/index.js +2 -4
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +3 -4
- package/build-module/components/global-styles-provider/index.js.map +1 -1
- package/build-module/components/header/index.js +6 -4
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +2 -5
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +2 -5
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +6 -12
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/index.js +2 -4
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +2 -4
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +4 -8
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +2 -4
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -4
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +152 -35
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-publish-panel/media-util.js +72 -0
- package/build-module/components/post-publish-panel/media-util.js.map +1 -0
- package/build-module/components/post-trash/check.js +2 -1
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-trash/index.js +23 -11
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +28 -1
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +5 -57
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.js +35 -9
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +9 -4
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/sidebar/post-summary.js +3 -0
- package/build-module/components/sidebar/post-summary.js.map +1 -1
- package/build-module/components/start-page-options/index.js +17 -21
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +2 -4
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/table-of-contents/index.js +2 -4
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/text-editor/index.js +2 -4
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/zoom-out-toggle/index.js +31 -0
- package/build-module/components/zoom-out-toggle/index.js.map +1 -0
- package/build-module/dataviews/actions/reset-post.js +4 -8
- package/build-module/dataviews/actions/reset-post.js.map +1 -1
- package/build-module/dataviews/actions/trash-post.js +4 -8
- package/build-module/dataviews/actions/trash-post.js.map +1 -1
- package/build-module/dataviews/store/private-actions.js +2 -8
- package/build-module/dataviews/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +6 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +3 -7
- package/build-style/style.css +3 -7
- package/build-types/components/editor-history/redo.d.ts.map +1 -1
- package/build-types/components/editor-history/undo.d.ts.map +1 -1
- package/build-types/components/error-boundary/index.d.ts.map +1 -1
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
- package/build-types/components/header/back-button.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -1
- package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
- package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -1
- package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/post-excerpt/plugin.d.ts.map +1 -1
- package/build-types/components/post-format/index.d.ts.map +1 -1
- package/build-types/components/post-last-revision/index.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-upload-media.d.ts +1 -1
- package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/media-util.d.ts +20 -0
- package/build-types/components/post-publish-panel/media-util.d.ts.map +1 -0
- package/build-types/components/post-trash/check.d.ts.map +1 -1
- package/build-types/components/post-trash/index.d.ts +4 -1
- package/build-types/components/post-trash/index.d.ts.map +1 -1
- package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -1
- package/build-types/components/preferences-modal/index.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/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/save-publish-panels/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 +1 -0
- package/build-types/components/start-page-options/index.d.ts.map +1 -1
- package/build-types/components/start-template-options/index.d.ts.map +1 -1
- package/build-types/components/text-editor/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
- package/build-types/components/zoom-out-toggle/index.d.ts +3 -0
- package/build-types/components/zoom-out-toggle/index.d.ts.map +1 -0
- package/build-types/dataviews/actions/reset-post.d.ts.map +1 -1
- package/build-types/dataviews/actions/trash-post.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +8 -8
- package/build-types/store/selectors.d.ts.map +1 -1
- package/package.json +37 -36
- package/src/bindings/post-meta.js +1 -1
- package/src/components/block-manager/index.js +1 -2
- package/src/components/editor/index.js +1 -1
- package/src/components/editor-history/redo.js +1 -2
- package/src/components/editor-history/undo.js +1 -2
- package/src/components/error-boundary/index.js +1 -6
- package/src/components/global-styles-provider/index.js +11 -7
- package/src/components/header/index.js +12 -3
- package/src/components/header/style.scss +1 -1
- package/src/components/inserter-sidebar/index.js +2 -5
- package/src/components/post-excerpt/panel.js +1 -3
- package/src/components/post-featured-image/index.js +3 -6
- package/src/components/post-featured-image/style.scss +1 -5
- package/src/components/post-format/index.js +1 -2
- package/src/components/post-last-revision/index.js +1 -2
- package/src/components/post-locked-modal/index.js +2 -4
- package/src/components/post-publish-panel/index.js +1 -2
- package/src/components/post-publish-panel/maybe-post-format-panel.js +1 -2
- package/src/components/post-publish-panel/maybe-upload-media.js +150 -50
- package/src/components/post-publish-panel/media-util.js +87 -0
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
- package/src/components/post-publish-panel/test/media-util.js +118 -0
- package/src/components/post-trash/check.js +5 -2
- package/src/components/post-trash/index.js +23 -12
- package/src/components/preferences-modal/index.js +227 -172
- package/src/components/preview-dropdown/index.js +26 -84
- package/src/components/provider/index.js +42 -10
- package/src/components/provider/use-block-editor-settings.js +11 -6
- package/src/components/sidebar/post-summary.js +4 -0
- package/src/components/start-page-options/index.js +28 -26
- package/src/components/start-template-options/index.js +1 -2
- package/src/components/table-of-contents/index.js +1 -2
- package/src/components/text-editor/index.js +1 -2
- package/src/components/text-editor/style.scss +1 -1
- package/src/components/visual-editor/edit-template-blocks-notification.js +4 -1
- package/src/components/zoom-out-toggle/index.js +34 -0
- package/src/dataviews/actions/reset-post.tsx +2 -4
- package/src/dataviews/actions/trash-post.tsx +2 -4
- package/src/dataviews/store/private-actions.ts +10 -8
- package/src/store/selectors.js +9 -3
- package/tsconfig.json +2 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/dataviews/actions/duplicate-pattern.js +0 -48
- package/build/dataviews/actions/duplicate-pattern.js.map +0 -1
- package/build/dataviews/actions/duplicate-post.js +0 -146
- package/build/dataviews/actions/duplicate-post.js.map +0 -1
- package/build/dataviews/actions/duplicate-post.native.js +0 -9
- package/build/dataviews/actions/duplicate-post.native.js.map +0 -1
- package/build/dataviews/actions/export-pattern.js +0 -57
- package/build/dataviews/actions/export-pattern.js.map +0 -1
- package/build/dataviews/actions/export-pattern.native.js +0 -9
- package/build/dataviews/actions/export-pattern.native.js.map +0 -1
- package/build/dataviews/actions/permanently-delete-post.js +0 -109
- package/build/dataviews/actions/permanently-delete-post.js.map +0 -1
- package/build/dataviews/actions/reorder-page.js +0 -116
- package/build/dataviews/actions/reorder-page.js.map +0 -1
- package/build/dataviews/actions/reorder-page.native.js +0 -9
- package/build/dataviews/actions/reorder-page.native.js.map +0 -1
- package/build/dataviews/actions/view-post-revisions.js +0 -49
- package/build/dataviews/actions/view-post-revisions.js.map +0 -1
- package/build/dataviews/actions/view-post.js +0 -36
- package/build/dataviews/actions/view-post.js.map +0 -1
- package/build-module/dataviews/actions/duplicate-pattern.js +0 -39
- package/build-module/dataviews/actions/duplicate-pattern.js.map +0 -1
- package/build-module/dataviews/actions/duplicate-post.js +0 -139
- package/build-module/dataviews/actions/duplicate-post.js.map +0 -1
- package/build-module/dataviews/actions/duplicate-post.native.js +0 -3
- package/build-module/dataviews/actions/duplicate-post.native.js.map +0 -1
- package/build-module/dataviews/actions/export-pattern.js +0 -51
- package/build-module/dataviews/actions/export-pattern.js.map +0 -1
- package/build-module/dataviews/actions/export-pattern.native.js +0 -3
- package/build-module/dataviews/actions/export-pattern.native.js.map +0 -1
- package/build-module/dataviews/actions/permanently-delete-post.js +0 -102
- package/build-module/dataviews/actions/permanently-delete-post.js.map +0 -1
- package/build-module/dataviews/actions/reorder-page.js +0 -111
- package/build-module/dataviews/actions/reorder-page.js.map +0 -1
- package/build-module/dataviews/actions/reorder-page.native.js +0 -3
- package/build-module/dataviews/actions/reorder-page.native.js.map +0 -1
- package/build-module/dataviews/actions/view-post-revisions.js +0 -43
- package/build-module/dataviews/actions/view-post-revisions.js.map +0 -1
- package/build-module/dataviews/actions/view-post.js +0 -30
- package/build-module/dataviews/actions/view-post.js.map +0 -1
- package/build-types/dataviews/actions/duplicate-pattern.d.ts +0 -5
- package/build-types/dataviews/actions/duplicate-pattern.d.ts.map +0 -1
- package/build-types/dataviews/actions/duplicate-post.d.ts +0 -5
- package/build-types/dataviews/actions/duplicate-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/duplicate-post.native.d.ts +0 -3
- package/build-types/dataviews/actions/duplicate-post.native.d.ts.map +0 -1
- package/build-types/dataviews/actions/export-pattern.d.ts +0 -8
- package/build-types/dataviews/actions/export-pattern.d.ts.map +0 -1
- package/build-types/dataviews/actions/export-pattern.native.d.ts +0 -3
- package/build-types/dataviews/actions/export-pattern.native.d.ts.map +0 -1
- package/build-types/dataviews/actions/permanently-delete-post.d.ts +0 -5
- package/build-types/dataviews/actions/permanently-delete-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/reorder-page.d.ts +0 -8
- package/build-types/dataviews/actions/reorder-page.d.ts.map +0 -1
- package/build-types/dataviews/actions/reorder-page.native.d.ts +0 -3
- package/build-types/dataviews/actions/reorder-page.native.d.ts.map +0 -1
- package/build-types/dataviews/actions/view-post-revisions.d.ts +0 -8
- package/build-types/dataviews/actions/view-post-revisions.d.ts.map +0 -1
- package/build-types/dataviews/actions/view-post.d.ts +0 -8
- package/build-types/dataviews/actions/view-post.d.ts.map +0 -1
- package/src/dataviews/actions/duplicate-pattern.tsx +0 -40
- package/src/dataviews/actions/duplicate-post.native.tsx +0 -3
- package/src/dataviews/actions/duplicate-post.tsx +0 -174
- package/src/dataviews/actions/export-pattern.native.tsx +0 -3
- package/src/dataviews/actions/export-pattern.tsx +0 -76
- package/src/dataviews/actions/permanently-delete-post.tsx +0 -118
- package/src/dataviews/actions/reorder-page.native.tsx +0 -3
- package/src/dataviews/actions/reorder-page.tsx +0 -125
- package/src/dataviews/actions/view-post-revisions.tsx +0 -47
- package/src/dataviews/actions/view-post.tsx +0 -30
package/README.md
CHANGED
|
@@ -1471,6 +1471,10 @@ Undocumented declaration.
|
|
|
1471
1471
|
|
|
1472
1472
|
Displays the Post Trash Button and Confirm Dialog in the Editor.
|
|
1473
1473
|
|
|
1474
|
+
_Parameters_
|
|
1475
|
+
|
|
1476
|
+
- _An_ `?{onActionPerformed: Object}`: object containing the onActionPerformed function.
|
|
1477
|
+
|
|
1474
1478
|
_Returns_
|
|
1475
1479
|
|
|
1476
1480
|
- `JSX.Element|null`: The rendered PostTrash component.
|
|
@@ -22,8 +22,9 @@ var _default = exports.default = {
|
|
|
22
22
|
const meta = registry.select(_coreData.store).getEditedEntityRecord('postType', context?.postType, context?.postId)?.meta;
|
|
23
23
|
const newValues = {};
|
|
24
24
|
for (const [attributeName, source] of Object.entries(bindings)) {
|
|
25
|
+
var _meta$source$args$key;
|
|
25
26
|
// Use the key if the value is not set.
|
|
26
|
-
newValues[attributeName] = meta?.[source.args.key]
|
|
27
|
+
newValues[attributeName] = (_meta$source$args$key = meta?.[source.args.key]) !== null && _meta$source$args$key !== void 0 ? _meta$source$args$key : source.args.key;
|
|
27
28
|
}
|
|
28
29
|
return newValues;
|
|
29
30
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_coreData","require","_store","_default","exports","default","name","getValues","registry","context","bindings","meta","select","coreDataStore","getEditedEntityRecord","postType","postId","newValues","attributeName","source","Object","entries","args","key","setValues","newMeta","values","forEach","newValue","dispatch","editEntityRecord","canUserEditValue","query","queryId","editorStore","getCurrentPostType","fieldValue","getEntityRecord","undefined","areCustomFieldsEnabled","getEditorSettings","enableCustomFields","canUserEdit","canUser","kind","id","getFieldsList","metaFields","keys","length","fromEntries","filter","charAt"],"sources":["@wordpress/editor/src/bindings/post-meta.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\nexport default {\n\tname: 'core/post-meta',\n\tgetValues( { registry, context, bindings } ) {\n\t\tconst meta = registry\n\t\t\t.select( coreDataStore )\n\t\t\t.getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcontext?.postType,\n\t\t\t\tcontext?.postId\n\t\t\t)?.meta;\n\t\tconst newValues = {};\n\t\tfor ( const [ attributeName, source ] of Object.entries( bindings ) ) {\n\t\t\t// Use the key if the value is not set.\n\t\t\tnewValues[ attributeName ] =\n\t\t\t\tmeta?.[ source.args.key ]
|
|
1
|
+
{"version":3,"names":["_coreData","require","_store","_default","exports","default","name","getValues","registry","context","bindings","meta","select","coreDataStore","getEditedEntityRecord","postType","postId","newValues","attributeName","source","Object","entries","_meta$source$args$key","args","key","setValues","newMeta","values","forEach","newValue","dispatch","editEntityRecord","canUserEditValue","query","queryId","editorStore","getCurrentPostType","fieldValue","getEntityRecord","undefined","areCustomFieldsEnabled","getEditorSettings","enableCustomFields","canUserEdit","canUser","kind","id","getFieldsList","metaFields","keys","length","fromEntries","filter","charAt"],"sources":["@wordpress/editor/src/bindings/post-meta.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\nexport default {\n\tname: 'core/post-meta',\n\tgetValues( { registry, context, bindings } ) {\n\t\tconst meta = registry\n\t\t\t.select( coreDataStore )\n\t\t\t.getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcontext?.postType,\n\t\t\t\tcontext?.postId\n\t\t\t)?.meta;\n\t\tconst newValues = {};\n\t\tfor ( const [ attributeName, source ] of Object.entries( bindings ) ) {\n\t\t\t// Use the key if the value is not set.\n\t\t\tnewValues[ attributeName ] =\n\t\t\t\tmeta?.[ source.args.key ] ?? source.args.key;\n\t\t}\n\t\treturn newValues;\n\t},\n\tsetValues( { registry, context, bindings } ) {\n\t\tconst newMeta = {};\n\t\tObject.values( bindings ).forEach( ( { args, newValue } ) => {\n\t\t\tnewMeta[ args.key ] = newValue;\n\t\t} );\n\t\tregistry\n\t\t\t.dispatch( coreDataStore )\n\t\t\t.editEntityRecord( 'postType', context?.postType, context?.postId, {\n\t\t\t\tmeta: newMeta,\n\t\t\t} );\n\t},\n\tcanUserEditValue( { select, context, args } ) {\n\t\t// Lock editing in query loop.\n\t\tif ( context?.query || context?.queryId ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst postType =\n\t\t\tcontext?.postType || select( editorStore ).getCurrentPostType();\n\n\t\t// Check that editing is happening in the post editor and not a template.\n\t\tif ( postType === 'wp_template' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check that the custom field is not protected and available in the REST API.\n\t\t// Empty string or `false` could be a valid value, so we need to check if the field value is undefined.\n\t\tconst fieldValue = select( coreDataStore ).getEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType,\n\t\t\tcontext?.postId\n\t\t)?.meta?.[ args.key ];\n\n\t\tif ( fieldValue === undefined ) {\n\t\t\treturn false;\n\t\t}\n\t\t// Check that custom fields metabox is not enabled.\n\t\tconst areCustomFieldsEnabled =\n\t\t\tselect( editorStore ).getEditorSettings().enableCustomFields;\n\t\tif ( areCustomFieldsEnabled ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check that the user has the capability to edit post meta.\n\t\tconst canUserEdit = select( coreDataStore ).canUser( 'update', {\n\t\t\tkind: 'postType',\n\t\t\tname: context?.postType,\n\t\t\tid: context?.postId,\n\t\t} );\n\t\tif ( ! canUserEdit ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t},\n\tgetFieldsList( { registry, context } ) {\n\t\tconst metaFields = registry\n\t\t\t.select( coreDataStore )\n\t\t\t.getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcontext?.postType,\n\t\t\t\tcontext?.postId\n\t\t\t).meta;\n\n\t\tif ( ! metaFields || ! Object.keys( metaFields ).length ) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Remove footnotes or private keys from the list of fields.\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries( metaFields ).filter(\n\t\t\t\t( [ key ] ) => key !== 'footnotes' && key.charAt( 0 ) !== '_'\n\t\t\t)\n\t\t);\n\t},\n};\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;AAGA;AACA;AACA;AAFA,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAKe;EACdC,IAAI,EAAE,gBAAgB;EACtBC,SAASA,CAAE;IAAEC,QAAQ;IAAEC,OAAO;IAAEC;EAAS,CAAC,EAAG;IAC5C,MAAMC,IAAI,GAAGH,QAAQ,CACnBI,MAAM,CAAEC,eAAc,CAAC,CACvBC,qBAAqB,CACrB,UAAU,EACVL,OAAO,EAAEM,QAAQ,EACjBN,OAAO,EAAEO,MACV,CAAC,EAAEL,IAAI;IACR,MAAMM,SAAS,GAAG,CAAC,CAAC;IACpB,KAAM,MAAM,CAAEC,aAAa,EAAEC,MAAM,CAAE,IAAIC,MAAM,CAACC,OAAO,CAAEX,QAAS,CAAC,EAAG;MAAA,IAAAY,qBAAA;MACrE;MACAL,SAAS,CAAEC,aAAa,CAAE,IAAAI,qBAAA,GACzBX,IAAI,GAAIQ,MAAM,CAACI,IAAI,CAACC,GAAG,CAAE,cAAAF,qBAAA,cAAAA,qBAAA,GAAIH,MAAM,CAACI,IAAI,CAACC,GAAG;IAC9C;IACA,OAAOP,SAAS;EACjB,CAAC;EACDQ,SAASA,CAAE;IAAEjB,QAAQ;IAAEC,OAAO;IAAEC;EAAS,CAAC,EAAG;IAC5C,MAAMgB,OAAO,GAAG,CAAC,CAAC;IAClBN,MAAM,CAACO,MAAM,CAAEjB,QAAS,CAAC,CAACkB,OAAO,CAAE,CAAE;MAAEL,IAAI;MAAEM;IAAS,CAAC,KAAM;MAC5DH,OAAO,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WAAW,EAAG;MACpB,OAAO,KAAK;IACb;IAEA,OAAO,IAAI;EACZ,CAAC;EACDI,aAAaA,CAAE;IAAEvC,QAAQ;IAAEC;EAAQ,CAAC,EAAG;IACtC,MAAMuC,UAAU,GAAGxC,QAAQ,CACzBI,MAAM,CAAEC,eAAc,CAAC,CACvBC,qBAAqB,CACrB,UAAU,EACVL,OAAO,EAAEM,QAAQ,EACjBN,OAAO,EAAEO,MACV,CAAC,CAACL,IAAI;IAEP,IAAK,CAAEqC,UAAU,IAAI,CAAE5B,MAAM,CAAC6B,IAAI,CAAED,UAAW,CAAC,CAACE,MAAM,EAAG;MACzD,OAAO,IAAI;IACZ;;IAEA;IACA,OAAO9B,MAAM,CAAC+B,WAAW,CACxB/B,MAAM,CAACC,OAAO,CAAE2B,UAAW,CAAC,CAACI,MAAM,CAClC,CAAE,CAAE5B,GAAG,CAAE,KAAMA,GAAG,KAAK,WAAW,IAAIA,GAAG,CAAC6B,MAAM,CAAE,CAAE,CAAC,KAAK,GAC3D,CACD,CAAC;EACF;AACD,CAAC","ignoreList":[]}
|
|
@@ -56,10 +56,8 @@ function BlockManager({
|
|
|
56
56
|
children: [!!numberOfHiddenBlocks && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
57
57
|
className: "editor-block-manager__disabled-blocks-count",
|
|
58
58
|
children: [(0, _i18n.sprintf)( /* translators: %d: number of blocks. */
|
|
59
|
-
(0, _i18n._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button
|
|
60
|
-
|
|
61
|
-
, {
|
|
62
|
-
__next40pxDefaultSize: false,
|
|
59
|
+
(0, _i18n._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
60
|
+
__next40pxDefaultSize: true,
|
|
63
61
|
variant: "link",
|
|
64
62
|
onClick: () => enableAllBlockTypes(blockTypes),
|
|
65
63
|
children: (0, _i18n.__)('Reset')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_data","_components","_i18n","_element","_compose","_a11y","_preferences","_lockUnlock","_store","_category","_interopRequireDefault","_jsxRuntime","BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","enableAllBlockTypes","debouncedSpeak","useDebounce","speak","search","setSearch","useState","filter","blockType","parent","includes","useEffect","count","length","resultsFoundMessage","sprintf","_n","jsxs","className","children","jsx","Button","__next40pxDefaultSize","variant","onClick","__","SearchControl","__nextHasNoMarginBottom","label","placeholder","value","onChange","nextSearch","tabIndex","role","map","category","default","title","slug","_default","exports","compose","withSelect","select","_get","getBlockTypes","getCategories","blocksStore","get","preferencesStore","hiddenBlockTypes","hiddenBlock","some","registeredBlock","name","Array","isArray","withDispatch","dispatch","showBlockTypes","unlock","editorStore","blockNames"],"sources":["@wordpress/editor/src/components/block-manager/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { SearchControl, Button } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce, compose } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport BlockManagerCategory from './category';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\n\tenableAllBlockTypes,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\n\t// Filtering occurs here (as opposed to `withSelect`) to avoid\n\t// wasted renders by consequence of `Array#filter` producing\n\t// a new value reference on each call.\n\tblockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = blockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ blockTypes.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"editor-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"editor-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t\t<Button\n\t\t\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => enableAllBlockTypes( blockTypes ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"editor-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"editor-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"editor-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t\t( blockType ) =>\n\t\t\t\t\t\t\t\tblockType.category === category.slug\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockTypes,\n\t\t\tgetCategories,\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t} = select( blocksStore );\n\t\tconst { get } = select( preferencesStore );\n\n\t\t// Some hidden blocks become unregistered\n\t\t// by removing for instance the plugin that registered them, yet\n\t\t// they're still remain as hidden by the user's action.\n\t\t// We consider \"hidden\", blocks which were hidden and\n\t\t// are still registered.\n\t\tconst blockTypes = getBlockTypes();\n\t\tconst hiddenBlockTypes = (\n\t\t\tget( 'core', 'hiddenBlockTypes' ) ?? []\n\t\t).filter( ( hiddenBlock ) => {\n\t\t\treturn blockTypes.some(\n\t\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t\t);\n\t\t} );\n\t\tconst numberOfHiddenBlocks =\n\t\t\tArray.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\t\treturn {\n\t\t\tblockTypes,\n\t\t\tcategories: getCategories(),\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t\tnumberOfHiddenBlocks,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { showBlockTypes } = unlock( dispatch( editorStore ) );\n\t\treturn {\n\t\t\tenableAllBlockTypes: ( blockTypes ) => {\n\t\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t},\n\t\t};\n\t} ),\n] )( BlockManager );\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAC,sBAAA,CAAAX,OAAA;AAA8C,IAAAY,WAAA,GAAAZ,OAAA;AAjB9C;AACA;AACA;;AAUA;AACA;AACA;;AAKA,SAASa,YAAYA,CAAE;EACtBC,UAAU;EACVC,UAAU;EACVC,eAAe;EACfC,oBAAoB;EACpBC,oBAAoB;EACpBC;AACD,CAAC,EAAG;EACH,MAAMC,cAAc,GAAG,IAAAC,oBAAW,EAAEC,WAAK,EAAE,GAAI,CAAC;EAChD,MAAM,CAAEC,MAAM,EAAEC,SAAS,CAAE,GAAG,IAAAC,iBAAQ,EAAE,EAA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AErE,YAAa,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blocks","require","_data","_components","_i18n","_element","_compose","_a11y","_preferences","_lockUnlock","_store","_category","_interopRequireDefault","_jsxRuntime","BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","enableAllBlockTypes","debouncedSpeak","useDebounce","speak","search","setSearch","useState","filter","blockType","parent","includes","useEffect","count","length","resultsFoundMessage","sprintf","_n","jsxs","className","children","jsx","Button","__next40pxDefaultSize","variant","onClick","__","SearchControl","__nextHasNoMarginBottom","label","placeholder","value","onChange","nextSearch","tabIndex","role","map","category","default","title","slug","_default","exports","compose","withSelect","select","_get","getBlockTypes","getCategories","blocksStore","get","preferencesStore","hiddenBlockTypes","hiddenBlock","some","registeredBlock","name","Array","isArray","withDispatch","dispatch","showBlockTypes","unlock","editorStore","blockNames"],"sources":["@wordpress/editor/src/components/block-manager/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { SearchControl, Button } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce, compose } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport BlockManagerCategory from './category';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\n\tenableAllBlockTypes,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\n\t// Filtering occurs here (as opposed to `withSelect`) to avoid\n\t// wasted renders by consequence of `Array#filter` producing\n\t// a new value reference on each call.\n\tblockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = blockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ blockTypes.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"editor-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"editor-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => enableAllBlockTypes( blockTypes ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"editor-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"editor-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"editor-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t\t( blockType ) =>\n\t\t\t\t\t\t\t\tblockType.category === category.slug\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockTypes,\n\t\t\tgetCategories,\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t} = select( blocksStore );\n\t\tconst { get } = select( preferencesStore );\n\n\t\t// Some hidden blocks become unregistered\n\t\t// by removing for instance the plugin that registered them, yet\n\t\t// they're still remain as hidden by the user's action.\n\t\t// We consider \"hidden\", blocks which were hidden and\n\t\t// are still registered.\n\t\tconst blockTypes = getBlockTypes();\n\t\tconst hiddenBlockTypes = (\n\t\t\tget( 'core', 'hiddenBlockTypes' ) ?? []\n\t\t).filter( ( hiddenBlock ) => {\n\t\t\treturn blockTypes.some(\n\t\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t\t);\n\t\t} );\n\t\tconst numberOfHiddenBlocks =\n\t\t\tArray.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\t\treturn {\n\t\t\tblockTypes,\n\t\t\tcategories: getCategories(),\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t\tnumberOfHiddenBlocks,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { showBlockTypes } = unlock( dispatch( editorStore ) );\n\t\treturn {\n\t\t\tenableAllBlockTypes: ( blockTypes ) => {\n\t\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t},\n\t\t};\n\t} ),\n] )( BlockManager );\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAC,sBAAA,CAAAX,OAAA;AAA8C,IAAAY,WAAA,GAAAZ,OAAA;AAjB9C;AACA;AACA;;AAUA;AACA;AACA;;AAKA,SAASa,YAAYA,CAAE;EACtBC,UAAU;EACVC,UAAU;EACVC,eAAe;EACfC,oBAAoB;EACpBC,oBAAoB;EACpBC;AACD,CAAC,EAAG;EACH,MAAMC,cAAc,GAAG,IAAAC,oBAAW,EAAEC,WAAK,EAAE,GAAI,CAAC;EAChD,MAAM,CAAEC,MAAM,EAAEC,SAAS,CAAE,GAAG,IAAAC,iBAAQ,EAAE,EAAG,CAAC;;EAE5C;EACA;EACA;EACAX,UAAU,GAAGA,UAAU,CAACY,MAAM,CAC3BC,SAAS,IACVX,eAAe,CAAEW,SAAS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, {
|
|
67
67
|
...props,
|
|
68
68
|
children: extraContent
|
|
69
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebar.default, {
|
|
69
|
+
}), children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebar.default, {
|
|
70
70
|
onActionPerformed: onActionPerformed,
|
|
71
71
|
extraPanels: extraSidebarPanels
|
|
72
|
-
})
|
|
72
|
+
})]
|
|
73
73
|
})]
|
|
74
74
|
});
|
|
75
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_components","_i18n","_constants","_editorInterface","_interopRequireDefault","_provider","_sidebar","_jsxRuntime","Editor","postType","postId","templateId","settings","children","initialEdits","onActionPerformed","extraContent","extraSidebarPanels","props","post","template","hasLoadedPost","useSelect","select","getEntityRecord","hasFinishedResolution","coreStore","TEMPLATE_POST_TYPE","undefined","jsxs","Fragment","jsx","Notice","status","isDismissible","__","ExperimentalEditorProvider","__unstableTemplate","useSubRegistry","default","extraPanels","_default","exports"],"sources":["@wordpress/editor/src/components/editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport EditorInterface from '../editor-interface';\nimport { ExperimentalEditorProvider } from '../provider';\nimport Sidebar from '../sidebar';\n\nfunction Editor( {\n\tpostType,\n\tpostId,\n\ttemplateId,\n\tsettings,\n\tchildren,\n\tinitialEdits,\n\n\t// This could be part of the settings.\n\tonActionPerformed,\n\n\t// The following abstractions are not ideal but necessary\n\t// to account for site editor and post editor differences for now.\n\textraContent,\n\textraSidebarPanels,\n\t...props\n} ) {\n\tconst { post, template, hasLoadedPost } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\treturn {\n\t\t\t\tpost: getEntityRecord( 'postType', postType, postId ),\n\t\t\t\ttemplate: templateId\n\t\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t\ttemplateId\n\t\t\t\t\t )\n\t\t\t\t\t: undefined,\n\t\t\t\thasLoadedPost: hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, templateId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ hasLoadedPost && ! post && (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t) }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ !! post && (\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tpost={ post }\n\t\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<EditorInterface { ...props }>\n\t\t\t\t\t\t{ extraContent }\n\t\t\t\t\t</EditorInterface>\n\t\t\t\t\t<Sidebar\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\textraPanels={ extraSidebarPanels }\n\t\t\t\t\t/>\n\t\t\t\t
|
|
1
|
+
{"version":3,"names":["_data","require","_coreData","_components","_i18n","_constants","_editorInterface","_interopRequireDefault","_provider","_sidebar","_jsxRuntime","Editor","postType","postId","templateId","settings","children","initialEdits","onActionPerformed","extraContent","extraSidebarPanels","props","post","template","hasLoadedPost","useSelect","select","getEntityRecord","hasFinishedResolution","coreStore","TEMPLATE_POST_TYPE","undefined","jsxs","Fragment","jsx","Notice","status","isDismissible","__","ExperimentalEditorProvider","__unstableTemplate","useSubRegistry","default","extraPanels","_default","exports"],"sources":["@wordpress/editor/src/components/editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport EditorInterface from '../editor-interface';\nimport { ExperimentalEditorProvider } from '../provider';\nimport Sidebar from '../sidebar';\n\nfunction Editor( {\n\tpostType,\n\tpostId,\n\ttemplateId,\n\tsettings,\n\tchildren,\n\tinitialEdits,\n\n\t// This could be part of the settings.\n\tonActionPerformed,\n\n\t// The following abstractions are not ideal but necessary\n\t// to account for site editor and post editor differences for now.\n\textraContent,\n\textraSidebarPanels,\n\t...props\n} ) {\n\tconst { post, template, hasLoadedPost } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\treturn {\n\t\t\t\tpost: getEntityRecord( 'postType', postType, postId ),\n\t\t\t\ttemplate: templateId\n\t\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t\ttemplateId\n\t\t\t\t\t )\n\t\t\t\t\t: undefined,\n\t\t\t\thasLoadedPost: hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, templateId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ hasLoadedPost && ! post && (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t) }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ !! post && (\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tpost={ post }\n\t\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<EditorInterface { ...props }>\n\t\t\t\t\t\t{ extraContent }\n\t\t\t\t\t</EditorInterface>\n\t\t\t\t\t{ children }\n\t\t\t\t\t<Sidebar\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\textraPanels={ extraSidebarPanels }\n\t\t\t\t\t/>\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Editor;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAF,sBAAA,CAAAN,OAAA;AAAiC,IAAAS,WAAA,GAAAT,OAAA;AAdjC;AACA;AACA;;AAMA;AACA;AACA;;AAMA,SAASU,MAAMA,CAAE;EAChBC,QAAQ;EACRC,MAAM;EACNC,UAAU;EACVC,QAAQ;EACRC,QAAQ;EACRC,YAAY;EAEZ;EACAC,iBAAiB;EAEjB;EACA;EACAC,YAAY;EACZC,kBAAkB;EAClB,GAAGC;AACJ,CAAC,EAAG;EACH,MAAM;IAAEC,IAAI;IAAEC,QAAQ;IAAEC;EAAc,CAAC,GAAG,IAAAC,eAAS,EAChDC,MAAM,IAAM;IACb,MAAM;MAAEC,eAAe;MAAEC;IA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,CAAC;AAEL;AAAC,IAAAwB,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEc/B,MAAM","ignoreList":[]}
|
|
@@ -26,10 +26,8 @@ function EditorHistoryRedo(props, ref) {
|
|
|
26
26
|
const {
|
|
27
27
|
redo
|
|
28
28
|
} = (0, _data.useDispatch)(_store.store);
|
|
29
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button
|
|
30
|
-
|
|
31
|
-
, {
|
|
32
|
-
__next40pxDefaultSize: false,
|
|
29
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
30
|
+
__next40pxDefaultSize: true,
|
|
33
31
|
...props,
|
|
34
32
|
ref: ref,
|
|
35
33
|
icon: !(0, _i18n.isRTL)() ? _icons.redo : _icons.undo
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_keycodes","_icons","_element","_store","_jsxRuntime","EditorHistoryRedo","props","ref","shortcut","isAppleOS","displayShortcut","primaryShift","primary","hasRedo","useSelect","select","editorStore","hasEditorRedo","redo","useDispatch","jsx","Button","__next40pxDefaultSize","icon","isRTL","redoIcon","undoIcon","label","__","onClick","undefined","className","_default","exports","default","forwardRef"],"sources":["@wordpress/editor/src/components/editor-history/redo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { redo as redoIcon, undo as undoIcon } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction EditorHistoryRedo( props, ref ) {\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tconst hasRedo = useSelect(\n\t\t( select ) => select( editorStore ).hasEditorRedo(),\n\t\t[]\n\t);\n\tconst { redo } = useDispatch( editorStore );\n\treturn (\n\t\t<Button\n\t\t\
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_keycodes","_icons","_element","_store","_jsxRuntime","EditorHistoryRedo","props","ref","shortcut","isAppleOS","displayShortcut","primaryShift","primary","hasRedo","useSelect","select","editorStore","hasEditorRedo","redo","useDispatch","jsx","Button","__next40pxDefaultSize","icon","isRTL","redoIcon","undoIcon","label","__","onClick","undefined","className","_default","exports","default","forwardRef"],"sources":["@wordpress/editor/src/components/editor-history/redo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { redo as redoIcon, undo as undoIcon } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction EditorHistoryRedo( props, ref ) {\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tconst hasRedo = useSelect(\n\t\t( select ) => select( editorStore ).hasEditorRedo(),\n\t\t[]\n\t);\n\tconst { redo } = useDispatch( editorStore );\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\tlabel={ __( 'Redo' ) }\n\t\t\tshortcut={ shortcut }\n\t\t\t// If there are no redo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasRedo }\n\t\t\tonClick={ hasRedo ? redo : undefined }\n\t\t\tclassName=\"editor-history__redo\"\n\t\t/>\n\t);\n}\n\n/** @typedef {import('react').Ref<HTMLElement>} Ref */\n\n/**\n * Renders the redo button for the editor history.\n *\n * @param {Object} props - Props.\n * @param {Ref} ref - Forwarded ref.\n *\n * @return {Component} The component to be rendered.\n */\nexport default forwardRef( EditorHistoryRedo );\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAAmD,IAAAO,WAAA,GAAAP,OAAA;AAbnD;AACA;AACA;;AAQA;AACA;AACA;;AAGA,SAASQ,iBAAiBA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACxC,MAAMC,QAAQ,GAAG,IAAAC,mBAAS,EAAC,CAAC,GACzBC,yBAAe,CAACC,YAAY,CAAE,GAAI,CAAC,GACnCD,yBAAe,CAACE,OAAO,CAAE,GAAI,CAAC;EAEjC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,YAAY,CAAC,CAACC,aAAa,CAAC,CAAC,EACnD,EACD,CAAC;EACD,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAY,CAAC;EAC3C,oBACC,IAAAZ,WAAA,CAAAgB,GAAA,EAACtB,WAAA,CAAAuB,MAAM;IACNC,qBAAqB;IAAA,GAChBhB,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXgB,IAAI,EAAG,CAAE,IAAAC,WAAK,EAAC,CAAC,GAAGC,WAAQ,GAAGC;IAC9B;IACAC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBpB,QAAQ,EAAGA;IACX;IACA;IACA;IAAA;IACA,iBAAgB,CAAEK,OAAS;IAC3BgB,OAAO,EAAGhB,OAAO,GAAGK,IAAI,GAAGY,SAAW;IACtCC,SAAS,EAAC;EAAsB,CAChC,CAAC;AAEJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAQe,IAAAC,mBAAU,EAAE9B,iBAAkB,CAAC","ignoreList":[]}
|
|
@@ -25,10 +25,8 @@ function EditorHistoryUndo(props, ref) {
|
|
|
25
25
|
const {
|
|
26
26
|
undo
|
|
27
27
|
} = (0, _data.useDispatch)(_store.store);
|
|
28
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button
|
|
29
|
-
|
|
30
|
-
, {
|
|
31
|
-
__next40pxDefaultSize: false,
|
|
28
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
29
|
+
__next40pxDefaultSize: true,
|
|
32
30
|
...props,
|
|
33
31
|
ref: ref,
|
|
34
32
|
icon: !(0, _i18n.isRTL)() ? _icons.undo : _icons.redo
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_keycodes","_icons","_element","_store","_jsxRuntime","EditorHistoryUndo","props","ref","hasUndo","useSelect","select","editorStore","hasEditorUndo","undo","useDispatch","jsx","Button","__next40pxDefaultSize","icon","isRTL","undoIcon","redoIcon","label","__","shortcut","displayShortcut","primary","onClick","undefined","className","_default","exports","default","forwardRef"],"sources":["@wordpress/editor/src/components/editor-history/undo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction EditorHistoryUndo( props, ref ) {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( editorStore ).hasEditorUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( editorStore );\n\treturn (\n\t\t<Button\n\t\t\
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_keycodes","_icons","_element","_store","_jsxRuntime","EditorHistoryUndo","props","ref","hasUndo","useSelect","select","editorStore","hasEditorUndo","undo","useDispatch","jsx","Button","__next40pxDefaultSize","icon","isRTL","undoIcon","redoIcon","label","__","shortcut","displayShortcut","primary","onClick","undefined","className","_default","exports","default","forwardRef"],"sources":["@wordpress/editor/src/components/editor-history/undo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction EditorHistoryUndo( props, ref ) {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( editorStore ).hasEditorUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( editorStore );\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\tlabel={ __( 'Undo' ) }\n\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasUndo }\n\t\t\tonClick={ hasUndo ? undo : undefined }\n\t\t\tclassName=\"editor-history__undo\"\n\t\t/>\n\t);\n}\n\n/** @typedef {import('react').Ref<HTMLElement>} Ref */\n\n/**\n * Renders the undo button for the editor history.\n *\n * @param {Object} props - Props.\n * @param {Ref} ref - Forwarded ref.\n *\n * @return {Component} The component to be rendered.\n */\nexport default forwardRef( EditorHistoryUndo );\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAAmD,IAAAO,WAAA,GAAAP,OAAA;AAbnD;AACA;AACA;;AAQA;AACA;AACA;;AAGA,SAASQ,iBAAiBA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACxC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,YAAY,CAAC,CAACC,aAAa,CAAC,CAAC,EACnD,EACD,CAAC;EACD,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAY,CAAC;EAC3C,oBACC,IAAAP,WAAA,CAAAW,GAAA,EAACjB,WAAA,CAAAkB,MAAM;IACNC,qBAAqB;IAAA,GAChBX,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXW,IAAI,EAAG,CAAE,IAAAC,WAAK,EAAC,CAAC,GAAGC,WAAQ,GAAGC;IAC9B;IACAC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBC,QAAQ,EAAGC,yBAAe,CAACC,OAAO,CAAE,GAAI;IACxC;IACA;IACA;IAAA;IACA,iBAAgB,CAAElB,OAAS;IAC3BmB,OAAO,EAAGnB,OAAO,GAAGK,IAAI,GAAGe,SAAW;IACtCC,SAAS,EAAC;EAAsB,CAChC,CAAC;AAEJ;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAQe,IAAAC,mBAAU,EAAE5B,iBAAkB,CAAC","ignoreList":[]}
|
|
@@ -37,10 +37,8 @@ function CopyButton({
|
|
|
37
37
|
children
|
|
38
38
|
}) {
|
|
39
39
|
const ref = (0, _compose.useCopyToClipboard)(text);
|
|
40
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button
|
|
41
|
-
|
|
42
|
-
, {
|
|
43
|
-
__next40pxDefaultSize: false,
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
41
|
+
__next40pxDefaultSize: true,
|
|
44
42
|
variant: "secondary",
|
|
45
43
|
ref: ref,
|
|
46
44
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_i18n","_components","_data","_blockEditor","_compose","_hooks","_store","_jsxRuntime","getContent","select","editorStore","getEditedPostContent","error","CopyButton","text","children","ref","useCopyToClipboard","jsx","Button","__next40pxDefaultSize","variant","ErrorBoundary","Component","constructor","arguments","state","componentDidCatch","doAction","getDerivedStateFromError","render","props","actions","__","stack","Warning","className","_default","exports","default"],"sources":["@wordpress/editor/src/components/error-boundary/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { select } from '@wordpress/data';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction getContent() {\n\ttry {\n\t\t// While `select` in a component is generally discouraged, it is\n\t\t// used here because it (a) reduces the chance of data loss in the\n\t\t// case of additional errors by performing a direct retrieval and\n\t\t// (b) avoids the performance cost associated with unnecessary\n\t\t// content serialization throughout the lifetime of a non-erroring\n\t\t// application.\n\t\treturn select( editorStore ).getEditedPostContent();\n\t} catch ( error ) {}\n}\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button
|
|
1
|
+
{"version":3,"names":["_element","require","_i18n","_components","_data","_blockEditor","_compose","_hooks","_store","_jsxRuntime","getContent","select","editorStore","getEditedPostContent","error","CopyButton","text","children","ref","useCopyToClipboard","jsx","Button","__next40pxDefaultSize","variant","ErrorBoundary","Component","constructor","arguments","state","componentDidCatch","doAction","getDerivedStateFromError","render","props","actions","__","stack","Warning","className","_default","exports","default"],"sources":["@wordpress/editor/src/components/error-boundary/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { select } from '@wordpress/data';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction getContent() {\n\ttry {\n\t\t// While `select` in a component is generally discouraged, it is\n\t\t// used here because it (a) reduces the chance of data loss in the\n\t\t// case of additional errors by performing a direct retrieval and\n\t\t// (b) avoids the performance cost associated with unnecessary\n\t\t// content serialization throughout the lifetime of a non-erroring\n\t\t// application.\n\t\treturn select( editorStore ).getEditedPostContent();\n\t} catch ( error ) {}\n}\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button __next40pxDefaultSize variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nclass ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\tconst actions = [\n\t\t\t<CopyButton key=\"copy-post\" text={ getContent }>\n\t\t\t\t{ __( 'Copy Post Text' ) }\n\t\t\t</CopyButton>,\n\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t</CopyButton>,\n\t\t];\n\n\t\treturn (\n\t\t\t<Warning className=\"editor-error-boundary\" actions={ actions }>\n\t\t\t\t{ __( 'The editor has encountered an unexpected error.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n}\n\n/**\n * ErrorBoundary is used to catch JavaScript errors anywhere in a child component tree, log those errors, and display a fallback UI.\n *\n * It uses the lifecycle methods getDerivedStateFromError and componentDidCatch to catch errors in a child component tree.\n *\n * getDerivedStateFromError is used to render a fallback UI after an error has been thrown, and componentDidCatch is used to log error information.\n *\n * @class ErrorBoundary\n * @augments Component\n */\nexport default ErrorBoundary;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AAAmD,IAAAQ,WAAA,GAAAR,OAAA;AAdnD;AACA;AACA;;AASA;AACA;AACA;;AAGA,SAASS,UAAUA,CAAA,EAAG;EACrB,IAAI;IACH;IACA;IACA;IACA;IACA;IACA;IACA,OAAO,IAAAC,YAAM,EAAEC,YAAY,CAAC,CAACC,oBAAoB,CAAC,CAAC;EACpD,CAAC,CAAC,OAAQC,KAAK,EAAG,CAAC;AACpB;AAEA,SAASC,UAAUA,CAAE;EAAEC,IAAI;EAAEC;AAAS,CAAC,EAAG;EACzC,MAAMC,GAAG,GAAG,IAAAC,2BAAkB,EAAEH,IAAK,CAAC;EACtC,oBACC,IAAAP,WAAA,CAAAW,GAAA,EAAC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A,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAUejB,aAAa","ignoreList":[]}
|
|
@@ -124,12 +124,11 @@ function useGlobalStylesBaseConfig() {
|
|
|
124
124
|
const baseConfig = (0, _data.useSelect)(select => {
|
|
125
125
|
const {
|
|
126
126
|
__experimentalGetCurrentThemeBaseGlobalStyles,
|
|
127
|
+
getCurrentTheme,
|
|
127
128
|
canUser
|
|
128
129
|
} = select(_coreData.store);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
name: 'theme'
|
|
132
|
-
}) && __experimentalGetCurrentThemeBaseGlobalStyles();
|
|
130
|
+
const currentTheme = getCurrentTheme();
|
|
131
|
+
return currentTheme && canUser('read', 'global-styles/themes', currentTheme.stylesheet) ? __experimentalGetCurrentThemeBaseGlobalStyles() : undefined;
|
|
133
132
|
}, []);
|
|
134
133
|
return [!!baseConfig, baseConfig];
|
|
135
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_deepmerge","_interopRequireDefault","require","_isPlainObject","_blockEditor","_coreData","_data","_element","_lockUnlock","_jsxRuntime","GlobalStylesContext","cleanEmptyObject","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","base","user","deepmerge","isMergeableObject","isPlainObject","customMerge","key","baseConfig","userConfig","undefined","useGlobalStylesUserConfig","globalStylesId","isReady","settings","styles","_links","useSelect","select","getEditedEntityRecord","hasFinishedResolution","canUser","coreStore","_globalStylesId","__experimentalGetCurrentGlobalStylesId","record","kind","name","id","hasResolved","editEntityRecord","useDispatch","config","useMemo","setConfig","useCallback","callbackOrObject","options","_record$styles","_record$settings","_record$_links","currentConfig","updatedConfig","useGlobalStylesBaseConfig","__experimentalGetCurrentThemeBaseGlobalStyles","useGlobalStylesContext","isUserConfigReady","setUserConfig","isBaseConfigReady","mergedConfig","context","merged","GlobalStylesProvider","children","jsx","Provider","value"],"sources":["@wordpress/editor/src/components/global-styles-provider/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, cleanEmptyObject } = unlock(\n\tblockEditorPrivateApis\n);\n\nexport function mergeBaseAndUserConfigs( base, user ) {\n\treturn deepmerge( base, user, {\n\t\t/*\n\t\t * We only pass as arrays the presets,\n\t\t * in which case we want the new array of values\n\t\t * to override the old array (no merging).\n\t\t */\n\t\tisMergeableObject: isPlainObject,\n\t\t/*\n\t\t * Exceptions to the above rule.\n\t\t * Background images should be replaced, not merged,\n\t\t * as they themselves are specific object definitions for the style.\n\t\t */\n\t\tcustomMerge: ( key ) => {\n\t\t\tif ( key === 'backgroundImage' ) {\n\t\t\t\treturn ( baseConfig, userConfig ) => userConfig;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t} );\n}\n\nfunction useGlobalStylesUserConfig() {\n\tconst { globalStylesId, isReady, settings, styles, _links } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _globalStylesId =\n\t\t\t\tselect( coreStore ).__experimentalGetCurrentGlobalStylesId();\n\n\t\t\tconst record =\n\t\t\t\t_globalStylesId &&\n\t\t\t\tcanUser( 'read', {\n\t\t\t\t\tkind: 'root',\n\t\t\t\t\tname: 'globalStyles',\n\t\t\t\t\tid: _globalStylesId,\n\t\t\t\t} )\n\t\t\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t_globalStylesId\n\t\t\t\t\t )\n\t\t\t\t\t: undefined;\n\n\t\t\tlet hasResolved = false;\n\t\t\tif (\n\t\t\t\thasFinishedResolution(\n\t\t\t\t\t'__experimentalGetCurrentGlobalStylesId'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\thasResolved = _globalStylesId\n\t\t\t\t\t? hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t ] )\n\t\t\t\t\t: true;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tglobalStylesId: _globalStylesId,\n\t\t\t\tisReady: hasResolved,\n\t\t\t\tsettings: record?.settings,\n\t\t\t\tstyles: record?.styles,\n\t\t\t\t_links: record?._links,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { getEditedEntityRecord } = useSelect( coreStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst config = useMemo( () => {\n\t\treturn {\n\t\t\tsettings: settings ?? {},\n\t\t\tstyles: styles ?? {},\n\t\t\t_links: _links ?? {},\n\t\t};\n\t}, [ settings, styles, _links ] );\n\n\tconst setConfig = useCallback(\n\t\t/**\n\t\t * Set the global styles config.\n\t\t * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.\n\t\t * Otherwise, overwrite the current config with the incoming object.\n\t\t * @param {Object} options Options for editEntityRecord Core selector.\n\t\t */\n\t\t( callbackOrObject, options = {} ) => {\n\t\t\tconst record = getEditedEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId\n\t\t\t);\n\n\t\t\tconst currentConfig = {\n\t\t\t\tstyles: record?.styles ?? {},\n\t\t\t\tsettings: record?.settings ?? {},\n\t\t\t\t_links: record?._links ?? {},\n\t\t\t};\n\n\t\t\tconst updatedConfig =\n\t\t\t\ttypeof callbackOrObject === 'function'\n\t\t\t\t\t? callbackOrObject( currentConfig )\n\t\t\t\t\t: callbackOrObject;\n\n\t\t\teditEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId,\n\t\t\t\t{\n\t\t\t\t\tstyles: cleanEmptyObject( updatedConfig.styles ) || {},\n\t\t\t\t\tsettings: cleanEmptyObject( updatedConfig.settings ) || {},\n\t\t\t\t\t_links: cleanEmptyObject( updatedConfig._links ) || {},\n\t\t\t\t},\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\t\t[ globalStylesId, editEntityRecord, getEditedEntityRecord ]\n\t);\n\n\treturn [ isReady, config, setConfig ];\n}\n\nfunction useGlobalStylesBaseConfig() {\n\tconst baseConfig = useSelect( ( select ) => {\n\t\tconst { __experimentalGetCurrentThemeBaseGlobalStyles, canUser } =\n\t\t\tselect( coreStore );\n\n\t\treturn (\n\t\t\tcanUser( 'read', { kind: 'root', name: 'theme' } ) &&\n\t\t\t__experimentalGetCurrentThemeBaseGlobalStyles()\n\t\t);\n\t}, [] );\n\n\treturn [ !! baseConfig, baseConfig ];\n}\n\nexport function useGlobalStylesContext() {\n\tconst [ isUserConfigReady, userConfig, setUserConfig ] =\n\t\tuseGlobalStylesUserConfig();\n\tconst [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! baseConfig || ! userConfig ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t}, [ userConfig, baseConfig ] );\n\n\tconst context = useMemo( () => {\n\t\treturn {\n\t\t\tisReady: isUserConfigReady && isBaseConfigReady,\n\t\t\tuser: userConfig,\n\t\t\tbase: baseConfig,\n\t\t\tmerged: mergedConfig,\n\t\t\tsetUserConfig,\n\t\t};\n\t}, [\n\t\tmergedConfig,\n\t\tuserConfig,\n\t\tbaseConfig,\n\t\tsetUserConfig,\n\t\tisUserConfigReady,\n\t\tisBaseConfigReady,\n\t] );\n\n\treturn context;\n}\n\nexport function GlobalStylesProvider( { children } ) {\n\tconst context = useGlobalStylesContext();\n\tif ( ! context.isReady ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AAA2C,IAAAO,WAAA,GAAAP,OAAA;AAjB3C;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;;AAGA,MAAM;EAAEQ,mBAAmB;EAAEC;AAAiB,CAAC,GAAG,IAAAC,kBAAM,EACvDC,wBACD,CAAC;AAEM,SAASC,uBAAuBA,CAAEC,IAAI,EAAEC,IAAI,EAAG;EACrD,OAAO,IAAAC,kBAAS,EAAEF,IAAI,EAAEC,IAAI,EAAE;IAC7B;AACF;AACA;AACA;AACA;IACEE,iBAAiB,EAAEC,4BAAa;IAChC;AACF;AACA;AACA;AACA;IACEC,WAAW,EAAIC,GAAG,IAAM;MACvB,IAAKA,GAAG,KAAK,iBAAiB,EAAG;QAChC,OAAO,CAAEC,UAAU,EAAEC,UAAU,KAAMA,UAAU;MAChD;MACA,OAAOC,SAAS;IACjB;EACD,CAAE,CAAC;AACJ;AAEA,SAASC,yBAAyBA,CAAA,EAAG;EACpC,MAAM;IAAEC,cAAc;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,eAAS,EACpEC,MAAM,IAAM;IACb,MAAM;MAAEC,qBAAqB;MAAEC,qBAAqB;MAAEC;IAAQ,CAAC,GAC9DH,MAAM,CAAEI,eAAU,CAAC;IACpB,MAAMC,eAAe,GACpBL,M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,IAAI;EACZ;EAEA,oBACC,IAAAlB,WAAA,CAAA2D,GAAA,EAAC1D,mBAAmB,CAAC2D,QAAQ;IAACC,KAAK,EAAGN,OAAS;IAAAG,QAAA,EAC5CA;EAAQ,CACmB,CAAC;AAEjC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_deepmerge","_interopRequireDefault","require","_isPlainObject","_blockEditor","_coreData","_data","_element","_lockUnlock","_jsxRuntime","GlobalStylesContext","cleanEmptyObject","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","base","user","deepmerge","isMergeableObject","isPlainObject","customMerge","key","baseConfig","userConfig","undefined","useGlobalStylesUserConfig","globalStylesId","isReady","settings","styles","_links","useSelect","select","getEditedEntityRecord","hasFinishedResolution","canUser","coreStore","_globalStylesId","__experimentalGetCurrentGlobalStylesId","record","kind","name","id","hasResolved","editEntityRecord","useDispatch","config","useMemo","setConfig","useCallback","callbackOrObject","options","_record$styles","_record$settings","_record$_links","currentConfig","updatedConfig","useGlobalStylesBaseConfig","__experimentalGetCurrentThemeBaseGlobalStyles","getCurrentTheme","currentTheme","stylesheet","useGlobalStylesContext","isUserConfigReady","setUserConfig","isBaseConfigReady","mergedConfig","context","merged","GlobalStylesProvider","children","jsx","Provider","value"],"sources":["@wordpress/editor/src/components/global-styles-provider/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, cleanEmptyObject } = unlock(\n\tblockEditorPrivateApis\n);\n\nexport function mergeBaseAndUserConfigs( base, user ) {\n\treturn deepmerge( base, user, {\n\t\t/*\n\t\t * We only pass as arrays the presets,\n\t\t * in which case we want the new array of values\n\t\t * to override the old array (no merging).\n\t\t */\n\t\tisMergeableObject: isPlainObject,\n\t\t/*\n\t\t * Exceptions to the above rule.\n\t\t * Background images should be replaced, not merged,\n\t\t * as they themselves are specific object definitions for the style.\n\t\t */\n\t\tcustomMerge: ( key ) => {\n\t\t\tif ( key === 'backgroundImage' ) {\n\t\t\t\treturn ( baseConfig, userConfig ) => userConfig;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t} );\n}\n\nfunction useGlobalStylesUserConfig() {\n\tconst { globalStylesId, isReady, settings, styles, _links } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _globalStylesId =\n\t\t\t\tselect( coreStore ).__experimentalGetCurrentGlobalStylesId();\n\n\t\t\tconst record =\n\t\t\t\t_globalStylesId &&\n\t\t\t\tcanUser( 'read', {\n\t\t\t\t\tkind: 'root',\n\t\t\t\t\tname: 'globalStyles',\n\t\t\t\t\tid: _globalStylesId,\n\t\t\t\t} )\n\t\t\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t_globalStylesId\n\t\t\t\t\t )\n\t\t\t\t\t: undefined;\n\n\t\t\tlet hasResolved = false;\n\t\t\tif (\n\t\t\t\thasFinishedResolution(\n\t\t\t\t\t'__experimentalGetCurrentGlobalStylesId'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\thasResolved = _globalStylesId\n\t\t\t\t\t? hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t ] )\n\t\t\t\t\t: true;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tglobalStylesId: _globalStylesId,\n\t\t\t\tisReady: hasResolved,\n\t\t\t\tsettings: record?.settings,\n\t\t\t\tstyles: record?.styles,\n\t\t\t\t_links: record?._links,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { getEditedEntityRecord } = useSelect( coreStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst config = useMemo( () => {\n\t\treturn {\n\t\t\tsettings: settings ?? {},\n\t\t\tstyles: styles ?? {},\n\t\t\t_links: _links ?? {},\n\t\t};\n\t}, [ settings, styles, _links ] );\n\n\tconst setConfig = useCallback(\n\t\t/**\n\t\t * Set the global styles config.\n\t\t * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.\n\t\t * Otherwise, overwrite the current config with the incoming object.\n\t\t * @param {Object} options Options for editEntityRecord Core selector.\n\t\t */\n\t\t( callbackOrObject, options = {} ) => {\n\t\t\tconst record = getEditedEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId\n\t\t\t);\n\n\t\t\tconst currentConfig = {\n\t\t\t\tstyles: record?.styles ?? {},\n\t\t\t\tsettings: record?.settings ?? {},\n\t\t\t\t_links: record?._links ?? {},\n\t\t\t};\n\n\t\t\tconst updatedConfig =\n\t\t\t\ttypeof callbackOrObject === 'function'\n\t\t\t\t\t? callbackOrObject( currentConfig )\n\t\t\t\t\t: callbackOrObject;\n\n\t\t\teditEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId,\n\t\t\t\t{\n\t\t\t\t\tstyles: cleanEmptyObject( updatedConfig.styles ) || {},\n\t\t\t\t\tsettings: cleanEmptyObject( updatedConfig.settings ) || {},\n\t\t\t\t\t_links: cleanEmptyObject( updatedConfig._links ) || {},\n\t\t\t\t},\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\t\t[ globalStylesId, editEntityRecord, getEditedEntityRecord ]\n\t);\n\n\treturn [ isReady, config, setConfig ];\n}\n\nfunction useGlobalStylesBaseConfig() {\n\tconst baseConfig = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetCurrentThemeBaseGlobalStyles,\n\t\t\tgetCurrentTheme,\n\t\t\tcanUser,\n\t\t} = select( coreStore );\n\t\tconst currentTheme = getCurrentTheme();\n\n\t\treturn currentTheme &&\n\t\t\tcanUser( 'read', 'global-styles/themes', currentTheme.stylesheet )\n\t\t\t? __experimentalGetCurrentThemeBaseGlobalStyles()\n\t\t\t: undefined;\n\t}, [] );\n\n\treturn [ !! baseConfig, baseConfig ];\n}\n\nexport function useGlobalStylesContext() {\n\tconst [ isUserConfigReady, userConfig, setUserConfig ] =\n\t\tuseGlobalStylesUserConfig();\n\tconst [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! baseConfig || ! userConfig ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t}, [ userConfig, baseConfig ] );\n\n\tconst context = useMemo( () => {\n\t\treturn {\n\t\t\tisReady: isUserConfigReady && isBaseConfigReady,\n\t\t\tuser: userConfig,\n\t\t\tbase: baseConfig,\n\t\t\tmerged: mergedConfig,\n\t\t\tsetUserConfig,\n\t\t};\n\t}, [\n\t\tmergedConfig,\n\t\tuserConfig,\n\t\tbaseConfig,\n\t\tsetUserConfig,\n\t\tisUserConfigReady,\n\t\tisBaseConfigReady,\n\t] );\n\n\treturn context;\n}\n\nexport function GlobalStylesProvider( { children } ) {\n\tconst context = useGlobalStylesContext();\n\tif ( ! context.isReady ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,O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22
|
var _postSavedState = _interopRequireDefault(require("../post-saved-state"));
|
|
23
23
|
var _postViewLink = _interopRequireDefault(require("../post-view-link"));
|
|
24
24
|
var _previewDropdown = _interopRequireDefault(require("../preview-dropdown"));
|
|
25
|
+
var _zoomOutToggle = _interopRequireDefault(require("../zoom-out-toggle"));
|
|
25
26
|
var _store = require("../../store");
|
|
26
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
28
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -76,6 +77,7 @@ function Header({
|
|
|
76
77
|
title,
|
|
77
78
|
icon
|
|
78
79
|
}) {
|
|
80
|
+
const zoomOutExperimentEnabled = window.__experimentalEnableZoomOutExperiment;
|
|
79
81
|
const isWideViewport = (0, _compose.useViewportMatch)('large');
|
|
80
82
|
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
81
83
|
const isTooNarrowForDocumentBar = (0, _compose.useMediaQuery)('(max-width: 403px)');
|
|
@@ -164,12 +166,12 @@ function Header({
|
|
|
164
166
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postPreviewButton.default, {
|
|
165
167
|
className: "editor-header__post-preview-button",
|
|
166
168
|
forceIsAutosaveable: forceIsDirty
|
|
167
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postViewLink.default, {}),
|
|
169
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postViewLink.default, {}), zoomOutExperimentEnabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_zoomOutToggle.default, {}), (isWideViewport || !showIconLabels) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_interface.PinnedItems.Slot, {
|
|
170
|
+
scope: "core"
|
|
171
|
+
}), !customSaveButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_postPublishButtonOrToggle.default, {
|
|
168
172
|
forceIsDirty: forceIsDirty,
|
|
169
173
|
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
|
|
170
|
-
}), customSaveButton,
|
|
171
|
-
scope: "core"
|
|
172
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_moreMenu.default, {})]
|
|
174
|
+
}), customSaveButton, /*#__PURE__*/(0, _jsxRuntime.jsx)(_moreMenu.default, {})]
|
|
173
175
|
})]
|
|
174
176
|
});
|
|
175
177
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_compose","_components","_preferences","_element","_interface","_blockEditor","_backButton","_interopRequireWildcard","_collapsibleBlockToolbar","_interopRequireDefault","_documentBar","_documentTools","_moreMenu","_postPreviewButton","_postPublishButtonOrToggle","_postSavedState","_postViewLink","_previewDropdown","_store","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","toolbarVariations","distractionFreeDisabled","y","distractionFreeHover","distractionFreeHidden","visible","hidden","backButtonVariations","x","Header","customSaveButton","forceIsDirty","forceDisableBlockTools","setEntitiesSavedStatesCallback","title","icon","isWideViewport","useViewportMatch","isLargeViewport","isTooNarrowForDocumentBar","useMediaQuery","isTextEditor","isPublishSidebarOpened","showIconLabels","hasFixedToolbar","isNestedEntity","useSelect","select","getPreference","preferencesStore","getEditorMode","getEditorSettings","_isPublishSidebarOpened","editorStore","__unstableGetEditorMode","blockEditorStore","onNavigateToPreviousEntityRecord","isZoomedOutView","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","hasCenter","hasBackButton","useHasBackButton","jsxs","className","children","jsx","__unstableMotion","div","variants","transition","type","Slot","disableBlockTools","isCollapsed","onToggle","forceIsAutosaveable","disabled","PinnedItems","scope","_default","exports"],"sources":["@wordpress/editor/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMediaQuery, useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport BackButton, { useHasBackButton } from './back-button';\nimport CollapsibleBlockToolbar from '../collapsible-block-toolbar';\nimport DocumentBar from '../document-bar';\nimport DocumentTools from '../document-tools';\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 { store as editorStore } from '../../store';\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\nfunction Header( {\n\tcustomSaveButton,\n\tforceIsDirty,\n\tforceDisableBlockTools,\n\tsetEntitiesSavedStatesCallback,\n\ttitle,\n\ticon,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isTooNarrowForDocumentBar = useMediaQuery( '(max-width: 403px)' );\n\tconst {\n\t\tisTextEditor,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasFixedToolbar,\n\t\tisNestedEntity,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorMode,\n\t\t\tgetEditorSettings,\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened,\n\t\t} = select( editorStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\treturn {\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\tisNestedEntity:\n\t\t\t\t!! getEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisZoomedOutView: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasCenter = isBlockToolsCollapsed && ! isTooNarrowForDocumentBar;\n\tconst hasBackButton = useHasBackButton();\n\n\t// The edit-post-header classname is only kept for backward compatibilty\n\t// as some plugins might be relying on its presence.\n\treturn (\n\t\t<div className=\"editor-header edit-post-header\">\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<DocumentTools\n\t\t\t\t\tdisableBlockTools={ forceDisableBlockTools || isTextEditor }\n\t\t\t\t/>\n\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t<CollapsibleBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t\t{ hasCenter && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__center\"\n\t\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<DocumentBar title={ title } icon={ icon } />\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{ ! customSaveButton && ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\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// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState forceIsDirty={ forceIsDirty } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\tdisabled={ isNestedEntity }\n\t\t\t\t/>\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"editor-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\t\t\t\t{ ! customSaveButton && (\n\t\t\t\t\t<PostPublishButtonOrToggle\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/>\n\t\t\t\t) }\n\t\t\t\t{ customSaveButton }\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\t\t\t\t<MoreMenu />\n\t\t\t</motion.div>\n\t\t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C;EAAA,CACT,CAAC;AAER;AAAC,IAAA2E,QAAA,GAAAC,OAAA,CAAA5E,OAAA,GAEcuB,MAAM","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_compose","_components","_preferences","_element","_interface","_blockEditor","_backButton","_interopRequireWildcard","_collapsibleBlockToolbar","_interopRequireDefault","_documentBar","_documentTools","_moreMenu","_postPreviewButton","_postPublishButtonOrToggle","_postSavedState","_postViewLink","_previewDropdown","_zoomOutToggle","_store","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","toolbarVariations","distractionFreeDisabled","y","distractionFreeHover","distractionFreeHidden","visible","hidden","backButtonVariations","x","Header","customSaveButton","forceIsDirty","forceDisableBlockTools","setEntitiesSavedStatesCallback","title","icon","zoomOutExperimentEnabled","window","__experimentalEnableZoomOutExperiment","isWideViewport","useViewportMatch","isLargeViewport","isTooNarrowForDocumentBar","useMediaQuery","isTextEditor","isPublishSidebarOpened","showIconLabels","hasFixedToolbar","isNestedEntity","useSelect","select","getPreference","preferencesStore","getEditorMode","getEditorSettings","_isPublishSidebarOpened","editorStore","__unstableGetEditorMode","blockEditorStore","onNavigateToPreviousEntityRecord","isZoomedOutView","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","hasCenter","hasBackButton","useHasBackButton","jsxs","className","children","jsx","__unstableMotion","div","variants","transition","type","Slot","disableBlockTools","isCollapsed","onToggle","forceIsAutosaveable","disabled","PinnedItems","scope","_default","exports"],"sources":["@wordpress/editor/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMediaQuery, useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport BackButton, { useHasBackButton } from './back-button';\nimport CollapsibleBlockToolbar from '../collapsible-block-toolbar';\nimport DocumentBar from '../document-bar';\nimport DocumentTools from '../document-tools';\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';\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\nfunction Header( {\n\tcustomSaveButton,\n\tforceIsDirty,\n\tforceDisableBlockTools,\n\tsetEntitiesSavedStatesCallback,\n\ttitle,\n\ticon,\n} ) {\n\tconst zoomOutExperimentEnabled =\n\t\twindow.__experimentalEnableZoomOutExperiment;\n\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isTooNarrowForDocumentBar = useMediaQuery( '(max-width: 403px)' );\n\tconst {\n\t\tisTextEditor,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasFixedToolbar,\n\t\tisNestedEntity,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorMode,\n\t\t\tgetEditorSettings,\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened,\n\t\t} = select( editorStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\treturn {\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\tisNestedEntity:\n\t\t\t\t!! getEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisZoomedOutView: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasCenter = isBlockToolsCollapsed && ! isTooNarrowForDocumentBar;\n\tconst hasBackButton = useHasBackButton();\n\n\t// The edit-post-header classname is only kept for backward compatibilty\n\t// as some plugins might be relying on its presence.\n\treturn (\n\t\t<div className=\"editor-header edit-post-header\">\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<DocumentTools\n\t\t\t\t\tdisableBlockTools={ forceDisableBlockTools || isTextEditor }\n\t\t\t\t/>\n\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t<CollapsibleBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t\t{ hasCenter && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__center\"\n\t\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<DocumentBar title={ title } icon={ icon } />\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{ ! customSaveButton && ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\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// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState forceIsDirty={ forceIsDirty } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\tdisabled={ isNestedEntity }\n\t\t\t\t/>\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"editor-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\n\t\t\t\t{ zoomOutExperimentEnabled && <ZoomOutToggle /> }\n\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\n\t\t\t\t{ ! customSaveButton && (\n\t\t\t\t\t<PostPublishButtonOrToggle\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/>\n\t\t\t\t) }\n\n\t\t\t\t{ customSaveButton }\n\t\t\t\t<MoreMenu />\n\t\t\t</motion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,GAAA,EAAC7E,0BAAA,CAAAa,OAAyB;QACzByB,YAAY,EAAGA,YAAc;QAC7BE,8BAA8B,EAC7BA;MACA,CACD,CACD,EAECH,gBAAgB,eAClB,IAAA/B,WAAA,CAAAuE,GAAA,EAAC/E,SAAA,CAAAe,OAAQ,IAAE,CAAC;IAAA,CACD,CAAC;EAAA,CACT,CAAC;AAER;AAAC,IAAA8E,QAAA,GAAAC,OAAA,CAAA/E,OAAA,GAEcuB,MAAM","ignoreList":[]}
|
|
@@ -27,7 +27,6 @@ const {
|
|
|
27
27
|
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
28
28
|
function InserterSidebar() {
|
|
29
29
|
const {
|
|
30
|
-
blockInsertionPoint,
|
|
31
30
|
blockSectionRootClientId,
|
|
32
31
|
inserterSidebarToggleRef,
|
|
33
32
|
insertionPoint,
|
|
@@ -40,7 +39,6 @@ function InserterSidebar() {
|
|
|
40
39
|
isPublishSidebarOpened
|
|
41
40
|
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
42
41
|
const {
|
|
43
|
-
getBlockInsertionPoint,
|
|
44
42
|
getBlockRootClientId,
|
|
45
43
|
__unstableGetEditorMode,
|
|
46
44
|
getSectionRootClientId
|
|
@@ -61,7 +59,6 @@ function InserterSidebar() {
|
|
|
61
59
|
return getBlockRootClientId();
|
|
62
60
|
};
|
|
63
61
|
return {
|
|
64
|
-
blockInsertionPoint: getBlockInsertionPoint(),
|
|
65
62
|
inserterSidebarToggleRef: getInserterSidebarToggleRef(),
|
|
66
63
|
insertionPoint: getInsertionPoint(),
|
|
67
64
|
showMostUsedBlocks: get('core', 'mostUsedBlocks'),
|
|
@@ -95,8 +92,8 @@ function InserterSidebar() {
|
|
|
95
92
|
showMostUsedBlocks: showMostUsedBlocks,
|
|
96
93
|
showInserterHelpPanel: true,
|
|
97
94
|
shouldFocusBlock: isMobileViewport,
|
|
98
|
-
rootClientId: blockSectionRootClientId !== null && blockSectionRootClientId !== void 0 ? blockSectionRootClientId :
|
|
99
|
-
__experimentalInsertionIndex:
|
|
95
|
+
rootClientId: blockSectionRootClientId !== null && blockSectionRootClientId !== void 0 ? blockSectionRootClientId : insertionPoint.rootClientId,
|
|
96
|
+
__experimentalInsertionIndex: insertionPoint.insertionIndex,
|
|
100
97
|
onSelect: insertionPoint.onSelect,
|
|
101
98
|
__experimentalInitialTab: insertionPoint.tab,
|
|
102
99
|
__experimentalInitialCategory: insertionPoint.category,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blockEditor","_compose","_element","_preferences","_keycodes","_interface","_lockUnlock","_store","_jsxRuntime","PrivateInserterLibrary","unlock","blockEditorPrivateApis","InserterSidebar","
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","_compose","_element","_preferences","_keycodes","_interface","_lockUnlock","_store","_jsxRuntime","PrivateInserterLibrary","unlock","blockEditorPrivateApis","InserterSidebar","blockSectionRootClientId","inserterSidebarToggleRef","insertionPoint","showMostUsedBlocks","sidebarIsOpened","useSelect","select","getInserterSidebarToggleRef","getInsertionPoint","isPublishSidebarOpened","editorStore","getBlockRootClientId","__unstableGetEditorMode","getSectionRootClientId","blockEditorStore","get","preferencesStore","getActiveComplementaryArea","interfaceStore","getBlockSectionRootClientId","sectionRootClientId","setIsInserterOpened","useDispatch","disableComplementaryArea","isMobileViewport","useViewportMatch","libraryRef","useRef","closeInserterSidebar","useCallback","current","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","inserterContents","jsx","className","children","showInserterHelpPanel","shouldFocusBlock","rootClientId","__experimentalInsertionIndex","insertionIndex","onSelect","__experimentalInitialTab","tab","__experimentalInitialCategory","category","__experimentalFilterValue","filterValue","onPatternCategorySelection","undefined","ref","onClose","onKeyDown"],"sources":["@wordpress/editor/src/components/inserter-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { PrivateInserterLibrary } = unlock( blockEditorPrivateApis );\n\nexport default function InserterSidebar() {\n\tconst {\n\t\tblockSectionRootClientId,\n\t\tinserterSidebarToggleRef,\n\t\tinsertionPoint,\n\t\tshowMostUsedBlocks,\n\t\tsidebarIsOpened,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tgetInsertionPoint,\n\t\t\tisPublishSidebarOpened,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\t__unstableGetEditorMode,\n\t\t\tgetSectionRootClientId,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst getBlockSectionRootClientId = () => {\n\t\t\tif ( __unstableGetEditorMode() === 'zoom-out' ) {\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\tif ( sectionRootClientId ) {\n\t\t\t\t\treturn sectionRootClientId;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn getBlockRootClientId();\n\t\t};\n\t\treturn {\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tinsertionPoint: getInsertionPoint(),\n\t\t\tshowMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),\n\t\t\tblockSectionRootClientId: getBlockSectionRootClientId(),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tgetActiveComplementaryArea( 'core' ) || isPublishSidebarOpened()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\tconst { disableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst libraryRef = useRef();\n\n\t// When closing the inserter, focus should return to the toggle button.\n\tconst closeInserterSidebar = useCallback( () => {\n\t\tsetIsInserterOpened( false );\n\t\tinserterSidebarToggleRef.current?.focus();\n\t}, [ inserterSidebarToggleRef, setIsInserterOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseInserterSidebar();\n\t\t\t}\n\t\t},\n\t\t[ closeInserterSidebar ]\n\t);\n\n\tconst inserterContents = (\n\t\t<div className=\"editor-inserter-sidebar__content\">\n\t\t\t<PrivateInserterLibrary\n\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\tshowInserterHelpPanel\n\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\trootClientId={\n\t\t\t\t\tblockSectionRootClientId ?? insertionPoint.rootClientId\n\t\t\t\t}\n\t\t\t\t__experimentalInsertionIndex={ insertionPoint.insertionIndex }\n\t\t\t\tonSelect={ insertionPoint.onSelect }\n\t\t\t\t__experimentalInitialTab={ insertionPoint.tab }\n\t\t\t\t__experimentalInitialCategory={ insertionPoint.category }\n\t\t\t\t__experimentalFilterValue={ insertionPoint.filterValue }\n\t\t\t\tonPatternCategorySelection={\n\t\t\t\t\tsidebarIsOpened\n\t\t\t\t\t\t? () => disableComplementaryArea( 'core' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tref={ libraryRef }\n\t\t\t\tonClose={ closeInserterSidebar }\n\t\t\t/>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div onKeyDown={ closeOnEscape } className=\"editor-inserter-sidebar\">\n\t\t\t{ in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AAA,CAAA4C,GAAA,EAAC3C,sBAAsB;MACtBO,kBAAkB,EAAGA,kBAAoB;MACzCuC,qBAAqB;MACrBC,gBAAgB,EAAGnB,gBAAkB;MACrCoB,YAAY,EACX5C,wBAAwB,aAAxBA,wBAAwB,cAAxBA,wBAAwB,GAAIE,cAAc,CAAC0C,YAC3C;MACDC,4BAA4B,EAAG3C,cAAc,CAAC4C,cAAgB;MAC9DC,QAAQ,EAAG7C,cAAc,CAAC6C,QAAU;MACpCC,wBAAwB,EAAG9C,cAAc,CAAC+C,GAAK;MAC/CC,6BAA6B,EAAGhD,cAAc,CAACiD,QAAU;MACzDC,yBAAyB,EAAGlD,cAAc,CAACmD,WAAa;MACxDC,0BAA0B,EACzBlD,eAAe,GACZ,MAAMmB,wBAAwB,CAAE,MAAO,CAAC,GACxCgC,SACH;MACDC,GAAG,EAAG9B,UAAY;MAClB+B,OAAO,EAAG7B;IAAsB,CAChC;EAAC,CACE,CACL;EAED;IAAA;IACC;IACA,IAAAjC,WAAA,CAAA4C,GAAA;MAAKmB,SAAS,EAAG1B,aAAe;MAACQ,SAAS,EAAC,yBAAyB;MAAAC,QAAA,EACjEH;IAAgB,CACd;EAAC;AAER","ignoreList":[]}
|
|
@@ -154,11 +154,8 @@ function PrivateExcerpt() {
|
|
|
154
154
|
ref: setPopoverAnchor,
|
|
155
155
|
renderToggle: ({
|
|
156
156
|
onToggle
|
|
157
|
-
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button
|
|
158
|
-
|
|
159
|
-
, {
|
|
160
|
-
__next40pxDefaultSize: false,
|
|
161
|
-
className: "editor-post-excerpt__dropdown__trigger",
|
|
157
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
158
|
+
__next40pxDefaultSize: true,
|
|
162
159
|
onClick: onToggle,
|
|
163
160
|
variant: "link",
|
|
164
161
|
children: excerptText ? triggerEditLabel : excerptPlaceholder
|