@wordpress/block-editor 14.21.1-next.719a03cbe.0 → 15.0.1-next.46f643fa0.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 (124) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/block-list/use-block-props/index.js +1 -3
  3. package/build/components/block-list/use-block-props/index.js.map +1 -1
  4. package/build/components/block-list/use-block-props/use-is-hovered.js +8 -25
  5. package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  6. package/build/components/block-list/zoom-out-separator.js +0 -1
  7. package/build/components/block-list/zoom-out-separator.js.map +1 -1
  8. package/build/components/block-settings-menu/block-settings-dropdown.js +7 -4
  9. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  10. package/build/components/block-toolbar/index.js +6 -3
  11. package/build/components/block-toolbar/index.js.map +1 -1
  12. package/build/components/child-layout-control/index.js +53 -34
  13. package/build/components/child-layout-control/index.js.map +1 -1
  14. package/build/components/iframe/index.js +20 -15
  15. package/build/components/iframe/index.js.map +1 -1
  16. package/build/components/image-editor/use-save-image.js +49 -30
  17. package/build/components/image-editor/use-save-image.js.map +1 -1
  18. package/build/components/inserter-button/index.native.js +54 -64
  19. package/build/components/inserter-button/index.native.js.map +1 -1
  20. package/build/components/link-control/search-input.js +4 -2
  21. package/build/components/link-control/search-input.js.map +1 -1
  22. package/build/components/list-view/block.js +7 -5
  23. package/build/components/list-view/block.js.map +1 -1
  24. package/build/components/list-view/use-list-view-images.js +62 -30
  25. package/build/components/list-view/use-list-view-images.js.map +1 -1
  26. package/build/components/publish-date-time-picker/index.js +2 -1
  27. package/build/components/publish-date-time-picker/index.js.map +1 -1
  28. package/build/components/writing-flow/use-click-selection.js +3 -1
  29. package/build/components/writing-flow/use-click-selection.js.map +1 -1
  30. package/build/layouts/grid.js +2 -0
  31. package/build/layouts/grid.js.map +1 -1
  32. package/build/private-apis.js +2 -1
  33. package/build/private-apis.js.map +1 -1
  34. package/build/store/actions.js +12 -7
  35. package/build/store/actions.js.map +1 -1
  36. package/build/store/private-keys.js +2 -1
  37. package/build/store/private-keys.js.map +1 -1
  38. package/build/store/reducer.js +0 -18
  39. package/build/store/reducer.js.map +1 -1
  40. package/build/store/selectors.js +13 -9
  41. package/build/store/selectors.js.map +1 -1
  42. package/build/utils/block-bindings.js +2 -1
  43. package/build/utils/block-bindings.js.map +1 -1
  44. package/build-module/components/block-list/use-block-props/index.js +1 -3
  45. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  46. package/build-module/components/block-list/use-block-props/use-is-hovered.js +8 -26
  47. package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  48. package/build-module/components/block-list/zoom-out-separator.js +0 -1
  49. package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
  50. package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -4
  51. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  52. package/build-module/components/block-toolbar/index.js +6 -3
  53. package/build-module/components/block-toolbar/index.js.map +1 -1
  54. package/build-module/components/child-layout-control/index.js +54 -35
  55. package/build-module/components/child-layout-control/index.js.map +1 -1
  56. package/build-module/components/iframe/index.js +20 -15
  57. package/build-module/components/iframe/index.js.map +1 -1
  58. package/build-module/components/image-editor/use-save-image.js +50 -30
  59. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  60. package/build-module/components/inserter-button/index.native.js +55 -65
  61. package/build-module/components/inserter-button/index.native.js.map +1 -1
  62. package/build-module/components/link-control/search-input.js +4 -2
  63. package/build-module/components/link-control/search-input.js.map +1 -1
  64. package/build-module/components/list-view/block.js +8 -6
  65. package/build-module/components/list-view/block.js.map +1 -1
  66. package/build-module/components/list-view/use-list-view-images.js +62 -30
  67. package/build-module/components/list-view/use-list-view-images.js.map +1 -1
  68. package/build-module/components/publish-date-time-picker/index.js +2 -1
  69. package/build-module/components/publish-date-time-picker/index.js.map +1 -1
  70. package/build-module/components/writing-flow/use-click-selection.js +3 -1
  71. package/build-module/components/writing-flow/use-click-selection.js.map +1 -1
  72. package/build-module/layouts/grid.js +2 -0
  73. package/build-module/layouts/grid.js.map +1 -1
  74. package/build-module/private-apis.js +3 -2
  75. package/build-module/private-apis.js.map +1 -1
  76. package/build-module/store/actions.js +12 -7
  77. package/build-module/store/actions.js.map +1 -1
  78. package/build-module/store/private-keys.js +1 -0
  79. package/build-module/store/private-keys.js.map +1 -1
  80. package/build-module/store/reducer.js +0 -17
  81. package/build-module/store/reducer.js.map +1 -1
  82. package/build-module/store/selectors.js +12 -9
  83. package/build-module/store/selectors.js.map +1 -1
  84. package/build-module/utils/block-bindings.js +2 -1
  85. package/build-module/utils/block-bindings.js.map +1 -1
  86. package/build-style/style-rtl.css +50 -26
  87. package/build-style/style.css +50 -26
  88. package/package.json +34 -34
  89. package/src/components/block-list/use-block-props/index.js +1 -1
  90. package/src/components/block-list/use-block-props/use-is-hovered.js +12 -26
  91. package/src/components/block-list/zoom-out-separator.js +0 -1
  92. package/src/components/block-lock/style.scss +10 -0
  93. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -1
  94. package/src/components/block-toolbar/index.js +8 -2
  95. package/src/components/block-variation-transforms/style.scss +7 -0
  96. package/src/components/border-radius-control/style.scss +5 -0
  97. package/src/components/child-layout-control/index.js +66 -42
  98. package/src/components/colors-gradients/style.scss +5 -0
  99. package/src/components/grid/style.scss +3 -2
  100. package/src/components/iframe/index.js +25 -16
  101. package/src/components/image-editor/use-save-image.js +58 -31
  102. package/src/components/inserter/style.scss +1 -1
  103. package/src/components/inserter-button/index.native.js +69 -80
  104. package/src/components/inserter-list-item/style.scss +9 -6
  105. package/src/components/link-control/search-input.js +9 -2
  106. package/src/components/link-control/style.scss +7 -0
  107. package/src/components/link-control/test/index.js +44 -44
  108. package/src/components/list-view/block.js +10 -5
  109. package/src/components/list-view/style.scss +2 -20
  110. package/src/components/list-view/use-list-view-images.js +57 -36
  111. package/src/components/media-replace-flow/test/index.js +1 -1
  112. package/src/components/publish-date-time-picker/README.md +9 -0
  113. package/src/components/publish-date-time-picker/index.js +2 -1
  114. package/src/components/spacing-sizes-control/style.scss +5 -0
  115. package/src/components/writing-flow/use-click-selection.js +3 -1
  116. package/src/hooks/layout.scss +8 -0
  117. package/src/layouts/grid.js +2 -2
  118. package/src/private-apis.js +2 -0
  119. package/src/store/actions.js +15 -7
  120. package/src/store/private-keys.js +1 -0
  121. package/src/store/reducer.js +0 -18
  122. package/src/store/selectors.js +29 -31
  123. package/src/store/test/actions.js +15 -2
  124. package/src/utils/block-bindings.js +1 -0
