@wordpress/block-editor 12.19.0 → 12.19.2

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 (66) hide show
  1. package/build/components/global-styles/border-panel.js +4 -3
  2. package/build/components/global-styles/border-panel.js.map +1 -1
  3. package/build/components/global-styles/get-global-styles-changes.js +61 -24
  4. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  5. package/build/components/global-styles/typography-panel.js +8 -6
  6. package/build/components/global-styles/typography-panel.js.map +1 -1
  7. package/build/components/iframe/index.js +4 -1
  8. package/build/components/iframe/index.js.map +1 -1
  9. package/build/components/rich-text/index.native.js +1 -0
  10. package/build/components/rich-text/index.native.js.map +1 -1
  11. package/build/components/rich-text/use-enter.js +1 -0
  12. package/build/components/rich-text/use-enter.js.map +1 -1
  13. package/build/components/rich-text/use-input-rules.js +1 -30
  14. package/build/components/rich-text/use-input-rules.js.map +1 -1
  15. package/build/hooks/use-bindings-attributes.js +1 -18
  16. package/build/hooks/use-bindings-attributes.js.map +1 -1
  17. package/build/hooks/utils.js +8 -4
  18. package/build/hooks/utils.js.map +1 -1
  19. package/build/store/get-block-settings.js +17 -4
  20. package/build/store/get-block-settings.js.map +1 -1
  21. package/build/store/private-actions.js +5 -0
  22. package/build/store/private-actions.js.map +1 -1
  23. package/build/store/reducer.js +2 -1
  24. package/build/store/reducer.js.map +1 -1
  25. package/build-module/components/global-styles/border-panel.js +5 -4
  26. package/build-module/components/global-styles/border-panel.js.map +1 -1
  27. package/build-module/components/global-styles/get-global-styles-changes.js +61 -25
  28. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  29. package/build-module/components/global-styles/typography-panel.js +9 -7
  30. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  31. package/build-module/components/iframe/index.js +4 -1
  32. package/build-module/components/iframe/index.js.map +1 -1
  33. package/build-module/components/rich-text/index.native.js +1 -0
  34. package/build-module/components/rich-text/index.native.js.map +1 -1
  35. package/build-module/components/rich-text/use-enter.js +1 -0
  36. package/build-module/components/rich-text/use-enter.js.map +1 -1
  37. package/build-module/components/rich-text/use-input-rules.js +2 -31
  38. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  39. package/build-module/hooks/use-bindings-attributes.js +1 -18
  40. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  41. package/build-module/hooks/utils.js +8 -4
  42. package/build-module/hooks/utils.js.map +1 -1
  43. package/build-module/store/get-block-settings.js +16 -4
  44. package/build-module/store/get-block-settings.js.map +1 -1
  45. package/build-module/store/private-actions.js +5 -0
  46. package/build-module/store/private-actions.js.map +1 -1
  47. package/build-module/store/reducer.js +2 -1
  48. package/build-module/store/reducer.js.map +1 -1
  49. package/build-style/style-rtl.css +0 -12
  50. package/build-style/style.css +0 -12
  51. package/package.json +31 -31
  52. package/src/components/global-styles/border-panel.js +4 -6
  53. package/src/components/global-styles/get-global-styles-changes.js +68 -28
  54. package/src/components/global-styles/test/get-global-styles-changes.js +114 -75
  55. package/src/components/global-styles/typography-panel.js +11 -7
  56. package/src/components/iframe/index.js +4 -1
  57. package/src/components/link-control/style.scss +0 -7
  58. package/src/components/rich-text/index.native.js +1 -0
  59. package/src/components/rich-text/use-enter.js +1 -0
  60. package/src/components/rich-text/use-input-rules.js +2 -30
  61. package/src/components/url-input/style.scss +0 -4
  62. package/src/hooks/use-bindings-attributes.js +1 -22
  63. package/src/hooks/utils.js +24 -8
  64. package/src/store/get-block-settings.js +15 -4
  65. package/src/store/private-actions.js +9 -0
  66. package/src/store/reducer.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "12.19.0",
3
+ "version": "12.19.2",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -35,35 +35,35 @@
35
35
  "@emotion/react": "^11.7.1",
36
36
  "@emotion/styled": "^11.6.0",
37
37
  "@react-spring/web": "^9.4.5",
