@wordpress/block-editor 12.19.1 → 12.19.3

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 (130) hide show
  1. package/build/components/block-tools/insertion-point.js +4 -1
  2. package/build/components/block-tools/insertion-point.js.map +1 -1
  3. package/build/components/global-styles/advanced-panel.js +5 -10
  4. package/build/components/global-styles/advanced-panel.js.map +1 -1
  5. package/build/components/global-styles/border-panel.js +4 -3
  6. package/build/components/global-styles/border-panel.js.map +1 -1
  7. package/build/components/global-styles/get-global-styles-changes.js +61 -24
  8. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  9. package/build/components/global-styles/shadow-panel-components.js +3 -3
  10. package/build/components/global-styles/shadow-panel-components.js.map +1 -1
  11. package/build/components/global-styles/typography-panel.js +8 -6
  12. package/build/components/global-styles/typography-panel.js.map +1 -1
  13. package/build/components/iframe/index.js +4 -1
  14. package/build/components/iframe/index.js.map +1 -1
  15. package/build/components/inserter/media-tab/media-preview.js +1 -1
  16. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  17. package/build/components/rich-text/index.js +7 -3
  18. package/build/components/rich-text/index.js.map +1 -1
  19. package/build/components/rich-text/index.native.js +1 -0
  20. package/build/components/rich-text/index.native.js.map +1 -1
  21. package/build/components/rich-text/use-enter.js +1 -0
  22. package/build/components/rich-text/use-enter.js.map +1 -1
  23. package/build/components/rich-text/use-paste-handler.js +25 -26
  24. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  25. package/build/hooks/background.js +4 -2
  26. package/build/hooks/background.js.map +1 -1
  27. package/build/hooks/use-bindings-attributes.js +0 -17
  28. package/build/hooks/use-bindings-attributes.js.map +1 -1
  29. package/build/hooks/utils.js +8 -4
  30. package/build/hooks/utils.js.map +1 -1
  31. package/build/private-apis.js +3 -1
  32. package/build/private-apis.js.map +1 -1
  33. package/build/store/get-block-settings.js +17 -4
  34. package/build/store/get-block-settings.js.map +1 -1
  35. package/build/store/index.js +0 -2
  36. package/build/store/index.js.map +1 -1
  37. package/build/store/private-actions.js +5 -0
  38. package/build/store/private-actions.js.map +1 -1
  39. package/build/store/private-keys.js +8 -0
  40. package/build/store/private-keys.js.map +1 -0
  41. package/build/store/private-selectors.js +6 -9
  42. package/build/store/private-selectors.js.map +1 -1
  43. package/build/store/reducer.js +1 -9
  44. package/build/store/reducer.js.map +1 -1
  45. package/build/store/selectors.js +7 -12
  46. package/build/store/selectors.js.map +1 -1
  47. package/build/store/utils.js +7 -2
  48. package/build/store/utils.js.map +1 -1
  49. package/build-module/components/block-tools/insertion-point.js +4 -1
  50. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  51. package/build-module/components/global-styles/advanced-panel.js +6 -11
  52. package/build-module/components/global-styles/advanced-panel.js.map +1 -1
  53. package/build-module/components/global-styles/border-panel.js +5 -4
  54. package/build-module/components/global-styles/border-panel.js.map +1 -1
  55. package/build-module/components/global-styles/get-global-styles-changes.js +61 -25
  56. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  57. package/build-module/components/global-styles/shadow-panel-components.js +3 -3
  58. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
  59. package/build-module/components/global-styles/typography-panel.js +9 -7
  60. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  61. package/build-module/components/iframe/index.js +4 -1
  62. package/build-module/components/iframe/index.js.map +1 -1
  63. package/build-module/components/inserter/media-tab/media-preview.js +1 -1
  64. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  65. package/build-module/components/rich-text/index.js +7 -3
  66. package/build-module/components/rich-text/index.js.map +1 -1
  67. package/build-module/components/rich-text/index.native.js +1 -0
  68. package/build-module/components/rich-text/index.native.js.map +1 -1
  69. package/build-module/components/rich-text/use-enter.js +1 -0
  70. package/build-module/components/rich-text/use-enter.js.map +1 -1
  71. package/build-module/components/rich-text/use-paste-handler.js +25 -26
  72. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  73. package/build-module/hooks/background.js +4 -2
  74. package/build-module/hooks/background.js.map +1 -1
  75. package/build-module/hooks/use-bindings-attributes.js +0 -17
  76. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  77. package/build-module/hooks/utils.js +8 -4
  78. package/build-module/hooks/utils.js.map +1 -1
  79. package/build-module/private-apis.js +3 -1
  80. package/build-module/private-apis.js.map +1 -1
  81. package/build-module/store/get-block-settings.js +16 -4
  82. package/build-module/store/get-block-settings.js.map +1 -1
  83. package/build-module/store/index.js +0 -2
  84. package/build-module/store/index.js.map +1 -1
  85. package/build-module/store/private-actions.js +5 -0
  86. package/build-module/store/private-actions.js.map +1 -1
  87. package/build-module/store/private-keys.js +2 -0
  88. package/build-module/store/private-keys.js.map +1 -0
  89. package/build-module/store/private-selectors.js +5 -6
  90. package/build-module/store/private-selectors.js.map +1 -1
  91. package/build-module/store/reducer.js +1 -9
  92. package/build-module/store/reducer.js.map +1 -1
  93. package/build-module/store/selectors.js +8 -13
  94. package/build-module/store/selectors.js.map +1 -1
  95. package/build-module/store/utils.js +6 -2
  96. package/build-module/store/utils.js.map +1 -1
  97. package/build-style/style-rtl.css +0 -10
  98. package/build-style/style.css +0 -10
  99. package/package.json +31 -31
  100. package/src/components/block-tools/insertion-point.js +6 -1
  101. package/src/components/global-styles/advanced-panel.js +6 -12
  102. package/src/components/global-styles/border-panel.js +4 -6
  103. package/src/components/global-styles/get-global-styles-changes.js +68 -28
  104. package/src/components/global-styles/shadow-panel-components.js +3 -3
  105. package/src/components/global-styles/style.scss +0 -10
  106. package/src/components/global-styles/test/get-global-styles-changes.js +114 -75
  107. package/src/components/global-styles/typography-panel.js +11 -7
  108. package/src/components/iframe/index.js +4 -1
  109. package/src/components/inserter/media-tab/media-preview.js +6 -1
  110. package/src/components/rich-text/index.js +12 -5
  111. package/src/components/rich-text/index.native.js +1 -0
  112. package/src/components/rich-text/use-enter.js +1 -0
  113. package/src/components/rich-text/use-paste-handler.js +26 -25
  114. package/src/hooks/background.js +5 -2
  115. package/src/hooks/use-bindings-attributes.js +0 -21
  116. package/src/hooks/utils.js +24 -8
  117. package/src/private-apis.js +2 -0
  118. package/src/store/get-block-settings.js +15 -4
  119. package/src/store/index.js +0 -2
  120. package/src/store/private-actions.js +9 -0
  121. package/src/store/private-keys.js +1 -0
  122. package/src/store/private-selectors.js +4 -7
  123. package/src/store/reducer.js +0 -10
  124. package/src/store/selectors.js +7 -15
  125. package/src/store/utils.js +7 -2
  126. package/build/store/resolvers.js +0 -27
  127. package/build/store/resolvers.js.map +0 -1
  128. package/build-module/store/resolvers.js +0 -20
  129. package/build-module/store/resolvers.js.map +0 -1
  130. package/src/store/resolvers.js +0 -17
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { selectBlockPatternsKey } from './private-keys';
1
5
  export const checkAllowList = (list, item, defaultResult = null) => {
2
6
  if (typeof list === 'boolean') {
3
7
  return list;
@@ -30,7 +34,7 @@ export const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
30
34
  }
31
35
  return true;
32
36
  };
