@wordpress/block-editor 11.3.5 → 11.3.6

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 (54) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/build/components/block-inspector/index.js +11 -10
  3. package/build/components/block-inspector/index.js.map +1 -1
  4. package/build/components/block-inspector/useBlockInspectorAnimationSettings.js +46 -0
  5. package/build/components/block-inspector/useBlockInspectorAnimationSettings.js.map +1 -0
  6. package/build/components/inserter/media-tab/hooks.js +10 -11
  7. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  8. package/build/components/inserter/media-tab/media-list.js +5 -108
  9. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  10. package/build/components/inserter/media-tab/media-preview.js +242 -0
  11. package/build/components/inserter/media-tab/media-preview.js.map +1 -0
  12. package/build/components/inserter/menu.js +4 -7
  13. package/build/components/inserter/menu.js.map +1 -1
  14. package/build/components/link-control/index.js +17 -44
  15. package/build/components/link-control/index.js.map +1 -1
  16. package/build/store/defaults.js +28 -1
  17. package/build/store/defaults.js.map +1 -1
  18. package/build/store/selectors.js +1 -1
  19. package/build/store/selectors.js.map +1 -1
  20. package/build-module/components/block-inspector/index.js +9 -9
  21. package/build-module/components/block-inspector/index.js.map +1 -1
  22. package/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js +37 -0
  23. package/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js.map +1 -0
  24. package/build-module/components/inserter/media-tab/hooks.js +10 -11
  25. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  26. package/build-module/components/inserter/media-tab/media-list.js +6 -105
  27. package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
  28. package/build-module/components/inserter/media-tab/media-preview.js +222 -0
  29. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -0
  30. package/build-module/components/inserter/menu.js +4 -7
  31. package/build-module/components/inserter/menu.js.map +1 -1
  32. package/build-module/components/link-control/index.js +16 -44
  33. package/build-module/components/link-control/index.js.map +1 -1
  34. package/build-module/store/defaults.js +28 -1
  35. package/build-module/store/defaults.js.map +1 -1
  36. package/build-module/store/selectors.js +1 -1
  37. package/build-module/store/selectors.js.map +1 -1
  38. package/build-style/style-rtl.css +43 -8
  39. package/build-style/style.css +43 -8
  40. package/package.json +4 -4
  41. package/src/components/block-inspector/index.js +11 -14
  42. package/src/components/block-inspector/useBlockInspectorAnimationSettings.js +53 -0
  43. package/src/components/inserter/media-tab/hooks.js +9 -8
  44. package/src/components/inserter/media-tab/media-list.js +3 -122
  45. package/src/components/inserter/media-tab/media-preview.js +268 -0
  46. package/src/components/inserter/menu.js +14 -20
  47. package/src/components/inserter/style.scss +22 -0
  48. package/src/components/link-control/index.js +23 -58
  49. package/src/components/link-control/style.scss +23 -7
  50. package/src/components/link-control/test/index.js +5 -134
  51. package/src/components/media-replace-flow/test/index.js +1 -1
  52. package/src/components/spacing-sizes-control/style.scss +1 -1
  53. package/src/store/defaults.js +14 -1
  54. package/src/store/selectors.js +4 -1
@@ -537,7 +537,7 @@ describe( 'Manual link entry', () => {
537
537
  } );
538
538
 
539
539
  let submitButton = screen.getByRole( 'button', {
540
- name: 'Apply',
540
+ name: 'Submit',
541
541
  } );
542
542
 
543
543
  expect( submitButton ).toBeDisabled();