38
- "@wordpress/a11y": "^3.51.0",
39
- "@wordpress/api-fetch": "^6.48.0",
40
- "@wordpress/blob": "^3.51.0",
41
- "@wordpress/blocks": "^12.28.0",
42
- "@wordpress/commands": "^0.22.0",
43
- "@wordpress/components": "^26.0.0",
44
- "@wordpress/compose": "^6.28.0",
45
- "@wordpress/data": "^9.21.0",
46
- "@wordpress/date": "^4.51.0",
47
- "@wordpress/deprecated": "^3.51.0",
48
- "@wordpress/dom": "^3.51.0",
49
- "@wordpress/element": "^5.28.0",
50
- "@wordpress/escape-html": "^2.51.0",
51
- "@wordpress/hooks": "^3.51.0",
52
- "@wordpress/html-entities": "^3.51.0",
53
- "@wordpress/i18n": "^4.51.0",
54
- "@wordpress/icons": "^9.42.0",
55
- "@wordpress/is-shallow-equal": "^4.51.0",
56
- "@wordpress/keyboard-shortcuts": "^4.28.0",
57
- "@wordpress/keycodes": "^3.51.0",
58
- "@wordpress/notices": "^4.19.0",
59
- "@wordpress/preferences": "^3.28.0",
60
- "@wordpress/private-apis": "^0.33.0",
61
- "@wordpress/rich-text": "^6.28.0",
62
- "@wordpress/style-engine": "^1.34.0",
63
- "@wordpress/token-list": "^2.51.0",
64
- "@wordpress/url": "^3.52.0",
65
- "@wordpress/warning": "^2.51.0",
66
- "@wordpress/wordcount": "^3.51.0",
38
+ "@wordpress/a11y": "^3.51.1",
39
+ "@wordpress/api-fetch": "^6.48.1",
40
+ "@wordpress/blob": "^3.51.1",
41
+ "@wordpress/blocks": "^12.28.2",
42
+ "@wordpress/commands": "^0.22.2",
43
+ "@wordpress/components": "^26.0.2",
44
+ "@wordpress/compose": "^6.28.1",
45
+ "@wordpress/data": "^9.21.1",
46
+ "@wordpress/date": "^4.51.1",
47
+ "@wordpress/deprecated": "^3.51.1",
48
+ "@wordpress/dom": "^3.51.1",
49
+ "@wordpress/element": "^5.28.1",
50
+ "@wordpress/escape-html": "^2.51.1",
51
+ "@wordpress/hooks": "^3.51.1",
52
+ "@wordpress/html-entities": "^3.51.1",
53
+ "@wordpress/i18n": "^4.51.1",
54
+ "@wordpress/icons": "^9.42.1",
55
+ "@wordpress/is-shallow-equal": "^4.51.1",
56
+ "@wordpress/keyboard-shortcuts": "^4.28.1",
57
+ "@wordpress/keycodes": "^3.51.1",
58
+ "@wordpress/notices": "^4.19.1",
59
+ "@wordpress/preferences": "^3.28.2",
60
+ "@wordpress/private-apis": "^0.33.1",
61
+ "@wordpress/rich-text": "^6.28.2",
62
+ "@wordpress/style-engine": "^1.34.1",
63
+ "@wordpress/token-list": "^2.51.1",
64
+ "@wordpress/url": "^3.52.1",
65
+ "@wordpress/warning": "^2.51.1",
66
+ "@wordpress/wordcount": "^3.51.1",
67
67
  "change-case": "^4.1.2",
68
68
  "classnames": "^2.3.1",
69
69
  "colord": "^2.7.0",
@@ -87,5 +87,5 @@
87
87
  "publishConfig": {
88
88
  "access": "public"
89
89
  },
90
- "gitHead": "eb796371e9630636a4a8837033807b0c4a06ed67"
90
+ "gitHead": "730beb7fd33d3382d6032c3f33e451625a0fcf36"
91
91
  }
@@ -19,7 +19,7 @@ import { __ } from '@wordpress/i18n';
19
19
  import BorderRadiusControl from '../border-radius-control';
20
20
  import { useColorsPerOrigin } from './hooks';
21
21
  import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
22
- import { mergeOrigins } from '../../store/get-block-settings';
22
+ import { overrideOrigins } from '../../store/get-block-settings';
23
23
  import { setImmutably } from '../../utils/object';
