@wordpress/block-editor 15.11.1-next.v.0 → 15.12.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 (176) 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 +2 -2
  5. package/build/components/block-inspector/index.cjs.map +2 -2
  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-tabs/index.cjs +2 -2
  31. package/build/components/inspector-controls-tabs/index.cjs.map +3 -3
  32. package/build/components/inspector-controls-tabs/styles-tab.cjs +1 -1
  33. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  34. package/build/components/media-replace-flow/index.cjs +2 -2
  35. package/build/components/media-replace-flow/index.cjs.map +2 -2
  36. package/build/components/rich-text/index.cjs +1 -1
  37. package/build/components/rich-text/index.cjs.map +2 -2
  38. package/build/components/use-block-display-information/index.cjs +1 -1
  39. package/build/components/use-block-display-information/index.cjs.map +2 -2
  40. package/build/components/writing-flow/index.cjs +2 -0
  41. package/build/components/writing-flow/index.cjs.map +2 -2
  42. package/build/components/writing-flow/use-arrow-nav.cjs +3 -0
  43. package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
  44. package/build/components/writing-flow/use-drag-selection.cjs +2 -1
  45. package/build/components/writing-flow/use-drag-selection.cjs.map +2 -2
  46. package/build/components/writing-flow/use-preview-mode-nav.cjs +92 -0
  47. package/build/components/writing-flow/use-preview-mode-nav.cjs.map +7 -0
  48. package/build/hooks/block-renaming.cjs +1 -1
  49. package/build/hooks/block-renaming.cjs.map +2 -2
  50. package/build/hooks/custom-css.cjs +1 -1
  51. package/build/hooks/custom-css.cjs.map +2 -2
  52. package/build/hooks/index.cjs +0 -2
  53. package/build/hooks/index.cjs.map +3 -3
  54. package/build/store/actions.cjs +5 -0
  55. package/build/store/actions.cjs.map +2 -2
  56. package/build/store/private-selectors.cjs +1 -1
  57. package/build/store/private-selectors.cjs.map +2 -2
  58. package/build/store/reducer.cjs +5 -7
  59. package/build/store/reducer.cjs.map +2 -2
  60. package/build/store/selectors.cjs +15 -0
  61. package/build/store/selectors.cjs.map +2 -2
  62. package/build/utils/fit-text-utils.cjs +17 -7
  63. package/build/utils/fit-text-utils.cjs.map +2 -2
  64. package/build-module/components/block-breadcrumb/index.mjs +10 -2
  65. package/build-module/components/block-breadcrumb/index.mjs.map +2 -2
  66. package/build-module/components/block-inspector/index.mjs +2 -2
  67. package/build-module/components/block-inspector/index.mjs.map +2 -2
  68. package/build-module/components/block-list/block.mjs +6 -3
  69. package/build-module/components/block-list/block.mjs.map +3 -3
  70. package/build-module/components/block-list/index.mjs +26 -18
  71. package/build-module/components/block-list/index.mjs.map +2 -2
  72. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs +2 -6
  73. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs.map +2 -2
  74. package/build-module/components/block-list/use-in-between-inserter.mjs +4 -4
  75. package/build-module/components/block-list/use-in-between-inserter.mjs.map +2 -2
  76. package/build-module/components/block-settings-menu/block-settings-dropdown.mjs +10 -7
  77. package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
  78. package/build-module/components/block-settings-menu-controls/edit-section-menu-item.mjs +1 -1
  79. package/build-module/components/block-settings-menu-controls/edit-section-menu-item.mjs.map +2 -2
  80. package/build-module/components/block-settings-menu-controls/index.mjs +10 -15
  81. package/build-module/components/block-settings-menu-controls/index.mjs.map +2 -2
  82. package/build-module/components/block-toolbar/block-toolbar-icon.mjs +6 -4
  83. package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
  84. package/build-module/components/block-toolbar/index.mjs +1 -1
  85. package/build-module/components/block-toolbar/index.mjs.map +2 -2
  86. package/build-module/components/block-variation-transforms/index.mjs +1 -2
  87. package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
  88. package/build-module/components/block-visibility/modal.mjs +5 -92
  89. package/build-module/components/block-visibility/modal.mjs.map +2 -2
  90. package/build-module/components/inserter/index.mjs +1 -0
  91. package/build-module/components/inserter/index.mjs.map +2 -2
  92. package/build-module/components/inspector-controls-tabs/index.mjs +2 -2
  93. package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
  94. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +1 -1
  95. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  96. package/build-module/components/media-replace-flow/index.mjs +2 -2
  97. package/build-module/components/media-replace-flow/index.mjs.map +2 -2
  98. package/build-module/components/rich-text/index.mjs +1 -1
  99. package/build-module/components/rich-text/index.mjs.map +2 -2
  100. package/build-module/components/use-block-display-information/index.mjs +1 -1
  101. package/build-module/components/use-block-display-information/index.mjs.map +2 -2
  102. package/build-module/components/writing-flow/index.mjs +2 -0
  103. package/build-module/components/writing-flow/index.mjs.map +2 -2
  104. package/build-module/components/writing-flow/use-arrow-nav.mjs +3 -0
  105. package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
  106. package/build-module/components/writing-flow/use-drag-selection.mjs +2 -1
  107. package/build-module/components/writing-flow/use-drag-selection.mjs.map +2 -2
  108. package/build-module/components/writing-flow/use-preview-mode-nav.mjs +67 -0
  109. package/build-module/components/writing-flow/use-preview-mode-nav.mjs.map +7 -0
  110. package/build-module/hooks/block-renaming.mjs +1 -1
  111. package/build-module/hooks/block-renaming.mjs.map +2 -2
  112. package/build-module/hooks/custom-css.mjs +1 -1
  113. package/build-module/hooks/custom-css.mjs.map +2 -2
  114. package/build-module/hooks/index.mjs +0 -2
  115. package/build-module/hooks/index.mjs.map +2 -2
  116. package/build-module/store/actions.mjs +5 -0
  117. package/build-module/store/actions.mjs.map +2 -2
  118. package/build-module/store/private-selectors.mjs +1 -1
  119. package/build-module/store/private-selectors.mjs.map +2 -2
  120. package/build-module/store/reducer.mjs +5 -7
  121. package/build-module/store/reducer.mjs.map +2 -2
  122. package/build-module/store/selectors.mjs +15 -0
  123. package/build-module/store/selectors.mjs.map +2 -2
  124. package/build-module/utils/fit-text-utils.mjs +17 -7
  125. package/build-module/utils/fit-text-utils.mjs.map +2 -2
  126. package/build-style/content-rtl.css +10 -0
  127. package/build-style/content.css +10 -0
  128. package/package.json +39 -39
  129. package/src/components/block-breadcrumb/index.js +6 -1
  130. package/src/components/block-inspector/index.js +1 -4
  131. package/src/components/block-list/block.js +5 -2
  132. package/src/components/block-list/content.scss +11 -0
  133. package/src/components/block-list/index.js +25 -17
  134. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +2 -7
  135. package/src/components/block-list/use-in-between-inserter.js +8 -6
  136. package/src/components/block-settings-menu/block-settings-dropdown.js +11 -6
  137. package/src/components/block-settings-menu-controls/edit-section-menu-item.js +1 -7
  138. package/src/components/block-settings-menu-controls/index.js +14 -16
  139. package/src/components/block-toolbar/block-toolbar-icon.js +6 -10
  140. package/src/components/block-toolbar/index.js +1 -7
  141. package/src/components/block-variation-transforms/index.js +1 -4
  142. package/src/components/inserter/index.js +1 -0
  143. package/src/components/inserter/stories/index.story.jsx +31 -24
  144. package/src/components/inspector-controls-tabs/index.js +1 -1
  145. package/src/components/inspector-controls-tabs/styles-tab.js +7 -8
  146. package/src/components/media-replace-flow/index.js +3 -3
  147. package/src/components/rich-text/index.js +1 -1
  148. package/src/components/use-block-display-information/index.js +1 -5
  149. package/src/components/writing-flow/index.js +2 -0
  150. package/src/components/writing-flow/use-arrow-nav.js +5 -0
  151. package/src/components/writing-flow/use-drag-selection.js +7 -1
  152. package/src/components/writing-flow/use-preview-mode-nav.js +102 -0
  153. package/src/hooks/block-renaming.js +5 -2
  154. package/src/hooks/custom-css.js +1 -1
  155. package/src/hooks/index.js +0 -2
  156. package/src/store/actions.js +7 -0
  157. package/src/store/private-selectors.js +0 -1
  158. package/src/store/reducer.js +11 -18
  159. package/src/store/selectors.js +25 -0
  160. package/src/store/test/reducer.js +258 -266
  161. package/src/utils/fit-text-utils.js +24 -8
  162. package/build/components/content-lock/index.cjs +0 -31
  163. package/build/components/content-lock/index.cjs.map +0 -7
  164. package/build/components/content-lock/modify-content-lock-menu-item.cjs +0 -70
  165. package/build/components/content-lock/modify-content-lock-menu-item.cjs.map +0 -7
  166. package/build/hooks/content-lock-ui.cjs +0 -68
  167. package/build/hooks/content-lock-ui.cjs.map +0 -7
  168. package/build-module/components/content-lock/index.mjs +0 -6
  169. package/build-module/components/content-lock/index.mjs.map +0 -7
  170. package/build-module/components/content-lock/modify-content-lock-menu-item.mjs +0 -45
  171. package/build-module/components/content-lock/modify-content-lock-menu-item.mjs.map +0 -7
  172. package/build-module/hooks/content-lock-ui.mjs +0 -47
  173. package/build-module/hooks/content-lock-ui.mjs.map +0 -7
  174. package/src/components/content-lock/index.js +0 -1
  175. package/src/components/content-lock/modify-content-lock-menu-item.js +0 -67
  176. package/src/hooks/content-lock-ui.js +0 -76