@@ -555,7 +555,7 @@ describe( 'Manual link entry', () => {
555
555
  await user.keyboard( '[Enter]' );
556
556
 
557
557
  submitButton = screen.getByRole( 'button', {
558
- name: 'Apply',
558
+ name: 'Submit',
559
559
  } );
560
560
 
561
561
  // Verify the UI hasn't allowed submission.
@@ -578,7 +578,7 @@ describe( 'Manual link entry', () => {
578
578
  } );
579
579
 
580
580
  let submitButton = screen.queryByRole( 'button', {
581
- name: 'Apply',
581
+ name: 'Submit',
582
582
  } );
583
583
 
584
584
  expect( submitButton ).toBeDisabled();
@@ -597,7 +597,7 @@ describe( 'Manual link entry', () => {
597
597
  await user.click( submitButton );
598
598
 
599
599
  submitButton = screen.queryByRole( 'button', {
600
- name: 'Apply',
600
+ name: 'Submit',
601
601
  } );
602
602
 
603
603
  // Verify the UI hasn't allowed submission.
@@ -608,135 +608,6 @@ describe( 'Manual link entry', () => {
608
608
  );
609
609
  } );
610
610
 
611
- describe( 'Handling cancellation', () => {
612
- it( 'should allow cancellation of the link creation process and reset any entered values', async () => {
613
- const user = userEvent.setup();
614
- const mockOnRemove = jest.fn();
615
- const mockOnCancel = jest.fn();
616
-
617
- render( <LinkControl onRemove={ mockOnRemove } /> );
618
-
619
- // Search Input UI.
620
- const searchInput = screen.getByRole( 'combobox', {
621
- name: 'URL',
622
- } );
623
-
624
- const cancelButton = screen.queryByRole( 'button', {
625
- name: 'Cancel',
626
- } );
627
-
628
- expect( cancelButton ).toBeEnabled();
629
- expect( cancelButton ).toBeVisible();
630
-
631
- // Simulate adding a link for a term.
632
- await user.type( searchInput, 'https://www.wordpress.org' );
633
-
634
- // Attempt to submit the empty search value in the input.
635
- await user.click( cancelButton );
636
-
637
- // Verify the consumer can handle the cancellation.
638
- expect( mockOnRemove ).toHaveBeenCalled();
639
-
640
- // Ensure optional callback is not called.
641
- expect( mockOnCancel ).not.toHaveBeenCalled();
642
-
643
- expect( searchInput ).toHaveValue( '' );
644
- } );
645
-
646
- it( 'should allow cancellation of the link editing process and reset any entered values', async () => {
647
- const user = userEvent.setup();
648
- const initialLink = fauxEntitySuggestions[ 0 ];
649
-
650
- const LinkControlConsumer = () => {
651
- const [ link, setLink ] = useState( initialLink );
652
-
653
- return (
654
- <LinkControl
655
- value={ link }
656
- onChange={ ( suggestion ) => {
657
- setLink( suggestion );
658
- } }
659
- hasTextControl
660
- />
661
- );
662
- };
663
-
664
- render( <LinkControlConsumer /> );
665
-
666
- let linkPreview = screen.getByLabelText( 'Currently selected' );
667
-
668
- expect( linkPreview ).toBeInTheDocument();
669
-
670
- // Click the "Edit" button to trigger into the editing mode.
671
- let editButton = screen.queryByRole( 'button', {
672
- name: 'Edit',
673
- } );
674
-
675
- await user.click( editButton );
676
-
677
- let searchInput = screen.getByRole( 'combobox', {
678
- name: 'URL',
679
- } );
680
-
681
- let textInput = screen.getByRole( 'textbox', {
682
- name: 'Text',
683
- } );
684
-
685
- // Make a change to the search input.
686
- await user.type( searchInput, 'This URL value was changed!' );
687
-
688
- // Make a change to the text input.
689
- await user.type( textInput, 'This text value was changed!' );
690
-
691
- const cancelButton = screen.queryByRole( 'button', {
692
- name: 'Cancel',
693
- } );
694
-
695
- // Cancel the editing process.
696
- await user.click( cancelButton );
697
-
698
- linkPreview = screen.getByLabelText( 'Currently selected' );
699
-
700
- expect( linkPreview ).toBeInTheDocument();
701
-
702
- // Re-query the edit button as it's been replaced.
703
- editButton = screen.queryByRole( 'button', {
704
- name: 'Edit',
705
- } );
706
-
707
- await user.click( editButton );
708
-
709
- // Re-query the inputs as they have been replaced.
710
- searchInput = screen.getByRole( 'combobox', {
711
- name: 'URL',
712
- } );
713
-
714
- textInput = screen.getByRole( 'textbox', {
715
- name: 'Text',
716
- } );
717
-
718
- // Expect to see the original link values and **not** the changed values.
719
- expect( searchInput ).toHaveValue( initialLink.url );
720
- expect( textInput ).toHaveValue( initialLink.text );
721
- } );
722
-
723
- it( 'should call onCancel callback when cancelling if provided', async () => {
724
- const user = userEvent.setup();
725
- const mockOnCancel = jest.fn();
726
-
727
- render( <LinkControl onCancel={ mockOnCancel } /> );
728
-
729
- const cancelButton = screen.queryByRole( 'button', {
730
- name: 'Cancel',
731
- } );
732
-
733
- await user.click( cancelButton );
734
-
735
- // Verify the consumer can handle the cancellation.
736
- expect( mockOnCancel ).toHaveBeenCalled();
737
- } );
738
- } );
739
-
740
611
  describe( 'Alternative link protocols and formats', () => {
741
612
  it.each( [
742
613
  [ 'mailto:example123456@wordpress.org', 'mailto' ],
@@ -1988,7 +1859,7 @@ describe( 'Controlling link title text', () => {
1988
1859
  expect( textInput ).toHaveValue( textValue );
1989
1860
 
1990
1861
  const submitButton = screen.queryByRole( 'button', {
1991
- name: 'Apply',
1862
+ name: 'Submit',
1992
1863
  } );
1993
1864
 
1994
1865
  await user.click( submitButton );
@@ -137,7 +137,7 @@ describe( 'General media replace flow', () => {
137
137
 
138
138
  await user.click(
139
139
  screen.getByRole( 'button', {
140
- name: 'Apply',
140
+ name: 'Submit',
141
141
  } )
142
142
  );
143
143
 
@@ -126,7 +126,7 @@
126
126
  }
127
127
  }
128
128
 
129
- [class*="ThumbWrapper-thumbColor"] {
129
+ .components-range-control__thumb-wrapper {
130
130
  z-index: 3;
131
131
  }
132
132
 
@@ -170,11 +170,24 @@ export const SETTINGS_DEFAULTS = {
170
170
  __unstableGalleryWithImageBlocks: false,
171
171
  __unstableIsPreviewMode: false,
172
172
 
173
- // This setting is `private` now with `lock` API.
173
+ // These settings will be completely revamped in the future.
174
+ // The goal is to evolve this into an API which will instruct
175
+ // the block inspector to animate transitions between what it
176
+ // displays based on the relationship between the selected block
177
+ // and its parent, and only enable it if the parent is controlling
178
+ // its children blocks.
174
179
  blockInspectorAnimation: {
180
+ animationParent: 'core/navigation',
175
181
  'core/navigation': { enterDirection: 'leftToRight' },
176
182
  'core/navigation-submenu': { enterDirection: 'rightToLeft' },
177
183
  'core/navigation-link': { enterDirection: 'rightToLeft' },
184
+ 'core/search': { enterDirection: 'rightToLeft' },
185
+ 'core/social-links': { enterDirection: 'rightToLeft' },
186
+ 'core/page-list': { enterDirection: 'rightToLeft' },
187
+ 'core/spacer': { enterDirection: 'rightToLeft' },
188
+ 'core/home-link': { enterDirection: 'rightToLeft' },
189
+ 'core/site-title': { enterDirection: 'rightToLeft' },
190
+ 'core/site-logo': { enterDirection: 'rightToLeft' },
178
191
  },
179
192
 
180
193
  generateAnchors: false,
@@ -2742,7 +2742,10 @@ export const __unstableGetContentLockingParent = createSelector(
2742
2742
  let result;
2743
2743
  while ( state.blocks.parents.has( current ) ) {
2744
2744
  current = state.blocks.parents.get( current );
2745
- if ( getTemplateLock( state, current ) === 'contentOnly' ) {
2745
+ if (
2746
+ current &&
2747
+ getTemplateLock( state, current ) === 'contentOnly'
2748
+ ) {
2746
2749
  result = current;
2747
2750
  }
2748
2751
  }