@wordpress/editor 13.25.0 → 13.26.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 +6 -0
- package/LICENSE.md +1 -1
- package/build/components/document-bar/index.js +19 -7
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/index.js +82 -1
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-tools/index.js +160 -0
- package/build/components/document-tools/index.js.map +1 -0
- package/build/components/editor-canvas/index.js +10 -4
- package/build/components/editor-canvas/index.js.map +1 -1
- package/build/components/entities-saved-states/index.js +3 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +12 -2
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +9 -0
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/index.js +56 -8
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +9 -1
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +77 -0
- package/build/components/inserter-sidebar/index.js.map +1 -0
- package/build/components/list-view-sidebar/index.js +150 -0
- package/build/components/list-view-sidebar/index.js.map +1 -0
- package/build/components/list-view-sidebar/list-view-outline.js +28 -0
- package/build/components/list-view-sidebar/list-view-outline.js.map +1 -0
- package/build/components/offline-status/index.native.js +85 -0
- package/build/components/offline-status/index.native.js.map +1 -0
- package/build/components/page-attributes/panel.js +63 -0
- package/build/components/page-attributes/panel.js.map +1 -0
- package/build/components/post-discussion/panel.js +59 -0
- package/build/components/post-discussion/panel.js.map +1 -0
- package/build/components/post-excerpt/check.js +19 -0
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/panel.js +55 -0
- package/build/components/post-excerpt/panel.js.map +1 -0
- package/build/components/post-excerpt/plugin.js +72 -0
- package/build/components/post-excerpt/plugin.js.map +1 -0
- package/build/components/post-featured-image/index.js +5 -8
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-featured-image/panel.js +60 -0
- package/build/components/post-featured-image/panel.js.map +1 -0
- package/build/components/post-last-revision/panel.js +27 -0
- package/build/components/post-last-revision/panel.js.map +1 -0
- package/build/components/post-saved-state/index.js +12 -8
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-taxonomies/panel.js +68 -0
- package/build/components/post-taxonomies/panel.js.map +1 -0
- package/build/components/post-template/block-theme.js +2 -1
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/hooks.js +6 -6
- package/build/components/post-template/hooks.js.map +1 -1
- package/build/components/post-template/panel.js +1 -2
- package/build/components/post-template/panel.js.map +1 -1
- package/build/components/post-template/swap-template-button.js +4 -2
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-title/index.native.js +25 -14
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-view-link/index.js +58 -0
- package/build/components/post-view-link/index.js.map +1 -0
- package/build/components/post-visibility/check.js +5 -17
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/preview-dropdown/index.js +8 -3
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.native.js +19 -0
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +29 -5
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/private-apis.js +10 -0
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +102 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +2 -0
- package/build/store/index.js.map +1 -1
- package/build/store/private-selectors.js +52 -0
- package/build/store/private-selectors.js.map +1 -0
- package/build/store/reducer.js +78 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +76 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/media-upload/index.js +8 -2
- package/build/utils/media-upload/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +19 -7
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/index.js +82 -1
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-tools/index.js +151 -0
- package/build-module/components/document-tools/index.js.map +1 -0
- package/build-module/components/editor-canvas/index.js +10 -4
- package/build-module/components/editor-canvas/index.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +3 -1
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +12 -2
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +9 -0
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/index.js +6 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -0
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +70 -0
- package/build-module/components/inserter-sidebar/index.js.map +1 -0
- package/build-module/components/list-view-sidebar/index.js +142 -0
- package/build-module/components/list-view-sidebar/index.js.map +1 -0
- package/build-module/components/list-view-sidebar/list-view-outline.js +20 -0
- package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -0
- package/build-module/components/offline-status/index.native.js +77 -0
- package/build-module/components/offline-status/index.native.js.map +1 -0
- package/build-module/components/page-attributes/panel.js +53 -0
- package/build-module/components/page-attributes/panel.js.map +1 -0
- package/build-module/components/post-discussion/panel.js +50 -0
- package/build-module/components/post-discussion/panel.js.map +1 -0
- package/build-module/components/post-excerpt/check.js +19 -0
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +48 -0
- package/build-module/components/post-excerpt/panel.js.map +1 -0
- package/build-module/components/post-excerpt/plugin.js +64 -0
- package/build-module/components/post-excerpt/plugin.js.map +1 -0
- package/build-module/components/post-featured-image/index.js +5 -8
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-featured-image/panel.js +51 -0
- package/build-module/components/post-featured-image/panel.js.map +1 -0
- package/build-module/components/post-last-revision/panel.js +18 -0
- package/build-module/components/post-last-revision/panel.js.map +1 -0
- package/build-module/components/post-saved-state/index.js +12 -8
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-taxonomies/panel.js +59 -0
- package/build-module/components/post-taxonomies/panel.js.map +1 -0
- package/build-module/components/post-template/block-theme.js +2 -1
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/hooks.js +6 -6
- package/build-module/components/post-template/hooks.js.map +1 -1
- package/build-module/components/post-template/panel.js +1 -2
- package/build-module/components/post-template/panel.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +4 -2
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-title/index.native.js +26 -15
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-view-link/index.js +51 -0
- package/build-module/components/post-view-link/index.js.map +1 -0
- package/build-module/components/post-visibility/check.js +6 -16
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +8 -3
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +19 -0
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +29 -5
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/private-apis.js +10 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +94 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +2 -0
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-selectors.js +43 -0
- package/build-module/store/private-selectors.js.map +1 -0
- package/build-module/store/reducer.js +74 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +67 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/media-upload/index.js +8 -2
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-style/style-rtl.css +251 -0
- package/build-style/style.css +251 -0
- package/package.json +32 -32
- package/src/components/document-bar/index.js +39 -28
- package/src/components/document-outline/index.js +48 -1
- package/src/components/document-outline/style.scss +12 -0
- package/src/components/document-tools/index.js +177 -0
- package/src/components/document-tools/style.scss +98 -0
- package/src/components/editor-canvas/index.js +12 -7
- package/src/components/editor-canvas/style.scss +5 -0
- package/src/components/entities-saved-states/index.js +3 -1
- package/src/components/entities-saved-states/style.scss +4 -0
- package/src/components/global-keyboard-shortcuts/index.js +12 -2
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +10 -0
- package/src/components/index.js +6 -0
- package/src/components/index.native.js +1 -0
- package/src/components/inserter-sidebar/index.js +73 -0
- package/src/components/inserter-sidebar/style.scss +22 -0
- package/src/components/list-view-sidebar/index.js +169 -0
- package/src/components/list-view-sidebar/list-view-outline.js +37 -0
- package/src/components/list-view-sidebar/style.scss +84 -0
- package/src/components/offline-status/index.native.js +101 -0
- package/src/components/offline-status/style.native.scss +28 -0
- package/src/components/offline-status/test/index.native.js +108 -0
- package/src/components/page-attributes/panel.js +62 -0
- package/src/components/post-discussion/panel.js +57 -0
- package/src/components/post-excerpt/check.js +18 -0
- package/src/components/post-excerpt/panel.js +57 -0
- package/src/components/post-excerpt/plugin.js +61 -0
- package/src/components/post-excerpt/test/plugin.js +36 -0
- package/src/components/post-featured-image/index.js +3 -7
- package/src/components/post-featured-image/panel.js +55 -0
- package/src/components/post-last-revision/panel.js +22 -0
- package/src/components/post-last-revision/style.scss +10 -0
- package/src/components/post-saved-state/index.js +8 -8
- package/src/components/post-taxonomies/panel.js +66 -0
- package/src/components/post-template/block-theme.js +2 -1
- package/src/components/post-template/hooks.js +6 -6
- package/src/components/post-template/panel.js +1 -2
- package/src/components/post-template/swap-template-button.js +7 -4
- package/src/components/post-title/index.native.js +32 -17
- package/src/components/post-title/style.scss +1 -0
- package/src/components/post-title/test/__snapshots__/index.native.js.snap +25 -0
- package/src/components/post-title/test/index.native.js +78 -0
- package/src/components/post-view-link/index.js +47 -0
- package/src/components/post-visibility/check.js +10 -15
- package/src/components/post-visibility/test/check.js +24 -13
- package/src/components/preview-dropdown/index.js +7 -10
- package/src/components/provider/index.native.js +29 -2
- package/src/components/provider/use-block-editor-settings.js +36 -8
- package/src/private-apis.js +10 -0
- package/src/store/actions.js +109 -0
- package/src/store/index.js +2 -0
- package/src/store/private-selectors.js +51 -0
- package/src/store/reducer.js +72 -0
- package/src/store/selectors.js +80 -0
- package/src/store/test/actions.js +56 -0
- package/src/store/test/reducer.js +98 -0
- package/src/store/test/selectors.js +49 -0
- package/src/style.scss +4 -0
- package/src/utils/media-upload/index.js +9 -2
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = InserterSidebar;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _data = require("@wordpress/data");
|
|
9
|
+
var _components = require("@wordpress/components");
|
|
10
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
11
|
+
var _icons = require("@wordpress/icons");
|
|
12
|
+
var _compose = require("@wordpress/compose");
|
|
13
|
+
var _i18n = require("@wordpress/i18n");
|
|
14
|
+
var _element = require("@wordpress/element");
|
|
15
|
+
var _preferences = require("@wordpress/preferences");
|
|
16
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
17
|
+
var _store = require("../../store");
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
function InserterSidebar() {
|
|
27
|
+
const {
|
|
28
|
+
insertionPoint,
|
|
29
|
+
showMostUsedBlocks
|
|
30
|
+
} = (0, _data.useSelect)(select => {
|
|
31
|
+
const {
|
|
32
|
+
getInsertionPoint
|
|
33
|
+
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
34
|
+
const {
|
|
35
|
+
get
|
|
36
|
+
} = select(_preferences.store);
|
|
37
|
+
return {
|
|
38
|
+
insertionPoint: getInsertionPoint(),
|
|
39
|
+
showMostUsedBlocks: get('core', 'mostUsedBlocks')
|
|
40
|
+
};
|
|
41
|
+
}, []);
|
|
42
|
+
const {
|
|
43
|
+
setIsInserterOpened
|
|
44
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
45
|
+
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
46
|
+
const TagName = !isMobileViewport ? _components.VisuallyHidden : 'div';
|
|
47
|
+
const [inserterDialogRef, inserterDialogProps] = (0, _compose.__experimentalUseDialog)({
|
|
48
|
+
onClose: () => setIsInserterOpened(false),
|
|
49
|
+
focusOnMount: null
|
|
50
|
+
});
|
|
51
|
+
const libraryRef = (0, _element.useRef)();
|
|
52
|
+
(0, _element.useEffect)(() => {
|
|
53
|
+
libraryRef.current.focusSearch();
|
|
54
|
+
}, []);
|
|
55
|
+
return (0, _react.createElement)("div", {
|
|
56
|
+
ref: inserterDialogRef,
|
|
57
|
+
...inserterDialogProps,
|
|
58
|
+
className: "editor-inserter-sidebar"
|
|
59
|
+
}, (0, _react.createElement)(TagName, {
|
|
60
|
+
className: "editor-inserter-sidebar__header"
|
|
61
|
+
}, (0, _react.createElement)(_components.Button, {
|
|
62
|
+
icon: _icons.close,
|
|
63
|
+
label: (0, _i18n.__)('Close block inserter'),
|
|
64
|
+
onClick: () => setIsInserterOpened(false)
|
|
65
|
+
})), (0, _react.createElement)("div", {
|
|
66
|
+
className: "editor-inserter-sidebar__content"
|
|
67
|
+
}, (0, _react.createElement)(_blockEditor.__experimentalLibrary, {
|
|
68
|
+
showMostUsedBlocks: showMostUsedBlocks,
|
|
69
|
+
showInserterHelpPanel: true,
|
|
70
|
+
shouldFocusBlock: isMobileViewport,
|
|
71
|
+
rootClientId: insertionPoint.rootClientId,
|
|
72
|
+
__experimentalInsertionIndex: insertionPoint.insertionIndex,
|
|
73
|
+
__experimentalFilterValue: insertionPoint.filterValue,
|
|
74
|
+
ref: libraryRef
|
|
75
|
+
})));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_components","_blockEditor","_icons","_compose","_i18n","_element","_preferences","_lockUnlock","_store","InserterSidebar","insertionPoint","showMostUsedBlocks","useSelect","select","getInsertionPoint","unlock","editorStore","get","preferencesStore","setIsInserterOpened","useDispatch","isMobileViewport","useViewportMatch","TagName","VisuallyHidden","inserterDialogRef","inserterDialogProps","useDialog","onClose","focusOnMount","libraryRef","useRef","useEffect","current","focusSearch","_react","createElement","ref","className","Button","icon","close","label","__","onClick","__experimentalLibrary","showInserterHelpPanel","shouldFocusBlock","rootClientId","__experimentalInsertionIndex","insertionIndex","__experimentalFilterValue","filterValue"],"sources":["@wordpress/editor/src/components/inserter-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { close } from '@wordpress/icons';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst { insertionPoint, showMostUsedBlocks } = useSelect( ( select ) => {\n\t\tconst { getInsertionPoint } = unlock( select( editorStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\tinsertionPoint: getInsertionPoint(),\n\t\t\tshowMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst TagName = ! isMobileViewport ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: () => setIsInserterOpened( false ),\n\t\tfocusOnMount: null,\n\t} );\n\n\tconst libraryRef = useRef();\n\tuseEffect( () => {\n\t\tlibraryRef.current.focusSearch();\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"editor-inserter-sidebar\"\n\t\t>\n\t\t\t<TagName className=\"editor-inserter-sidebar__header\">\n\t\t\t\t<Button\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tlabel={ __( 'Close block inserter' ) }\n\t\t\t\t\tonClick={ () => setIsInserterOpened( false ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"editor-inserter-sidebar__content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFilterValue={ insertionPoint.filterValue }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAIA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,WAAA,GAAAR,OAAA;A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ACnD,IAAAH,MAAA,CAAAC,aAAA,EAACpC,WAAA,CAAAuC,MAAM;IACNC,IAAI,EAAGC,YAAO;IACdC,KAAK,EAAG,IAAAC,QAAE,EAAE,sBAAuB,CAAG;IACtCC,OAAO,EAAGA,CAAA,KAAMzB,mBAAmB,CAAE,KAAM;EAAG,CAC9C,CACO,CAAC,EACV,IAAAgB,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAAkC,GAChD,IAAAH,MAAA,CAAAC,aAAA,EAACnC,YAAA,CAAA4C,qBAAO;IACPlC,kBAAkB,EAAGA,kBAAoB;IACzCmC,qBAAqB;IACrBC,gBAAgB,EAAG1B,gBAAkB;IACrC2B,YAAY,EAAGtC,cAAc,CAACsC,YAAc;IAC5CC,4BAA4B,EAC3BvC,cAAc,CAACwC,cACf;IACDC,yBAAyB,EAAGzC,cAAc,CAAC0C,WAAa;IACxDf,GAAG,EAAGP;EAAY,CAClB,CACG,CACD,CAAC;AAER"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = ListViewSidebar;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
var _compose = require("@wordpress/compose");
|
|
12
|
+
var _data = require("@wordpress/data");
|
|
13
|
+
var _dom = require("@wordpress/dom");
|
|
14
|
+
var _element = require("@wordpress/element");
|
|
15
|
+
var _i18n = require("@wordpress/i18n");
|
|
16
|
+
var _icons = require("@wordpress/icons");
|
|
17
|
+
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
18
|
+
var _keycodes = require("@wordpress/keycodes");
|
|
19
|
+
var _listViewOutline = _interopRequireDefault(require("./list-view-outline"));
|
|
20
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
21
|
+
var _store = require("../../store");
|
|
22
|
+
/**
|
|
23
|
+
* WordPress dependencies
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Internal dependencies
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
function ListViewSidebar() {
|
|
31
|
+
const {
|
|
32
|
+
setIsListViewOpened
|
|
33
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
34
|
+
const {
|
|
35
|
+
getListViewToggleRef
|
|
36
|
+
} = (0, _lockUnlock.unlock)((0, _data.useSelect)(_store.store));
|
|
37
|
+
|
|
38
|
+
// This hook handles focus when the sidebar first renders.
|
|
39
|
+
const focusOnMountRef = (0, _compose.useFocusOnMount)('firstElement');
|
|
40
|
+
|
|
41
|
+
// When closing the list view, focus should return to the toggle button.
|
|
42
|
+
const closeListView = (0, _element.useCallback)(() => {
|
|
43
|
+
setIsListViewOpened(false);
|
|
44
|
+
getListViewToggleRef().current?.focus();
|
|
45
|
+
}, [getListViewToggleRef, setIsListViewOpened]);
|
|
46
|
+
const closeOnEscape = (0, _element.useCallback)(event => {
|
|
47
|
+
if (event.keyCode === _keycodes.ESCAPE && !event.defaultPrevented) {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
closeListView();
|
|
50
|
+
}
|
|
51
|
+
}, [closeListView]);
|
|
52
|
+
|
|
53
|
+
// Use internal state instead of a ref to make sure that the component
|
|
54
|
+
// re-renders when the dropZoneElement updates.
|
|
55
|
+
const [dropZoneElement, setDropZoneElement] = (0, _element.useState)(null);
|
|
56
|
+
// Tracks our current tab.
|
|
57
|
+
const [tab, setTab] = (0, _element.useState)('list-view');
|
|
58
|
+
|
|
59
|
+
// This ref refers to the sidebar as a whole.
|
|
60
|
+
const sidebarRef = (0, _element.useRef)();
|
|
61
|
+
// This ref refers to the tab panel.
|
|
62
|
+
const tabPanelRef = (0, _element.useRef)();
|
|
63
|
+
// This ref refers to the list view application area.
|
|
64
|
+
const listViewRef = (0, _element.useRef)();
|
|
65
|
+
|
|
66
|
+
// Must merge the refs together so focus can be handled properly in the next function.
|
|
67
|
+
const listViewContainerRef = (0, _compose.useMergeRefs)([focusOnMountRef, listViewRef, setDropZoneElement]);
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
* Callback function to handle list view or outline focus.
|
|
71
|
+
*
|
|
72
|
+
* @param {string} currentTab The current tab. Either list view or outline.
|
|
73
|
+
*
|
|
74
|
+
* @return void
|
|
75
|
+
*/
|
|
76
|
+
function handleSidebarFocus(currentTab) {
|
|
77
|
+
// Tab panel focus.
|
|
78
|
+
const tabPanelFocus = _dom.focus.tabbable.find(tabPanelRef.current)[0];
|
|
79
|
+
// List view tab is selected.
|
|
80
|
+
if (currentTab === 'list-view') {
|
|
81
|
+
// Either focus the list view or the tab panel. Must have a fallback because the list view does not render when there are no blocks.
|
|
82
|
+
const listViewApplicationFocus = _dom.focus.tabbable.find(listViewRef.current)[0];
|
|
83
|
+
const listViewFocusArea = sidebarRef.current.contains(listViewApplicationFocus) ? listViewApplicationFocus : tabPanelFocus;
|
|
84
|
+
listViewFocusArea.focus();
|
|
85
|
+
// Outline tab is selected.
|
|
86
|
+
} else {
|
|
87
|
+
tabPanelFocus.focus();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const handleToggleListViewShortcut = (0, _element.useCallback)(() => {
|
|
91
|
+
// If the sidebar has focus, it is safe to close.
|
|
92
|
+
if (sidebarRef.current.contains(sidebarRef.current.ownerDocument.activeElement)) {
|
|
93
|
+
closeListView();
|
|
94
|
+
} else {
|
|
95
|
+
// If the list view or outline does not have focus, focus should be moved to it.
|
|
96
|
+
handleSidebarFocus(tab);
|
|
97
|
+
}
|
|
98
|
+
}, [closeListView, tab]);
|
|
99
|
+
|
|
100
|
+
// This only fires when the sidebar is open because of the conditional rendering.
|
|
101
|
+
// It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed.
|
|
102
|
+
(0, _keyboardShortcuts.useShortcut)('core/editor/toggle-list-view', handleToggleListViewShortcut);
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Render tab content for a given tab name.
|
|
106
|
+
*
|
|
107
|
+
* @param {string} tabName The name of the tab to render.
|
|
108
|
+
*/
|
|
109
|
+
function renderTabContent(tabName) {
|
|
110
|
+
if (tabName === 'list-view') {
|
|
111
|
+
return (0, _react.createElement)("div", {
|
|
112
|
+
className: "editor-list-view-sidebar__list-view-panel-content"
|
|
113
|
+
}, (0, _react.createElement)(_blockEditor.__experimentalListView, {
|
|
114
|
+
dropZoneElement: dropZoneElement
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
return (0, _react.createElement)(_listViewOutline.default, null);
|
|
118
|
+
}
|
|
119
|
+
return (
|
|
120
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
121
|
+
(0, _react.createElement)("div", {
|
|
122
|
+
className: "editor-list-view-sidebar",
|
|
123
|
+
onKeyDown: closeOnEscape,
|
|
124
|
+
ref: sidebarRef
|
|
125
|
+
}, (0, _react.createElement)(_components.Button, {
|
|
126
|
+
className: "editor-list-view-sidebar__close-button",
|
|
127
|
+
icon: _icons.closeSmall,
|
|
128
|
+
label: (0, _i18n.__)('Close'),
|
|
129
|
+
onClick: closeListView
|
|
130
|
+
}), (0, _react.createElement)(_components.TabPanel, {
|
|
131
|
+
className: "editor-list-view-sidebar__tab-panel",
|
|
132
|
+
ref: tabPanelRef,
|
|
133
|
+
onSelect: tabName => setTab(tabName),
|
|
134
|
+
selectOnMove: false,
|
|
135
|
+
tabs: [{
|
|
136
|
+
name: 'list-view',
|
|
137
|
+
title: (0, _i18n._x)('List View', 'Post overview'),
|
|
138
|
+
className: 'editor-list-view-sidebar__panel-tab'
|
|
139
|
+
}, {
|
|
140
|
+
name: 'outline',
|
|
141
|
+
title: (0, _i18n._x)('Outline', 'Post overview'),
|
|
142
|
+
className: 'editor-list-view-sidebar__panel-tab'
|
|
143
|
+
}]
|
|
144
|
+
}, currentTab => (0, _react.createElement)("div", {
|
|
145
|
+
className: "editor-list-view-sidebar__list-view-container",
|
|
146
|
+
ref: listViewContainerRef
|
|
147
|
+
}, renderTabContent(currentTab.name))))
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_components","_compose","_data","_dom","_element","_i18n","_icons","_keyboardShortcuts","_keycodes","_listViewOutline","_interopRequireDefault","_lockUnlock","_store","ListViewSidebar","setIsListViewOpened","useDispatch","editorStore","getListViewToggleRef","unlock","useSelect","focusOnMountRef","useFocusOnMount","closeListView","useCallback","current","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","dropZoneElement","setDropZoneElement","useState","tab","setTab","sidebarRef","useRef","tabPanelRef","listViewRef","listViewContainerRef","useMergeRefs","handleSidebarFocus","currentTab","tabPanelFocus","tabbable","find","listViewApplicationFocus","listViewFocusArea","contains","handleToggleListViewShortcut","ownerDocument","activeElement","useShortcut","renderTabContent","tabName","_react","createElement","className","__experimentalListView","default","onKeyDown","ref","Button","icon","closeSmall","label","__","onClick","TabPanel","onSelect","selectOnMove","tabs","name","title","_x"],"sources":["@wordpress/editor/src/components/list-view-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button, TabPanel } from '@wordpress/components';\nimport { useFocusOnMount, useMergeRefs } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { focus } from '@wordpress/dom';\nimport { useCallback, useRef, useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport ListViewOutline from './list-view-outline';\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\tconst { getListViewToggleRef } = unlock( useSelect( editorStore ) );\n\n\t// This hook handles focus when the sidebar first renders.\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\t// When closing the list view, focus should return to the toggle button.\n\tconst closeListView = useCallback( () => {\n\t\tsetIsListViewOpened( false );\n\t\tgetListViewToggleRef().current?.focus();\n\t}, [ getListViewToggleRef, setIsListViewOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseListView();\n\t\t\t}\n\t\t},\n\t\t[ closeListView ]\n\t);\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the dropZoneElement updates.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\t// Tracks our current tab.\n\tconst [ tab, setTab ] = useState( 'list-view' );\n\n\t// This ref refers to the sidebar as a whole.\n\tconst sidebarRef = useRef();\n\t// This ref refers to the tab panel.\n\tconst tabPanelRef = useRef();\n\t// This ref refers to the list view application area.\n\tconst listViewRef = useRef();\n\n\t// Must merge the refs together so focus can be handled properly in the next function.\n\tconst listViewContainerRef = useMergeRefs( [\n\t\tfocusOnMountRef,\n\t\tlistViewRef,\n\t\tsetDropZoneElement,\n\t] );\n\n\t/*\n\t * Callback function to handle list view or outline focus.\n\t *\n\t * @param {string} currentTab The current tab. Either list view or outline.\n\t *\n\t * @return void\n\t */\n\tfunction handleSidebarFocus( currentTab ) {\n\t\t// Tab panel focus.\n\t\tconst tabPanelFocus = focus.tabbable.find( tabPanelRef.current )[ 0 ];\n\t\t// List view tab is selected.\n\t\tif ( currentTab === 'list-view' ) {\n\t\t\t// Either focus the list view or the tab panel. Must have a fallback because the list view does not render when there are no blocks.\n\t\t\tconst listViewApplicationFocus = focus.tabbable.find(\n\t\t\t\tlistViewRef.current\n\t\t\t)[ 0 ];\n\t\t\tconst listViewFocusArea = sidebarRef.current.contains(\n\t\t\t\tlistViewApplicationFocus\n\t\t\t)\n\t\t\t\t? listViewApplicationFocus\n\t\t\t\t: tabPanelFocus;\n\t\t\tlistViewFocusArea.focus();\n\t\t\t// Outline tab is selected.\n\t\t} else {\n\t\t\ttabPanelFocus.focus();\n\t\t}\n\t}\n\n\tconst handleToggleListViewShortcut = useCallback( () => {\n\t\t// If the sidebar has focus, it is safe to close.\n\t\tif (\n\t\t\tsidebarRef.current.contains(\n\t\t\t\tsidebarRef.current.ownerDocument.activeElement\n\t\t\t)\n\t\t) {\n\t\t\tcloseListView();\n\t\t} else {\n\t\t\t// If the list view or outline does not have focus, focus should be moved to it.\n\t\t\thandleSidebarFocus( tab );\n\t\t}\n\t}, [ closeListView, tab ] );\n\n\t// This only fires when the sidebar is open because of the conditional rendering.\n\t// It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed.\n\tuseShortcut( 'core/editor/toggle-list-view', handleToggleListViewShortcut );\n\n\t/**\n\t * Render tab content for a given tab name.\n\t *\n\t * @param {string} tabName The name of the tab to render.\n\t */\n\tfunction renderTabContent( tabName ) {\n\t\tif ( tabName === 'list-view' ) {\n\t\t\treturn (\n\t\t\t\t<div className=\"editor-list-view-sidebar__list-view-panel-content\">\n\t\t\t\t\t<ListView dropZoneElement={ dropZoneElement } />\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\t\treturn <ListViewOutline />;\n\t}\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"editor-list-view-sidebar\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t\tref={ sidebarRef }\n\t\t>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-list-view-sidebar__close-button\"\n\t\t\t\ticon={ closeSmall }\n\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\tonClick={ closeListView }\n\t\t\t/>\n\t\t\t<TabPanel\n\t\t\t\tclassName=\"editor-list-view-sidebar__tab-panel\"\n\t\t\t\tref={ tabPanelRef }\n\t\t\t\tonSelect={ ( tabName ) => setTab( tabName ) }\n\t\t\t\tselectOnMove={ false }\n\t\t\t\ttabs={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'list-view',\n\t\t\t\t\t\ttitle: _x( 'List View', 'Post overview' ),\n\t\t\t\t\t\tclassName: 'editor-list-view-sidebar__panel-tab',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'outline',\n\t\t\t\t\t\ttitle: _x( 'Outline', 'Post overview' ),\n\t\t\t\t\t\tclassName: 'editor-list-view-sidebar__panel-tab',\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ ( currentTab ) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"editor-list-view-sidebar__list-view-container\"\n\t\t\t\t\t\tref={ listViewContainerRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ renderTabContent( currentTab.name ) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TabPanel>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AAKA,IAAAU,gBAAA,GAAAC,sBAAA,CAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AAnBA;AACA;AACA;;AAYA;AACA;AACA;;AAKe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AyB,MAAA,CAAAC,aAAA,EAACjD,gBAAA,CAAAoD,OAAe,MAAE,CAAC;EAC3B;EAEA;IACC;IACA,IAAAJ,MAAA,CAAAC,aAAA;MACCC,SAAS,EAAC,0BAA0B;MACpCG,SAAS,EAAGpC,aAAe;MAC3BqC,GAAG,EAAG1B;IAAY,GAElB,IAAAoB,MAAA,CAAAC,aAAA,EAAC1D,WAAA,CAAAgE,MAAM;MACNL,SAAS,EAAC,wCAAwC;MAClDM,IAAI,EAAGC,iBAAY;MACnBC,KAAK,EAAG,IAAAC,QAAE,EAAE,OAAQ,CAAG;MACvBC,OAAO,EAAG/C;IAAe,CACzB,CAAC,EACF,IAAAmC,MAAA,CAAAC,aAAA,EAAC1D,WAAA,CAAAsE,QAAQ;MACRX,SAAS,EAAC,qCAAqC;MAC/CI,GAAG,EAAGxB,WAAa;MACnBgC,QAAQ,EAAKf,OAAO,IAAMpB,MAAM,CAAEoB,OAAQ,CAAG;MAC7CgB,YAAY,EAAG,KAAO;MACtBC,IAAI,EAAG,CACN;QACCC,IAAI,EAAE,WAAW;QACjBC,KAAK,EAAE,IAAAC,QAAE,EAAE,WAAW,EAAE,eAAgB,CAAC;QACzCjB,SAAS,EAAE;MACZ,CAAC,EACD;QACCe,IAAI,EAAE,SAAS;QACfC,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAS,EAAE,eAAgB,CAAC;QACvCjB,SAAS,EAAE;MACZ,CAAC;IACC,GAECf,UAAU,IACb,IAAAa,MAAA,CAAAC,aAAA;MACCC,SAAS,EAAC,+CAA+C;MACzDI,GAAG,EAAGtB;IAAsB,GAE1Bc,gBAAgB,CAAEX,UAAU,CAAC8B,IAAK,CAChC,CAEG,CACN;EAAC;AAER"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = ListViewOutline;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _components = require("@wordpress/components");
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
var _characterCount = _interopRequireDefault(require("../character-count"));
|
|
12
|
+
var _wordCount = _interopRequireDefault(require("../word-count"));
|
|
13
|
+
var _timeToRead = _interopRequireDefault(require("../time-to-read"));
|
|
14
|
+
var _documentOutline = _interopRequireDefault(require("../document-outline"));
|
|
15
|
+
/**
|
|
16
|
+
* WordPress dependencies
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Internal dependencies
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
function ListViewOutline() {
|
|
24
|
+
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
|
|
25
|
+
className: "editor-list-view-sidebar__outline"
|
|
26
|
+
}, (0, _react.createElement)("div", null, (0, _react.createElement)(_components.__experimentalText, null, (0, _i18n.__)('Characters:')), (0, _react.createElement)(_components.__experimentalText, null, (0, _react.createElement)(_characterCount.default, null))), (0, _react.createElement)("div", null, (0, _react.createElement)(_components.__experimentalText, null, (0, _i18n.__)('Words:')), (0, _react.createElement)(_wordCount.default, null)), (0, _react.createElement)("div", null, (0, _react.createElement)(_components.__experimentalText, null, (0, _i18n.__)('Time to read:')), (0, _react.createElement)(_timeToRead.default, null))), (0, _react.createElement)(_documentOutline.default, null));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=list-view-outline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_characterCount","_interopRequireDefault","_wordCount","_timeToRead","_documentOutline","ListViewOutline","_react","createElement","Fragment","className","__experimentalText","__","default"],"sources":["@wordpress/editor/src/components/list-view-sidebar/list-view-outline.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalText as Text } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport CharacterCount from '../character-count';\nimport WordCount from '../word-count';\nimport TimeToRead from '../time-to-read';\nimport DocumentOutline from '../document-outline';\n\nexport default function ListViewOutline() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"editor-list-view-sidebar__outline\">\n\t\t\t\t<div>\n\t\t\t\t\t<Text>{ __( 'Characters:' ) }</Text>\n\t\t\t\t\t<Text>\n\t\t\t\t\t\t<CharacterCount />\n\t\t\t\t\t</Text>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<Text>{ __( 'Words:' ) }</Text>\n\t\t\t\t\t<WordCount />\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<Text>{ __( 'Time to read:' ) }</Text>\n\t\t\t\t\t<TimeToRead />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<DocumentOutline />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,WAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,gBAAA,GAAAH,sBAAA,CAAAH,OAAA;AAZA;AACA;AACA;;AAIA;AACA;AACA;;AAMe,SAASO,eAAeA,CAAA,EAAG;EACzC,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAAmC,GACjD,IAAAH,MAAA,CAAAC,aAAA,eACC,IAAAD,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAa,kBAAI,QAAG,IAAAC,QAAE,EAAE,aAAc,CAAS,CAAC,EACpC,IAAAL,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAa,kBAAI,QACJ,IAAAJ,MAAA,CAAAC,aAAA,EAACP,eAAA,CAAAY,OAAc,MAAE,CACZ,CACF,CAAC,EACN,IAAAN,MAAA,CAAAC,aAAA,eACC,IAAAD,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAa,kBAAI,QAAG,IAAAC,QAAE,EAAE,QAAS,CAAS,CAAC,EAC/B,IAAAL,MAAA,CAAAC,aAAA,EAACL,UAAA,CAAAU,OAAS,MAAE,CACR,CAAC,EACN,IAAAN,MAAA,CAAAC,aAAA,eACC,IAAAD,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAa,kBAAI,QAAG,IAAAC,QAAE,EAAE,eAAgB,CAAS,CAAC,EACtC,IAAAL,MAAA,CAAAC,aAAA,EAACJ,WAAA,CAAAS,OAAU,MAAE,CACT,CACD,CAAC,EACN,IAAAN,MAAA,CAAAC,aAAA,EAACH,gBAAA,CAAAQ,OAAe,MAAE,CACjB,CAAC;AAEL"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _reactNative = require("react-native");
|
|
10
|
+
var _compose = require("@wordpress/compose");
|
|
11
|
+
var _components = require("@wordpress/components");
|
|
12
|
+
var _icons = require("@wordpress/icons");
|
|
13
|
+
var _i18n = require("@wordpress/i18n");
|
|
14
|
+
var _element = require("@wordpress/element");
|
|
15
|
+
var _styleNative = _interopRequireDefault(require("./style.native.scss"));
|
|
16
|
+
/**
|
|
17
|
+
* External dependencies
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* WordPress dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Internal dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Conditionally announces messages for screen reader users. This Hook provides
|
|
30
|
+
* two benefits over React Native's `accessibilityLiveRegion`:
|
|
31
|
+
*
|
|
32
|
+
* 1. It works on both iOS and Android.
|
|
33
|
+
* 2. It allows announcing a secondary message when the component is inactive.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} message The message to announce.
|
|
36
|
+
* @param {Object} options Options for the Hook.
|
|
37
|
+
* @param {boolean} [options.isActive] Whether the message should be announced.
|
|
38
|
+
* @param {string} [options.inactiveMessage] The message to announce when inactive.
|
|
39
|
+
*/
|
|
40
|
+
function useAccessibilityLiveRegion(message, {
|
|
41
|
+
isActive,
|
|
42
|
+
inactiveMessage
|
|
43
|
+
}) {
|
|
44
|
+
const {
|
|
45
|
+
announceForAccessibility
|
|
46
|
+
} = _reactNative.AccessibilityInfo;
|
|
47
|
+
const prevIsActive = (0, _compose.usePrevious)(isActive);
|
|
48
|
+
(0, _element.useEffect)(() => {
|
|
49
|
+
const unconditionalMessage = typeof isActive === 'undefined';
|
|
50
|
+
const initialRender = typeof prevIsActive === 'undefined';
|
|
51
|
+
if (unconditionalMessage || isActive && !prevIsActive && !initialRender) {
|
|
52
|
+
announceForAccessibility(message);
|
|
53
|
+
} else if (!isActive && prevIsActive && inactiveMessage) {
|
|
54
|
+
announceForAccessibility(inactiveMessage);
|
|
55
|
+
}
|
|
56
|
+
}, [message, isActive, prevIsActive, inactiveMessage, announceForAccessibility]);
|
|
57
|
+
}
|
|
58
|
+
const OfflineStatus = () => {
|
|
59
|
+
const {
|
|
60
|
+
isConnected
|
|
61
|
+
} = (0, _compose.useNetworkConnectivity)();
|
|
62
|
+
useAccessibilityLiveRegion((0, _i18n.__)('Network connection re-established'), {
|
|
63
|
+
isActive: isConnected,
|
|
64
|
+
inactiveMessage: (0, _i18n.__)('Network connection lost, working offline')
|
|
65
|
+
});
|
|
66
|
+
const containerStyle = (0, _compose.usePreferredColorSchemeStyle)(_styleNative.default.offline, _styleNative.default.offline__dark);
|
|
67
|
+
const textStyle = (0, _compose.usePreferredColorSchemeStyle)(_styleNative.default['offline--text'], _styleNative.default['offline--text__dark']);
|
|
68
|
+
const iconStyle = (0, _compose.usePreferredColorSchemeStyle)(_styleNative.default['offline--icon'], _styleNative.default['offline--icon__dark']);
|
|
69
|
+
return !isConnected ? (0, _react.createElement)(_reactNative.View, {
|
|
70
|
+
accessible: true,
|
|
71
|
+
accessibilityRole: "alert",
|
|
72
|
+
accessibilityLabel: (0, _i18n.__)('Network connection lost, working offline'),
|
|
73
|
+
style: containerStyle
|
|
74
|
+
}, (0, _react.createElement)(_reactNative.View, {
|
|
75
|
+
style: containerStyle
|
|
76
|
+
}, (0, _react.createElement)(_components.Icon, {
|
|
77
|
+
fill: iconStyle.fill,
|
|
78
|
+
icon: _icons.offline
|
|
79
|
+
}), (0, _react.createElement)(_reactNative.Text, {
|
|
80
|
+
style: textStyle
|
|
81
|
+
}, (0, _i18n.__)('Working Offline')))) : null;
|
|
82
|
+
};
|
|
83
|
+
var _default = OfflineStatus;
|
|
84
|
+
exports.default = _default;
|
|
85
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_compose","_components","_icons","_i18n","_element","_styleNative","_interopRequireDefault","useAccessibilityLiveRegion","message","isActive","inactiveMessage","announceForAccessibility","AccessibilityInfo","prevIsActive","usePrevious","useEffect","unconditionalMessage","initialRender","OfflineStatus","isConnected","useNetworkConnectivity","__","containerStyle","usePreferredColorSchemeStyle","styles","offline","offline__dark","textStyle","iconStyle","_react","createElement","View","accessible","accessibilityRole","accessibilityLabel","style","Icon","fill","icon","offlineIcon","Text","_default","exports","default"],"sources":["@wordpress/editor/src/components/offline-status/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { AccessibilityInfo, Text, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tusePreferredColorSchemeStyle,\n\tuseNetworkConnectivity,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { Icon } from '@wordpress/components';\nimport { offline as offlineIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.native.scss';\n\n/**\n * Conditionally announces messages for screen reader users. This Hook provides\n * two benefits over React Native's `accessibilityLiveRegion`:\n *\n * 1. It works on both iOS and Android.\n * 2. It allows announcing a secondary message when the component is inactive.\n *\n * @param {string} message The message to announce.\n * @param {Object} options Options for the Hook.\n * @param {boolean} [options.isActive] Whether the message should be announced.\n * @param {string} [options.inactiveMessage] The message to announce when inactive.\n */\nfunction useAccessibilityLiveRegion( message, { isActive, inactiveMessage } ) {\n\tconst { announceForAccessibility } = AccessibilityInfo;\n\tconst prevIsActive = usePrevious( isActive );\n\n\tuseEffect( () => {\n\t\tconst unconditionalMessage = typeof isActive === 'undefined';\n\t\tconst initialRender = typeof prevIsActive === 'undefined';\n\n\t\tif (\n\t\t\tunconditionalMessage ||\n\t\t\t( isActive && ! prevIsActive && ! initialRender )\n\t\t) {\n\t\t\tannounceForAccessibility( message );\n\t\t} else if ( ! isActive && prevIsActive && inactiveMessage ) {\n\t\t\tannounceForAccessibility( inactiveMessage );\n\t\t}\n\t}, [\n\t\tmessage,\n\t\tisActive,\n\t\tprevIsActive,\n\t\tinactiveMessage,\n\t\tannounceForAccessibility,\n\t] );\n}\n\nconst OfflineStatus = () => {\n\tconst { isConnected } = useNetworkConnectivity();\n\n\tuseAccessibilityLiveRegion( __( 'Network connection re-established' ), {\n\t\tisActive: isConnected,\n\t\tinactiveMessage: __( 'Network connection lost, working offline' ),\n\t} );\n\n\tconst containerStyle = usePreferredColorSchemeStyle(\n\t\tstyles.offline,\n\t\tstyles.offline__dark\n\t);\n\n\tconst textStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'offline--text' ],\n\t\tstyles[ 'offline--text__dark' ]\n\t);\n\n\tconst iconStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'offline--icon' ],\n\t\tstyles[ 'offline--icon__dark' ]\n\t);\n\n\treturn ! isConnected ? (\n\t\t<View\n\t\t\taccessible\n\t\t\taccessibilityRole=\"alert\"\n\t\t\taccessibilityLabel={ __(\n\t\t\t\t'Network connection lost, working offline'\n\t\t\t) }\n\t\t\tstyle={ containerStyle }\n\t\t>\n\t\t\t<View style={ containerStyle }>\n\t\t\t\t<Icon fill={ iconStyle.fill } icon={ offlineIcon } />\n\t\t\t\t<Text style={ textStyle }>{ __( 'Working Offline' ) }</Text>\n\t\t\t</View>\n\t\t</View>\n\t) : null;\n};\n\nexport default OfflineStatus;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,YAAA,GAAAC,sBAAA,CAAAP,OAAA;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASQ,0BAA0BA,CAAEC,OAAO,EAAE;EAAEC,QAAQ;EAAEC;AAAgB,CAAC,EAAG;EAC7E,MAAM;IAAEC;EAAyB,CAAC,GAAGC,8BAAiB;EACtD,MAAMC,YAAY,GAAG,IAAAC,oBAAW,EAAEL,QAAS,CAAC;EAE5C,IAAAM,kBAAS,EAAE,MAAM;IAChB,MAAMC,oBAAoB,GAAG,OAAOP,QAAQ,KAAK,WAAW;IAC5D,MAAMQ,aAAa,GAAG,OAAOJ,YAAY,KAAK,WAAW;IAEzD,IACCG,oBAAoB,IAClBP,QAAQ,IAAI,CAAEI,YAAY,IAAI,CAAEI,aAAe,EAChD;MACDN,wBAAwB,CAAEH,OAAQ,CAAC;IACpC,CAAC,MAA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CAAAC,aAAA,EAAChC,YAAA,CAAA0C,IAAI;IAACL,KAAK,EAAGR;EAAW,GAAG,IAAAN,QAAE,EAAE,iBAAkB,CAAS,CACtD,CACD,CAAC,GACJ,IAAI;AACT,CAAC;AAAC,IAAAoB,QAAA,GAEavB,aAAa;AAAAwB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.PageAttributesPanel = PageAttributesPanel;
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
var _components = require("@wordpress/components");
|
|
12
|
+
var _data = require("@wordpress/data");
|
|
13
|
+
var _coreData = require("@wordpress/core-data");
|
|
14
|
+
var _store = require("../../store");
|
|
15
|
+
var _check = _interopRequireDefault(require("./check"));
|
|
16
|
+
var _order = _interopRequireDefault(require("./order"));
|
|
17
|
+
var _parent = _interopRequireDefault(require("./parent"));
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const PANEL_NAME = 'page-attributes';
|
|
27
|
+
function PageAttributesPanel() {
|
|
28
|
+
var _postType$labels$attr;
|
|
29
|
+
const {
|
|
30
|
+
isEnabled,
|
|
31
|
+
isOpened,
|
|
32
|
+
postType
|
|
33
|
+
} = (0, _data.useSelect)(select => {
|
|
34
|
+
const {
|
|
35
|
+
getEditedPostAttribute,
|
|
36
|
+
isEditorPanelEnabled,
|
|
37
|
+
isEditorPanelOpened
|
|
38
|
+
} = select(_store.store);
|
|
39
|
+
const {
|
|
40
|
+
getPostType
|
|
41
|
+
} = select(_coreData.store);
|
|
42
|
+
return {
|
|
43
|
+
isEnabled: isEditorPanelEnabled(PANEL_NAME),
|
|
44
|
+
isOpened: isEditorPanelOpened(PANEL_NAME),
|
|
45
|
+
postType: getPostType(getEditedPostAttribute('type'))
|
|
46
|
+
};
|
|
47
|
+
}, []);
|
|
48
|
+
const {
|
|
49
|
+
toggleEditorPanelOpened
|
|
50
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
51
|
+
if (!isEnabled || !postType) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const onTogglePanel = (...args) => toggleEditorPanelOpened(PANEL_NAME, ...args);
|
|
55
|
+
return (0, _react.createElement)(_check.default, null, (0, _react.createElement)(_components.PanelBody, {
|
|
56
|
+
title: (_postType$labels$attr = postType?.labels?.attributes) !== null && _postType$labels$attr !== void 0 ? _postType$labels$attr : (0, _i18n.__)('Page attributes'),
|
|
57
|
+
opened: isOpened,
|
|
58
|
+
onToggle: onTogglePanel
|
|
59
|
+
}, (0, _react.createElement)(_parent.default, null), (0, _react.createElement)(_components.PanelRow, null, (0, _react.createElement)(_order.default, null))));
|
|
60
|
+
}
|
|
61
|
+
var _default = PageAttributesPanel;
|
|
62
|
+
exports.default = _default;
|
|
63
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_coreData","_store","_check","_interopRequireDefault","_order","_parent","PANEL_NAME","PageAttributesPanel","_postType$labels$attr","isEnabled","isOpened","postType","useSelect","select","getEditedPostAttribute","isEditorPanelEnabled","isEditorPanelOpened","editorStore","getPostType","coreStore","toggleEditorPanelOpened","useDispatch","onTogglePanel","args","_react","createElement","default","PanelBody","title","labels","attributes","__","opened","onToggle","PanelRow","_default","exports"],"sources":["@wordpress/editor/src/components/page-attributes/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody, PanelRow } from '@wordpress/components';\n\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PageAttributesCheck from './check';\nimport PageAttributesOrder from './order';\nimport PageAttributesParent from './parent';\n\nconst PANEL_NAME = 'page-attributes';\n\nexport function PageAttributesPanel() {\n\tconst { isEnabled, isOpened, postType } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostAttribute,\n\t\t\tisEditorPanelEnabled,\n\t\t\tisEditorPanelOpened,\n\t\t} = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn {\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( ! isEnabled || ! postType ) {\n\t\treturn null;\n\t}\n\n\tconst onTogglePanel = ( ...args ) =>\n\t\ttoggleEditorPanelOpened( PANEL_NAME, ...args );\n\n\treturn (\n\t\t<PageAttributesCheck>\n\t\t\t<PanelBody\n\t\t\t\ttitle={\n\t\t\t\t\tpostType?.labels?.attributes ?? __( 'Page attributes' )\n\t\t\t\t}\n\t\t\t\topened={ isOpened }\n\t\t\t\tonToggle={ onTogglePanel }\n\t\t\t>\n\t\t\t\t<PageAttributesParent />\n\t\t\t\t<PanelRow>\n\t\t\t\t\t<PageAttributesOrder />\n\t\t\t\t</PanelRow>\n\t\t\t</PanelBody>\n\t\t</PageAttributesCheck>\n\t);\n}\n\nexport default PageAttributesPanel;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,G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B,QAAE,EAAE,iBAAkB,CACtD;IACDC,MAAM,EAAGtB,QAAU;IACnBuB,QAAQ,EAAGX;EAAe,GAE1B,IAAAE,MAAA,CAAAC,aAAA,EAACpB,OAAA,CAAAqB,OAAoB,MAAE,CAAC,EACxB,IAAAF,MAAA,CAAAC,aAAA,EAAC3B,WAAA,CAAAoC,QAAQ,QACR,IAAAV,MAAA,CAAAC,aAAA,EAACrB,MAAA,CAAAsB,OAAmB,MAAE,CACb,CACA,CACS,CAAC;AAExB;AAAC,IAAAS,QAAA,GAEc5B,mBAAmB;AAAA6B,OAAA,CAAAV,OAAA,GAAAS,QAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _i18n = require("@wordpress/i18n");
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
var _data = require("@wordpress/data");
|
|
12
|
+
var _store = require("../../store");
|
|
13
|
+
var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
|
|
14
|
+
var _postComments = _interopRequireDefault(require("../post-comments"));
|
|
15
|
+
var _postPingbacks = _interopRequireDefault(require("../post-pingbacks"));
|
|
16
|
+
/**
|
|
17
|
+
* WordPress dependencies
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Internal dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const PANEL_NAME = 'discussion-panel';
|
|
25
|
+
function PostDiscussionPanel() {
|
|
26
|
+
const {
|
|
27
|
+
isEnabled,
|
|
28
|
+
isOpened
|
|
29
|
+
} = (0, _data.useSelect)(select => {
|
|
30
|
+
const {
|
|
31
|
+
isEditorPanelEnabled,
|
|
32
|
+
isEditorPanelOpened
|
|
33
|
+
} = select(_store.store);
|
|
34
|
+
return {
|
|
35
|
+
isEnabled: isEditorPanelEnabled(PANEL_NAME),
|
|
36
|
+
isOpened: isEditorPanelOpened(PANEL_NAME)
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
const {
|
|
40
|
+
toggleEditorPanelOpened
|
|
41
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
42
|
+
if (!isEnabled) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return (0, _react.createElement)(_postTypeSupportCheck.default, {
|
|
46
|
+
supportKeys: ['comments', 'trackbacks']
|
|
47
|
+
}, (0, _react.createElement)(_components.PanelBody, {
|
|
48
|
+
title: (0, _i18n.__)('Discussion'),
|
|
49
|
+
opened: isOpened,
|
|
50
|
+
onToggle: () => toggleEditorPanelOpened(PANEL_NAME)
|
|
51
|
+
}, (0, _react.createElement)(_postTypeSupportCheck.default, {
|
|
52
|
+
supportKeys: "comments"
|
|
53
|
+
}, (0, _react.createElement)(_components.PanelRow, null, (0, _react.createElement)(_postComments.default, null))), (0, _react.createElement)(_postTypeSupportCheck.default, {
|
|
54
|
+
supportKeys: "trackbacks"
|
|
55
|
+
}, (0, _react.createElement)(_components.PanelRow, null, (0, _react.createElement)(_postPingbacks.default, null)))));
|
|
56
|
+
}
|
|
57
|
+
var _default = PostDiscussionPanel;
|
|
58
|
+
exports.default = _default;
|
|
59
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_store","_postTypeSupportCheck","_interopRequireDefault","_postComments","_postPingbacks","PANEL_NAME","PostDiscussionPanel","isEnabled","isOpened","useSelect","select","isEditorPanelEnabled","isEditorPanelOpened","editorStore","toggleEditorPanelOpened","useDispatch","_react","createElement","default","supportKeys","PanelBody","title","__","opened","onToggle","PanelRow","_default","exports"],"sources":["@wordpress/editor/src/components/post-discussion/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport PostComments from '../post-comments';\nimport PostPingbacks from '../post-pingbacks';\n\nconst PANEL_NAME = 'discussion-panel';\n\nfunction PostDiscussionPanel() {\n\tconst { isEnabled, isOpened } = useSelect( ( select ) => {\n\t\tconst { isEditorPanelEnabled, isEditorPanelOpened } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys={ [ 'comments', 'trackbacks' ] }>\n\t\t\t<PanelBody\n\t\t\t\ttitle={ __( 'Discussion' ) }\n\t\t\t\topened={ isOpened }\n\t\t\t\tonToggle={ () => toggleEditorPanelOpened( PANEL_NAME ) }\n\t\t\t>\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"comments\">\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<PostComments />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</PostTypeSupportCheck>\n\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"trackbacks\">\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<PostPingbacks />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</PostTypeSupportCheck>\n\t\t\t</PanelBody>\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default PostDiscussionPanel;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF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,OAAY,MAAE,CACN,CACW,CAAC,EAEvB,IAAAF,MAAA,CAAAC,aAAA,EAAChB,qBAAA,CAAAiB,OAAoB;IAACC,WAAW,EAAC;EAAY,GAC7C,IAAAH,MAAA,CAAAC,aAAA,EAACnB,WAAA,CAAA2B,QAAQ,QACR,IAAAT,MAAA,CAAAC,aAAA,EAACb,cAAA,CAAAc,OAAa,MAAE,CACP,CACW,CACZ,CACU,CAAC;AAEzB;AAAC,IAAAQ,QAAA,GAEcpB,mBAAmB;AAAAqB,OAAA,CAAAT,OAAA,GAAAQ,QAAA"}
|
|
@@ -6,7 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
+
var _data = require("@wordpress/data");
|
|
9
10
|
var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
|
|
11
|
+
var _store = require("../../store");
|
|
12
|
+
/**
|
|
13
|
+
* WordPress dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
10
16
|
/**
|
|
11
17
|
* Internal dependencies
|
|
12
18
|
*/
|
|
@@ -14,6 +20,19 @@ var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support
|
|
|
14
20
|
function PostExcerptCheck({
|
|
15
21
|
children
|
|
16
22
|
}) {
|
|
23
|
+
const postType = (0, _data.useSelect)(select => {
|
|
24
|
+
const {
|
|
25
|
+
getEditedPostAttribute
|
|
26
|
+
} = select(_store.store);
|
|
27
|
+
return getEditedPostAttribute('type');
|
|
28
|
+
}, []);
|
|
29
|
+
|
|
30
|
+
// This special case is unfortunate, but the REST API of wp_template and wp_template_part
|
|
31
|
+
// support the excerpt field throught the "description" field rather than "excerpt" which means
|
|
32
|
+
// the default ExcerptPanel won't work for these.
|
|
33
|
+
if (['wp_template', 'wp_template_part'].includes(postType)) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
17
36
|
return (0, _react.createElement)(_postTypeSupportCheck.default, {
|
|
18
37
|
supportKeys: "excerpt"
|
|
19
38
|
}, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_postTypeSupportCheck","_interopRequireDefault","
|
|
1
|
+
{"version":3,"names":["_data","require","_postTypeSupportCheck","_interopRequireDefault","_store","PostExcerptCheck","children","postType","useSelect","select","getEditedPostAttribute","editorStore","includes","_react","createElement","default","supportKeys","_default","exports"],"sources":["@wordpress/editor/src/components/post-excerpt/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 PostExcerptCheck( { children } ) {\n\tconst postType = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\treturn getEditedPostAttribute( 'type' );\n\t}, [] );\n\n\t// This special case is unfortunate, but the REST API of wp_template and wp_template_part\n\t// support the excerpt field throught the \"description\" field rather than \"excerpt\" which means\n\t// the default ExcerptPanel won't work for these.\n\tif ( [ 'wp_template', 'wp_template_part' ].includes( postType ) ) {\n\t\treturn null;\n\t}\n\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,KAAA,GAAAC,OAAA;AAKA,IAAAC,qBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA,SAASI,gBAAgBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACzC,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzC,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IACxD,OAAOD,sBAAsB,CAAE,MAAO,CAAC;EACxC,CAAC,EAAE,EAAG,CAAC;;EAEP;EACA;EACA;EACA,IAAK,CAAE,aAAa,EAAE,kBAAkB,CAAE,CAACE,QAAQ,CAAEL,QAAS,CAAC,EAAG;IACjE,OAAO,IAAI;EACZ;EAEA,OACC,IAAAM,MAAA,CAAAC,aAAA,EAACZ,qBAAA,CAAAa,OAAoB;IAACC,WAAW,EAAC;EAAS,GACxCV,QACmB,CAAC;AAEzB;AAAC,IAAAW,QAAA,GAEcZ,gBAAgB;AAAAa,OAAA,CAAAH,OAAA,GAAAE,QAAA"}
|