@wordpress/block-editor 15.11.1-next.v.0 → 15.12.1-next.v.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 (201) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-breadcrumb/index.cjs +10 -2
  3. package/build/components/block-breadcrumb/index.cjs.map +2 -2
  4. package/build/components/block-inspector/index.cjs +11 -11
  5. package/build/components/block-inspector/index.cjs.map +3 -3
  6. package/build/components/block-list/block.cjs +6 -3
  7. package/build/components/block-list/block.cjs.map +3 -3
  8. package/build/components/block-list/index.cjs +26 -18
  9. package/build/components/block-list/index.cjs.map +2 -2
  10. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs +2 -6
  11. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs.map +2 -2
  12. package/build/components/block-list/use-in-between-inserter.cjs +4 -4
  13. package/build/components/block-list/use-in-between-inserter.cjs.map +2 -2
  14. package/build/components/block-settings-menu/block-settings-dropdown.cjs +10 -7
  15. package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +2 -2
  16. package/build/components/block-settings-menu-controls/edit-section-menu-item.cjs +1 -1
  17. package/build/components/block-settings-menu-controls/edit-section-menu-item.cjs.map +2 -2
  18. package/build/components/block-settings-menu-controls/index.cjs +10 -15
  19. package/build/components/block-settings-menu-controls/index.cjs.map +2 -2
  20. package/build/components/block-toolbar/block-toolbar-icon.cjs +6 -4
  21. package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
  22. package/build/components/block-toolbar/index.cjs +1 -1
  23. package/build/components/block-toolbar/index.cjs.map +2 -2
  24. package/build/components/block-variation-transforms/index.cjs +1 -2
  25. package/build/components/block-variation-transforms/index.cjs.map +2 -2
  26. package/build/components/block-visibility/modal.cjs +5 -92
  27. package/build/components/block-visibility/modal.cjs.map +2 -2
  28. package/build/components/inserter/index.cjs +1 -0
  29. package/build/components/inserter/index.cjs.map +2 -2
  30. package/build/components/inspector-controls/last-item.cjs +41 -0
  31. package/build/components/inspector-controls/last-item.cjs.map +7 -0
  32. package/build/components/inspector-controls-tabs/index.cjs +2 -2
  33. package/build/components/inspector-controls-tabs/index.cjs.map +3 -3
  34. package/build/components/inspector-controls-tabs/styles-tab.cjs +4 -4
  35. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  36. package/build/components/media-replace-flow/index.cjs +2 -2
  37. package/build/components/media-replace-flow/index.cjs.map +2 -2
  38. package/build/components/rich-text/index.cjs +1 -1
  39. package/build/components/rich-text/index.cjs.map +2 -2
  40. package/build/components/use-block-display-information/index.cjs +1 -1
  41. package/build/components/use-block-display-information/index.cjs.map +2 -2
  42. package/build/components/writing-flow/index.cjs +2 -0
  43. package/build/components/writing-flow/index.cjs.map +2 -2
  44. package/build/components/writing-flow/use-arrow-nav.cjs +3 -0
  45. package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
  46. package/build/components/writing-flow/use-drag-selection.cjs +2 -1
  47. package/build/components/writing-flow/use-drag-selection.cjs.map +2 -2
  48. package/build/components/writing-flow/use-preview-mode-nav.cjs +92 -0
  49. package/build/components/writing-flow/use-preview-mode-nav.cjs.map +7 -0
  50. package/build/hooks/anchor.cjs +1 -1
  51. package/build/hooks/anchor.cjs.map +1 -1
  52. package/build/hooks/block-renaming.cjs +1 -1
  53. package/build/hooks/block-renaming.cjs.map +2 -2
  54. package/build/hooks/custom-css.cjs +1 -1
  55. package/build/hooks/custom-css.cjs.map +2 -2
  56. package/build/hooks/grid-visualizer.cjs +42 -5
  57. package/build/hooks/grid-visualizer.cjs.map +3 -3
  58. package/build/hooks/index.cjs +0 -2
  59. package/build/hooks/index.cjs.map +3 -3
  60. package/build/hooks/layout-child.cjs +41 -5
  61. package/build/hooks/layout-child.cjs.map +3 -3
  62. package/build/private-apis.cjs +2 -0
  63. package/build/private-apis.cjs.map +3 -3
  64. package/build/store/actions.cjs +5 -0
  65. package/build/store/actions.cjs.map +2 -2
  66. package/build/store/private-selectors.cjs +1 -1
  67. package/build/store/private-selectors.cjs.map +2 -2
  68. package/build/store/reducer.cjs +5 -7
  69. package/build/store/reducer.cjs.map +2 -2
  70. package/build/store/selectors.cjs +15 -0
  71. package/build/store/selectors.cjs.map +2 -2
  72. package/build/utils/fit-text-utils.cjs +17 -7
  73. package/build/utils/fit-text-utils.cjs.map +2 -2
  74. package/build-module/components/block-breadcrumb/index.mjs +10 -2
  75. package/build-module/components/block-breadcrumb/index.mjs.map +2 -2
  76. package/build-module/components/block-inspector/index.mjs +12 -11
  77. package/build-module/components/block-inspector/index.mjs.map +2 -2
  78. package/build-module/components/block-list/block.mjs +6 -3
  79. package/build-module/components/block-list/block.mjs.map +3 -3
  80. package/build-module/components/block-list/index.mjs +26 -18
  81. package/build-module/components/block-list/index.mjs.map +2 -2
  82. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs +2 -6
  83. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs.map +2 -2
  84. package/build-module/components/block-list/use-in-between-inserter.mjs +4 -4
  85. package/build-module/components/block-list/use-in-between-inserter.mjs.map +2 -2
  86. package/build-module/components/block-settings-menu/block-settings-dropdown.mjs +10 -7
  87. package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
  88. package/build-module/components/block-settings-menu-controls/edit-section-menu-item.mjs +1 -1
  89. package/build-module/components/block-settings-menu-controls/edit-section-menu-item.mjs.map +2 -2
  90. package/build-module/components/block-settings-menu-controls/index.mjs +10 -15
  91. package/build-module/components/block-settings-menu-controls/index.mjs.map +2 -2
  92. package/build-module/components/block-toolbar/block-toolbar-icon.mjs +6 -4
  93. package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
  94. package/build-module/components/block-toolbar/index.mjs +1 -1
  95. package/build-module/components/block-toolbar/index.mjs.map +2 -2
  96. package/build-module/components/block-variation-transforms/index.mjs +1 -2
  97. package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
  98. package/build-module/components/block-visibility/modal.mjs +5 -92
  99. package/build-module/components/block-visibility/modal.mjs.map +2 -2
  100. package/build-module/components/inserter/index.mjs +1 -0
  101. package/build-module/components/inserter/index.mjs.map +2 -2
  102. package/build-module/components/inspector-controls/last-item.mjs +23 -0
  103. package/build-module/components/inspector-controls/last-item.mjs.map +7 -0
  104. package/build-module/components/inspector-controls-tabs/index.mjs +2 -2
  105. package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
  106. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +4 -4
  107. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  108. package/build-module/components/media-replace-flow/index.mjs +2 -2
  109. package/build-module/components/media-replace-flow/index.mjs.map +2 -2
  110. package/build-module/components/rich-text/index.mjs +1 -1
  111. package/build-module/components/rich-text/index.mjs.map +2 -2
  112. package/build-module/components/use-block-display-information/index.mjs +1 -1
  113. package/build-module/components/use-block-display-information/index.mjs.map +2 -2
  114. package/build-module/components/writing-flow/index.mjs +2 -0
  115. package/build-module/components/writing-flow/index.mjs.map +2 -2
  116. package/build-module/components/writing-flow/use-arrow-nav.mjs +3 -0
  117. package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
  118. package/build-module/components/writing-flow/use-drag-selection.mjs +2 -1
  119. package/build-module/components/writing-flow/use-drag-selection.mjs.map +2 -2
  120. package/build-module/components/writing-flow/use-preview-mode-nav.mjs +67 -0
  121. package/build-module/components/writing-flow/use-preview-mode-nav.mjs.map +7 -0
  122. package/build-module/hooks/anchor.mjs +1 -1
  123. package/build-module/hooks/anchor.mjs.map +1 -1
  124. package/build-module/hooks/block-renaming.mjs +1 -1
  125. package/build-module/hooks/block-renaming.mjs.map +2 -2
  126. package/build-module/hooks/custom-css.mjs +1 -1
  127. package/build-module/hooks/custom-css.mjs.map +2 -2
  128. package/build-module/hooks/grid-visualizer.mjs +20 -5
  129. package/build-module/hooks/grid-visualizer.mjs.map +2 -2
  130. package/build-module/hooks/index.mjs +0 -2
  131. package/build-module/hooks/index.mjs.map +2 -2
  132. package/build-module/hooks/layout-child.mjs +31 -5
  133. package/build-module/hooks/layout-child.mjs.map +2 -2
  134. package/build-module/private-apis.mjs +2 -0
  135. package/build-module/private-apis.mjs.map +2 -2
  136. package/build-module/store/actions.mjs +5 -0
  137. package/build-module/store/actions.mjs.map +2 -2
  138. package/build-module/store/private-selectors.mjs +1 -1
  139. package/build-module/store/private-selectors.mjs.map +2 -2
  140. package/build-module/store/reducer.mjs +5 -7
  141. package/build-module/store/reducer.mjs.map +2 -2
  142. package/build-module/store/selectors.mjs +15 -0
  143. package/build-module/store/selectors.mjs.map +2 -2
  144. package/build-module/utils/fit-text-utils.mjs +17 -7
  145. package/build-module/utils/fit-text-utils.mjs.map +2 -2
  146. package/build-style/content-rtl.css +10 -0
  147. package/build-style/content.css +10 -0
  148. package/package.json +39 -39
  149. package/src/components/block-breadcrumb/index.js +6 -1
  150. package/src/components/block-inspector/index.js +20 -21
  151. package/src/components/block-list/block.js +5 -2
  152. package/src/components/block-list/content.scss +11 -0
  153. package/src/components/block-list/index.js +25 -17
  154. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +2 -7
  155. package/src/components/block-list/use-in-between-inserter.js +8 -6
  156. package/src/components/block-settings-menu/block-settings-dropdown.js +11 -6
  157. package/src/components/block-settings-menu-controls/edit-section-menu-item.js +1 -7
  158. package/src/components/block-settings-menu-controls/index.js +14 -16
  159. package/src/components/block-toolbar/block-toolbar-icon.js +6 -10
  160. package/src/components/block-toolbar/index.js +1 -7
  161. package/src/components/block-variation-transforms/index.js +1 -4
  162. package/src/components/inserter/index.js +1 -0
  163. package/src/components/inserter/stories/index.story.jsx +31 -24
  164. package/src/components/inspector-controls/last-item.js +29 -0
  165. package/src/components/inspector-controls-tabs/index.js +1 -1
  166. package/src/components/inspector-controls-tabs/styles-tab.js +10 -11
  167. package/src/components/media-replace-flow/index.js +3 -3
  168. package/src/components/rich-text/index.js +1 -1
  169. package/src/components/use-block-display-information/index.js +1 -5
  170. package/src/components/writing-flow/index.js +2 -0
  171. package/src/components/writing-flow/use-arrow-nav.js +5 -0
  172. package/src/components/writing-flow/use-drag-selection.js +7 -1
  173. package/src/components/writing-flow/use-preview-mode-nav.js +102 -0
  174. package/src/hooks/anchor.js +1 -1
  175. package/src/hooks/block-renaming.js +5 -2
  176. package/src/hooks/custom-css.js +1 -1
  177. package/src/hooks/grid-visualizer.js +23 -4
  178. package/src/hooks/index.js +0 -2
  179. package/src/hooks/layout-child.js +39 -3
  180. package/src/private-apis.js +2 -0
  181. package/src/store/actions.js +7 -0
  182. package/src/store/private-selectors.js +0 -1
  183. package/src/store/reducer.js +11 -18
  184. package/src/store/selectors.js +25 -0
  185. package/src/store/test/reducer.js +258 -266
  186. package/src/utils/fit-text-utils.js +24 -8
  187. package/build/components/content-lock/index.cjs +0 -31
  188. package/build/components/content-lock/index.cjs.map +0 -7
  189. package/build/components/content-lock/modify-content-lock-menu-item.cjs +0 -70
  190. package/build/components/content-lock/modify-content-lock-menu-item.cjs.map +0 -7
  191. package/build/hooks/content-lock-ui.cjs +0 -68
  192. package/build/hooks/content-lock-ui.cjs.map +0 -7
  193. package/build-module/components/content-lock/index.mjs +0 -6
  194. package/build-module/components/content-lock/index.mjs.map +0 -7
  195. package/build-module/components/content-lock/modify-content-lock-menu-item.mjs +0 -45
  196. package/build-module/components/content-lock/modify-content-lock-menu-item.mjs.map +0 -7
  197. package/build-module/hooks/content-lock-ui.mjs +0 -47
  198. package/build-module/hooks/content-lock-ui.mjs.map +0 -7
  199. package/src/components/content-lock/index.js +0 -1
  200. package/src/components/content-lock/modify-content-lock-menu-item.js +0 -67
  201. package/src/hooks/content-lock-ui.js +0 -76
