@wordpress/edit-site 5.28.1 → 5.28.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 (56) hide show
  1. package/build/components/global-styles/font-library-modal/context.js +1 -1
  2. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  3. package/build/components/global-styles/font-library-modal/utils/index.js +1 -1
  4. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  5. package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js +14 -1
  6. package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +1 -1
  7. package/build/components/global-styles/font-library-modal/utils/preview-styles.js +64 -8
  8. package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  9. package/build/components/global-styles/screen-revisions/revisions-buttons.js +6 -4
  10. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  11. package/build/components/media/index.js +3 -3
  12. package/build/components/media/index.js.map +1 -1
  13. package/build/components/sidebar/index.js +7 -2
  14. package/build/components/sidebar/index.js.map +1 -1
  15. package/build/components/sidebar-dataviews/default-views.js +1 -1
  16. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  17. package/build/hooks/commands/use-edit-mode-commands.js +8 -8
  18. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  19. package/build-module/components/global-styles/font-library-modal/context.js +1 -1
  20. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  21. package/build-module/components/global-styles/font-library-modal/utils/index.js +2 -2
  22. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  23. package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js +13 -1
  24. package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +1 -1
  25. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +63 -8
  26. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  27. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +6 -4
  28. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  29. package/build-module/components/media/index.js +3 -3
  30. package/build-module/components/media/index.js.map +1 -1
  31. package/build-module/components/sidebar/index.js +7 -2
  32. package/build-module/components/sidebar/index.js.map +1 -1
  33. package/build-module/components/sidebar-dataviews/default-views.js +2 -2
  34. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  35. package/build-module/hooks/commands/use-edit-mode-commands.js +8 -8
  36. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  37. package/build-style/style-rtl.css +9 -8
  38. package/build-style/style.css +9 -8
  39. package/package.json +42 -42
  40. package/src/components/global-styles/font-library-modal/context.js +1 -1
  41. package/src/components/global-styles/font-library-modal/utils/index.js +2 -2
  42. package/src/components/global-styles/font-library-modal/utils/make-families-from-faces.js +13 -1
  43. package/src/components/global-styles/font-library-modal/utils/preview-styles.js +72 -15
  44. package/src/components/global-styles/font-library-modal/utils/test/preview-styles.spec.js +60 -5
  45. package/src/components/global-styles/screen-revisions/revisions-buttons.js +7 -5
  46. package/src/components/global-styles/screen-revisions/style.scss +11 -6
  47. package/src/components/media/index.js +7 -9
  48. package/src/components/sidebar/index.js +7 -2
  49. package/src/components/sidebar-dataviews/default-views.js +2 -2
  50. package/src/components/sidebar-edit-mode/page-panels/style.scss +0 -1
  51. package/src/hooks/commands/use-edit-mode-commands.js +14 -14
  52. package/build/components/sidebar-navigation-screen-pages-dataviews/index.js +0 -92
  53. package/build/components/sidebar-navigation-screen-pages-dataviews/index.js.map +0 -1
  54. package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js +0 -84
  55. package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js.map +0 -1
  56. package/src/components/sidebar-navigation-screen-pages-dataviews/index.js +0 -103
@@ -1806,7 +1806,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1806
1806
  .edit-site-global-styles-screen-revisions__revision-item.is-selected::before {
1807
1807
  background: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
1808
1808
  }
1809
- .edit-site-global-styles-screen-revisions__revision-item.is-selected .edit-site-global-styles-screen-revisions__changes,
1809
+ .edit-site-global-styles-screen-revisions__revision-item.is-selected .edit-site-global-styles-screen-revisions__changes > li,
1810
1810
  .edit-site-global-styles-screen-revisions__revision-item.is-selected .edit-site-global-styles-screen-revisions__meta,