24
24
  import { getBorderPanelLabel } from '../../hooks/border';
25
25
  import { ShadowPopover } from './shadow-panel-components';
@@ -154,12 +154,10 @@ export default function BorderPanel( {
154
154
 
155
155
  // Shadow
156
156
  const shadow = decodeValue( inheritedValue?.shadow );
157
- const shadowPresets = settings?.shadow?.presets;
158
- const mergedShadowPresets = shadowPresets
159
- ? mergeOrigins( shadowPresets )
160
- : [];
157
+ const shadowPresets = settings?.shadow?.presets ?? {};
158
+ const overriddenShadowPresets = overrideOrigins( shadowPresets ) ?? [];
161
159
  const setShadow = ( newValue ) => {
162
- const slug = mergedShadowPresets?.find(
160
+ const slug = overriddenShadowPresets?.find(
163
161
  ( { shadow: shadowName } ) => shadowName === newValue
164
162
  )?.slug;
165
163
 
@@ -22,8 +22,8 @@ const translationMap = {
22
22
  h4: __( 'H4' ),
23
23
  h5: __( 'H5' ),
24
24
  h6: __( 'H6' ),
25
- 'settings.color': __( 'Color settings' ),
26
- 'settings.typography': __( 'Typography settings' ),
25
+ 'settings.color': __( 'Color' ),
26
+ 'settings.typography': __( 'Typography' ),
27
27
  'styles.color': __( 'Colors' ),
28
28
  'styles.spacing': __( 'Spacing' ),
29
29
  'styles.typography': __( 'Typography' ),
@@ -54,12 +54,7 @@ function getTranslation( key ) {
54
54
  }
55
55
 
56
56
  if ( keyArray?.[ 0 ] === 'elements' ) {
57
- const elementName = translationMap[ keyArray[ 1 ] ] || keyArray[ 1 ];
58
- return sprintf(
59
- // translators: %s: element name, e.g., heading button, link, caption.
60
- __( '%s element' ),
61
- elementName
62
- );
57
+ return translationMap[ keyArray[ 1 ] ] || keyArray[ 1 ];
63
58
  }
64
59
 
65
60
  return undefined;
@@ -114,9 +109,9 @@ function deepCompare( changedObject, originalObject, parentPath = '' ) {
114
109
  *
115
110
  * @param {Object} next The changed object to compare.
116
111
  * @param {Object} previous The original object to compare against.
117
- * @return {string[]} An array of translated changes.
112
+ * @return {Array[]} A 2-dimensional array of tuples: [ "group", "translated change" ].
118
113
  */
119
- function getGlobalStylesChangelist( next, previous ) {
114
+ export function getGlobalStylesChangelist( next, previous ) {
120
115
  const cacheKey = JSON.stringify( { next, previous } );
121
116
 
122
117
  if ( globalStylesChangesCache.has( cacheKey ) ) {
@@ -160,12 +155,12 @@ function getGlobalStylesChangelist( next, previous ) {
160
155
  const result = [ ...new Set( changedValueTree ) ]
161
156
  /*
162
157
  * Translate the keys.
163
- * Remove duplicate or empty translations.
158
+ * Remove empty translations.
164
159
  */
165
160
  .reduce( ( acc, curr ) => {
166
161
  const translation = getTranslation( curr );
167
- if ( translation && ! acc.includes( translation ) ) {
168
- acc.push( translation );
162
+ if ( translation ) {
163
+ acc.push( [ curr.split( '.' )[ 0 ], translation ] );
169
164
  }
170
165
  return acc;
171
166
  }, [] );
@@ -176,29 +171,74 @@ function getGlobalStylesChangelist( next, previous ) {
176
171
  }
177
172
 
178
173
  /**
179
- * From a getGlobalStylesChangelist() result, returns a truncated array of translated changes.
180
- * Appends a translated string indicating the number of changes that were truncated.
174
+ * From a getGlobalStylesChangelist() result, returns an array of translated global styles changes, grouped by type.
175
+ * The types are 'blocks', 'elements', 'settings', and 'styles'.
181
176
  *
182
177
  * @param {Object} next The changed object to compare.
183
178
  * @param {Object} previous The original object to compare against.
184
179
  * @param {{maxResults:number}} options Options. maxResults: results to return before truncating.
185
- * @return {string[]} An array of translated changes.
180
+ * @return {string[]} An array of translated changes.
186
181
  */
187
182
  export default function getGlobalStylesChanges( next, previous, options = {} ) {
188
- const changes = getGlobalStylesChangelist( next, previous );
189
- const changesLength = changes.length;
183
+ let changeList = getGlobalStylesChangelist( next, previous );
184
+ const changesLength = changeList.length;
190
185
  const { maxResults } = options;
191
186
 
192
- // Truncate to `n` results if necessary.
193
- if ( !! maxResults && changesLength && changesLength > maxResults ) {
194
- const deleteCount = changesLength - maxResults;
195
- const andMoreText = sprintf(
196
- // translators: %d: number of global styles changes that are not displayed in the UI.
197
- _n( '…and %d more change', '…and %d more changes', deleteCount ),
198
- deleteCount
199
- );
200
- changes.splice( maxResults, deleteCount, andMoreText );
187
+ if ( changesLength ) {
188
+ // Truncate to `n` results if necessary.
189
+ if ( !! maxResults && changesLength > maxResults ) {
190
+ changeList = changeList.slice( 0, maxResults );
191
+ }
192
+ return Object.entries(
193
+ changeList.reduce( ( acc, curr ) => {
194
+ const group = acc[ curr[ 0 ] ] || [];
195
+ if ( ! group.includes( curr[ 1 ] ) ) {
196
+ acc[ curr[ 0 ] ] = [ ...group, curr[ 1 ] ];
197
+ }
198
+ return acc;
199
+ }, {} )
200
+ ).map( ( [ key, changeValues ] ) => {
201
+ const changeValuesLength = changeValues.length;
202
+ const joinedChangesValue = changeValues.join( __( ', ' ) );
203
+ switch ( key ) {
204
+ case 'blocks': {
205
+ return sprintf(
206
+ // translators: %s: a list of block names separated by a comma.
207
+ _n( '%s block.', '%s blocks.', changeValuesLength ),
208
+ joinedChangesValue
209
+ );
210
+ }
211
+ case 'elements': {
212
+ return sprintf(
213
+ // translators: %s: a list of element names separated by a comma.
214
+ _n( '%s element.', '%s elements.', changeValuesLength ),
215
+ joinedChangesValue
216
+ );
217
+ }
218
+ case 'settings': {
219
+ return sprintf(
220
+ // translators: %s: a list of theme.json setting labels separated by a comma.
221
+ __( '%s settings.' ),
222
+ joinedChangesValue
223
+ );
224
+ }
225
+ case 'styles': {
226
+ return sprintf(
227
+ // translators: %s: a list of theme.json top-level styles labels separated by a comma.
228
+ __( '%s styles.' ),
229
+ joinedChangesValue
230
+ );
231
+ }
232
+ default: {
233
+ return sprintf(
234
+ // translators: %s: a list of global styles changes separated by a comma.
235
+ __( '%s.' ),
236
+ joinedChangesValue
237
+ );
238
+ }
239
+ }
240
+ } );
201
241
  }
202
242
 
203
- return changes;
243
+ return EMPTY_ARRAY;
204
244
  }
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import getGlobalStylesChanges from '../get-global-styles-changes';
4
+ import getGlobalStylesChanges, {
5
+ getGlobalStylesChangelist,
6
+ } from '../get-global-styles-changes';
5
7
 
6
8
  /**
7
9
  * WordPress dependencies
@@ -12,24 +14,8 @@ import {
12
14
  getBlockTypes,
13
15
  } from '@wordpress/blocks';
14
16
 
15
- describe( 'getGlobalStylesChanges', () => {
16
- beforeEach( () => {
17
- registerBlockType( 'core/test-fiori-di-zucca', {
18
- save: () => {},
19
- category: 'text',
20
- title: 'Test pumpkin flowers',
21
- edit: () => {},
22
- } );
23
- } );
24
-
25
- afterEach( () => {
26
- getBlockTypes().forEach( ( block ) => {
27
- unregisterBlockType( block.name );
28
- } );
29
- } );
30
-
31
- const revision = {
32
- id: 10,
17
+ describe( 'getGlobalStylesChanges and utils', () => {
18
+ const next = {
33
19
  styles: {
34
20
  typography: {
35
21
  fontSize: 'var(--wp--preset--font-size--potato)',
@@ -85,11 +71,18 @@ describe( 'getGlobalStylesChanges', () => {
85
71
  },
86
72
  ],
87
73
  },
74
+ gradients: [
75
+ {
76
+ name: 'Something something',
77
+ gradient:
78
+ 'linear-gradient(105deg,rgba(6,147,100,1) 0%,rgb(155,81,100) 100%)',
79
+ slug: 'something-something',
80
+ },
81
+ ],
88
82
  },
89
83
  },
90
84
  };
91
- const previousRevision = {
92
- id: 9,
85
+ const previous = {
93
86
  styles: {
94
87
  typography: {
95
88
  fontSize: 'var(--wp--preset--font-size--fungus)',
@@ -161,74 +154,120 @@ describe( 'getGlobalStylesChanges', () => {
161
154
  color: 'blue',
162
155
  },
163
156
  ],
157
+ custom: [
158
+ {
159
+ slug: 'one',
160
+ color: 'tomato',
161
+ },
162
+ ],
164
163
  },
164
+ gradients: [
165
+ {
166
+ name: 'Vivid cyan blue to vivid purple',
167
+ gradient:
168
+ 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
169
+ slug: 'vivid-cyan-blue-to-vivid-purple',
170
+ },
171
+ ],
172
+ },
173
+ typography: {
174
+ fluid: true,
165
175
  },
166
176
  },
167
177
  };
168
178
 
169
- it( 'returns a list of changes and caches them', () => {
170
- const resultA = getGlobalStylesChanges( revision, previousRevision );
171
- expect( resultA ).toEqual( [
172
- 'Colors',
173
- 'Typography',
174
- 'Test pumpkin flowers',
175
- 'H3 element',
176
- 'Caption element',
177
- 'H6 element',
178
- 'Link element',
179
- 'Color settings',
180
- ] );
181
-
182
- const resultB = getGlobalStylesChanges( revision, previousRevision );
183
-
184
- expect( resultA ).toBe( resultB );
179
+ beforeEach( () => {
180
+ registerBlockType( 'core/test-fiori-di-zucca', {
181
+ save: () => {},
182
+ category: 'text',
183
+ title: 'Test pumpkin flowers',
184
+ edit: () => {},
185
+ } );
185
186
  } );
186
187
 
187
- it( 'returns a list of truncated changes', () => {
188
- const resultA = getGlobalStylesChanges( revision, previousRevision, {
189
- maxResults: 3,
188
+ afterEach( () => {
189
+ getBlockTypes().forEach( ( block ) => {
190
+ unregisterBlockType( block.name );
190
191
  } );
191
- expect( resultA ).toEqual( [
192
- 'Colors',
193
- 'Typography',
194
- 'Test pumpkin flowers',
195
- '…and 5 more changes',
196
- ] );
197
192
  } );
198
193
 
199
- it( 'skips unknown and unchanged keys', () => {
200
- const result = getGlobalStylesChanges(
201
- {
202
- styles: {
203
- frogs: {
204
- legs: 'green',
205
- },
206
- typography: {
207
- fontSize: '1rem',
208
- },
209
- settings: {
210
- '': {
211
- '': 'foo',
194
+ describe( 'getGlobalStylesChanges()', () => {
195
+ it( 'returns a list of changes', () => {
196
+ const result = getGlobalStylesChanges( next, previous );
197
+ expect( result ).toEqual( [
198
+ 'Colors, Typography styles.',
199
+ 'Test pumpkin flowers block.',
200
+ 'H3, Caption, H6, Link elements.',
201
+ 'Color, Typography settings.',
202
+ ] );
203
+ } );
204
+
205
+ it( 'returns a list of truncated changes', () => {
206
+ const resultA = getGlobalStylesChanges( next, previous, {
207
+ maxResults: 3,
208
+ } );
209
+ expect( resultA ).toEqual( [
210
+ 'Colors, Typography styles.',
211
+ 'Test pumpkin flowers block.',
212
+ ] );
213
+ } );
214
+
215
+ it( 'skips unknown and unchanged keys', () => {
216
+ const result = getGlobalStylesChanges(
217
+ {
218
+ styles: {
219
+ frogs: {
220
+ legs: 'green',
221
+ },
222
+ typography: {
223
+ fontSize: '1rem',
224
+ },
225
+ settings: {
226
+ '': {
227
+ '': 'foo',
228
+ },
212
229
  },
213
230
  },
214
231
  },
215
- },
216
- {
217
- styles: {
218
- frogs: {
219
- legs: 'yellow',
220
- },
221
- typography: {
222
- fontSize: '1rem',
223
- },
224
- settings: {
225
- '': {
226
- '': 'bar',
232
+ {
233
+ styles: {
234
+ frogs: {
235
+ legs: 'yellow',
236
+ },
237
+ typography: {
238
+ fontSize: '1rem',
239
+ },
240
+ settings: {
241
+ '': {
242
+ '': 'bar',
243
+ },
227
244
  },
228
245
  },
229
- },
230
- }
231
- );
232
- expect( result ).toEqual( [] );
246
+ }
247
+ );
248
+ expect( result ).toEqual( [] );
249
+ } );
250
+ } );
251
+
252
+ describe( 'getGlobalStylesChangelist()', () => {
253
+ it( 'compares two objects and returns a cached list of changed keys', () => {
254
+ const resultA = getGlobalStylesChangelist( next, previous );
255
+
256
+ expect( resultA ).toEqual( [
257
+ [ 'styles', 'Colors' ],
258
+ [ 'styles', 'Typography' ],
259
+ [ 'blocks', 'Test pumpkin flowers' ],
260
+ [ 'elements', 'H3' ],
261
+ [ 'elements', 'Caption' ],
262
+ [ 'elements', 'H6' ],
263
+ [ 'elements', 'Link' ],
264
+ [ 'settings', 'Color' ],
265
+ [ 'settings', 'Typography' ],
266
+ ] );
267
+
268
+ const resultB = getGlobalStylesChangelist( next, previous );
269
+
270
+ expect( resultB ).toEqual( resultA );
271
+ } );
233
272
  } );
234
273
  } );
@@ -13,7 +13,11 @@ import { useCallback } from '@wordpress/element';
13
13
  /**
14
14
  * Internal dependencies
15
15
  */
16
- import { mergeOrigins, hasMergedOrigins } from '../../store/get-block-settings';
16
+ import {
17
+ mergeOrigins,
18
+ overrideOrigins,
19
+ hasOriginValue,
20
+ } from '../../store/get-block-settings';
17
21
  import FontFamilyControl from '../font-family';
18
22
  import FontAppearanceControl from '../font-appearance-control';
19
23
  import LineHeightControl from '../line-height-control';
@@ -53,13 +57,13 @@ export function useHasTypographyPanel( settings ) {
53
57
 
54
58
  function useHasFontSizeControl( settings ) {
55
59
  return (
56
- hasMergedOrigins( settings?.typography?.fontSizes ) ||
60
+ hasOriginValue( settings?.typography?.fontSizes ) ||
57
61
  settings?.typography?.customFontSize
58
62
  );
59
63
  }
60
64
 
61
65
  function useHasFontFamilyControl( settings ) {
62
- return hasMergedOrigins( settings?.typography?.fontFamilies );
66
+ return hasOriginValue( settings?.typography?.fontFamilies );
63
67
  }
64
68
 
65
69
  function useHasLineHeightControl( settings ) {
@@ -101,10 +105,10 @@ function useHasTextColumnsControl( settings ) {
101
105
  }
102
106
 
103
107
  function getUniqueFontSizesBySlug( settings ) {
104
- const fontSizes = settings?.typography?.fontSizes;
105
- const mergedFontSizes = fontSizes ? mergeOrigins( fontSizes ) : [];
108
+ const fontSizes = settings?.typography?.fontSizes ?? {};
109
+ const overriddenFontSizes = overrideOrigins( fontSizes ) ?? [];
106
110
  const uniqueSizes = [];
107
- for ( const currentSize of mergedFontSizes ) {
111
+ for ( const currentSize of overriddenFontSizes ) {
108
112
  if ( ! uniqueSizes.some( ( { slug } ) => slug === currentSize.slug ) ) {
109
113
  uniqueSizes.push( currentSize );
110
114
  }
@@ -162,7 +166,7 @@ export default function TypographyPanel( {
162
166
 
163
167
  // Font Family
164
168
  const hasFontFamilyEnabled = useHasFontFamilyControl( settings );
165
- const fontFamilies = settings?.typography?.fontFamilies;
169
+ const fontFamilies = settings?.typography?.fontFamilies ?? {};
166
170
  const mergedFontFamilies = fontFamilies ? mergeOrigins( fontFamilies ) : [];
167
171
  const fontFamily = decodeValue( inheritedValue?.typography?.fontFamily );
168
172
  const setFontFamily = ( newValue ) => {
@@ -273,13 +273,16 @@ function Iframe( {
273
273
  src={ src }
274
274
  title={ __( 'Editor canvas' ) }
275
275
  onKeyDown={ ( event ) => {
276
+ if ( props.onKeyDown ) {
277
+ props.onKeyDown( event );
278
+ }
276
279
  // If the event originates from inside the iframe, it means
277
280
  // it bubbled through the portal, but only with React
278
281
  // events. We need to to bubble native events as well,
279
282
  // though by doing so we also trigger another React event,
280
283
  // so we need to stop the propagation of this event to avoid
281
284
  // duplication.
282
- if (
285
+ else if (
283
286
  event.currentTarget.ownerDocument !==
284
287
  event.target.ownerDocument
285
288
  ) {
@@ -340,13 +340,6 @@ $block-editor-link-control-number-of-actions: 1;
340
340
  }
341
341
  }
342
342
 
343
- .block-editor-link-control__drawer {
344
- display: flex; // allow for ordering.
345
- order: 30;
346
- flex-direction: column;
347
- flex-basis: 100%; // occupy full width.
348
- }
349
-
350
343
  // Inner div required to avoid padding/margin
351
344
  // causing janky animation.
352
345
  .block-editor-link-control__drawer-inner {
@@ -316,6 +316,7 @@ export function RichTextWrapper(
316
316
  transformation.transform( { content: value.text } ),
317
317
  ] );
318
318
  __unstableMarkAutomaticChange();
319
+ return;
319
320
  }
320
321
  }
321
322
 
@@ -61,6 +61,7 @@ export function useEnter( props ) {
61
61
  } ),
62
62
  ] );
63
63
  __unstableMarkAutomaticChange();
64
+ return;
64
65
  }
65
66
  }
66
67
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { useRef } from '@wordpress/element';
5
5
  import { useRefEffect } from '@wordpress/compose';
6
- import { insert, isCollapsed, toHTMLString } from '@wordpress/rich-text';
6
+ import { insert, toHTMLString } from '@wordpress/rich-text';
7
7
  import { getBlockTransforms, findTransform } from '@wordpress/blocks';
8
8
  import { useDispatch } from '@wordpress/data';
9
9
 
@@ -47,34 +47,6 @@ function findSelection( blocks ) {
47
47
  return [];
48
48
  }
49
49
 
50
- /**
51
- * An input rule that replaces two spaces with an en space, and an en space
52
- * followed by a space with an em space.
53
- *
54
- * @param {Object} value Value to replace spaces in.
55
- *
56
- * @return {Object} Value with spaces replaced.
57
- */
58
- function replacePrecedingSpaces( value ) {
59
- if ( ! isCollapsed( value ) ) {
60
- return value;
61
- }
62
-
63
- const { text, start } = value;
64
- const lastTwoCharacters = text.slice( start - 2, start );
65
-
66
- // Replace two spaces with an em space.
67
- if ( lastTwoCharacters === ' ' ) {
68
- return insert( value, '\u2002', start - 2, start );
69
- }
70
- // Replace an en space followed by a space with an em space.
71
- else if ( lastTwoCharacters === '\u2002 ' ) {
72
- return insert( value, '\u2003', start - 2, start );
73
- }
74
-
75
- return value;
76
- }
77
-
78
50
  export function useInputRules( props ) {
79
51
  const {
80
52
  __unstableMarkLastChangeAsPersistent,
@@ -155,7 +127,7 @@ export function useInputRules( props ) {
155
127
 
156
128
  return accumlator;
157
129
  },
158
- preventEventDiscovery( replacePrecedingSpaces( value ) )
130
+ preventEventDiscovery( value )
159
131
  );
160
132
 
161
133
  if ( transformed !== value ) {
@@ -18,10 +18,6 @@ $input-size: 300px;
18
18
  margin-left: 0;
19
19
  margin-right: 0;
20
20
 
21
- &:not(:focus) {
22
- border-color: transparent;
23
- }
24
-
25
21
  /* Fonts smaller than 16px causes mobile safari to zoom. */
26
22
  font-size: $mobile-text-min-font-size;
27
23
  @include break-small {