@wordpress/edit-site 3.0.19 → 3.0.24
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/build/components/block-editor/index.js +1 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +37 -7
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +1 -11
- package/build/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build/plugins/site-export.js +1 -1
- package/build/plugins/site-export.js.map +1 -1
- package/build-module/components/block-editor/index.js +2 -2
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +37 -7
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js +0 -5
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build-module/plugins/site-export.js +2 -2
- package/build-module/plugins/site-export.js.map +1 -1
- package/build-style/style-rtl.css +11 -4
- package/build-style/style.css +11 -4
- package/package.json +8 -8
- package/src/components/block-editor/index.js +2 -2
- package/src/components/block-editor/resizable-editor.js +52 -12
- package/src/components/block-editor/style.scss +8 -0
- package/src/components/editor/style.scss +0 -1
- package/src/components/global-styles/style.scss +2 -1
- package/src/components/navigation-sidebar/navigation-panel/constants.js +0 -15
- package/src/components/navigation-sidebar/navigation-toggle/style.scss +8 -4
- package/src/plugins/site-export.js +2 -2
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js +0 -101
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/content-categories.js +0 -82
- package/build/components/navigation-sidebar/navigation-panel/menus/content-categories.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/content-pages.js +0 -82
- package/build/components/navigation-sidebar/navigation-panel/menus/content-pages.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/content-posts.js +0 -107
- package/build/components/navigation-sidebar/navigation-panel/menus/content-posts.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/index.js +0 -57
- package/build/components/navigation-sidebar/navigation-panel/menus/index.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +0 -48
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js +0 -100
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +0 -62
- package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/templates.js +0 -143
- package/build/components/navigation-sidebar/navigation-panel/menus/templates.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +0 -76
- package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +0 -125
- package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/search-results.js +0 -132
- package/build/components/navigation-sidebar/navigation-panel/search-results.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js +0 -86
- package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/template-preview.js +0 -46
- package/build/components/navigation-sidebar/navigation-panel/template-preview.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/use-debounced-search.js +0 -47
- package/build/components/navigation-sidebar/navigation-panel/use-debounced-search.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/utils.js +0 -21
- package/build/components/navigation-sidebar/navigation-panel/utils.js.map +0 -1
- package/build/utils/get-closest-available-template.js +0 -48
- package/build/utils/get-closest-available-template.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js +0 -86
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-categories.js +0 -65
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-categories.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-pages.js +0 -65
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-pages.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-posts.js +0 -90
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-posts.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/index.js +0 -40
- package/build-module/components/navigation-sidebar/navigation-panel/menus/index.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +0 -35
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js +0 -84
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +0 -50
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js +0 -124
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +0 -65
- package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +0 -106
- package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/search-results.js +0 -116
- package/build-module/components/navigation-sidebar/navigation-panel/search-results.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js +0 -71
- package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js +0 -38
- package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/use-debounced-search.js +0 -37
- package/build-module/components/navigation-sidebar/navigation-panel/use-debounced-search.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/utils.js +0 -8
- package/build-module/components/navigation-sidebar/navigation-panel/utils.js.map +0 -1
- package/build-module/utils/get-closest-available-template.js +0 -40
- package/build-module/utils/get-closest-available-template.js.map +0 -1
- package/src/components/navigation-sidebar/navigation-panel/content-navigation-item.js +0 -89
- package/src/components/navigation-sidebar/navigation-panel/menus/content-categories.js +0 -85
- package/src/components/navigation-sidebar/navigation-panel/menus/content-pages.js +0 -85
- package/src/components/navigation-sidebar/navigation-panel/menus/content-posts.js +0 -117
- package/src/components/navigation-sidebar/navigation-panel/menus/index.js +0 -61
- package/src/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +0 -34
- package/src/components/navigation-sidebar/navigation-panel/menus/template-parts.js +0 -94
- package/src/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +0 -42
- package/src/components/navigation-sidebar/navigation-panel/menus/templates.js +0 -147
- package/src/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +0 -53
- package/src/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +0 -110
- package/src/components/navigation-sidebar/navigation-panel/search-results.js +0 -117
- package/src/components/navigation-sidebar/navigation-panel/template-navigation-item.js +0 -83
- package/src/components/navigation-sidebar/navigation-panel/template-preview.js +0 -32
- package/src/components/navigation-sidebar/navigation-panel/use-debounced-search.js +0 -47
- package/src/components/navigation-sidebar/navigation-panel/utils.js +0 -11
- package/src/utils/get-closest-available-template.js +0 -31
package/build-style/style.css
CHANGED
|
@@ -467,6 +467,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
467
467
|
.edit-site-visual-editor.is-focus-mode .edit-site-visual-editor__editor-canvas {
|
|
468
468
|
border-radius: 2px;
|
|
469
469
|
}
|
|
470
|
+
.edit-site-visual-editor.is-focus-mode .components-resizable-box__container {
|
|
471
|
+
overflow: visible;
|
|
472
|
+
}
|
|
470
473
|
|
|
471
474
|
.edit-site-visual-editor__editor-canvas {
|
|
472
475
|
border-radius: 2px 2px 0 0;
|
|
@@ -484,6 +487,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
484
487
|
|
|
485
488
|
.components-resizable-box__container {
|
|
486
489
|
margin: 0 auto;
|
|
490
|
+
overflow: auto;
|
|
487
491
|
}
|
|
488
492
|
|
|
489
493
|
.resizable-editor__drag-handle {
|
|
@@ -580,7 +584,8 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
580
584
|
.edit-site-global-styles-subtitle {
|
|
581
585
|
margin-bottom: 0 !important;
|
|
582
586
|
text-transform: uppercase;
|
|
583
|
-
font-weight: 500;
|
|
587
|
+
font-weight: 500 !important;
|
|
588
|
+
font-size: 11px !important;
|
|
584
589
|
}
|
|
585
590
|
|
|
586
591
|
.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle {
|
|
@@ -914,10 +919,13 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
|
|
|
914
919
|
.edit-site-navigation-toggle__button.has-icon:focus::before {
|
|
915
920
|
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) rgba(255, 255, 255, 0.1), inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
916
921
|
}
|
|
917
|
-
|
|
918
|
-
.edit-site-navigation-toggle__site-icon {
|
|
922
|
+
.edit-site-navigation-toggle__button .edit-site-navigation-toggle__site-icon {
|
|
919
923
|
width: 36px;
|
|
924
|
+
height: 36px;
|
|
920
925
|
border-radius: 2px;
|
|
926
|
+
-o-object-fit: cover;
|
|
927
|
+
object-fit: cover;
|
|
928
|
+
margin-top: -1px;
|
|
921
929
|
}
|
|
922
930
|
|
|
923
931
|
.edit-site-navigation-panel {
|
|
@@ -1506,7 +1514,6 @@ html.wp-toolbar {
|
|
|
1506
1514
|
position: relative;
|
|
1507
1515
|
height: 100%;
|
|
1508
1516
|
display: block;
|
|
1509
|
-
overflow: hidden;
|
|
1510
1517
|
}
|
|
1511
1518
|
.edit-site-visual-editor iframe {
|
|
1512
1519
|
display: block;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.24",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -29,28 +29,28 @@
|
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
30
|
"@wordpress/a11y": "^3.2.4",
|
|
31
31
|
"@wordpress/api-fetch": "^5.2.6",
|
|
32
|
-
"@wordpress/block-editor": "^8.0.
|
|
33
|
-
"@wordpress/block-library": "^6.0.
|
|
32
|
+
"@wordpress/block-editor": "^8.0.15",
|
|
33
|
+
"@wordpress/block-library": "^6.0.23",
|
|
34
34
|
"@wordpress/blocks": "^11.1.5",
|
|
35
|
-
"@wordpress/components": "^19.
|
|
35
|
+
"@wordpress/components": "^19.2.2",
|
|
36
36
|
"@wordpress/compose": "^5.0.7",
|
|
37
37
|
"@wordpress/core-data": "^4.0.9",
|
|
38
38
|
"@wordpress/data": "^6.1.5",
|
|
39
39
|
"@wordpress/data-controls": "^2.2.8",
|
|
40
|
-
"@wordpress/editor": "^12.0.
|
|
40
|
+
"@wordpress/editor": "^12.0.18",
|
|
41
41
|
"@wordpress/element": "^4.0.4",
|
|
42
42
|
"@wordpress/hooks": "^3.2.2",
|
|
43
43
|
"@wordpress/html-entities": "^3.2.3",
|
|
44
44
|
"@wordpress/i18n": "^4.2.4",
|
|
45
45
|
"@wordpress/icons": "^6.1.1",
|
|
46
|
-
"@wordpress/interface": "^4.1.
|
|
46
|
+
"@wordpress/interface": "^4.1.17",
|
|
47
47
|
"@wordpress/keyboard-shortcuts": "^3.0.7",
|
|
48
48
|
"@wordpress/keycodes": "^3.2.4",
|
|
49
49
|
"@wordpress/media-utils": "^3.0.5",
|
|
50
50
|
"@wordpress/notices": "^3.2.8",
|
|
51
51
|
"@wordpress/plugins": "^4.0.7",
|
|
52
52
|
"@wordpress/primitives": "^3.0.4",
|
|
53
|
-
"@wordpress/reusable-blocks": "^3.0.
|
|
53
|
+
"@wordpress/reusable-blocks": "^3.0.21",
|
|
54
54
|
"@wordpress/url": "^3.3.1",
|
|
55
55
|
"@wordpress/viewport": "^4.0.7",
|
|
56
56
|
"classnames": "^2.3.1",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "0e4085301b13440717334d012c45399949163b4a"
|
|
68
68
|
}
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
BlockTools,
|
|
18
18
|
__unstableBlockSettingsMenuFirstItem,
|
|
19
19
|
__unstableUseTypingObserver as useTypingObserver,
|
|
20
|
+
BlockEditorKeyboardShortcuts,
|
|
20
21
|
store as blockEditorStore,
|
|
21
22
|
} from '@wordpress/block-editor';
|
|
22
23
|
import { useMergeRefs, useViewportMatch } from '@wordpress/compose';
|
|
@@ -108,8 +109,8 @@ export default function BlockEditor( { setIsInserterOpen } ) {
|
|
|
108
109
|
}
|
|
109
110
|
} }
|
|
110
111
|
>
|
|
112
|
+
<BlockEditorKeyboardShortcuts.Register />
|
|
111
113
|
<BackButton />
|
|
112
|
-
|
|
113
114
|
<ResizableEditor
|
|
114
115
|
// Reinitialize the editor and reset the states when the template changes.
|
|
115
116
|
key={ templateId }
|
|
@@ -127,7 +128,6 @@ export default function BlockEditor( { setIsInserterOpen } ) {
|
|
|
127
128
|
renderAppender={ isTemplatePart ? false : undefined }
|
|
128
129
|
/>
|
|
129
130
|
</ResizableEditor>
|
|
130
|
-
|
|
131
131
|
<__unstableBlockSettingsMenuFirstItem>
|
|
132
132
|
{ ( { onClose } ) => (
|
|
133
133
|
<BlockInspectorButton onClick={ onClose } />
|
|
@@ -57,22 +57,49 @@ function ResizableEditor( { enableResizing, settings, ...props } ) {
|
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
let animationFrame = null;
|
|
61
|
+
|
|
62
|
+
function resizeHeight() {
|
|
63
|
+
if ( ! animationFrame ) {
|
|
64
|
+
// Throttle the updates on animation frame.
|
|
65
|
+
animationFrame = iframe.contentWindow.requestAnimationFrame(
|
|
66
|
+
() => {
|
|
67
|
+
setHeight(
|
|
68
|
+
iframe.contentDocument.documentElement
|
|
69
|
+
.scrollHeight
|
|
70
|
+
);
|
|
71
|
+
animationFrame = null;
|
|
72
|
+
}
|
|
66
73
|
);
|
|
67
74
|
}
|
|
68
|
-
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let resizeObserver;
|
|
78
|
+
|
|
79
|
+
function registerObserver() {
|
|
80
|
+
resizeObserver?.disconnect();
|
|
81
|
+
|
|
82
|
+
resizeObserver = new iframe.contentWindow.ResizeObserver(
|
|
83
|
+
resizeHeight
|
|
84
|
+
);
|
|
85
|
+
// Observing the <html> rather than the <body> because the latter
|
|
86
|
+
// gets destroyed and remounted after initialization in <Iframe>.
|
|
87
|
+
resizeObserver.observe(
|
|
88
|
+
iframe.contentDocument.documentElement
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
resizeHeight();
|
|
92
|
+
}
|
|
69
93
|
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
94
|
+
// This is only required in Firefox for some unknown reasons.
|
|
95
|
+
iframe.addEventListener( 'load', registerObserver );
|
|
96
|
+
// This is required in Chrome and Safari.
|
|
97
|
+
registerObserver();
|
|
73
98
|
|
|
74
99
|
return () => {
|
|
75
|
-
|
|
100
|
+
iframe.contentWindow?.cancelAnimationFrame( animationFrame );
|
|
101
|
+
resizeObserver?.disconnect();
|
|
102
|
+
iframe.removeEventListener( 'load', registerObserver );
|
|
76
103
|
};
|
|
77
104
|
},
|
|
78
105
|
[ enableResizing ]
|
|
@@ -133,8 +160,21 @@ function ResizableEditor( { enableResizing, settings, ...props } ) {
|
|
|
133
160
|
<style>{
|
|
134
161
|
// Forming a "block formatting context" to prevent margin collapsing.
|
|
135
162
|
// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
|
|
136
|
-
`.
|
|
163
|
+
`.is-root-container { display: flow-root; }`
|
|
137
164
|
}</style>
|
|
165
|
+
{ enableResizing && (
|
|
166
|
+
<style>
|
|
167
|
+
{
|
|
168
|
+
// Force the <html> and <body>'s heights to fit the content.
|
|
169
|
+
`html, body { height: -moz-fit-content !important; height: fit-content !important; min-height: 0 !important; }`
|
|
170
|
+
}
|
|
171
|
+
{
|
|
172
|
+
// Some themes will have `min-height: 100vh` for the root container,
|
|
173
|
+
// which isn't a requirement in auto resize mode.
|
|
174
|
+
`.is-root-container { min-height: 0 !important; }`
|
|
175
|
+
}
|
|
176
|
+
</style>
|
|
177
|
+
) }
|
|
138
178
|
</>
|
|
139
179
|
}
|
|
140
180
|
ref={ ref }
|
|
@@ -24,6 +24,12 @@
|
|
|
24
24
|
.edit-site-visual-editor__editor-canvas {
|
|
25
25
|
border-radius: 2px;
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
// To hide the horizontal scrollbar and show the drag handle on the
|
|
29
|
+
// left and right of the container.
|
|
30
|
+
.components-resizable-box__container {
|
|
31
|
+
overflow: visible;
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
|
|
@@ -46,6 +52,8 @@
|
|
|
46
52
|
|
|
47
53
|
.components-resizable-box__container {
|
|
48
54
|
margin: 0 auto;
|
|
55
|
+
// Removing this will cancel the bottom margins in the iframe.
|
|
56
|
+
overflow: auto;
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
.resizable-editor__drag-handle {
|
|
@@ -64,7 +64,8 @@
|
|
|
64
64
|
// Need to override the too specific styles for complementary areas.
|
|
65
65
|
margin-bottom: 0 !important;
|
|
66
66
|
text-transform: uppercase;
|
|
67
|
-
font-weight: 500;
|
|
67
|
+
font-weight: 500 !important;
|
|
68
|
+
font-size: 11px !important;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle {
|
|
@@ -51,16 +51,6 @@ export const TEMPLATES_POSTS_PREFIXES = [
|
|
|
51
51
|
|
|
52
52
|
export const TEMPLATES_PAGES_PREFIXES = [ 'page-' ];
|
|
53
53
|
|
|
54
|
-
export const TEMPLATES_NEW_OPTIONS = [
|
|
55
|
-
'front-page',
|
|
56
|
-
'single-post',
|
|
57
|
-
'page',
|
|
58
|
-
'archive',
|
|
59
|
-
'search',
|
|
60
|
-
'404',
|
|
61
|
-
'index',
|
|
62
|
-
];
|
|
63
|
-
|
|
64
54
|
export const TEMPLATE_OVERRIDES = {
|
|
65
55
|
singular: [ 'single', 'page' ],
|
|
66
56
|
index: [ 'archive', '404', 'search', 'singular', 'home' ],
|
|
@@ -68,9 +58,6 @@ export const TEMPLATE_OVERRIDES = {
|
|
|
68
58
|
};
|
|
69
59
|
|
|
70
60
|
export const MENU_ROOT = 'root';
|
|
71
|
-
export const MENU_CONTENT_CATEGORIES = 'content-categories';
|
|
72
|
-
export const MENU_CONTENT_PAGES = 'content-pages';
|
|
73
|
-
export const MENU_CONTENT_POSTS = 'content-posts';
|
|
74
61
|
export const MENU_TEMPLATE_PARTS = 'template-parts';
|
|
75
62
|
export const MENU_TEMPLATES = 'templates';
|
|
76
63
|
export const MENU_TEMPLATES_GENERAL = 'templates-general';
|
|
@@ -78,8 +65,6 @@ export const MENU_TEMPLATES_PAGES = 'templates-pages';
|
|
|
78
65
|
export const MENU_TEMPLATES_POSTS = 'templates-posts';
|
|
79
66
|
export const MENU_TEMPLATES_UNUSED = 'templates-unused';
|
|
80
67
|
|
|
81
|
-
export const SEARCH_DEBOUNCE_IN_MS = 75;
|
|
82
|
-
|
|
83
68
|
export const MENU_TEMPLATE_PARTS_HEADERS = 'template-parts-headers';
|
|
84
69
|
export const MENU_TEMPLATE_PARTS_FOOTERS = 'template-parts-footers';
|
|
85
70
|
export const MENU_TEMPLATE_PARTS_SIDEBARS = 'template-parts-sidebars';
|
|
@@ -58,9 +58,13 @@
|
|
|
58
58
|
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) rgba($white, 0.1), inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
}
|
|
62
61
|
|
|
63
|
-
.edit-site-navigation-toggle__site-icon {
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
.edit-site-navigation-toggle__site-icon {
|
|
63
|
+
width: $button-size;
|
|
64
|
+
height: $button-size;
|
|
65
|
+
border-radius: $radius-block-ui;
|
|
66
|
+
object-fit: cover;
|
|
67
|
+
// Compensate for the top-bar border.
|
|
68
|
+
margin-top: -($border-width);
|
|
69
|
+
}
|
|
66
70
|
}
|
|
@@ -6,7 +6,7 @@ import downloadjs from 'downloadjs';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
9
|
+
import { __, _x } from '@wordpress/i18n';
|
|
10
10
|
import { MenuItem } from '@wordpress/components';
|
|
11
11
|
import apiFetch from '@wordpress/api-fetch';
|
|
12
12
|
import { download } from '@wordpress/icons';
|
|
@@ -46,7 +46,7 @@ export default function SiteExport() {
|
|
|
46
46
|
onClick={ handleExport }
|
|
47
47
|
info={ __( 'Download your templates and template parts.' ) }
|
|
48
48
|
>
|
|
49
|
-
{
|
|
49
|
+
{ _x( 'Export', 'site exporter menu item' ) }
|
|
50
50
|
</MenuItem>
|
|
51
51
|
);
|
|
52
52
|
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = ContentNavigationItem;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
|
-
|
|
14
|
-
var _data = require("@wordpress/data");
|
|
15
|
-
|
|
16
|
-
var _i18n = require("@wordpress/i18n");
|
|
17
|
-
|
|
18
|
-
var _url = require("@wordpress/url");
|
|
19
|
-
|
|
20
|
-
var _coreData = require("@wordpress/core-data");
|
|
21
|
-
|
|
22
|
-
var _ = require("..");
|
|
23
|
-
|
|
24
|
-
var _templatePreview = _interopRequireDefault(require("./template-preview"));
|
|
25
|
-
|
|
26
|
-
var _store = require("../../../store");
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* WordPress dependencies
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Internal dependencies
|
|
34
|
-
*/
|
|
35
|
-
const getTitle = entity => {
|
|
36
|
-
var _entity$title;
|
|
37
|
-
|
|
38
|
-
const title = entity.taxonomy ? entity.name : entity === null || entity === void 0 ? void 0 : (_entity$title = entity.title) === null || _entity$title === void 0 ? void 0 : _entity$title.rendered; // Make sure encoded characters are displayed as the characters they represent.
|
|
39
|
-
|
|
40
|
-
const titleElement = document.createElement('div');
|
|
41
|
-
titleElement.innerHTML = title;
|
|
42
|
-
return titleElement.textContent || titleElement.innerText || '';
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
function ContentNavigationItem(_ref) {
|
|
46
|
-
let {
|
|
47
|
-
item
|
|
48
|
-
} = _ref;
|
|
49
|
-
const [isPreviewVisible, setIsPreviewVisible] = (0, _element.useState)(false);
|
|
50
|
-
const previewContent = (0, _data.useSelect)(select => {
|
|
51
|
-
if (!isPreviewVisible) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const template = select(_coreData.store).__experimentalGetTemplateForLink(item.link);
|
|
56
|
-
|
|
57
|
-
return template === null || template === void 0 ? void 0 : template.content;
|
|
58
|
-
}, [isPreviewVisible]);
|
|
59
|
-
const {
|
|
60
|
-
setPage,
|
|
61
|
-
setIsNavigationPanelOpened
|
|
62
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
63
|
-
const onActivateItem = (0, _element.useCallback)(() => {
|
|
64
|
-
const {
|
|
65
|
-
type,
|
|
66
|
-
slug,
|
|
67
|
-
link,
|
|
68
|
-
id
|
|
69
|
-
} = item;
|
|
70
|
-
setPage({
|
|
71
|
-
type,
|
|
72
|
-
slug,
|
|
73
|
-
path: (0, _url.getPathAndQueryString)(link),
|
|
74
|
-
context: {
|
|
75
|
-
postType: type,
|
|
76
|
-
postId: id
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
setIsNavigationPanelOpened(false);
|
|
80
|
-
}, [setPage, item]);
|
|
81
|
-
|
|
82
|
-
if (!item) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalNavigationItem, {
|
|
87
|
-
className: "edit-site-navigation-panel__content-item",
|
|
88
|
-
item: `${item.taxonomy || item.type}-${item.id}`,
|
|
89
|
-
title: getTitle(item) || (0, _i18n.__)('(no title)'),
|
|
90
|
-
onClick: onActivateItem,
|
|
91
|
-
onMouseEnter: () => setIsPreviewVisible(true),
|
|
92
|
-
onMouseLeave: () => setIsPreviewVisible(false)
|
|
93
|
-
}), isPreviewVisible && previewContent && (0, _element.createElement)(_.NavigationPanelPreviewFill, null, (0, _element.createElement)(_templatePreview.default, {
|
|
94
|
-
rawContent: previewContent,
|
|
95
|
-
blockContext: {
|
|
96
|
-
postType: item.type,
|
|
97
|
-
postId: item.id
|
|
98
|
-
}
|
|
99
|
-
})));
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=content-navigation-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/content-navigation-item.js"],"names":["getTitle","entity","title","taxonomy","name","rendered","titleElement","document","createElement","innerHTML","textContent","innerText","ContentNavigationItem","item","isPreviewVisible","setIsPreviewVisible","previewContent","select","template","coreStore","__experimentalGetTemplateForLink","link","content","setPage","setIsNavigationPanelOpened","editSiteStore","onActivateItem","type","slug","id","path","context","postType","postId"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAfA;AACA;AACA;;AAQA;AACA;AACA;AAKA,MAAMA,QAAQ,GAAKC,MAAF,IAAc;AAAA;;AAC9B,QAAMC,KAAK,GAAGD,MAAM,CAACE,QAAP,GAAkBF,MAAM,CAACG,IAAzB,GAAgCH,MAAhC,aAAgCA,MAAhC,wCAAgCA,MAAM,CAAEC,KAAxC,kDAAgC,cAAeG,QAA7D,CAD8B,CAG9B;;AACA,QAAMC,YAAY,GAAGC,QAAQ,CAACC,aAAT,CAAwB,KAAxB,CAArB;AACAF,EAAAA,YAAY,CAACG,SAAb,GAAyBP,KAAzB;AAEA,SAAOI,YAAY,CAACI,WAAb,IAA4BJ,YAAY,CAACK,SAAzC,IAAsD,EAA7D;AACA,CARD;;AAUe,SAASC,qBAAT,OAA2C;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACzD,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,uBAAU,KAAV,CAAlD;AACA,QAAMC,cAAc,GAAG,qBACpBC,MAAF,IAAc;AACb,QAAK,CAAEH,gBAAP,EAA0B;AACzB,aAAO,IAAP;AACA;;AAED,UAAMI,QAAQ,GAAGD,MAAM,CACtBE,eADsB,CAAN,CAEfC,gCAFe,CAEmBP,IAAI,CAACQ,IAFxB,CAAjB;;AAGA,WAAOH,QAAP,aAAOA,QAAP,uBAAOA,QAAQ,CAAEI,OAAjB;AACA,GAVqB,EAWtB,CAAER,gBAAF,CAXsB,CAAvB;AAaA,QAAM;AAAES,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAA0C,uBAC/CC,YAD+C,CAAhD;AAIA,QAAMC,cAAc,GAAG,0BAAa,MAAM;AACzC,UAAM;AAAEC,MAAAA,IAAF;AAAQC,MAAAA,IAAR;AAAcP,MAAAA,IAAd;AAAoBQ,MAAAA;AAApB,QAA2BhB,IAAjC;AACAU,IAAAA,OAAO,CAAE;AACRI,MAAAA,IADQ;AAERC,MAAAA,IAFQ;AAGRE,MAAAA,IAAI,EAAE,gCAAuBT,IAAvB,CAHE;AAIRU,MAAAA,OAAO,EAAE;AACRC,QAAAA,QAAQ,EAAEL,IADF;AAERM,QAAAA,MAAM,EAAEJ;AAFA;AAJD,KAAF,CAAP;AASAL,IAAAA,0BAA0B,CAAE,KAAF,CAA1B;AACA,GAZsB,EAYpB,CAAED,OAAF,EAAWV,IAAX,CAZoB,CAAvB;;AAcA,MAAK,CAAEA,IAAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,SACC,qDACC,4BAAC,wCAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,IAAI,EAAI,GAAGA,IAAI,CAACV,QAAL,IAAiBU,IAAI,CAACc,IAAM,IAAId,IAAI,CAACgB,EAAI,EAFrD;AAGC,IAAA,KAAK,EAAG7B,QAAQ,CAAEa,IAAF,CAAR,IAAoB,cAAI,YAAJ,CAH7B;AAIC,IAAA,OAAO,EAAGa,cAJX;AAKC,IAAA,YAAY,EAAG,MAAMX,mBAAmB,CAAE,IAAF,CALzC;AAMC,IAAA,YAAY,EAAG,MAAMA,mBAAmB,CAAE,KAAF;AANzC,IADD,EAUGD,gBAAgB,IAAIE,cAApB,IACD,4BAAC,4BAAD,QACC,4BAAC,wBAAD;AACC,IAAA,UAAU,EAAGA,cADd;AAEC,IAAA,YAAY,EAAG;AACdgB,MAAAA,QAAQ,EAAEnB,IAAI,CAACc,IADD;AAEdM,MAAAA,MAAM,EAAEpB,IAAI,CAACgB;AAFC;AAFhB,IADD,CAXF,CADD;AAwBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalNavigationItem as NavigationItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getPathAndQueryString } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { NavigationPanelPreviewFill } from '..';\nimport TemplatePreview from './template-preview';\nimport { store as editSiteStore } from '../../../store';\n\nconst getTitle = ( entity ) => {\n\tconst title = entity.taxonomy ? entity.name : entity?.title?.rendered;\n\n\t// Make sure encoded characters are displayed as the characters they represent.\n\tconst titleElement = document.createElement( 'div' );\n\ttitleElement.innerHTML = title;\n\n\treturn titleElement.textContent || titleElement.innerText || '';\n};\n\nexport default function ContentNavigationItem( { item } ) {\n\tconst [ isPreviewVisible, setIsPreviewVisible ] = useState( false );\n\tconst previewContent = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isPreviewVisible ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst template = select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetTemplateForLink( item.link );\n\t\t\treturn template?.content;\n\t\t},\n\t\t[ isPreviewVisible ]\n\t);\n\tconst { setPage, setIsNavigationPanelOpened } = useDispatch(\n\t\teditSiteStore\n\t);\n\n\tconst onActivateItem = useCallback( () => {\n\t\tconst { type, slug, link, id } = item;\n\t\tsetPage( {\n\t\t\ttype,\n\t\t\tslug,\n\t\t\tpath: getPathAndQueryString( link ),\n\t\t\tcontext: {\n\t\t\t\tpostType: type,\n\t\t\t\tpostId: id,\n\t\t\t},\n\t\t} );\n\t\tsetIsNavigationPanelOpened( false );\n\t}, [ setPage, item ] );\n\n\tif ( ! item ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<NavigationItem\n\t\t\t\tclassName=\"edit-site-navigation-panel__content-item\"\n\t\t\t\titem={ `${ item.taxonomy || item.type }-${ item.id }` }\n\t\t\t\ttitle={ getTitle( item ) || __( '(no title)' ) }\n\t\t\t\tonClick={ onActivateItem }\n\t\t\t\tonMouseEnter={ () => setIsPreviewVisible( true ) }\n\t\t\t\tonMouseLeave={ () => setIsPreviewVisible( false ) }\n\t\t\t/>\n\n\t\t\t{ isPreviewVisible && previewContent && (\n\t\t\t\t<NavigationPanelPreviewFill>\n\t\t\t\t\t<TemplatePreview\n\t\t\t\t\t\trawContent={ previewContent }\n\t\t\t\t\t\tblockContext={ {\n\t\t\t\t\t\t\tpostType: item.type,\n\t\t\t\t\t\t\tpostId: item.id,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</NavigationPanelPreviewFill>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = ContentCategoriesMenu;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
|
-
|
|
14
|
-
var _i18n = require("@wordpress/i18n");
|
|
15
|
-
|
|
16
|
-
var _data = require("@wordpress/data");
|
|
17
|
-
|
|
18
|
-
var _coreData = require("@wordpress/core-data");
|
|
19
|
-
|
|
20
|
-
var _constants = require("../constants");
|
|
21
|
-
|
|
22
|
-
var _contentNavigationItem = _interopRequireDefault(require("../content-navigation-item"));
|
|
23
|
-
|
|
24
|
-
var _searchResults = _interopRequireDefault(require("../search-results"));
|
|
25
|
-
|
|
26
|
-
var _useDebouncedSearch = _interopRequireDefault(require("../use-debounced-search"));
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* WordPress dependencies
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Internal dependencies
|
|
34
|
-
*/
|
|
35
|
-
function ContentCategoriesMenu() {
|
|
36
|
-
const {
|
|
37
|
-
search,
|
|
38
|
-
searchQuery,
|
|
39
|
-
onSearch,
|
|
40
|
-
isDebouncing
|
|
41
|
-
} = (0, _useDebouncedSearch.default)();
|
|
42
|
-
const {
|
|
43
|
-
categories,
|
|
44
|
-
isResolved
|
|
45
|
-
} = (0, _data.useSelect)(select => {
|
|
46
|
-
const {
|
|
47
|
-
getEntityRecords,
|
|
48
|
-
hasFinishedResolution
|
|
49
|
-
} = select(_coreData.store);
|
|
50
|
-
const query = searchQuery ? {
|
|
51
|
-
search: searchQuery
|
|
52
|
-
} : undefined;
|
|
53
|
-
const getEntityRecordsArgs = ['taxonomy', 'category', query];
|
|
54
|
-
const hasResolvedPosts = hasFinishedResolution('getEntityRecords', getEntityRecordsArgs);
|
|
55
|
-
return {
|
|
56
|
-
categories: getEntityRecords(...getEntityRecordsArgs),
|
|
57
|
-
isResolved: hasResolvedPosts
|
|
58
|
-
};
|
|
59
|
-
}, [searchQuery]);
|
|
60
|
-
const shouldShowLoadingForDebouncing = search && isDebouncing;
|
|
61
|
-
const showLoading = !isResolved || shouldShowLoadingForDebouncing;
|
|
62
|
-
return (0, _element.createElement)(_components.__experimentalNavigationMenu, {
|
|
63
|
-
menu: _constants.MENU_CONTENT_CATEGORIES,
|
|
64
|
-
title: (0, _i18n.__)('Categories'),
|
|
65
|
-
parentMenu: _constants.MENU_ROOT,
|
|
66
|
-
hasSearch: true,
|
|
67
|
-
onSearch: onSearch,
|
|
68
|
-
search: search,
|
|
69
|
-
isSearchDebouncing: isDebouncing || !isResolved
|
|
70
|
-
}, search && !isDebouncing && (0, _element.createElement)(_searchResults.default, {
|
|
71
|
-
items: categories,
|
|
72
|
-
search: search,
|
|
73
|
-
disableFilter: true
|
|
74
|
-
}), !search && (categories === null || categories === void 0 ? void 0 : categories.map(category => (0, _element.createElement)(_contentNavigationItem.default, {
|
|
75
|
-
item: category,
|
|
76
|
-
key: `${category.taxonomy}-${category.id}`
|
|
77
|
-
}))), showLoading && (0, _element.createElement)(_components.__experimentalNavigationItem, {
|
|
78
|
-
title: (0, _i18n.__)('Loading…'),
|
|
79
|
-
isText: true
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=content-categories.js.map
|
package/build/components/navigation-sidebar/navigation-panel/menus/content-categories.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-categories.js"],"names":["ContentCategoriesMenu","search","searchQuery","onSearch","isDebouncing","categories","isResolved","select","getEntityRecords","hasFinishedResolution","coreStore","query","undefined","getEntityRecordsArgs","hasResolvedPosts","shouldShowLoadingForDebouncing","showLoading","MENU_CONTENT_CATEGORIES","MENU_ROOT","map","category","taxonomy","id"],"mappings":";;;;;;;;;;;AAGA;;AAIA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AASA;AACA;AACA;AAMe,SAASA,qBAAT,GAAiC;AAC/C,QAAM;AACLC,IAAAA,MADK;AAELC,IAAAA,WAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA;AAJK,MAKF,kCALJ;AAOA,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA6B,qBAChCC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,gBAAF;AAAoBC,MAAAA;AAApB,QAA8CF,MAAM,CACzDG,eADyD,CAA1D;AAGA,UAAMC,KAAK,GAAGT,WAAW,GACtB;AACAD,MAAAA,MAAM,EAAEC;AADR,KADsB,GAItBU,SAJH;AAKA,UAAMC,oBAAoB,GAAG,CAAE,UAAF,EAAc,UAAd,EAA0BF,KAA1B,CAA7B;AACA,UAAMG,gBAAgB,GAAGL,qBAAqB,CAC7C,kBAD6C,EAE7CI,oBAF6C,CAA9C;AAIA,WAAO;AACNR,MAAAA,UAAU,EAAEG,gBAAgB,CAAE,GAAGK,oBAAL,CADtB;AAENP,MAAAA,UAAU,EAAEQ;AAFN,KAAP;AAIA,GAnBiC,EAoBlC,CAAEZ,WAAF,CApBkC,CAAnC;AAuBA,QAAMa,8BAA8B,GAAGd,MAAM,IAAIG,YAAjD;AACA,QAAMY,WAAW,GAAG,CAAEV,UAAF,IAAgBS,8BAApC;AAEA,SACC,4BAAC,wCAAD;AACC,IAAA,IAAI,EAAGE,kCADR;AAEC,IAAA,KAAK,EAAG,cAAI,YAAJ,CAFT;AAGC,IAAA,UAAU,EAAGC,oBAHd;AAIC,IAAA,SAAS,EAAG,IAJb;AAKC,IAAA,QAAQ,EAAGf,QALZ;AAMC,IAAA,MAAM,EAAGF,MANV;AAOC,IAAA,kBAAkB,EAAGG,YAAY,IAAI,CAAEE;AAPxC,KASGL,MAAM,IAAI,CAAEG,YAAZ,IACD,4BAAC,sBAAD;AACC,IAAA,KAAK,EAAGC,UADT;AAEC,IAAA,MAAM,EAAGJ,MAFV;AAGC,IAAA,aAAa;AAHd,IAVF,EAiBG,CAAEA,MAAF,KACDI,UADC,aACDA,UADC,uBACDA,UAAU,CAAEc,GAAZ,CAAmBC,QAAF,IAChB,4BAAC,8BAAD;AACC,IAAA,IAAI,EAAGA,QADR;AAEC,IAAA,GAAG,EAAI,GAAGA,QAAQ,CAACC,QAAU,IAAID,QAAQ,CAACE,EAAI;AAF/C,IADD,CADC,CAjBH,EAyBGN,WAAW,IACZ,4BAAC,wCAAD;AAAgB,IAAA,KAAK,EAAG,cAAI,UAAJ,CAAxB;AAA2C,IAAA,MAAM;AAAjD,IA1BF,CADD;AA+BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigationMenu as NavigationMenu,\n\t__experimentalNavigationItem as NavigationItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { MENU_CONTENT_CATEGORIES, MENU_ROOT } from '../constants';\nimport ContentNavigationItem from '../content-navigation-item';\nimport SearchResults from '../search-results';\nimport useDebouncedSearch from '../use-debounced-search';\n\nexport default function ContentCategoriesMenu() {\n\tconst {\n\t\tsearch,\n\t\tsearchQuery,\n\t\tonSearch,\n\t\tisDebouncing,\n\t} = useDebouncedSearch();\n\n\tconst { categories, isResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, hasFinishedResolution } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\tconst query = searchQuery\n\t\t\t\t? {\n\t\t\t\t\t\tsearch: searchQuery,\n\t\t\t\t }\n\t\t\t\t: undefined;\n\t\t\tconst getEntityRecordsArgs = [ 'taxonomy', 'category', query ];\n\t\t\tconst hasResolvedPosts = hasFinishedResolution(\n\t\t\t\t'getEntityRecords',\n\t\t\t\tgetEntityRecordsArgs\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcategories: getEntityRecords( ...getEntityRecordsArgs ),\n\t\t\t\tisResolved: hasResolvedPosts,\n\t\t\t};\n\t\t},\n\t\t[ searchQuery ]\n\t);\n\n\tconst shouldShowLoadingForDebouncing = search && isDebouncing;\n\tconst showLoading = ! isResolved || shouldShowLoadingForDebouncing;\n\n\treturn (\n\t\t<NavigationMenu\n\t\t\tmenu={ MENU_CONTENT_CATEGORIES }\n\t\t\ttitle={ __( 'Categories' ) }\n\t\t\tparentMenu={ MENU_ROOT }\n\t\t\thasSearch={ true }\n\t\t\tonSearch={ onSearch }\n\t\t\tsearch={ search }\n\t\t\tisSearchDebouncing={ isDebouncing || ! isResolved }\n\t\t>\n\t\t\t{ search && ! isDebouncing && (\n\t\t\t\t<SearchResults\n\t\t\t\t\titems={ categories }\n\t\t\t\t\tsearch={ search }\n\t\t\t\t\tdisableFilter\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ ! search &&\n\t\t\t\tcategories?.map( ( category ) => (\n\t\t\t\t\t<ContentNavigationItem\n\t\t\t\t\t\titem={ category }\n\t\t\t\t\t\tkey={ `${ category.taxonomy }-${ category.id }` }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\n\t\t\t{ showLoading && (\n\t\t\t\t<NavigationItem title={ __( 'Loading…' ) } isText />\n\t\t\t) }\n\t\t</NavigationMenu>\n\t);\n}\n"]}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = ContentPagesMenu;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
|
-
|
|
14
|
-
var _i18n = require("@wordpress/i18n");
|
|
15
|
-
|
|
16
|
-
var _data = require("@wordpress/data");
|
|
17
|
-
|
|
18
|
-
var _coreData = require("@wordpress/core-data");
|
|
19
|
-
|
|
20
|
-
var _constants = require("../constants");
|
|
21
|
-
|
|
22
|
-
var _contentNavigationItem = _interopRequireDefault(require("../content-navigation-item"));
|
|
23
|
-
|
|
24
|
-
var _searchResults = _interopRequireDefault(require("../search-results"));
|
|
25
|
-
|
|
26
|
-
var _useDebouncedSearch = _interopRequireDefault(require("../use-debounced-search"));
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* WordPress dependencies
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Internal dependencies
|
|
34
|
-
*/
|
|
35
|
-
function ContentPagesMenu() {
|
|
36
|
-
const {
|
|
37
|
-
search,
|
|
38
|
-
searchQuery,
|
|
39
|
-
onSearch,
|
|
40
|
-
isDebouncing
|
|
41
|
-
} = (0, _useDebouncedSearch.default)();
|
|
42
|
-
const {
|
|
43
|
-
pages,
|
|
44
|
-
isResolved
|
|
45
|
-
} = (0, _data.useSelect)(select => {
|
|
46
|
-
const {
|
|
47
|
-
getEntityRecords,
|
|
48
|
-
hasFinishedResolution
|
|
49
|
-
} = select(_coreData.store);
|
|
50
|
-
const query = searchQuery ? {
|
|
51
|
-
search: searchQuery
|
|
52
|
-
} : undefined;
|
|
53
|
-
const getEntityRecordsArgs = ['postType', 'page', query];
|
|
54
|
-
const hasResolvedPosts = hasFinishedResolution('getEntityRecords', getEntityRecordsArgs);
|
|
55
|
-
return {
|
|
56
|
-
pages: getEntityRecords(...getEntityRecordsArgs),
|
|
57
|
-
isResolved: hasResolvedPosts
|
|
58
|
-
};
|
|
59
|
-
}, [searchQuery]);
|
|
60
|
-
const shouldShowLoadingForDebouncing = search && isDebouncing;
|
|
61
|
-
const showLoading = !isResolved || shouldShowLoadingForDebouncing;
|
|
62
|
-
return (0, _element.createElement)(_components.__experimentalNavigationMenu, {
|
|
63
|
-
menu: _constants.MENU_CONTENT_PAGES,
|
|
64
|
-
title: (0, _i18n.__)('Pages'),
|
|
65
|
-
parentMenu: _constants.MENU_ROOT,
|
|
66
|
-
hasSearch: true,
|
|
67
|
-
onSearch: onSearch,
|
|
68
|
-
search: search,
|
|
69
|
-
isSearchDebouncing: isDebouncing || !isResolved
|
|
70
|
-
}, search && !isDebouncing && (0, _element.createElement)(_searchResults.default, {
|
|
71
|
-
items: pages,
|
|
72
|
-
search: search,
|
|
73
|
-
disableFilter: true
|
|
74
|
-
}), !search && (pages === null || pages === void 0 ? void 0 : pages.map(page => (0, _element.createElement)(_contentNavigationItem.default, {
|
|
75
|
-
item: page,
|
|
76
|
-
key: `${page.type}-${page.id}`
|
|
77
|
-
}))), showLoading && (0, _element.createElement)(_components.__experimentalNavigationItem, {
|
|
78
|
-
title: (0, _i18n.__)('Loading…'),
|
|
79
|
-
isText: true
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=content-pages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-pages.js"],"names":["ContentPagesMenu","search","searchQuery","onSearch","isDebouncing","pages","isResolved","select","getEntityRecords","hasFinishedResolution","coreStore","query","undefined","getEntityRecordsArgs","hasResolvedPosts","shouldShowLoadingForDebouncing","showLoading","MENU_CONTENT_PAGES","MENU_ROOT","map","page","type","id"],"mappings":";;;;;;;;;;;AAGA;;AAIA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AASA;AACA;AACA;AAMe,SAASA,gBAAT,GAA4B;AAC1C,QAAM;AACLC,IAAAA,MADK;AAELC,IAAAA,WAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA;AAJK,MAKF,kCALJ;AAOA,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAwB,qBAC3BC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,gBAAF;AAAoBC,MAAAA;AAApB,QAA8CF,MAAM,CACzDG,eADyD,CAA1D;AAGA,UAAMC,KAAK,GAAGT,WAAW,GACtB;AACAD,MAAAA,MAAM,EAAEC;AADR,KADsB,GAItBU,SAJH;AAKA,UAAMC,oBAAoB,GAAG,CAAE,UAAF,EAAc,MAAd,EAAsBF,KAAtB,CAA7B;AACA,UAAMG,gBAAgB,GAAGL,qBAAqB,CAC7C,kBAD6C,EAE7CI,oBAF6C,CAA9C;AAIA,WAAO;AACNR,MAAAA,KAAK,EAAEG,gBAAgB,CAAE,GAAGK,oBAAL,CADjB;AAENP,MAAAA,UAAU,EAAEQ;AAFN,KAAP;AAIA,GAnB4B,EAoB7B,CAAEZ,WAAF,CApB6B,CAA9B;AAuBA,QAAMa,8BAA8B,GAAGd,MAAM,IAAIG,YAAjD;AACA,QAAMY,WAAW,GAAG,CAAEV,UAAF,IAAgBS,8BAApC;AAEA,SACC,4BAAC,wCAAD;AACC,IAAA,IAAI,EAAGE,6BADR;AAEC,IAAA,KAAK,EAAG,cAAI,OAAJ,CAFT;AAGC,IAAA,UAAU,EAAGC,oBAHd;AAIC,IAAA,SAAS,EAAG,IAJb;AAKC,IAAA,QAAQ,EAAGf,QALZ;AAMC,IAAA,MAAM,EAAGF,MANV;AAOC,IAAA,kBAAkB,EAAGG,YAAY,IAAI,CAAEE;AAPxC,KASGL,MAAM,IAAI,CAAEG,YAAZ,IACD,4BAAC,sBAAD;AACC,IAAA,KAAK,EAAGC,KADT;AAEC,IAAA,MAAM,EAAGJ,MAFV;AAGC,IAAA,aAAa;AAHd,IAVF,EAiBG,CAAEA,MAAF,KACDI,KADC,aACDA,KADC,uBACDA,KAAK,CAAEc,GAAP,CAAcC,IAAF,IACX,4BAAC,8BAAD;AACC,IAAA,IAAI,EAAGA,IADR;AAEC,IAAA,GAAG,EAAI,GAAGA,IAAI,CAACC,IAAM,IAAID,IAAI,CAACE,EAAI;AAFnC,IADD,CADC,CAjBH,EAyBGN,WAAW,IACZ,4BAAC,wCAAD;AAAgB,IAAA,KAAK,EAAG,cAAI,UAAJ,CAAxB;AAA2C,IAAA,MAAM;AAAjD,IA1BF,CADD;AA+BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigationMenu as NavigationMenu,\n\t__experimentalNavigationItem as NavigationItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { MENU_CONTENT_PAGES, MENU_ROOT } from '../constants';\nimport ContentNavigationItem from '../content-navigation-item';\nimport SearchResults from '../search-results';\nimport useDebouncedSearch from '../use-debounced-search';\n\nexport default function ContentPagesMenu() {\n\tconst {\n\t\tsearch,\n\t\tsearchQuery,\n\t\tonSearch,\n\t\tisDebouncing,\n\t} = useDebouncedSearch();\n\n\tconst { pages, isResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, hasFinishedResolution } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\tconst query = searchQuery\n\t\t\t\t? {\n\t\t\t\t\t\tsearch: searchQuery,\n\t\t\t\t }\n\t\t\t\t: undefined;\n\t\t\tconst getEntityRecordsArgs = [ 'postType', 'page', query ];\n\t\t\tconst hasResolvedPosts = hasFinishedResolution(\n\t\t\t\t'getEntityRecords',\n\t\t\t\tgetEntityRecordsArgs\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tpages: getEntityRecords( ...getEntityRecordsArgs ),\n\t\t\t\tisResolved: hasResolvedPosts,\n\t\t\t};\n\t\t},\n\t\t[ searchQuery ]\n\t);\n\n\tconst shouldShowLoadingForDebouncing = search && isDebouncing;\n\tconst showLoading = ! isResolved || shouldShowLoadingForDebouncing;\n\n\treturn (\n\t\t<NavigationMenu\n\t\t\tmenu={ MENU_CONTENT_PAGES }\n\t\t\ttitle={ __( 'Pages' ) }\n\t\t\tparentMenu={ MENU_ROOT }\n\t\t\thasSearch={ true }\n\t\t\tonSearch={ onSearch }\n\t\t\tsearch={ search }\n\t\t\tisSearchDebouncing={ isDebouncing || ! isResolved }\n\t\t>\n\t\t\t{ search && ! isDebouncing && (\n\t\t\t\t<SearchResults\n\t\t\t\t\titems={ pages }\n\t\t\t\t\tsearch={ search }\n\t\t\t\t\tdisableFilter\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ ! search &&\n\t\t\t\tpages?.map( ( page ) => (\n\t\t\t\t\t<ContentNavigationItem\n\t\t\t\t\t\titem={ page }\n\t\t\t\t\t\tkey={ `${ page.type }-${ page.id }` }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\n\t\t\t{ showLoading && (\n\t\t\t\t<NavigationItem title={ __( 'Loading…' ) } isText />\n\t\t\t) }\n\t\t</NavigationMenu>\n\t);\n}\n"]}
|