@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
@@ -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.1-next.v.0+5aba098fc",
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.1-next.v.0+5aba098fc",
65
+ "@wordpress/api-fetch": "^7.39.1-next.v.0+5aba098fc",
66
+ "@wordpress/base-styles": "^6.15.1-next.v.0+5aba098fc",
67
+ "@wordpress/blob": "^4.39.1-next.v.0+5aba098fc",
68
+ "@wordpress/block-serialization-default-parser": "^5.39.1-next.v.0+5aba098fc",
69
+ "@wordpress/blocks": "^15.12.1-next.v.0+5aba098fc",
70
+ "@wordpress/commands": "^1.39.1-next.v.0+5aba098fc",
71
+ "@wordpress/components": "^32.1.1-next.v.0+5aba098fc",
72
+ "@wordpress/compose": "^7.39.1-next.v.0+5aba098fc",
73
+ "@wordpress/data": "^10.39.1-next.v.0+5aba098fc",
74
+ "@wordpress/dataviews": "^11.4.1-next.v.0+5aba098fc",
75
+ "@wordpress/date": "^5.39.1-next.v.0+5aba098fc",
76
+ "@wordpress/deprecated": "^4.39.1-next.v.0+5aba098fc",
77
+ "@wordpress/dom": "^4.39.1-next.v.0+5aba098fc",
78
+ "@wordpress/element": "^6.39.1-next.v.0+5aba098fc",
79
+ "@wordpress/escape-html": "^3.39.1-next.v.0+5aba098fc",
80
+ "@wordpress/global-styles-engine": "^1.6.1-next.v.0+5aba098fc",
81
+ "@wordpress/hooks": "^4.39.1-next.v.0+5aba098fc",
82
+ "@wordpress/html-entities": "^4.39.1-next.v.0+5aba098fc",
83
+ "@wordpress/i18n": "^6.12.1-next.v.0+5aba098fc",
84
+ "@wordpress/icons": "^11.6.1-next.v.0+5aba098fc",
85
+ "@wordpress/image-cropper": "^1.3.1-next.v.0+5aba098fc",
86
+ "@wordpress/interactivity": "^6.39.1-next.v.0+5aba098fc",
87
+ "@wordpress/is-shallow-equal": "^5.39.1-next.v.0+5aba098fc",
88
+ "@wordpress/keyboard-shortcuts": "^5.39.1-next.v.0+5aba098fc",
89
+ "@wordpress/keycodes": "^4.39.1-next.v.0+5aba098fc",
90
+ "@wordpress/notices": "^5.39.1-next.v.0+5aba098fc",
91
+ "@wordpress/preferences": "^4.39.1-next.v.0+5aba098fc",
92
+ "@wordpress/priority-queue": "^3.39.1-next.v.0+5aba098fc",
93
+ "@wordpress/private-apis": "^1.39.1-next.v.0+5aba098fc",
94
+ "@wordpress/rich-text": "^7.39.1-next.v.0+5aba098fc",
95
+ "@wordpress/style-engine": "^2.39.1-next.v.0+5aba098fc",
96
+ "@wordpress/token-list": "^3.39.1-next.v.0+5aba098fc",
97
+ "@wordpress/upload-media": "^0.24.1-next.v.0+5aba098fc",
98
+ "@wordpress/url": "^4.39.1-next.v.0+5aba098fc",
99
+ "@wordpress/warning": "^3.39.1-next.v.0+5aba098fc",
100
+ "@wordpress/wordcount": "^4.39.1-next.v.0+5aba098fc",
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": "d730f9e00f5462d1b9d2660632850f5f43ccff44"
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>
@@ -5,6 +5,7 @@ import { __ } from '@wordpress/i18n';
5
5
  import {
6
6
  getBlockType,
7
7
  getUnregisteredTypeHandlerName,
8
+ hasBlockSupport,
8
9
  store as blocksStore,
9
10
  } from '@wordpress/blocks';
10
11
  import { __unstableMotion as motion } from '@wordpress/components';
