@wordpress/editor 13.31.0 → 13.32.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.
Files changed (157) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +857 -0
  3. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +107 -0
  4. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -0
  5. package/build/components/commands/index.js +1 -1
  6. package/build/components/commands/index.js.map +1 -1
  7. package/build/components/deprecated.js +158 -0
  8. package/build/components/deprecated.js.map +1 -1
  9. package/build/components/document-bar/index.js +5 -8
  10. package/build/components/document-bar/index.js.map +1 -1
  11. package/build/components/editor-canvas/edit-template-blocks-notification.js +2 -39
  12. package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  13. package/build/components/editor-canvas/index.js +3 -0
  14. package/build/components/editor-canvas/index.js.map +1 -1
  15. package/build/components/entities-saved-states/index.js +11 -85
  16. package/build/components/entities-saved-states/index.js.map +1 -1
  17. package/build/components/index.js +24 -0
  18. package/build/components/index.js.map +1 -1
  19. package/build/components/inserter-sidebar/index.js +5 -1
  20. package/build/components/inserter-sidebar/index.js.map +1 -1
  21. package/build/components/list-view-sidebar/index.js +2 -1
  22. package/build/components/list-view-sidebar/index.js.map +1 -1
  23. package/build/components/pattern-overrides-panel/index.js +30 -0
  24. package/build/components/pattern-overrides-panel/index.js.map +1 -0
  25. package/build/components/plugin-post-publish-panel/index.js +68 -0
  26. package/build/components/plugin-post-publish-panel/index.js.map +1 -0
  27. package/build/components/plugin-pre-publish-panel/index.js +71 -0
  28. package/build/components/plugin-pre-publish-panel/index.js.map +1 -0
  29. package/build/components/post-actions/actions.js +455 -0
  30. package/build/components/post-actions/actions.js.map +1 -0
  31. package/build/components/post-card-panel/index.js +93 -0
  32. package/build/components/post-card-panel/index.js.map +1 -0
  33. package/build/components/post-title/index.native.js +1 -1
  34. package/build/components/post-title/index.native.js.map +1 -1
  35. package/build/components/provider/disable-non-page-content-blocks.js +36 -20
  36. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  37. package/build/components/provider/use-block-editor-settings.js +8 -9
  38. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  39. package/build/components/template-areas/index.js +70 -0
  40. package/build/components/template-areas/index.js.map +1 -0
  41. package/build/hooks/use-select-nearest-editable-block.js +87 -0
  42. package/build/hooks/use-select-nearest-editable-block.js.map +1 -0
  43. package/build/private-apis.js +6 -0
  44. package/build/private-apis.js.map +1 -1
  45. package/build/store/actions.js +46 -6
  46. package/build/store/actions.js.map +1 -1
  47. package/build/store/constants.js +3 -1
  48. package/build/store/constants.js.map +1 -1
  49. package/build/store/private-actions.js +80 -1
  50. package/build/store/private-actions.js.map +1 -1
  51. package/build/store/private-selectors.js +56 -3
  52. package/build/store/private-selectors.js.map +1 -1
  53. package/build/store/reducer.js +14 -1
  54. package/build/store/reducer.js.map +1 -1
  55. package/build/store/selectors.js +21 -11
  56. package/build/store/selectors.js.map +1 -1
  57. package/build/store/utils/get-filtered-template-parts.js +71 -0
  58. package/build/store/utils/get-filtered-template-parts.js.map +1 -0
  59. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +100 -0
  60. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -0
  61. package/build-module/components/commands/index.js +1 -1
  62. package/build-module/components/commands/index.js.map +1 -1
  63. package/build-module/components/deprecated.js +159 -0
  64. package/build-module/components/deprecated.js.map +1 -1
  65. package/build-module/components/document-bar/index.js +6 -9
  66. package/build-module/components/document-bar/index.js.map +1 -1
  67. package/build-module/components/editor-canvas/edit-template-blocks-notification.js +4 -41
  68. package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  69. package/build-module/components/editor-canvas/index.js +3 -0
  70. package/build-module/components/editor-canvas/index.js.map +1 -1
  71. package/build-module/components/entities-saved-states/index.js +11 -85
  72. package/build-module/components/entities-saved-states/index.js.map +1 -1
  73. package/build-module/components/index.js +3 -0
  74. package/build-module/components/index.js.map +1 -1
  75. package/build-module/components/inserter-sidebar/index.js +5 -1
  76. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  77. package/build-module/components/list-view-sidebar/index.js +2 -1
  78. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  79. package/build-module/components/pattern-overrides-panel/index.js +23 -0
  80. package/build-module/components/pattern-overrides-panel/index.js.map +1 -0
  81. package/build-module/components/plugin-post-publish-panel/index.js +61 -0
  82. package/build-module/components/plugin-post-publish-panel/index.js.map +1 -0
  83. package/build-module/components/plugin-pre-publish-panel/index.js +64 -0
  84. package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -0
  85. package/build-module/components/post-actions/actions.js +444 -0
  86. package/build-module/components/post-actions/actions.js.map +1 -0
  87. package/build-module/components/post-card-panel/index.js +85 -0
  88. package/build-module/components/post-card-panel/index.js.map +1 -0
  89. package/build-module/components/post-title/index.native.js +1 -1
  90. package/build-module/components/post-title/index.native.js.map +1 -1
  91. package/build-module/components/provider/disable-non-page-content-blocks.js +36 -20
  92. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  93. package/build-module/components/provider/use-block-editor-settings.js +9 -10
  94. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  95. package/build-module/components/template-areas/index.js +63 -0
  96. package/build-module/components/template-areas/index.js.map +1 -0
  97. package/build-module/hooks/use-select-nearest-editable-block.js +80 -0
  98. package/build-module/hooks/use-select-nearest-editable-block.js.map +1 -0
  99. package/build-module/private-apis.js +6 -0
  100. package/build-module/private-apis.js.map +1 -1
  101. package/build-module/store/actions.js +37 -3
  102. package/build-module/store/actions.js.map +1 -1
  103. package/build-module/store/constants.js +2 -0
  104. package/build-module/store/constants.js.map +1 -1
  105. package/build-module/store/private-actions.js +78 -0
  106. package/build-module/store/private-actions.js.map +1 -1
  107. package/build-module/store/private-selectors.js +54 -3
  108. package/build-module/store/private-selectors.js.map +1 -1
  109. package/build-module/store/reducer.js +13 -1
  110. package/build-module/store/reducer.js.map +1 -1
  111. package/build-module/store/selectors.js +19 -10
  112. package/build-module/store/selectors.js.map +1 -1
  113. package/build-module/store/utils/get-filtered-template-parts.js +64 -0
  114. package/build-module/store/utils/get-filtered-template-parts.js.map +1 -0
  115. package/build-style/style-rtl.css +70 -27
  116. package/build-style/style.css +70 -27
  117. package/package.json +35 -35
  118. package/src/components/block-settings-menu/plugin-block-settings-menu-item.js +108 -0
  119. package/src/components/commands/index.js +1 -1
  120. package/src/components/deprecated.js +157 -0
  121. package/src/components/document-bar/index.js +9 -15
  122. package/src/components/document-bar/style.scss +9 -12
  123. package/src/components/document-tools/style.scss +4 -11
  124. package/src/components/editor-canvas/edit-template-blocks-notification.js +6 -56
  125. package/src/components/editor-canvas/index.js +4 -0
  126. package/src/components/entities-saved-states/index.js +12 -113
  127. package/src/components/index.js +3 -0
  128. package/src/components/inserter-sidebar/index.js +7 -1
  129. package/src/components/list-view-sidebar/index.js +1 -0
  130. package/src/components/list-view-sidebar/style.scss +1 -1
  131. package/src/components/pattern-overrides-panel/index.js +26 -0
  132. package/src/components/plugin-post-publish-panel/index.js +64 -0
  133. package/src/components/plugin-post-publish-panel/test/__snapshots__/index.js.snap +39 -0
  134. package/src/components/plugin-post-publish-panel/test/index.js +33 -0
  135. package/src/components/plugin-pre-publish-panel/index.js +67 -0
  136. package/src/components/plugin-pre-publish-panel/test/index.js +33 -0
  137. package/src/components/post-actions/actions.js +582 -0
  138. package/src/components/post-card-panel/index.js +108 -0
  139. package/src/components/post-card-panel/style.scss +32 -0
  140. package/src/components/post-featured-image/style.scss +3 -2
  141. package/src/components/post-title/index.native.js +1 -1
  142. package/src/components/provider/disable-non-page-content-blocks.js +40 -20
  143. package/src/components/provider/test/disable-non-page-content-blocks.js +35 -14
  144. package/src/components/provider/use-block-editor-settings.js +11 -11
  145. package/src/components/template-areas/index.js +85 -0
  146. package/src/components/template-areas/style.scss +23 -0
  147. package/src/hooks/use-select-nearest-editable-block.js +95 -0
  148. package/src/private-apis.js +6 -0
  149. package/src/store/actions.js +37 -3
  150. package/src/store/constants.js +2 -0
  151. package/src/store/private-actions.js +111 -0
  152. package/src/store/private-selectors.js +105 -17
  153. package/src/store/reducer.js +13 -0
  154. package/src/store/selectors.js +50 -40
  155. package/src/store/utils/get-filtered-template-parts.js +69 -0
  156. package/src/store/utils/test/get-filtered-template-parts.js +189 -0
  157. package/src/style.scss +2 -0
