@wordpress/edit-site 5.12.12 → 5.12.13
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/constants.js +1 -1
- package/build/components/block-editor/constants.js.map +1 -1
- package/build/components/editor/index.js +2 -3
- package/build/components/editor/index.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +1 -1
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/page-patterns/grid.js +2 -1
- package/build/components/page-patterns/grid.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +17 -3
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +20 -3
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/block-editor/constants.js +1 -1
- package/build-module/components/block-editor/constants.js.map +1 -1
- package/build-module/components/editor/index.js +2 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +3 -3
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/page-patterns/grid.js +3 -2
- package/build-module/components/page-patterns/grid.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +17 -3
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +19 -3
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-style/style-rtl.css +22 -25
- package/build-style/style.css +22 -25
- package/package.json +14 -14
- package/src/components/block-editor/constants.js +5 -1
- package/src/components/editor/index.js +2 -3
- package/src/components/header-edit-mode/document-actions/index.js +4 -3
- package/src/components/header-edit-mode/document-actions/style.scss +25 -25
- package/src/components/page-patterns/grid.js +8 -3
- package/src/components/page-patterns/patterns-list.js +15 -2
- package/src/components/page-patterns/use-patterns.js +19 -3
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -13
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -4
|
@@ -1446,17 +1446,18 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1446
1446
|
}
|
|
1447
1447
|
|
|
1448
1448
|
.edit-site-document-actions {
|
|
1449
|
-
display:
|
|
1450
|
-
|
|
1449
|
+
display: flex;
|
|
1450
|
+
align-items: center;
|
|
1451
|
+
gap: 8px;
|
|
1451
1452
|
height: 36px;
|
|
1453
|
+
justify-content: space-between;
|
|
1452
1454
|
min-width: 0;
|
|
1453
1455
|
background: #f0f0f0;
|
|
1454
1456
|
border-radius: 4px;
|
|
1455
1457
|
width: min(100%, 450px);
|
|
1456
|
-
overflow: hidden;
|
|
1457
1458
|
}
|
|
1458
|
-
.edit-site-document-actions:hover {
|
|
1459
|
-
color:
|
|
1459
|
+
.edit-site-document-actions .components-button:hover {
|
|
1460
|
+
color: var(--wp-block-synced-color);
|
|
1460
1461
|
background: #e0e0e0;
|
|
1461
1462
|
}
|
|
1462
1463
|
@media (min-width: 782px) {
|
|
@@ -1471,20 +1472,22 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1471
1472
|
}
|
|
1472
1473
|
|
|
1473
1474
|
.edit-site-document-actions__command {
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
grid-row: 1;
|
|
1475
|
+
flex-grow: 1;
|
|
1476
|
+
color: var(--wp-block-synced-color);
|
|
1477
|
+
overflow: hidden;
|
|
1478
1478
|
}
|
|
1479
1479
|
|
|
1480
1480
|
.edit-site-document-actions__title {
|
|
1481
1481
|
flex-grow: 1;
|
|
1482
1482
|
color: var(--wp-block-synced-color);
|
|
1483
1483
|
overflow: hidden;
|
|
1484
|
-
|
|
1484
|
+
}
|
|
1485
|
+
.edit-site-document-actions__title:hover {
|
|
1486
|
+
color: var(--wp-block-synced-color);
|
|
1485
1487
|
}
|
|
1486
1488
|
.edit-site-document-actions__title .block-editor-block-icon {
|
|
1487
1489
|
min-width: 24px;
|
|
1490
|
+
flex-shrink: 0;
|
|
1488
1491
|
}
|
|
1489
1492
|
.edit-site-document-actions__title h1 {
|
|
1490
1493
|
white-space: nowrap;
|
|
@@ -1517,31 +1520,25 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1517
1520
|
}
|
|
1518
1521
|
}
|
|
1519
1522
|
|
|
1520
|
-
.edit-site-document-actions__shortcut,
|
|
1521
|
-
.edit-site-document-actions__back {
|
|
1522
|
-
color: #2f2f2f;
|
|
1523
|
-
}
|
|
1524
|
-
.edit-site-document-actions:hover .edit-site-document-actions__shortcut,
|
|
1525
|
-
.edit-site-document-actions:hover .edit-site-document-actions__back {
|
|
1526
|
-
color: #1e1e1e;
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
1523
|
.edit-site-document-actions__shortcut {
|
|
1530
|
-
|
|
1524
|
+
color: #2f2f2f;
|
|
1531
1525
|
}
|
|
1532
1526
|
|
|
1533
|
-
.edit-site-document-actions__back {
|
|
1527
|
+
.edit-site-document-actions__back.components-button.has-icon.has-text {
|
|
1534
1528
|
min-width: 36px;
|
|
1535
1529
|
flex-shrink: 0;
|
|
1536
|
-
|
|
1537
|
-
|
|
1530
|
+
color: #757575;
|
|
1531
|
+
gap: 0;
|
|
1538
1532
|
z-index: 1;
|
|
1539
1533
|
}
|
|
1540
|
-
.edit-site-document-
|
|
1534
|
+
.edit-site-document-actions__back.components-button.has-icon.has-text:hover {
|
|
1535
|
+
color: currentColor;
|
|
1536
|
+
}
|
|
1537
|
+
.edit-site-document-actions.is-animated .edit-site-document-actions__back.components-button.has-icon.has-text {
|
|
1541
1538
|
animation: edit-site-document-actions__slide-in-left 0.3s;
|
|
1542
1539
|
}
|
|
1543
1540
|
@media (prefers-reduced-motion: reduce) {
|
|
1544
|
-
.edit-site-document-actions.is-animated .edit-site-document-actions__back {
|
|
1541
|
+
.edit-site-document-actions.is-animated .edit-site-document-actions__back.components-button.has-icon.has-text {
|
|
1545
1542
|
animation-duration: 1ms;
|
|
1546
1543
|
animation-delay: 0s;
|
|
1547
1544
|
}
|
package/build-style/style.css
CHANGED
|
@@ -1447,17 +1447,18 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1447
1447
|
}
|
|
1448
1448
|
|
|
1449
1449
|
.edit-site-document-actions {
|
|
1450
|
-
display:
|
|
1451
|
-
|
|
1450
|
+
display: flex;
|
|
1451
|
+
align-items: center;
|
|
1452
|
+
gap: 8px;
|
|
1452
1453
|
height: 36px;
|
|
1454
|
+
justify-content: space-between;
|
|
1453
1455
|
min-width: 0;
|
|
1454
1456
|
background: #f0f0f0;
|
|
1455
1457
|
border-radius: 4px;
|
|
1456
1458
|
width: min(100%, 450px);
|
|
1457
|
-
overflow: hidden;
|
|
1458
1459
|
}
|
|
1459
|
-
.edit-site-document-actions:hover {
|
|
1460
|
-
color:
|
|
1460
|
+
.edit-site-document-actions .components-button:hover {
|
|
1461
|
+
color: var(--wp-block-synced-color);
|
|
1461
1462
|
background: #e0e0e0;
|
|
1462
1463
|
}
|
|
1463
1464
|
@media (min-width: 782px) {
|
|
@@ -1472,20 +1473,22 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1472
1473
|
}
|
|
1473
1474
|
|
|
1474
1475
|
.edit-site-document-actions__command {
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
grid-row: 1;
|
|
1476
|
+
flex-grow: 1;
|
|
1477
|
+
color: var(--wp-block-synced-color);
|
|
1478
|
+
overflow: hidden;
|
|
1479
1479
|
}
|
|
1480
1480
|
|
|
1481
1481
|
.edit-site-document-actions__title {
|
|
1482
1482
|
flex-grow: 1;
|
|
1483
1483
|
color: var(--wp-block-synced-color);
|
|
1484
1484
|
overflow: hidden;
|
|
1485
|
-
|
|
1485
|
+
}
|
|
1486
|
+
.edit-site-document-actions__title:hover {
|
|
1487
|
+
color: var(--wp-block-synced-color);
|
|
1486
1488
|
}
|
|
1487
1489
|
.edit-site-document-actions__title .block-editor-block-icon {
|
|
1488
1490
|
min-width: 24px;
|
|
1491
|
+
flex-shrink: 0;
|
|
1489
1492
|
}
|
|
1490
1493
|
.edit-site-document-actions__title h1 {
|
|
1491
1494
|
white-space: nowrap;
|
|
@@ -1518,31 +1521,25 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
1518
1521
|
}
|
|
1519
1522
|
}
|
|
1520
1523
|
|
|
1521
|
-
.edit-site-document-actions__shortcut,
|
|
1522
|
-
.edit-site-document-actions__back {
|
|
1523
|
-
color: #2f2f2f;
|
|
1524
|
-
}
|
|
1525
|
-
.edit-site-document-actions:hover .edit-site-document-actions__shortcut,
|
|
1526
|
-
.edit-site-document-actions:hover .edit-site-document-actions__back {
|
|
1527
|
-
color: #1e1e1e;
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1530
1524
|
.edit-site-document-actions__shortcut {
|
|
1531
|
-
|
|
1525
|
+
color: #2f2f2f;
|
|
1532
1526
|
}
|
|
1533
1527
|
|
|
1534
|
-
.edit-site-document-actions__back {
|
|
1528
|
+
.edit-site-document-actions__back.components-button.has-icon.has-text {
|
|
1535
1529
|
min-width: 36px;
|
|
1536
1530
|
flex-shrink: 0;
|
|
1537
|
-
|
|
1538
|
-
|
|
1531
|
+
color: #757575;
|
|
1532
|
+
gap: 0;
|
|
1539
1533
|
z-index: 1;
|
|
1540
1534
|
}
|
|
1541
|
-
.edit-site-document-
|
|
1535
|
+
.edit-site-document-actions__back.components-button.has-icon.has-text:hover {
|
|
1536
|
+
color: currentColor;
|
|
1537
|
+
}
|
|
1538
|
+
.edit-site-document-actions.is-animated .edit-site-document-actions__back.components-button.has-icon.has-text {
|
|
1542
1539
|
animation: edit-site-document-actions__slide-in-left 0.3s;
|
|
1543
1540
|
}
|
|
1544
1541
|
@media (prefers-reduced-motion: reduce) {
|
|
1545
|
-
.edit-site-document-actions.is-animated .edit-site-document-actions__back {
|
|
1542
|
+
.edit-site-document-actions.is-animated .edit-site-document-actions__back.components-button.has-icon.has-text {
|
|
1546
1543
|
animation-duration: 1ms;
|
|
1547
1544
|
animation-delay: 0s;
|
|
1548
1545
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.13",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -29,40 +29,40 @@
|
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
30
|
"@wordpress/a11y": "^3.35.1",
|
|
31
31
|
"@wordpress/api-fetch": "^6.32.1",
|
|
32
|
-
"@wordpress/block-editor": "^12.3.
|
|
33
|
-
"@wordpress/block-library": "^8.12.
|
|
32
|
+
"@wordpress/block-editor": "^12.3.11",
|
|
33
|
+
"@wordpress/block-library": "^8.12.13",
|
|
34
34
|
"@wordpress/blocks": "^12.12.6",
|
|
35
|
-
"@wordpress/commands": "^0.6.
|
|
36
|
-
"@wordpress/components": "^25.1.
|
|
35
|
+
"@wordpress/commands": "^0.6.10",
|
|
36
|
+
"@wordpress/components": "^25.1.10",
|
|
37
37
|
"@wordpress/compose": "^6.12.2",
|
|
38
|
-
"@wordpress/core-commands": "^0.4.
|
|
39
|
-
"@wordpress/core-data": "^6.12.
|
|
38
|
+
"@wordpress/core-commands": "^0.4.11",
|
|
39
|
+
"@wordpress/core-data": "^6.12.11",
|
|
40
40
|
"@wordpress/data": "^9.5.5",
|
|
41
41
|
"@wordpress/date": "^4.35.1",
|
|
42
42
|
"@wordpress/deprecated": "^3.35.1",
|
|
43
43
|
"@wordpress/dom": "^3.35.1",
|
|
44
|
-
"@wordpress/editor": "^13.12.
|
|
44
|
+
"@wordpress/editor": "^13.12.11",
|
|
45
45
|
"@wordpress/element": "^5.12.1",
|
|
46
46
|
"@wordpress/escape-html": "^2.35.1",
|
|
47
47
|
"@wordpress/hooks": "^3.35.1",
|
|
48
48
|
"@wordpress/html-entities": "^3.35.1",
|
|
49
49
|
"@wordpress/i18n": "^4.35.1",
|
|
50
50
|
"@wordpress/icons": "^9.26.2",
|
|
51
|
-
"@wordpress/interface": "^5.12.
|
|
51
|
+
"@wordpress/interface": "^5.12.10",
|
|
52
52
|
"@wordpress/keyboard-shortcuts": "^4.12.5",
|
|
53
53
|
"@wordpress/keycodes": "^3.35.1",
|
|
54
54
|
"@wordpress/media-utils": "^4.26.1",
|
|
55
55
|
"@wordpress/notices": "^4.3.5",
|
|
56
|
-
"@wordpress/plugins": "^6.3.
|
|
57
|
-
"@wordpress/preferences": "^3.12.
|
|
56
|
+
"@wordpress/plugins": "^6.3.10",
|
|
57
|
+
"@wordpress/preferences": "^3.12.10",
|
|
58
58
|
"@wordpress/primitives": "^3.33.1",
|
|
59
59
|
"@wordpress/private-apis": "^0.17.2",
|
|
60
|
-
"@wordpress/reusable-blocks": "^4.12.
|
|
60
|
+
"@wordpress/reusable-blocks": "^4.12.11",
|
|
61
61
|
"@wordpress/router": "^0.4.2",
|
|
62
62
|
"@wordpress/style-engine": "^1.18.1",
|
|
63
63
|
"@wordpress/url": "^3.36.1",
|
|
64
64
|
"@wordpress/viewport": "^5.12.5",
|
|
65
|
-
"@wordpress/widgets": "^3.12.
|
|
65
|
+
"@wordpress/widgets": "^3.12.11",
|
|
66
66
|
"@wordpress/wordcount": "^3.35.1",
|
|
67
67
|
"change-case": "^4.1.2",
|
|
68
68
|
"classnames": "^2.3.1",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "a6c8348f0058e714c97df49b4025e5d7d1c9e437"
|
|
88
88
|
}
|
|
@@ -58,7 +58,7 @@ const interfaceLabels = {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
const typeLabels = {
|
|
61
|
-
wp_template: __( 'Template
|
|
61
|
+
wp_template: __( 'Template' ),
|
|
62
62
|
wp_template_part: __( 'Template Part' ),
|
|
63
63
|
wp_block: __( 'Pattern' ),
|
|
64
64
|
};
|
|
@@ -165,12 +165,11 @@ export default function Editor( { isLoading } ) {
|
|
|
165
165
|
|
|
166
166
|
let title;
|
|
167
167
|
if ( hasLoadedPost ) {
|
|
168
|
-
const type = typeLabels[ editedPostType ] ?? __( 'Template' );
|
|
169
168
|
title = sprintf(
|
|
170
169
|
// translators: A breadcrumb trail in browser tab. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).
|
|
171
170
|
__( '%1$s ‹ %2$s ‹ Editor' ),
|
|
172
171
|
getTitle(),
|
|
173
|
-
|
|
172
|
+
typeLabels[ editedPostType ] ?? typeLabels.wp_template
|
|
174
173
|
);
|
|
175
174
|
}
|
|
176
175
|
|
|
@@ -6,7 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { sprintf, __ } from '@wordpress/i18n';
|
|
9
|
+
import { sprintf, __, isRTL } from '@wordpress/i18n';
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
11
|
import {
|
|
12
12
|
Button,
|
|
@@ -17,7 +17,8 @@ import {
|
|
|
17
17
|
import { BlockIcon } from '@wordpress/block-editor';
|
|
18
18
|
import { store as commandsStore } from '@wordpress/commands';
|
|
19
19
|
import {
|
|
20
|
-
chevronLeftSmall
|
|
20
|
+
chevronLeftSmall,
|
|
21
|
+
chevronRightSmall,
|
|
21
22
|
page as pageIcon,
|
|
22
23
|
navigation as navigationIcon,
|
|
23
24
|
symbol,
|
|
@@ -153,7 +154,7 @@ function BaseDocumentActions( { className, icon, children, onBack } ) {
|
|
|
153
154
|
{ onBack && (
|
|
154
155
|
<Button
|
|
155
156
|
className="edit-site-document-actions__back"
|
|
156
|
-
icon={
|
|
157
|
+
icon={ isRTL() ? chevronRightSmall : chevronLeftSmall }
|
|
157
158
|
onClick={ ( event ) => {
|
|
158
159
|
event.stopPropagation();
|
|
159
160
|
onBack();
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
.edit-site-document-actions {
|
|
2
|
-
display:
|
|
3
|
-
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: $grid-unit;
|
|
4
5
|
height: $button-size;
|
|
6
|
+
justify-content: space-between;
|
|
5
7
|
// Flex items will, by default, refuse to shrink below a minimum
|
|
6
8
|
// intrinsic width. In order to shrink this flexbox item, and
|
|
7
9
|
// subsequently truncate child text, we set an explicit min-width.
|
|
@@ -10,11 +12,12 @@
|
|
|
10
12
|
background: $gray-100;
|
|
11
13
|
border-radius: 4px;
|
|
12
14
|
width: min(100%, 450px);
|
|
13
|
-
overflow: hidden;
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
.components-button {
|
|
17
|
+
&:hover {
|
|
18
|
+
color: var(--wp-block-synced-color);
|
|
19
|
+
background: $gray-200;
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
@include break-medium() {
|
|
@@ -27,21 +30,23 @@
|
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
.edit-site-document-actions__command {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
grid-row: 1;
|
|
33
|
+
flex-grow: 1;
|
|
34
|
+
color: var(--wp-block-synced-color);
|
|
35
|
+
overflow: hidden;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
|
|
37
38
|
.edit-site-document-actions__title {
|
|
38
39
|
flex-grow: 1;
|
|
39
40
|
color: var(--wp-block-synced-color);
|
|
40
41
|
overflow: hidden;
|
|
41
|
-
|
|
42
|
+
|
|
43
|
+
&:hover {
|
|
44
|
+
color: var(--wp-block-synced-color);
|
|
45
|
+
}
|
|
42
46
|
|
|
43
47
|
.block-editor-block-icon {
|
|
44
48
|
min-width: $grid-unit-30;
|
|
49
|
+
flex-shrink: 0;
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
h1 {
|
|
@@ -70,26 +75,21 @@
|
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
77
|
|
|
73
|
-
.edit-site-document-actions__shortcut,
|
|
74
|
-
.edit-site-document-actions__back {
|
|
75
|
-
color: $gray-800;
|
|
76
|
-
|
|
77
|
-
.edit-site-document-actions:hover & {
|
|
78
|
-
color: $gray-900;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
78
|
.edit-site-document-actions__shortcut {
|
|
83
|
-
|
|
79
|
+
color: $gray-800;
|
|
84
80
|
}
|
|
85
81
|
|
|
86
|
-
.edit-site-document-actions__back {
|
|
82
|
+
.edit-site-document-actions__back.components-button.has-icon.has-text {
|
|
87
83
|
min-width: $button-size;
|
|
88
84
|
flex-shrink: 0;
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
color: $gray-700;
|
|
86
|
+
gap: 0;
|
|
91
87
|
z-index: 1;
|
|
92
88
|
|
|
89
|
+
&:hover {
|
|
90
|
+
color: currentColor;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
93
|
.edit-site-document-actions.is-animated & {
|
|
94
94
|
animation: edit-site-document-actions__slide-in-left 0.3s;
|
|
95
95
|
@include reduce-motion("animation");
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
__experimentalText as Text,
|
|
7
7
|
Button,
|
|
8
8
|
} from '@wordpress/components';
|
|
9
|
-
import { useRef,
|
|
9
|
+
import { useRef, useMemo } from '@wordpress/element';
|
|
10
10
|
import { __, _x, _n, sprintf } from '@wordpress/i18n';
|
|
11
11
|
import { useAsyncList } from '@wordpress/compose';
|
|
12
12
|
|
|
@@ -82,8 +82,13 @@ function Pagination( { currentPage, numPages, changePage, totalItems } ) {
|
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
export default function Grid( {
|
|
86
|
-
|
|
85
|
+
export default function Grid( {
|
|
86
|
+
categoryId,
|
|
87
|
+
items,
|
|
88
|
+
currentPage,
|
|
89
|
+
setCurrentPage,
|
|
90
|
+
...props
|
|
91
|
+
} ) {
|
|
87
92
|
const gridRef = useRef();
|
|
88
93
|
const totalItems = items.length;
|
|
89
94
|
const pageIndex = currentPage - 1;
|
|
@@ -48,6 +48,7 @@ const SYNC_DESCRIPTIONS = {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
export default function PatternsList( { categoryId, type } ) {
|
|
51
|
+
const [ currentPage, setCurrentPage ] = useState( 1 );
|
|
51
52
|
const location = useLocation();
|
|
52
53
|
const history = useHistory();
|
|
53
54
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
@@ -73,6 +74,16 @@ export default function PatternsList( { categoryId, type } ) {
|
|
|
73
74
|
}
|
|
74
75
|
);
|
|
75
76
|
|
|
77
|
+
const updateSearchFilter = ( value ) => {
|
|
78
|
+
setCurrentPage( 1 );
|
|
79
|
+
setFilterValue( value );
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const updateSyncFilter = ( value ) => {
|
|
83
|
+
setCurrentPage( 1 );
|
|
84
|
+
setSyncFilter( value );
|
|
85
|
+
};
|
|
86
|
+
|
|
76
87
|
const id = useId();
|
|
77
88
|
const titleId = `${ id }-title`;
|
|
78
89
|
const descriptionId = `${ id }-description`;
|
|
@@ -109,7 +120,7 @@ export default function PatternsList( { categoryId, type } ) {
|
|
|
109
120
|
<FlexBlock className="edit-site-patterns__search-block">
|
|
110
121
|
<SearchControl
|
|
111
122
|
className="edit-site-patterns__search"
|
|
112
|
-
onChange={ ( value ) =>
|
|
123
|
+
onChange={ ( value ) => updateSearchFilter( value ) }
|
|
113
124
|
placeholder={ __( 'Search patterns' ) }
|
|
114
125
|
label={ __( 'Search patterns' ) }
|
|
115
126
|
value={ filterValue }
|
|
@@ -123,7 +134,7 @@ export default function PatternsList( { categoryId, type } ) {
|
|
|
123
134
|
label={ __( 'Filter by sync status' ) }
|
|
124
135
|
value={ syncFilter }
|
|
125
136
|
isBlock
|
|
126
|
-
onChange={ ( value ) =>
|
|
137
|
+
onChange={ ( value ) => updateSyncFilter( value ) }
|
|
127
138
|
__nextHasNoMarginBottom
|
|
128
139
|
>
|
|
129
140
|
{ Object.entries( SYNC_FILTERS ).map(
|
|
@@ -157,6 +168,8 @@ export default function PatternsList( { categoryId, type } ) {
|
|
|
157
168
|
items={ patterns }
|
|
158
169
|
aria-labelledby={ titleId }
|
|
159
170
|
aria-describedby={ descriptionId }
|
|
171
|
+
currentPage={ currentPage }
|
|
172
|
+
setCurrentPage={ setCurrentPage }
|
|
160
173
|
/>
|
|
161
174
|
) }
|
|
162
175
|
{ ! isResolving && ! hasPatterns && <NoPatterns /> }
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { parse } from '@wordpress/blocks';
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
7
8
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -39,14 +40,12 @@ const templatePartToPattern = ( templatePart ) => ( {
|
|
|
39
40
|
templatePart,
|
|
40
41
|
} );
|
|
41
42
|
|
|
42
|
-
const templatePartHasCategory = ( item, category ) =>
|
|
43
|
-
item.templatePart.area === category;
|
|
44
|
-
|
|
45
43
|
const selectTemplatePartsAsPatterns = (
|
|
46
44
|
select,
|
|
47
45
|
{ categoryId, search = '' } = {}
|
|
48
46
|
) => {
|
|
49
47
|
const { getEntityRecords, getIsResolving } = select( coreStore );
|
|
48
|
+
const { __experimentalGetDefaultTemplatePartAreas } = select( editorStore );
|
|
50
49
|
const query = { per_page: -1 };
|
|
51
50
|
const rawTemplateParts =
|
|
52
51
|
getEntityRecords( 'postType', TEMPLATE_PARTS, query ) ??
|
|
@@ -55,6 +54,23 @@ const selectTemplatePartsAsPatterns = (
|
|
|
55
54
|
templatePartToPattern( templatePart )
|
|
56
55
|
);
|
|
57
56
|
|
|
57
|
+
// In the case where a custom template part area has been removed we need
|
|
58
|
+
// the current list of areas to cross check against so orphaned template
|
|
59
|
+
// parts can be treated as uncategorized.
|
|
60
|
+
const knownAreas = __experimentalGetDefaultTemplatePartAreas() || [];
|
|
61
|
+
const templatePartAreas = knownAreas.map( ( area ) => area.area );
|
|
62
|
+
|
|
63
|
+
const templatePartHasCategory = ( item, category ) => {
|
|
64
|
+
if ( category !== 'uncategorized' ) {
|
|
65
|
+
return item.templatePart.area === category;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
item.templatePart.area === category ||
|
|
70
|
+
! templatePartAreas.includes( item.templatePart.area )
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
58
74
|
const isResolving = getIsResolving( 'getEntityRecords', [
|
|
59
75
|
'postType',
|
|
60
76
|
'wp_template_part',
|
|
@@ -12,19 +12,11 @@ export default function CategoryItem( {
|
|
|
12
12
|
label,
|
|
13
13
|
type,
|
|
14
14
|
} ) {
|
|
15
|
-
const linkInfo = useLink(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
// Keep a record of where we came from in state so we can
|
|
23
|
-
// use the browser's back button to go back to Patterns.
|
|
24
|
-
// See the implementation of the back button in patterns-list.
|
|
25
|
-
backPath: '/patterns',
|
|
26
|
-
}
|
|
27
|
-
);
|
|
15
|
+
const linkInfo = useLink( {
|
|
16
|
+
path: '/patterns',
|
|
17
|
+
categoryType: type,
|
|
18
|
+
categoryId: id,
|
|
19
|
+
} );
|
|
28
20
|
|
|
29
21
|
if ( ! count ) {
|
|
30
22
|
return;
|
|
@@ -58,10 +58,7 @@ export default function useSyncCanvasModeWithURL() {
|
|
|
58
58
|
|
|
59
59
|
useEffect( () => {
|
|
60
60
|
currentCanvasInUrl.current = canvasInUrl;
|
|
61
|
-
if (
|
|
62
|
-
canvasInUrl === undefined &&
|
|
63
|
-
currentCanvasMode.current !== 'view'
|
|
64
|
-
) {
|
|
61
|
+
if ( canvasInUrl !== 'edit' && currentCanvasMode.current !== 'view' ) {
|
|
65
62
|
setCanvasMode( 'view' );
|
|
66
63
|
} else if (
|
|
67
64
|
canvasInUrl === 'edit' &&
|