33
- export const getAllPatternsDependants = state => {
34
- return [state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings.__experimentalFetchBlockPatterns, state.blockPatterns];
37
+ export const getAllPatternsDependants = select => state => {
38
+ return [state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings[selectBlockPatternsKey]?.(select), state.blockPatterns];
35
39
  };
36
40
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["checkAllowList","list","item","defaultResult","Array","isArray","includes","checkAllowListRecursive","blocks","allowedBlockTypes","blocksQueue","length","block","shift","isAllowed","name","blockName","innerBlocks","forEach","innerBlock","push","getAllPatternsDependants","state","settings","__experimentalBlockPatterns","__experimentalUserPatternCategories","__experimentalReusableBlocks","__experimentalFetchBlockPatterns","blockPatterns"],"sources":["@wordpress/block-editor/src/store/utils.js"],"sourcesContent":["export const checkAllowList = ( list, item, defaultResult = null ) => {\n\tif ( typeof list === 'boolean' ) {\n\t\treturn list;\n\t}\n\tif ( Array.isArray( list ) ) {\n\t\t// TODO: when there is a canonical way to detect that we are editing a post\n\t\t// the following check should be changed to something like:\n\t\t// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )\n\t\tif ( list.includes( 'core/post-content' ) && item === null ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn list.includes( item );\n\t}\n\treturn defaultResult;\n};\n\nexport const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {\n\tif ( typeof allowedBlockTypes === 'boolean' ) {\n\t\treturn allowedBlockTypes;\n\t}\n\n\tconst blocksQueue = [ ...blocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\n\t\tconst isAllowed = checkAllowList(\n\t\t\tallowedBlockTypes,\n\t\t\tblock.name || block.blockName,\n\t\t\ttrue\n\t\t);\n\t\tif ( ! isAllowed ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\n\treturn true;\n};\n\nexport const getAllPatternsDependants = ( state ) => {\n\treturn [\n\t\tstate.settings.__experimentalBlockPatterns,\n\t\tstate.settings.__experimentalUserPatternCategories,\n\t\tstate.settings.__experimentalReusableBlocks,\n\t\tstate.settings.__experimentalFetchBlockPatterns,\n\t\tstate.blockPatterns,\n\t];\n};\n"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GAAGA,CAAEC,IAAI,EAAEC,IAAI,EAAEC,aAAa,GAAG,IAAI,KAAM;EACrE,IAAK,OAAOF,IAAI,KAAK,SAAS,EAAG;IAChC,OAAOA,IAAI;EACZ;EACA,IAAKG,KAAK,CAACC,OAAO,CAAEJ,IAAK,CAAC,EAAG;IAC5B;IACA;IACA;IACA,IAAKA,IAAI,CAACK,QAAQ,CAAE,mBAAoB,CAAC,IAAIJ,IAAI,KAAK,IAAI,EAAG;MAC5D,OAAO,IAAI;IACZ;IACA,OAAOD,IAAI,CAACK,QAAQ,CAAEJ,IAAK,CAAC;EAC7B;EACA,OAAOC,aAAa;AACrB,CAAC;AAED,OAAO,MAAMI,uBAAuB,GAAGA,CAAEC,MAAM,EAAEC,iBAAiB,KAAM;EACvE,IAAK,OAAOA,iBAAiB,KAAK,SAAS,EAAG;IAC7C,OAAOA,iBAAiB;EACzB;EAEA,MAAMC,WAAW,GAAG,CAAE,GAAGF,MAAM,CAAE;EACjC,OAAQE,WAAW,CAACC,MAAM,GAAG,CAAC,EAAG;IAChC,MAAMC,KAAK,GAAGF,WAAW,CAACG,KAAK,CAAC,CAAC;IAEjC,MAAMC,SAAS,GAAGd,cAAc,CAC/BS,iBAAiB,EACjBG,KAAK,CAACG,IAAI,IAAIH,KAAK,CAACI,SAAS,EAC7B,IACD,CAAC;IACD,IAAK,CAAEF,SAAS,EAAG;MAClB,OAAO,KAAK;IACb;IAEAF,KAAK,CAACK,WAAW,EAAEC,OAAO,CAAIC,UAAU,IAAM;MAC7CT,WAAW,CAACU,IAAI,CAAED,UAAW,CAAC;IAC/B,CAAE,CAAC;EACJ;EAEA,OAAO,IAAI;AACZ,CAAC;AAED,OAAO,MAAME,wBAAwB,GAAKC,KAAK,IAAM;EACpD,OAAO,CACNA,KAAK,CAACC,QAAQ,CAACC,2BAA2B,EAC1CF,KAAK,CAACC,QAAQ,CAACE,mCAAmC,EAClDH,KAAK,CAACC,QAAQ,CAACG,4BAA4B,EAC3CJ,KAAK,CAACC,QAAQ,CAACI,gCAAgC,EAC/CL,KAAK,CAACM,aAAa,CACnB;AACF,CAAC"}
1
+ {"version":3,"names":["selectBlockPatternsKey","checkAllowList","list","item","defaultResult","Array","isArray","includes","checkAllowListRecursive","blocks","allowedBlockTypes","blocksQueue","length","block","shift","isAllowed","name","blockName","innerBlocks","forEach","innerBlock","push","getAllPatternsDependants","select","state","settings","__experimentalBlockPatterns","__experimentalUserPatternCategories","__experimentalReusableBlocks","blockPatterns"],"sources":["@wordpress/block-editor/src/store/utils.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { selectBlockPatternsKey } from './private-keys';\n\nexport const checkAllowList = ( list, item, defaultResult = null ) => {\n\tif ( typeof list === 'boolean' ) {\n\t\treturn list;\n\t}\n\tif ( Array.isArray( list ) ) {\n\t\t// TODO: when there is a canonical way to detect that we are editing a post\n\t\t// the following check should be changed to something like:\n\t\t// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )\n\t\tif ( list.includes( 'core/post-content' ) && item === null ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn list.includes( item );\n\t}\n\treturn defaultResult;\n};\n\nexport const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {\n\tif ( typeof allowedBlockTypes === 'boolean' ) {\n\t\treturn allowedBlockTypes;\n\t}\n\n\tconst blocksQueue = [ ...blocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\n\t\tconst isAllowed = checkAllowList(\n\t\t\tallowedBlockTypes,\n\t\t\tblock.name || block.blockName,\n\t\t\ttrue\n\t\t);\n\t\tif ( ! isAllowed ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\n\treturn true;\n};\n\nexport const getAllPatternsDependants = ( select ) => ( state ) => {\n\treturn [\n\t\tstate.settings.__experimentalBlockPatterns,\n\t\tstate.settings.__experimentalUserPatternCategories,\n\t\tstate.settings.__experimentalReusableBlocks,\n\t\tstate.settings[ selectBlockPatternsKey ]?.( select ),\n\t\tstate.blockPatterns,\n\t];\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAsB,QAAQ,gBAAgB;AAEvD,OAAO,MAAMC,cAAc,GAAGA,CAAEC,IAAI,EAAEC,IAAI,EAAEC,aAAa,GAAG,IAAI,KAAM;EACrE,IAAK,OAAOF,IAAI,KAAK,SAAS,EAAG;IAChC,OAAOA,IAAI;EACZ;EACA,IAAKG,KAAK,CAACC,OAAO,CAAEJ,IAAK,CAAC,EAAG;IAC5B;IACA;IACA;IACA,IAAKA,IAAI,CAACK,QAAQ,CAAE,mBAAoB,CAAC,IAAIJ,IAAI,KAAK,IAAI,EAAG;MAC5D,OAAO,IAAI;IACZ;IACA,OAAOD,IAAI,CAACK,QAAQ,CAAEJ,IAAK,CAAC;EAC7B;EACA,OAAOC,aAAa;AACrB,CAAC;AAED,OAAO,MAAMI,uBAAuB,GAAGA,CAAEC,MAAM,EAAEC,iBAAiB,KAAM;EACvE,IAAK,OAAOA,iBAAiB,KAAK,SAAS,EAAG;IAC7C,OAAOA,iBAAiB;EACzB;EAEA,MAAMC,WAAW,GAAG,CAAE,GAAGF,MAAM,CAAE;EACjC,OAAQE,WAAW,CAACC,MAAM,GAAG,CAAC,EAAG;IAChC,MAAMC,KAAK,GAAGF,WAAW,CAACG,KAAK,CAAC,CAAC;IAEjC,MAAMC,SAAS,GAAGd,cAAc,CAC/BS,iBAAiB,EACjBG,KAAK,CAACG,IAAI,IAAIH,KAAK,CAACI,SAAS,EAC7B,IACD,CAAC;IACD,IAAK,CAAEF,SAAS,EAAG;MAClB,OAAO,KAAK;IACb;IAEAF,KAAK,CAACK,WAAW,EAAEC,OAAO,CAAIC,UAAU,IAAM;MAC7CT,WAAW,CAACU,IAAI,CAAED,UAAW,CAAC;IAC/B,CAAE,CAAC;EACJ;EAEA,OAAO,IAAI;AACZ,CAAC;AAED,OAAO,MAAME,wBAAwB,GAAKC,MAAM,IAAQC,KAAK,IAAM;EAClE,OAAO,CACNA,KAAK,CAACC,QAAQ,CAACC,2BAA2B,EAC1CF,KAAK,CAACC,QAAQ,CAACE,mCAAmC,EAClDH,KAAK,CAACC,QAAQ,CAACG,4BAA4B,EAC3CJ,KAAK,CAACC,QAAQ,CAAEzB,sBAAsB,CAAE,GAAIuB,MAAO,CAAC,EACpDC,KAAK,CAACK,aAAa,CACnB;AACF,CAAC"}
@@ -1587,16 +1587,6 @@ iframe[name=editor-canvas].has-editor-padding {
1587
1587
  direction: ltr;
1588
1588
  }
1589
1589
 
1590
- .block-editor-global-styles-advanced-panel__custom-css-validation-wrapper {
1591
- position: absolute;
1592
- bottom: 16px;
1593
- left: 24px;
1594
- }
1595
-
1596
- .block-editor-global-styles-advanced-panel__custom-css-validation-icon {
1597
- fill: #cc1818;
1598
- }
1599
-
1600
1590
  .block-editor-height-control {
1601
1591
  border: 0;
1602
1592
  margin: 0;
@@ -1588,16 +1588,6 @@ iframe[name=editor-canvas].has-editor-padding {
1588
1588
  direction: ltr;
1589
1589
  }
1590
1590
 
1591
- .block-editor-global-styles-advanced-panel__custom-css-validation-wrapper {
1592
- position: absolute;
1593
- bottom: 16px;
1594
- right: 24px;
1595
- }
1596
-
1597
- .block-editor-global-styles-advanced-panel__custom-css-validation-icon {
1598
- fill: #cc1818;
1599
- }
1600
-
1601
1591
  .block-editor-height-control {
1602
1592
  border: 0;
1603
1593
  margin: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "12.19.1",
3
+ "version": "12.19.3",
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.1",
42
- "@wordpress/commands": "^0.22.1",
43
- "@wordpress/components": "^26.0.1",
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.1",
60
- "@wordpress/private-apis": "^0.33.0",
61
- "@wordpress/rich-text": "^6.28.1",
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.3",
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": "5902fc0f490528da6965dd4cf97f11192bcf5956"
90
+ "gitHead": "b12d75c5c5256fda2a0509bb432e20ddd3354d5e"
91
91
  }
@@ -81,11 +81,16 @@ function InbetweenInsertionPointPopover( {
81
81
  isInserterShown: insertionPoint?.__unstableWithInserter,
82
82
  };
83
83
  }, [] );
84
+ const { getBlockEditingMode } = useSelect( blockEditorStore );
84
85
 
85
86
  const disableMotion = useReducedMotion();
86
87
 
87
88
  function onClick( event ) {
88
- if ( event.target === ref.current && nextClientId ) {
89
+ if (
90
+ event.target === ref.current &&
91
+ nextClientId &&
92
+ getBlockEditingMode( nextClientId ) !== 'disabled'
93
+ ) {
89
94
  selectBlock( nextClientId, -1 );
90
95
  }
91
96
  }
@@ -3,12 +3,11 @@
3
3
  */
4
4
  import {
5
5
  TextareaControl,
6
- Tooltip,
6
+ Notice,
7
7
  __experimentalVStack as VStack,
8
8
  } from '@wordpress/components';
9
9
  import { useState } from '@wordpress/element';
10
10
  import { __ } from '@wordpress/i18n';
11
- import { Icon, info } from '@wordpress/icons';
12
11
 
13
12
  /**
14
13
  * Internal dependencies
@@ -58,6 +57,11 @@ export default function AdvancedPanel( {
58
57
 
59
58
  return (
60
59
  <VStack spacing={ 3 }>
60
+ { cssError && (
61
+ <Notice status="error" onRemove={ () => setCSSError( null ) }>
62
+ { cssError }
63
+ </Notice>
64
+ ) }
61
65
  <TextareaControl
62
66
  label={ __( 'Additional CSS' ) }
63
67
  __nextHasNoMarginBottom
@@ -67,16 +71,6 @@ export default function AdvancedPanel( {
67
71
  className="block-editor-global-styles-advanced-panel__custom-css-input"
68
72
  spellCheck={ false }
69
73
  />
70
- { cssError && (
71
- <Tooltip text={ cssError }>
72
- <div className="block-editor-global-styles-advanced-panel__custom-css-validation-wrapper">
73
- <Icon
74
- icon={ info }
75
- className="block-editor-global-styles-advanced-panel__custom-css-validation-icon"
76
- />
77
- </div>
78
- </Tooltip>
79
- ) }
80
74
  </VStack>
81
75
  );
82
76
  }
@@ -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
  }
@@ -19,13 +19,13 @@ import { shadow as shadowIcon, Icon, check } from '@wordpress/icons';
19
19
  import classNames from 'classnames';
20
20
 
21
21
  export function ShadowPopoverContainer( { shadow, onShadowChange, settings } ) {
22
- const defaultShadows = settings?.shadow?.presets?.default;
23
- const themeShadows = settings?.shadow?.presets?.theme;
22
+ const defaultShadows = settings?.shadow?.presets?.default || [];
23
+ const themeShadows = settings?.shadow?.presets?.theme || [];
24
24
  const defaultPresetsEnabled = settings?.shadow?.defaultPresets;
25
25
 
26
26
  const shadows = [
27
27
  ...( defaultPresetsEnabled ? defaultShadows : [] ),
28
- ...( themeShadows || [] ),
28
+ ...themeShadows,
29
29
  ];
30
30
 
31
31
  return (
@@ -47,13 +47,3 @@
47
47
  /*rtl:ignore*/
48
48
  direction: ltr;
49
49
  }
50
-
51
- .block-editor-global-styles-advanced-panel__custom-css-validation-wrapper {
52
- position: absolute;
53
- bottom: $grid-unit-20;
54
- right: $grid-unit * 3;
55
- }
56
-
57
- .block-editor-global-styles-advanced-panel__custom-css-validation-icon {
58
- fill: $alert-red;
59
- }
@@ -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
  } );