@wordpress/block-editor 13.1.0 → 13.2.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 (142) hide show
  1. package/CHANGELOG.md +19 -17
  2. package/README.md +1 -1
  3. package/build/components/block-lock/modal.js +67 -67
  4. package/build/components/block-lock/modal.js.map +1 -1
  5. package/build/components/block-mover/index.js +12 -6
  6. package/build/components/block-mover/index.js.map +1 -1
  7. package/build/components/block-toolbar/shuffle.js +3 -1
  8. package/build/components/block-toolbar/shuffle.js.map +1 -1
  9. package/build/components/child-layout-control/index.js +185 -127
  10. package/build/components/child-layout-control/index.js.map +1 -1
  11. package/build/components/global-styles/use-global-styles-output.js +4 -3
  12. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  13. package/build/components/grid/grid-item-movers.js +97 -0
  14. package/build/components/grid/grid-item-movers.js.map +1 -0
  15. package/build/components/{grid-visualizer → grid}/grid-item-resizer.js +18 -56
  16. package/build/components/grid/grid-item-resizer.js.map +1 -0
  17. package/build/components/grid/grid-visualizer.js +225 -0
  18. package/build/components/grid/grid-visualizer.js.map +1 -0
  19. package/build/components/{grid-visualizer → grid}/index.js +14 -0
  20. package/build/components/grid/index.js.map +1 -0
  21. package/build/components/grid/use-get-number-of-blocks-before-cell.js +40 -0
  22. package/build/components/grid/use-get-number-of-blocks-before-cell.js.map +1 -0
  23. package/build/components/grid/use-grid-layout-sync.js +162 -0
  24. package/build/components/grid/use-grid-layout-sync.js.map +1 -0
  25. package/build/components/grid/utils.js +145 -0
  26. package/build/components/grid/utils.js.map +1 -0
  27. package/build/components/image-editor/aspect-ratio-dropdown.js +0 -1
  28. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  29. package/build/components/inner-blocks/index.js +1 -1
  30. package/build/components/inner-blocks/index.js.map +1 -1
  31. package/build/components/rich-text/event-listeners/input-rules.js +1 -0
  32. package/build/components/rich-text/event-listeners/input-rules.js.map +1 -1
  33. package/build/components/rich-text/index.native.js +10 -4
  34. package/build/components/rich-text/index.native.js.map +1 -1
  35. package/build/components/rich-text/native/index.native.js +14 -0
  36. package/build/components/rich-text/native/index.native.js.map +1 -1
  37. package/build/hooks/block-style-variation.js +26 -7
  38. package/build/hooks/block-style-variation.js.map +1 -1
  39. package/build/hooks/layout-child.js +29 -21
  40. package/build/hooks/layout-child.js.map +1 -1
  41. package/build/hooks/utils.js +3 -2
  42. package/build/hooks/utils.js.map +1 -1
  43. package/build/layouts/grid.js +24 -47
  44. package/build/layouts/grid.js.map +1 -1
  45. package/build/lock-unlock.js +1 -1
  46. package/build/lock-unlock.js.map +1 -1
  47. package/build/store/actions.js +17 -1
  48. package/build/store/actions.js.map +1 -1
  49. package/build-module/components/block-lock/modal.js +67 -67
  50. package/build-module/components/block-lock/modal.js.map +1 -1
  51. package/build-module/components/block-mover/index.js +12 -6
  52. package/build-module/components/block-mover/index.js.map +1 -1
  53. package/build-module/components/block-toolbar/shuffle.js +3 -1
  54. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  55. package/build-module/components/child-layout-control/index.js +185 -127
  56. package/build-module/components/child-layout-control/index.js.map +1 -1
  57. package/build-module/components/global-styles/use-global-styles-output.js +4 -3
  58. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  59. package/build-module/components/grid/grid-item-movers.js +90 -0
  60. package/build-module/components/grid/grid-item-movers.js.map +1 -0
  61. package/build-module/components/{grid-visualizer → grid}/grid-item-resizer.js +13 -51
  62. package/build-module/components/grid/grid-item-resizer.js.map +1 -0
  63. package/build-module/components/grid/grid-visualizer.js +217 -0
  64. package/build-module/components/grid/grid-visualizer.js.map +1 -0
  65. package/build-module/components/grid/index.js +5 -0
  66. package/build-module/components/grid/index.js.map +1 -0
  67. package/build-module/components/grid/use-get-number-of-blocks-before-cell.js +33 -0
  68. package/build-module/components/grid/use-get-number-of-blocks-before-cell.js.map +1 -0
  69. package/build-module/components/grid/use-grid-layout-sync.js +155 -0
  70. package/build-module/components/grid/use-grid-layout-sync.js.map +1 -0
  71. package/build-module/components/grid/utils.js +131 -0
  72. package/build-module/components/grid/utils.js.map +1 -0
  73. package/build-module/components/image-editor/aspect-ratio-dropdown.js +0 -1
  74. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  75. package/build-module/components/inner-blocks/index.js +1 -1
  76. package/build-module/components/inner-blocks/index.js.map +1 -1
  77. package/build-module/components/rich-text/event-listeners/input-rules.js +1 -1
  78. package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
  79. package/build-module/components/rich-text/index.native.js +11 -5
  80. package/build-module/components/rich-text/index.native.js.map +1 -1
  81. package/build-module/components/rich-text/native/index.native.js +14 -0
  82. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  83. package/build-module/hooks/block-style-variation.js +25 -7
  84. package/build-module/hooks/block-style-variation.js.map +1 -1
  85. package/build-module/hooks/layout-child.js +27 -19
  86. package/build-module/hooks/layout-child.js.map +1 -1
  87. package/build-module/hooks/utils.js +3 -2
  88. package/build-module/hooks/utils.js.map +1 -1
  89. package/build-module/layouts/grid.js +24 -47
  90. package/build-module/layouts/grid.js.map +1 -1
  91. package/build-module/lock-unlock.js +1 -1
  92. package/build-module/lock-unlock.js.map +1 -1
  93. package/build-module/store/actions.js +17 -1
  94. package/build-module/store/actions.js.map +1 -1
  95. package/build-style/style-rtl.css +39 -18
  96. package/build-style/style.css +39 -18
  97. package/package.json +31 -31
  98. package/src/components/block-lock/modal.js +95 -82
  99. package/src/components/block-lock/style.scss +11 -1
  100. package/src/components/block-mover/index.js +37 -24
  101. package/src/components/block-toolbar/shuffle.js +3 -1
  102. package/src/components/child-layout-control/index.js +224 -159
  103. package/src/components/global-styles/test/use-global-styles-output.js +38 -3
  104. package/src/components/global-styles/use-global-styles-output.js +4 -3
  105. package/src/components/grid/grid-item-movers.js +128 -0
  106. package/src/components/{grid-visualizer → grid}/grid-item-resizer.js +14 -52
  107. package/src/components/grid/grid-visualizer.js +267 -0
  108. package/src/components/grid/index.js +4 -0
  109. package/src/components/grid/style.scss +63 -0
  110. package/src/components/grid/use-get-number-of-blocks-before-cell.js +30 -0
  111. package/src/components/grid/use-grid-layout-sync.js +167 -0
  112. package/src/components/grid/utils.js +178 -0
  113. package/src/components/image-editor/aspect-ratio-dropdown.js +0 -1
  114. package/src/components/inner-blocks/index.js +3 -1
  115. package/src/components/rich-text/event-listeners/input-rules.js +1 -1
  116. package/src/components/rich-text/index.native.js +10 -8
  117. package/src/components/rich-text/native/index.native.js +17 -0
  118. package/src/hooks/block-style-variation.js +24 -6
  119. package/src/hooks/layout-child.js +34 -14
  120. package/src/hooks/utils.js +3 -1
  121. package/src/layouts/grid.js +54 -62
  122. package/src/lock-unlock.js +1 -1
  123. package/src/store/actions.js +21 -1
  124. package/src/style.scss +1 -1
  125. package/build/components/grid-visualizer/grid-item-resizer.js.map +0 -1
  126. package/build/components/grid-visualizer/grid-visualizer.js +0 -92
  127. package/build/components/grid-visualizer/grid-visualizer.js.map +0 -1
  128. package/build/components/grid-visualizer/index.js.map +0 -1
  129. package/build/components/grid-visualizer/utils.js +0 -10
  130. package/build/components/grid-visualizer/utils.js.map +0 -1
  131. package/build-module/components/grid-visualizer/grid-item-resizer.js.map +0 -1
  132. package/build-module/components/grid-visualizer/grid-visualizer.js +0 -84
  133. package/build-module/components/grid-visualizer/grid-visualizer.js.map +0 -1
  134. package/build-module/components/grid-visualizer/index.js +0 -3
  135. package/build-module/components/grid-visualizer/index.js.map +0 -1
  136. package/build-module/components/grid-visualizer/utils.js +0 -4
  137. package/build-module/components/grid-visualizer/utils.js.map +0 -1
  138. package/src/components/grid-visualizer/grid-visualizer.js +0 -101
  139. package/src/components/grid-visualizer/index.js +0 -2
  140. package/src/components/grid-visualizer/style.scss +0 -34
  141. package/src/components/grid-visualizer/utils.js +0 -5
  142. /package/src/components/font-sizes/{README.MD → README.md} +0 -0
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.GridRect = void 0;
7
+ exports.getClosestTrack = getClosestTrack;
8
+ exports.getComputedCSS = getComputedCSS;
9
+ exports.getGridInfo = getGridInfo;
10
+ exports.getGridItemRect = getGridItemRect;
11
+ exports.getGridRect = getGridRect;
12
+ exports.getGridTracks = getGridTracks;
13
+ exports.range = range;
14
+ function range(start, length) {
15
+ return Array.from({
16
+ length
17
+ }, (_, i) => start + i);
18
+ }
19
+ class GridRect {
20
+ constructor({
21
+ columnStart,
22
+ rowStart,
23
+ columnEnd,
24
+ rowEnd,
25
+ columnSpan,
26
+ rowSpan
27
+ } = {}) {
28
+ this.columnStart = columnStart !== null && columnStart !== void 0 ? columnStart : 1;
29
+ this.rowStart = rowStart !== null && rowStart !== void 0 ? rowStart : 1;
30
+ if (columnSpan !== undefined) {
31
+ this.columnEnd = this.columnStart + columnSpan - 1;
32
+ } else {
33
+ this.columnEnd = columnEnd !== null && columnEnd !== void 0 ? columnEnd : this.columnStart;
34
+ }
35
+ if (rowSpan !== undefined) {
36
+ this.rowEnd = this.rowStart + rowSpan - 1;
37
+ } else {
38
+ this.rowEnd = rowEnd !== null && rowEnd !== void 0 ? rowEnd : this.rowStart;
39
+ }
40
+ }
41
+ get columnSpan() {
42
+ return this.columnEnd - this.columnStart + 1;
43
+ }
44
+ get rowSpan() {
45
+ return this.rowEnd - this.rowStart + 1;
46
+ }
47
+ contains(column, row) {
48
+ return column >= this.columnStart && column <= this.columnEnd && row >= this.rowStart && row <= this.rowEnd;
49
+ }
50
+ containsRect(rect) {
51
+ return this.contains(rect.columnStart, rect.rowStart) && this.contains(rect.columnEnd, rect.rowEnd);
52
+ }
53
+ intersectsRect(rect) {
54
+ return this.columnStart <= rect.columnEnd && this.columnEnd >= rect.columnStart && this.rowStart <= rect.rowEnd && this.rowEnd >= rect.rowStart;
55
+ }
56
+ }
57
+ exports.GridRect = GridRect;
58
+ function getComputedCSS(element, property) {
59
+ return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property);
60
+ }
61
+
62
+ /**
63
+ * Given a grid-template-columns or grid-template-rows CSS property value, gets the start and end
64
+ * position in pixels of each grid track.
65
+ *
66
+ * https://css-tricks.com/snippets/css/complete-guide-grid/#aa-grid-track
67
+ *
68
+ * @param {string} template The grid-template-columns or grid-template-rows CSS property value.
69
+ * Only supports fixed sizes in pixels.
70
+ * @param {number} gap The gap between grid tracks in pixels.
71
+ *
72
+ * @return {Array<{start: number, end: number}>} An array of objects with the start and end
73
+ * position in pixels of each grid track.
74
+ */
75
+ function getGridTracks(template, gap) {
76
+ const tracks = [];
77
+ for (const size of template.split(' ')) {
78
+ const previousTrack = tracks[tracks.length - 1];
79
+ const start = previousTrack ? previousTrack.end + gap : 0;
80
+ const end = start + parseFloat(size);
81
+ tracks.push({
82
+ start,
83
+ end
84
+ });
85
+ }
86
+ return tracks;
87
+ }
88
+
89
+ /**
90
+ * Given an array of grid tracks and a position in pixels, gets the index of the closest track to
91
+ * that position.
92
+ *
93
+ * https://css-tricks.com/snippets/css/complete-guide-grid/#aa-grid-track
94
+ *
95
+ * @param {Array<{start: number, end: number}>} tracks An array of objects with the start and end
96
+ * position in pixels of each grid track.
97
+ * @param {number} position The position in pixels.
98
+ * @param {string} edge The edge of the track to compare the
99
+ * position to. Either 'start' or 'end'.
100
+ *
101
+ * @return {number} The index of the closest track to the position. 0-based, unlike CSS grid which
102
+ * is 1-based.
103
+ */
104
+ function getClosestTrack(tracks, position, edge = 'start') {
105
+ return tracks.reduce((closest, track, index) => Math.abs(track[edge] - position) < Math.abs(tracks[closest][edge] - position) ? index : closest, 0);
106
+ }
107
+ function getGridRect(gridElement, rect) {
108
+ const columnGap = parseFloat(getComputedCSS(gridElement, 'column-gap'));
109
+ const rowGap = parseFloat(getComputedCSS(gridElement, 'row-gap'));
110
+ const gridColumnTracks = getGridTracks(getComputedCSS(gridElement, 'grid-template-columns'), columnGap);
111
+ const gridRowTracks = getGridTracks(getComputedCSS(gridElement, 'grid-template-rows'), rowGap);
112
+ const columnStart = getClosestTrack(gridColumnTracks, rect.left) + 1;
113
+ const rowStart = getClosestTrack(gridRowTracks, rect.top) + 1;
114
+ const columnEnd = getClosestTrack(gridColumnTracks, rect.right, 'end') + 1;
115
+ const rowEnd = getClosestTrack(gridRowTracks, rect.bottom, 'end') + 1;
116
+ return new GridRect({
117
+ columnStart,
118
+ columnEnd,
119
+ rowStart,
120
+ rowEnd
121
+ });
122
+ }
123
+ function getGridItemRect(gridItemElement) {
124
+ return getGridRect(gridItemElement.parentElement, new window.DOMRect(gridItemElement.offsetLeft, gridItemElement.offsetTop, gridItemElement.offsetWidth, gridItemElement.offsetHeight));
125
+ }
126
+ function getGridInfo(gridElement) {
127
+ const gridTemplateColumns = getComputedCSS(gridElement, 'grid-template-columns');
128
+ const gridTemplateRows = getComputedCSS(gridElement, 'grid-template-rows');
129
+ const numColumns = gridTemplateColumns.split(' ').length;
130
+ const numRows = gridTemplateRows.split(' ').length;
131
+ const numItems = numColumns * numRows;
132
+ return {
133
+ numColumns,
134
+ numRows,
135
+ numItems,
136
+ currentColor: getComputedCSS(gridElement, 'color'),
137
+ style: {
138
+ gridTemplateColumns,
139
+ gridTemplateRows,
140
+ gap: getComputedCSS(gridElement, 'gap'),
141
+ padding: getComputedCSS(gridElement, 'padding')
142
+ }
143
+ };
144
+ }
145
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["range","start","length","Array","from","_","i","GridRect","constructor","columnStart","rowStart","columnEnd","rowEnd","columnSpan","rowSpan","undefined","contains","column","row","containsRect","rect","intersectsRect","exports","getComputedCSS","element","property","ownerDocument","defaultView","getComputedStyle","getPropertyValue","getGridTracks","template","gap","tracks","size","split","previousTrack","end","parseFloat","push","getClosestTrack","position","edge","reduce","closest","track","index","Math","abs","getGridRect","gridElement","columnGap","rowGap","gridColumnTracks","gridRowTracks","left","top","right","bottom","getGridItemRect","gridItemElement","parentElement","window","DOMRect","offsetLeft","offsetTop","offsetWidth","offsetHeight","getGridInfo","gridTemplateColumns","gridTemplateRows","numColumns","numRows","numItems","currentColor","style","padding"],"sources":["@wordpress/block-editor/src/components/grid/utils.js"],"sourcesContent":["export function range( start, length ) {\n\treturn Array.from( { length }, ( _, i ) => start + i );\n}\n\nexport class GridRect {\n\tconstructor( {\n\t\tcolumnStart,\n\t\trowStart,\n\t\tcolumnEnd,\n\t\trowEnd,\n\t\tcolumnSpan,\n\t\trowSpan,\n\t} = {} ) {\n\t\tthis.columnStart = columnStart ?? 1;\n\t\tthis.rowStart = rowStart ?? 1;\n\t\tif ( columnSpan !== undefined ) {\n\t\t\tthis.columnEnd = this.columnStart + columnSpan - 1;\n\t\t} else {\n\t\t\tthis.columnEnd = columnEnd ?? this.columnStart;\n\t\t}\n\t\tif ( rowSpan !== undefined ) {\n\t\t\tthis.rowEnd = this.rowStart + rowSpan - 1;\n\t\t} else {\n\t\t\tthis.rowEnd = rowEnd ?? this.rowStart;\n\t\t}\n\t}\n\n\tget columnSpan() {\n\t\treturn this.columnEnd - this.columnStart + 1;\n\t}\n\n\tget rowSpan() {\n\t\treturn this.rowEnd - this.rowStart + 1;\n\t}\n\n\tcontains( column, row ) {\n\t\treturn (\n\t\t\tcolumn >= this.columnStart &&\n\t\t\tcolumn <= this.columnEnd &&\n\t\t\trow >= this.rowStart &&\n\t\t\trow <= this.rowEnd\n\t\t);\n\t}\n\n\tcontainsRect( rect ) {\n\t\treturn (\n\t\t\tthis.contains( rect.columnStart, rect.rowStart ) &&\n\t\t\tthis.contains( rect.columnEnd, rect.rowEnd )\n\t\t);\n\t}\n\n\tintersectsRect( rect ) {\n\t\treturn (\n\t\t\tthis.columnStart <= rect.columnEnd &&\n\t\t\tthis.columnEnd >= rect.columnStart &&\n\t\t\tthis.rowStart <= rect.rowEnd &&\n\t\t\tthis.rowEnd >= rect.rowStart\n\t\t);\n\t}\n}\n\nexport function getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n\n/**\n * Given a grid-template-columns or grid-template-rows CSS property value, gets the start and end\n * position in pixels of each grid track.\n *\n * https://css-tricks.com/snippets/css/complete-guide-grid/#aa-grid-track\n *\n * @param {string} template The grid-template-columns or grid-template-rows CSS property value.\n * Only supports fixed sizes in pixels.\n * @param {number} gap The gap between grid tracks in pixels.\n *\n * @return {Array<{start: number, end: number}>} An array of objects with the start and end\n * position in pixels of each grid track.\n */\nexport function getGridTracks( template, gap ) {\n\tconst tracks = [];\n\tfor ( const size of template.split( ' ' ) ) {\n\t\tconst previousTrack = tracks[ tracks.length - 1 ];\n\t\tconst start = previousTrack ? previousTrack.end + gap : 0;\n\t\tconst end = start + parseFloat( size );\n\t\ttracks.push( { start, end } );\n\t}\n\treturn tracks;\n}\n\n/**\n * Given an array of grid tracks and a position in pixels, gets the index of the closest track to\n * that position.\n *\n * https://css-tricks.com/snippets/css/complete-guide-grid/#aa-grid-track\n *\n * @param {Array<{start: number, end: number}>} tracks An array of objects with the start and end\n * position in pixels of each grid track.\n * @param {number} position The position in pixels.\n * @param {string} edge The edge of the track to compare the\n * position to. Either 'start' or 'end'.\n *\n * @return {number} The index of the closest track to the position. 0-based, unlike CSS grid which\n * is 1-based.\n */\nexport function getClosestTrack( tracks, position, edge = 'start' ) {\n\treturn tracks.reduce(\n\t\t( closest, track, index ) =>\n\t\t\tMath.abs( track[ edge ] - position ) <\n\t\t\tMath.abs( tracks[ closest ][ edge ] - position )\n\t\t\t\t? index\n\t\t\t\t: closest,\n\t\t0\n\t);\n}\n\nexport function getGridRect( gridElement, rect ) {\n\tconst columnGap = parseFloat( getComputedCSS( gridElement, 'column-gap' ) );\n\tconst rowGap = parseFloat( getComputedCSS( gridElement, 'row-gap' ) );\n\tconst gridColumnTracks = getGridTracks(\n\t\tgetComputedCSS( gridElement, 'grid-template-columns' ),\n\t\tcolumnGap\n\t);\n\tconst gridRowTracks = getGridTracks(\n\t\tgetComputedCSS( gridElement, 'grid-template-rows' ),\n\t\trowGap\n\t);\n\tconst columnStart = getClosestTrack( gridColumnTracks, rect.left ) + 1;\n\tconst rowStart = getClosestTrack( gridRowTracks, rect.top ) + 1;\n\tconst columnEnd =\n\t\tgetClosestTrack( gridColumnTracks, rect.right, 'end' ) + 1;\n\tconst rowEnd = getClosestTrack( gridRowTracks, rect.bottom, 'end' ) + 1;\n\treturn new GridRect( {\n\t\tcolumnStart,\n\t\tcolumnEnd,\n\t\trowStart,\n\t\trowEnd,\n\t} );\n}\n\nexport function getGridItemRect( gridItemElement ) {\n\treturn getGridRect(\n\t\tgridItemElement.parentElement,\n\t\tnew window.DOMRect(\n\t\t\tgridItemElement.offsetLeft,\n\t\t\tgridItemElement.offsetTop,\n\t\t\tgridItemElement.offsetWidth,\n\t\t\tgridItemElement.offsetHeight\n\t\t)\n\t);\n}\n\nexport function getGridInfo( gridElement ) {\n\tconst gridTemplateColumns = getComputedCSS(\n\t\tgridElement,\n\t\t'grid-template-columns'\n\t);\n\tconst gridTemplateRows = getComputedCSS(\n\t\tgridElement,\n\t\t'grid-template-rows'\n\t);\n\tconst numColumns = gridTemplateColumns.split( ' ' ).length;\n\tconst numRows = gridTemplateRows.split( ' ' ).length;\n\tconst numItems = numColumns * numRows;\n\treturn {\n\t\tnumColumns,\n\t\tnumRows,\n\t\tnumItems,\n\t\tcurrentColor: getComputedCSS( gridElement, 'color' ),\n\t\tstyle: {\n\t\t\tgridTemplateColumns,\n\t\t\tgridTemplateRows,\n\t\t\tgap: getComputedCSS( gridElement, 'gap' ),\n\t\t\tpadding: getComputedCSS( gridElement, 'padding' ),\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;AAAO,SAASA,KAAKA,CAAEC,KAAK,EAAEC,MAAM,EAAG;EACtC,OAAOC,KAAK,CAACC,IAAI,CAAE;IAAEF;EAAO,CAAC,EAAE,CAAEG,CAAC,EAAEC,CAAC,KAAML,KAAK,GAAGK,CAAE,CAAC;AACvD;AAEO,MAAMC,QAAQ,CAAC;EACrBC,WA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E,WAAW;IACXE,SAAS;IACTD,QAAQ;IACRE;EACD,CAAE,CAAC;AACJ;AAEO,SAAS+C,eAAeA,CAAEC,eAAe,EAAG;EAClD,OAAOX,WAAW,CACjBW,eAAe,CAACC,aAAa,EAC7B,IAAIC,MAAM,CAACC,OAAO,CACjBH,eAAe,CAACI,UAAU,EAC1BJ,eAAe,CAACK,SAAS,EACzBL,eAAe,CAACM,WAAW,EAC3BN,eAAe,CAACO,YACjB,CACD,CAAC;AACF;AAEO,SAASC,WAAWA,CAAElB,WAAW,EAAG;EAC1C,MAAMmB,mBAAmB,GAAG9C,cAAc,CACzC2B,WAAW,EACX,uBACD,CAAC;EACD,MAAMoB,gBAAgB,GAAG/C,cAAc,CACtC2B,WAAW,EACX,oBACD,CAAC;EACD,MAAMqB,UAAU,GAAGF,mBAAmB,CAAClC,KAAK,CAAE,GAAI,CAAC,CAACjC,MAAM;EAC1D,MAAMsE,OAAO,GAAGF,gBAAgB,CAACnC,KAAK,CAAE,GAAI,CAAC,CAACjC,MAAM;EACpD,MAAMuE,QAAQ,GAAGF,UAAU,GAAGC,OAAO;EACrC,OAAO;IACND,UAAU;IACVC,OAAO;IACPC,QAAQ;IACRC,YAAY,EAAEnD,cAAc,CAAE2B,WAAW,EAAE,OAAQ,CAAC;IACpDyB,KAAK,EAAE;MACNN,mBAAmB;MACnBC,gBAAgB;MAChBtC,GAAG,EAAET,cAAc,CAAE2B,WAAW,EAAE,KAAM,CAAC;MACzC0B,OAAO,EAAErD,cAAc,CAAE2B,WAAW,EAAE,SAAU;IACjD;EACD,CAAC;AACF","ignoreList":[]}
@@ -78,7 +78,6 @@ function AspectRatioDropdown({
78
78
  label: (0, _i18n.__)('Aspect Ratio'),
79
79
  popoverProps: _constants.POPOVER_PROPS,
80
80
  toggleProps: toggleProps,
81
- className: "wp-block-image__aspect-ratio",
82
81
  children: ({
83
82
  onClose
84
83
  }) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
@@ -1 +1 @@
1
- {"version":3,"names":["_icons","require","_components","_i18n","_useSettings","_constants","_context","_jsxRuntime","AspectRatioGroup","aspectRatios","isDisabled","label","onClick","value","jsx","MenuGroup","children","map","name","slug","ratio","MenuItem","disabled","role","isSelected","icon","check","undefined","ratioToNumber","str","a","b","rest","split","Number","isNaN","length","NaN","presetRatioAsNumber","AspectRatioDropdown","toggleProps","isInProgress","aspect","setAspect","defaultAspect","useImageEditingContext","defaultRatios","themeRatios","showDefaultRatios","useSettings","DropdownMenu","aspectRatioIcon","__","popoverProps","POPOVER_PROPS","className","onClose","jsxs","Fragment","newAspect","filter"],"sources":["@wordpress/block-editor/src/components/image-editor/aspect-ratio-dropdown.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { check, aspectRatio as aspectRatioIcon } from '@wordpress/icons';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\nimport { POPOVER_PROPS } from './constants';\nimport { useImageEditingContext } from './context';\n\nfunction AspectRatioGroup( {\n\taspectRatios,\n\tisDisabled,\n\tlabel,\n\tonClick,\n\tvalue,\n} ) {\n\treturn (\n\t\t<MenuGroup label={ label }>\n\t\t\t{ aspectRatios.map( ( { name, slug, ratio } ) => (\n\t\t\t\t<MenuItem\n\t\t\t\t\tkey={ slug }\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonClick( ratio );\n\t\t\t\t\t} }\n\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\tisSelected={ ratio === value }\n\t\t\t\t\ticon={ ratio === value ? check : undefined }\n\t\t\t\t>\n\t\t\t\t\t{ name }\n\t\t\t\t</MenuItem>\n\t\t\t) ) }\n\t\t</MenuGroup>\n\t);\n}\n\nexport function ratioToNumber( str ) {\n\t// TODO: support two-value aspect ratio?\n\t// https://css-tricks.com/almanac/properties/a/aspect-ratio/#aa-it-can-take-two-values\n\tconst [ a, b, ...rest ] = str.split( '/' ).map( Number );\n\tif (\n\t\ta <= 0 ||\n\t\tb <= 0 ||\n\t\tNumber.isNaN( a ) ||\n\t\tNumber.isNaN( b ) ||\n\t\trest.length\n\t) {\n\t\treturn NaN;\n\t}\n\treturn b ? a / b : a;\n}\n\nfunction presetRatioAsNumber( { ratio, ...rest } ) {\n\treturn {\n\t\tratio: ratioToNumber( ratio ),\n\t\t...rest,\n\t};\n}\n\nexport default function AspectRatioDropdown( { toggleProps } ) {\n\tconst { isInProgress, aspect, setAspect, defaultAspect } =\n\t\tuseImageEditingContext();\n\n\tconst [ defaultRatios, themeRatios, showDefaultRatios ] = useSettings(\n\t\t'dimensions.aspectRatios.default',\n\t\t'dimensions.aspectRatios.theme',\n\t\t'dimensions.defaultAspectRatios'\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ aspectRatioIcon }\n\t\t\tlabel={ __( 'Aspect Ratio' ) }\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tclassName=\"wp-block-image__aspect-ratio\"\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\taspectRatios={ [\n\t\t\t\t\t\t\t// All ratios should be mirrored in AspectRatioTool in @wordpress/block-editor.\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tslug: 'original',\n\t\t\t\t\t\t\t\tname: __( 'Original' ),\n\t\t\t\t\t\t\t\taspect: defaultAspect,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...( showDefaultRatios\n\t\t\t\t\t\t\t\t? defaultRatios\n\t\t\t\t\t\t\t\t\t\t.map( presetRatioAsNumber )\n\t\t\t\t\t\t\t\t\t\t.filter( ( { ratio } ) => ratio === 1 )\n\t\t\t\t\t\t\t\t: [] ),\n\t\t\t\t\t\t] }\n\t\t\t\t\t/>\n\t\t\t\t\t{ themeRatios?.length > 0 && (\n\t\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Theme' ) }\n\t\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\t\taspectRatios={ themeRatios }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showDefaultRatios && (\n\t\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Landscape' ) }\n\t\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\t\taspectRatios={ defaultRatios\n\t\t\t\t\t\t\t\t.map( presetRatioAsNumber )\n\t\t\t\t\t\t\t\t.filter( ( { ratio } ) => ratio > 1 ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showDefaultRatios && (\n\t\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Portrait' ) }\n\t\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t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CAAC,KAAMA,KAAK,GAAG,CAAE;MAAG,CACxC,CACD,EACC4B,iBAAiB,iBAClB,IAAAzC,WAAA,CAAAO,GAAA,EAACN,gBAAgB;QAChBG,KAAK,EAAG,IAAAyC,QAAE,EAAE,UAAW,CAAG;QAC1B1C,UAAU,EAAG+B,YAAc;QAC3B7B,OAAO,EAAK+C,SAAS,IAAM;UAC1BhB,SAAS,CAAEgB,SAAU,CAAC;UACtBH,OAAO,CAAC,CAAC;QACV,CAAG;QACH3C,KAAK,EAAG6B,MAAQ;QAChBjC,YAAY,EAAGqC,aAAa,CAC1B7B,GAAG,CAAEqB,mBAAoB,CAAC,CAC1BsB,MAAM,CAAE,CAAE;UAAExC;QAAM,CAAC,KAAMA,KAAK,GAAG,CAAE;MAAG,CACxC,CACD;IAAA,CACA;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["_icons","require","_components","_i18n","_useSettings","_constants","_context","_jsxRuntime","AspectRatioGroup","aspectRatios","isDisabled","label","onClick","value","jsx","MenuGroup","children","map","name","slug","ratio","MenuItem","disabled","role","isSelected","icon","check","undefined","ratioToNumber","str","a","b","rest","split","Number","isNaN","length","NaN","presetRatioAsNumber","AspectRatioDropdown","toggleProps","isInProgress","aspect","setAspect","defaultAspect","useImageEditingContext","defaultRatios","themeRatios","showDefaultRatios","useSettings","DropdownMenu","aspectRatioIcon","__","popoverProps","POPOVER_PROPS","onClose","jsxs","Fragment","newAspect","filter"],"sources":["@wordpress/block-editor/src/components/image-editor/aspect-ratio-dropdown.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { check, aspectRatio as aspectRatioIcon } from '@wordpress/icons';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\nimport { POPOVER_PROPS } from './constants';\nimport { useImageEditingContext } from './context';\n\nfunction AspectRatioGroup( {\n\taspectRatios,\n\tisDisabled,\n\tlabel,\n\tonClick,\n\tvalue,\n} ) {\n\treturn (\n\t\t<MenuGroup label={ label }>\n\t\t\t{ aspectRatios.map( ( { name, slug, ratio } ) => (\n\t\t\t\t<MenuItem\n\t\t\t\t\tkey={ slug }\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonClick( ratio );\n\t\t\t\t\t} }\n\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\tisSelected={ ratio === value }\n\t\t\t\t\ticon={ ratio === value ? check : undefined }\n\t\t\t\t>\n\t\t\t\t\t{ name }\n\t\t\t\t</MenuItem>\n\t\t\t) ) }\n\t\t</MenuGroup>\n\t);\n}\n\nexport function ratioToNumber( str ) {\n\t// TODO: support two-value aspect ratio?\n\t// https://css-tricks.com/almanac/properties/a/aspect-ratio/#aa-it-can-take-two-values\n\tconst [ a, b, ...rest ] = str.split( '/' ).map( Number );\n\tif (\n\t\ta <= 0 ||\n\t\tb <= 0 ||\n\t\tNumber.isNaN( a ) ||\n\t\tNumber.isNaN( b ) ||\n\t\trest.length\n\t) {\n\t\treturn NaN;\n\t}\n\treturn b ? a / b : a;\n}\n\nfunction presetRatioAsNumber( { ratio, ...rest } ) {\n\treturn {\n\t\tratio: ratioToNumber( ratio ),\n\t\t...rest,\n\t};\n}\n\nexport default function AspectRatioDropdown( { toggleProps } ) {\n\tconst { isInProgress, aspect, setAspect, defaultAspect } =\n\t\tuseImageEditingContext();\n\n\tconst [ defaultRatios, themeRatios, showDefaultRatios ] = useSettings(\n\t\t'dimensions.aspectRatios.default',\n\t\t'dimensions.aspectRatios.theme',\n\t\t'dimensions.defaultAspectRatios'\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ aspectRatioIcon }\n\t\t\tlabel={ __( 'Aspect Ratio' ) }\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\ttoggleProps={ toggleProps }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\taspectRatios={ [\n\t\t\t\t\t\t\t// All ratios should be mirrored in AspectRatioTool in @wordpress/block-editor.\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tslug: 'original',\n\t\t\t\t\t\t\t\tname: __( 'Original' ),\n\t\t\t\t\t\t\t\taspect: defaultAspect,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...( showDefaultRatios\n\t\t\t\t\t\t\t\t? defaultRatios\n\t\t\t\t\t\t\t\t\t\t.map( presetRatioAsNumber )\n\t\t\t\t\t\t\t\t\t\t.filter( ( { ratio } ) => ratio === 1 )\n\t\t\t\t\t\t\t\t: [] ),\n\t\t\t\t\t\t] }\n\t\t\t\t\t/>\n\t\t\t\t\t{ themeRatios?.length > 0 && (\n\t\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Theme' ) }\n\t\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\t\taspectRatios={ themeRatios }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showDefaultRatios && (\n\t\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Landscape' ) }\n\t\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\t\taspectRatios={ defaultRatios\n\t\t\t\t\t\t\t\t.map( presetRatioAsNumber )\n\t\t\t\t\t\t\t\t.filter( ( { ratio } ) => ratio > 1 ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showDefaultRatios && (\n\t\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Portrait' ) }\n\t\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\t\taspectRatios={ defaultRatios\n\t\t\t\t\t\t\t\t.map( presetRatioAsNumber )\n\t\t\t\t\t\t\t\t.filter( ( { ratio } ) => ratio < 1 ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAAmD,IAAAM,WAAA,GAAAN,OAAA;AAZnD;AACA;AACA;;AAKA;AACA;AACA;;AAKA,SAASO,gBAAgBA,CAAE;EAC1BC,YAAY;EACZC,UAAU;EACVC,KAAK;EACLC,OAAO;EACPC;AACD,CAAC,EAAG;EACH,oBACC,IAAAN,WAAA,CAAAO,GAAA,EAACZ,WAAA,CAAAa,SAAS;IAACJ,KAAK,EAAGA,KAAO;IAAAK,QAAA,EACvBP,YAAY,CAACQ,GAAG,CAAE,CAA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1C,KAAK,EAAG6B,MAAQ;QAChBjC,YAAY,EAAGsC;MAAa,CAC5B,CACD,EACCC,iBAAiB,iBAClB,IAAAzC,WAAA,CAAAO,GAAA,EAACN,gBAAgB;QAChBG,KAAK,EAAG,IAAAyC,QAAE,EAAE,WAAY,CAAG;QAC3B1C,UAAU,EAAG+B,YAAc;QAC3B7B,OAAO,EAAK8C,SAAS,IAAM;UAC1Bf,SAAS,CAAEe,SAAU,CAAC;UACtBH,OAAO,CAAC,CAAC;QACV,CAAG;QACH1C,KAAK,EAAG6B,MAAQ;QAChBjC,YAAY,EAAGqC,aAAa,CAC1B7B,GAAG,CAAEqB,mBAAoB,CAAC,CAC1BqB,MAAM,CAAE,CAAE;UAAEvC;QAAM,CAAC,KAAMA,KAAK,GAAG,CAAE;MAAG,CACxC,CACD,EACC4B,iBAAiB,iBAClB,IAAAzC,WAAA,CAAAO,GAAA,EAACN,gBAAgB;QAChBG,KAAK,EAAG,IAAAyC,QAAE,EAAE,UAAW,CAAG;QAC1B1C,UAAU,EAAG+B,YAAc;QAC3B7B,OAAO,EAAK8C,SAAS,IAAM;UAC1Bf,SAAS,CAAEe,SAAU,CAAC;UACtBH,OAAO,CAAC,CAAC;QACV,CAAG;QACH1C,KAAK,EAAG6B,MAAQ;QAChBjC,YAAY,EAAGqC,aAAa,CAC1B7B,GAAG,CAAEqB,mBAAoB,CAAC,CAC1BqB,MAAM,CAAE,CAAE;UAAEvC;QAAM,CAAC,KAAMA,KAAK,GAAG,CAAE;MAAG,CACxC,CACD;IAAA,CACA;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
@@ -235,7 +235,7 @@ function useInnerBlocksProps(props = {}, options = {}) {
235
235
  rootClientId: clientId,
236
236
  parentClientId
237
237
  });
238
- const ref = (0, _compose.useMergeRefs)([props.ref, __unstableDisableDropZone || isDropZoneDisabled ? null : blockDropZoneRef]);
238
+ const ref = (0, _compose.useMergeRefs)([props.ref, __unstableDisableDropZone || isDropZoneDisabled || layout?.columnCount && window.__experimentalEnableGridInteractivity ? null : blockDropZoneRef]);
239
239
  const innerBlocksProps = {
240
240
  __experimentalCaptureToolbars,
241
241
  layout,
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_element","_data","_blocks","_buttonBlockAppender","_defaultBlockAppender","_useNestedSettingsUpdate","_useInnerBlockTemplateSync","_useBlockContext","_blockList","_blockContext","_context","_useBlockSync","_store","_useBlockDropZone","_lockUnlock","_jsxRuntime","EMPTY_OBJECT","BlockContext","children","clientId","context","useBlockContext","jsx","BlockContextProvider","value","BlockListItemsMemo","memo","BlockListItems","UncontrolledInnerBlocks","props","allowedBlocks","prioritizedInserterBlocks","defaultBlock","directInsert","__experimentalDefaultBlock","__experimentalDirectInsert","template","templateLock","wrapperRef","templateInsertUpdatesSelection","__experimentalCaptureToolbars","captureToolbars","__experimentalAppenderTagName","renderAppender","orientation","placeholder","layout","name","blockType","parentLock","defaultLayout","useNestedSettingsUpdate","useInnerBlockTemplateSync","defaultLayoutBlockSupport","getBlockSupport","allowSizingOnChildren","usedLayout","memoedLayout","useMemo","items","rootClientId","Object","keys","providesContext","length","ControlledInnerBlocks","useBlockSync","ForwardedInnerBlocks","forwardRef","ref","innerBlocksProps","useInnerBlocksProps","className","options","__unstableDisableLayoutClassNames","__unstableDisableDropZone","dropZoneElement","__unstableLayoutClassNames","layoutClassNames","useBlockEditContext","selected","useSelect","select","getBlockName","isBlockSelected","hasSelectedInnerBlock","__unstableGetEditorMode","getTemplateLock","getBlockRootClientId","getBlockEditingMode","getBlockSettings","isDragging","getSettings","unlock","blockEditorStore","_isDropZoneDisabled","sectionRootClientId","isDropZoneDisabled","hasBlockSupport","getBlockType","blocksStore","blockName","enableClickThrough","blockEditingMode","parentClientId","undefined","hasOverlay","blockDropZoneRef","useBlockDropZone","useMergeRefs","InnerBlocks","onChange","clsx","save","getInnerBlocksProps","DefaultBlockAppender","ButtonBlockAppender","Content","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/inner-blocks/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useMemo, memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tgetBlockSupport,\n\tstore as blocksStore,\n\t__unstableGetInnerBlocksProps as getInnerBlocksProps,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ButtonBlockAppender from './button-block-appender';\nimport DefaultBlockAppender from './default-block-appender';\nimport useNestedSettingsUpdate from './use-nested-settings-update';\nimport useInnerBlockTemplateSync from './use-inner-block-template-sync';\nimport useBlockContext from './use-block-context';\nimport { BlockListItems } from '../block-list';\nimport { BlockContextProvider } from '../block-context';\nimport { useBlockEditContext } from '../block-edit/context';\nimport useBlockSync from '../provider/use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDropZone from '../use-block-drop-zone';\nimport { unlock } from '../../lock-unlock';\n\nconst EMPTY_OBJECT = {};\n\nfunction BlockContext( { children, clientId } ) {\n\tconst context = useBlockContext( clientId );\n\treturn (\n\t\t<BlockContextProvider value={ context }>\n\t\t\t{ children }\n\t\t</BlockContextProvider>\n\t);\n}\n\nconst BlockListItemsMemo = memo( BlockListItems );\n\n/**\n * InnerBlocks is a component which allows a single block to have multiple blocks\n * as children. The UncontrolledInnerBlocks component is used whenever the inner\n * blocks are not controlled by another entity. In other words, it is normally\n * used for inner blocks in the post editor\n *\n * @param {Object} props The component props.\n */\nfunction UncontrolledInnerBlocks( props ) {\n\tconst {\n\t\tclientId,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\twrapperRef,\n\t\ttemplateInsertUpdatesSelection,\n\t\t__experimentalCaptureToolbars: captureToolbars,\n\t\t__experimentalAppenderTagName,\n\t\trenderAppender,\n\t\torientation,\n\t\tplaceholder,\n\t\tlayout,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tdefaultLayout,\n\t} = props;\n\n\tuseNestedSettingsUpdate(\n\t\tclientId,\n\t\tparentLock,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplateLock,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tlayout\n\t);\n\n\tuseInnerBlockTemplateSync(\n\t\tclientId,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection\n\t);\n\n\tconst defaultLayoutBlockSupport =\n\t\tgetBlockSupport( name, 'layout' ) ||\n\t\tgetBlockSupport( name, '__experimentalLayout' ) ||\n\t\tEMPTY_OBJECT;\n\n\tconst { allowSizingOnChildren = false } = defaultLayoutBlockSupport;\n\tconst usedLayout = layout || defaultLayoutBlockSupport;\n\n\tconst memoedLayout = useMemo(\n\t\t() => ( {\n\t\t\t// Default layout will know about any content/wide size defined by the theme.\n\t\t\t...defaultLayout,\n\t\t\t...usedLayout,\n\t\t\t...( allowSizingOnChildren && {\n\t\t\t\tallowSizingOnChildren: true,\n\t\t\t} ),\n\t\t} ),\n\t\t[ defaultLayout, usedLayout, allowSizingOnChildren ]\n\t);\n\n\t// For controlled inner blocks, we don't want a change in blocks to\n\t// re-render the blocks list.\n\tconst items = (\n\t\t<BlockListItemsMemo\n\t\t\trootClientId={ clientId }\n\t\t\trenderAppender={ renderAppender }\n\t\t\t__experimentalAppenderTagName={ __experimentalAppenderTagName }\n\t\t\tlayout={ memoedLayout }\n\t\t\twrapperRef={ wrapperRef }\n\t\t\tplaceholder={ placeholder }\n\t\t/>\n\t);\n\n\tif ( Object.keys( blockType.providesContext ).length === 0 ) {\n\t\treturn items;\n\t}\n\n\treturn <BlockContext clientId={ clientId }>{ items }</BlockContext>;\n}\n\n/**\n * The controlled inner blocks component wraps the uncontrolled inner blocks\n * component with the blockSync hook. This keeps the innerBlocks of the block in\n * the block-editor store in sync with the blocks of the controlling entity. An\n * example of an inner block controller is a template part block, which provides\n * its own blocks from the template part entity data source.\n *\n * @param {Object} props The component props.\n */\nfunction ControlledInnerBlocks( props ) {\n\tuseBlockSync( props );\n\treturn <UncontrolledInnerBlocks { ...props } />;\n}\n\nconst ForwardedInnerBlocks = forwardRef( ( props, ref ) => {\n\tconst innerBlocksProps = useInnerBlocksProps( { ref }, props );\n\treturn (\n\t\t<div className=\"block-editor-inner-blocks\">\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</div>\n\t);\n} );\n\n/**\n * This hook is used to lightly mark an element as an inner blocks wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * an inner blocks wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Optional. Inner blocks options.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport function useInnerBlocksProps( props = {}, options = {} ) {\n\tconst {\n\t\t__unstableDisableLayoutClassNames,\n\t\t__unstableDisableDropZone,\n\t\tdropZoneElement,\n\t} = options;\n\tconst {\n\t\tclientId,\n\t\tlayout = null,\n\t\t__unstableLayoutClassNames: layoutClassNames = '',\n\t} = useBlockEditContext();\n\tconst selected = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tisBlockSelected,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetBlockSettings,\n\t\t\t\tisDragging,\n\t\t\t\tgetSettings,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tlet _isDropZoneDisabled;\n\t\t\t// In zoom out mode, we want to disable the drop zone for the sections.\n\t\t\t// The inner blocks belonging to the section drop zone is\n\t\t\t// already disabled by the blocks themselves being disabled.\n\t\t\tif ( __unstableGetEditorMode() === 'zoom-out' ) {\n\t\t\t\tconst { sectionRootClientId } = unlock( getSettings() );\n\t\t\t\t_isDropZoneDisabled = clientId !== sectionRootClientId;\n\t\t\t}\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn { isDropZoneDisabled: _isDropZoneDisabled };\n\t\t\t}\n\n\t\t\tconst { hasBlockSupport, getBlockType } = select( blocksStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst enableClickThrough =\n\t\t\t\t__unstableGetEditorMode() === 'navigation';\n\t\t\tconst blockEditingMode = getBlockEditingMode( clientId );\n\t\t\tconst parentClientId = getBlockRootClientId( clientId );\n\t\t\tconst [ defaultLayout ] = getBlockSettings( clientId, 'layout' );\n\n\t\t\tif ( _isDropZoneDisabled !== undefined ) {\n\t\t\t\t_isDropZoneDisabled = blockEditingMode === 'disabled';\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t__experimentalCaptureToolbars: hasBlockSupport(\n\t\t\t\t\tblockName,\n\t\t\t\t\t'__experimentalExposeControlsToChildren',\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasOverlay:\n\t\t\t\t\tblockName !== 'core/template' &&\n\t\t\t\t\t! isBlockSelected( clientId ) &&\n\t\t\t\t\t! hasSelectedInnerBlock( clientId, true ) &&\n\t\t\t\t\tenableClickThrough &&\n\t\t\t\t\t! isDragging(),\n\t\t\t\tname: blockName,\n\t\t\t\tblockType: getBlockType( blockName ),\n\t\t\t\tparentLock: getTemplateLock( parentClientId ),\n\t\t\t\tparentClientId,\n\t\t\t\tisDropZoneDisabled: _isDropZoneDisabled,\n\t\t\t\tdefaultLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst {\n\t\t__experimentalCaptureToolbars,\n\t\thasOverlay,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tparentClientId,\n\t\tisDropZoneDisabled,\n\t\tdefaultLayout,\n\t} = selected;\n\n\tconst blockDropZoneRef = useBlockDropZone( {\n\t\tdropZoneElement,\n\t\trootClientId: clientId,\n\t\tparentClientId,\n\t} );\n\n\tconst ref = useMergeRefs( [\n\t\tprops.ref,\n\t\t__unstableDisableDropZone || isDropZoneDisabled\n\t\t\t? null\n\t\t\t: blockDropZoneRef,\n\t] );\n\n\tconst innerBlocksProps = {\n\t\t__experimentalCaptureToolbars,\n\t\tlayout,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tdefaultLayout,\n\t\t...options,\n\t};\n\tconst InnerBlocks =\n\t\tinnerBlocksProps.value && innerBlocksProps.onChange\n\t\t\t? ControlledInnerBlocks\n\t\t\t: UncontrolledInnerBlocks;\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: clsx(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-list__layout',\n\t\t\t__unstableDisableLayoutClassNames ? '' : layoutClassNames,\n\t\t\t{\n\t\t\t\t'has-overlay': hasOverlay,\n\t\t\t}\n\t\t),\n\t\tchildren: clientId ? (\n\t\t\t<InnerBlocks { ...innerBlocksProps } clientId={ clientId } />\n\t\t) : (\n\t\t\t<BlockListItems { ...options } />\n\t\t),\n\t};\n}\n\nuseInnerBlocksProps.save = getInnerBlocksProps;\n\n// Expose default appender placeholders as components.\nForwardedInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;\nForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;\n\nForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport default ForwardedInnerBlocks;\n"],"mappings":";;;;;;;;AAGA,IA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CAAC;IACDxF,QAAQ,EAAEC,QAAQ,gBACjB,IAAAJ,WAAA,CAAAO,GAAA,EAACwF,WAAW;MAAA,GAAMxC,gBAAgB;MAAGnD,QAAQ,EAAGA;IAAU,CAAE,CAAC,gBAE7D,IAAAJ,WAAA,CAAAO,GAAA,EAACd,UAAA,CAAAmB,cAAc;MAAA,GAAM8C;IAAO,CAAI;EAElC,CAAC;AACF;AAEAF,mBAAmB,CAAC0C,IAAI,GAAGC,qCAAmB;;AAE9C;AACA/C,oBAAoB,CAACgD,oBAAoB,GAAGA,6BAAoB;AAChEhD,oBAAoB,CAACiD,mBAAmB,GAAGA,4BAAmB;AAE9DjD,oBAAoB,CAACkD,OAAO,GAAG,MAAM9C,mBAAmB,CAAC0C,IAAI,CAAC,CAAC,CAAC/F,QAAQ;;AAExE;AACA;AACA;AAFA,IAAAoG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAGerD,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_element","_data","_blocks","_buttonBlockAppender","_defaultBlockAppender","_useNestedSettingsUpdate","_useInnerBlockTemplateSync","_useBlockContext","_blockList","_blockContext","_context","_useBlockSync","_store","_useBlockDropZone","_lockUnlock","_jsxRuntime","EMPTY_OBJECT","BlockContext","children","clientId","context","useBlockContext","jsx","BlockContextProvider","value","BlockListItemsMemo","memo","BlockListItems","UncontrolledInnerBlocks","props","allowedBlocks","prioritizedInserterBlocks","defaultBlock","directInsert","__experimentalDefaultBlock","__experimentalDirectInsert","template","templateLock","wrapperRef","templateInsertUpdatesSelection","__experimentalCaptureToolbars","captureToolbars","__experimentalAppenderTagName","renderAppender","orientation","placeholder","layout","name","blockType","parentLock","defaultLayout","useNestedSettingsUpdate","useInnerBlockTemplateSync","defaultLayoutBlockSupport","getBlockSupport","allowSizingOnChildren","usedLayout","memoedLayout","useMemo","items","rootClientId","Object","keys","providesContext","length","ControlledInnerBlocks","useBlockSync","ForwardedInnerBlocks","forwardRef","ref","innerBlocksProps","useInnerBlocksProps","className","options","__unstableDisableLayoutClassNames","__unstableDisableDropZone","dropZoneElement","__unstableLayoutClassNames","layoutClassNames","useBlockEditContext","selected","useSelect","select","getBlockName","isBlockSelected","hasSelectedInnerBlock","__unstableGetEditorMode","getTemplateLock","getBlockRootClientId","getBlockEditingMode","getBlockSettings","isDragging","getSettings","unlock","blockEditorStore","_isDropZoneDisabled","sectionRootClientId","isDropZoneDisabled","hasBlockSupport","getBlockType","blocksStore","blockName","enableClickThrough","blockEditingMode","parentClientId","undefined","hasOverlay","blockDropZoneRef","useBlockDropZone","useMergeRefs","columnCount","window","__experimentalEnableGridInteractivity","InnerBlocks","onChange","clsx","save","getInnerBlocksProps","DefaultBlockAppender","ButtonBlockAppender","Content","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/inner-blocks/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useMemo, memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tgetBlockSupport,\n\tstore as blocksStore,\n\t__unstableGetInnerBlocksProps as getInnerBlocksProps,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ButtonBlockAppender from './button-block-appender';\nimport DefaultBlockAppender from './default-block-appender';\nimport useNestedSettingsUpdate from './use-nested-settings-update';\nimport useInnerBlockTemplateSync from './use-inner-block-template-sync';\nimport useBlockContext from './use-block-context';\nimport { BlockListItems } from '../block-list';\nimport { BlockContextProvider } from '../block-context';\nimport { useBlockEditContext } from '../block-edit/context';\nimport useBlockSync from '../provider/use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDropZone from '../use-block-drop-zone';\nimport { unlock } from '../../lock-unlock';\n\nconst EMPTY_OBJECT = {};\n\nfunction BlockContext( { children, clientId } ) {\n\tconst context = useBlockContext( clientId );\n\treturn (\n\t\t<BlockContextProvider value={ context }>\n\t\t\t{ children }\n\t\t</BlockContextProvider>\n\t);\n}\n\nconst BlockListItemsMemo = memo( BlockListItems );\n\n/**\n * InnerBlocks is a component which allows a single block to have multiple blocks\n * as children. The UncontrolledInnerBlocks component is used whenever the inner\n * blocks are not controlled by another entity. In other words, it is normally\n * used for inner blocks in the post editor\n *\n * @param {Object} props The component props.\n */\nfunction UncontrolledInnerBlocks( props ) {\n\tconst {\n\t\tclientId,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\twrapperRef,\n\t\ttemplateInsertUpdatesSelection,\n\t\t__experimentalCaptureToolbars: captureToolbars,\n\t\t__experimentalAppenderTagName,\n\t\trenderAppender,\n\t\torientation,\n\t\tplaceholder,\n\t\tlayout,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tdefaultLayout,\n\t} = props;\n\n\tuseNestedSettingsUpdate(\n\t\tclientId,\n\t\tparentLock,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplateLock,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tlayout\n\t);\n\n\tuseInnerBlockTemplateSync(\n\t\tclientId,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection\n\t);\n\n\tconst defaultLayoutBlockSupport =\n\t\tgetBlockSupport( name, 'layout' ) ||\n\t\tgetBlockSupport( name, '__experimentalLayout' ) ||\n\t\tEMPTY_OBJECT;\n\n\tconst { allowSizingOnChildren = false } = defaultLayoutBlockSupport;\n\tconst usedLayout = layout || defaultLayoutBlockSupport;\n\n\tconst memoedLayout = useMemo(\n\t\t() => ( {\n\t\t\t// Default layout will know about any content/wide size defined by the theme.\n\t\t\t...defaultLayout,\n\t\t\t...usedLayout,\n\t\t\t...( allowSizingOnChildren && {\n\t\t\t\tallowSizingOnChildren: true,\n\t\t\t} ),\n\t\t} ),\n\t\t[ defaultLayout, usedLayout, allowSizingOnChildren ]\n\t);\n\n\t// For controlled inner blocks, we don't want a change in blocks to\n\t// re-render the blocks list.\n\tconst items = (\n\t\t<BlockListItemsMemo\n\t\t\trootClientId={ clientId }\n\t\t\trenderAppender={ renderAppender }\n\t\t\t__experimentalAppenderTagName={ __experimentalAppenderTagName }\n\t\t\tlayout={ memoedLayout }\n\t\t\twrapperRef={ wrapperRef }\n\t\t\tplaceholder={ placeholder }\n\t\t/>\n\t);\n\n\tif ( Object.keys( blockType.providesContext ).length === 0 ) {\n\t\treturn items;\n\t}\n\n\treturn <BlockContext clientId={ clientId }>{ items }</BlockContext>;\n}\n\n/**\n * The controlled inner blocks component wraps the uncontrolled inner blocks\n * component with the blockSync hook. This keeps the innerBlocks of the block in\n * the block-editor store in sync with the blocks of the controlling entity. An\n * example of an inner block controller is a template part block, which provides\n * its own blocks from the template part entity data source.\n *\n * @param {Object} props The component props.\n */\nfunction ControlledInnerBlocks( props ) {\n\tuseBlockSync( props );\n\treturn <UncontrolledInnerBlocks { ...props } />;\n}\n\nconst ForwardedInnerBlocks = forwardRef( ( props, ref ) => {\n\tconst innerBlocksProps = useInnerBlocksProps( { ref }, props );\n\treturn (\n\t\t<div className=\"block-editor-inner-blocks\">\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</div>\n\t);\n} );\n\n/**\n * This hook is used to lightly mark an element as an inner blocks wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * an inner blocks wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Optional. Inner blocks options.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport function useInnerBlocksProps( props = {}, options = {} ) {\n\tconst {\n\t\t__unstableDisableLayoutClassNames,\n\t\t__unstableDisableDropZone,\n\t\tdropZoneElement,\n\t} = options;\n\tconst {\n\t\tclientId,\n\t\tlayout = null,\n\t\t__unstableLayoutClassNames: layoutClassNames = '',\n\t} = useBlockEditContext();\n\tconst selected = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tisBlockSelected,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetBlockSettings,\n\t\t\t\tisDragging,\n\t\t\t\tgetSettings,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tlet _isDropZoneDisabled;\n\t\t\t// In zoom out mode, we want to disable the drop zone for the sections.\n\t\t\t// The inner blocks belonging to the section drop zone is\n\t\t\t// already disabled by the blocks themselves being disabled.\n\t\t\tif ( __unstableGetEditorMode() === 'zoom-out' ) {\n\t\t\t\tconst { sectionRootClientId } = unlock( getSettings() );\n\t\t\t\t_isDropZoneDisabled = clientId !== sectionRootClientId;\n\t\t\t}\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn { isDropZoneDisabled: _isDropZoneDisabled };\n\t\t\t}\n\n\t\t\tconst { hasBlockSupport, getBlockType } = select( blocksStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst enableClickThrough =\n\t\t\t\t__unstableGetEditorMode() === 'navigation';\n\t\t\tconst blockEditingMode = getBlockEditingMode( clientId );\n\t\t\tconst parentClientId = getBlockRootClientId( clientId );\n\t\t\tconst [ defaultLayout ] = getBlockSettings( clientId, 'layout' );\n\n\t\t\tif ( _isDropZoneDisabled !== undefined ) {\n\t\t\t\t_isDropZoneDisabled = blockEditingMode === 'disabled';\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t__experimentalCaptureToolbars: hasBlockSupport(\n\t\t\t\t\tblockName,\n\t\t\t\t\t'__experimentalExposeControlsToChildren',\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasOverlay:\n\t\t\t\t\tblockName !== 'core/template' &&\n\t\t\t\t\t! isBlockSelected( clientId ) &&\n\t\t\t\t\t! hasSelectedInnerBlock( clientId, true ) &&\n\t\t\t\t\tenableClickThrough &&\n\t\t\t\t\t! isDragging(),\n\t\t\t\tname: blockName,\n\t\t\t\tblockType: getBlockType( blockName ),\n\t\t\t\tparentLock: getTemplateLock( parentClientId ),\n\t\t\t\tparentClientId,\n\t\t\t\tisDropZoneDisabled: _isDropZoneDisabled,\n\t\t\t\tdefaultLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst {\n\t\t__experimentalCaptureToolbars,\n\t\thasOverlay,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tparentClientId,\n\t\tisDropZoneDisabled,\n\t\tdefaultLayout,\n\t} = selected;\n\n\tconst blockDropZoneRef = useBlockDropZone( {\n\t\tdropZoneElement,\n\t\trootClientId: clientId,\n\t\tparentClientId,\n\t} );\n\n\tconst ref = useMergeRefs( [\n\t\tprops.ref,\n\t\t__unstableDisableDropZone ||\n\t\tisDropZoneDisabled ||\n\t\t( layout?.columnCount && window.__experimentalEnableGridInteractivity )\n\t\t\t? null\n\t\t\t: blockDropZoneRef,\n\t] );\n\n\tconst innerBlocksProps = {\n\t\t__experimentalCaptureToolbars,\n\t\tlayout,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tdefaultLayout,\n\t\t...options,\n\t};\n\tconst InnerBlocks =\n\t\tinnerBlocksProps.value && innerBlocksProps.onChange\n\t\t\t? ControlledInnerBlocks\n\t\t\t: UncontrolledInnerBlocks;\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: clsx(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-list__layout',\n\t\t\t__unstableDisableLayoutClassNames ? '' : layoutClassNames,\n\t\t\t{\n\t\t\t\t'has-overlay': hasOverlay,\n\t\t\t}\n\t\t),\n\t\tchildren: clientId ? (\n\t\t\t<InnerBlocks { ...innerBlocksProps } clientId={ clientId } />\n\t\t) : (\n\t\t\t<BlockListItems { ...options } />\n\t\t),\n\t};\n}\n\nuseInnerBlocksProps.save = getInnerBlocksProps;\n\n// Expose default appender placeholders as components.\nForwardedInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;\nForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;\n\nForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport default ForwardedInnerBlocks;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AASA,IAAAK,oBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,qBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,wBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,0BAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,gBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AACA,IAAAY,QAAA,GAAAZ,OAAA;AACA,IAAAa,aAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,iBAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,WAAA,GAAAhB,OAAA;AAA2C,IAAAiB,W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perty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ exports.findSelection = findSelection;
7
8
  var _richText = require("@wordpress/rich-text");
8
9
  var _blocks = require("@wordpress/blocks");
9
10
  var _store = require("../../../store");
@@ -1 +1 @@
1
- {"version":3,"names":["_richText","require","_blocks","_store","_preventEventDiscovery","_selection","findSelection","blocks","i","length","attributeKey","retrieveSelectedAttribute","attributes","toString","replace","START_OF_SELECTED_AREA","clientId","nestedSelection","innerBlocks","_default","props","element","inputRule","getValue","onReplace","selectionChange","registry","current","value","start","text","characterBefore","slice","trimmedTextBefore","trim","prefixTransforms","getBlockTransforms","filter","type","transformation","findTransform","prefix","content","toHTMLString","insert","block","transform","dispatch","blockEditorStore","__unstableMarkAutomaticChange","onInput","event","inputType","onChange","__unstableAllowPrefixTransformations","formatTypes","transformed","reduce","accumlator","__unstableInputRule","preventEventDiscovery","__unstableMarkLastChangeAsPersistent","activeFormats","addEventListener","removeEventListener","exports","default"],"sources":["@wordpress/block-editor/src/components/rich-text/event-listeners/input-rules.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { insert, toHTMLString } from '@wordpress/rich-text';\nimport { getBlockTransforms, findTransform } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\nimport { preventEventDiscovery } from '../prevent-event-discovery';\nimport {\n\tretrieveSelectedAttribute,\n\tSTART_OF_SELECTED_AREA,\n} from '../../../utils/selection';\n\nfunction findSelection( blocks ) {\n\tlet i = blocks.length;\n\n\twhile ( i-- ) {\n\t\tconst attributeKey = retrieveSelectedAttribute(\n\t\t\tblocks[ i ].attributes\n\t\t);\n\n\t\tif ( attributeKey ) {\n\t\t\tblocks[ i ].attributes[ attributeKey ] = blocks[ i ].attributes[\n\t\t\t\tattributeKey\n\t\t\t]\n\t\t\t\t// To do: refactor this to use rich text's selection instead, so\n\t\t\t\t// we no longer have to use on this hack inserting a special\n\t\t\t\t// character.\n\t\t\t\t.toString()\n\t\t\t\t.replace( START_OF_SELECTED_AREA, '' );\n\t\t\treturn [ blocks[ i ].clientId, attributeKey, 0, 0 ];\n\t\t}\n\n\t\tconst nestedSelection = findSelection( blocks[ i ].innerBlocks );\n\n\t\tif ( nestedSelection ) {\n\t\t\treturn nestedSelection;\n\t\t}\n\t}\n\n\treturn [];\n}\n\nexport default ( props ) => ( element ) => {\n\tfunction inputRule() {\n\t\tconst { getValue, onReplace, selectionChange, registry } =\n\t\t\tprops.current;\n\n\t\tif ( ! onReplace ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We must use getValue() here because value may be update\n\t\t// asynchronously.\n\t\tconst value = getValue();\n\t\tconst { start, text } = value;\n\t\tconst characterBefore = text.slice( start - 1, start );\n\n\t\t// The character right before the caret must be a plain space.\n\t\tif ( characterBefore !== ' ' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst trimmedTextBefore = text.slice( 0, start ).trim();\n\t\tconst prefixTransforms = getBlockTransforms( 'from' ).filter(\n\t\t\t( { type } ) => type === 'prefix'\n\t\t);\n\t\tconst transformation = findTransform(\n\t\t\tprefixTransforms,\n\t\t\t( { prefix } ) => {\n\t\t\t\treturn trimmedTextBefore === prefix;\n\t\t\t}\n\t\t);\n\n\t\tif ( ! transformation ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst content = toHTMLString( {\n\t\t\tvalue: insert( value, START_OF_SELECTED_AREA, 0, start ),\n\t\t} );\n\t\tconst block = transformation.transform( content );\n\n\t\tselectionChange( ...findSelection( [ block ] ) );\n\t\tonReplace( [ block ] );\n\t\tregistry.dispatch( blockEditorStore ).__unstableMarkAutomaticChange();\n\n\t\treturn true;\n\t}\n\n\tfunction onInput( event ) {\n\t\tconst { inputType, type } = event;\n\t\tconst {\n\t\t\tgetValue,\n\t\t\tonChange,\n\t\t\t__unstableAllowPrefixTransformations,\n\t\t\tformatTypes,\n\t\t\tregistry,\n\t\t} = props.current;\n\n\t\t// Only run input rules when inserting text.\n\t\tif ( inputType !== 'insertText' && type !== 'compositionend' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( __unstableAllowPrefixTransformations && inputRule() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst value = getValue();\n\t\tconst transformed = formatTypes.reduce(\n\t\t\t( accumlator, { __unstableInputRule } ) => {\n\t\t\t\tif ( __unstableInputRule ) {\n\t\t\t\t\taccumlator = __unstableInputRule( accumlator );\n\t\t\t\t}\n\n\t\t\t\treturn accumlator;\n\t\t\t},\n\t\t\tpreventEventDiscovery( value )\n\t\t);\n\n\t\tconst {\n\t\t\t__unstableMarkLastChangeAsPersistent,\n\t\t\t__unstableMarkAutomaticChange,\n\t\t} = registry.dispatch( blockEditorStore );\n\n\t\tif ( transformed !== value ) {\n\t\t\t__unstableMarkLastChangeAsPersistent();\n\t\t\tonChange( {\n\t\t\t\t...transformed,\n\t\t\t\tactiveFormats: value.activeFormats,\n\t\t\t} );\n\t\t\t__unstableMarkAutomaticChange();\n\t\t}\n\t}\n\n\telement.addEventListener( 'input', onInput );\n\telement.addEventListener( 'compositionend', onInput );\n\treturn () => {\n\t\telement.removeEventListener( 'input', onInput );\n\t\telement.removeEventListener( 'compositionend', onInput );\n\t};\n};\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAQA,SAASK,aAAaA,CAAEC,MAAM,EAAG;EAChC,IAAIC,CAAC,GAAGD,MAAM,CAACE,MAAM;EAErB,OAAQD,CAAC,EAAE,EAAG;IACb,MAAME,YAAY,GAAG,IAAAC,oCAAyB,EAC7CJ,MAAM,CAAEC,CAAC,CAAE,CAACI,UACb,CAAC;IAED,IAAKF,YAAY,EAAG;MACnBH,MAAM,CAAEC,CAAC,CAAE,CAACI,UA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C;IAED,MAAM;MACLiC,oCAAoC;MACpCZ;IACD,CAAC,GAAGvB,QAAQ,CAACqB,QAAQ,CAAEC,YAAiB,CAAC;IAEzC,IAAKQ,WAAW,KAAK5B,KAAK,EAAG;MAC5BiC,oCAAoC,CAAC,CAAC;MACtCR,QAAQ,CAAE;QACT,GAAGG,WAAW;QACdM,aAAa,EAAElC,KAAK,CAACkC;MACtB,CAAE,CAAC;MACHb,6BAA6B,CAAC,CAAC;IAChC;EACD;EAEA5B,OAAO,CAAC0C,gBAAgB,CAAE,OAAO,EAAEb,OAAQ,CAAC;EAC5C7B,OAAO,CAAC0C,gBAAgB,CAAE,gBAAgB,EAAEb,OAAQ,CAAC;EACrD,OAAO,MAAM;IACZ7B,OAAO,CAAC2C,mBAAmB,CAAE,OAAO,EAAEd,OAAQ,CAAC;IAC/C7B,OAAO,CAAC2C,mBAAmB,CAAE,gBAAgB,EAAEd,OAAQ,CAAC;EACzD,CAAC;AACF,CAAC;AAAAe,OAAA,CAAAC,OAAA,GAAA/C,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["_richText","require","_blocks","_store","_preventEventDiscovery","_selection","findSelection","blocks","i","length","attributeKey","retrieveSelectedAttribute","attributes","toString","replace","START_OF_SELECTED_AREA","clientId","nestedSelection","innerBlocks","_default","props","element","inputRule","getValue","onReplace","selectionChange","registry","current","value","start","text","characterBefore","slice","trimmedTextBefore","trim","prefixTransforms","getBlockTransforms","filter","type","transformation","findTransform","prefix","content","toHTMLString","insert","block","transform","dispatch","blockEditorStore","__unstableMarkAutomaticChange","onInput","event","inputType","onChange","__unstableAllowPrefixTransformations","formatTypes","transformed","reduce","accumlator","__unstableInputRule","preventEventDiscovery","__unstableMarkLastChangeAsPersistent","activeFormats","addEventListener","removeEventListener","exports","default"],"sources":["@wordpress/block-editor/src/components/rich-text/event-listeners/input-rules.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { insert, toHTMLString } from '@wordpress/rich-text';\nimport { getBlockTransforms, findTransform } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\nimport { preventEventDiscovery } from '../prevent-event-discovery';\nimport {\n\tretrieveSelectedAttribute,\n\tSTART_OF_SELECTED_AREA,\n} from '../../../utils/selection';\n\nexport function findSelection( blocks ) {\n\tlet i = blocks.length;\n\n\twhile ( i-- ) {\n\t\tconst attributeKey = retrieveSelectedAttribute(\n\t\t\tblocks[ i ].attributes\n\t\t);\n\n\t\tif ( attributeKey ) {\n\t\t\tblocks[ i ].attributes[ attributeKey ] = blocks[ i ].attributes[\n\t\t\t\tattributeKey\n\t\t\t]\n\t\t\t\t// To do: refactor this to use rich text's selection instead, so\n\t\t\t\t// we no longer have to use on this hack inserting a special\n\t\t\t\t// character.\n\t\t\t\t.toString()\n\t\t\t\t.replace( START_OF_SELECTED_AREA, '' );\n\t\t\treturn [ blocks[ i ].clientId, attributeKey, 0, 0 ];\n\t\t}\n\n\t\tconst nestedSelection = findSelection( blocks[ i ].innerBlocks );\n\n\t\tif ( nestedSelection ) {\n\t\t\treturn nestedSelection;\n\t\t}\n\t}\n\n\treturn [];\n}\n\nexport default ( props ) => ( element ) => {\n\tfunction inputRule() {\n\t\tconst { getValue, onReplace, selectionChange, registry } =\n\t\t\tprops.current;\n\n\t\tif ( ! onReplace ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We must use getValue() here because value may be update\n\t\t// asynchronously.\n\t\tconst value = getValue();\n\t\tconst { start, text } = value;\n\t\tconst characterBefore = text.slice( start - 1, start );\n\n\t\t// The character right before the caret must be a plain space.\n\t\tif ( characterBefore !== ' ' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst trimmedTextBefore = text.slice( 0, start ).trim();\n\t\tconst prefixTransforms = getBlockTransforms( 'from' ).filter(\n\t\t\t( { type } ) => type === 'prefix'\n\t\t);\n\t\tconst transformation = findTransform(\n\t\t\tprefixTransforms,\n\t\t\t( { prefix } ) => {\n\t\t\t\treturn trimmedTextBefore === prefix;\n\t\t\t}\n\t\t);\n\n\t\tif ( ! transformation ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst content = toHTMLString( {\n\t\t\tvalue: insert( value, START_OF_SELECTED_AREA, 0, start ),\n\t\t} );\n\t\tconst block = transformation.transform( content );\n\n\t\tselectionChange( ...findSelection( [ block ] ) );\n\t\tonReplace( [ block ] );\n\t\tregistry.dispatch( blockEditorStore ).__unstableMarkAutomaticChange();\n\n\t\treturn true;\n\t}\n\n\tfunction onInput( event ) {\n\t\tconst { inputType, type } = event;\n\t\tconst {\n\t\t\tgetValue,\n\t\t\tonChange,\n\t\t\t__unstableAllowPrefixTransformations,\n\t\t\tformatTypes,\n\t\t\tregistry,\n\t\t} = props.current;\n\n\t\t// Only run input rules when inserting text.\n\t\tif ( inputType !== 'insertText' && type !== 'compositionend' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( __unstableAllowPrefixTransformations && inputRule() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst value = getValue();\n\t\tconst transformed = formatTypes.reduce(\n\t\t\t( accumlator, { __unstableInputRule } ) => {\n\t\t\t\tif ( __unstableInputRule ) {\n\t\t\t\t\taccumlator = __unstableInputRule( accumlator );\n\t\t\t\t}\n\n\t\t\t\treturn accumlator;\n\t\t\t},\n\t\t\tpreventEventDiscovery( value )\n\t\t);\n\n\t\tconst {\n\t\t\t__unstableMarkLastChangeAsPersistent,\n\t\t\t__unstableMarkAutomaticChange,\n\t\t} = registry.dispatch( blockEditorStore );\n\n\t\tif ( transformed !== value ) {\n\t\t\t__unstableMarkLastChangeAsPersistent();\n\t\t\tonChange( {\n\t\t\t\t...transformed,\n\t\t\t\tactiveFormats: value.activeFormats,\n\t\t\t} );\n\t\t\t__unstableMarkAutomaticChange();\n\t\t}\n\t}\n\n\telement.addEventListener( 'input', onInput );\n\telement.addEventListener( 'compositionend', onInput );\n\treturn () => {\n\t\telement.removeEventListener( 'input', onInput );\n\t\telement.removeEventListener( 'compositionend', onInput );\n\t};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CAAC,GAAGN,KAAK,CAACO,OAAO;;IAEjB;IACA,IAAKyB,SAAS,KAAK,YAAY,IAAId,IAAI,KAAK,gBAAgB,EAAG;MAC9D;IACD;IAEA,IAAKgB,oCAAoC,IAAIhC,SAAS,CAAC,CAAC,EAAG;MAC1D;IACD;IAEA,MAAMM,KAAK,GAAGL,QAAQ,CAAC,CAAC;IACxB,MAAMiC,WAAW,GAAGD,WAAW,CAACE,MAAM,CACrC,CAAEC,UAAU,EAAE;MAAEC;IAAoB,CAAC,KAAM;MAC1C,IAAKA,mBAAmB,EAAG;QAC1BD,UAAU,GAAGC,mBAAmB,CAAED,UAAW,CAAC;MAC/C;MAEA,OAAOA,UAAU;IAClB,CAAC,EACD,IAAAE,4CAAqB,EAAEhC,KAAM,CAC9B,CAAC;IAED,MAAM;MACLiC,oCAAoC;MACpCZ;IACD,CAAC,GAAGvB,QAAQ,CAACqB,QAAQ,CAAEC,YAAiB,CAAC;IAEzC,IAAKQ,WAAW,KAAK5B,KAAK,EAAG;MAC5BiC,oCAAoC,CAAC,CAAC;MACtCR,QAAQ,CAAE;QACT,GAAGG,WAAW;QACdM,aAAa,EAAElC,KAAK,CAACkC;MACtB,CAAE,CAAC;MACHb,6BAA6B,CAAC,CAAC;IAChC;EACD;EAEA5B,OAAO,CAAC0C,gBAAgB,CAAE,OAAO,EAAEb,OAAQ,CAAC;EAC5C7B,OAAO,CAAC0C,gBAAgB,CAAE,gBAAgB,EAAEb,OAAQ,CAAC;EACrD,OAAO,MAAM;IACZ7B,OAAO,CAAC2C,mBAAmB,CAAE,OAAO,EAAEd,OAAQ,CAAC;IAC/C7B,OAAO,CAAC2C,mBAAmB,CAAE,gBAAgB,EAAEd,OAAQ,CAAC;EACzD,CAAC;AACF,CAAC;AAAAe,OAAA,CAAAC,OAAA,GAAA/C,QAAA","ignoreList":[]}
@@ -43,6 +43,8 @@ var _embedHandlerPicker = _interopRequireDefault(require("./embed-handler-picker
43
43
  var _content = require("./content");
44
44
  var _native = _interopRequireDefault(require("./native"));
45
45
  var _withDeprecations = require("./with-deprecations");
46
+ var _inputRules = require("./event-listeners/input-rules");
47
+ var _selection = require("../../utils/selection");
46
48
  var _jsxRuntime = require("react/jsx-runtime");
47
49
  var _shortcut = require("./shortcut");
48
50
  var _toolbarButton = require("./toolbar-button");
@@ -435,7 +437,7 @@ function RichTextWrapper({
435
437
  }
436
438
  }
437
439
  }, [tagName, onReplace, onSplit, splitValue, __unstableEmbedURLOnPaste, preserveWhiteSpace, pastePlainText]);
438
- const inputRule = (0, _element.useCallback)((value, valueToFormat) => {
440
+ const inputRule = (0, _element.useCallback)(value => {
439
441
  if (!onReplace) {
440
442
  return;
441
443
  }
@@ -449,7 +451,7 @@ function RichTextWrapper({
449
451
  if (characterBefore !== ' ') {
450
452
  return;
451
453
  }
452
- const trimmedTextBefore = text.slice(0, startPosition).trim();
454
+ const trimmedTextBefore = text.slice(0, start).trim();
453
455
  const prefixTransforms = (0, _blocks.getBlockTransforms)('from').filter(({
454
456
  type
455
457
  }) => type === 'prefix');
@@ -461,11 +463,15 @@ function RichTextWrapper({
461
463
  if (!transformation) {
462
464
  return;
463
465
  }
464
- const content = valueToFormat((0, _richText.slice)(value, startPosition, text.length));
466
+ const content = (0, _richText.toHTMLString)({
467
+ value: (0, _richText.insert)(value, _selection.START_OF_SELECTED_AREA, 0, start)
468
+ });
465
469
  const block = transformation.transform(content);
470
+ const currentSelection = (0, _inputRules.findSelection)([block]);
466
471
  onReplace([block]);
472
+ selectionChange(...currentSelection);
467
473
  __unstableMarkAutomaticChange();
468
- }, [onReplace, __unstableMarkAutomaticChange]);
474
+ }, [onReplace, start, selectionChange, __unstableMarkAutomaticChange]);
469
475
  const mergedRef = (0, _compose.useMergeRefs)([providedRef, fallbackRef]);
470
476
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_native.default, {
471
477
  clientId: clientId,