@wordpress/edit-post 6.17.0 → 6.19.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 (103) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/build/components/block-manager/category.js +4 -12
  3. package/build/components/block-manager/category.js.map +1 -1
  4. package/build/components/block-manager/checklist.js +4 -3
  5. package/build/components/block-manager/checklist.js.map +1 -1
  6. package/build/components/block-manager/index.js +1 -1
  7. package/build/components/block-manager/index.js.map +1 -1
  8. package/build/components/header/header-toolbar/index.js +2 -8
  9. package/build/components/header/header-toolbar/index.js.map +1 -1
  10. package/build/components/header/index.js +5 -4
  11. package/build/components/header/index.js.map +1 -1
  12. package/build/components/header/more-menu/index.js +1 -3
  13. package/build/components/header/more-menu/index.js.map +1 -1
  14. package/build/components/header/writing-menu/index.js +13 -14
  15. package/build/components/header/writing-menu/index.js.map +1 -1
  16. package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
  17. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  18. package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -7
  19. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  20. package/build/components/keyboard-shortcuts/index.js +71 -5
  21. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  22. package/build/components/layout/index.js +2 -7
  23. package/build/components/layout/index.js.map +1 -1
  24. package/build/components/preferences-modal/index.js +1 -1
  25. package/build/components/preferences-modal/index.js.map +1 -1
  26. package/build/components/secondary-sidebar/list-view-outline.js +119 -0
  27. package/build/components/secondary-sidebar/list-view-outline.js.map +1 -0
  28. package/build/components/secondary-sidebar/list-view-sidebar.js +38 -13
  29. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  30. package/build/components/visual-editor/index.js +4 -1
  31. package/build/components/visual-editor/index.js.map +1 -1
  32. package/build/store/actions.js +24 -41
  33. package/build/store/actions.js.map +1 -1
  34. package/build/store/reducer.js +29 -8
  35. package/build/store/reducer.js.map +1 -1
  36. package/build-module/components/block-manager/category.js +5 -13
  37. package/build-module/components/block-manager/category.js.map +1 -1
  38. package/build-module/components/block-manager/checklist.js +5 -4
  39. package/build-module/components/block-manager/checklist.js.map +1 -1
  40. package/build-module/components/block-manager/index.js +2 -2
  41. package/build-module/components/block-manager/index.js.map +1 -1
  42. package/build-module/components/header/header-toolbar/index.js +3 -9
  43. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  44. package/build-module/components/header/index.js +5 -4
  45. package/build-module/components/header/index.js.map +1 -1
  46. package/build-module/components/header/more-menu/index.js +1 -3
  47. package/build-module/components/header/more-menu/index.js.map +1 -1
  48. package/build-module/components/header/writing-menu/index.js +13 -14
  49. package/build-module/components/header/writing-menu/index.js.map +1 -1
  50. package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
  51. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  52. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
  53. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  54. package/build-module/components/keyboard-shortcuts/index.js +71 -6
  55. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  56. package/build-module/components/layout/index.js +2 -7
  57. package/build-module/components/layout/index.js.map +1 -1
  58. package/build-module/components/preferences-modal/index.js +1 -1
  59. package/build-module/components/preferences-modal/index.js.map +1 -1
  60. package/build-module/components/secondary-sidebar/list-view-outline.js +108 -0
  61. package/build-module/components/secondary-sidebar/list-view-outline.js.map +1 -0
  62. package/build-module/components/secondary-sidebar/list-view-sidebar.js +36 -14
  63. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  64. package/build-module/components/visual-editor/index.js +3 -1
  65. package/build-module/components/visual-editor/index.js.map +1 -1
  66. package/build-module/store/actions.js +22 -37
  67. package/build-module/store/actions.js.map +1 -1
  68. package/build-module/store/reducer.js +30 -7
  69. package/build-module/store/reducer.js.map +1 -1
  70. package/build-style/style-rtl.css +96 -40
  71. package/build-style/style.css +96 -40
  72. package/package.json +27 -27
  73. package/src/components/block-manager/category.js +5 -12
  74. package/src/components/block-manager/checklist.js +3 -6
  75. package/src/components/block-manager/index.js +2 -2
  76. package/src/components/block-manager/style.scss +4 -15
  77. package/src/components/header/fullscreen-mode-close/test/__snapshots__/index.js.snap +26 -0
  78. package/src/components/header/fullscreen-mode-close/test/index.js +10 -12
  79. package/src/components/header/header-toolbar/index.js +2 -10
  80. package/src/components/header/index.js +4 -1
  81. package/src/components/header/more-menu/index.js +1 -1
  82. package/src/components/header/style.scss +3 -9
  83. package/src/components/header/writing-menu/index.js +13 -11
  84. package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
  85. package/src/components/keyboard-shortcut-help-modal/shortcut.js +15 -18
  86. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +70 -0
  87. package/src/components/keyboard-shortcuts/index.js +77 -8
  88. package/src/components/layout/index.js +2 -9
  89. package/src/components/layout/style.scss +12 -1
  90. package/src/components/preferences-modal/index.js +1 -1
  91. package/src/components/preferences-modal/test/__snapshots__/index.js.snap +52 -47
  92. package/src/components/secondary-sidebar/list-view-outline.js +98 -0
  93. package/src/components/secondary-sidebar/list-view-sidebar.js +49 -10
  94. package/src/components/secondary-sidebar/style.scss +67 -11
  95. package/src/components/sidebar/plugin-post-status-info/test/__snapshots__/index.js.snap +6 -4
  96. package/src/components/sidebar/plugin-post-status-info/test/index.js +1 -1
  97. package/src/components/sidebar/plugin-pre-publish-panel/test/index.js +8 -6
  98. package/src/components/visual-editor/index.js +9 -3
  99. package/src/components/visual-editor/test/index.native.js +13 -13
  100. package/src/store/actions.js +21 -35
  101. package/src/store/reducer.js +28 -8
  102. package/src/store/test/reducer.js +32 -2
  103. package/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap +0 -3