@@ -39,6 +39,7 @@ import {
39
39
  globalStylesDataKey,
40
40
  globalStylesLinksDataKey,
41
41
  sectionRootClientIdKey,
42
+ mediaEditKey,
42
43
  } from './store/private-keys';
43
44
  import { requiresWrapperOnCopy } from './components/writing-flow/utils';
44
45
  import { PrivateRichText } from './components/rich-text/';
@@ -99,4 +100,5 @@ lock( privateApis, {
99
100
  sectionRootClientIdKey,
100
101
  CommentIconSlotFill,
101
102
  CommentIconToolbarSlotFill,
103
+ mediaEditKey,
102
104
  } );
@@ -216,14 +216,15 @@ export function selectBlock( clientId, initialPosition = 0 ) {
216
216
  * Returns an action object used in signalling that the block with the
217
217
  * specified client ID has been hovered.
218
218
  *
219
- * @param {string} clientId Block client ID.
220
- *
221
- * @return {Object} Action object.
219
+ * @deprecated
222
220
  */
223
- export function hoverBlock( clientId ) {
221
+ export function hoverBlock() {
222
+ deprecated( 'wp.data.dispatch( "core/block-editor" ).hoverBlock', {
223
+ since: '6.9',
224
+ version: '7.1',
225
+ } );
224
226
  return {
225
- type: 'HOVER_BLOCK',
226
- clientId,
227
+ type: 'DO_NOTHING',
227
228
  };
228
229
  }
229
230
 
@@ -1254,7 +1255,14 @@ export const mergeBlocks =
1254
1255
  }
1255
1256
 
1256
1257
  if ( ! blockAType.merge ) {
1257
- dispatch.selectBlock( blockA.clientId );
1258
+ if ( isUnmodifiedBlock( blockB, 'content' ) ) {
1259
+ dispatch.removeBlock(
1260
+ clientIdB,
1261
+ select.isBlockSelected( clientIdB )
1262
+ );
1263
+ } else {
1264
+ dispatch.selectBlock( blockA.clientId );
1265
+ }
1258
1266
  return;
1259
1267
  }
1260
1268
 
@@ -3,3 +3,4 @@ export const globalStylesLinksDataKey = Symbol( 'globalStylesLinks' );
3
3
  export const selectBlockPatternsKey = Symbol( 'selectBlockPatternsKey' );
4
4
  export const reusableBlocksSelectKey = Symbol( 'reusableBlocksSelect' );
5
5
  export const sectionRootClientIdKey = Symbol( 'sectionRootClientIdKey' );
6
+ export const mediaEditKey = Symbol( 'mediaEditKey' );
@@ -2055,23 +2055,6 @@ export function lastFocus( state = false, action ) {
2055
2055
  return state;
2056
2056
  }
2057
2057
 
2058
- /**
2059
- * Reducer setting currently hovered block.
2060
- *
2061
- * @param {boolean} state Current state.
2062
- * @param {Object} action Dispatched action.
2063
- *
2064
- * @return {boolean} Updated state.
2065
- */
2066
- export function hoveredBlockClientId( state = false, action ) {
2067
- switch ( action.type ) {
2068
- case 'HOVER_BLOCK':
2069
- return action.clientId;
2070
- }
2071
-
2072
- return state;
2073
- }
2074
-
2075
2058
  /**
2076
2059
  * Reducer setting zoom out state.
2077
2060
  *
@@ -2141,7 +2124,6 @@ const combinedReducers = combineReducers( {
2141
2124
  blockRemovalRules,
2142
2125
  openedBlockSettingsMenu,
2143
2126
  registeredInserterMediaCategories,
2144
- hoveredBlockClientId,
2145
2127
  zoomLevel,
2146
2128
  } );
2147
2129
 
@@ -2318,26 +2318,21 @@ export const getBlockTransformItems = createRegistrySelector( ( select ) =>
2318
2318
  *
2319
2319
  * @return {boolean} Items that appear in inserter.
2320
2320
  */
2321
- export const hasInserterItems = createRegistrySelector(
2322
- ( select ) =>
2323
- ( state, rootClientId = null ) => {
2324
- const hasBlockType = getBlockTypes().some( ( blockType ) =>
2325
- canIncludeBlockTypeInInserter( state, blockType, rootClientId )
2326
- );
2327
- if ( hasBlockType ) {
2328
- return true;
2329
- }
2330
- const hasReusableBlock =
2331
- canInsertBlockTypeUnmemoized(
2332
- state,
2333
- 'core/block',
2334
- rootClientId
2335
- ) &&
2336
- unlock( select( STORE_NAME ) ).getReusableBlocks().length > 0;
2321
+ export const hasInserterItems = ( state, rootClientId = null ) => {
2322
+ const hasBlockType = getBlockTypes().some( ( blockType ) =>
2323
+ canIncludeBlockTypeInInserter( state, blockType, rootClientId )
2324
+ );
2325
+ if ( hasBlockType ) {
2326
+ return true;
2327
+ }
2328
+ const hasReusableBlock = canInsertBlockTypeUnmemoized(
2329
+ state,
2330
+ 'core/block',
2331
+ rootClientId
2332
+ );
2337
2333
 
2338
- return hasReusableBlock;
2339
- }
2340
- );
2334
+ return hasReusableBlock;
2335
+ };
2341
2336
 
2342
2337
  /**
2343
2338
  * Returns the list of allowed inserter blocks for inner blocks children.
@@ -2358,13 +2353,11 @@ export const getAllowedBlocks = createRegistrySelector( ( select ) =>
2358
2353
  canIncludeBlockTypeInInserter( state, blockType, rootClientId )
2359
2354
  );
2360
2355
 
2361
- const hasReusableBlock =
2362
- canInsertBlockTypeUnmemoized(
2363
- state,
2364
- 'core/block',
2365
- rootClientId
2366
- ) &&
2367
- unlock( select( STORE_NAME ) ).getReusableBlocks().length > 0;
2356
+ const hasReusableBlock = canInsertBlockTypeUnmemoized(
2357
+ state,
2358
+ 'core/block',
2359
+ rootClientId
2360
+ );
2368
2361
 
2369
2362
  if ( hasReusableBlock ) {
2370
2363
  blockTypes.push( 'core/block' );
@@ -2374,7 +2367,6 @@ export const getAllowedBlocks = createRegistrySelector( ( select ) =>
2374
2367
  },
2375
2368
  ( state, rootClientId ) => [
2376
2369
  getBlockTypes(),
2377
- unlock( select( STORE_NAME ) ).getReusableBlocks(),
2378
2370
  ...getInsertBlockTypeDependants( select )( state, rootClientId ),
2379
2371
  ]
2380
2372
  )
@@ -2920,11 +2912,17 @@ export function isBlockVisible( state, clientId ) {
2920
2912
  /**
2921
2913
  * Returns the currently hovered block.
2922
2914
  *
2923
- * @param {Object} state Global application state.
2924
- * @return {Object} Client Id of the hovered block.
2915
+ * @deprecated
2925
2916
  */
2926
- export function getHoveredBlockClientId( state ) {
2927
- return state.hoveredBlockClientId;
2917
+ export function getHoveredBlockClientId() {
2918
+ deprecated(
2919
+ "wp.data.select( 'core/block-editor' ).getHoveredBlockClientId",
2920
+ {
2921
+ since: '6.9',
2922
+ version: '7.1',
2923
+ }
2924
+ );
2925
+ return undefined;
2928
2926
  }
2929
2927
 
2930
2928
  /**
@@ -808,8 +808,16 @@ describe( 'actions', () => {
808
808
  } );
809
809
  } );
810
810
 
811
- it( 'should only focus the blockA if the blockA has no merge function', () => {
812
- registerBlockType( 'core/test-block', defaultBlockSettings );
811
+ it( 'should only focus the blockA if the blockA has no merge function and the content of blockB is modified', () => {
812
+ registerBlockType( 'core/test-block', {
813
+ ...defaultBlockSettings,
814
+ attributes: {
815
+ content: {
816
+ type: 'string',
817
+ role: 'content',
818
+ },
819
+ },
820
+ } );
813
821
  const blockA = deepFreeze( {
814
822
  clientId: 'chicken',
815
823
  name: 'core/test-block',
@@ -817,15 +825,20 @@ describe( 'actions', () => {
817
825
  const blockB = deepFreeze( {
818
826
  clientId: 'ribs',
819
827
  name: 'core/test-block',
828
+ attributes: {
829
+ content: 'Updated content',
830
+ },
820
831
  } );
821
832
 
822
833
  const select = {
823
834
  getBlock: ( clientId ) =>
824
835
  [ blockA, blockB ].find( ( b ) => b.clientId === clientId ),
825
836
  getBlockEditingMode: () => 'default',
837
+ isBlockSelected: () => false,
826
838
  };
827
839
  const dispatch = Object.assign( jest.fn(), {
828
840
  selectBlock: jest.fn(),
841
+ removeBlock: jest.fn(),
829
842
  } );
830
843
 
831
844
  mergeBlocks(
@@ -16,6 +16,7 @@ const BLOCK_BINDINGS_ALLOWED_BLOCKS = {
16
16
  'core/heading': [ 'content' ],
17
17
  'core/image': [ 'id', 'url', 'title', 'alt' ],
18
18
  'core/button': [ 'url', 'text', 'linkTarget', 'rel' ],
19
+ 'core/post-date': [ 'datetime' ],
19
20
  };
20
21
 
21
22
  /**