@@ -24,6 +25,7 @@ import BlockStyles from '../block-styles';
24
25
  import { default as InspectorControls } from '../inspector-controls';
25
26
  import { default as InspectorControlsTabs } from '../inspector-controls-tabs';
26
27
  import useInspectorControlsTabs from '../inspector-controls-tabs/use-inspector-controls-tabs';
28
+ import InspectorControlsLastItem from '../inspector-controls/last-item';
27
29
  import AdvancedControls from '../inspector-controls-tabs/advanced-controls-panel';
28
30
  import PositionControls from '../inspector-controls-tabs/position-controls-panel';
29
31
  import useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';
@@ -145,30 +147,29 @@ function BlockInspector() {
145
147
  renderedBlockClientId
146
148
  );
147
149
 
148
- // Temporary workaround for issue #71991
149
- // Exclude Navigation block children from Content sidebar until proper
150
- // drill-down experience is implemented (see #65699)
151
- // This prevents a poor UX where all Nav block sub-items are shown
152
- // when the parent block is in contentOnly mode.
153
- // Build a Set of all navigation block descendants for efficient lookup
154
- const navigationDescendants = new Set();
150
+ // Exclude items from the content tab that are already present in the
151
+ // List View tab.
152
+ const listViewDescendants = new Set();
155
153
  descendants.forEach( ( clientId ) => {
156
- if ( getBlockName( clientId ) === 'core/navigation' ) {
157
- const navChildren = getClientIdsOfDescendants( clientId );
158
- navChildren.forEach( ( childId ) =>
159
- navigationDescendants.add( childId )
154
+ const blockName = getBlockName( clientId );
155
+ // Navigation block doesn't have List View block support, but
156
+ // it does have a custom implementation that is shown within
157
+ // patterns, so it's included in this condition.
158
+ if (
159
+ blockName === 'core/navigation' ||
160
+ hasBlockSupport( blockName, 'listView' )
161
+ ) {
162
+ const listViewChildren =
163
+ getClientIdsOfDescendants( clientId );
164
+ listViewChildren.forEach( ( childId ) =>
165
+ listViewDescendants.add( childId )
160
166
  );
161
167
  }
162
168
  } );
163
169
 
164
170
  return descendants.filter( ( current ) => {
165
- // Exclude navigation block children
166
- if ( navigationDescendants.has( current ) ) {
167
- return false;
168
- }
169
-
170
171
  return (
171
- getBlockName( current ) !== 'core/list-item' &&
172
+ ! listViewDescendants.has( current ) &&
172
173
  getBlockEditingMode( current ) === 'contentOnly'
173
174
  );
174
175
  } );
@@ -315,7 +316,6 @@ const BlockInspectorSingleBlock = ( {
315
316
  } ) => {
316
317
  const hasMultipleTabs = availableTabs?.length > 1;
317
318
  const hasParentChildBlockCards =
318
- window?.__experimentalContentOnlyPatternInsertion &&
319
319
  editedContentOnlySection &&
320
320
  editedContentOnlySection !== renderedBlockClientId;
321
321
  const parentBlockInformation = useBlockDisplayInformation(
@@ -343,9 +343,7 @@ const BlockInspectorSingleBlock = ( {
343
343
  clientId={ renderedBlockClientId }
344
344
  />
345
345
  <ViewportVisibilityInfo clientId={ renderedBlockClientId } />
346
- { window?.__experimentalContentOnlyPatternInsertion && (
347
- <EditContents clientId={ renderedBlockClientId } />
348
- ) }
346
+ <EditContents clientId={ renderedBlockClientId } />
349
347
  <BlockVariationTransforms blockClientId={ renderedBlockClientId } />
350
348
  { hasMultipleTabs && (
351
349
  <>
@@ -372,6 +370,7 @@ const BlockInspectorSingleBlock = ( {
372
370
  ) }
373
371
  </>
374
372
  ) }
373
+ <InspectorControlsLastItem.Slot />
375
374
  <SkipToSelectedBlock key="back" />
376
375
  </div>
377
376
  );
@@ -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
  } }