@@ -7,11 +7,12 @@ import {
7
7
  useShortcut,
8
8
  store as keyboardShortcutsStore,
9
9
  } from '@wordpress/keyboard-shortcuts';
10
- import { __, sprintf } from '@wordpress/i18n';
10
+ import { __ } from '@wordpress/i18n';
11
11
  import { store as editorStore } from '@wordpress/editor';
12
12
  import { store as blockEditorStore } from '@wordpress/block-editor';
13
13
  import { store as noticesStore } from '@wordpress/notices';
14
14
  import { store as preferencesStore } from '@wordpress/preferences';
15
+ import { createBlock } from '@wordpress/blocks';
15
16
 
16
17
  /**
17
18
  * Internal dependencies
@@ -53,6 +54,35 @@ function KeyboardShortcuts() {
53
54
  closeGeneralSidebar();
54
55
  };
55
56
 
57
+ const { replaceBlocks } = useDispatch( blockEditorStore );
58
+ const { getBlockName, getSelectedBlockClientId, getBlockAttributes } =
59
+ useSelect( blockEditorStore );
60
+
61
+ const handleTextLevelShortcut = ( event, level ) => {
62
+ event.preventDefault();
63
+ const destinationBlockName =
64
+ level === 0 ? 'core/paragraph' : 'core/heading';
65
+ const currentClientId = getSelectedBlockClientId();
66
+ if ( currentClientId === null ) {
67
+ return;
68
+ }
69
+ const blockName = getBlockName( currentClientId );
70
+ if ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {
71
+ return;
72
+ }
73
+ const currentAttributes = getBlockAttributes( currentClientId );
74
+ const { content: currentContent, align: currentAlign } =
75
+ currentAttributes;
76
+ replaceBlocks(
77
+ currentClientId,
78
+ createBlock( destinationBlockName, {
79
+ level,
80
+ content: currentContent,
81
+ align: currentAlign,
82
+ } )
83
+ );
84
+ };
85
+
56
86
  useEffect( () => {
57
87
  registerShortcut( {
58
88
  name: 'core/edit-post/toggle-mode',
@@ -67,7 +97,7 @@ function KeyboardShortcuts() {
67
97
  registerShortcut( {
68
98
  name: 'core/edit-post/toggle-distraction-free',
69
99
  category: 'global',
70
- description: __( 'Toggle disrtaction free mode.' ),
100
+ description: __( 'Toggle distraction free mode.' ),
71
101
  keyCombination: {
72
102
  modifier: 'primaryShift',
73
103
  character: '\\',
@@ -133,6 +163,10 @@ function KeyboardShortcuts() {
133
163
  modifier: 'access',
134
164
  character: 'p',
135
165
  },
166
+ {
167
+ modifier: 'ctrlShift',
168
+ character: '~',
169
+ },
136
170
  ],
137
171
  } );
138
172
 
@@ -145,6 +179,28 @@ function KeyboardShortcuts() {
145
179
  character: 'h',
146
180
  },
147
181
  } );
182
+
183
+ registerShortcut( {
184
+ name: `core/block-editor/transform-heading-to-paragraph`,
185
+ category: 'block-library',
186
+ description: __( 'Transform heading to paragraph.' ),
187
+ keyCombination: {
188
+ modifier: 'access',
189
+ character: `0`,
190
+ },
191
+ } );
192
+
193
+ [ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
194
+ registerShortcut( {
195
+ name: `core/block-editor/transform-paragraph-to-heading-${ level }`,
196
+ category: 'block-library',
197
+ description: __( 'Transform paragraph to heading.' ),
198
+ keyCombination: {
199
+ modifier: 'access',
200
+ character: `${ level }`,
201
+ },
202
+ } );
203
+ } );
148
204
  }, [] );
149
205
 
150
206
  useShortcut(
@@ -168,14 +224,12 @@ function KeyboardShortcuts() {
168
224
  setIsListViewOpened( false );
169
225
  toggleDistractionFree();
170
226
  toggleFeature( 'distractionFree' );
171
- const modeState = isFeatureActive( 'distractionFree' )
172
- ? __( 'on' )
173
- : __( 'off' );
174
227
  createInfoNotice(
175
- // translators: Mode of distraction free can be 'on' or 'off';
176
- sprintf( __( 'Distraction free mode turned %s.' ), modeState ),
228
+ isFeatureActive( 'distractionFree' )
229
+ ? __( 'Distraction free mode turned on.' )
230
+ : __( 'Distraction free mode turned off.' ),
177
231
  {
178
- speak: true,
232
+ id: 'core/edit-post/distraction-free-mode/notice',
179
233
  type: 'snackbar',
180
234
  }
181
235
  );
@@ -200,6 +254,21 @@ function KeyboardShortcuts() {
200
254
  setIsListViewOpened( ! isListViewOpened() )
201
255
  );
202
256
 
257
+ useShortcut(
258
+ 'core/block-editor/transform-heading-to-paragraph',
259
+ ( event ) => handleTextLevelShortcut( event, 0 )
260
+ );
261
+
262
+ [ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
263
+ //the loop is based off on a constant therefore
264
+ //the hook will execute the same way every time
265
+ //eslint-disable-next-line react-hooks/rules-of-hooks
266
+ useShortcut(
267
+ `core/block-editor/transform-paragraph-to-heading-${ level }`,
268
+ ( event ) => handleTextLevelShortcut( event, level )
269
+ );
270
+ } );
271
+
203
272
  return null;
204
273
  }
205
274
 
@@ -124,12 +124,6 @@ function Layout( { styles } ) {
124
124
  documentLabel: postTypeLabel || _x( 'Document', 'noun' ),
125
125
  };
126
126
  }, [] );
127
- const [ distractionFree, setDistractionFree ] =
128
- useState( isDistractionFree );
129
-
130
- useEffect( () => {
131
- setDistractionFree( isDistractionFree );
132
- }, [ isDistractionFree ] );
133
127
 
134
128
  const className = classnames( 'edit-post-layout', 'is-mode-' + mode, {
135
129
  'is-sidebar-opened': sidebarIsOpened,
@@ -170,7 +164,7 @@ function Layout( { styles } ) {
170
164
  );
171
165
 
172
166
  const secondarySidebarLabel = isListViewOpened
173
- ? __( 'List View' )
167
+ ? __( 'Document Overview' )
174
168
  : __( 'Block Library' );
175
169
 
176
170
  const secondarySidebar = () => {
@@ -207,7 +201,7 @@ function Layout( { styles } ) {
207
201
  <EditorKeyboardShortcutsRegister />
208
202
  <SettingsSidebar />
209
203
  <InterfaceSkeleton
210
- isDistractionFree={ distractionFree }
204
+ isDistractionFree={ isDistractionFree }
211
205
  className={ className }
212
206
  labels={ {
213
207
  ...interfaceLabels,
@@ -215,7 +209,6 @@ function Layout( { styles } ) {
215
209
  } }
216
210
  header={
217
211
  <Header
218
- isDistractionFree={ distractionFree }
219
212
  setEntitiesSavedStatesCallback={
220
213
  setEntitiesSavedStatesCallback
221
214
  }
@@ -60,7 +60,6 @@
60
60
  justify-content: center;
61
61
  }
62
62
 
63
-
64
63
  .edit-post-layout__toggle-publish-panel,
65
64
  .edit-post-layout__toggle-sidebar-panel,
66
65
  .edit-post-layout__toggle-entities-saved-states-panel {
@@ -70,6 +69,7 @@
70
69
  bottom: auto;
71
70
  left: auto;
72
71
  right: 0;
72
+ box-sizing: border-box;
73
73
  width: $sidebar-width;
74
74
  background-color: $white;
75
75
  border: 1px dotted $gray-300;
@@ -77,7 +77,18 @@
77
77
  padding: $grid-unit-30;
78
78
  display: flex;
79
79
  justify-content: center;
80
+ }
81
+
82
+ .edit-post-layout__toggle-sidebar-panel {
83
+ .interface-interface-skeleton__sidebar:focus &,
84
+ .interface-interface-skeleton__sidebar:focus-within & {
85
+ top: auto;
86
+ bottom: 0;
87
+ }
88
+ }
80
89
 
90
+ .edit-post-layout__toggle-entities-saved-states-panel,
91
+ .edit-post-layout__toggle-publish-panel {
81
92
  .interface-interface-skeleton__actions:focus &,
82
93
  .interface-interface-skeleton__actions:focus-within & {
83
94
  top: auto;
@@ -116,7 +116,7 @@ export default function EditPostPreferencesModal() {
116
116
  help={ __(
117
117
  'Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'
118
118
  ) }
119
- label={ __( 'Distraction Free' ) }
119
+ label={ __( 'Distraction free' ) }
120
120
  />
121
121
  <EnableFeature
122
122
  featureName="focusMode"
@@ -253,7 +253,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
253
253
  class="components-toggle-control__label"
254
254
  for="inspector-toggle-control-1"
255
255
  >
256
- Distraction Free
256
+ Distraction free
257
257
  </label>
258
258
  </div>
259
259
  </div>
@@ -508,6 +508,11 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
508
508
  }
509
509
 
510
510
  .emotion-2 {
511
+ overflow-x: auto;
512
+ max-height: 100%;
513
+ }
514
+
515
+ .emotion-3 {
511
516
  background-color: #fff;
512
517
  color: #1e1e1e;
513
518
  position: relative;
@@ -517,47 +522,47 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
517
522
  border-radius: calc(2px - 1px);
518
523
  }
519
524
 
520
- .emotion-4 {
525
+ .emotion-5 {
521
526
  height: 100%;
522
527
  }
523
528
 
524
- .emotion-6 {
529
+ .emotion-7 {
525
530
  box-sizing: border-box;
526
531
  height: auto;
527
532
  max-height: 100%;
528
533
  padding: calc(4px * 4);
529
534
  }
530
535
 
531
- .emotion-6:first-of-type {
536
+ .emotion-7:first-of-type {
532
537
  border-top-left-radius: calc(2px - 1px);
533
538
  border-top-right-radius: calc(2px - 1px);
534
539
  }
535
540
 
536
- .emotion-6:last-of-type {
541
+ .emotion-7:last-of-type {
537
542
  border-bottom-left-radius: calc(2px - 1px);
538
543
  border-bottom-right-radius: calc(2px - 1px);
539
544
  }
540
545
 
541
- .emotion-8 {
546
+ .emotion-9 {
542
547
  border-radius: 2px;
543
548
  }
544
549
 
545
- .emotion-8>*:first-of-type>* {
550
+ .emotion-9>*:first-of-type>* {
546
551
  border-top-left-radius: 2px;
547
552
  border-top-right-radius: 2px;
548
553
  }
549
554
 
550
- .emotion-8>*:last-of-type>* {
555
+ .emotion-9>*:last-of-type>* {
551
556
  border-bottom-left-radius: 2px;
552
557
  border-bottom-right-radius: 2px;
553
558
  }
554
559
 
555
- .emotion-10 {
560
+ .emotion-11 {
556
561
  width: 100%;
557
562
  display: block;
558
563
  }
559
564
 
560
- .emotion-12 {
565
+ .emotion-13 {
561
566
  -webkit-appearance: none;
562
567
  -moz-appearance: none;
563
568
  -ms-appearance: none;
@@ -565,7 +570,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
565
570
  border: 1px solid transparent;
566
571
  cursor: pointer;
567
572
  background: none;
568
- text-align: left;
573
+ text-align: start;
569
574
  padding: calc((36px - calc(13px * 1.2) - 2px) / 2) 12px;
570
575
  width: 100%;
571
576
  display: block;
@@ -574,18 +579,18 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
574
579
  border-radius: 2px;
575
580
  }
576
581
 
577
- .emotion-12:hover {
578
- color: var( --wp-admin-theme-color, #007cba);
582
+ .emotion-13:hover {
583
+ color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
579
584
  }
580
585
 
581
- .emotion-12:focus {
586
+ .emotion-13:focus {
582
587
  background-color: transparent;
583
- color: var( --wp-admin-theme-color, #007cba);
584
- border-color: var( --wp-admin-theme-color, #007cba);
588
+ color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
589
+ border-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
585
590
  outline: 3px solid transparent;
586
591
  }
587
592
 
588
- .emotion-14 {
593
+ .emotion-15 {
589
594
  display: -webkit-box;
590
595
  display: -webkit-flex;
591
596
  display: -ms-flexbox;
@@ -604,11 +609,11 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
604
609
  width: 100%;
605
610
  }
606
611
 
607
- .emotion-14>* {
612
+ .emotion-15>* {
608
613
  min-width: 0;
609
614
  }
610
615
 
611
- .emotion-16 {
616
+ .emotion-17 {
612
617
  display: block;
613
618
  max-height: 100%;
614
619
  max-width: 100%;
@@ -616,14 +621,14 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
616
621
  min-width: 0;
617
622
  }
618
623
 
619
- .emotion-18 {
624
+ .emotion-19 {
620
625
  display: block;
621
626
  overflow: hidden;
622
627
  text-overflow: ellipsis;
623
628
  white-space: nowrap;
624
629
  }
625
630
 
626
- .emotion-46 {
631
+ .emotion-47 {
627
632
  background: transparent;
628
633
  display: block;
629
634
  margin: 0!important;
@@ -643,7 +648,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
643
648
  }
644
649
 
645
650
  @media ( prefers-reduced-motion: reduce ) {
646
- .emotion-46 {
651
+ .emotion-47 {
647
652
  transition-duration: 0ms;
648
653
  }
649
654
  }
@@ -696,52 +701,52 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
696
701
  data-wp-component="NavigatorProvider"
697
702
  >
698
703
  <div
699
- class="components-navigator-screen"
704
+ class="emotion-2 components-navigator-screen"
700
705
  data-wp-c16t="true"
701
706
  data-wp-component="NavigatorScreen"
702
707
  style="opacity: 0; transform: translateX(50px) translateZ(0);"
703
708
  >
704
709
  <div
705
- class="components-surface components-card emotion-2 emotion-1"
710
+ class="components-surface components-card emotion-3 emotion-1"
706
711
  data-wp-c16t="true"
707
712
  data-wp-component="Card"
708
713
  >
709
714
  <div
710
- class="emotion-4 emotion-1"
715
+ class="emotion-5 emotion-1"
711
716
  >
712
717
  <div
713
- class="components-card__body components-card-body emotion-6 emotion-1"
718
+ class="components-card__body components-card-body emotion-7 emotion-1"
714
719
  data-wp-c16t="true"
715
720
  data-wp-component="CardBody"
716
721
  >
717
722
  <div
718
- class="components-item-group emotion-8 emotion-1"
723
+ class="components-item-group emotion-9 emotion-1"
719
724
  data-wp-c16t="true"
720
725
  data-wp-component="ItemGroup"
721
726
  role="list"
722
727
  >
723
728
  <div
724
- class="emotion-10"
729
+ class="emotion-11"
725
730
  role="listitem"
726
731
  >
727
732
  <button
728
- class="components-item components-navigator-button emotion-1 emotion-12 emotion-1"
733
+ class="components-item components-navigator-button emotion-1 emotion-13 emotion-1"
729
734
  data-wp-c16t="true"
730
735
  data-wp-component="NavigatorButton"
731
736
  id="general"
732
737
  >
733
738
  <div
734
- class="components-flex components-h-stack emotion-14 emotion-1"
739
+ class="components-flex components-h-stack emotion-15 emotion-1"
735
740
  data-wp-c16t="true"
736
741
  data-wp-component="HStack"
737
742
  >
738
743
  <div
739
- class="components-flex-item emotion-16 emotion-1"
744
+ class="components-flex-item emotion-17 emotion-1"
740
745
  data-wp-c16t="true"
741
746
  data-wp-component="FlexItem"
742
747
  >
743
748
  <span
744
- class="components-truncate emotion-18 emotion-1"
749
+ class="components-truncate emotion-19 emotion-1"
745
750
  data-wp-c16t="true"
746
751
  data-wp-component="Truncate"
747
752
  >
@@ -749,7 +754,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
749
754
  </span>
750
755
  </div>
751
756
  <div
752
- class="components-flex-item emotion-16 emotion-1"
757
+ class="components-flex-item emotion-17 emotion-1"
753
758
  data-wp-c16t="true"
754
759
  data-wp-component="FlexItem"
755
760
  >
@@ -770,27 +775,27 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
770
775
  </button>
771
776
  </div>
772
777
  <div
773
- class="emotion-10"
778
+ class="emotion-11"
774
779
  role="listitem"
775
780
  >
776
781
  <button
777
- class="components-item components-navigator-button emotion-1 emotion-12 emotion-1"
782
+ class="components-item components-navigator-button emotion-1 emotion-13 emotion-1"
778
783
  data-wp-c16t="true"
779
784
  data-wp-component="NavigatorButton"
780
785
  id="blocks"
781
786
  >
782
787
  <div
783
- class="components-flex components-h-stack emotion-14 emotion-1"
788
+ class="components-flex components-h-stack emotion-15 emotion-1"
784
789
  data-wp-c16t="true"
785
790
  data-wp-component="HStack"
786
791
  >
787
792
  <div
788
- class="components-flex-item emotion-16 emotion-1"
793
+ class="components-flex-item emotion-17 emotion-1"
789
794
  data-wp-c16t="true"
790
795
  data-wp-component="FlexItem"
791
796
  >
792
797
  <span
793
- class="components-truncate emotion-18 emotion-1"
798
+ class="components-truncate emotion-19 emotion-1"
794
799
  data-wp-c16t="true"
795
800
  data-wp-component="Truncate"
796
801
  >
@@ -798,7 +803,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
798
803
  </span>
799
804
  </div>
800
805
  <div
801
- class="components-flex-item emotion-16 emotion-1"
806
+ class="components-flex-item emotion-17 emotion-1"
802
807
  data-wp-c16t="true"
803
808
  data-wp-component="FlexItem"
804
809
  >
@@ -819,27 +824,27 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
819
824
  </button>
820
825
  </div>
821
826
  <div
822
- class="emotion-10"
827
+ class="emotion-11"
823
828
  role="listitem"
824
829
  >
825
830
  <button
826
- class="components-item components-navigator-button emotion-1 emotion-12 emotion-1"
831
+ class="components-item components-navigator-button emotion-1 emotion-13 emotion-1"
827
832
  data-wp-c16t="true"
828
833
  data-wp-component="NavigatorButton"
829
834
  id="panels"
830
835
  >
831
836
  <div
832
- class="components-flex components-h-stack emotion-14 emotion-1"
837
+ class="components-flex components-h-stack emotion-15 emotion-1"
833
838
  data-wp-c16t="true"
834
839
  data-wp-component="HStack"
835
840
  >
836
841
  <div
837
- class="components-flex-item emotion-16 emotion-1"
842
+ class="components-flex-item emotion-17 emotion-1"
838
843
  data-wp-c16t="true"
839
844
  data-wp-component="FlexItem"
840
845
  >
841
846
  <span
842
- class="components-truncate emotion-18 emotion-1"
847
+ class="components-truncate emotion-19 emotion-1"
843
848
  data-wp-c16t="true"
844
849
  data-wp-component="Truncate"
845
850
  >
@@ -847,7 +852,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
847
852
  </span>
848
853
  </div>
849
854
  <div
850
- class="components-flex-item emotion-16 emotion-1"
855
+ class="components-flex-item emotion-17 emotion-1"
851
856
  data-wp-c16t="true"
852
857
  data-wp-component="FlexItem"
853
858
  >
@@ -872,13 +877,13 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
872
877
  </div>
873
878
  <div
874
879
  aria-hidden="true"
875
- class="components-elevation emotion-46 emotion-1"
880
+ class="components-elevation emotion-47 emotion-1"
876
881
  data-wp-c16t="true"
877
882
  data-wp-component="Elevation"
878
883
  />
879
884
  <div
880
885
  aria-hidden="true"
881
- class="components-elevation emotion-46 emotion-1"
886
+ class="components-elevation emotion-47 emotion-1"
882
887
  data-wp-c16t="true"
883
888
  data-wp-component="Elevation"
884
889
  />
@@ -0,0 +1,98 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect } from '@wordpress/data';
5
+ import {
6
+ DocumentOutline,
7
+ WordCount,
8
+ TimeToRead,
9
+ CharacterCount,
10
+ } from '@wordpress/editor';
11
+ import { store as blockEditorStore } from '@wordpress/block-editor';
12
+ import {
13
+ __experimentalText as Text,
14
+ Path,
15
+ SVG,
16
+ Line,
17
+ Rect,
18
+ } from '@wordpress/components';
19
+ import { __ } from '@wordpress/i18n';
20
+
21
+ function EmptyOutlineIllustration() {
22
+ return (
23
+ <SVG
24
+ width="138"
25
+ height="148"
26
+ viewBox="0 0 138 148"
27
+ fill="none"
28
+ xmlns="http://www.w3.org/2000/svg"
29
+ >
30
+ <Rect width="138" height="148" rx="4" fill="#F0F6FC" />
31
+ <Line x1="44" y1="28" x2="24" y2="28" stroke="#DDDDDD" />
32
+ <Rect x="48" y="16" width="27" height="23" rx="4" fill="#DDDDDD" />
33
+ <Path
34
+ d="M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z"
35
+ fill="black"
36
+ />
37
+ <Line x1="55" y1="59" x2="24" y2="59" stroke="#DDDDDD" />
38
+ <Rect x="59" y="47" width="29" height="23" rx="4" fill="#DDDDDD" />
39
+ <Path
40
+ d="M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z"
41
+ fill="black"
42
+ />
43
+ <Line x1="80" y1="90" x2="24" y2="90" stroke="#DDDDDD" />
44
+ <Rect x="84" y="78" width="30" height="23" rx="4" fill="#F0B849" />
45
+ <Path
46
+ d="M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z"
47
+ fill="black"
48
+ />
49
+ <Line x1="66" y1="121" x2="24" y2="121" stroke="#DDDDDD" />
50
+ <Rect x="70" y="109" width="29" height="23" rx="4" fill="#DDDDDD" />
51
+ <Path
52
+ d="M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z"
53
+ fill="black"
54
+ />
55
+ </SVG>
56
+ );
57
+ }
58
+
59
+ export default function ListViewOutline() {
60
+ const { headingCount } = useSelect( ( select ) => {
61
+ const { getGlobalBlockCount } = select( blockEditorStore );
62
+ return {
63
+ headingCount: getGlobalBlockCount( 'core/heading' ),
64
+ };
65
+ }, [] );
66
+ return (
67
+ <>
68
+ { headingCount > 0 ? (
69
+ <DocumentOutline />
70
+ ) : (
71
+ <div className="edit-post-editor__list-view-empty-headings">
72
+ <EmptyOutlineIllustration />
73
+ <p>
74
+ { __(
75
+ 'Navigate the structure of your document and address issues like empty or incorrect heading levels.'
76
+ ) }
77
+ </p>
78
+ </div>
79
+ ) }
80
+ <div className="edit-post-editor__list-view-overview">
81
+ <div>
82
+ <Text>{ __( 'Characters:' ) }</Text>
83
+ <Text>
84
+ <CharacterCount />
85
+ </Text>
86
+ </div>
87
+ <div>
88
+ <Text>{ __( 'Words:' ) }</Text>
89
+ <WordCount />
90
+ </div>
91
+ <div>
92
+ <Text>{ __( 'Time to read:' ) }</Text>
93
+ <TimeToRead />
94
+ </div>
95
+ </div>
96
+ </>
97
+ );
98
+ }