@wordpress/editor 13.19.6 → 13.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +6 -6
- package/build/components/autocompleters/user.js +5 -4
- package/build/components/autocompleters/user.js.map +1 -1
- package/build/components/deprecated.js +3 -2
- package/build/components/deprecated.js.map +1 -1
- package/build/components/document-outline/index.js +11 -11
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js +6 -6
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/editor-help/add-blocks.native.js +5 -5
- package/build/components/editor-help/add-blocks.native.js.map +1 -1
- package/build/components/editor-help/customize-blocks.native.js +5 -5
- package/build/components/editor-help/customize-blocks.native.js.map +1 -1
- package/build/components/editor-help/help-detail-navigation-screen.native.js +8 -7
- package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build/components/editor-help/help-get-support-button.native.js +3 -3
- package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build/components/editor-help/help-section-title.native.js +3 -3
- package/build/components/editor-help/help-section-title.native.js.map +1 -1
- package/build/components/editor-help/help-topic-row.native.js +3 -3
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/icon-move-blocks.native.js +3 -3
- package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
- package/build/components/editor-help/index.native.js +19 -19
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/intro-to-blocks.native.js +15 -15
- package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build/components/editor-help/move-blocks.native.js +9 -9
- package/build/components/editor-help/move-blocks.native.js.map +1 -1
- package/build/components/editor-help/remove-blocks.native.js +4 -4
- package/build/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.js +8 -8
- package/build/components/editor-help/view-sections.native.js.map +1 -1
- package/build/components/editor-history/redo.js +3 -2
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +3 -2
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-notices/index.js +4 -4
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js +2 -2
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +3 -3
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +4 -4
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/index.js +10 -9
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js +5 -4
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +2 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +2 -1
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/page-attributes/order.js +5 -4
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/parent.js +3 -2
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/check.js +2 -2
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/combobox.js +3 -2
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-author/index.js +3 -3
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/select.js +3 -2
- package/build/components/post-author/select.js.map +1 -1
- package/build/components/post-comments/index.js +2 -2
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-excerpt/check.js +2 -2
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js +4 -4
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-featured-image/check.js +3 -3
- package/build/components/post-featured-image/check.js.map +1 -1
- package/build/components/post-featured-image/index.js +15 -14
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/check.js +2 -2
- package/build/components/post-format/check.js.map +1 -1
- package/build/components/post-format/index.js +5 -5
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/check.js +2 -2
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js +2 -2
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +14 -13
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-pending-status/index.js +2 -2
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-pingbacks/index.js +2 -2
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-preview-button/index.js +8 -7
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +4 -3
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +13 -12
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +5 -4
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +5 -5
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js +6 -5
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +9 -8
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +15 -14
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js +15 -15
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +5 -4
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/index.js +3 -2
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-slug/check.js +2 -2
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +3 -2
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-sticky/check.js +12 -14
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-sticky/index.js +14 -24
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +35 -43
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-sync-status/index.js +10 -9
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +4 -3
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +15 -14
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +3 -2
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +6 -6
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/index.js +2 -2
- package/build/components/post-template/index.js.map +1 -1
- package/build/components/post-text-editor/index.js +4 -3
- package/build/components/post-text-editor/index.js.map +1 -1
- package/build/components/post-title/index.js +4 -3
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js +4 -3
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/index.js +14 -4
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-type-support-check/index.js +2 -2
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/index.js +11 -10
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-visibility/index.js +17 -16
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/provider/index.js +7 -6
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +4 -3
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/with-registry-provider.js +4 -3
- package/build/components/provider/with-registry-provider.js.map +1 -1
- package/build/components/table-of-contents/index.js +5 -4
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/table-of-contents/panel.js +15 -15
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/template-validation-notice/index.js +2 -2
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/time-to-read/index.js +5 -4
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/unsaved-changes-warning/index.js +1 -1
- package/build/components/unsaved-changes-warning/index.js.map +1 -1
- package/build/components/word-count/index.js +2 -2
- package/build/components/word-count/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +3 -2
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build-module/components/autocompleters/user.js +1 -1
- package/build-module/components/deprecated.js +1 -1
- package/build-module/components/document-outline/index.js +1 -1
- package/build-module/components/document-outline/item.js +1 -1
- package/build-module/components/editor-help/add-blocks.native.js +1 -1
- package/build-module/components/editor-help/customize-blocks.native.js +1 -1
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js +1 -1
- package/build-module/components/editor-help/help-get-support-button.native.js +1 -1
- package/build-module/components/editor-help/help-section-title.native.js +1 -1
- package/build-module/components/editor-help/help-topic-row.native.js +1 -1
- package/build-module/components/editor-help/icon-move-blocks.native.js +1 -1
- package/build-module/components/editor-help/index.native.js +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js +1 -1
- package/build-module/components/editor-help/move-blocks.native.js +1 -1
- package/build-module/components/editor-help/remove-blocks.native.js +1 -1
- package/build-module/components/editor-help/view-sections.native.js +1 -1
- package/build-module/components/editor-history/redo.js +1 -1
- package/build-module/components/editor-history/undo.js +1 -1
- package/build-module/components/editor-notices/index.js +1 -1
- package/build-module/components/editor-snackbars/index.js +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +1 -1
- package/build-module/components/entities-saved-states/index.js +1 -1
- package/build-module/components/error-boundary/index.js +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/build-module/components/local-autosave-monitor/index.js +1 -1
- package/build-module/components/page-attributes/order.js +1 -1
- package/build-module/components/page-attributes/parent.js +1 -1
- package/build-module/components/post-author/check.js +1 -1
- package/build-module/components/post-author/combobox.js +1 -1
- package/build-module/components/post-author/index.js +1 -1
- package/build-module/components/post-author/select.js +1 -1
- package/build-module/components/post-comments/index.js +1 -1
- package/build-module/components/post-excerpt/check.js +1 -1
- package/build-module/components/post-excerpt/index.js +1 -1
- package/build-module/components/post-featured-image/check.js +1 -1
- package/build-module/components/post-featured-image/index.js +1 -1
- package/build-module/components/post-format/check.js +1 -1
- package/build-module/components/post-format/index.js +1 -1
- package/build-module/components/post-last-revision/check.js +1 -1
- package/build-module/components/post-last-revision/index.js +1 -1
- package/build-module/components/post-locked-modal/index.js +1 -1
- package/build-module/components/post-pending-status/index.js +1 -1
- package/build-module/components/post-pingbacks/index.js +1 -1
- package/build-module/components/post-preview-button/index.js +1 -1
- package/build-module/components/post-publish-button/index.js +1 -1
- package/build-module/components/post-publish-panel/index.js +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +1 -1
- package/build-module/components/post-saved-state/index.js +2 -2
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/index.js +1 -1
- package/build-module/components/post-slug/check.js +1 -1
- package/build-module/components/post-slug/index.js +1 -1
- package/build-module/components/post-sticky/check.js +13 -13
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-sticky/index.js +13 -21
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +32 -40
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +1 -1
- package/build-module/components/post-template/index.js +1 -1
- package/build-module/components/post-text-editor/index.js +1 -1
- package/build-module/components/post-title/index.js +1 -1
- package/build-module/components/post-title/index.native.js +1 -1
- package/build-module/components/post-trash/index.js +15 -5
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js +2 -2
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/index.js +1 -1
- package/build-module/components/post-visibility/index.js +1 -1
- package/build-module/components/provider/index.js +1 -1
- package/build-module/components/provider/index.native.js +1 -1
- package/build-module/components/provider/with-registry-provider.js +1 -1
- package/build-module/components/table-of-contents/index.js +1 -1
- package/build-module/components/table-of-contents/panel.js +1 -1
- package/build-module/components/template-validation-notice/index.js +1 -1
- package/build-module/components/time-to-read/index.js +1 -1
- package/build-module/components/unsaved-changes-warning/index.js +1 -1
- package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
- package/build-module/components/word-count/index.js +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/package.json +31 -31
- package/src/components/post-featured-image/README.md +3 -3
- package/src/components/post-saved-state/index.js +1 -1
- package/src/components/post-sticky/check.js +10 -13
- package/src/components/post-sticky/index.js +10 -20
- package/src/components/post-sticky/test/index.js +31 -16
- package/src/components/post-switch-to-draft-button/index.js +20 -35
- package/src/components/post-taxonomies/README.md +2 -2
- package/src/components/post-taxonomies/hierarchical-term-selector.js +1 -1
- package/src/components/post-trash/index.js +34 -11
- package/src/components/post-type-support-check/README.md +1 -1
- package/src/components/post-type-support-check/index.js +2 -2
- package/src/components/unsaved-changes-warning/index.js +1 -1
- package/src/lock-unlock.js +1 -1
|
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.PageAttributesParent = PageAttributesParent;
|
|
8
8
|
exports.getItemPriority = exports.default = void 0;
|
|
9
|
-
var
|
|
9
|
+
var _react = require("react");
|
|
10
10
|
var _removeAccents = _interopRequireDefault(require("remove-accents"));
|
|
11
11
|
var _i18n = require("@wordpress/i18n");
|
|
12
12
|
var _components = require("@wordpress/components");
|
|
13
13
|
var _compose = require("@wordpress/compose");
|
|
14
|
+
var _element = require("@wordpress/element");
|
|
14
15
|
var _data = require("@wordpress/data");
|
|
15
16
|
var _htmlEntities = require("@wordpress/html-entities");
|
|
16
17
|
var _coreData = require("@wordpress/core-data");
|
|
@@ -151,7 +152,7 @@ function PageAttributesParent() {
|
|
|
151
152
|
parent: selectedPostId
|
|
152
153
|
});
|
|
153
154
|
};
|
|
154
|
-
return (0,
|
|
155
|
+
return (0, _react.createElement)(_components.ComboboxControl, {
|
|
155
156
|
__nextHasNoMarginBottom: true,
|
|
156
157
|
__next40pxDefaultSize: true,
|
|
157
158
|
className: "editor-page-attributes__parent",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_removeAccents","_interopRequireDefault","_i18n","_components","_compose","_data","_htmlEntities","_coreData","_terms","_store","getTitle","post","title","rendered","decodeEntities","id","__","getItemPriority","name","searchValue","normalizedName","removeAccents","toLowerCase","normalizedSearch","startsWith","length","Infinity","exports","PageAttributesParent","editPost","useDispatch","editorStore","fieldValue","setFieldValue","useState","isHierarchical","parentPostId","parentPostTitle","pageItems","useSelect","select","_pType$hierarchical","getPostType","getEntityRecords","getEntityRecord","coreStore","getCurrentPostId","getEditedPostAttribute","postTypeSlug","pageId","pType","postId","postIsHierarchical","hierarchical","query","per_page","exclude","parent_exclude","orderby","order","_fields","search","parentPost","parentOptions","useMemo","getOptionsFromTree","tree","level","mappedNodes","map","treeNode","value","label","repeat","rawName","children","sortedNodes","sort","a","b","priorityA","priorityB","flat","item","parent","buildTermsTree","opts","optsHasParent","find","unshift","handleKeydown","inputValue","handleChange","selectedPostId","createElement","ComboboxControl","__nextHasNoMarginBottom","__next40pxDefaultSize","className","options","onFilterValueChange","debounce","onChange","_default","default"],"sources":["@wordpress/editor/src/components/page-attributes/parent.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\nfunction getTitle( post ) {\n\treturn post?.title?.rendered\n\t\t? decodeEntities( post.title.rendered )\n\t\t: `#${ post.id } (${ __( 'no title' ) })`;\n}\n\nexport const getItemPriority = ( name, searchValue ) => {\n\tconst normalizedName = removeAccents( name || '' ).toLowerCase();\n\tconst normalizedSearch = removeAccents( searchValue || '' ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\nexport function PageAttributesParent() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ fieldValue, setFieldValue ] = useState( false );\n\tconst { isHierarchical, parentPostId, parentPostTitle, pageItems } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getPostType, getEntityRecords, getEntityRecord } =\n\t\t\t\t\tselect( coreStore );\n\t\t\t\tconst { getCurrentPostId, getEditedPostAttribute } =\n\t\t\t\t\tselect( editorStore );\n\t\t\t\tconst postTypeSlug = getEditedPostAttribute( 'type' );\n\t\t\t\tconst pageId = getEditedPostAttribute( 'parent' );\n\t\t\t\tconst pType = getPostType( postTypeSlug );\n\t\t\t\tconst postId = getCurrentPostId();\n\t\t\t\tconst postIsHierarchical = pType?.hierarchical ?? false;\n\t\t\t\tconst query = {\n\t\t\t\t\tper_page: 100,\n\t\t\t\t\texclude: postId,\n\t\t\t\t\tparent_exclude: postId,\n\t\t\t\t\torderby: 'menu_order',\n\t\t\t\t\torder: 'asc',\n\t\t\t\t\t_fields: 'id,title,parent',\n\t\t\t\t};\n\n\t\t\t\t// Perform a search when the field is changed.\n\t\t\t\tif ( !! fieldValue ) {\n\t\t\t\t\tquery.search = fieldValue;\n\t\t\t\t}\n\n\t\t\t\tconst parentPost = pageId\n\t\t\t\t\t? getEntityRecord( 'postType', postTypeSlug, pageId )\n\t\t\t\t\t: null;\n\n\t\t\t\treturn {\n\t\t\t\t\tisHierarchical: postIsHierarchical,\n\t\t\t\t\tparentPostId: pageId,\n\t\t\t\t\tparentPostTitle: parentPost ? getTitle( parentPost ) : '',\n\t\t\t\t\tpageItems: postIsHierarchical\n\t\t\t\t\t\t? getEntityRecords( 'postType', postTypeSlug, query )\n\t\t\t\t\t\t: null,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ fieldValue ]\n\t\t);\n\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = ( tree, level = 0 ) => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\t'— '.repeat( level ) + decodeEntities( treeNode.name ),\n\t\t\t\t\trawName: treeNode.name,\n\t\t\t\t},\n\t\t\t\t...getOptionsFromTree( treeNode.children || [], level + 1 ),\n\t\t\t] );\n\n\t\t\tconst sortedNodes = mappedNodes.sort( ( [ a ], [ b ] ) => {\n\t\t\t\tconst priorityA = getItemPriority( a.rawName, fieldValue );\n\t\t\t\tconst priorityB = getItemPriority( b.rawName, fieldValue );\n\t\t\t\treturn priorityA >= priorityB ? 1 : -1;\n\t\t\t} );\n\n\t\t\treturn sortedNodes.flat();\n\t\t};\n\n\t\tif ( ! pageItems ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet tree = pageItems.map( ( item ) => ( {\n\t\t\tid: item.id,\n\t\t\tparent: item.parent,\n\t\t\tname: getTitle( item ),\n\t\t} ) );\n\n\t\t// Only build a hierarchical tree when not searching.\n\t\tif ( ! fieldValue ) {\n\t\t\ttree = buildTermsTree( tree );\n\t\t}\n\n\t\tconst opts = getOptionsFromTree( tree );\n\n\t\t// Ensure the current parent is in the options list.\n\t\tconst optsHasParent = opts.find(\n\t\t\t( item ) => item.value === parentPostId\n\t\t);\n\t\tif ( parentPostTitle && ! optsHasParent ) {\n\t\t\topts.unshift( {\n\t\t\t\tvalue: parentPostId,\n\t\t\t\tlabel: parentPostTitle,\n\t\t\t} );\n\t\t}\n\t\treturn opts;\n\t}, [ pageItems, fieldValue, parentPostTitle, parentPostId ] );\n\n\tif ( ! isHierarchical ) {\n\t\treturn null;\n\t}\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {Object} selectedPostId The selected Author.\n\t */\n\tconst handleChange = ( selectedPostId ) => {\n\t\teditPost( { parent: selectedPostId } );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"editor-page-attributes__parent\"\n\t\t\tlabel={ __( 'Parent' ) }\n\t\t\tvalue={ parentPostId }\n\t\t\toptions={ parentOptions }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleChange }\n\t\t/>\n\t);\n}\n\nexport default PageAttributesParent;\n"],"mappings":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B,CAAC;AAEJ;AAAC,IAAAW,QAAA,GAEc3E,oBAAoB;AAAAD,OAAA,CAAA6E,OAAA,GAAAD,QAAA"}
|
|
1
|
+
{"version":3,"names":["_removeAccents","_interopRequireDefault","require","_i18n","_components","_compose","_element","_data","_htmlEntities","_coreData","_terms","_store","getTitle","post","title","rendered","decodeEntities","id","__","getItemPriority","name","searchValue","normalizedName","removeAccents","toLowerCase","normalizedSearch","startsWith","length","Infinity","exports","PageAttributesParent","editPost","useDispatch","editorStore","fieldValue","setFieldValue","useState","isHierarchical","parentPostId","parentPostTitle","pageItems","useSelect","select","_pType$hierarchical","getPostType","getEntityRecords","getEntityRecord","coreStore","getCurrentPostId","getEditedPostAttribute","postTypeSlug","pageId","pType","postId","postIsHierarchical","hierarchical","query","per_page","exclude","parent_exclude","orderby","order","_fields","search","parentPost","parentOptions","useMemo","getOptionsFromTree","tree","level","mappedNodes","map","treeNode","value","label","repeat","rawName","children","sortedNodes","sort","a","b","priorityA","priorityB","flat","item","parent","buildTermsTree","opts","optsHasParent","find","unshift","handleKeydown","inputValue","handleChange","selectedPostId","_react","createElement","ComboboxControl","__nextHasNoMarginBottom","__next40pxDefaultSize","className","options","onFilterValueChange","debounce","onChange","_default","default"],"sources":["@wordpress/editor/src/components/page-attributes/parent.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\nfunction getTitle( post ) {\n\treturn post?.title?.rendered\n\t\t? decodeEntities( post.title.rendered )\n\t\t: `#${ post.id } (${ __( 'no title' ) })`;\n}\n\nexport const getItemPriority = ( name, searchValue ) => {\n\tconst normalizedName = removeAccents( name || '' ).toLowerCase();\n\tconst normalizedSearch = removeAccents( searchValue || '' ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\nexport function PageAttributesParent() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ fieldValue, setFieldValue ] = useState( false );\n\tconst { isHierarchical, parentPostId, parentPostTitle, pageItems } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getPostType, getEntityRecords, getEntityRecord } =\n\t\t\t\t\tselect( coreStore );\n\t\t\t\tconst { getCurrentPostId, getEditedPostAttribute } =\n\t\t\t\t\tselect( editorStore );\n\t\t\t\tconst postTypeSlug = getEditedPostAttribute( 'type' );\n\t\t\t\tconst pageId = getEditedPostAttribute( 'parent' );\n\t\t\t\tconst pType = getPostType( postTypeSlug );\n\t\t\t\tconst postId = getCurrentPostId();\n\t\t\t\tconst postIsHierarchical = pType?.hierarchical ?? false;\n\t\t\t\tconst query = {\n\t\t\t\t\tper_page: 100,\n\t\t\t\t\texclude: postId,\n\t\t\t\t\tparent_exclude: postId,\n\t\t\t\t\torderby: 'menu_order',\n\t\t\t\t\torder: 'asc',\n\t\t\t\t\t_fields: 'id,title,parent',\n\t\t\t\t};\n\n\t\t\t\t// Perform a search when the field is changed.\n\t\t\t\tif ( !! fieldValue ) {\n\t\t\t\t\tquery.search = fieldValue;\n\t\t\t\t}\n\n\t\t\t\tconst parentPost = pageId\n\t\t\t\t\t? getEntityRecord( 'postType', postTypeSlug, pageId )\n\t\t\t\t\t: null;\n\n\t\t\t\treturn {\n\t\t\t\t\tisHierarchical: postIsHierarchical,\n\t\t\t\t\tparentPostId: pageId,\n\t\t\t\t\tparentPostTitle: parentPost ? getTitle( parentPost ) : '',\n\t\t\t\t\tpageItems: postIsHierarchical\n\t\t\t\t\t\t? getEntityRecords( 'postType', postTypeSlug, query )\n\t\t\t\t\t\t: null,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ fieldValue ]\n\t\t);\n\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = ( tree, level = 0 ) => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\t'— '.repeat( level ) + decodeEntities( treeNode.name ),\n\t\t\t\t\trawName: treeNode.name,\n\t\t\t\t},\n\t\t\t\t...getOptionsFromTree( treeNode.children || [], level + 1 ),\n\t\t\t] );\n\n\t\t\tconst sortedNodes = mappedNodes.sort( ( [ a ], [ b ] ) => {\n\t\t\t\tconst priorityA = getItemPriority( a.rawName, fieldValue );\n\t\t\t\tconst priorityB = getItemPriority( b.rawName, fieldValue );\n\t\t\t\treturn priorityA >= priorityB ? 1 : -1;\n\t\t\t} );\n\n\t\t\treturn sortedNodes.flat();\n\t\t};\n\n\t\tif ( ! pageItems ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet tree = pageItems.map( ( item ) => ( {\n\t\t\tid: item.id,\n\t\t\tparent: item.parent,\n\t\t\tname: getTitle( item ),\n\t\t} ) );\n\n\t\t// Only build a hierarchical tree when not searching.\n\t\tif ( ! fieldValue ) {\n\t\t\ttree = buildTermsTree( tree );\n\t\t}\n\n\t\tconst opts = getOptionsFromTree( tree );\n\n\t\t// Ensure the current parent is in the options list.\n\t\tconst optsHasParent = opts.find(\n\t\t\t( item ) => item.value === parentPostId\n\t\t);\n\t\tif ( parentPostTitle && ! optsHasParent ) {\n\t\t\topts.unshift( {\n\t\t\t\tvalue: parentPostId,\n\t\t\t\tlabel: parentPostTitle,\n\t\t\t} );\n\t\t}\n\t\treturn opts;\n\t}, [ pageItems, fieldValue, parentPostTitle, parentPostId ] );\n\n\tif ( ! isHierarchical ) {\n\t\treturn null;\n\t}\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {Object} selectedPostId The selected Author.\n\t */\n\tconst handleChange = ( selectedPostId ) => {\n\t\teditPost( { parent: selectedPostId } );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"editor-page-attributes__parent\"\n\t\t\tlabel={ __( 'Parent' ) }\n\t\t\tvalue={ parentPostId }\n\t\t\toptions={ parentOptions }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleChange }\n\t\t/>\n\t);\n}\n\nexport default PageAttributesParent;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;;AAIA,SAASU,QAAQA,CAAEC,IAAI,EAAG;EACzB,OAAOA,IAAI,EAAEC,KAAK,EAAEC,QAAQ,GACzB,IAAAC,4BAAc,EAAEH,IAAI,CAACC,KAAK,CAACC,QAAS,CAAC,GACpC,IAAIF,IAAI,CAACI,EAAI,KAAK,IAAAC,QAAE,EAAE,UAAW,CAAG,GAAE;AAC3C;AAEO,MAAMC,eAAe,GAAGA,CAAEC,IAAI,EAAEC,WAAW,KAA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uD,aAAa,GAAKC,UAAU,IAAM;IACvC1D,aAAa,CAAE0D,UAAW,CAAC;EAC5B,CAAC;;EAED;AACD;AACA;AACA;AACA;EACC,MAAMC,YAAY,GAAKC,cAAc,IAAM;IAC1ChE,QAAQ,CAAE;MAAEuD,MAAM,EAAES;IAAe,CAAE,CAAC;EACvC,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAC7F,WAAA,CAAA8F,eAAe;IACfC,uBAAuB;IACvBC,qBAAqB;IACrBC,SAAS,EAAC,gCAAgC;IAC1C3B,KAAK,EAAG,IAAAxD,QAAE,EAAE,QAAS,CAAG;IACxBuD,KAAK,EAAGnC,YAAc;IACtBgE,OAAO,EAAGrC,aAAe;IACzBsC,mBAAmB,EAAG,IAAAC,iBAAQ,EAAEZ,aAAa,EAAE,GAAI,CAAG;IACtDa,QAAQ,EAAGX;EAAc,CACzB,CAAC;AAEJ;AAAC,IAAAY,QAAA,GAEc5E,oBAAoB;AAAAD,OAAA,CAAA8E,OAAA,GAAAD,QAAA"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = PostAuthorCheck;
|
|
8
|
-
var
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _data = require("@wordpress/data");
|
|
10
10
|
var _coreData = require("@wordpress/core-data");
|
|
11
11
|
var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
|
|
@@ -37,7 +37,7 @@ function PostAuthorCheck({
|
|
|
37
37
|
if (!hasAssignAuthorAction || !hasAuthors) {
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
|
-
return (0,
|
|
40
|
+
return (0, _react.createElement)(_postTypeSupportCheck.default, {
|
|
41
41
|
supportKeys: "author"
|
|
42
42
|
}, children);
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_postTypeSupportCheck","_interopRequireDefault","_store","_constants","PostAuthorCheck","children","hasAssignAuthorAction","hasAuthors","useSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","authors","coreStore","getUsers","AUTHORS_QUERY","_links","length","
|
|
1
|
+
{"version":3,"names":["_data","require","_coreData","_postTypeSupportCheck","_interopRequireDefault","_store","_constants","PostAuthorCheck","children","hasAssignAuthorAction","hasAuthors","useSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","authors","coreStore","getUsers","AUTHORS_QUERY","_links","length","_react","createElement","default","supportKeys"],"sources":["@wordpress/editor/src/components/post-author/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nexport default function PostAuthorCheck( { children } ) {\n\tconst { hasAssignAuthorAction, hasAuthors } = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst authors = select( coreStore ).getUsers( AUTHORS_QUERY );\n\t\treturn {\n\t\t\thasAssignAuthorAction:\n\t\t\t\tpost._links?.[ 'wp:action-assign-author' ] ?? false,\n\t\t\thasAuthors: authors?.length >= 1,\n\t\t};\n\t}, [] );\n\n\tif ( ! hasAssignAuthorAction || ! hasAuthors ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"author\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,qBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKe,SAASM,eAAeA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACvD,MAAM;IAAEC,qBAAqB;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,oBAAA;IACtE,MAAMC,IAAI,GAAGF,MAAM,CAAEG,YAAY,CAAC,CAACC,cAAc,CAAC,CAAC;IACnD,MAAMC,OAAO,GAAGL,MAAM,CAAEM,eAAU,CAAC,CAACC,QAAQ,CAAEC,wBAAc,CAAC;IAC7D,OAAO;MACNX,qBAAqB,GAAAI,oBAAA,GACpBC,IAAI,CAACO,MAAM,GAAI,yBAAyB,CAAE,cAAAR,oBAAA,cAAAA,oBAAA,GAAI,KAAK;MACpDH,UAAU,EAAEO,OAAO,EAAEK,MAAM,IAAI;IAChC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEb,qBAAqB,IAAI,CAAEC,UAAU,EAAG;IAC9C,OAAO,IAAI;EACZ;EAEA,OACC,IAAAa,MAAA,CAAAC,aAAA,EAACrB,qBAAA,CAAAsB,OAAoB;IAACC,WAAW,EAAC;EAAQ,GACvClB,QACmB,CAAC;AAEzB"}
|
|
@@ -4,8 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("react");
|
|
8
8
|
var _compose = require("@wordpress/compose");
|
|
9
|
+
var _element = require("@wordpress/element");
|
|
9
10
|
var _data = require("@wordpress/data");
|
|
10
11
|
var _i18n = require("@wordpress/i18n");
|
|
11
12
|
var _components = require("@wordpress/components");
|
|
@@ -102,7 +103,7 @@ function PostAuthorCombobox() {
|
|
|
102
103
|
if (!postAuthor) {
|
|
103
104
|
return null;
|
|
104
105
|
}
|
|
105
|
-
return (0,
|
|
106
|
+
return (0, _react.createElement)(_components.ComboboxControl, {
|
|
106
107
|
__nextHasNoMarginBottom: true,
|
|
107
108
|
__next40pxDefaultSize: true,
|
|
108
109
|
label: (0, _i18n.__)('Author'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_compose","require","_element","_data","_i18n","_components","_htmlEntities","_coreData","_store","_constants","PostAuthorCombobox","fieldValue","setFieldValue","useState","authorId","isLoading","authors","postAuthor","useSelect","select","getUser","getUsers","isResolving","coreStore","getEditedPostAttribute","editorStore","author","context","query","AUTHORS_QUERY","search","editPost","useDispatch","authorOptions","useMemo","fetchedAuthors","map","value","id","label","decodeEntities","name","foundAuthor","findIndex","handleSelect","postAuthorId","handleKeydown","inputValue","_react","createElement","ComboboxControl","__nextHasNoMarginBottom","__next40pxDefaultSize","__","options","onFilterValueChange","debounce","onChange","allowReset","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-author/combobox.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nfunction PostAuthorCombobox() {\n\tconst [ fieldValue, setFieldValue ] = useState();\n\n\tconst { authorId, isLoading, authors, postAuthor } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser, getUsers, isResolving } = select( coreStore );\n\t\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\t\tconst author = getUser( getEditedPostAttribute( 'author' ), {\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\t\tconst query = { ...AUTHORS_QUERY };\n\n\t\t\tif ( fieldValue ) {\n\t\t\t\tquery.search = fieldValue;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tauthorId: getEditedPostAttribute( 'author' ),\n\t\t\t\tpostAuthor: author,\n\t\t\t\tauthors: getUsers( query ),\n\t\t\t\tisLoading: isResolving( 'core', 'getUsers', [ query ] ),\n\t\t\t};\n\t\t},\n\t\t[ fieldValue ]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst authorOptions = useMemo( () => {\n\t\tconst fetchedAuthors = ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\n\t\t// Ensure the current author is included in the dropdown list.\n\t\tconst foundAuthor = fetchedAuthors.findIndex(\n\t\t\t( { value } ) => postAuthor?.id === value\n\t\t);\n\n\t\tif ( foundAuthor < 0 && postAuthor ) {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tvalue: postAuthor.id,\n\t\t\t\t\tlabel: decodeEntities( postAuthor.name ),\n\t\t\t\t},\n\t\t\t\t...fetchedAuthors,\n\t\t\t];\n\t\t}\n\n\t\treturn fetchedAuthors;\n\t}, [ authors, postAuthor ] );\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {number} postAuthorId The selected Author.\n\t */\n\tconst handleSelect = ( postAuthorId ) => {\n\t\tif ( ! postAuthorId ) {\n\t\t\treturn;\n\t\t}\n\t\teditPost( { author: postAuthorId } );\n\t};\n\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\tif ( ! postAuthor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tvalue={ authorId }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleSelect }\n\t\t\tisLoading={ isLoading }\n\t\t\tallowReset={ false }\n\t\t/>\n\t);\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IACvBC,qBAAqB;IACrBb,KAAK,EAAG,IAAAc,QAAE,EAAE,QAAS,CAAG;IACxBC,OAAO,EAAGrB,aAAe;IACzBI,KAAK,EAAGvB,QAAU;IAClByC,mBAAmB,EAAG,IAAAC,iBAAQ,EAAEV,aAAa,EAAE,GAAI,CAAG;IACtDW,QAAQ,EAAGb,YAAc;IACzB7B,SAAS,EAAGA,SAAW;IACvB2C,UAAU,EAAG;EAAO,CACpB,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEcjD,kBAAkB;AAAAkD,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _data = require("@wordpress/data");
|
|
10
10
|
var _coreData = require("@wordpress/core-data");
|
|
11
11
|
var _combobox = _interopRequireDefault(require("./combobox"));
|
|
@@ -26,9 +26,9 @@ function PostAuthor() {
|
|
|
26
26
|
return authors?.length >= minimumUsersForCombobox;
|
|
27
27
|
}, []);
|
|
28
28
|
if (showCombobox) {
|
|
29
|
-
return (0,
|
|
29
|
+
return (0, _react.createElement)(_combobox.default, null);
|
|
30
30
|
}
|
|
31
|
-
return (0,
|
|
31
|
+
return (0, _react.createElement)(_select.default, null);
|
|
32
32
|
}
|
|
33
33
|
var _default = PostAuthor;
|
|
34
34
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_combobox","_interopRequireDefault","_select","_constants","minimumUsersForCombobox","PostAuthor","showCombobox","useSelect","select","authors","coreStore","getUsers","AUTHORS_QUERY","length","
|
|
1
|
+
{"version":3,"names":["_data","require","_coreData","_combobox","_interopRequireDefault","_select","_constants","minimumUsersForCombobox","PostAuthor","showCombobox","useSelect","select","authors","coreStore","getUsers","AUTHORS_QUERY","length","_react","createElement","default","_default","exports"],"sources":["@wordpress/editor/src/components/post-author/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostAuthorCombobox from './combobox';\nimport PostAuthorSelect from './select';\nimport { AUTHORS_QUERY } from './constants';\n\nconst minimumUsersForCombobox = 25;\n\nfunction PostAuthor() {\n\tconst showCombobox = useSelect( ( select ) => {\n\t\tconst authors = select( coreStore ).getUsers( AUTHORS_QUERY );\n\n\t\treturn authors?.length >= minimumUsersForCombobox;\n\t}, [] );\n\n\tif ( showCombobox ) {\n\t\treturn <PostAuthorCombobox />;\n\t}\n\treturn <PostAuthorSelect />;\n}\n\nexport default PostAuthor;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA,MAAMM,uBAAuB,GAAG,EAAE;AAElC,SAASC,UAAUA,CAAA,EAAG;EACrB,MAAMC,YAAY,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC7C,MAAMC,OAAO,GAAGD,MAAM,CAAEE,eAAU,CAAC,CAACC,QAAQ,CAAEC,wBAAc,CAAC;IAE7D,OAAOH,OAAO,EAAEI,MAAM,IAAIT,uBAAuB;EAClD,CAAC,EAAE,EAAG,CAAC;EAEP,IAAKE,YAAY,EAAG;IACnB,OAAO,IAAAQ,MAAA,CAAAC,aAAA,EAACf,SAAA,CAAAgB,OAAkB,MAAE,CAAC;EAC9B;EACA,OAAO,IAAAF,MAAA,CAAAC,aAAA,EAACb,OAAA,CAAAc,OAAgB,MAAE,CAAC;AAC5B;AAAC,IAAAC,QAAA,GAEcZ,UAAU;AAAAa,OAAA,CAAAF,OAAA,GAAAC,QAAA"}
|
|
@@ -4,8 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("react");
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
|
+
var _element = require("@wordpress/element");
|
|
9
10
|
var _data = require("@wordpress/data");
|
|
10
11
|
var _htmlEntities = require("@wordpress/html-entities");
|
|
11
12
|
var _components = require("@wordpress/components");
|
|
@@ -47,7 +48,7 @@ function PostAuthorSelect() {
|
|
|
47
48
|
author
|
|
48
49
|
});
|
|
49
50
|
};
|
|
50
|
-
return (0,
|
|
51
|
+
return (0, _react.createElement)(_components.SelectControl, {
|
|
51
52
|
__nextHasNoMarginBottom: true,
|
|
52
53
|
className: "post-author-selector",
|
|
53
54
|
label: (0, _i18n.__)('Author'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_i18n","require","_element","_data","_htmlEntities","_components","_coreData","_store","_constants","PostAuthorSelect","editPost","useDispatch","editorStore","postAuthor","authors","useSelect","select","getEditedPostAttribute","coreStore","getUsers","AUTHORS_QUERY","authorOptions","useMemo","map","author","value","id","label","decodeEntities","name","setAuthorId","Number","_react","createElement","SelectControl","__nextHasNoMarginBottom","className","__","options","onChange","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-author/select.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { SelectControl } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nfunction PostAuthorSelect() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { postAuthor, authors } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostAuthor:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'author' ),\n\t\t\tauthors: select( coreStore ).getUsers( AUTHORS_QUERY ),\n\t\t};\n\t}, [] );\n\n\tconst authorOptions = useMemo( () => {\n\t\treturn ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\t}, [ authors ] );\n\n\tconst setAuthorId = ( value ) => {\n\t\tconst author = Number( value );\n\t\teditPost( { author } );\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"post-author-selector\"\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tonChange={ setAuthorId }\n\t\t\tvalue={ postAuthor }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorSelect;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIA,SAASQ,gBAAgBA,CAAA,EAAG;EAC3B,MAAM;IAAEC;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAY,CAAC;EAC/C,MAAM;IAAEC,UAAU;IAAEC;EAAQ,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACxD,OAAO;MACNH,UAAU,EACTG,MAAM,CAAEJ,YAAY,CAAC,CAACK,sBAAsB,CAAE,QAAS,CAAC;MACzDH,OAAO,EAAEE,MAAM,CAAEE,eAAU,CAAC,CAACC,QAAQ,CAAEC,wBAAc;IACtD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,aAAa,GAAG,IAAAC,gBAAO,EAAE,MAAM;IACpC,OAAO,CAAER,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,EAAE,EAAGS,GAAG,CAAIC,MAAM,IAAM;MAC3C,OAAO;QACNC,KAAK,EAAED,MAAM,CAACE,EAAE;QAChBC,KAAK,EAAE,IAAAC,4BAAc,EAAEJ,MAAM,CAACK,IAAK;MACpC,CAAC;IACF,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEf,OAAO,CAAG,CAAC;EAEhB,MAAMgB,WAAW,GAAKL,KAAK,IAAM;IAChC,MAAMD,MAAM,GAAGO,MAAM,CAAEN,KAAM,CAAC;IAC9Bf,QAAQ,CAAE;MAAEc;IAAO,CAAE,CAAC;EACvB,CAAC;EAED,OACC,IAAAQ,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAA6B,aAAa;IACbC,uBAAuB;IACvBC,SAAS,EAAC,sBAAsB;IAChCT,KAAK,EAAG,IAAAU,QAAE,EAAE,QAAS,CAAG;IACxBC,OAAO,EAAGjB,aAAe;IACzBkB,QAAQ,EAAGT,WAAa;IACxBL,KAAK,EAAGZ;EAAY,CACpB,CAAC;AAEJ;AAAC,IAAA2B,QAAA,GAEc/B,gBAAgB;AAAAgC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("react");
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
@@ -28,7 +28,7 @@ function PostComments() {
|
|
|
28
28
|
const onToggleComments = () => editPost({
|
|
29
29
|
comment_status: commentStatus === 'open' ? 'closed' : 'open'
|
|
30
30
|
});
|
|
31
|
-
return (0,
|
|
31
|
+
return (0, _react.createElement)(_components.CheckboxControl, {
|
|
32
32
|
__nextHasNoMarginBottom: true,
|
|
33
33
|
label: (0, _i18n.__)('Allow comments'),
|
|
34
34
|
checked: commentStatus === 'open',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_store","PostComments","commentStatus","useSelect","select","_select$getEditedPost","editorStore","getEditedPostAttribute","editPost","useDispatch","onToggleComments","comment_status","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_store","PostComments","commentStatus","useSelect","select","_select$getEditedPost","editorStore","getEditedPostAttribute","editPost","useDispatch","onToggleComments","comment_status","_react","createElement","CheckboxControl","__nextHasNoMarginBottom","label","__","checked","onChange","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-comments/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostComments() {\n\tconst commentStatus = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'comment_status' ) ??\n\t\t\t'open',\n\t\t[]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\tconst onToggleComments = () =>\n\t\teditPost( {\n\t\t\tcomment_status: commentStatus === 'open' ? 'closed' : 'open',\n\t\t} );\n\n\treturn (\n\t\t<CheckboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Allow comments' ) }\n\t\t\tchecked={ commentStatus === 'open' }\n\t\t\tonChange={ onToggleComments }\n\t\t/>\n\t);\n}\n\nexport default PostComments;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,SAASI,YAAYA,CAAA,EAAG;EACvB,MAAMC,aAAa,GAAG,IAAAC,eAAS,EAC5BC,MAAM;IAAA,IAAAC,qBAAA;IAAA,QAAAA,qBAAA,GACPD,MAAM,CAAEE,YAAY,CAAC,CAACC,sBAAsB,CAAE,gBAAiB,CAAC,cAAAF,qBAAA,cAAAA,qBAAA,GAChE,MAAM;EAAA,GACP,EACD,CAAC;EACD,MAAM;IAAEG;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAY,CAAC;EAC/C,MAAMI,gBAAgB,GAAGA,CAAA,KACxBF,QAAQ,CAAE;IACTG,cAAc,EAAET,aAAa,KAAK,MAAM,GAAG,QAAQ,GAAG;EACvD,CAAE,CAAC;EAEJ,OACC,IAAAU,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAgB,eAAe;IACfC,uBAAuB;IACvBC,KAAK,EAAG,IAAAC,QAAE,EAAE,gBAAiB,CAAG;IAChCC,OAAO,EAAGhB,aAAa,KAAK,MAAQ;IACpCiB,QAAQ,EAAGT;EAAkB,CAC7B,CAAC;AAEJ;AAAC,IAAAU,QAAA,GAEcnB,YAAY;AAAAoB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
@@ -14,7 +14,7 @@ var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support
|
|
|
14
14
|
function PostExcerptCheck({
|
|
15
15
|
children
|
|
16
16
|
}) {
|
|
17
|
-
return (0,
|
|
17
|
+
return (0, _react.createElement)(_postTypeSupportCheck.default, {
|
|
18
18
|
supportKeys: "excerpt"
|
|
19
19
|
}, children);
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_postTypeSupportCheck","_interopRequireDefault","require","PostExcerptCheck","children","
|
|
1
|
+
{"version":3,"names":["_postTypeSupportCheck","_interopRequireDefault","require","PostExcerptCheck","children","_react","createElement","default","supportKeys","_default","exports"],"sources":["@wordpress/editor/src/components/post-excerpt/check.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nfunction PostExcerptCheck( { children } ) {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"excerpt\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default PostExcerptCheck;\n"],"mappings":";;;;;;;;AAGA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA,SAASC,gBAAgBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACzC,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACN,qBAAA,CAAAO,OAAoB;IAACC,WAAW,EAAC;EAAS,GACxCJ,QACmB,CAAC;AAEzB;AAAC,IAAAK,QAAA,GAEcN,gBAAgB;AAAAO,OAAA,CAAAH,OAAA,GAAAE,QAAA"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("react");
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
@@ -22,9 +22,9 @@ function PostExcerpt() {
|
|
|
22
22
|
const {
|
|
23
23
|
editPost
|
|
24
24
|
} = (0, _data.useDispatch)(_store.store);
|
|
25
|
-
return (0,
|
|
25
|
+
return (0, _react.createElement)("div", {
|
|
26
26
|
className: "editor-post-excerpt"
|
|
27
|
-
}, (0,
|
|
27
|
+
}, (0, _react.createElement)(_components.TextareaControl, {
|
|
28
28
|
__nextHasNoMarginBottom: true,
|
|
29
29
|
label: (0, _i18n.__)('Write an excerpt (optional)'),
|
|
30
30
|
className: "editor-post-excerpt__textarea",
|
|
@@ -32,7 +32,7 @@ function PostExcerpt() {
|
|
|
32
32
|
excerpt: value
|
|
33
33
|
}),
|
|
34
34
|
value: excerpt
|
|
35
|
-
}), (0,
|
|
35
|
+
}), (0, _react.createElement)(_components.ExternalLink, {
|
|
36
36
|
href: (0, _i18n.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt')
|
|
37
37
|
}, (0, _i18n.__)('Learn more about manual excerpts')));
|
|
38
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_store","PostExcerpt","excerpt","useSelect","select","editorStore","getEditedPostAttribute","editPost","useDispatch","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_store","PostExcerpt","excerpt","useSelect","select","editorStore","getEditedPostAttribute","editPost","useDispatch","_react","createElement","className","TextareaControl","__nextHasNoMarginBottom","label","__","onChange","value","ExternalLink","href","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-excerpt/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ExternalLink, TextareaControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostExcerpt() {\n\tconst excerpt = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostAttribute( 'excerpt' ),\n\t\t[]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\n\treturn (\n\t\t<div className=\"editor-post-excerpt\">\n\t\t\t<TextareaControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Write an excerpt (optional)' ) }\n\t\t\t\tclassName=\"editor-post-excerpt__textarea\"\n\t\t\t\tonChange={ ( value ) => editPost( { excerpt: value } ) }\n\t\t\t\tvalue={ excerpt }\n\t\t\t/>\n\t\t\t<ExternalLink\n\t\t\t\thref={ __(\n\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ __( 'Learn more about manual excerpts' ) }\n\t\t\t</ExternalLink>\n\t\t</div>\n\t);\n}\n\nexport default PostExcerpt;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,SAASI,WAAWA,CAAA,EAAG;EACtB,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,SAAU,CAAC,EACvE,EACD,CAAC;EACD,MAAM;IAAEC;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAY,CAAC;EAE/C,OACC,IAAAI,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAqB,GACnC,IAAAF,MAAA,CAAAC,aAAA,EAACZ,WAAA,CAAAc,eAAe;IACfC,uBAAuB;IACvBC,KAAK,EAAG,IAAAC,QAAE,EAAE,6BAA8B,CAAG;IAC7CJ,SAAS,EAAC,+BAA+B;IACzCK,QAAQ,EAAKC,KAAK,IAAMV,QAAQ,CAAE;MAAEL,OAAO,EAAEe;IAAM,CAAE,CAAG;IACxDA,KAAK,EAAGf;EAAS,CACjB,CAAC,EACF,IAAAO,MAAA,CAAAC,aAAA,EAACZ,WAAA,CAAAoB,YAAY;IACZC,IAAI,EAAG,IAAAJ,QAAE,EACR,iFACD;EAAG,GAED,IAAAA,QAAE,EAAE,kCAAmC,CAC5B,CACV,CAAC;AAER;AAAC,IAAAK,QAAA,GAEcnB,WAAW;AAAAoB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
|
|
10
10
|
var _themeSupportCheck = _interopRequireDefault(require("../theme-support-check"));
|
|
11
11
|
/**
|
|
@@ -15,9 +15,9 @@ var _themeSupportCheck = _interopRequireDefault(require("../theme-support-check"
|
|
|
15
15
|
function PostFeaturedImageCheck({
|
|
16
16
|
children
|
|
17
17
|
}) {
|
|
18
|
-
return (0,
|
|
18
|
+
return (0, _react.createElement)(_themeSupportCheck.default, {
|
|
19
19
|
supportKeys: "post-thumbnails"
|
|
20
|
-
}, (0,
|
|
20
|
+
}, (0, _react.createElement)(_postTypeSupportCheck.default, {
|
|
21
21
|
supportKeys: "thumbnail"
|
|
22
22
|
}, children));
|
|
23
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_postTypeSupportCheck","_interopRequireDefault","require","_themeSupportCheck","PostFeaturedImageCheck","children","
|
|
1
|
+
{"version":3,"names":["_postTypeSupportCheck","_interopRequireDefault","require","_themeSupportCheck","PostFeaturedImageCheck","children","_react","createElement","default","supportKeys","_default","exports"],"sources":["@wordpress/editor/src/components/post-featured-image/check.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport ThemeSupportCheck from '../theme-support-check';\n\nfunction PostFeaturedImageCheck( { children } ) {\n\treturn (\n\t\t<ThemeSupportCheck supportKeys=\"post-thumbnails\">\n\t\t\t<PostTypeSupportCheck supportKeys=\"thumbnail\">\n\t\t\t\t{ children }\n\t\t\t</PostTypeSupportCheck>\n\t\t</ThemeSupportCheck>\n\t);\n}\n\nexport default PostFeaturedImageCheck;\n"],"mappings":";;;;;;;;AAGA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA,SAASE,sBAAsBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC/C,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACJ,kBAAA,CAAAK,OAAiB;IAACC,WAAW,EAAC;EAAiB,GAC/C,IAAAH,MAAA,CAAAC,aAAA,EAACP,qBAAA,CAAAQ,OAAoB;IAACC,WAAW,EAAC;EAAW,GAC1CJ,QACmB,CACJ,CAAC;AAEtB;AAAC,IAAAK,QAAA,GAEcN,sBAAsB;AAAAO,OAAA,CAAAH,OAAA,GAAAE,QAAA"}
|
|
@@ -5,11 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _i18n = require("@wordpress/i18n");
|
|
10
10
|
var _hooks = require("@wordpress/hooks");
|
|
11
11
|
var _components = require("@wordpress/components");
|
|
12
12
|
var _blob = require("@wordpress/blob");
|
|
13
|
+
var _element = require("@wordpress/element");
|
|
13
14
|
var _compose = require("@wordpress/compose");
|
|
14
15
|
var _data = require("@wordpress/data");
|
|
15
16
|
var _blockEditor = require("@wordpress/block-editor");
|
|
@@ -29,7 +30,7 @@ const ALLOWED_MEDIA_TYPES = ['image'];
|
|
|
29
30
|
// Used when labels from post type were not yet loaded or when they are not present.
|
|
30
31
|
const DEFAULT_FEATURE_IMAGE_LABEL = (0, _i18n.__)('Featured image');
|
|
31
32
|
const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0, _i18n.__)('Set featured image');
|
|
32
|
-
const instructions = (0,
|
|
33
|
+
const instructions = (0, _react.createElement)("p", null, (0, _i18n.__)('To edit the featured image, you need permission to upload media.'));
|
|
33
34
|
function getMediaDetails(media, postId) {
|
|
34
35
|
var _media$media_details$, _media$media_details$2;
|
|
35
36
|
if (!media) {
|
|
@@ -99,18 +100,18 @@ function PostFeaturedImage({
|
|
|
99
100
|
}
|
|
100
101
|
});
|
|
101
102
|
}
|
|
102
|
-
return (0,
|
|
103
|
+
return (0, _react.createElement)(_check.default, null, noticeUI, (0, _react.createElement)("div", {
|
|
103
104
|
className: "editor-post-featured-image"
|
|
104
|
-
}, media && (0,
|
|
105
|
+
}, media && (0, _react.createElement)("div", {
|
|
105
106
|
id: `editor-post-featured-image-${featuredImageId}-describedby`,
|
|
106
107
|
className: "hidden"
|
|
107
108
|
}, media.alt_text && (0, _i18n.sprintf)(
|
|
108
109
|
// Translators: %s: The selected image alt text.
|
|
109
110
|
(0, _i18n.__)('Current image: %s'), media.alt_text), !media.alt_text && (0, _i18n.sprintf)(
|
|
110
111
|
// Translators: %s: The selected image filename.
|
|
111
|
-
(0, _i18n.__)('The current image has no alternative text. The file name is: %s'), media.media_details.sizes?.full?.file || media.slug)), (0,
|
|
112
|
+
(0, _i18n.__)('The current image has no alternative text. The file name is: %s'), media.media_details.sizes?.full?.file || media.slug)), (0, _react.createElement)(_blockEditor.MediaUploadCheck, {
|
|
112
113
|
fallback: instructions
|
|
113
|
-
}, (0,
|
|
114
|
+
}, (0, _react.createElement)(_blockEditor.MediaUpload, {
|
|
114
115
|
title: postType?.labels?.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
|
|
115
116
|
onSelect: onUpdateImage,
|
|
116
117
|
unstableFeaturedImageFlow: true,
|
|
@@ -118,36 +119,36 @@ function PostFeaturedImage({
|
|
|
118
119
|
modalClass: "editor-post-featured-image__media-modal",
|
|
119
120
|
render: ({
|
|
120
121
|
open
|
|
121
|
-
}) => (0,
|
|
122
|
+
}) => (0, _react.createElement)("div", {
|
|
122
123
|
className: "editor-post-featured-image__container"
|
|
123
|
-
}, (0,
|
|
124
|
+
}, (0, _react.createElement)(_components.Button, {
|
|
124
125
|
ref: toggleRef,
|
|
125
126
|
className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
|
|
126
127
|
onClick: open,
|
|
127
128
|
"aria-label": !featuredImageId ? null : (0, _i18n.__)('Edit or replace the image'),
|
|
128
129
|
"aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`
|
|
129
|
-
}, !!featuredImageId && media && (0,
|
|
130
|
+
}, !!featuredImageId && media && (0, _react.createElement)(_components.ResponsiveWrapper, {
|
|
130
131
|
naturalWidth: mediaWidth,
|
|
131
132
|
naturalHeight: mediaHeight,
|
|
132
133
|
isInline: true
|
|
133
|
-
}, (0,
|
|
134
|
+
}, (0, _react.createElement)("img", {
|
|
134
135
|
src: mediaSourceUrl,
|
|
135
136
|
alt: ""
|
|
136
|
-
})), isLoading && (0,
|
|
137
|
+
})), isLoading && (0, _react.createElement)(_components.Spinner, null), !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), !!featuredImageId && (0, _react.createElement)(_components.__experimentalHStack, {
|
|
137
138
|
className: "editor-post-featured-image__actions"
|
|
138
|
-
}, (0,
|
|
139
|
+
}, (0, _react.createElement)(_components.Button, {
|
|
139
140
|
className: "editor-post-featured-image__action",
|
|
140
141
|
onClick: open
|
|
141
142
|
// Prefer that screen readers use the .editor-post-featured-image__preview button.
|
|
142
143
|
,
|
|
143
144
|
"aria-hidden": "true"
|
|
144
|
-
}, (0, _i18n.__)('Replace')), (0,
|
|
145
|
+
}, (0, _i18n.__)('Replace')), (0, _react.createElement)(_components.Button, {
|
|
145
146
|
className: "editor-post-featured-image__action",
|
|
146
147
|
onClick: () => {
|
|
147
148
|
onRemoveImage();
|
|
148
149
|
toggleRef.current.focus();
|
|
149
150
|
}
|
|
150
|
-
}, (0, _i18n.__)('Remove'))), (0,
|
|
151
|
+
}, (0, _i18n.__)('Remove'))), (0, _react.createElement)(_components.DropZone, {
|
|
151
152
|
onFilesDrop: onDropFiles
|
|
152
153
|
})),
|
|
153
154
|
value: featuredImageId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_i18n","_hooks","_components","_blob","_compose","_data","_blockEditor","_coreData","_check","_interopRequireDefault","_store","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","__","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","createElement","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","applyFilters","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","toggleRef","useRef","isLoading","setIsLoading","useState","mediaUpload","useSelect","select","blockEditorStore","getSettings","onDropFiles","filesList","allowedTypes","onFileChange","image","isBlobURL","url","onError","message","removeAllNotices","createErrorNotice","default","className","alt_text","sprintf","full","file","slug","MediaUploadCheck","fallback","MediaUpload","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","Button","ref","onClick","ResponsiveWrapper","naturalWidth","naturalHeight","isInline","src","alt","Spinner","set_featured_image","__experimentalHStack","current","focus","DropZone","onFilesDrop","value","applyWithSelect","withSelect","getMedia","getPostType","coreStore","getCurrentPostId","getEditedPostAttribute","editorStore","context","applyWithDispatch","withDispatch","dispatch","editPost","featured_media","onDropImage","_default","compose","withNotices","withFilters","exports"],"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\tResponsiveWrapper,\n\twithNotices,\n\twithFilters,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { isBlobURL } from '@wordpress/blob';\nimport { useState, useRef } from '@wordpress/element';\nimport { compose } from '@wordpress/compose';\nimport { useSelect, withDispatch, withSelect } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Set featured image' );\n\nconst instructions = (\n\t<p>\n\t\t{ __(\n\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t) }\n\t</p>\n);\n\nfunction getMediaDetails( media, postId ) {\n\tif ( ! media ) {\n\t\treturn {};\n\t}\n\n\tconst defaultSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'large',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ defaultSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ defaultSize ].height,\n\t\t\tmediaSourceUrl: media.media_details.sizes[ defaultSize ].source_url,\n\t\t};\n\t}\n\n\t// Use fallbackSize when defaultSize is not available.\n\tconst fallbackSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'thumbnail',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ fallbackSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ fallbackSize ].height,\n\t\t\tmediaSourceUrl:\n\t\t\t\tmedia.media_details.sizes[ fallbackSize ].source_url,\n\t\t};\n\t}\n\n\t// Use full image size when fallbackSize and defaultSize are not available.\n\treturn {\n\t\tmediaWidth: media.media_details.width,\n\t\tmediaHeight: media.media_details.height,\n\t\tmediaSourceUrl: media.source_url,\n\t};\n}\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n\tnoticeOperations,\n} ) {\n\tconst toggleRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst mediaUpload = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).getSettings().mediaUpload;\n\t}, [] );\n\tconst { mediaWidth, mediaHeight, mediaSourceUrl } = getMediaDetails(\n\t\tmedia,\n\t\tcurrentPostId\n\t);\n\n\tfunction onDropFiles( filesList ) {\n\t\tmediaUpload( {\n\t\t\tallowedTypes: [ 'image' ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetIsLoading( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonUpdateImage( image );\n\t\t\t\tsetIsLoading( false );\n\t\t\t},\n\t\t\tonError( message ) {\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tmedia.media_details.sizes?.full?.file ||\n\t\t\t\t\t\t\t\t\tmedia.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostType?.labels?.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Edit or replace the image' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t<ResponsiveWrapper\n\t\t\t\t\t\t\t\t\t\t\tnaturalWidth={ mediaWidth }\n\t\t\t\t\t\t\t\t\t\t\tnaturalHeight={ mediaHeight }\n\t\t\t\t\t\t\t\t\t\t\tisInline\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</ResponsiveWrapper>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isLoading && <Spinner /> }\n\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t! isLoading &&\n\t\t\t\t\t\t\t\t\t\t( postType?.labels\n\t\t\t\t\t\t\t\t\t\t\t?.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t\t\t\t\t<HStack className=\"editor-post-featured-image__actions\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\t\t// Prefer that screen readers use the .editor-post-featured-image__preview button.\n\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t\t\t\t\t\t\ttoggleRef.current.focus();\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropFiles } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType } = select( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\twithFilters( 'editor.PostFeaturedImage' )\n)( PostFeaturedImage );\n"],"mappings":";;;;;;;AAeA,IAAAA,QAAA,GAAAC,OAAA;AAZA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,SAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AA7BA;AACA;AACA;;AAuBA;AACA;AACA;;AAIA,MAAMY,mBAAmB,GAAG,CAAE,OAAO,CAAE;;AAEvC;AACA,MAAMC,2BAA2B,GAAG,IAAAC,QAAE,EAAE,gBAAiB,CAAC;AAC1D,MAAMC,+BAA+B,GAAG,IAAAD,QAAE,EAAE,oBAAqB,CAAC;AAElE,MAAME,YAAY,GACjB,IAAAjB,QAAA,CAAAkB,aAAA,aACG,IAAAH,QAAE,EACH,kEACD,CACE,CACH;AAED,SAASI,eAAeA,CAAEC,KAAK,EAAEC,MAAM,EAAG;EAAA,IAAAC,qBAAA,EAAA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;QAC9C;MACD,CAAE,CAAC;IACL,CAAC;IACDtB,aAAaA,CAAA,EAAG;MACfwE,QAAQ,CAAE;QAAEC,cAAc,EAAE;MAAE,CAAE,CAAC;IAClC;EACD,CAAC;AACF,CACD,CAAC;AAAC,IAAAE,QAAA,GAEa,IAAAC,gBAAO,EACrBC,uBAAW,EACXjB,eAAe,EACfS,iBAAiB,EACjB,IAAAS,uBAAW,EAAE,0BAA2B,CACzC,CAAC,CAAElF,iBAAkB,CAAC;AAAAmF,OAAA,CAAAtD,OAAA,GAAAkD,QAAA"}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_hooks","_components","_blob","_element","_compose","_data","_blockEditor","_coreData","_check","_interopRequireDefault","_store","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","__","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","_react","createElement","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","applyFilters","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","toggleRef","useRef","isLoading","setIsLoading","useState","mediaUpload","useSelect","select","blockEditorStore","getSettings","onDropFiles","filesList","allowedTypes","onFileChange","image","isBlobURL","url","onError","message","removeAllNotices","createErrorNotice","default","className","alt_text","sprintf","full","file","slug","MediaUploadCheck","fallback","MediaUpload","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","Button","ref","onClick","ResponsiveWrapper","naturalWidth","naturalHeight","isInline","src","alt","Spinner","set_featured_image","__experimentalHStack","current","focus","DropZone","onFilesDrop","value","applyWithSelect","withSelect","getMedia","getPostType","coreStore","getCurrentPostId","getEditedPostAttribute","editorStore","context","applyWithDispatch","withDispatch","dispatch","editPost","featured_media","onDropImage","_default","compose","withNotices","withFilters","exports"],"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\tResponsiveWrapper,\n\twithNotices,\n\twithFilters,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { isBlobURL } from '@wordpress/blob';\nimport { useState, useRef } from '@wordpress/element';\nimport { compose } from '@wordpress/compose';\nimport { useSelect, withDispatch, withSelect } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Set featured image' );\n\nconst instructions = (\n\t<p>\n\t\t{ __(\n\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t) }\n\t</p>\n);\n\nfunction getMediaDetails( media, postId ) {\n\tif ( ! media ) {\n\t\treturn {};\n\t}\n\n\tconst defaultSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'large',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ defaultSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ defaultSize ].height,\n\t\t\tmediaSourceUrl: media.media_details.sizes[ defaultSize ].source_url,\n\t\t};\n\t}\n\n\t// Use fallbackSize when defaultSize is not available.\n\tconst fallbackSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'thumbnail',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ fallbackSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ fallbackSize ].height,\n\t\t\tmediaSourceUrl:\n\t\t\t\tmedia.media_details.sizes[ fallbackSize ].source_url,\n\t\t};\n\t}\n\n\t// Use full image size when fallbackSize and defaultSize are not available.\n\treturn {\n\t\tmediaWidth: media.media_details.width,\n\t\tmediaHeight: media.media_details.height,\n\t\tmediaSourceUrl: media.source_url,\n\t};\n}\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n\tnoticeOperations,\n} ) {\n\tconst toggleRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst mediaUpload = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).getSettings().mediaUpload;\n\t}, [] );\n\tconst { mediaWidth, mediaHeight, mediaSourceUrl } = getMediaDetails(\n\t\tmedia,\n\t\tcurrentPostId\n\t);\n\n\tfunction onDropFiles( filesList ) {\n\t\tmediaUpload( {\n\t\t\tallowedTypes: [ 'image' ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetIsLoading( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonUpdateImage( image );\n\t\t\t\tsetIsLoading( false );\n\t\t\t},\n\t\t\tonError( message ) {\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tmedia.media_details.sizes?.full?.file ||\n\t\t\t\t\t\t\t\t\tmedia.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostType?.labels?.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Edit or replace the image' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t<ResponsiveWrapper\n\t\t\t\t\t\t\t\t\t\t\tnaturalWidth={ mediaWidth }\n\t\t\t\t\t\t\t\t\t\t\tnaturalHeight={ mediaHeight }\n\t\t\t\t\t\t\t\t\t\t\tisInline\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</ResponsiveWrapper>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isLoading && <Spinner /> }\n\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t! isLoading &&\n\t\t\t\t\t\t\t\t\t\t( postType?.labels\n\t\t\t\t\t\t\t\t\t\t\t?.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t\t\t\t\t<HStack className=\"editor-post-featured-image__actions\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\t\t// Prefer that screen readers use the .editor-post-featured-image__preview button.\n\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t\t\t\t\t\t\ttoggleRef.current.focus();\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropFiles } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType } = select( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\twithFilters( 'editor.PostFeaturedImage' )\n)( PostFeaturedImage );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,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,SAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AA7BA;AACA;AACA;;AAuBA;AACA;AACA;;AAIA,MAAMY,mBAAmB,GAAG,CAAE,OAAO,CAAE;;AAEvC;AACA,MAAMC,2BAA2B,GAAG,IAAAC,QAAE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AEC,KAAK,CAAE,EAAG;UACzBsD,QAAQ,CAAE;YAAEC,cAAc,EAAEvD,KAAK,CAAChC;UAAG,CAAE,CAAC;QACzC,CAAC;QACDmC,OAAOA,CAAEC,OAAO,EAAG;UAClBnB,gBAAgB,CAACoB,gBAAgB,CAAC,CAAC;UACnCpB,gBAAgB,CAACqB,iBAAiB,CAAEF,OAAQ,CAAC;QAC9C;MACD,CAAE,CAAC;IACL,CAAC;IACDtB,aAAaA,CAAA,EAAG;MACfwE,QAAQ,CAAE;QAAEC,cAAc,EAAE;MAAE,CAAE,CAAC;IAClC;EACD,CAAC;AACF,CACD,CAAC;AAAC,IAAAE,QAAA,GAEa,IAAAC,gBAAO,EACrBC,uBAAW,EACXjB,eAAe,EACfS,iBAAiB,EACjB,IAAAS,uBAAW,EAAE,0BAA2B,CACzC,CAAC,CAAElF,iBAAkB,CAAC;AAAAmF,OAAA,CAAAtD,OAAA,GAAAkD,QAAA"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _data = require("@wordpress/data");
|
|
10
10
|
var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
|
|
11
11
|
var _store = require("../../store");
|
|
@@ -24,7 +24,7 @@ function PostFormatCheck({
|
|
|
24
24
|
if (disablePostFormats) {
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
27
|
-
return (0,
|
|
27
|
+
return (0, _react.createElement)(_postTypeSupportCheck.default, {
|
|
28
28
|
supportKeys: "post-formats"
|
|
29
29
|
}, children);
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_postTypeSupportCheck","_interopRequireDefault","_store","PostFormatCheck","children","disablePostFormats","useSelect","select","editorStore","getEditorSettings","
|
|
1
|
+
{"version":3,"names":["_data","require","_postTypeSupportCheck","_interopRequireDefault","_store","PostFormatCheck","children","disablePostFormats","useSelect","select","editorStore","getEditorSettings","_react","createElement","default","supportKeys","_default","exports"],"sources":["@wordpress/editor/src/components/post-format/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nfunction PostFormatCheck( { children } ) {\n\tconst disablePostFormats = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().disablePostFormats,\n\t\t[]\n\t);\n\n\tif ( disablePostFormats ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"post-formats\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default PostFormatCheck;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,qBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA,SAASI,eAAeA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACxC,MAAMC,kBAAkB,GAAG,IAAAC,eAAS,EACjCC,MAAM,IACPA,MAAM,CAAEC,YAAY,CAAC,CAACC,iBAAiB,CAAC,CAAC,CAACJ,kBAAkB,EAC7D,EACD,CAAC;EAED,IAAKA,kBAAkB,EAAG;IACzB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAK,MAAA,CAAAC,aAAA,EAACX,qBAAA,CAAAY,OAAoB;IAACC,WAAW,EAAC;EAAc,GAC7CT,QACmB,CAAC;AAEzB;AAAC,IAAAU,QAAA,GAEcX,eAAe;AAAAY,OAAA,CAAAH,OAAA,GAAAE,QAAA"}
|