@@ -226,16 +226,22 @@
226
226
  min-width: 0;
227
227
  background: #f0f0f0;
228
228
  border-radius: 4px;
229
- width: min(100%, 450px);
229
+ width: min(100%, 416px);
230
230
  }
231
231
  .editor-document-bar:hover {
232
232
  background-color: #e0e0e0;
233
233
  }
234
234
  .editor-document-bar .components-button {
235
235
  border-radius: 4px;
236
+ transition: all 0.1s ease-out;
237
+ }
238
+ @media (prefers-reduced-motion: reduce) {
239
+ .editor-document-bar .components-button {
240
+ transition-duration: 0s;
241
+ transition-delay: 0s;
242
+ }
236
243
  }
237
244
  .editor-document-bar .components-button:hover {
238
- color: var(--wp-block-synced-color);
239
245
  background: #e0e0e0;
240
246
  }
241
247
  @media (min-width: 960px) {
@@ -253,20 +259,17 @@
253
259
  .editor-document-bar__title {
254
260
  flex-grow: 1;
255
261
  overflow: hidden;
256
- color: #2f2f2f;
262
+ color: #1e1e1e;
257
263
  gap: 4px;
258
264
  display: flex;
259
265
  justify-content: center;
260
266
  align-items: center;
261
267
  }
262
- @media (min-width: 600px) {
268
+ @media (min-width: 782px) {
263
269
  .editor-document-bar__title {
264
- padding-right: 32px;
270
+ padding-right: 24px;
265
271
  }
266
272
  }
267
- .editor-document-bar__title:hover {
268
- color: var(--wp-block-synced-color);
269
- }
270
273
  .editor-document-bar.is-global .editor-document-bar__title {
271
274
  color: var(--wp-block-synced-color);
272
275
  }
@@ -278,13 +281,13 @@
278
281
  white-space: nowrap;
279
282
  overflow: hidden;
280
283
  text-overflow: ellipsis;
281
- max-width: 50%;
284
+ max-width: 70%;
282
285
  color: currentColor;
283
286
  }
284
287
 
285
288
  .editor-document-bar__shortcut {
286
289
  color: #2f2f2f;
287
- min-width: 32px;
290
+ min-width: 24px;
288
291
  display: none;
289
292
  }
290
293
  @media (min-width: 782px) {
@@ -302,7 +305,7 @@
302
305
  position: absolute;
303
306
  }
304
307
  .editor-document-bar__back.components-button.has-icon.has-text:hover {
305
- color: var(--wp-block-synced-color);
308
+ color: #1e1e1e;
306
309
  background-color: transparent;
307
310
  }
308
311
 
@@ -393,11 +396,13 @@
393
396
  display: inline-flex;
394
397
  align-items: center;
395
398
  }