1811
1811
  .edit-site-global-styles-screen-revisions__revision-item.is-selected .edit-site-global-styles-screen-revisions__applied-text {
1812
1812
  color: #1e1e1e;
@@ -1828,7 +1828,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1828
1828
  width: 100%;
1829
1829
  height: auto;
1830
1830
  display: block;
1831
- padding: 12px 40px 8px 12px;
1831
+ padding: 12px 40px 4px 12px;
1832
1832
  z-index: 1;
1833
1833
  position: relative;
1834
1834
  outline-offset: -2px;
@@ -1837,7 +1837,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1837
1837
  .edit-site-global-styles-screen-revisions__apply-button.is-primary,
1838
1838
  .edit-site-global-styles-screen-revisions__applied-text {
1839
1839
  align-self: flex-start;
1840
- margin: 0 40px 12px 12px;
1840
+ margin: 4px 40px 12px 12px;
1841
1841
  }
1842
1842
 
1843
1843
  .edit-site-global-styles-screen-revisions__changes,
@@ -1859,15 +1859,14 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1859
1859
  font-size: 12px;
1860
1860
  }
1861
1861
 
1862
- .edit-site-global-styles-screen-revisions__changes,
1863
1862
  .edit-site-global-styles-screen-revisions__meta {
1864
1863
  display: flex;
1865
1864
  justify-content: start;
1866
1865
  width: 100%;
1867
1866
  align-items: flex-start;
1868
1867
  text-align: right;
1868
+ margin-bottom: 4px;
1869
1869
  }
1870
- .edit-site-global-styles-screen-revisions__changes img,
1871
1870
  .edit-site-global-styles-screen-revisions__meta img {
1872
1871
  width: 16px;
1873
1872
  height: 16px;
@@ -1880,10 +1879,13 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1880
1879
  }
1881
1880
 
1882
1881
  .edit-site-global-styles-screen-revisions__changes {
1883
- margin-bottom: 4px;
1884
1882
  text-align: right;
1885
- color: #1e1e1e;
1886
1883
  line-height: 1.4;
1884
+ margin-right: 12px;
1885
+ list-style: disc;
1886
+ }
1887
+ .edit-site-global-styles-screen-revisions__changes li {
1888
+ margin-bottom: 4px;
1887
1889
  }
1888
1890
 