@@ -5,20 +5,30 @@ function findOptimalFontSize(textElement, applyFontSize) {
5
5
  let maxSize = 2400;
6
6
  let bestSize = minSize;
7
7
  const computedStyle = window.getComputedStyle(textElement);
8
- const paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;
9
- const paddingRight = parseFloat(computedStyle.paddingRight) || 0;
8
+ let paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;
9
+ let paddingRight = parseFloat(computedStyle.paddingRight) || 0;
10
10
  const range = document.createRange();
11
11
  range.selectNodeContents(textElement);
12
- let maxclientHeight = textElement.clientHeight;
12
+ let referenceElement = textElement;
13
+ const parentElement = textElement.parentElement;
14
+ if (parentElement) {
15
+ const parentElementComputedStyle = window.getComputedStyle(parentElement);
16
+ if (parentElementComputedStyle?.display === "flex") {
17
+ referenceElement = parentElement;
18
+ paddingLeft += parseFloat(parentElementComputedStyle.paddingLeft) || 0;
19
+ paddingRight += parseFloat(parentElementComputedStyle.paddingRight) || 0;
20
+ }
21
+ }
22
+ let maxclientHeight = referenceElement.clientHeight;
13
23
  while (minSize <= maxSize) {
14
24
  const midSize = Math.floor((minSize + maxSize) / 2);
15
25
  applyFontSize(midSize);
16
26
  const rect = range.getBoundingClientRect();
17
27
  const textWidth = rect.width;
18
- const fitsWidth = textElement.scrollWidth <= textElement.clientWidth && textWidth <= textElement.clientWidth - paddingLeft - paddingRight;
19
- const fitsHeight = alreadyHasScrollableHeight || textElement.scrollHeight <= textElement.clientHeight || textElement.scrollHeight <= maxclientHeight;
20
- if (textElement.clientHeight > maxclientHeight) {
21
- maxclientHeight = textElement.clientHeight;
28
+ const fitsWidth = textElement.scrollWidth <= referenceElement.clientWidth && textWidth <= referenceElement.clientWidth - paddingLeft - paddingRight;
29
+ const fitsHeight = alreadyHasScrollableHeight || textElement.scrollHeight <= referenceElement.clientHeight || textElement.scrollHeight <= maxclientHeight;
30
+ if (referenceElement.clientHeight > maxclientHeight) {
31
+ maxclientHeight = referenceElement.clientHeight;
22
32
  }
23
33
  if (fitsWidth && fitsHeight) {
24
34
  bestSize = midSize;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/fit-text-utils.js"],
4
- "sourcesContent": ["/**\n * Shared utility functions for fit text functionality.\n * Uses callback-based approach for maximum code reuse between editor and frontend.\n */\n\n/**\n * Find optimal font size using simple binary search between 0-2400px.\n *\n * @param {HTMLElement} textElement The text element\n * @param {Function} applyFontSize Function that receives font size in pixels\n * @return {number} Optimal font size\n */\nfunction findOptimalFontSize( textElement, applyFontSize ) {\n\tconst alreadyHasScrollableHeight =\n\t\ttextElement.scrollHeight > textElement.clientHeight;\n\tlet minSize = 0;\n\tlet maxSize = 2400;\n\tlet bestSize = minSize;\n\n\tconst computedStyle = window.getComputedStyle( textElement );\n\tconst paddingLeft = parseFloat( computedStyle.paddingLeft ) || 0;\n\tconst paddingRight = parseFloat( computedStyle.paddingRight ) || 0;\n\tconst range = document.createRange();\n\trange.selectNodeContents( textElement );\n\tlet maxclientHeight = textElement.clientHeight;\n\twhile ( minSize <= maxSize ) {\n\t\tconst midSize = Math.floor( ( minSize + maxSize ) / 2 );\n\t\tapplyFontSize( midSize );\n\n\t\t// When there is padding if the text overflows to the\n\t\t// padding area, it should be considered overflowing.\n\t\t// Use Range API to measure actual text content dimensions.\n\t\tconst rect = range.getBoundingClientRect();\n\t\tconst textWidth = rect.width;\n\n\t\t// Check if text fits within the element's width and is not\n\t\t// overflowing into the padding area.\n\t\tconst fitsWidth =\n\t\t\ttextElement.scrollWidth <= textElement.clientWidth &&\n\t\t\ttextWidth <= textElement.clientWidth - paddingLeft - paddingRight;\n\t\t// Check if text fits within the element's height.\n\t\tconst fitsHeight =\n\t\t\talreadyHasScrollableHeight ||\n\t\t\ttextElement.scrollHeight <= textElement.clientHeight ||\n\t\t\ttextElement.scrollHeight <= maxclientHeight;\n\n\t\t// When there are calculated line heights, text may jump in height\n\t\t// the available space may decrease while the font size decreases,\n\t\t// making text not fit.\n\t\t// We store a maximum reference height: the maximum reference element height that was observed\n\t\t// during the loop to avoid issues with such jumps.\n\t\tif ( textElement.clientHeight > maxclientHeight ) {\n\t\t\tmaxclientHeight = textElement.clientHeight;\n\t\t}\n\n\t\tif ( fitsWidth && fitsHeight ) {\n\t\t\tbestSize = midSize;\n\t\t\tminSize = midSize + 1;\n\t\t} else {\n\t\t\tmaxSize = midSize - 1;\n\t\t}\n\t}\n\trange.detach();\n\n\treturn bestSize;\n}\n\n/**\n * Complete fit text optimization for a single text element.\n * Handles the full flow using callbacks for font size application.\n *\n * @param {HTMLElement} textElement The text element (paragraph, heading, etc.)\n * @param {Function} applyFontSize Function that receives font size in pixels (0 to clear, >0 to apply)\n */\nexport function optimizeFitText( textElement, applyFontSize ) {\n\tif ( ! textElement ) {\n\t\treturn;\n\t}\n\n\tapplyFontSize( 0 );\n\n\tconst optimalSize = findOptimalFontSize( textElement, applyFontSize );\n\n\tapplyFontSize( optimalSize );\n\treturn optimalSize;\n}\n"],
5
- "mappings": ";AAYA,SAAS,oBAAqB,aAAa,eAAgB;AAC1D,QAAM,6BACL,YAAY,eAAe,YAAY;AACxC,MAAI,UAAU;AACd,MAAI,UAAU;AACd,MAAI,WAAW;AAEf,QAAM,gBAAgB,OAAO,iBAAkB,WAAY;AAC3D,QAAM,cAAc,WAAY,cAAc,WAAY,KAAK;AAC/D,QAAM,eAAe,WAAY,cAAc,YAAa,KAAK;AACjE,QAAM,QAAQ,SAAS,YAAY;AACnC,QAAM,mBAAoB,WAAY;AACtC,MAAI,kBAAkB,YAAY;AAClC,SAAQ,WAAW,SAAU;AAC5B,UAAM,UAAU,KAAK,OAAS,UAAU,WAAY,CAAE;AACtD,kBAAe,OAAQ;AAKvB,UAAM,OAAO,MAAM,sBAAsB;AACzC,UAAM,YAAY,KAAK;AAIvB,UAAM,YACL,YAAY,eAAe,YAAY,eACvC,aAAa,YAAY,cAAc,cAAc;AAEtD,UAAM,aACL,8BACA,YAAY,gBAAgB,YAAY,gBACxC,YAAY,gBAAgB;AAO7B,QAAK,YAAY,eAAe,iBAAkB;AACjD,wBAAkB,YAAY;AAAA,IAC/B;AAEA,QAAK,aAAa,YAAa;AAC9B,iBAAW;AACX,gBAAU,UAAU;AAAA,IACrB,OAAO;AACN,gBAAU,UAAU;AAAA,IACrB;AAAA,EACD;AACA,QAAM,OAAO;AAEb,SAAO;AACR;AASO,SAAS,gBAAiB,aAAa,eAAgB;AAC7D,MAAK,CAAE,aAAc;AACpB;AAAA,EACD;AAEA,gBAAe,CAAE;AAEjB,QAAM,cAAc,oBAAqB,aAAa,aAAc;AAEpE,gBAAe,WAAY;AAC3B,SAAO;AACR;",
4
+ "sourcesContent": ["/**\n * Shared utility functions for fit text functionality.\n * Uses callback-based approach for maximum code reuse between editor and frontend.\n */\n\n/**\n * Find optimal font size using simple binary search between 0-2400px.\n *\n * @param {HTMLElement} textElement The text element\n * @param {Function} applyFontSize Function that receives font size in pixels\n * @return {number} Optimal font size\n */\nfunction findOptimalFontSize( textElement, applyFontSize ) {\n\tconst alreadyHasScrollableHeight =\n\t\ttextElement.scrollHeight > textElement.clientHeight;\n\tlet minSize = 0;\n\tlet maxSize = 2400;\n\tlet bestSize = minSize;\n\n\tconst computedStyle = window.getComputedStyle( textElement );\n\tlet paddingLeft = parseFloat( computedStyle.paddingLeft ) || 0;\n\tlet paddingRight = parseFloat( computedStyle.paddingRight ) || 0;\n\tconst range = document.createRange();\n\trange.selectNodeContents( textElement );\n\n\tlet referenceElement = textElement;\n\tconst parentElement = textElement.parentElement;\n\tif ( parentElement ) {\n\t\tconst parentElementComputedStyle =\n\t\t\twindow.getComputedStyle( parentElement );\n\t\tif ( parentElementComputedStyle?.display === 'flex' ) {\n\t\t\treferenceElement = parentElement;\n\t\t\tpaddingLeft +=\n\t\t\t\tparseFloat( parentElementComputedStyle.paddingLeft ) || 0;\n\t\t\tpaddingRight +=\n\t\t\t\tparseFloat( parentElementComputedStyle.paddingRight ) || 0;\n\t\t}\n\t}\n\tlet maxclientHeight = referenceElement.clientHeight;\n\n\twhile ( minSize <= maxSize ) {\n\t\tconst midSize = Math.floor( ( minSize + maxSize ) / 2 );\n\t\tapplyFontSize( midSize );\n\n\t\t// When there is padding if the text overflows to the\n\t\t// padding area, it should be considered overflowing.\n\t\t// Use Range API to measure actual text content dimensions.\n\t\tconst rect = range.getBoundingClientRect();\n\t\tconst textWidth = rect.width;\n\n\t\t// Check if text fits within the element's width and is not\n\t\t// overflowing into the padding area.\n\t\tconst fitsWidth =\n\t\t\ttextElement.scrollWidth <= referenceElement.clientWidth &&\n\t\t\ttextWidth <=\n\t\t\t\treferenceElement.clientWidth - paddingLeft - paddingRight;\n\t\t// Check if text fits within the element's height.\n\t\tconst fitsHeight =\n\t\t\talreadyHasScrollableHeight ||\n\t\t\ttextElement.scrollHeight <= referenceElement.clientHeight ||\n\t\t\ttextElement.scrollHeight <= maxclientHeight;\n\n\t\t// When there are calculated line heights, text may jump in height\n\t\t// the available space may decrease while the font size decreases,\n\t\t// making text not fit.\n\t\t// We store a maximum reference height: the maximum reference element height that was observed\n\t\t// during the loop to avoid issues with such jumps.\n\t\tif ( referenceElement.clientHeight > maxclientHeight ) {\n\t\t\tmaxclientHeight = referenceElement.clientHeight;\n\t\t}\n\n\t\tif ( fitsWidth && fitsHeight ) {\n\t\t\tbestSize = midSize;\n\t\t\tminSize = midSize + 1;\n\t\t} else {\n\t\t\tmaxSize = midSize - 1;\n\t\t}\n\t}\n\trange.detach();\n\n\treturn bestSize;\n}\n\n/**\n * Complete fit text optimization for a single text element.\n * Handles the full flow using callbacks for font size application.\n *\n * @param {HTMLElement} textElement The text element (paragraph, heading, etc.)\n * @param {Function} applyFontSize Function that receives font size in pixels (0 to clear, >0 to apply)\n */\nexport function optimizeFitText( textElement, applyFontSize ) {\n\tif ( ! textElement ) {\n\t\treturn;\n\t}\n\n\tapplyFontSize( 0 );\n\n\tconst optimalSize = findOptimalFontSize( textElement, applyFontSize );\n\n\tapplyFontSize( optimalSize );\n\treturn optimalSize;\n}\n"],
5
+ "mappings": ";AAYA,SAAS,oBAAqB,aAAa,eAAgB;AAC1D,QAAM,6BACL,YAAY,eAAe,YAAY;AACxC,MAAI,UAAU;AACd,MAAI,UAAU;AACd,MAAI,WAAW;AAEf,QAAM,gBAAgB,OAAO,iBAAkB,WAAY;AAC3D,MAAI,cAAc,WAAY,cAAc,WAAY,KAAK;AAC7D,MAAI,eAAe,WAAY,cAAc,YAAa,KAAK;AAC/D,QAAM,QAAQ,SAAS,YAAY;AACnC,QAAM,mBAAoB,WAAY;AAEtC,MAAI,mBAAmB;AACvB,QAAM,gBAAgB,YAAY;AAClC,MAAK,eAAgB;AACpB,UAAM,6BACL,OAAO,iBAAkB,aAAc;AACxC,QAAK,4BAA4B,YAAY,QAAS;AACrD,yBAAmB;AACnB,qBACC,WAAY,2BAA2B,WAAY,KAAK;AACzD,sBACC,WAAY,2BAA2B,YAAa,KAAK;AAAA,IAC3D;AAAA,EACD;AACA,MAAI,kBAAkB,iBAAiB;AAEvC,SAAQ,WAAW,SAAU;AAC5B,UAAM,UAAU,KAAK,OAAS,UAAU,WAAY,CAAE;AACtD,kBAAe,OAAQ;AAKvB,UAAM,OAAO,MAAM,sBAAsB;AACzC,UAAM,YAAY,KAAK;AAIvB,UAAM,YACL,YAAY,eAAe,iBAAiB,eAC5C,aACC,iBAAiB,cAAc,cAAc;AAE/C,UAAM,aACL,8BACA,YAAY,gBAAgB,iBAAiB,gBAC7C,YAAY,gBAAgB;AAO7B,QAAK,iBAAiB,eAAe,iBAAkB;AACtD,wBAAkB,iBAAiB;AAAA,IACpC;AAEA,QAAK,aAAa,YAAa;AAC9B,iBAAW;AACX,gBAAU,UAAU;AAAA,IACrB,OAAO;AACN,gBAAU,UAAU;AAAA,IACrB;AAAA,EACD;AACA,QAAM,OAAO;AAEb,SAAO;AACR;AASO,SAAS,gBAAiB,aAAa,eAAgB;AAC7D,MAAK,CAAE,aAAc;AACpB;AAAA,EACD;AAEA,gBAAe,CAAE;AAEjB,QAAM,cAAc,oBAAqB,aAAa,aAAc;AAEpE,gBAAe,WAAY;AAC3B,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -503,6 +503,16 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
503
503
  cursor: grabbing;
504
504
  }
505
505
 
506
+ .is-preview-mode {
507
+ pointer-events: none;
508
+ }
509
+ .is-preview-mode .block-editor-block-list__block {
510
+ pointer-events: auto;
511
+ }
512
+ .is-preview-mode .block-editor-block-list__block > *:not(.block-editor-block-list__block) {
513
+ pointer-events: none;
514
+ }
515
+
506
516
  .is-vertical .block-list-appender {
507
517
  width: 24px;
508
518
  margin-left: auto;
@@ -503,6 +503,16 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
503
503
  cursor: grabbing;
504
504
  }
505
505
 
506
+ .is-preview-mode {
507
+ pointer-events: none;
508
+ }
509
+ .is-preview-mode .block-editor-block-list__block {
510
+ pointer-events: auto;
511
+ }
512
+ .is-preview-mode .block-editor-block-list__block > *:not(.block-editor-block-list__block) {
513
+ pointer-events: none;
514
+ }
515
+
506
516
  .is-vertical .block-list-appender {
507
517
  width: 24px;
508
518
  margin-right: auto;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "15.11.1-next.v.0+b8934fcf9",
3
+ "version": "15.12.0",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -61,43 +61,43 @@
61
61
  ],
62
62
  "dependencies": {
63
63
  "@react-spring/web": "^9.4.5",
64
- "@wordpress/a11y": "^4.38.1-next.v.0+b8934fcf9",
65
- "@wordpress/api-fetch": "^7.38.1-next.v.0+b8934fcf9",
66
- "@wordpress/base-styles": "^6.14.1-next.v.0+b8934fcf9",
67
- "@wordpress/blob": "^4.38.1-next.v.0+b8934fcf9",
68
- "@wordpress/block-serialization-default-parser": "^5.38.1-next.v.0+b8934fcf9",
69
- "@wordpress/blocks": "^15.11.1-next.v.0+b8934fcf9",
70
- "@wordpress/commands": "^1.38.1-next.v.0+b8934fcf9",
71
- "@wordpress/components": "^32.0.2-next.v.0+b8934fcf9",
72
- "@wordpress/compose": "^7.38.1-next.v.0+b8934fcf9",
73
- "@wordpress/data": "^10.38.1-next.v.0+b8934fcf9",
74
- "@wordpress/dataviews": "^11.3.1-next.v.0+b8934fcf9",
75
- "@wordpress/date": "^5.38.1-next.v.0+b8934fcf9",
76
- "@wordpress/deprecated": "^4.38.1-next.v.0+b8934fcf9",
77
- "@wordpress/dom": "^4.38.1-next.v.0+b8934fcf9",
78
- "@wordpress/element": "^6.38.1-next.v.0+b8934fcf9",
79
- "@wordpress/escape-html": "^3.38.1-next.v.0+b8934fcf9",
80
- "@wordpress/global-styles-engine": "^1.5.1-next.v.0+b8934fcf9",
81
- "@wordpress/hooks": "^4.38.1-next.v.0+b8934fcf9",
82
- "@wordpress/html-entities": "^4.38.1-next.v.0+b8934fcf9",
83
- "@wordpress/i18n": "^6.11.1-next.v.0+b8934fcf9",
84
- "@wordpress/icons": "^11.5.1-next.v.0+b8934fcf9",
85
- "@wordpress/image-cropper": "^1.2.1-next.v.0+b8934fcf9",
86
- "@wordpress/interactivity": "^6.38.1-next.v.0+b8934fcf9",
87
- "@wordpress/is-shallow-equal": "^5.38.1-next.v.0+b8934fcf9",
88
- "@wordpress/keyboard-shortcuts": "^5.38.1-next.v.0+b8934fcf9",
89
- "@wordpress/keycodes": "^4.38.1-next.v.0+b8934fcf9",
90
- "@wordpress/notices": "^5.38.1-next.v.0+b8934fcf9",
91
- "@wordpress/preferences": "^4.38.1-next.v.0+b8934fcf9",
92
- "@wordpress/priority-queue": "^3.38.1-next.v.0+b8934fcf9",
93
- "@wordpress/private-apis": "^1.38.1-next.v.0+b8934fcf9",
94
- "@wordpress/rich-text": "^7.38.1-next.v.0+b8934fcf9",
95
- "@wordpress/style-engine": "^2.38.1-next.v.0+b8934fcf9",
96
- "@wordpress/token-list": "^3.38.1-next.v.0+b8934fcf9",
97
- "@wordpress/upload-media": "^0.23.1-next.v.0+b8934fcf9",
98
- "@wordpress/url": "^4.38.1-next.v.0+b8934fcf9",
99
- "@wordpress/warning": "^3.38.1-next.v.0+b8934fcf9",
100
- "@wordpress/wordcount": "^4.38.1-next.v.0+b8934fcf9",
64
+ "@wordpress/a11y": "^4.39.0",
65
+ "@wordpress/api-fetch": "^7.39.0",
66
+ "@wordpress/base-styles": "^6.15.0",
67
+ "@wordpress/blob": "^4.39.0",
68
+ "@wordpress/block-serialization-default-parser": "^5.39.0",
69
+ "@wordpress/blocks": "^15.12.0",
70
+ "@wordpress/commands": "^1.39.0",
71
+ "@wordpress/components": "^32.1.0",
72
+ "@wordpress/compose": "^7.39.0",
73
+ "@wordpress/data": "^10.39.0",
74
+ "@wordpress/dataviews": "^11.3.0",
75
+ "@wordpress/date": "^5.39.0",
76
+ "@wordpress/deprecated": "^4.39.0",
77
+ "@wordpress/dom": "^4.39.0",
78
+ "@wordpress/element": "^6.39.0",
79
+ "@wordpress/escape-html": "^3.39.0",
80
+ "@wordpress/global-styles-engine": "^1.6.0",
81
+ "@wordpress/hooks": "^4.39.0",
82
+ "@wordpress/html-entities": "^4.39.0",
83
+ "@wordpress/i18n": "^6.12.0",
84
+ "@wordpress/icons": "^11.6.0",
85
+ "@wordpress/image-cropper": "^1.3.0",
86
+ "@wordpress/interactivity": "^6.39.0",
87
+ "@wordpress/is-shallow-equal": "^5.39.0",
88
+ "@wordpress/keyboard-shortcuts": "^5.39.0",
89
+ "@wordpress/keycodes": "^4.39.0",
90
+ "@wordpress/notices": "^5.39.0",
91
+ "@wordpress/preferences": "^4.39.0",
92
+ "@wordpress/priority-queue": "^3.39.0",
93
+ "@wordpress/private-apis": "^1.39.0",
94
+ "@wordpress/rich-text": "^7.39.0",
95
+ "@wordpress/style-engine": "^2.39.0",
96
+ "@wordpress/token-list": "^3.39.0",
97
+ "@wordpress/upload-media": "^0.24.0",
98
+ "@wordpress/url": "^4.39.0",
99
+ "@wordpress/warning": "^3.39.0",
100
+ "@wordpress/wordcount": "^4.39.0",
101
101
  "change-case": "^4.1.2",
102
102
  "clsx": "^2.1.1",
103
103
  "colord": "^2.7.0",
@@ -124,5 +124,5 @@
124
124
  "publishConfig": {
125
125
  "access": "public"
126
126
  },
127
- "gitHead": "17529010285784fd2e735348a28391c79de87c88"
127
+ "gitHead": "eee1cfb1472f11183e40fb77465a5f13145df7ad"
128
128
  }
@@ -103,6 +103,7 @@ function BlockBreadcrumb( { rootLabelText } ) {
103
103
  <BlockTitle
104
104
  clientId={ parentClientId }
105
105
  maximumLength={ 35 }
106
+ context="breadcrumb"
106
107
  />
107
108
  </Button>
108
109
  <Icon
@@ -116,7 +117,11 @@ function BlockBreadcrumb( { rootLabelText } ) {
116
117
  className="block-editor-block-breadcrumb__current"
117
118
  aria-current="true"
118
119
  >
119
- <BlockTitle clientId={ clientId } maximumLength={ 35 } />
120
+ <BlockTitle
121
+ clientId={ clientId }
122
+ maximumLength={ 35 }
123
+ context="breadcrumb"
124
+ />
120
125
  </li>
121
126
  ) }
122
127
  </ul>
@@ -315,7 +315,6 @@ const BlockInspectorSingleBlock = ( {
315
315
  } ) => {
316
316
  const hasMultipleTabs = availableTabs?.length > 1;
317
317
  const hasParentChildBlockCards =
318
- window?.__experimentalContentOnlyPatternInsertion &&
319
318
  editedContentOnlySection &&
320
319
  editedContentOnlySection !== renderedBlockClientId;
321
320
  const parentBlockInformation = useBlockDisplayInformation(
@@ -343,9 +342,7 @@ const BlockInspectorSingleBlock = ( {
343
342
  clientId={ renderedBlockClientId }
344
343
  />
345
344
  <ViewportVisibilityInfo clientId={ renderedBlockClientId } />
346
- { window?.__experimentalContentOnlyPatternInsertion && (
347
- <EditContents clientId={ renderedBlockClientId } />
348
- ) }
345
+ <EditContents clientId={ renderedBlockClientId } />
349
346
  <BlockVariationTransforms blockClientId={ renderedBlockClientId } />
350
347
  { hasMultipleTabs && (
351
348
  <>
@@ -624,6 +624,8 @@ function BlockListBlockProvider( props ) {
624
624
  settings?.[ deviceTypeKey ]?.toLowerCase() || 'desktop';
625
625
 
626
626
  const hasLightBlockWrapper = blockType?.apiVersion > 1;
627
+ const isMultiSelected = isBlockMultiSelected( clientId );
628
+ const blockEditingMode = getBlockEditingMode( clientId );
627
629
  const previewContext = {
628
630
  isPreviewMode,
629
631
  blockWithoutAttributes,
@@ -643,6 +645,9 @@ function BlockListBlockProvider( props ) {
643
645
  bindableAttributes,
644
646
  blockVisibility,
645
647
  deviceType,
648
+ isMultiSelected,
649
+ blockEditingMode,
650
+ isEditingDisabled: blockEditingMode === 'disabled',
646
651
  };
647
652
 
648
653
  // When in preview mode, we can avoid a lot of selection and
@@ -654,13 +659,11 @@ function BlockListBlockProvider( props ) {
654
659
  const canRemove = canRemoveBlock( clientId );
655
660
  const canMove = canMoveBlock( clientId );
656
661
  const match = getActiveBlockVariation( blockName, attributes );
657
- const isMultiSelected = isBlockMultiSelected( clientId );
658
662
  const checkDeep = true;
659
663
  const isAncestorOfSelectedBlock = hasSelectedInnerBlock(
660
664
  clientId,
661
665
  checkDeep
662
666
  );
663
- const blockEditingMode = getBlockEditingMode( clientId );
664
667
  const sectionBlockClientId = _isSectionBlock( clientId )
665
668
  ? clientId
666
669
  : getParentSectionBlock( clientId );
@@ -476,3 +476,14 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
476
476
  cursor: grabbing;
477
477
  }
478
478
 
479
+ .is-preview-mode {
480
+ pointer-events: none;
481
+
482
+ .block-editor-block-list__block {
483
+ pointer-events: auto;
484
+
485
+ > *:not(.block-editor-block-list__block) {
486
+ pointer-events: none;
487
+ }
488
+ }
489
+ }
@@ -48,23 +48,30 @@ const delayedBlockVisibilityDebounceOptions = {
48
48
  };
49
49
 
50
50
  function Root( { className, ...settings } ) {
51
- const { isOutlineMode, isFocusMode, editedContentOnlySection } = useSelect(
52
- ( select ) => {
53
- const {
54
- getSettings,
55
- isTyping,
56
- hasBlockSpotlight,
57
- getEditedContentOnlySection,
58
- } = unlock( select( blockEditorStore ) );
59
- const { outlineMode, focusMode } = getSettings();
60
- return {
61
- isOutlineMode: outlineMode && ! isTyping(),
62
- isFocusMode: focusMode || hasBlockSpotlight(),
63
- editedContentOnlySection: getEditedContentOnlySection(),
64
- };
65
- },
66
- []
67
- );
51
+ const {
52
+ isOutlineMode,
53
+ isFocusMode,
54
+ isPreviewMode,
55
+ editedContentOnlySection,
56
+ } = useSelect( ( select ) => {
57
+ const {
58
+ getSettings,
59
+ isTyping,
60
+ hasBlockSpotlight,
61
+ getEditedContentOnlySection,
62
+ } = unlock( select( blockEditorStore ) );
63
+ const {
64
+ outlineMode,
65
+ focusMode,
66
+ isPreviewMode: _isPreviewMode,
67
+ } = getSettings();
68
+ return {
69
+ isOutlineMode: outlineMode && ! isTyping(),
70
+ isFocusMode: focusMode || hasBlockSpotlight(),
71
+ isPreviewMode: _isPreviewMode,
72
+ editedContentOnlySection: getEditedContentOnlySection(),
73
+ };
74
+ }, [] );
68
75
  const registry = useRegistry();
69
76
  const { setBlockVisibility } = useDispatch( blockEditorStore );
70
77
 
@@ -111,6 +118,7 @@ function Root( { className, ...settings } ) {
111
118
  className: clsx( 'is-root-container', className, {
112
119
  'is-outline-mode': isOutlineMode,
113
120
  'is-focus-mode': isFocusMode,
121
+ 'is-preview-mode': isPreviewMode,
114
122
  } ),
115
123
  },
116
124
  settings
@@ -319,17 +319,12 @@ export function useEventHandlers( { clientId, isSelected } ) {
319
319
  editContentOnlySection( clientId );
320
320
  }
321
321
 
322
- // Only add double-click listener if experimental flag is enabled
323
- if ( window?.__experimentalContentOnlyPatternInsertion ) {
324
- node.addEventListener( 'dblclick', onDoubleClick );
325
- }
322
+ node.addEventListener( 'dblclick', onDoubleClick );
326
323
 
327
324
  return () => {
328
325
  node.removeEventListener( 'keydown', onKeyDown );
329
326
  node.removeEventListener( 'dragstart', onDragStart );
330
- if ( window?.__experimentalContentOnlyPatternInsertion ) {
331
- node.removeEventListener( 'dblclick', onDoubleClick );
332
- }
327
+ node.removeEventListener( 'dblclick', onDoubleClick );
333
328
  };
334
329
  },
335
330
  [
@@ -15,12 +15,14 @@ import { unlock } from '../../lock-unlock';
15
15
 
16
16
  export function useInBetweenInserter() {
17
17
  const openRef = useContext( InsertionPointOpenRef );
18
- const isInBetweenInserterDisabled = useSelect(
19
- ( select ) =>
20
- select( blockEditorStore ).getSettings().isDistractionFree ||
21
- unlock( select( blockEditorStore ) ).isZoomOut(),
22
- []
23
- );
18
+ const isInBetweenInserterDisabled = useSelect( ( select ) => {
19
+ const settings = select( blockEditorStore ).getSettings();
20
+ return (
21
+ settings.isDistractionFree ||
22
+ settings.isPreviewMode ||
23
+ unlock( select( blockEditorStore ) ).isZoomOut()
24
+ );
25
+ }, [] );
24
26
  const {
25
27
  getBlockListSettings,
26
28
  getBlockIndex,
@@ -87,6 +87,7 @@ export function BlockSettingsDropdown( {
87
87
  selectedBlockClientIds,
88
88
  isContentOnly,
89
89
  isZoomOut,
90
+ canEdit,
90
91
  } = useSelect(
91
92
  ( select ) => {
92
93
  const {
@@ -97,6 +98,7 @@ export function BlockSettingsDropdown( {
97
98
  getBlockAttributes,
98
99
  getBlockEditingMode,
99
100
  isZoomOut: _isZoomOut,
101
+ canEditBlock,
100
102
  } = unlock( select( blockEditorStore ) );
101
103
 
102
104
  const { getActiveBlockVariation } = select( blocksStore );
@@ -121,6 +123,7 @@ export function BlockSettingsDropdown( {
121
123
  isContentOnly:
122
124
  getBlockEditingMode( firstBlockClientId ) === 'contentOnly',
123
125
  isZoomOut: _isZoomOut(),
126
+ canEdit: canEditBlock( firstBlockClientId ),
124
127
  };
125
128
  },
126
129
  [ firstBlockClientId ]
@@ -240,7 +243,7 @@ export function BlockSettingsDropdown( {
240
243
  parentBlockType={ parentBlockType }
241
244
  />
242
245
  ) }
243
- { count === 1 && (
246
+ { canEdit && count === 1 && (
244
247
  <BlockHTMLConvertButton
245
248
  clientId={ firstBlockClientId }
246
249
  />
@@ -252,7 +255,7 @@ export function BlockSettingsDropdown( {
252
255
  shortcut={ shortcuts.copy }
253
256
  />
254
257
  ) }
255
- { ! isContentOnly && (
258
+ { canRemove && ! isContentOnly && (
256
259
  <CopyMenuItem
257
260
  clientIds={ clientIds }
258
261
  label={ __( 'Cut' ) }
@@ -301,7 +304,7 @@ export function BlockSettingsDropdown( {
301
304
  </MenuItem>
302
305
  </>
303
306
  ) }
304
- { count === 1 && (
307
+ { canEdit && count === 1 && (
305
308
  <CommentIconSlotFill.Slot
306
309
  fillProps={ {
307
310
  clientId: firstBlockClientId,
@@ -318,9 +321,11 @@ export function BlockSettingsDropdown( {
318
321
  label={ __( 'Copy styles' ) }
319
322
  eventType="copyStyles"
320
323
  />
321
- <MenuItem onClick={ onPasteStyles }>
322
- { __( 'Paste styles' ) }
323
- </MenuItem>
324
+ { canEdit && (
325
+ <MenuItem onClick={ onPasteStyles }>
326
+ { __( 'Paste styles' ) }
327
+ </MenuItem>
328
+ ) }
324
329
  </MenuGroup>
325
330
  ) }
326
331
  { ! isContentOnly && (
@@ -31,13 +31,7 @@ export function EditSectionMenuItem( { clientId, onClose } ) {
31
31
  [ clientId ]
32
32
  );
33
33
 
34
- // Only show when the experiment is enabled, the block is a section block,
35
- // and we're not already editing it
36
- if (
37
- ! window?.__experimentalContentOnlyPatternInsertion ||
38
- ! isSectionBlock ||
39
- isEditingContentOnlySection
40
- ) {
34
+ if ( ! isSectionBlock || isEditingContentOnlySection ) {
41
35
  return null;
42
36
  }
43
37
 
@@ -19,7 +19,6 @@ import {
19
19
  import { BlockLockMenuItem, useBlockLock } from '../block-lock';
20
20
  import { store as blockEditorStore } from '../../store';
21
21
  import BlockModeToggle from '../block-settings-menu/block-mode-toggle';
22
- import { ModifyContentOnlySectionMenuItem } from '../content-lock';
23
22
  import { BlockRenameControl, useBlockRename } from '../block-rename';
24
23
  import { BlockVisibilityViewportMenuItem } from '../block-visibility';
25
24
  import { EditSectionMenuItem } from './edit-section-menu-item';
@@ -32,6 +31,7 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
32
31
  selectedClientIds,
33
32
  isContentOnly,
34
33
  canToggleSelectedBlocksVisibility,
34
+ canEdit,
35
35
  } = useSelect(
36
36
  ( select ) => {
37
37
  const {
@@ -39,6 +39,7 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
39
39
  getBlockNamesByClientId,
40
40
  getSelectedBlockClientIds,
41
41
  getBlockEditingMode,
42
+ canEditBlock,
42
43
  } = select( blockEditorStore );
43
44
  const ids =
44
45
  clientIds !== null ? clientIds : getSelectedBlockClientIds();
@@ -52,6 +53,7 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
52
53
  ).every( ( block ) =>
53
54
  hasBlockSupport( block.name, 'visibility', true )
54
55
  ),
56
+ canEdit: canEditBlock( ids[ 0 ] ),
55
57
  };
56
58
  },
57
59
  [ clientIds ]
@@ -105,34 +107,30 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
105
107
  onClose={ fillProps?.onClose }
106
108
  />
107
109
  ) }
108
- { showLockButton && (
110
+ { canEdit && showLockButton && (
109
111
  <BlockLockMenuItem
110
112
  clientId={ selectedClientIds[ 0 ] }
111
113
  />
112
114
  ) }
113
- { showRenameButton && (
115
+ { canEdit && showRenameButton && (
114
116
  <BlockRenameControl
115
117
  clientId={ selectedClientIds[ 0 ] }
116
118
  />
117
119
  ) }
118
- { showVisibilityButton && (
120
+ { canEdit && showVisibilityButton && (
119
121
  <BlockVisibilityViewportMenuItem
120
122
  clientIds={ selectedClientIds }
121
123
  />
122
124
  ) }
123
125
  { fills }
124
- { selectedClientIds.length === 1 && (
125
- <ModifyContentOnlySectionMenuItem
126
- clientId={ selectedClientIds[ 0 ] }
127
- onClose={ fillProps?.onClose }
128
- />
129
- ) }
130
- { fillProps?.count === 1 && ! isContentOnly && (
131
- <BlockModeToggle
132
- clientId={ fillProps?.firstBlockClientId }
133
- onToggle={ fillProps?.onClose }
134
- />
135
- ) }
126
+ { canEdit &&
127
+ fillProps?.count === 1 &&
128
+ ! isContentOnly && (
129
+ <BlockModeToggle
130
+ clientId={ fillProps?.firstBlockClientId }
131
+ onToggle={ fillProps?.onClose }
132
+ />
133
+ ) }
136
134
  </MenuGroup>
137
135
  );
138
136
  } }
@@ -27,6 +27,7 @@ function getBlockIconVariant( { select, clientIds } ) {
27
27
  canRemoveBlocks,
28
28
  getTemplateLock,
29
29
  getBlockEditingMode,
30
+ canEditBlock,
30
31
  } = unlock( select( blockEditorStore ) );
31
32
  const { getBlockStyles } = select( blocksStore );
32
33
 
@@ -53,17 +54,16 @@ function getBlockIconVariant( { select, clientIds } ) {
53
54
  0
54
55
  );
55
56
  const canRemove = canRemoveBlocks( clientIds );
56
-
57
+ const canEdit = clientIds.every( ( clientId ) => canEditBlock( clientId ) );
57
58
  const isDefaultEditingMode =
58
59
  getBlockEditingMode( clientIds[ 0 ] ) === 'default';
59
- const _hideTransformsForSections =
60
- window?.__experimentalContentOnlyPatternInsertion &&
61
- hasPatternNameInSelection;
60
+ const _hideTransformsForSections = hasPatternNameInSelection;
62
61
  const _showBlockSwitcher =
63
62
  ! _hideTransformsForSections &&
64
63
  isDefaultEditingMode &&
65
64
  ( hasBlockStyles || canRemove ) &&
66
- ! hasTemplateLock;
65
+ ! hasTemplateLock &&
66
+ canEdit;
67
67
 
68
68
  const _showPatternOverrides = hasPatternOverrides && hasParentPattern;
69
69
 
@@ -84,11 +84,7 @@ function getBlockIcon( { select, clientIds } ) {
84
84
  const _isSingleBlock = clientIds.length === 1;
85
85
  const firstClientId = clientIds[ 0 ];
86
86
  const blockAttributes = getBlockAttributes( firstClientId );
87
- if (
88
- _isSingleBlock &&
89
- blockAttributes?.metadata?.patternName &&
90
- window?.__experimentalContentOnlyPatternInsertion
91
- ) {
87
+ if ( _isSingleBlock && blockAttributes?.metadata?.patternName ) {
92
88
  return symbol;
93
89
  }
94
90
 
@@ -116,14 +116,8 @@ export function PrivateBlockToolbar( {
116
116
  );
117
117
 
118
118
  const _isZoomOut = isZoomOut();
119
-
120
119
  const _isSectionBlock = isSectionBlock( selectedBlockClientId );
121
-
122
- // The switch style button appears more prominently with the
123
- // content only pattern experiment.
124
- const _showSwitchSectionStyleButton =
125
- window?.__experimentalContentOnlyPatternInsertion &&
126
- ( _isZoomOut || _isSectionBlock );
120
+ const _showSwitchSectionStyleButton = _isZoomOut || _isSectionBlock;
127
121
 
128
122
  return {
129
123
  blockClientId: selectedBlockClientId,
@@ -205,10 +205,7 @@ function __experimentalBlockVariationTransforms( { blockClientId } ) {
205
205
  } );
206
206
  };
207
207
 
208
- const hideVariationsForSections =
209
- window?.__experimentalContentOnlyPatternInsertion && isSection;
210
-
211
- if ( ! variations?.length || isContentOnly || hideVariationsForSections ) {
208
+ if ( ! variations?.length || isContentOnly || isSection ) {
212
209
  return null;
213
210
  }
214
211
 
@@ -176,6 +176,7 @@ class Inserter extends Component {
176
176
  onSelect={ () => {
177
177
  onClose();
178
178
  } }
179
+ onClose={ onClose }
179
180
  rootClientId={ rootClientId }
180
181
  clientId={ clientId }
181
182
  isAppender={ isAppender }