396
- .editor-document-tools .editor-document-tools__left > .components-button {
399
+ .editor-document-tools .editor-document-tools__left > .editor-history__redo,
400
+ .editor-document-tools .editor-document-tools__left > .editor-history__undo {
397
401
  display: none;
398
402
  }
399
- @media (min-width: 600px) {
400
- .editor-document-tools .editor-document-tools__left > .components-button {
403
+ @media (min-width: 782px) {
404
+ .editor-document-tools .editor-document-tools__left > .editor-history__redo,
405
+ .editor-document-tools .editor-document-tools__left > .editor-history__undo {
401
406
  display: inline-flex;
402
407
  }
403
408
  }
@@ -451,16 +456,6 @@
451
456
  gap: 8px;
452
457
  margin-left: 8px;
453
458
  }
454
- @media (min-width: 782px) {
455
- .editor-document-tools__left {
456
- padding-right: 20px;
457
- }
458
- }
459
- @media (min-width: 1280px) {
460
- .editor-document-tools__left {
461
- padding-left: 8px;
462
- }
463
- }
464
459
 
465
460
  .editor-document-tools .editor-document-tools__left > .editor-document-tools__inserter-toggle.has-icon {
466
461
  min-width: 32px;
@@ -584,7 +579,7 @@
584
579
  background: #fff;
585
580
  order: 1;
586
581
  align-self: center;
587
- margin-left: 8px;
582
+ margin-left: 12px;
588
583
  }
589
584
 
590
585
  .editor-list-view-sidebar__tabs-tablist {
@@ -682,6 +677,32 @@
682
677
  width: 100%;
683
678
  }
684
679
 
680
+ .editor-post-card-panel__content {
681
+ flex-grow: 1;
682
+ }
683
+ .editor-post-card-panel__title {
684
+ width: 100%;
685
+ }
686
+ .editor-post-card-panel__title.editor-post-card-panel__title {
687
+ margin: 3px 0 0 0;
688
+ }
689
+ .editor-post-card-panel__icon {
690
+ flex: 0 0 24px;
691
+ width: 24px;
692
+ height: 24px;
693
+ }
694
+ .editor-post-card-panel__header {
695
+ display: flex;
696
+ justify-content: space-between;
697
+ margin: 0 0 8px;
698
+ }
699
+ .editor-post-card-panel__description {
700
+ color: #757575;
701
+ }
702
+ .editor-post-card-panel__description .components-text {
703
+ color: inherit;
704
+ }
705
+
685
706
  .editor-post-excerpt__textarea {
686
707
  width: 100%;
687
708
  margin-bottom: 10px;
@@ -700,7 +721,6 @@
700
721
 
701
722
  .editor-post-featured-image__container {
702
723
  position: relative;
703
- aspect-ratio: 2/1;
704
724
  }
705
725
  .editor-post-featured-image__container:hover .editor-post-featured-image__actions, .editor-post-featured-image__container:focus .editor-post-featured-image__actions, .editor-post-featured-image__container:focus-within .editor-post-featured-image__actions {
706
726
  opacity: 1;
@@ -713,8 +733,9 @@
713
733
  transition: all 0.1s ease-out;
714
734
  box-shadow: 0 0 0 0 var(--wp-admin-theme-color);
715
735
  overflow: hidden;
716
- outline: 1px solid rgba(0, 0, 0, 0.1);
717
736
  outline-offset: -1px;
737
+ min-height: 80px;
738
+ margin-bottom: 16px;
718
739
  display: flex;
719
740
  justify-content: center;
720
741
  }
@@ -728,6 +749,7 @@
728
749
 
729
750
  .editor-post-featured-image__preview {
730
751
  height: auto;
752
+ outline: 1px solid rgba(0, 0, 0, 0.1);
731
753
  }
732
754
  .editor-post-featured-image__preview .editor-post-featured-image__preview-image {
733
755
  object-fit: cover;
@@ -1449,6 +1471,27 @@
1449
1471
  font-weight: 600;
1450
1472
  }
1451
1473
 
1474
+ .editor-template-areas {
1475
+ margin-top: 16px;
1476
+ }
1477
+ .editor-template-areas__list {
1478
+ margin: 0;
1479
+ }
1480
+ .editor-template-areas__list > li {
1481
+ margin: 0;
1482
+ }
1483
+ .editor-template-areas__item {
1484
+ width: 100%;
1485
+ }
1486
+ .editor-template-areas__item.components-button.has-icon {
1487
+ padding: 0;
1488
+ }
1489
+
1490
+ h3.components-heading.editor-template-areas__title {
1491
+ font-weight: 500;
1492
+ margin: 0 0 8px;
1493
+ }
1494
+
1452
1495
  .editor-template-validation-notice {
1453
1496
  display: flex;
1454
1497
  justify-content: space-between;
@@ -226,16 +226,22 @@
226
226
  min-width: 0;
227
227
  background: #f0f0f0;
228
228
  border-radius: 4px;
229
- width: min(100%, 450px);
229
+ width: min(100%, 416px);
230
230
  }
231
231
  .editor-document-bar:hover {
232
232
  background-color: #e0e0e0;
233
233
  }
234
234
  .editor-document-bar .components-button {
235
235
  border-radius: 4px;
236
+ transition: all 0.1s ease-out;
237
+ }
238
+ @media (prefers-reduced-motion: reduce) {
239
+ .editor-document-bar .components-button {
240
+ transition-duration: 0s;
241
+ transition-delay: 0s;
242
+ }
236
243
  }
237
244
  .editor-document-bar .components-button:hover {
238
- color: var(--wp-block-synced-color);
239
245
  background: #e0e0e0;
240
246
  }
241
247
  @media (min-width: 960px) {
@@ -253,20 +259,17 @@
253
259
  .editor-document-bar__title {
254
260
  flex-grow: 1;
255
261
  overflow: hidden;
256
- color: #2f2f2f;
262
+ color: #1e1e1e;
257
263
  gap: 4px;
258
264
  display: flex;
259
265
  justify-content: center;
260
266
  align-items: center;
261
267
  }
262
- @media (min-width: 600px) {
268
+ @media (min-width: 782px) {
263
269
  .editor-document-bar__title {
264
- padding-left: 32px;
270
+ padding-left: 24px;
265
271
  }
266
272
  }
267
- .editor-document-bar__title:hover {
268
- color: var(--wp-block-synced-color);
269
- }
270
273
  .editor-document-bar.is-global .editor-document-bar__title {
271
274
  color: var(--wp-block-synced-color);
272
275
  }
@@ -278,13 +281,13 @@
278
281
  white-space: nowrap;
279
282
  overflow: hidden;
280
283
  text-overflow: ellipsis;
281
- max-width: 50%;
284
+ max-width: 70%;
282
285
  color: currentColor;
283
286
  }
284
287
 
285
288
  .editor-document-bar__shortcut {
286
289
  color: #2f2f2f;
287
- min-width: 32px;
290
+ min-width: 24px;
288
291
  display: none;
289
292
  }
290
293
  @media (min-width: 782px) {
@@ -302,7 +305,7 @@
302
305
  position: absolute;
303
306
  }
304
307
  .editor-document-bar__back.components-button.has-icon.has-text:hover {
305
- color: var(--wp-block-synced-color);
308
+ color: #1e1e1e;
306
309
  background-color: transparent;
307
310
  }
308
311
 
@@ -393,11 +396,13 @@
393
396
  display: inline-flex;
394
397
  align-items: center;
395
398
  }
396
- .editor-document-tools .editor-document-tools__left > .components-button {
399
+ .editor-document-tools .editor-document-tools__left > .editor-history__redo,
400
+ .editor-document-tools .editor-document-tools__left > .editor-history__undo {
397
401
  display: none;
398
402
  }
399
- @media (min-width: 600px) {
400
- .editor-document-tools .editor-document-tools__left > .components-button {
403
+ @media (min-width: 782px) {
404
+ .editor-document-tools .editor-document-tools__left > .editor-history__redo,
405
+ .editor-document-tools .editor-document-tools__left > .editor-history__undo {
401
406
  display: inline-flex;
402
407
  }
403
408
  }
@@ -451,16 +456,6 @@
451
456
  gap: 8px;
452
457
  margin-right: 8px;
453
458
  }
454
- @media (min-width: 782px) {
455
- .editor-document-tools__left {
456
- padding-left: 20px;
457
- }
458
- }
459
- @media (min-width: 1280px) {
460
- .editor-document-tools__left {
461
- padding-right: 8px;
462
- }
463
- }
464
459
 
465
460
  .editor-document-tools .editor-document-tools__left > .editor-document-tools__inserter-toggle.has-icon {
466
461
  min-width: 32px;
@@ -584,7 +579,7 @@
584
579
  background: #fff;
585
580
  order: 1;
586
581
  align-self: center;
587
- margin-right: 8px;
582
+ margin-right: 12px;
588
583
  }
589
584
 
590
585
  .editor-list-view-sidebar__tabs-tablist {
@@ -682,6 +677,32 @@
682
677
  width: 100%;
683
678
  }
684
679
 
680
+ .editor-post-card-panel__content {
681
+ flex-grow: 1;
682
+ }
683
+ .editor-post-card-panel__title {
684
+ width: 100%;
685
+ }
686
+ .editor-post-card-panel__title.editor-post-card-panel__title {
687
+ margin: 3px 0 0 0;
688
+ }
689
+ .editor-post-card-panel__icon {
690
+ flex: 0 0 24px;
691
+ width: 24px;
692
+ height: 24px;
693
+ }
694
+ .editor-post-card-panel__header {
695
+ display: flex;
696
+ justify-content: space-between;
697
+ margin: 0 0 8px;
698
+ }
699
+ .editor-post-card-panel__description {
700
+ color: #757575;
701
+ }
702
+ .editor-post-card-panel__description .components-text {
703
+ color: inherit;
704
+ }
705
+
685
706
  .editor-post-excerpt__textarea {
686
707
  width: 100%;
687
708
  margin-bottom: 10px;
@@ -700,7 +721,6 @@
700
721
 
701
722
  .editor-post-featured-image__container {
702
723
  position: relative;
703
- aspect-ratio: 2/1;
704
724
  }
705
725
  .editor-post-featured-image__container:hover .editor-post-featured-image__actions, .editor-post-featured-image__container:focus .editor-post-featured-image__actions, .editor-post-featured-image__container:focus-within .editor-post-featured-image__actions {
706
726
  opacity: 1;
@@ -713,8 +733,9 @@
713
733
  transition: all 0.1s ease-out;
714
734
  box-shadow: 0 0 0 0 var(--wp-admin-theme-color);
715
735
  overflow: hidden;
716
- outline: 1px solid rgba(0, 0, 0, 0.1);
717
736
  outline-offset: -1px;
737
+ min-height: 80px;
738
+ margin-bottom: 16px;
718
739
  display: flex;
719
740
  justify-content: center;
720
741
  }
@@ -728,6 +749,7 @@
728
749
 
729
750
  .editor-post-featured-image__preview {
730
751
  height: auto;
752
+ outline: 1px solid rgba(0, 0, 0, 0.1);
731
753
  }
732
754
  .editor-post-featured-image__preview .editor-post-featured-image__preview-image {
733
755
  object-fit: cover;
@@ -1453,6 +1475,27 @@
1453
1475
  font-weight: 600;
1454
1476
  }
1455
1477
 
1478
+ .editor-template-areas {
1479
+ margin-top: 16px;
1480
+ }
1481
+ .editor-template-areas__list {
1482
+ margin: 0;
1483
+ }
1484
+ .editor-template-areas__list > li {
1485
+ margin: 0;
1486
+ }
1487
+ .editor-template-areas__item {
1488
+ width: 100%;
1489
+ }
1490
+ .editor-template-areas__item.components-button.has-icon {
1491
+ padding: 0;
1492
+ }
1493
+
1494
+ h3.components-heading.editor-template-areas__title {
1495
+ font-weight: 500;
1496
+ margin: 0 0 8px;
1497
+ }
1498
+
1456
1499
  .editor-template-validation-notice {
1457
1500
  display: flex;
1458
1501
  justify-content: space-between;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "13.31.0",
3
+ "version": "13.32.0",
4
4
  "description": "Enhanced block editor for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,40 +31,40 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.54.0",
35
- "@wordpress/api-fetch": "^6.51.0",
36
- "@wordpress/blob": "^3.54.0",
37
- "@wordpress/block-editor": "^12.22.0",
38
- "@wordpress/blocks": "^12.31.0",
39
- "@wordpress/commands": "^0.25.0",
40
- "@wordpress/components": "^27.2.0",
41
- "@wordpress/compose": "^6.31.0",
42
- "@wordpress/core-data": "^6.31.0",
43
- "@wordpress/data": "^9.24.0",
44
- "@wordpress/date": "^4.54.0",
45
- "@wordpress/deprecated": "^3.54.0",
46
- "@wordpress/dom": "^3.54.0",
47
- "@wordpress/element": "^5.31.0",
48
- "@wordpress/hooks": "^3.54.0",
49
- "@wordpress/html-entities": "^3.54.0",
50
- "@wordpress/i18n": "^4.54.0",
51
- "@wordpress/icons": "^9.45.0",
52
- "@wordpress/keyboard-shortcuts": "^4.31.0",
53
- "@wordpress/keycodes": "^3.54.0",
54
- "@wordpress/media-utils": "^4.45.0",
55
- "@wordpress/notices": "^4.22.0",
56
- "@wordpress/patterns": "^1.15.0",
57
- "@wordpress/plugins": "^6.22.0",
58
- "@wordpress/preferences": "^3.31.0",
59
- "@wordpress/private-apis": "^0.36.0",
60
- "@wordpress/reusable-blocks": "^4.31.0",
61
- "@wordpress/rich-text": "^6.31.0",
62
- "@wordpress/server-side-render": "^4.31.0",
63
- "@wordpress/url": "^3.55.0",
64
- "@wordpress/warning": "^2.54.0",
65
- "@wordpress/wordcount": "^3.54.0",
34
+ "@wordpress/a11y": "^3.55.0",
35
+ "@wordpress/api-fetch": "^6.52.0",
36
+ "@wordpress/blob": "^3.55.0",
37
+ "@wordpress/block-editor": "^12.23.0",
38
+ "@wordpress/blocks": "^12.32.0",
39
+ "@wordpress/commands": "^0.26.0",
40
+ "@wordpress/components": "^27.3.0",
41
+ "@wordpress/compose": "^6.32.0",
42
+ "@wordpress/core-data": "^6.32.0",
43
+ "@wordpress/data": "^9.25.0",
44
+ "@wordpress/date": "^4.55.0",
45
+ "@wordpress/deprecated": "^3.55.0",
46
+ "@wordpress/dom": "^3.55.0",
47
+ "@wordpress/element": "^5.32.0",
48
+ "@wordpress/hooks": "^3.55.0",
49
+ "@wordpress/html-entities": "^3.55.0",
50
+ "@wordpress/i18n": "^4.55.0",
51
+ "@wordpress/icons": "^9.46.0",
52
+ "@wordpress/keyboard-shortcuts": "^4.32.0",
53
+ "@wordpress/keycodes": "^3.55.0",
54
+ "@wordpress/media-utils": "^4.46.0",
55
+ "@wordpress/notices": "^4.23.0",
56
+ "@wordpress/patterns": "^1.16.0",
57
+ "@wordpress/plugins": "^6.23.0",
58
+ "@wordpress/preferences": "^3.32.0",
59
+ "@wordpress/private-apis": "^0.37.0",
60
+ "@wordpress/reusable-blocks": "^4.32.0",
61
+ "@wordpress/rich-text": "^6.32.0",
62
+ "@wordpress/server-side-render": "^4.32.0",
63
+ "@wordpress/url": "^3.56.0",
64
+ "@wordpress/warning": "^2.55.0",
65
+ "@wordpress/wordcount": "^3.55.0",
66
66
  "classnames": "^2.3.1",
67
- "date-fns": "^2.28.0",
67
+ "date-fns": "^3.6.0",
68
68
  "memize": "^2.1.0",
69
69
  "react-autosize-textarea": "^7.1.0",
70
70
  "rememo": "^4.0.2",
@@ -77,5 +77,5 @@
77
77
  "publishConfig": {
78
78
  "access": "public"
79
79
  },
80
- "gitHead": "ffc07735d0abfb3f69e91d48f25b7fe8d1ef92d2"
80
+ "gitHead": "ac2b13783c28f959770cf029a797a712f59e1958"
81
81
  }
@@ -0,0 +1,108 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { BlockSettingsMenuControls } from '@wordpress/block-editor';
5
+ import { MenuItem } from '@wordpress/components';
6
+ import { compose } from '@wordpress/compose';
7
+
8
+ const isEverySelectedBlockAllowed = ( selected, allowed ) =>
9
+ selected.filter( ( id ) => ! allowed.includes( id ) ).length === 0;
10
+
11
+ /**
12
+ * Plugins may want to add an item to the menu either for every block
13
+ * or only for the specific ones provided in the `allowedBlocks` component property.
14
+ *
15
+ * If there are multiple blocks selected the item will be rendered if every block
16
+ * is of one allowed type (not necessarily the same).
17
+ *
18
+ * @param {string[]} selectedBlocks Array containing the names of the blocks selected
19
+ * @param {string[]} allowedBlocks Array containing the names of the blocks allowed
20
+ * @return {boolean} Whether the item will be rendered or not.
21
+ */
22
+ const shouldRenderItem = ( selectedBlocks, allowedBlocks ) =>
23
+ ! Array.isArray( allowedBlocks ) ||
24
+ isEverySelectedBlockAllowed( selectedBlocks, allowedBlocks );
25
+
26
+ /**
27
+ * Renders a new item in the block settings menu.
28
+ *
29
+ * @param {Object} props Component props.
30
+ * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.
31
+ * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.
32
+ * @param {string} props.label The menu item text.
33
+ * @param {Function} props.onClick Callback function to be executed when the user click the menu item.
34
+ * @param {boolean} [props.small] Whether to render the label or not.
35
+ * @param {string} [props.role] The ARIA role for the menu item.
36
+ *
37
+ * @example
38
+ * ```js
39
+ * // Using ES5 syntax
40
+ * var __ = wp.i18n.__;
41
+ * var PluginBlockSettingsMenuItem = wp.editor.PluginBlockSettingsMenuItem;
42
+ *
43
+ * function doOnClick(){
44
+ * // To be called when the user clicks the menu item.
45
+ * }
46
+ *
47
+ * function MyPluginBlockSettingsMenuItem() {
48
+ * return React.createElement(
49
+ * PluginBlockSettingsMenuItem,
50
+ * {
51
+ * allowedBlocks: [ 'core/paragraph' ],
52
+ * icon: 'dashicon-name',
53
+ * label: __( 'Menu item text' ),
54
+ * onClick: doOnClick,
55
+ * }
56
+ * );
57
+ * }
58
+ * ```
59
+ *
60
+ * @example
61
+ * ```jsx
62
+ * // Using ESNext syntax
63
+ * import { __ } from '@wordpress/i18n';
64
+ * import { PluginBlockSettingsMenuItem } from '@wordpress/editor';
65
+ *
66
+ * const doOnClick = ( ) => {
67
+ * // To be called when the user clicks the menu item.
68
+ * };
69
+ *
70
+ * const MyPluginBlockSettingsMenuItem = () => (
71
+ * <PluginBlockSettingsMenuItem
72
+ * allowedBlocks={ [ 'core/paragraph' ] }
73
+ * icon='dashicon-name'
74
+ * label={ __( 'Menu item text' ) }
75
+ * onClick={ doOnClick } />
76
+ * );
77
+ * ```
78
+ *
79
+ * @return {Component} The component to be rendered.
80
+ */
81
+ const PluginBlockSettingsMenuItem = ( {
82
+ allowedBlocks,
83
+ icon,
84
+ label,
85
+ onClick,
86
+ small,
87
+ role,
88
+ } ) => (
89
+ <BlockSettingsMenuControls>
90
+ { ( { selectedBlocks, onClose } ) => {
91
+ if ( ! shouldRenderItem( selectedBlocks, allowedBlocks ) ) {
92
+ return null;
93
+ }
94
+ return (
95
+ <MenuItem
96
+ onClick={ compose( onClick, onClose ) }
97
+ icon={ icon }
98
+ label={ small ? label : undefined }
99
+ role={ role }
100
+ >
101
+ { ! small && label }
102
+ </MenuItem>
103
+ );
104
+ } }
105
+ </BlockSettingsMenuControls>
106
+ );
107
+
108
+ export default PluginBlockSettingsMenuItem;
@@ -68,7 +68,7 @@ function useEditorCommandLoader() {
68
68
  name: 'core/toggle-distraction-free',
69
69
  label: isDistractionFree
70
70
  ? __( 'Exit Distraction Free' )
71
- : __( 'Enter Distraction Free ' ),
71
+ : __( 'Enter Distraction Free' ),
72
72
  callback: ( { close } ) => {
73
73
  toggleDistractionFree();
74
74
  close();