@wordpress/block-editor 15.6.0 → 15.6.1

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 (73) hide show
  1. package/build/components/block-list/block.js +3 -3
  2. package/build/components/block-list/block.js.map +2 -2
  3. package/build/components/block-list/index.js +2 -2
  4. package/build/components/block-list/index.js.map +1 -1
  5. package/build/components/global-styles/typography-panel.js +18 -1
  6. package/build/components/global-styles/typography-panel.js.map +2 -2
  7. package/build/components/rich-text/index.js +8 -7
  8. package/build/components/rich-text/index.js.map +2 -2
  9. package/build/hooks/block-bindings.js +111 -170
  10. package/build/hooks/block-bindings.js.map +2 -2
  11. package/build/hooks/custom-class-name.js +1 -1
  12. package/build/hooks/custom-class-name.js.map +1 -1
  13. package/build/hooks/fit-text.js +31 -18
  14. package/build/hooks/fit-text.js.map +2 -2
  15. package/build/hooks/font-size.js +4 -3
  16. package/build/hooks/font-size.js.map +2 -2
  17. package/build/hooks/metadata.js +48 -2
  18. package/build/hooks/metadata.js.map +2 -2
  19. package/build/hooks/typography.js +11 -4
  20. package/build/hooks/typography.js.map +3 -3
  21. package/build/store/private-selectors.js +3 -3
  22. package/build/store/private-selectors.js.map +2 -2
  23. package/build/store/selectors.js +38 -13
  24. package/build/store/selectors.js.map +2 -2
  25. package/build/store/utils.js +2 -1
  26. package/build/store/utils.js.map +2 -2
  27. package/build/utils/fit-text-utils.js +4 -4
  28. package/build/utils/fit-text-utils.js.map +2 -2
  29. package/build-module/components/block-list/block.js +3 -3
  30. package/build-module/components/block-list/block.js.map +2 -2
  31. package/build-module/components/block-list/index.js +2 -2
  32. package/build-module/components/block-list/index.js.map +1 -1
  33. package/build-module/components/global-styles/typography-panel.js +18 -1
  34. package/build-module/components/global-styles/typography-panel.js.map +2 -2
  35. package/build-module/components/rich-text/index.js +8 -7
  36. package/build-module/components/rich-text/index.js.map +2 -2
  37. package/build-module/hooks/block-bindings.js +112 -172
  38. package/build-module/hooks/block-bindings.js.map +2 -2
  39. package/build-module/hooks/custom-class-name.js +1 -1
  40. package/build-module/hooks/custom-class-name.js.map +1 -1
  41. package/build-module/hooks/fit-text.js +32 -19
  42. package/build-module/hooks/fit-text.js.map +2 -2
  43. package/build-module/hooks/font-size.js +4 -3
  44. package/build-module/hooks/font-size.js.map +2 -2
  45. package/build-module/hooks/metadata.js +46 -1
  46. package/build-module/hooks/metadata.js.map +2 -2
  47. package/build-module/hooks/typography.js +11 -4
  48. package/build-module/hooks/typography.js.map +3 -3
  49. package/build-module/store/private-selectors.js +2 -2
  50. package/build-module/store/private-selectors.js.map +2 -2
  51. package/build-module/store/selectors.js +39 -14
  52. package/build-module/store/selectors.js.map +2 -2
  53. package/build-module/store/utils.js +3 -2
  54. package/build-module/store/utils.js.map +2 -2
  55. package/build-module/utils/fit-text-utils.js +4 -4
  56. package/build-module/utils/fit-text-utils.js.map +2 -2
  57. package/package.json +35 -35
  58. package/src/components/block-list/block.js +1 -1
  59. package/src/components/block-list/index.js +2 -2
  60. package/src/components/global-styles/typography-panel.js +26 -1
  61. package/src/components/rich-text/index.js +8 -14
  62. package/src/hooks/block-bindings.js +79 -153
  63. package/src/hooks/custom-class-name.js +1 -1
  64. package/src/hooks/fit-text.js +37 -28
  65. package/src/hooks/font-size.js +7 -3
  66. package/src/hooks/metadata.js +89 -0
  67. package/src/hooks/test/metadata.js +316 -0
  68. package/src/hooks/typography.js +15 -4
  69. package/src/store/private-selectors.js +2 -2
  70. package/src/store/selectors.js +59 -21
  71. package/src/store/test/selectors.js +1 -1
  72. package/src/store/utils.js +2 -1
  73. package/src/utils/fit-text-utils.js +4 -16