1889
1891
  .edit-site-global-styles-screen-revisions__pagination.edit-site-global-styles-screen-revisions__pagination {
@@ -2856,7 +2858,6 @@ body.is-fullscreen-mode .edit-site-list-header {
2856
2858
  }
2857
2859
  .edit-site-change-status__content .edit-site-change-status__options label .components-text {
2858
2860
  display: block;
2859
- margin-right: 26px;
2860
2861
  }
2861
2862
  .edit-site-change-status__content .edit-site-change-status__password-legend {
2862
2863
  padding: 0;
@@ -1807,7 +1807,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1807
1807
  .edit-site-global-styles-screen-revisions__revision-item.is-selected::before {
1808
1808
  background: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
1809
1809
  }
1810
- .edit-site-global-styles-screen-revisions__revision-item.is-selected .edit-site-global-styles-screen-revisions__changes,
1810
+ .edit-site-global-styles-screen-revisions__revision-item.is-selected .edit-site-global-styles-screen-revisions__changes > li,
1811
1811
  .edit-site-global-styles-screen-revisions__revision-item.is-selected .edit-site-global-styles-screen-revisions__meta,
1812
1812
  .edit-site-global-styles-screen-revisions__revision-item.is-selected .edit-site-global-styles-screen-revisions__applied-text {
1813
1813
  color: #1e1e1e;
@@ -1829,7 +1829,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1829
1829
  width: 100%;
1830
1830
  height: auto;
1831
1831
  display: block;
1832
- padding: 12px 12px 8px 40px;
1832
+ padding: 12px 12px 4px 40px;
1833
1833
  z-index: 1;
1834
1834
  position: relative;
1835
1835
  outline-offset: -2px;
@@ -1838,7 +1838,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1838
1838
  .edit-site-global-styles-screen-revisions__apply-button.is-primary,
1839
1839
  .edit-site-global-styles-screen-revisions__applied-text {
1840
1840
  align-self: flex-start;
1841
- margin: 0 12px 12px 40px;
1841
+ margin: 4px 12px 12px 40px;
1842
1842
  }
1843
1843
 
1844
1844
  .edit-site-global-styles-screen-revisions__changes,
@@ -1860,15 +1860,14 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1860
1860
  font-size: 12px;
1861
1861
  }
1862
1862
 
1863
- .edit-site-global-styles-screen-revisions__changes,
1864
1863
  .edit-site-global-styles-screen-revisions__meta {
1865
1864
  display: flex;
1866
1865
  justify-content: start;
1867
1866
  width: 100%;
1868
1867
  align-items: flex-start;
1869
1868
  text-align: left;
1869
+ margin-bottom: 4px;
1870
1870
  }
1871
- .edit-site-global-styles-screen-revisions__changes img,
1872
1871
  .edit-site-global-styles-screen-revisions__meta img {
1873
1872
  width: 16px;
1874
1873
  height: 16px;
@@ -1881,10 +1880,13 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1881
1880
  }
1882
1881
 
1883
1882
  .edit-site-global-styles-screen-revisions__changes {
1884
- margin-bottom: 4px;
1885
1883
  text-align: left;
1886
- color: #1e1e1e;
1887
1884
  line-height: 1.4;
1885
+ margin-left: 12px;
1886
+ list-style: disc;
1887
+ }
1888
+ .edit-site-global-styles-screen-revisions__changes li {
1889
+ margin-bottom: 4px;
1888
1890
  }
1889
1891
 
1890
1892
  .edit-site-global-styles-screen-revisions__pagination.edit-site-global-styles-screen-revisions__pagination {
@@ -2857,7 +2859,6 @@ body.is-fullscreen-mode .edit-site-list-header {
2857
2859
  }
2858
2860
  .edit-site-change-status__content .edit-site-change-status__options label .components-text {
2859
2861
  display: block;
2860
- margin-left: 26px;
2861
2862
  }
2862
2863
  .edit-site-change-status__content .edit-site-change-status__password-legend {
2863
2864
  padding: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "5.28.1",
3
+ "version": "5.28.2",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,46 +27,46 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.51.0",
31
- "@wordpress/api-fetch": "^6.48.0",
32
- "@wordpress/blob": "^3.51.0",
33
- "@wordpress/block-editor": "^12.19.1",
34
- "@wordpress/block-library": "^8.28.1",
35
- "@wordpress/blocks": "^12.28.1",
36
- "@wordpress/commands": "^0.22.1",
37
- "@wordpress/components": "^26.0.1",
38
- "@wordpress/compose": "^6.28.0",
39
- "@wordpress/core-commands": "^0.20.1",
40
- "@wordpress/core-data": "^6.28.1",
41
- "@wordpress/data": "^9.21.0",
42
- "@wordpress/dataviews": "^0.5.1",
43
- "@wordpress/date": "^4.51.0",
44
- "@wordpress/deprecated": "^3.51.0",
45
- "@wordpress/dom": "^3.51.0",
46
- "@wordpress/editor": "^13.28.1",
47
- "@wordpress/element": "^5.28.0",
48
- "@wordpress/escape-html": "^2.51.0",
49
- "@wordpress/hooks": "^3.51.0",
50
- "@wordpress/html-entities": "^3.51.0",
51
- "@wordpress/i18n": "^4.51.0",
52
- "@wordpress/icons": "^9.42.0",
53
- "@wordpress/interface": "^5.28.1",
54
- "@wordpress/keyboard-shortcuts": "^4.28.0",
55
- "@wordpress/keycodes": "^3.51.0",
56
- "@wordpress/media-utils": "^4.42.0",
57
- "@wordpress/notices": "^4.19.0",
58
- "@wordpress/patterns": "^1.12.1",
59
- "@wordpress/plugins": "^6.19.1",
60
- "@wordpress/preferences": "^3.28.1",
61
- "@wordpress/primitives": "^3.49.0",
62
- "@wordpress/private-apis": "^0.33.0",
63
- "@wordpress/reusable-blocks": "^4.28.1",
64
- "@wordpress/router": "^0.20.0",
65
- "@wordpress/style-engine": "^1.34.0",
66
- "@wordpress/url": "^3.52.0",
67
- "@wordpress/viewport": "^5.28.0",
68
- "@wordpress/widgets": "^3.28.1",
69
- "@wordpress/wordcount": "^3.51.0",
30
+ "@wordpress/a11y": "^3.51.1",
31
+ "@wordpress/api-fetch": "^6.48.1",
32
+ "@wordpress/blob": "^3.51.1",
33
+ "@wordpress/block-editor": "^12.19.2",
34
+ "@wordpress/block-library": "^8.28.2",
35
+ "@wordpress/blocks": "^12.28.2",
36
+ "@wordpress/commands": "^0.22.2",
37
+ "@wordpress/components": "^26.0.2",
38
+ "@wordpress/compose": "^6.28.1",
39
+ "@wordpress/core-commands": "^0.20.2",
40
+ "@wordpress/core-data": "^6.28.2",
41
+ "@wordpress/data": "^9.21.1",
42
+ "@wordpress/dataviews": "^0.5.2",
43
+ "@wordpress/date": "^4.51.1",
44
+ "@wordpress/deprecated": "^3.51.1",
45
+ "@wordpress/dom": "^3.51.1",
46
+ "@wordpress/editor": "^13.28.2",
47
+ "@wordpress/element": "^5.28.1",
48
+ "@wordpress/escape-html": "^2.51.1",
49
+ "@wordpress/hooks": "^3.51.1",
50
+ "@wordpress/html-entities": "^3.51.1",
51
+ "@wordpress/i18n": "^4.51.1",
52
+ "@wordpress/icons": "^9.42.1",
53
+ "@wordpress/interface": "^5.28.2",
54
+ "@wordpress/keyboard-shortcuts": "^4.28.1",
55
+ "@wordpress/keycodes": "^3.51.1",
56
+ "@wordpress/media-utils": "^4.42.1",
57
+ "@wordpress/notices": "^4.19.1",
58
+ "@wordpress/patterns": "^1.12.2",
59
+ "@wordpress/plugins": "^6.19.2",
60
+ "@wordpress/preferences": "^3.28.2",
61
+ "@wordpress/primitives": "^3.49.1",
62
+ "@wordpress/private-apis": "^0.33.1",
63
+ "@wordpress/reusable-blocks": "^4.28.2",
64
+ "@wordpress/router": "^0.20.1",
65
+ "@wordpress/style-engine": "^1.34.1",
66
+ "@wordpress/url": "^3.52.1",
67
+ "@wordpress/viewport": "^5.28.1",
68
+ "@wordpress/widgets": "^3.28.2",
69
+ "@wordpress/wordcount": "^3.51.1",
70
70
  "change-case": "^4.1.2",
71
71
  "classnames": "^2.3.1",
72
72
  "colord": "^2.9.2",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "5902fc0f490528da6965dd4cf97f11192bcf5956"
88
+ "gitHead": "730beb7fd33d3382d6032c3f33e451625a0fcf36"
89
89
  }
@@ -392,7 +392,7 @@ function FontLibraryProvider( { children } ) {
392
392
  loadFontFaceInBrowser(
393
393
  face,
394
394
  getDisplaySrcFromFontFace( face.src ),
395
- 'iframe'
395
+ 'all'
396
396
  );
397
397
  } );
398
398
  }
@@ -9,7 +9,7 @@ import { privateApis as componentsPrivateApis } from '@wordpress/components';
9
9
  import { FONT_WEIGHTS, FONT_STYLES } from './constants';
10
10
  import { unlock } from '../../../../lock-unlock';
11
11
  import { fetchInstallFontFace } from '../resolvers';
12
- import { formatFontFamily } from './preview-styles';
12
+ import { formatFontFaceName } from './preview-styles';
13
13
 
14
14
  /**
15
15
  * Browser dependencies
@@ -99,7 +99,7 @@ export async function loadFontFaceInBrowser( fontFace, source, addTo = 'all' ) {
99
99
  }
100
100
 
101
101
  const newFont = new window.FontFace(
102
- formatFontFamily( fontFace.fontFamily ),
102
+ formatFontFaceName( fontFace.fontFamily ),
103
103
  dataSource,
104
104
  {
105
105
  style: fontFace.fontStyle,
@@ -1,10 +1,22 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { privateApis as componentsPrivateApis } from '@wordpress/components';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { unlock } from '../../../../lock-unlock';
10
+
11
+ const { kebabCase } = unlock( componentsPrivateApis );
12
+
1
13
  export default function makeFamiliesFromFaces( fontFaces ) {
2
14
  const fontFamiliesObject = fontFaces.reduce( ( acc, item ) => {
3
15
  if ( ! acc[ item.fontFamily ] ) {
4
16
  acc[ item.fontFamily ] = {
5
17
  name: item.fontFamily,
6
18
  fontFamily: item.fontFamily,
7
- slug: item.fontFamily.replace( /\s+/g, '-' ).toLowerCase(),
19
+ slug: kebabCase( item.fontFamily.toLowerCase() ),
8
20
  fontFace: [],
9
21
  };
10
22
  }
@@ -30,22 +30,79 @@ function extractFontWeights( fontFaces ) {
30
30
  return result;
31
31
  }
32
32
 
33
+ /*
34
+ * Format the font family to use in the CSS font-family property of a CSS rule.
35
+ *
36
+ * The input can be a string with the font family name or a string with multiple font family names separated by commas.
37
+ * It follows the recommendations from the CSS Fonts Module Level 4.
38
+ * https://www.w3.org/TR/css-fonts-4/#font-family-prop
39
+ *
40
+ * @param {string} input - The font family.
41
+ * @return {string} The formatted font family.
42
+ *
43
+ * Example:
44
+ * formatFontFamily( "Open Sans, Font+Name, sans-serif" ) => '"Open Sans", "Font+Name", sans-serif'
45
+ * formatFontFamily( "'Open Sans', generic(kai), sans-serif" ) => '"Open Sans", sans-serif'
46
+ * formatFontFamily( "DotGothic16, Slabo 27px, serif" ) => '"DotGothic16","Slabo 27px",serif'
47
+ * formatFontFamily( "Mine's, Moe's Typography" ) => `"mine's","Moe's Typography"`
48
+ */
33
49
  export function formatFontFamily( input ) {
34
- return input
35
- .split( ',' )
36
- .map( ( font ) => {
37
- font = font.trim(); // Remove any leading or trailing white spaces
38
- // If the font doesn't start with quotes and contains a space, then wrap in quotes.
39
- // Check that string starts with a single or double quote and not a space
40
- if (
41
- ! ( font.startsWith( '"' ) || font.startsWith( "'" ) ) &&
42
- font.indexOf( ' ' ) !== -1
43
- ) {
44
- return `"${ font }"`;
45
- }
46
- return font; // Return font as is if no transformation is needed
47
- } )
48
- .join( ', ' );
50
+ // Matches strings that are not exclusively alphabetic characters or hyphens, and do not exactly follow the pattern generic(alphabetic characters or hyphens).
51
+ const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/;
52
+ const output = input.trim();
53
+
54
+ const formatItem = ( item ) => {
55
+ item = item.trim();
56
+ if ( item.match( regex ) ) {
57
+ // removes leading and trailing quotes.
58
+ item = item.replace( /^["']|["']$/g, '' );
59
+ return `"${ item }"`;
60
+ }
61
+ return item;
62
+ };
63
+
64
+ if ( output.includes( ',' ) ) {
65
+ return output
66
+ .split( ',' )
67
+ .map( formatItem )
68
+ .filter( ( item ) => item !== '' )
69
+ .join( ', ' );
70
+ }
71
+
72
+ return formatItem( output );
73
+ }
74
+
75
+ /*
76
+ * Format the font face name to use in the font-family property of a font face.
77
+ *
78
+ * The input can be a string with the font face name or a string with multiple font face names separated by commas.
79
+ * It removes the leading and trailing quotes from the font face name.
80
+ *
81
+ * @param {string} input - The font face name.
82
+ * @return {string} The formatted font face name.
83
+ *
84
+ * Example:
85
+ * formatFontFaceName("Open Sans") => "Open Sans"
86
+ * formatFontFaceName("'Open Sans', sans-serif") => "Open Sans"
87
+ * formatFontFaceName(", 'Open Sans', 'Helvetica Neue', sans-serif") => "Open Sans"
88
+ */
89
+ export function formatFontFaceName( input ) {
90
+ let output = input.trim();
91
+ if ( output.includes( ',' ) ) {
92
+ output = output
93
+ .split( ',' )
94
+ // finds the first item that is not an empty string.
95
+ .find( ( item ) => item.trim() !== '' )
96
+ .trim();
97
+ }
98
+ // removes leading and trailing quotes.
99
+ output = output.replace( /^["']|["']$/g, '' );
100
+
101
+ // Firefox needs the font name to be wrapped in double quotes meanwhile other browsers don't.
102
+ if ( window.navigator.userAgent.toLowerCase().includes( 'firefox' ) ) {
103
+ output = `"${ output }"`;
104
+ }
105
+ return output;
49
106
  }
50
107
 
51
108
  export function getFamilyPreviewStyle( family ) {
@@ -1,7 +1,11 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { getFamilyPreviewStyle, formatFontFamily } from '../preview-styles';
4
+ import {
5
+ getFamilyPreviewStyle,
6
+ formatFontFamily,
7
+ formatFontFaceName,
8
+ } from '../preview-styles';
5
9
 
6
10
  describe( 'getFamilyPreviewStyle', () => {
7
11
  it( 'should return default fontStyle and fontWeight if fontFace is not provided', () => {
@@ -139,7 +143,7 @@ describe( 'formatFontFamily', () => {
139
143
  "Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro, sans-serif"
140
144
  )
141
145
  ).toBe(
142
- "Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro, sans-serif"
146
+ 'Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", source-sans-pro, sans-serif'
143
147
  );
144
148
  } );
145
149
 
@@ -153,9 +157,60 @@ describe( 'formatFontFamily', () => {
153
157
  );
154
158
  } );
155
159
 
156
- it( 'should wrap only those font names with spaces which are not already quoted', () => {
157
- expect( formatFontFamily( 'Baloo Bhai 2, Arial' ) ).toBe(
158
- '"Baloo Bhai 2", Arial'
160
+ it( 'should wrap names with special characters in quotes', () => {
161
+ expect(
162
+ formatFontFamily(
163
+ 'Font+Name, Font*Name, _Font_Name_, generic(kai), sans-serif'
164
+ )
165
+ ).toBe(
166
+ '"Font+Name", "Font*Name", "_Font_Name_", generic(kai), sans-serif'
167
+ );
168
+ } );
169
+
170
+ it( 'should fix empty wrong formatted font family', () => {
171
+ expect( formatFontFamily( ', Abril Fatface,Times,serif' ) ).toBe(
172
+ '"Abril Fatface", Times, serif'
173
+ );
174
+ } );
175
+
176
+ it( 'should not add quotes to generic names', () => {
177
+ expect(
178
+ formatFontFamily(
179
+ 'Paren(thesis)Font, generic(kai), generic(fasongsong), generic( abc ), Helvetica Neue'
180
+ )
181
+ ).toBe(
182
+ '"Paren(thesis)Font", generic(kai), generic(fasongsong), generic( abc ), "Helvetica Neue"'
159
183
  );
160
184
  } );
161
185
  } );
186
+
187
+ describe( 'formatFontFaceName', () => {
188
+ it( 'should remove leading and trailing quotes', () => {
189
+ expect( formatFontFaceName( '"Open Sans"' ) ).toBe( 'Open Sans' );
190
+ } );
191
+
192
+ it( 'should remove leading and trailing quotes from multiple font face names', () => {
193
+ expect(
194
+ formatFontFaceName( "'Open Sans', 'Helvetica Neue', sans-serif" )
195
+ ).toBe( 'Open Sans' );
196
+ } );
197
+
198
+ it( 'should remove leading and trailing quotes even from names with spaces and special characters', () => {
199
+ expect( formatFontFaceName( "'Font+Name 24', sans-serif" ) ).toBe(
200
+ 'Font+Name 24'
201
+ );
202
+ } );
203
+
204
+ it( 'should ouput the font face name with quotes on Firefox', () => {
205
+ const mockUserAgent =
206
+ 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0';
207
+
208
+ // Mock the userAgent for this test
209
+ Object.defineProperty( window.navigator, 'userAgent', {
210
+ value: mockUserAgent,
211
+ configurable: true,
212
+ } );
213
+
214
+ expect( formatFontFaceName( 'Open Sans' ) ).toBe( '"Open Sans"' );
215
+ } );
216
+ } );
@@ -25,19 +25,20 @@ function ChangesSummary( { revision, previousRevision } ) {
25
25
  const changes = getGlobalStylesChanges( revision, previousRevision, {
26
26
  maxResults: 7,
27
27
  } );
28
- const changesLength = changes.length;
29
28
 
30
- if ( ! changesLength ) {
29
+ if ( ! changes.length ) {
31
30
  return null;
32
31
  }
33
32
 
34
33
  return (
35
- <span
34
+ <ul
36
35
  data-testid="global-styles-revision-changes"
37
36
  className="edit-site-global-styles-screen-revisions__changes"
38
37
  >
39
- { changes.join( ', ' ) }.
40
- </span>
38
+ { changes.map( ( change ) => (
39
+ <li key={ change }>{ change }</li>
40
+ ) ) }
41
+ </ul>
41
42
  );
42
43
  }
43
44
 
@@ -219,6 +220,7 @@ function RevisionsButtons( {
219
220
  ) : (
220
221
  <Button
221
222
  disabled={ areStylesEqual }
223
+ size="compact"
222
224
  variant="primary"
223
225
  className="edit-site-global-styles-screen-revisions__apply-button"
224
226
  onClick={ onApplyRevision }
@@ -64,7 +64,7 @@
64
64
  background: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
65
65
  }
66
66
 
67
- .edit-site-global-styles-screen-revisions__changes,
67
+ .edit-site-global-styles-screen-revisions__changes > li,
68
68
  .edit-site-global-styles-screen-revisions__meta,
69
69
  .edit-site-global-styles-screen-revisions__applied-text {
70
70
  color: $gray-900;
@@ -92,7 +92,7 @@
92
92
  width: 100%;
93
93
  height: auto;
94
94
  display: block;
95
- padding: $grid-unit-15 $grid-unit-15 $grid-unit-10 $grid-unit-50;
95
+ padding: $grid-unit-15 $grid-unit-15 $grid-unit-05 $grid-unit-50;
96
96
  z-index: 1;
97
97
  position: relative;
98
98
  outline-offset: -2px;
@@ -103,7 +103,7 @@
103
103
  .edit-site-global-styles-screen-revisions__applied-text {
104
104
  align-self: flex-start;
105
105
  // Left margin = left padding of .edit-site-global-styles-screen-revisions__revision-button.
106
- margin: 0 $grid-unit-15 $grid-unit-15 $grid-unit-50;
106
+ margin: $grid-unit-05 $grid-unit-15 $grid-unit-15 $grid-unit-50;
107
107
  }
108
108
 
109
109
  .edit-site-global-styles-screen-revisions__changes,
@@ -125,13 +125,14 @@
125
125
  }
126
126
  }
127
127
 
128
- .edit-site-global-styles-screen-revisions__changes,
129
128
  .edit-site-global-styles-screen-revisions__meta {
130
129
  display: flex;
131
130
  justify-content: start;
132
131
  width: 100%;
133
132
  align-items: flex-start;
134
133
  text-align: left;
134
+ margin-bottom: $grid-unit-05;
135
+
135
136
  img {
136
137
  width: $grid-unit-20;
137
138
  height: $grid-unit-20;
@@ -145,10 +146,14 @@
145
146
  }
146
147
 
147
148
  .edit-site-global-styles-screen-revisions__changes {
148
- margin-bottom: $grid-unit-05;
149
149
  text-align: left;
150
- color: $gray-900;
151
150
  line-height: $default-line-height;
151
+ margin-left: $grid-unit-15;
152
+ list-style: disc;
153
+
154
+ li {
155
+ margin-bottom: $grid-unit-05;
156
+ }
152
157
  }
153
158
 
154
159
  .edit-site-global-styles-screen-revisions__pagination.edit-site-global-styles-screen-revisions__pagination {
@@ -8,18 +8,16 @@ function Media( { id, size = [ 'large', 'medium', 'thumbnail' ], ...props } ) {
8
8
  const currentSize = size.find(
9
9
  ( s ) => !! media?.media_details?.sizes[ s ]
10
10
  );
11
- const mediaDetails = media?.media_details?.sizes[ currentSize ];
12
- if ( ! mediaDetails ) {
11
+
12
+ const mediaUrl =
13
+ media?.media_details?.sizes[ currentSize ]?.source_url ||
14
+ media?.source_url;
15
+
16
+ if ( ! mediaUrl ) {
13
17
  return null;
14
18
  }
15
19
 
16
- return (
17
- <img
18
- { ...props }
19
- src={ mediaDetails.source_url }
20
- alt={ media.alt_text }
21
- />
22
- );
20
+ return <img { ...props } src={ mediaUrl } alt={ media.alt_text } />;
23
21
  }
24
22
 
25
23
  export default Media;
@@ -12,6 +12,7 @@ import {
12
12
  __experimentalNavigatorScreen as NavigatorScreen,
13
13
  } from '@wordpress/components';
14
14
  import { privateApis as routerPrivateApis } from '@wordpress/router';
15
+ import { __ } from '@wordpress/i18n';
15
16
 
16
17
  /**
17
18
  * Internal dependencies
@@ -31,7 +32,8 @@ import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen
31
32
  import SaveHub from '../save-hub';
32
33
  import { unlock } from '../../lock-unlock';
33
34
  import SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';
34
- import SidebarNavigationScreenPagesDataViews from '../sidebar-navigation-screen-pages-dataviews';
35
+ import SidebarNavigationScreen from '../sidebar-navigation-screen';
36
+ import DataViewsSidebarContent from '../sidebar-dataviews';
35
37
  import SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';
36
38
 
37
39
  const { useLocation } = unlock( routerPrivateApis );
@@ -69,7 +71,10 @@ function SidebarScreens() {
69
71
  <SidebarNavigationScreenPages />
70
72
  </SidebarScreenWrapper>
71
73
  <SidebarScreenWrapper path="/pages">
72
- <SidebarNavigationScreenPagesDataViews />
74
+ <SidebarNavigationScreen
75
+ title={ __( 'Pages' ) }
76
+ content={ <DataViewsSidebarContent /> }
77
+ />
73
78
  </SidebarScreenWrapper>
74
79
  <SidebarScreenWrapper path="/page/:postId">
75
80
  <SidebarNavigationScreenPage />
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __, _x } from '@wordpress/i18n';
4
+ import { __ } from '@wordpress/i18n';
5
5
  import { trash } from '@wordpress/icons';
6
6
 
7
7
  /**
@@ -49,7 +49,7 @@ const DEFAULT_PAGE_BASE = {
49
49
  export const DEFAULT_VIEWS = {
50
50
  page: [
51
51
  {
52
- title: _x( 'All', 'pages' ),
52
+ title: __( 'All pages' ),
53
53
  slug: 'all',
54
54
  view: DEFAULT_PAGE_BASE,
55
55
  },
@@ -18,7 +18,6 @@
18
18
  label {
19
19
  .components-text {
20
20
  display: block;
21
- margin-left: $radio-input-size + 6;
22
21
  }
23
22
  }
24
23
  }