@@ -248,6 +248,13 @@ export const selectPreviousBlock =
248
248
  const firstParentClientId = select.getBlockRootClientId( clientId );
249
249
  if ( firstParentClientId ) {
250
250
  dispatch.selectBlock( firstParentClientId, -1 );
251
+ } else {
252
+ // Fallback to next block when no previous block and no parent
253
+ const nextBlockClientId =
254
+ select.getNextBlockClientId( clientId );
255
+ if ( nextBlockClientId ) {
256
+ dispatch.selectBlock( nextBlockClientId, 0 );
257
+ }
251
258
  }
252
259
  }
253
260
  };
@@ -523,7 +523,6 @@ export function isSectionBlock( state, clientId ) {
523
523
 
524
524
  if (
525
525
  ( attributes?.metadata?.patternName || isTemplatePart ) &&
526
- !! window?.__experimentalContentOnlyPatternInsertion &&
527
526
  ! isIsolatedEditor
528
527
  ) {
529
528
  return true;
@@ -2283,22 +2283,17 @@ function getDerivedBlockEditingModesForTree( state, treeClientId = '' ) {
2283
2283
 
2284
2284
  // Use array.from for better back compat. Older versions of the iterator returned
2285
2285
  // from `keys()` didn't have the `filter` method.
2286
- const unsyncedPatternClientIds =
2287
- !! window?.__experimentalContentOnlyPatternInsertion &&
2288
- ! isIsolatedEditor
2289
- ? Array.from( state.blocks.attributes.keys() ).filter(
2290
- ( clientId ) =>
2291
- state.blocks.attributes.get( clientId )?.metadata
2292
- ?.patternName
2293
- )
2294
- : [];
2286
+ const unsyncedPatternClientIds = isIsolatedEditor
2287
+ ? []
2288
+ : Array.from( state.blocks.attributes.keys() ).filter(
2289
+ ( clientId ) =>
2290
+ state.blocks.attributes.get( clientId )?.metadata
2291
+ ?.patternName
2292
+ );
2295
2293
  const contentOnlyParents = [
2296
2294
  ...contentOnlyTemplateLockedClientIds,
2297
2295
  ...unsyncedPatternClientIds,
2298
- ...( window?.__experimentalContentOnlyPatternInsertion &&
2299
- ! isIsolatedEditor
2300
- ? templatePartClientIds
2301
- : [] ),
2296
+ ...( isIsolatedEditor ? [] : templatePartClientIds ),
2302
2297
  ];
2303
2298
 
2304
2299
  traverseBlockTree( state, treeClientId, ( block ) => {
@@ -2323,11 +2318,9 @@ function getDerivedBlockEditingModesForTree( state, treeClientId = '' ) {
2323
2318
  return;
2324
2319
  }
2325
2320
 
2326
- // For the content only pattern experiment, disable blocks that are outside of the edited section.
2327
- if ( window?.__experimentalContentOnlyPatternInsertion ) {
2328
- derivedBlockEditingModes.set( clientId, 'disabled' );
2329
- return;
2330
- }
2321
+ // Disable blocks that are outside of the edited section.
2322
+ derivedBlockEditingModes.set( clientId, 'disabled' );
2323
+ return;
2331
2324
  }
2332
2325
 
2333
2326
  // If the block already has an explicit block editing mode set,
@@ -1681,6 +1681,11 @@ const canInsertBlockTypeUnmemoized = (
1681
1681
  blockName,
1682
1682
  rootClientId = null
1683
1683
  ) => {
1684
+ // Disable insertion in preview mode.
1685
+ if ( state.settings.isPreviewMode ) {
1686
+ return false;
1687
+ }
1688
+
1684
1689
  if ( ! isBlockVisibleInTheInserter( state, blockName, rootClientId ) ) {
1685
1690
  return false;
1686
1691
  }
@@ -1868,6 +1873,11 @@ export function canInsertBlocks( state, clientIds, rootClientId = null ) {
1868
1873
  * @return {boolean} Whether the given block is allowed to be removed.
1869
1874
  */
1870
1875
  export function canRemoveBlock( state, clientId ) {
1876
+ // Disable removal in preview mode.
1877
+ if ( state.settings.isPreviewMode ) {
1878
+ return false;
1879
+ }
1880
+
1871
1881
  const attributes = getBlockAttributes( state, clientId );
1872
1882
  if ( attributes === null ) {
1873
1883
  return true;
@@ -1930,6 +1940,11 @@ export function canRemoveBlocks( state, clientIds ) {
1930
1940
  * @return {boolean} Whether the given block is allowed to be moved.
1931
1941
  */
1932
1942
  export function canMoveBlock( state, clientId ) {
1943
+ // Disable moving in preview mode.
1944
+ if ( state.settings.isPreviewMode ) {
1945
+ return false;
1946
+ }
1947
+
1933
1948
  const attributes = getBlockAttributes( state, clientId );
1934
1949
  if ( attributes === null ) {
1935
1950
  return true;
@@ -1991,6 +2006,11 @@ export function canMoveBlocks( state, clientIds ) {
1991
2006
  * @return {boolean} Whether the given block is allowed to be edited.
1992
2007
  */
1993
2008
  export function canEditBlock( state, clientId ) {
2009
+ // Disable editing in preview mode.
2010
+ if ( state.settings.isPreviewMode ) {
2011
+ return false;
2012
+ }
2013
+
1994
2014
  const attributes = getBlockAttributes( state, clientId );
1995
2015
  if ( attributes === null ) {
1996
2016
  return true;
@@ -2011,6 +2031,11 @@ export function canEditBlock( state, clientId ) {
2011
2031
  * @return {boolean} Whether a given block type can be locked/unlocked.
2012
2032
  */
2013
2033
  export function canLockBlockType( state, nameOrType ) {
2034
+ // Disable locking in preview mode.
2035
+ if ( state.settings.isPreviewMode ) {
2036
+ return false;
2037
+ }
2038
+
2014
2039
  if ( ! hasBlockSupport( nameOrType, 'lock', true ) ) {
2015
2040
  return false;
2016
2041
  }