@@ -0,0 +1,316 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ getBlockTypes,
6
+ registerBlockType,
7
+ unregisterBlockType,
8
+ } from '@wordpress/blocks';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import { addTransforms } from '../metadata';
14
+
15
+ describe( 'metadata', () => {
16
+ afterEach( () => {
17
+ getBlockTypes().forEach( ( block ) => {
18
+ unregisterBlockType( block.name );
19
+ } );
20
+ } );
21
+
22
+ describe( 'addTransforms()', () => {
23
+ it( 'should not preserve metadata in wrapping transforms', () => {
24
+ const source = [
25
+ {
26
+ name: 'core/foo',
27
+ attributes: { metadata: { noteId: 1 } },
28
+ innerBlocks: [],
29
+ },
30
+ {
31
+ name: 'core/foo',
32
+ attributes: { metadata: { noteId: 2 } },
33
+ innerBlocks: [],
34
+ },
35
+ ];
36
+ const result = {
37
+ name: 'core/bar',
38
+ attributes: {},
39
+ innerBlocks: source,
40
+ };
41
+ const transformed = addTransforms( result, source, 0, [ result ] );
42
+
43
+ expect( transformed.attributes.metadata ).toBeUndefined();
44
+ } );
45
+
46
+ it( 'should not preserve metadata in one-to-many transforms', () => {
47
+ const source = [
48
+ {
49
+ name: 'core/foo',
50
+ attributes: { metadata: { noteId: 1 } },
51
+ innerBlocks: [],
52
+ },
53
+ ];
54
+ const results = [
55
+ {
56
+ name: 'core/bar',
57
+ attributes: {},
58
+ innerBlocks: [],
59
+ },
60
+ {
61
+ name: 'core/bar',
62
+ attributes: {},
63
+ innerBlocks: [],
64
+ },
65
+ ];
66
+ const transformed = addTransforms(
67
+ results[ 0 ],
68
+ source,
69
+ 0,
70
+ results
71
+ );
72
+
73
+ expect( transformed.attributes.metadata ).toBeUndefined();
74
+ } );
75
+
76
+ it( 'should not preserve metadata in many-to-one transforms', () => {
77
+ const source = [
78
+ {
79
+ name: 'core/foo',
80
+ attributes: { metadata: { noteId: 1 } },
81
+ innerBlocks: [],
82
+ },
83
+ {
84
+ name: 'core/foo',
85
+ attributes: { metadata: { noteId: 2 } },
86
+ innerBlocks: [],
87
+ },
88
+ ];
89
+ const result = {
90
+ name: 'core/bar',
91
+ attributes: {},
92
+ innerBlocks: [],
93
+ };
94
+ const transformed = addTransforms( result, source, 0, [ result ] );
95
+
96
+ expect( transformed.attributes.metadata ).toBeUndefined();
97
+ } );
98
+
99
+ it( 'should not preserve metadata in many-to-many transforms with different counts', () => {
100
+ const source = [
101
+ {
102
+ name: 'core/foo',
103
+ attributes: { metadata: { noteId: 1 } },
104
+ innerBlocks: [],
105
+ },
106
+ {
107
+ name: 'core/foo',
108
+ attributes: { metadata: { noteId: 2 } },
109
+ innerBlocks: [],
110
+ },
111
+ {
112
+ name: 'core/foo',
113
+ attributes: { metadata: { noteId: 3 } },
114
+ innerBlocks: [],
115
+ },
116
+ ];
117
+ const results = [
118
+ {
119
+ name: 'core/bar',
120
+ attributes: {},
121
+ innerBlocks: [],
122
+ },
123
+ {
124
+ name: 'core/bar',
125
+ attributes: {},
126
+ innerBlocks: [],
127
+ },
128
+ ];
129
+ const [ firstTransformed, secondTransformed ] = results.map(
130
+ ( result, index ) =>
131
+ addTransforms( result, source, index, results )
132
+ );
133
+
134
+ expect( firstTransformed.attributes.metadata ).toBeUndefined();
135
+ expect( secondTransformed.attributes.metadata ).toBeUndefined();
136
+ } );
137
+
138
+ it( 'should preserve metadata in many-to-many transforms with same counts', () => {
139
+ const source = [
140
+ {
141
+ name: 'core/foo',
142
+ attributes: { metadata: { noteId: 1 } },
143
+ innerBlocks: [],
144
+ },
145
+ {
146
+ name: 'core/foo',
147
+ attributes: { metadata: { noteId: 2 } },
148
+ innerBlocks: [],
149
+ },
150
+ ];
151
+ const results = [
152
+ {
153
+ name: 'core/bar',
154
+ attributes: { metadata: { noteId: 1 } },
155
+ },
156
+ {
157
+ name: 'core/bar',
158
+ attributes: { metadata: { noteId: 2 } },
159
+ },
160
+ ];
161
+
162
+ const [ firstTransformed, secondTransformed ] = results.map(
163
+ ( result, index ) =>
164
+ addTransforms( result, source, index, results )
165
+ );
166
+
167
+ expect( firstTransformed.attributes.metadata ).toEqual( {
168
+ noteId: 1,
169
+ } );
170
+ expect( secondTransformed.attributes.metadata ).toEqual( {
171
+ noteId: 2,
172
+ } );
173
+ } );
174
+
175
+ it( 'should preserve custom name metadata', () => {
176
+ registerBlockType( 'core/bar', {
177
+ title: 'Bar',
178
+ } );
179
+ const source = [
180
+ {
181
+ name: 'core/foo',
182
+ attributes: {
183
+ metadata: { name: 'Custom Name' },
184
+ },
185
+ innerBlocks: [],
186
+ },
187
+ ];
188
+ const result = {
189
+ name: 'core/bar',
190
+ attributes: {},
191
+ innerBlocks: [],
192
+ };
193
+ const transformed = addTransforms( result, source, 0, [ result ] );
194
+
195
+ expect( transformed.attributes.metadata.name ).toBe(
196
+ 'Custom Name'
197
+ );
198
+ } );
199
+
200
+ it( 'should not preserve custom name metadata when target block does not support renaming', () => {
201
+ registerBlockType( 'core/bar', {
202
+ title: 'Bar',
203
+ supports: {
204
+ renaming: false,
205
+ },
206
+ } );
207
+
208
+ const source = [
209
+ {
210
+ name: 'core/foo',
211
+ attributes: {
212
+ metadata: { name: 'Custom Name' },
213
+ },
214
+ innerBlocks: [],
215
+ },
216
+ ];
217
+ const result = {
218
+ name: 'core/bar',
219
+ attributes: {},
220
+ innerBlocks: [],
221
+ };
222
+ const transformed = addTransforms( result, source, 0, [ result ] );
223
+
224
+ expect( transformed.attributes.metadata?.name ).toBeUndefined();
225
+ } );
226
+
227
+ it( 'should preserve block visibility metadata', () => {
228
+ registerBlockType( 'core/bar', {
229
+ title: 'Bar',
230
+ } );
231
+
232
+ const source = [
233
+ {
234
+ name: 'core/foo',
235
+ attributes: {
236
+ metadata: { blockVisibility: false },
237
+ },
238
+ innerBlocks: [],
239
+ },
240
+ ];
241
+ const result = {
242
+ name: 'core/bar',
243
+ attributes: {},
244
+ innerBlocks: [],
245
+ };
246
+ const transformed = addTransforms( result, source, 0, [ result ] );
247
+
248
+ expect( transformed.attributes.metadata?.blockVisibility ).toBe(
249
+ false
250
+ );
251
+ } );
252
+
253
+ it( 'should not preserve block visibility metadata when target block does not support it', () => {
254
+ registerBlockType( 'core/bar', {
255
+ title: 'Bar',
256
+ supports: {
257
+ blockVisibility: false,
258
+ },
259
+ } );
260
+
261
+ const source = [
262
+ {
263
+ name: 'core/foo',
264
+ attributes: {
265
+ metadata: { blockVisibility: false },
266
+ },
267
+ innerBlocks: [],
268
+ },
269
+ ];
270
+ const result = {
271
+ name: 'core/bar',
272
+ attributes: {},
273
+ innerBlocks: [],
274
+ };
275
+ const transformed = addTransforms( result, source, 0, [ result ] );
276
+
277
+ expect(
278
+ transformed.attributes.metadata?.blockVisibility
279
+ ).toBeUndefined();
280
+ } );
281
+
282
+ it( 'should not override existing metadata in target block', () => {
283
+ const source = [
284
+ {
285
+ name: 'core/foo',
286
+ attributes: {
287
+ metadata: {
288
+ noteId: 1,
289
+ name: 'Custom Name',
290
+ blockVisibility: false,
291
+ },
292
+ },
293
+ innerBlocks: [],
294
+ },
295
+ ];
296
+ const result = {
297
+ name: 'core/bar',
298
+ attributes: {
299
+ metadata: {
300
+ noteId: 2,
301
+ name: 'Existing Name',
302
+ blockVisibility: true,
303
+ },
304
+ },
305
+ innerBlocks: [],
306
+ };
307
+ const transformed = addTransforms( result, source, 0, [ result ] );
308
+
309
+ expect( transformed.attributes.metadata ).toEqual( {
310
+ noteId: 2,
311
+ name: 'Existing Name',
312
+ blockVisibility: true,
313
+ } );
314
+ } );
315
+ } );
316
+ } );
@@ -116,11 +116,13 @@ function TypographyInspectorControl( { children, resetAllFilter } ) {
116
116
 
117
117
  export function TypographyPanel( { clientId, name, setAttributes, settings } ) {
118
118
  function selector( select ) {
119
- const { style, fontFamily, fontSize } =
119
+ const { style, fontFamily, fontSize, fitText } =
120
120
  select( blockEditorStore ).getBlockAttributes( clientId ) || {};
121
- return { style, fontFamily, fontSize };
121
+ return { style, fontFamily, fontSize, fitText };
122
122
  }
123
- const { style, fontFamily, fontSize } = useSelect( selector, [ clientId ] );
123
+ const { style, fontFamily, fontSize, fitText } = useSelect( selector, [
124
+ clientId,
125
+ ] );
124
126
  const isEnabled = useHasTypographyPanel( settings );
125
127
  const value = useMemo(
126
128
  () => attributesToStyle( { style, fontFamily, fontSize } ),
@@ -128,7 +130,16 @@ export function TypographyPanel( { clientId, name, setAttributes, settings } ) {
128
130
  );
129
131
 
130
132
  const onChange = ( newStyle ) => {
131
- setAttributes( styleToAttributes( newStyle ) );
133
+ const newAttributes = styleToAttributes( newStyle );
134
+
135
+ // If setting a font size and fitText is currently enabled, disable it
136
+ const hasFontSize =
137
+ newAttributes.fontSize || newAttributes.style?.typography?.fontSize;
138
+ if ( hasFontSize && fitText ) {
139
+ newAttributes.fitText = undefined;
140
+ }
141
+
142
+ setAttributes( newAttributes );
132
143
  };
133
144
 
134
145
  if ( ! isEnabled ) {
@@ -95,7 +95,7 @@ export const isBlockSubtreeDisabled = ( state, clientId ) => {
95
95
  * @param {string} rootClientId The client ID of the root container block.
96
96
  * @return {boolean} Whether the container allows insertion.
97
97
  */
98
- export function isContainerInsertableToInWriteMode(
98
+ export function isContainerInsertableToInContentOnlyMode(
99
99
  state,
100
100
  blockName,
101
101
  rootClientId
@@ -105,7 +105,7 @@ export function isContainerInsertableToInWriteMode(
105
105
  const isContainerContentBlock = isContentBlock( rootBlockName );
106
106
  const isRootBlockMain = getSectionRootClientId( state ) === rootClientId;
107
107
 
108
- // In write mode, containers shouldn't be inserted into unless:
108
+ // In contentOnly mode, containers shouldn't be inserted into unless:
109
109
  // 1. they are a section root;
110
110
  // 2. they are a content block and the block to be inserted is also content.
111
111
  return (
@@ -43,7 +43,7 @@ import {
43
43
  isSectionBlock,
44
44
  getParentSectionBlock,
45
45
  isZoomOut,
46
- isContainerInsertableToInWriteMode,
46
+ isContainerInsertableToInContentOnlyMode,
47
47
  } from './private-selectors';
48
48
 
49
49
  const { isContentBlock } = unlock( blocksPrivateApis );
@@ -1682,15 +1682,7 @@ const canInsertBlockTypeUnmemoized = (
1682
1682
  blockType = getBlockType( blockName );
1683
1683
  }
1684
1684
 
1685
- const isLocked = !! getTemplateLock( state, rootClientId );
1686
- if ( isLocked ) {
1687
- return false;
1688
- }
1689
- const isContentRoleBlock = isContentBlock( blockName );
1690
- const isParentSectionBlock = !! isSectionBlock( state, rootClientId );
1691
- // It shouldn't be possible to insert inside a section block unless in
1692
- // some cases when the block is a content block.
1693
- if ( isParentSectionBlock && ! isContentRoleBlock ) {
1685
+ if ( getTemplateLock( state, rootClientId ) ) {
1694
1686
  return false;
1695
1687
  }
1696
1688
 
@@ -1707,10 +1699,29 @@ const canInsertBlockTypeUnmemoized = (
1707
1699
  return false;
1708
1700
  }
1709
1701
 
1710
- // In write mode, check if this container allows insertion.
1702
+ // It shouldn't be possible to insert inside a section block unless in
1703
+ // some cases when the block is a content block.
1704
+ const isContentRoleBlock = isContentBlock( blockName );
1705
+ const isParentSectionBlock = !! isSectionBlock( state, rootClientId );
1706
+ const isBlockWithinSection = !! getParentSectionBlock(
1707
+ state,
1708
+ rootClientId
1709
+ );
1710
+ if (
1711
+ ( isParentSectionBlock || isBlockWithinSection ) &&
1712
+ ! isContentRoleBlock
1713
+ ) {
1714
+ return false;
1715
+ }
1716
+
1717
+ // In content only mode, check if this container allows insertion.
1711
1718
  if (
1712
- blockEditingMode === 'contentOnly' &&
1713
- ! isContainerInsertableToInWriteMode( state, blockName, rootClientId )
1719
+ ( isParentSectionBlock || blockEditingMode === 'contentOnly' ) &&
1720
+ ! isContainerInsertableToInContentOnlyMode(
1721
+ state,
1722
+ blockName,
1723
+ rootClientId
1724
+ )
1714
1725
  ) {
1715
1726
  return false;
1716
1727
  }
@@ -1858,6 +1869,8 @@ export function canRemoveBlock( state, clientId ) {
1858
1869
  return false;
1859
1870
  }
1860
1871
 
1872
+ // It shouldn't be possible to move in a section block unless in
1873
+ // some cases when the block is a content block.
1861
1874
  const isBlockWithinSection = !! getParentSectionBlock( state, clientId );
1862
1875
  const isContentRoleBlock = isContentBlock(
1863
1876
  getBlockName( state, clientId )
@@ -1866,21 +1879,21 @@ export function canRemoveBlock( state, clientId ) {
1866
1879
  return false;
1867
1880
  }
1868
1881
 
1869
- const blockEditingMode = getBlockEditingMode( state, rootClientId );
1870
-
1871
- // Check if the parent container allows insertion/removal in write mode
1882
+ const isParentSectionBlock = !! isSectionBlock( state, rootClientId );
1883
+ const rootBlockEditingMode = getBlockEditingMode( state, rootClientId );
1884
+ // Check if the parent container allows insertion/removal in contentOnly mode
1872
1885
  if (
1873
- blockEditingMode === 'contentOnly' &&
1874
- ! isContainerInsertableToInWriteMode(
1886
+ ( isParentSectionBlock || rootBlockEditingMode === 'contentOnly' ) &&
1887
+ ! isContainerInsertableToInContentOnlyMode(
1875
1888
  state,
1876
- getBlockName( state, rootClientId ),
1889
+ getBlockName( state, clientId ),
1877
1890
  rootClientId
1878
1891
  )
1879
1892
  ) {
1880
1893
  return false;
1881
1894
  }
1882
1895
 
1883
- return blockEditingMode !== 'disabled';
1896
+ return rootBlockEditingMode !== 'disabled';
1884
1897
  }
1885
1898
 
1886
1899
  /**
@@ -1913,9 +1926,34 @@ export function canMoveBlock( state, clientId ) {
1913
1926
  }
1914
1927
 
1915
1928
  const rootClientId = getBlockRootClientId( state, clientId );
1916
- if ( getTemplateLock( state, rootClientId ) === 'all' ) {
1929
+ const templateLock = getTemplateLock( state, rootClientId );
1930
+ if ( templateLock === 'all' || templateLock === 'contentOnly' ) {
1931
+ return false;
1932
+ }
1933
+
1934
+ const isBlockWithinSection = !! getParentSectionBlock( state, clientId );
1935
+ const isContentRoleBlock = isContentBlock(
1936
+ getBlockName( state, clientId )
1937
+ );
1938
+ if ( isBlockWithinSection && ! isContentRoleBlock ) {
1917
1939
  return false;
1918
1940
  }
1941
+
1942
+ // If the parent is a section or is `contentOnly`, then check is the inner block
1943
+ // should be allowed to move.
1944
+ const isParentSectionBlock = !! isSectionBlock( state, rootClientId );
1945
+ const rootBlockEditingMode = getBlockEditingMode( state, rootClientId );
1946
+ if (
1947
+ ( isParentSectionBlock || rootBlockEditingMode === 'contentOnly' ) &&
1948
+ ! isContainerInsertableToInContentOnlyMode(
1949
+ state,
1950
+ getBlockName( state, clientId ),
1951
+ rootClientId
1952
+ )
1953
+ ) {
1954
+ return false;
1955
+ }
1956
+
1919
1957
  return getBlockEditingMode( state, rootClientId ) !== 'disabled';
1920
1958
  }
1921
1959
 
@@ -3081,7 +3081,7 @@ describe( 'selectors', () => {
3081
3081
  byClientId: new Map(
3082
3082
  Object.entries( {
3083
3083
  block1: { name: 'core/test-block-ancestor' },
3084
- block2: { name: 'core/block' },
3084
+ block2: { name: 'core/group' },
3085
3085
  block3: { name: 'core/test-block-parent' },
3086
3086
  } )
3087
3087
  ),
@@ -10,7 +10,7 @@ import { parse as grammarParse } from '@wordpress/block-serialization-default-pa
10
10
  import { selectBlockPatternsKey } from './private-keys';
11
11
  import { unlock } from '../lock-unlock';
12
12
  import { STORE_NAME } from './constants';
13
- import { getSectionRootClientId } from './private-selectors';
13
+ import { getSectionRootClientId, isSectionBlock } from './private-selectors';
14
14
  import { getBlockEditingMode } from './selectors';
15
15
  import { INSERTER_PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils';
16
16
 
@@ -140,5 +140,6 @@ export const getInsertBlockTypeDependants = () => ( state, rootClientId ) => {
140
140
  state.settings.templateLock,
141
141
  getBlockEditingMode( state, rootClientId ),
142
142
  getSectionRootClientId( state ),
143
+ isSectionBlock( state, rootClientId ),
143
144
  ];
144
145
  };
@@ -20,18 +20,13 @@ function generateCSSRule( elementSelector, fontSize ) {
20
20
  * @param {HTMLElement} textElement The text element
21
21
  * @param {string} elementSelector CSS selector for the text element
22
22
  * @param {Function} applyStylesFn Function to apply test styles
23
- * @param {number} maxSize Maximum font size in pixels (default: 600)
24
23
  * @return {number} Optimal font size
25
24
  */
26
- function findOptimalFontSize(
27
- textElement,
28
- elementSelector,
29
- applyStylesFn,
30
- maxSize = 600
31
- ) {
25
+ function findOptimalFontSize( textElement, elementSelector, applyStylesFn ) {
32
26
  const alreadyHasScrollableHeight =
33
27
  textElement.scrollHeight > textElement.clientHeight;
34
28
  let minSize = 5;
29
+ let maxSize = 600;
35
30
  let bestSize = minSize;
36
31
 
37
32
  while ( minSize <= maxSize ) {
@@ -61,14 +56,8 @@ function findOptimalFontSize(
61
56
  * @param {HTMLElement} textElement The text element (paragraph, heading, etc.)
62
57
  * @param {string} elementSelector CSS selector for the text element
63
58
  * @param {Function} applyStylesFn Function to apply CSS styles (pass empty string to clear)
64
- * @param {number} maxSize Maximum font size in pixels.
65
59
  */
66
- export function optimizeFitText(
67
- textElement,
68
- elementSelector,
69
- applyStylesFn,
70
- maxSize
71
- ) {
60
+ export function optimizeFitText( textElement, elementSelector, applyStylesFn ) {
72
61
  if ( ! textElement ) {
73
62
  return;
74
63
  }
@@ -78,8 +67,7 @@ export function optimizeFitText(
78
67
  const optimalSize = findOptimalFontSize(
79
68
  textElement,
80
69
  elementSelector,
81
- applyStylesFn,
82
- maxSize
70
+ applyStylesFn
83
71
  );
84
72
 
85
73
  const cssRule = generateCSSRule( elementSelector, optimalSize );