@wordpress/editor 14.16.0 → 14.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +19 -19
- package/build/components/document-outline/check.js +3 -3
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/header/index.js +11 -6
- package/build/components/header/index.js.map +1 -1
- package/build/components/page-attributes/check.js +3 -3
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/post-pending-status/check.js +3 -3
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-schedule/check.js +3 -3
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/post-sticky/check.js +3 -3
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-taxonomies/check.js +1 -1
- package/build/components/post-taxonomies/check.js.map +1 -1
- package/build/components/post-trash/check.js +3 -3
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-type-support-check/index.js +6 -6
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/check.js +3 -3
- package/build/components/post-url/check.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/provider/index.js +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/start-page-options/index.js +15 -6
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +4 -4
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/store/selectors.js +4 -4
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/document-outline/check.js +3 -3
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/header/index.js +11 -6
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/page-attributes/check.js +3 -3
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/post-pending-status/check.js +3 -3
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-schedule/check.js +3 -3
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/post-sticky/check.js +3 -3
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-taxonomies/check.js +1 -1
- package/build-module/components/post-taxonomies/check.js.map +1 -1
- package/build-module/components/post-trash/check.js +3 -3
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js +6 -6
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/check.js +3 -3
- package/build-module/components/post-url/check.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -1
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/provider/index.js +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/start-page-options/index.js +15 -6
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +4 -4
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/store/selectors.js +4 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +11 -23
- package/build-style/style.css +11 -23
- package/build-types/components/document-outline/check.d.ts +5 -5
- package/build-types/components/document-outline/check.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/page-attributes/check.d.ts +5 -5
- package/build-types/components/page-attributes/check.d.ts.map +1 -1
- package/build-types/components/post-pending-status/check.d.ts +5 -5
- package/build-types/components/post-pending-status/check.d.ts.map +1 -1
- package/build-types/components/post-schedule/check.d.ts +5 -5
- package/build-types/components/post-schedule/check.d.ts.map +1 -1
- package/build-types/components/post-sticky/check.d.ts +5 -5
- package/build-types/components/post-sticky/check.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/check.d.ts +2 -2
- package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
- package/build-types/components/post-trash/check.d.ts +5 -5
- package/build-types/components/post-trash/check.d.ts.map +1 -1
- package/build-types/components/post-type-support-check/index.d.ts +8 -8
- package/build-types/components/post-type-support-check/index.d.ts.map +1 -1
- package/build-types/components/post-url/check.d.ts +5 -5
- package/build-types/components/post-url/check.d.ts.map +1 -1
- package/build-types/components/start-page-options/index.d.ts.map +1 -1
- package/build-types/components/theme-support-check/index.d.ts +6 -6
- package/build-types/components/theme-support-check/index.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +4 -4
- package/build-types/store/selectors.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/components/document-bar/style.scss +4 -2
- package/src/components/document-outline/check.js +3 -3
- package/src/components/document-tools/style.scss +3 -2
- package/src/components/header/index.js +18 -21
- package/src/components/page-attributes/check.js +3 -3
- package/src/components/post-featured-image/style.scss +4 -2
- package/src/components/post-pending-status/check.js +3 -3
- package/src/components/post-publish-panel/style.scss +5 -3
- package/src/components/post-schedule/check.js +3 -3
- package/src/components/post-sticky/check.js +3 -3
- package/src/components/post-taxonomies/check.js +1 -1
- package/src/components/post-text-editor/style.scss +4 -2
- package/src/components/post-trash/check.js +3 -3
- package/src/components/post-type-support-check/index.js +6 -6
- package/src/components/post-url/check.js +3 -3
- package/src/components/preferences-modal/index.js +1 -1
- package/src/components/provider/index.js +2 -2
- package/src/components/start-page-options/index.js +20 -12
- package/src/components/theme-support-check/index.js +4 -4
- package/src/store/selectors.js +4 -4
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -293,11 +293,11 @@ Component check if there are any headings (core/heading blocks) present in the d
|
|
|
293
293
|
_Parameters_
|
|
294
294
|
|
|
295
295
|
- _props_ `Object`: Props.
|
|
296
|
-
- _props.children_ `React.
|
|
296
|
+
- _props.children_ `React.ReactNode`: Children to be rendered.
|
|
297
297
|
|
|
298
298
|
_Returns_
|
|
299
299
|
|
|
300
|
-
- `React.
|
|
300
|
+
- `React.ReactNode`: The component to be rendered or null if there are headings.
|
|
301
301
|
|
|
302
302
|
### EditorHistoryRedo
|
|
303
303
|
|
|
@@ -524,11 +524,11 @@ Wrapper component that renders its children only if the post type supports page
|
|
|
524
524
|
_Parameters_
|
|
525
525
|
|
|
526
526
|
- _props_ `Object`: - The component props.
|
|
527
|
-
- _props.children_ `React.
|
|
527
|
+
- _props.children_ `React.ReactNode`: - The child components to render.
|
|
528
528
|
|
|
529
529
|
_Returns_
|
|
530
530
|
|
|
531
|
-
- `React.
|
|
531
|
+
- `React.ReactNode`: The rendered child components or null if page attributes are not supported.
|
|
532
532
|
|
|
533
533
|
### PageAttributesOrder
|
|
534
534
|
|
|
@@ -1211,11 +1211,11 @@ This component checks the publishing status of the current post. If the post is
|
|
|
1211
1211
|
_Parameters_
|
|
1212
1212
|
|
|
1213
1213
|
- _props_ `Object`: Component properties.
|
|
1214
|
-
- _props.children_ `React.
|
|
1214
|
+
- _props.children_ `React.ReactNode`: Children to be rendered.
|
|
1215
1215
|
|
|
1216
1216
|
_Returns_
|
|
1217
1217
|
|
|
1218
|
-
- `React.
|
|
1218
|
+
- `React.ReactNode`: The rendered child elements or null if the post is already published or the user doesn't have the capability to publish.
|
|
1219
1219
|
|
|
1220
1220
|
### PostPingbacks
|
|
1221
1221
|
|
|
@@ -1287,11 +1287,11 @@ Wrapper component that renders its children only if post has a publish action.
|
|
|
1287
1287
|
_Parameters_
|
|
1288
1288
|
|
|
1289
1289
|
- _props_ `Object`: Props.
|
|
1290
|
-
- _props.children_ `React.
|
|
1290
|
+
- _props.children_ `React.ReactNode`: Children to be rendered.
|
|
1291
1291
|
|
|
1292
1292
|
_Returns_
|
|
1293
1293
|
|
|
1294
|
-
- `React.
|
|
1294
|
+
- `React.ReactNode`: - The component to be rendered or null if there is no publish action.
|
|
1295
1295
|
|
|
1296
1296
|
### PostScheduleLabel
|
|
1297
1297
|
|
|
@@ -1328,11 +1328,11 @@ Wrapper component that renders its children only if post has a sticky action.
|
|
|
1328
1328
|
_Parameters_
|
|
1329
1329
|
|
|
1330
1330
|
- _props_ `Object`: Props.
|
|
1331
|
-
- _props.children_ `React.
|
|
1331
|
+
- _props.children_ `React.ReactNode`: Children to be rendered.
|
|
1332
1332
|
|
|
1333
1333
|
_Returns_
|
|
1334
1334
|
|
|
1335
|
-
- `React.
|
|
1335
|
+
- `React.ReactNode`: The component to be rendered or null if post type is not 'post' or hasStickyAction is false.
|
|
1336
1336
|
|
|
1337
1337
|
### PostSwitchToDraftButton
|
|
1338
1338
|
|
|
@@ -1374,7 +1374,7 @@ _Parameters_
|
|
|
1374
1374
|
|
|
1375
1375
|
_Returns_
|
|
1376
1376
|
|
|
1377
|
-
- `React.
|
|
1377
|
+
- `React.ReactNode`: The rendered children components or null if the current post type has no taxonomies.
|
|
1378
1378
|
|
|
1379
1379
|
### PostTaxonomiesFlatTermSelector
|
|
1380
1380
|
|
|
@@ -1463,11 +1463,11 @@ Wrapper component that renders its children only if the post can be trashed.
|
|
|
1463
1463
|
_Parameters_
|
|
1464
1464
|
|
|
1465
1465
|
- _props_ `Object`: The component props.
|
|
1466
|
-
- _props.children_ `React.
|
|
1466
|
+
- _props.children_ `React.ReactNode`: The child components.
|
|
1467
1467
|
|
|
1468
1468
|
_Returns_
|
|
1469
1469
|
|
|
1470
|
-
- `React.
|
|
1470
|
+
- `React.ReactNode`: The rendered child components or null if the post can't be trashed.
|
|
1471
1471
|
|
|
1472
1472
|
### PostTypeSupportCheck
|
|
1473
1473
|
|
|
@@ -1476,12 +1476,12 @@ A component which renders its own children only if the current editor post type
|
|
|
1476
1476
|
_Parameters_
|
|
1477
1477
|
|
|
1478
1478
|
- _props_ `Object`: Props.
|
|
1479
|
-
- _props.children_ `React.
|
|
1479
|
+
- _props.children_ `React.ReactNode`: Children to be rendered if post type supports.
|
|
1480
1480
|
- _props.supportKeys_ `(string|string[])`: String or string array of keys to test.
|
|
1481
1481
|
|
|
1482
1482
|
_Returns_
|
|
1483
1483
|
|
|
1484
|
-
- `React.
|
|
1484
|
+
- `React.ReactNode`: The component to be rendered.
|
|
1485
1485
|
|
|
1486
1486
|
### PostURL
|
|
1487
1487
|
|
|
@@ -1509,11 +1509,11 @@ Check if the post URL is valid and visible.
|
|
|
1509
1509
|
_Parameters_
|
|
1510
1510
|
|
|
1511
1511
|
- _props_ `Object`: The component props.
|
|
1512
|
-
- _props.children_ `React.
|
|
1512
|
+
- _props.children_ `React.ReactNode`: The child components.
|
|
1513
1513
|
|
|
1514
1514
|
_Returns_
|
|
1515
1515
|
|
|
1516
|
-
- `React.
|
|
1516
|
+
- `React.ReactNode`: The child components if the post URL is valid and visible, otherwise null.
|
|
1517
1517
|
|
|
1518
1518
|
### PostURLLabel
|
|
1519
1519
|
|
|
@@ -1657,12 +1657,12 @@ Checks if the current theme supports specific features and renders the children
|
|
|
1657
1657
|
_Parameters_
|
|
1658
1658
|
|
|
1659
1659
|
- _props_ `Object`: The component props.
|
|
1660
|
-
- _props.children_ `React.
|
|
1660
|
+
- _props.children_ `React.ReactNode`: The children to render if the theme supports the specified features.
|
|
1661
1661
|
- _props.supportKeys_ `string|string[]`: The key(s) of the theme support(s) to check.
|
|
1662
1662
|
|
|
1663
1663
|
_Returns_
|
|
1664
1664
|
|
|
1665
|
-
- `React.
|
|
1665
|
+
- `React.ReactNode`: The rendered children if the theme supports the specified features, otherwise null.
|
|
1666
1666
|
|
|
1667
1667
|
### TimeToRead
|
|
1668
1668
|
|
|
@@ -13,10 +13,10 @@ var _blockEditor = require("@wordpress/block-editor");
|
|
|
13
13
|
/**
|
|
14
14
|
* Component check if there are any headings (core/heading blocks) present in the document.
|
|
15
15
|
*
|
|
16
|
-
* @param {Object}
|
|
17
|
-
* @param {React.
|
|
16
|
+
* @param {Object} props Props.
|
|
17
|
+
* @param {React.ReactNode} props.children Children to be rendered.
|
|
18
18
|
*
|
|
19
|
-
* @return {React.
|
|
19
|
+
* @return {React.ReactNode} The component to be rendered or null if there are headings.
|
|
20
20
|
*/
|
|
21
21
|
function DocumentOutlineCheck({
|
|
22
22
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blockEditor","DocumentOutlineCheck","children","hasHeadings","useSelect","select","getGlobalBlockCount","blockEditorStore"],"sources":["@wordpress/editor/src/components/document-outline/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Component check if there are any headings (core/heading blocks) present in the document.\n *\n * @param {Object}
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","DocumentOutlineCheck","children","hasHeadings","useSelect","select","getGlobalBlockCount","blockEditorStore"],"sources":["@wordpress/editor/src/components/document-outline/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Component check if there are any headings (core/heading blocks) present in the document.\n *\n * @param {Object} props Props.\n * @param {React.ReactNode} props.children Children to be rendered.\n *\n * @return {React.ReactNode} The component to be rendered or null if there are headings.\n */\nexport default function DocumentOutlineCheck( { children } ) {\n\tconst hasHeadings = useSelect( ( select ) => {\n\t\tconst { getGlobalBlockCount } = select( blockEditorStore );\n\n\t\treturn getGlobalBlockCount( 'core/heading' ) > 0;\n\t} );\n\n\tif ( ! hasHeadings ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC5D,MAAMC,WAAW,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5C,MAAM;MAAEC;IAAoB,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IAE1D,OAAOD,mBAAmB,CAAE,cAAe,CAAC,GAAG,CAAC;EACjD,CAAE,CAAC;EAEH,IAAK,CAAEH,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
|
|
@@ -89,7 +89,8 @@ function Header({
|
|
|
89
89
|
isPublishSidebarOpened,
|
|
90
90
|
showIconLabels,
|
|
91
91
|
hasFixedToolbar,
|
|
92
|
-
hasBlockSelection
|
|
92
|
+
hasBlockSelection,
|
|
93
|
+
hasSectionRootClientId
|
|
93
94
|
} = (0, _data.useSelect)(select => {
|
|
94
95
|
const {
|
|
95
96
|
get: getPreference
|
|
@@ -99,21 +100,25 @@ function Header({
|
|
|
99
100
|
getCurrentPostType,
|
|
100
101
|
isPublishSidebarOpened: _isPublishSidebarOpened
|
|
101
102
|
} = select(_store.store);
|
|
103
|
+
const {
|
|
104
|
+
getBlockSelectionStart,
|
|
105
|
+
getSectionRootClientId
|
|
106
|
+
} = (0, _lockUnlock.unlock)(select(_blockEditor.store));
|
|
102
107
|
return {
|
|
103
108
|
postType: getCurrentPostType(),
|
|
104
109
|
isTextEditor: getEditorMode() === 'text',
|
|
105
110
|
isPublishSidebarOpened: _isPublishSidebarOpened(),
|
|
106
111
|
showIconLabels: getPreference('core', 'showIconLabels'),
|
|
107
112
|
hasFixedToolbar: getPreference('core', 'fixedToolbar'),
|
|
108
|
-
hasBlockSelection: !!
|
|
113
|
+
hasBlockSelection: !!getBlockSelectionStart(),
|
|
114
|
+
hasSectionRootClientId: !!getSectionRootClientId()
|
|
109
115
|
};
|
|
110
116
|
}, []);
|
|
111
|
-
const canBeZoomedOut = ['post', 'page', 'wp_template'].includes(postType);
|
|
112
|
-
const disablePreviewOption = [_constants.NAVIGATION_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE, _constants.PATTERN_POST_TYPE].includes(postType);
|
|
117
|
+
const canBeZoomedOut = ['post', 'page', 'wp_template'].includes(postType) && hasSectionRootClientId;
|
|
118
|
+
const disablePreviewOption = [_constants.NAVIGATION_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE, _constants.PATTERN_POST_TYPE].includes(postType) || forceDisableBlockTools;
|
|
113
119
|
const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0, _element.useState)(true);
|
|
114
120
|
const hasCenter = !isTooNarrowForDocumentBar && (!hasFixedToolbar || hasFixedToolbar && (!hasBlockSelection || isBlockToolsCollapsed));
|
|
115
121
|
const hasBackButton = (0, _backButton.useHasBackButton)();
|
|
116
|
-
const hasSectionRootClientId = (0, _data.useSelect)(select => !!(0, _lockUnlock.unlock)(select(_blockEditor.store)).getSectionRootClientId(), []);
|
|
117
122
|
|
|
118
123
|
/*
|
|
119
124
|
* The edit-post-header classname is only kept for backward compatibility
|
|
@@ -172,7 +177,7 @@ function Header({
|
|
|
172
177
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postPreviewButton.default, {
|
|
173
178
|
className: "editor-header__post-preview-button",
|
|
174
179
|
forceIsAutosaveable: forceIsDirty
|
|
175
|
-
}),
|
|
180
|
+
}), isWideViewport && canBeZoomedOut && /*#__PURE__*/(0, _jsxRuntime.jsx)(_zoomOutToggle.default, {
|
|
176
181
|
disabled: forceDisableBlockTools
|
|
177
182
|
}), (isWideViewport || !showIconLabels) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_interface.PinnedItems.Slot, {
|
|
178
183
|
scope: "core"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_data","_compose","_components","_preferences","_element","_interface","_collabSidebar","_interopRequireDefault","_backButton","_interopRequireWildcard","_collapsibleBlockToolbar","_documentBar","_documentTools","_moreMenu","_postPreviewButton","_postPublishButtonOrToggle","_postSavedState","_postViewLink","_previewDropdown","_zoomOutToggle","_store","_constants","_lockUnlock","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","isBlockCommentExperimentEnabled","window","__experimentalEnableBlockComment","toolbarVariations","distractionFreeDisabled","y","distractionFreeHover","distractionFreeHidden","visible","hidden","backButtonVariations","x","Header","customSaveButton","forceIsDirty","forceDisableBlockTools","setEntitiesSavedStatesCallback","title","isWideViewport","useViewportMatch","isLargeViewport","isTooNarrowForDocumentBar","useMediaQuery","postType","isTextEditor","isPublishSidebarOpened","showIconLabels","hasFixedToolbar","hasBlockSelection","useSelect","select","getPreference","preferencesStore","getEditorMode","getCurrentPostType","_isPublishSidebarOpened","editorStore","blockEditorStore","getBlockSelectionStart","canBeZoomedOut","includes","disablePreviewOption","NAVIGATION_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","hasCenter","hasBackButton","useHasBackButton","hasSectionRootClientId","unlock","getSectionRootClientId","jsxs","className","children","jsx","__unstableMotion","div","variants","transition","type","Slot","disableBlockTools","isCollapsed","onToggle","forceIsAutosaveable","disabled","PinnedItems","scope","undefined","_default","exports"],"sources":["@wordpress/editor/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMediaQuery, useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport CollabSidebar from '../collab-sidebar';\nimport BackButton, { useHasBackButton } from './back-button';\nimport CollapsibleBlockToolbar from '../collapsible-block-toolbar';\nimport DocumentBar from '../document-bar';\nimport DocumentTools from '../document-tools';\nimport MoreMenu from '../more-menu';\nimport PostPreviewButton from '../post-preview-button';\nimport PostPublishButtonOrToggle from '../post-publish-button/post-publish-button-or-toggle';\nimport PostSavedState from '../post-saved-state';\nimport PostViewLink from '../post-view-link';\nimport PreviewDropdown from '../preview-dropdown';\nimport ZoomOutToggle from '../zoom-out-toggle';\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst isBlockCommentExperimentEnabled =\n\twindow?.__experimentalEnableBlockComment;\n\nconst toolbarVariations = {\n\tdistractionFreeDisabled: { y: '-50px' },\n\tdistractionFreeHover: { y: 0 },\n\tdistractionFreeHidden: { y: '-50px' },\n\tvisible: { y: 0 },\n\thidden: { y: 0 },\n};\n\nconst backButtonVariations = {\n\tdistractionFreeDisabled: { x: '-100%' },\n\tdistractionFreeHover: { x: 0 },\n\tdistractionFreeHidden: { x: '-100%' },\n\tvisible: { x: 0 },\n\thidden: { x: 0 },\n};\n\nfunction Header( {\n\tcustomSaveButton,\n\tforceIsDirty,\n\tforceDisableBlockTools,\n\tsetEntitiesSavedStatesCallback,\n\ttitle,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isTooNarrowForDocumentBar = useMediaQuery( '(max-width: 403px)' );\n\tconst {\n\t\tpostType,\n\t\tisTextEditor,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasFixedToolbar,\n\t\thasBlockSelection,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorMode,\n\t\t\tgetCurrentPostType,\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened,\n\t\t} = select( editorStore );\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t};\n\t}, [] );\n\n\tconst canBeZoomedOut = [ 'post', 'page', 'wp_template' ].includes(\n\t\tpostType\n\t);\n\n\tconst disablePreviewOption = [\n\t\tNAVIGATION_POST_TYPE,\n\t\tTEMPLATE_PART_POST_TYPE,\n\t\tPATTERN_POST_TYPE,\n\t].includes( postType );\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasCenter =\n\t\t! isTooNarrowForDocumentBar &&\n\t\t( ! hasFixedToolbar ||\n\t\t\t( hasFixedToolbar &&\n\t\t\t\t( ! hasBlockSelection || isBlockToolsCollapsed ) ) );\n\tconst hasBackButton = useHasBackButton();\n\n\tconst hasSectionRootClientId = useSelect(\n\t\t( select ) =>\n\t\t\t!! unlock( select( blockEditorStore ) ).getSectionRootClientId(),\n\t\t[]\n\t);\n\n\t/*\n\t * The edit-post-header classname is only kept for backward compatibility\n\t * as some plugins might be relying on its presence.\n\t */\n\treturn (\n\t\t<div className=\"editor-header edit-post-header\">\n\t\t\t{ hasBackButton && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__back-button\"\n\t\t\t\t\tvariants={ backButtonVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<BackButton.Slot />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\tclassName=\"editor-header__toolbar\"\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t>\n\t\t\t\t<DocumentTools\n\t\t\t\t\tdisableBlockTools={ forceDisableBlockTools || isTextEditor }\n\t\t\t\t/>\n\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t<CollapsibleBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t\t{ hasCenter && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__center\"\n\t\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<DocumentBar title={ title } />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\tclassName=\"editor-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! customSaveButton && ! isPublishSidebarOpened && (\n\t\t\t\t\t/*\n\t\t\t\t\t * This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t * We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t * we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t * We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t * when the publish sidebar has been closed.\n\t\t\t\t\t */\n\t\t\t\t\t<PostSavedState forceIsDirty={ forceIsDirty } />\n\t\t\t\t) }\n\n\t\t\t\t<PostViewLink />\n\n\t\t\t\t<PreviewDropdown\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\tdisabled={ disablePreviewOption }\n\t\t\t\t/>\n\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"editor-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t/>\n\n\t\t\t\t{ canBeZoomedOut &&\n\t\t\t\t\tisWideViewport &&\n\t\t\t\t\thasSectionRootClientId && (\n\t\t\t\t\t\t<ZoomOutToggle disabled={ forceDisableBlockTools } />\n\t\t\t\t\t) }\n\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\n\t\t\t\t{ ! customSaveButton && (\n\t\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t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ACrF,eAAA,CAAAc,OAAc;QAAC4B,YAAY,EAAGA;MAAc,CAAE,CAC/C,eAED,IAAAnC,WAAA,CAAA8E,GAAA,EAACpF,aAAA,CAAAa,OAAY,IAAE,CAAC,eAEhB,IAAAP,WAAA,CAAA8E,GAAA,EAACnF,gBAAA,CAAAY,OAAe;QACfiF,mBAAmB,EAAGrD,YAAc;QACpCsD,QAAQ,EAAG3B;MAAsB,CACjC,CAAC,eAEF,IAAA9D,WAAA,CAAA8E,GAAA,EAACvF,kBAAA,CAAAgB,OAAiB;QACjBqE,SAAS,EAAC,oCAAoC;QAC9CY,mBAAmB,EAAGrD;MAAc,CACpC,CAAC,EAEAyB,cAAc,IACfrB,cAAc,IACdiC,sBAAsB,iBACrB,IAAAxE,WAAA,CAAA8E,GAAA,EAAClF,cAAA,CAAAW,OAAa;QAACkF,QAAQ,EAAGrD;MAAwB,CAAE,CACpD,EAEA,CAAEG,cAAc,IAAI,CAAEQ,cAAc,kBACrC,IAAA/C,WAAA,CAAA8E,GAAA,EAAChG,UAAA,CAAA4G,WAAW,CAACN,IAAI;QAACO,KAAK,EAAC;MAAM,CAAE,CAChC,EAEC,CAAEzD,gBAAgB,iBACnB,IAAAlC,WAAA,CAAA8E,GAAA,EAACtF,0BAAA,CAAAe,OAAyB;QACzB4B,YAAY,EAAGA,YAAc;QAC7BE,8BAA8B,EAC7BA;MACA,CACD,CACD,EAEChB,+BAA+B,gBAChC,IAAArB,WAAA,CAAA8E,GAAA,EAAC/F,cAAA,CAAAwB,OAAa,IAAE,CAAC,GACdqF,SAAS,EAEX1D,gBAAgB,eAClB,IAAAlC,WAAA,CAAA8E,GAAA,EAACxF,SAAA,CAAAiB,OAAQ,IAAE,CAAC;IAAA,CACD,CAAC;EAAA,CACT,CAAC;AAER;AAAC,IAAAsF,QAAA,GAAAC,OAAA,CAAAvF,OAAA,GAEc0B,MAAM","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_data","_compose","_components","_preferences","_element","_interface","_collabSidebar","_interopRequireDefault","_backButton","_interopRequireWildcard","_collapsibleBlockToolbar","_documentBar","_documentTools","_moreMenu","_postPreviewButton","_postPublishButtonOrToggle","_postSavedState","_postViewLink","_previewDropdown","_zoomOutToggle","_store","_constants","_lockUnlock","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","isBlockCommentExperimentEnabled","window","__experimentalEnableBlockComment","toolbarVariations","distractionFreeDisabled","y","distractionFreeHover","distractionFreeHidden","visible","hidden","backButtonVariations","x","Header","customSaveButton","forceIsDirty","forceDisableBlockTools","setEntitiesSavedStatesCallback","title","isWideViewport","useViewportMatch","isLargeViewport","isTooNarrowForDocumentBar","useMediaQuery","postType","isTextEditor","isPublishSidebarOpened","showIconLabels","hasFixedToolbar","hasBlockSelection","hasSectionRootClientId","useSelect","select","getPreference","preferencesStore","getEditorMode","getCurrentPostType","_isPublishSidebarOpened","editorStore","getBlockSelectionStart","getSectionRootClientId","unlock","blockEditorStore","canBeZoomedOut","includes","disablePreviewOption","NAVIGATION_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","hasCenter","hasBackButton","useHasBackButton","jsxs","className","children","jsx","__unstableMotion","div","variants","transition","type","Slot","disableBlockTools","isCollapsed","onToggle","forceIsAutosaveable","disabled","PinnedItems","scope","undefined","_default","exports"],"sources":["@wordpress/editor/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMediaQuery, useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport CollabSidebar from '../collab-sidebar';\nimport BackButton, { useHasBackButton } from './back-button';\nimport CollapsibleBlockToolbar from '../collapsible-block-toolbar';\nimport DocumentBar from '../document-bar';\nimport DocumentTools from '../document-tools';\nimport MoreMenu from '../more-menu';\nimport PostPreviewButton from '../post-preview-button';\nimport PostPublishButtonOrToggle from '../post-publish-button/post-publish-button-or-toggle';\nimport PostSavedState from '../post-saved-state';\nimport PostViewLink from '../post-view-link';\nimport PreviewDropdown from '../preview-dropdown';\nimport ZoomOutToggle from '../zoom-out-toggle';\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst isBlockCommentExperimentEnabled =\n\twindow?.__experimentalEnableBlockComment;\n\nconst toolbarVariations = {\n\tdistractionFreeDisabled: { y: '-50px' },\n\tdistractionFreeHover: { y: 0 },\n\tdistractionFreeHidden: { y: '-50px' },\n\tvisible: { y: 0 },\n\thidden: { y: 0 },\n};\n\nconst backButtonVariations = {\n\tdistractionFreeDisabled: { x: '-100%' },\n\tdistractionFreeHover: { x: 0 },\n\tdistractionFreeHidden: { x: '-100%' },\n\tvisible: { x: 0 },\n\thidden: { x: 0 },\n};\n\nfunction Header( {\n\tcustomSaveButton,\n\tforceIsDirty,\n\tforceDisableBlockTools,\n\tsetEntitiesSavedStatesCallback,\n\ttitle,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isTooNarrowForDocumentBar = useMediaQuery( '(max-width: 403px)' );\n\tconst {\n\t\tpostType,\n\t\tisTextEditor,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasFixedToolbar,\n\t\thasBlockSelection,\n\t\thasSectionRootClientId,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorMode,\n\t\t\tgetCurrentPostType,\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened,\n\t\t} = select( editorStore );\n\t\tconst { getBlockSelectionStart, getSectionRootClientId } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\thasBlockSelection: !! getBlockSelectionStart(),\n\t\t\thasSectionRootClientId: !! getSectionRootClientId(),\n\t\t};\n\t}, [] );\n\n\tconst canBeZoomedOut =\n\t\t[ 'post', 'page', 'wp_template' ].includes( postType ) &&\n\t\thasSectionRootClientId;\n\n\tconst disablePreviewOption =\n\t\t[\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\tPATTERN_POST_TYPE,\n\t\t].includes( postType ) || forceDisableBlockTools;\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasCenter =\n\t\t! isTooNarrowForDocumentBar &&\n\t\t( ! hasFixedToolbar ||\n\t\t\t( hasFixedToolbar &&\n\t\t\t\t( ! hasBlockSelection || isBlockToolsCollapsed ) ) );\n\tconst hasBackButton = useHasBackButton();\n\n\t/*\n\t * The edit-post-header classname is only kept for backward compatibility\n\t * as some plugins might be relying on its presence.\n\t */\n\treturn (\n\t\t<div className=\"editor-header edit-post-header\">\n\t\t\t{ hasBackButton && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__back-button\"\n\t\t\t\t\tvariants={ backButtonVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<BackButton.Slot />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\tclassName=\"editor-header__toolbar\"\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t>\n\t\t\t\t<DocumentTools\n\t\t\t\t\tdisableBlockTools={ forceDisableBlockTools || isTextEditor }\n\t\t\t\t/>\n\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t<CollapsibleBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t\t{ hasCenter && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__center\"\n\t\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<DocumentBar title={ title } />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\tclassName=\"editor-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! customSaveButton && ! isPublishSidebarOpened && (\n\t\t\t\t\t/*\n\t\t\t\t\t * This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t * We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t * we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t * We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t * when the publish sidebar has been closed.\n\t\t\t\t\t */\n\t\t\t\t\t<PostSavedState forceIsDirty={ forceIsDirty } />\n\t\t\t\t) }\n\n\t\t\t\t<PostViewLink />\n\n\t\t\t\t<PreviewDropdown\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\tdisabled={ disablePreviewOption }\n\t\t\t\t/>\n\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"editor-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t/>\n\n\t\t\t\t{ isWideViewport && canBeZoomedOut && (\n\t\t\t\t\t<ZoomOutToggle disabled={ forceDisableBlockTools } />\n\t\t\t\t) }\n\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\n\t\t\t\t{ ! customSaveButton && (\n\t\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ isBlockCommentExperimentEnabled ? (\n\t\t\t\t\t<CollabSidebar />\n\t\t\t\t) : undefined }\n\n\t\t\t\t{ customSaveButton }\n\t\t\t\t<MoreMenu />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAKA,IAAAO,cAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,WAAA,GAAAC,uBAAA,CAAAV,OAAA;AACA,IAAAW,wBAAA,GAAAH,sBAAA,CAAAR,OAAA;AACA,IAAAY,YAAA,GAAAJ,sBAAA,CAAAR,OAAA;AACA,IAAAa,cAAA,GAAAL,sBAAA,CAAAR,OAAA;AACA,IAAAc,SAAA,GAAAN,sBAAA,CAAAR,OAAA;AACA,IAAAe,kBAAA,GAAAP,sBAAA,CAAA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e,OAAyB;QACzB4B,YAAY,EAAGA,YAAc;QAC7BE,8BAA8B,EAC7BA;MACA,CACD,CACD,EAEChB,+BAA+B,gBAChC,IAAArB,WAAA,CAAA8E,GAAA,EAAC/F,cAAA,CAAAwB,OAAa,IAAE,CAAC,GACdqF,SAAS,EAEX1D,gBAAgB,eAClB,IAAAlC,WAAA,CAAA8E,GAAA,EAACxF,SAAA,CAAAiB,OAAQ,IAAE,CAAC;IAAA,CACD,CAAC;EAAA,CACT,CAAC;AAER;AAAC,IAAAsF,QAAA,GAAAC,OAAA,CAAAvF,OAAA,GAEc0B,MAAM","ignoreList":[]}
|
|
@@ -19,10 +19,10 @@ var _store = require("../../store");
|
|
|
19
19
|
/**
|
|
20
20
|
* Wrapper component that renders its children only if the post type supports page attributes.
|
|
21
21
|
*
|
|
22
|
-
* @param {Object}
|
|
23
|
-
* @param {React.
|
|
22
|
+
* @param {Object} props - The component props.
|
|
23
|
+
* @param {React.ReactNode} props.children - The child components to render.
|
|
24
24
|
*
|
|
25
|
-
* @return {React.
|
|
25
|
+
* @return {React.ReactNode} The rendered child components or null if page attributes are not supported.
|
|
26
26
|
*/
|
|
27
27
|
function PageAttributesCheck({
|
|
28
28
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_store","PageAttributesCheck","children","supportsPageAttributes","useSelect","select","getEditedPostAttribute","editorStore","getPostType","coreStore","postType","supports","_default","exports","default"],"sources":["@wordpress/editor/src/components/page-attributes/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 { store as editorStore } from '../../store';\n\n/**\n * Wrapper component that renders its children only if the post type supports page attributes.\n *\n * @param {Object}
|
|
1
|
+
{"version":3,"names":["_data","require","_coreData","_store","PageAttributesCheck","children","supportsPageAttributes","useSelect","select","getEditedPostAttribute","editorStore","getPostType","coreStore","postType","supports","_default","exports","default"],"sources":["@wordpress/editor/src/components/page-attributes/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 { store as editorStore } from '../../store';\n\n/**\n * Wrapper component that renders its children only if the post type supports page attributes.\n *\n * @param {Object} props - The component props.\n * @param {React.ReactNode} props.children - The child components to render.\n *\n * @return {React.ReactNode} The rendered child components or null if page attributes are not supported.\n */\nexport function PageAttributesCheck( { children } ) {\n\tconst supportsPageAttributes = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn !! postType?.supports?.[ 'page-attributes' ];\n\t}, [] );\n\n\t// Only render fields if post type supports page attributes or available templates exist.\n\tif ( ! supportsPageAttributes ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default PageAttributesCheck;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,mBAAmBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACnD,MAAMC,sBAAsB,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACvD,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IACxD,MAAM;MAAEC;IAAY,CAAC,GAAGH,MAAM,CAAEI,eAAU,CAAC;IAC3C,MAAMC,QAAQ,GAAGF,WAAW,CAAEF,sBAAsB,CAAE,MAAO,CAAE,CAAC;IAEhE,OAAO,CAAC,CAAEI,QAAQ,EAAEC,QAAQ,GAAI,iBAAiB,CAAE;EACpD,CAAC,EAAE,EAAG,CAAC;;EAEP;EACA,IAAK,CAAER,sBAAsB,EAAG;IAC/B,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB;AAAC,IAAAU,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcb,mBAAmB","ignoreList":[]}
|
|
@@ -20,10 +20,10 @@ var _store = require("../../store");
|
|
|
20
20
|
* If the post is already published or the user doesn't have the
|
|
21
21
|
* capability to publish, it returns null.
|
|
22
22
|
*
|
|
23
|
-
* @param {Object}
|
|
24
|
-
* @param {React.
|
|
23
|
+
* @param {Object} props Component properties.
|
|
24
|
+
* @param {React.ReactNode} props.children Children to be rendered.
|
|
25
25
|
*
|
|
26
|
-
* @return {React.
|
|
26
|
+
* @return {React.ReactNode} The rendered child elements or null if the post is already published or the user doesn't have the capability to publish.
|
|
27
27
|
*/
|
|
28
28
|
function PostPendingStatusCheck({
|
|
29
29
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_store","PostPendingStatusCheck","children","hasPublishAction","isPublished","useSelect","select","_getCurrentPost$_link","isCurrentPostPublished","getCurrentPost","editorStore","_links","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-pending-status/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * This component checks the publishing status of the current post.\n * If the post is already published or the user doesn't have the\n * capability to publish, it returns null.\n *\n * @param {Object}
|
|
1
|
+
{"version":3,"names":["_data","require","_store","PostPendingStatusCheck","children","hasPublishAction","isPublished","useSelect","select","_getCurrentPost$_link","isCurrentPostPublished","getCurrentPost","editorStore","_links","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-pending-status/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * This component checks the publishing status of the current post.\n * If the post is already published or the user doesn't have the\n * capability to publish, it returns null.\n *\n * @param {Object} props Component properties.\n * @param {React.ReactNode} props.children Children to be rendered.\n *\n * @return {React.ReactNode} The rendered child elements or null if the post is already published or the user doesn't have the capability to publish.\n */\nexport function PostPendingStatusCheck( { children } ) {\n\tconst { hasPublishAction, isPublished } = useSelect( ( select ) => {\n\t\tconst { isCurrentPostPublished, getCurrentPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t};\n\t}, [] );\n\n\tif ( isPublished || ! hasPublishAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default PostPendingStatusCheck;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,sBAAsBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACtD,MAAM;IAAEC,gBAAgB;IAAEC;EAAY,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IAClE,MAAM;MAAEC,sBAAsB;MAAEC;IAAe,CAAC,GAC/CH,MAAM,CAAEI,YAAY,CAAC;IACtB,OAAO;MACNP,gBAAgB,GAAAI,qBAAA,GACfE,cAAc,CAAC,CAAC,CAACE,MAAM,GAAI,mBAAmB,CAAE,cAAAJ,qBAAA,cAAAA,qBAAA,GAAI,KAAK;MAC1DH,WAAW,EAAEI,sBAAsB,CAAC;IACrC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAKJ,WAAW,IAAI,CAAED,gBAAgB,EAAG;IACxC,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB;AAAC,IAAAU,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcb,sBAAsB","ignoreList":[]}
|
|
@@ -17,10 +17,10 @@ var _store = require("../../store");
|
|
|
17
17
|
/**
|
|
18
18
|
* Wrapper component that renders its children only if post has a publish action.
|
|
19
19
|
*
|
|
20
|
-
* @param {Object}
|
|
21
|
-
* @param {React.
|
|
20
|
+
* @param {Object} props Props.
|
|
21
|
+
* @param {React.ReactNode} props.children Children to be rendered.
|
|
22
22
|
*
|
|
23
|
-
* @return {React.
|
|
23
|
+
* @return {React.ReactNode} - The component to be rendered or null if there is no publish action.
|
|
24
24
|
*/
|
|
25
25
|
function PostScheduleCheck({
|
|
26
26
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_store","PostScheduleCheck","children","hasPublishAction","useSelect","select","_select$getCurrentPos","editorStore","getCurrentPost","_links"],"sources":["@wordpress/editor/src/components/post-schedule/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Wrapper component that renders its children only if post has a publish action.\n *\n * @param {Object}
|
|
1
|
+
{"version":3,"names":["_data","require","_store","PostScheduleCheck","children","hasPublishAction","useSelect","select","_select$getCurrentPos","editorStore","getCurrentPost","_links"],"sources":["@wordpress/editor/src/components/post-schedule/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Wrapper component that renders its children only if post has a publish action.\n *\n * @param {Object} props Props.\n * @param {React.ReactNode} props.children Children to be rendered.\n *\n * @return {React.ReactNode} - The component to be rendered or null if there is no publish action.\n */\nexport default function PostScheduleCheck( { children } ) {\n\tconst hasPublishAction = useSelect( ( select ) => {\n\t\treturn (\n\t\t\tselect( editorStore ).getCurrentPost()._links?.[\n\t\t\t\t'wp:action-publish'\n\t\t\t] ?? false\n\t\t);\n\t}, [] );\n\n\tif ( ! hasPublishAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,iBAAiBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACzD,MAAMC,gBAAgB,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IACjD,QAAAA,qBAAA,GACCD,MAAM,CAAEE,YAAY,CAAC,CAACC,cAAc,CAAC,CAAC,CAACC,MAAM,GAC5C,mBAAmB,CACnB,cAAAH,qBAAA,cAAAA,qBAAA,GAAI,KAAK;EAEZ,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEH,gBAAgB,EAAG;IACzB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
|
|
@@ -17,10 +17,10 @@ var _store = require("../../store");
|
|
|
17
17
|
/**
|
|
18
18
|
* Wrapper component that renders its children only if post has a sticky action.
|
|
19
19
|
*
|
|
20
|
-
* @param {Object}
|
|
21
|
-
* @param {React.
|
|
20
|
+
* @param {Object} props Props.
|
|
21
|
+
* @param {React.ReactNode} props.children Children to be rendered.
|
|
22
22
|
*
|
|
23
|
-
* @return {React.
|
|
23
|
+
* @return {React.ReactNode} The component to be rendered or null if post type is not 'post' or hasStickyAction is false.
|
|
24
24
|
*/
|
|
25
25
|
function PostStickyCheck({
|
|
26
26
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_store","PostStickyCheck","children","hasStickyAction","postType","useSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","_links","getCurrentPostType"],"sources":["@wordpress/editor/src/components/post-sticky/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Wrapper component that renders its children only if post has a sticky action.\n *\n * @param {Object}
|
|
1
|
+
{"version":3,"names":["_data","require","_store","PostStickyCheck","children","hasStickyAction","postType","useSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","_links","getCurrentPostType"],"sources":["@wordpress/editor/src/components/post-sticky/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Wrapper component that renders its children only if post has a sticky action.\n *\n * @param {Object} props Props.\n * @param {React.ReactNode} props.children Children to be rendered.\n *\n * @return {React.ReactNode} The component to be rendered or null if post type is not 'post' or hasStickyAction is false.\n */\nexport default function PostStickyCheck( { children } ) {\n\tconst { hasStickyAction, postType } = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\treturn {\n\t\t\thasStickyAction: post._links?.[ 'wp:action-sticky' ] ?? false,\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tif ( postType !== 'post' || ! hasStickyAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,eAAeA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACvD,MAAM;IAAEC,eAAe;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,oBAAA;IAC9D,MAAMC,IAAI,GAAGF,MAAM,CAAEG,YAAY,CAAC,CAACC,cAAc,CAAC,CAAC;IACnD,OAAO;MACNP,eAAe,GAAAI,oBAAA,GAAEC,IAAI,CAACG,MAAM,GAAI,kBAAkB,CAAE,cAAAJ,oBAAA,cAAAA,oBAAA,GAAI,KAAK;MAC7DH,QAAQ,EAAEE,MAAM,CAAEG,YAAY,CAAC,CAACG,kBAAkB,CAAC;IACpD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAKR,QAAQ,KAAK,MAAM,IAAI,CAAED,eAAe,EAAG;IAC/C,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
|
|
@@ -21,7 +21,7 @@ var _store = require("../../store");
|
|
|
21
21
|
* @param {Object} props The component props.
|
|
22
22
|
* @param {React.ReactNode} props.children The children components to render.
|
|
23
23
|
*
|
|
24
|
-
* @return {React.
|
|
24
|
+
* @return {React.ReactNode} The rendered children components or null if the current post type has no taxonomies.
|
|
25
25
|
*/
|
|
26
26
|
function PostTaxonomiesCheck({
|
|
27
27
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_store","PostTaxonomiesCheck","children","hasTaxonomies","useSelect","select","postType","editorStore","getCurrentPostType","taxonomies","coreStore","getTaxonomies","per_page","some","taxonomy","types","includes"],"sources":["@wordpress/editor/src/components/post-taxonomies/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 { store as editorStore } from '../../store';\n\n/**\n * Renders the children components only if the current post type has taxonomies.\n *\n * @param {Object} props The component props.\n * @param {React.ReactNode} props.children The children components to render.\n *\n * @return {React.
|
|
1
|
+
{"version":3,"names":["_data","require","_coreData","_store","PostTaxonomiesCheck","children","hasTaxonomies","useSelect","select","postType","editorStore","getCurrentPostType","taxonomies","coreStore","getTaxonomies","per_page","some","taxonomy","types","includes"],"sources":["@wordpress/editor/src/components/post-taxonomies/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 { store as editorStore } from '../../store';\n\n/**\n * Renders the children components only if the current post type has taxonomies.\n *\n * @param {Object} props The component props.\n * @param {React.ReactNode} props.children The children components to render.\n *\n * @return {React.ReactNode} The rendered children components or null if the current post type has no taxonomies.\n */\nexport default function PostTaxonomiesCheck( { children } ) {\n\tconst hasTaxonomies = useSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst taxonomies = select( coreStore ).getTaxonomies( {\n\t\t\tper_page: -1,\n\t\t} );\n\t\treturn taxonomies?.some( ( taxonomy ) =>\n\t\t\ttaxonomy.types.includes( postType )\n\t\t);\n\t}, [] );\n\tif ( ! hasTaxonomies ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,mBAAmBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC3D,MAAMC,aAAa,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC9C,MAAMC,QAAQ,GAAGD,MAAM,CAAEE,YAAY,CAAC,CAACC,kBAAkB,CAAC,CAAC;IAC3D,MAAMC,UAAU,GAAGJ,MAAM,CAAEK,eAAU,CAAC,CAACC,aAAa,CAAE;MACrDC,QAAQ,EAAE,CAAC;IACZ,CAAE,CAAC;IACH,OAAOH,UAAU,EAAEI,IAAI,CAAIC,QAAQ,IAClCA,QAAQ,CAACC,KAAK,CAACC,QAAQ,CAAEV,QAAS,CACnC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,IAAK,CAAEH,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
|
|
@@ -19,10 +19,10 @@ var _constants = require("../../store/constants");
|
|
|
19
19
|
/**
|
|
20
20
|
* Wrapper component that renders its children only if the post can be trashed.
|
|
21
21
|
*
|
|
22
|
-
* @param {Object}
|
|
23
|
-
* @param {React.
|
|
22
|
+
* @param {Object} props The component props.
|
|
23
|
+
* @param {React.ReactNode} props.children The child components.
|
|
24
24
|
*
|
|
25
|
-
* @return {React.
|
|
25
|
+
* @return {React.ReactNode} The rendered child components or null if the post can't be trashed.
|
|
26
26
|
*/
|
|
27
27
|
function PostTrashCheck({
|
|
28
28
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_store","_constants","PostTrashCheck","children","canTrashPost","useSelect","select","isEditedPostNew","getCurrentPostId","getCurrentPostType","editorStore","canUser","coreStore","postType","postId","isNew","canUserDelete","kind","name","id","GLOBAL_POST_TYPES","includes"],"sources":["@wordpress/editor/src/components/post-trash/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 { store as editorStore } from '../../store';\nimport { GLOBAL_POST_TYPES } from '../../store/constants';\n\n/**\n * Wrapper component that renders its children only if the post can be trashed.\n *\n * @param {Object}
|
|
1
|
+
{"version":3,"names":["_data","require","_coreData","_store","_constants","PostTrashCheck","children","canTrashPost","useSelect","select","isEditedPostNew","getCurrentPostId","getCurrentPostType","editorStore","canUser","coreStore","postType","postId","isNew","canUserDelete","kind","name","id","GLOBAL_POST_TYPES","includes"],"sources":["@wordpress/editor/src/components/post-trash/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 { store as editorStore } from '../../store';\nimport { GLOBAL_POST_TYPES } from '../../store/constants';\n\n/**\n * Wrapper component that renders its children only if the post can be trashed.\n *\n * @param {Object} props The component props.\n * @param {React.ReactNode} props.children The child components.\n *\n * @return {React.ReactNode} The rendered child components or null if the post can't be trashed.\n */\nexport default function PostTrashCheck( { children } ) {\n\tconst { canTrashPost } = useSelect( ( select ) => {\n\t\tconst { isEditedPostNew, getCurrentPostId, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst { canUser } = select( coreStore );\n\t\tconst postType = getCurrentPostType();\n\t\tconst postId = getCurrentPostId();\n\t\tconst isNew = isEditedPostNew();\n\t\tconst canUserDelete = !! postId\n\t\t\t? canUser( 'delete', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: postType,\n\t\t\t\t\tid: postId,\n\t\t\t } )\n\t\t\t: false;\n\n\t\treturn {\n\t\t\tcanTrashPost:\n\t\t\t\t( ! isNew || postId ) &&\n\t\t\t\tcanUserDelete &&\n\t\t\t\t! GLOBAL_POST_TYPES.includes( postType ),\n\t\t};\n\t}, [] );\n\tif ( ! canTrashPost ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASI,cAAcA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACtD,MAAM;IAAEC;EAAa,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACjD,MAAM;MAAEC,eAAe;MAAEC,gBAAgB;MAAEC;IAAmB,CAAC,GAC9DH,MAAM,CAAEI,YAAY,CAAC;IACtB,MAAM;MAAEC;IAAQ,CAAC,GAAGL,MAAM,CAAEM,eAAU,CAAC;IACvC,MAAMC,QAAQ,GAAGJ,kBAAkB,CAAC,CAAC;IACrC,MAAMK,MAAM,GAAGN,gBAAgB,CAAC,CAAC;IACjC,MAAMO,KAAK,GAAGR,eAAe,CAAC,CAAC;IAC/B,MAAMS,aAAa,GAAG,CAAC,CAAEF,MAAM,GAC5BH,OAAO,CAAE,QAAQ,EAAE;MACnBM,IAAI,EAAE,UAAU;MAChBC,IAAI,EAAEL,QAAQ;MACdM,EAAE,EAAEL;IACJ,CAAE,CAAC,GACH,KAAK;IAER,OAAO;MACNV,YAAY,EACX,CAAE,CAAEW,KAAK,IAAID,MAAM,KACnBE,aAAa,IACb,CAAEI,4BAAiB,CAACC,QAAQ,CAAER,QAAS;IACzC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,IAAK,CAAET,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
|
|
@@ -20,13 +20,13 @@ var _store = require("../../store");
|
|
|
20
20
|
* A component which renders its own children only if the current editor post
|
|
21
21
|
* type supports one of the given `supportKeys` prop.
|
|
22
22
|
*
|
|
23
|
-
* @param {Object}
|
|
24
|
-
* @param {React.
|
|
25
|
-
*
|
|
26
|
-
* @param {(string|string[])}
|
|
27
|
-
*
|
|
23
|
+
* @param {Object} props Props.
|
|
24
|
+
* @param {React.ReactNode} props.children Children to be rendered if post
|
|
25
|
+
* type supports.
|
|
26
|
+
* @param {(string|string[])} props.supportKeys String or string array of keys
|
|
27
|
+
* to test.
|
|
28
28
|
*
|
|
29
|
-
* @return {React.
|
|
29
|
+
* @return {React.ReactNode} The component to be rendered.
|
|
30
30
|
*/
|
|
31
31
|
function PostTypeSupportCheck({
|
|
32
32
|
children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_store","PostTypeSupportCheck","children","supportKeys","postType","useSelect","select","getEditedPostAttribute","editorStore","getPostType","coreStore","isSupported","Array","isArray","some","key","supports","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-type-support-check/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 { store as editorStore } from '../../store';\n\n/**\n * A component which renders its own children only if the current editor post\n * type supports one of the given `supportKeys` prop.\n *\n * @param {Object}
|
|
1
|
+
{"version":3,"names":["_data","require","_coreData","_store","PostTypeSupportCheck","children","supportKeys","postType","useSelect","select","getEditedPostAttribute","editorStore","getPostType","coreStore","isSupported","Array","isArray","some","key","supports","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-type-support-check/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 { store as editorStore } from '../../store';\n\n/**\n * A component which renders its own children only if the current editor post\n * type supports one of the given `supportKeys` prop.\n *\n * @param {Object} props Props.\n * @param {React.ReactNode} props.children Children to be rendered if post\n * type supports.\n * @param {(string|string[])} props.supportKeys String or string array of keys\n * to test.\n *\n * @return {React.ReactNode} The component to be rendered.\n */\nfunction PostTypeSupportCheck( { children, supportKeys } ) {\n\tconst postType = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn getPostType( getEditedPostAttribute( 'type' ) );\n\t}, [] );\n\tlet isSupported = !! postType;\n\tif ( postType ) {\n\t\tisSupported = (\n\t\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t\t).some( ( key ) => !! postType.supports[ key ] );\n\t}\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default PostTypeSupportCheck;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EAC1D,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzC,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IACxD,MAAM;MAAEC;IAAY,CAAC,GAAGH,MAAM,CAAEI,eAAU,CAAC;IAC3C,OAAOD,WAAW,CAAEF,sBAAsB,CAAE,MAAO,CAAE,CAAC;EACvD,CAAC,EAAE,EAAG,CAAC;EACP,IAAII,WAAW,GAAG,CAAC,CAAEP,QAAQ;EAC7B,IAAKA,QAAQ,EAAG;IACfO,WAAW,GAAG,CACbC,KAAK,CAACC,OAAO,CAAEV,WAAY,CAAC,GAAGA,WAAW,GAAG,CAAEA,WAAW,CAAE,EAC3DW,IAAI,CAAIC,GAAG,IAAM,CAAC,CAAEX,QAAQ,CAACY,QAAQ,CAAED,GAAG,CAAG,CAAC;EACjD;EAEA,IAAK,CAAEJ,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OAAOT,QAAQ;AAChB;AAAC,IAAAe,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEclB,oBAAoB","ignoreList":[]}
|
|
@@ -18,10 +18,10 @@ var _store = require("../../store");
|
|
|
18
18
|
/**
|
|
19
19
|
* Check if the post URL is valid and visible.
|
|
20
20
|
*
|
|
21
|
-
* @param {Object}
|
|
22
|
-
* @param {React.
|
|
21
|
+
* @param {Object} props The component props.
|
|
22
|
+
* @param {React.ReactNode} props.children The child components.
|
|
23
23
|
*
|
|
24
|
-
* @return {React.
|
|
24
|
+
* @return {React.ReactNode} The child components if the post URL is valid and visible, otherwise null.
|
|
25
25
|
*/
|
|
26
26
|
function PostURLCheck({
|
|
27
27
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_store","PostURLCheck","children","isVisible","useSelect","select","postTypeSlug","editorStore","getCurrentPostType","postType","coreStore","getPostType","viewable","post","getCurrentPost","link","permalinkParts","getPermalinkParts"],"sources":["@wordpress/editor/src/components/post-url/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 { store as editorStore } from '../../store';\n\n/**\n * Check if the post URL is valid and visible.\n *\n * @param {Object}
|
|
1
|
+
{"version":3,"names":["_data","require","_coreData","_store","PostURLCheck","children","isVisible","useSelect","select","postTypeSlug","editorStore","getCurrentPostType","postType","coreStore","getPostType","viewable","post","getCurrentPost","link","permalinkParts","getPermalinkParts"],"sources":["@wordpress/editor/src/components/post-url/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 { store as editorStore } from '../../store';\n\n/**\n * Check if the post URL is valid and visible.\n *\n * @param {Object} props The component props.\n * @param {React.ReactNode} props.children The child components.\n *\n * @return {React.ReactNode} The child components if the post URL is valid and visible, otherwise null.\n */\nexport default function PostURLCheck( { children } ) {\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tif ( ! postType?.viewable ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tif ( ! post.link ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst permalinkParts = select( editorStore ).getPermalinkParts();\n\t\tif ( ! permalinkParts ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}, [] );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,YAAYA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACpD,MAAMC,SAAS,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC1C,MAAMC,YAAY,GAAGD,MAAM,CAAEE,YAAY,CAAC,CAACC,kBAAkB,CAAC,CAAC;IAC/D,MAAMC,QAAQ,GAAGJ,MAAM,CAAEK,eAAU,CAAC,CAACC,WAAW,CAAEL,YAAa,CAAC;IAChE,IAAK,CAAEG,QAAQ,EAAEG,QAAQ,EAAG;MAC3B,OAAO,KAAK;IACb;IAEA,MAAMC,IAAI,GAAGR,MAAM,CAAEE,YAAY,CAAC,CAACO,cAAc,CAAC,CAAC;IACnD,IAAK,CAAED,IAAI,CAACE,IAAI,EAAG;MAClB,OAAO,KAAK;IACb;IAEA,MAAMC,cAAc,GAAGX,MAAM,CAAEE,YAAY,CAAC,CAACU,iBAAiB,CAAC,CAAC;IAChE,IAAK,CAAED,cAAc,EAAG;MACvB,OAAO,KAAK;IACb;IAEA,OAAO,IAAI;EACZ,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEb,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
|
|
@@ -186,7 +186,7 @@ function PreferencesModalContents({
|
|
|
186
186
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PreferenceToggleControl, {
|
|
187
187
|
scope: "core",
|
|
188
188
|
featureName: "keepCaretInsideBlock",
|
|
189
|
-
help: (0, _i18n.__)('Keeps the text cursor within
|
|
189
|
+
help: (0, _i18n.__)('Keeps the text cursor within blocks while navigating with arrow keys, preventing it from moving to other blocks and enhancing accessibility for keyboard users.'),
|
|
190
190
|
label: (0, _i18n.__)('Contain text cursor inside block')
|
|
191
191
|
})
|
|
192
192
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(PreferencesModalSection, {
|