@wordpress/block-editor 14.3.14 → 14.3.16

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 (98) hide show
  1. package/build/components/block-list/index.js +1 -0
  2. package/build/components/block-list/index.js.map +1 -1
  3. package/build/components/block-switcher/index.js +1 -0
  4. package/build/components/block-switcher/index.js.map +1 -1
  5. package/build/components/block-switcher/use-transformed-patterns.js +1 -0
  6. package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
  7. package/build/components/block-switcher/utils.js +1 -0
  8. package/build/components/block-switcher/utils.js.map +1 -1
  9. package/build/components/block-toolbar/index.js +1 -1
  10. package/build/components/block-toolbar/index.js.map +1 -1
  11. package/build/components/block-variation-transforms/index.js +1 -0
  12. package/build/components/block-variation-transforms/index.js.map +1 -1
  13. package/build/components/button-block-appender/index.js +1 -5
  14. package/build/components/button-block-appender/index.js.map +1 -1
  15. package/build/components/date-format-picker/index.js +1 -0
  16. package/build/components/date-format-picker/index.js.map +1 -1
  17. package/build/components/global-styles/get-global-styles-changes.js +1 -0
  18. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  19. package/build/components/iframe/index.js +137 -23
  20. package/build/components/iframe/index.js.map +1 -1
  21. package/build/components/inserter/block-patterns-explorer/pattern-list.js +2 -1
  22. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  23. package/build/components/observe-typing/index.js +1 -0
  24. package/build/components/observe-typing/index.js.map +1 -1
  25. package/build/components/recursion-provider/index.js +1 -0
  26. package/build/components/recursion-provider/index.js.map +1 -1
  27. package/build/components/rich-text/index.js +1 -0
  28. package/build/components/rich-text/index.js.map +1 -1
  29. package/build/components/rich-text/native/use-format-types.js +1 -0
  30. package/build/components/rich-text/native/use-format-types.js.map +1 -1
  31. package/build/components/rich-text/use-format-types.js +1 -0
  32. package/build/components/rich-text/use-format-types.js.map +1 -1
  33. package/build/components/spacing-sizes-control/utils.js +1 -0
  34. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  35. package/build/components/typewriter/index.js +1 -0
  36. package/build/components/typewriter/index.js.map +1 -1
  37. package/build/hooks/generated-class-name.js +1 -0
  38. package/build/hooks/generated-class-name.js.map +1 -1
  39. package/build/store/reducer.js +1 -0
  40. package/build/store/reducer.js.map +1 -1
  41. package/build/store/selectors.js +1 -0
  42. package/build/store/selectors.js.map +1 -1
  43. package/build/utils/object.js +1 -0
  44. package/build/utils/object.js.map +1 -1
  45. package/build-module/components/block-list/index.js +1 -0
  46. package/build-module/components/block-list/index.js.map +1 -1
  47. package/build-module/components/block-switcher/index.js +1 -0
  48. package/build-module/components/block-switcher/index.js.map +1 -1
  49. package/build-module/components/block-switcher/use-transformed-patterns.js +1 -0
  50. package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
  51. package/build-module/components/block-switcher/utils.js +1 -0
  52. package/build-module/components/block-switcher/utils.js.map +1 -1
  53. package/build-module/components/block-toolbar/index.js +1 -1
  54. package/build-module/components/block-toolbar/index.js.map +1 -1
  55. package/build-module/components/block-variation-transforms/index.js +1 -0
  56. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  57. package/build-module/components/button-block-appender/index.js +2 -6
  58. package/build-module/components/button-block-appender/index.js.map +1 -1
  59. package/build-module/components/date-format-picker/index.js +1 -0
  60. package/build-module/components/date-format-picker/index.js.map +1 -1
  61. package/build-module/components/global-styles/get-global-styles-changes.js +1 -0
  62. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  63. package/build-module/components/iframe/index.js +138 -24
  64. package/build-module/components/iframe/index.js.map +1 -1
  65. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -1
  66. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  67. package/build-module/components/observe-typing/index.js +1 -0
  68. package/build-module/components/observe-typing/index.js.map +1 -1
  69. package/build-module/components/recursion-provider/index.js +1 -0
  70. package/build-module/components/recursion-provider/index.js.map +1 -1
  71. package/build-module/components/rich-text/index.js +1 -0
  72. package/build-module/components/rich-text/index.js.map +1 -1
  73. package/build-module/components/rich-text/native/use-format-types.js +1 -0
  74. package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
  75. package/build-module/components/rich-text/use-format-types.js +1 -0
  76. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  77. package/build-module/components/spacing-sizes-control/utils.js +1 -0
  78. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  79. package/build-module/components/typewriter/index.js +1 -0
  80. package/build-module/components/typewriter/index.js.map +1 -1
  81. package/build-module/hooks/generated-class-name.js +1 -0
  82. package/build-module/hooks/generated-class-name.js.map +1 -1
  83. package/build-module/store/reducer.js +1 -0
  84. package/build-module/store/reducer.js.map +1 -1
  85. package/build-module/store/selectors.js +1 -0
  86. package/build-module/store/selectors.js.map +1 -1
  87. package/build-module/utils/object.js +1 -0
  88. package/build-module/utils/object.js.map +1 -1
  89. package/build-style/content-rtl.css +9 -2
  90. package/build-style/content.css +9 -2
  91. package/build-style/style-rtl.css +1 -2
  92. package/build-style/style.css +1 -2
  93. package/package.json +11 -11
  94. package/src/components/block-toolbar/index.js +7 -5
  95. package/src/components/button-block-appender/index.js +2 -7
  96. package/src/components/iframe/content.scss +16 -3
  97. package/src/components/iframe/index.js +184 -44
  98. package/src/components/inserter/block-patterns-explorer/pattern-list.js +3 -3
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * Immutably sets a value inside an object. Like `lodash#set`, but returning a
3
4
  * new object. Treats nullish initial values as empty objects. Clones any
@@ -1 +1 @@
1
- {"version":3,"names":["setImmutably","object","path","value","Array","isArray","leaf","pop","prev","key","lvl","getValueFromObjectPath","defaultValue","_value","arrayPath","split","forEach","fieldName","uniqByProperty","array","property","seen","Set","filter","item","has","add"],"sources":["@wordpress/block-editor/src/utils/object.js"],"sourcesContent":["/**\n * Immutably sets a value inside an object. Like `lodash#set`, but returning a\n * new object. Treats nullish initial values as empty objects. Clones any\n * nested objects. Supports arrays, too.\n *\n * @param {Object} object Object to set a value in.\n * @param {number|string|Array} path Path in the object to modify.\n * @param {*} value New value to set.\n * @return {Object} Cloned object with the new value set.\n */\nexport function setImmutably( object, path, value ) {\n\t// Normalize path\n\tpath = Array.isArray( path ) ? [ ...path ] : [ path ];\n\n\t// Shallowly clone the base of the object\n\tobject = Array.isArray( object ) ? [ ...object ] : { ...object };\n\n\tconst leaf = path.pop();\n\n\t// Traverse object from root to leaf, shallowly cloning at each level\n\tlet prev = object;\n\tfor ( const key of path ) {\n\t\tconst lvl = prev[ key ];\n\t\tprev = prev[ key ] = Array.isArray( lvl ) ? [ ...lvl ] : { ...lvl };\n\t}\n\n\tprev[ leaf ] = value;\n\n\treturn object;\n}\n\n/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as either:\n * - a string of properties, separated by dots, for example: \"x.y\".\n * - an array of properties, for example `[ 'x', 'y' ]`.\n * You can also specify a default value in case the result is nullish.\n *\n * @param {Object} object Input object.\n * @param {string|Array} path Path to the object property.\n * @param {*} defaultValue Default value if the value at the specified path is nullish.\n * @return {*} Value of the object property at the specified path.\n */\nexport const getValueFromObjectPath = ( object, path, defaultValue ) => {\n\tconst arrayPath = Array.isArray( path ) ? path : path.split( '.' );\n\tlet value = object;\n\tarrayPath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value ?? defaultValue;\n};\n\n/**\n * Helper util to filter out objects with duplicate values for a given property.\n *\n * @param {Object[]} array Array of objects to filter.\n * @param {string} property Property to filter unique values by.\n *\n * @return {Object[]} Array of objects with unique values for the specified property.\n */\nexport function uniqByProperty( array, property ) {\n\tconst seen = new Set();\n\treturn array.filter( ( item ) => {\n\t\tconst value = item[ property ];\n\t\treturn seen.has( value ) ? false : seen.add( value );\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,YAAYA,CAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAG;EACnD;EACAD,IAAI,GAAGE,KAAK,CAACC,OAAO,CAAEH,IAAK,CAAC,GAAG,CAAE,GAAGA,IAAI,CAAE,GAAG,CAAEA,IAAI,CAAE;;EAErD;EACAD,MAAM,GAAGG,KAAK,CAACC,OAAO,CAAEJ,MAAO,CAAC,GAAG,CAAE,GAAGA,MAAM,CAAE,GAAG;IAAE,GAAGA;EAAO,CAAC;EAEhE,MAAMK,IAAI,GAAGJ,IAAI,CAACK,GAAG,CAAC,CAAC;;EAEvB;EACA,IAAIC,IAAI,GAAGP,MAAM;EACjB,KAAM,MAAMQ,GAAG,IAAIP,IAAI,EAAG;IACzB,MAAMQ,GAAG,GAAGF,IAAI,CAAEC,GAAG,CAAE;IACvBD,IAAI,GAAGA,IAAI,CAAEC,GAAG,CAAE,GAAGL,KAAK,CAACC,OAAO,CAAEK,GAAI,CAAC,GAAG,CAAE,GAAGA,GAAG,CAAE,GAAG;MAAE,GAAGA;IAAI,CAAC;EACpE;EAEAF,IAAI,CAAEF,IAAI,CAAE,GAAGH,KAAK;EAEpB,OAAOF,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMU,sBAAsB,GAAGA,CAAEV,MAAM,EAAEC,IAAI,EAAEU,YAAY,KAAM;EAAA,IAAAC,MAAA;EACvE,MAAMC,SAAS,GAAGV,KAAK,CAACC,OAAO,CAAEH,IAAK,CAAC,GAAGA,IAAI,GAAGA,IAAI,CAACa,KAAK,CAAE,GAAI,CAAC;EAClE,IAAIZ,KAAK,GAAGF,MAAM;EAClBa,SAAS,CAACE,OAAO,CAAIC,SAAS,IAAM;IACnCd,KAAK,GAAGA,KAAK,GAAIc,SAAS,CAAE;EAC7B,CAAE,CAAC;EACH,QAAAJ,MAAA,GAAOV,KAAK,cAAAU,MAAA,cAAAA,MAAA,GAAID,YAAY;AAC7B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,cAAcA,CAAEC,KAAK,EAAEC,QAAQ,EAAG;EACjD,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAC,CAAC;EACtB,OAAOH,KAAK,CAACI,MAAM,CAAIC,IAAI,IAAM;IAChC,MAAMrB,KAAK,GAAGqB,IAAI,CAAEJ,QAAQ,CAAE;IAC9B,OAAOC,IAAI,CAACI,GAAG,CAAEtB,KAAM,CAAC,GAAG,KAAK,GAAGkB,IAAI,CAACK,GAAG,CAAEvB,KAAM,CAAC;EACrD,CAAE,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["setImmutably","object","path","value","Array","isArray","leaf","pop","prev","key","lvl","getValueFromObjectPath","defaultValue","_value","arrayPath","split","forEach","fieldName","uniqByProperty","array","property","seen","Set","filter","item","has","add"],"sources":["@wordpress/block-editor/src/utils/object.js"],"sourcesContent":["/**\n * Immutably sets a value inside an object. Like `lodash#set`, but returning a\n * new object. Treats nullish initial values as empty objects. Clones any\n * nested objects. Supports arrays, too.\n *\n * @param {Object} object Object to set a value in.\n * @param {number|string|Array} path Path in the object to modify.\n * @param {*} value New value to set.\n * @return {Object} Cloned object with the new value set.\n */\nexport function setImmutably( object, path, value ) {\n\t// Normalize path\n\tpath = Array.isArray( path ) ? [ ...path ] : [ path ];\n\n\t// Shallowly clone the base of the object\n\tobject = Array.isArray( object ) ? [ ...object ] : { ...object };\n\n\tconst leaf = path.pop();\n\n\t// Traverse object from root to leaf, shallowly cloning at each level\n\tlet prev = object;\n\tfor ( const key of path ) {\n\t\tconst lvl = prev[ key ];\n\t\tprev = prev[ key ] = Array.isArray( lvl ) ? [ ...lvl ] : { ...lvl };\n\t}\n\n\tprev[ leaf ] = value;\n\n\treturn object;\n}\n\n/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as either:\n * - a string of properties, separated by dots, for example: \"x.y\".\n * - an array of properties, for example `[ 'x', 'y' ]`.\n * You can also specify a default value in case the result is nullish.\n *\n * @param {Object} object Input object.\n * @param {string|Array} path Path to the object property.\n * @param {*} defaultValue Default value if the value at the specified path is nullish.\n * @return {*} Value of the object property at the specified path.\n */\nexport const getValueFromObjectPath = ( object, path, defaultValue ) => {\n\tconst arrayPath = Array.isArray( path ) ? path : path.split( '.' );\n\tlet value = object;\n\tarrayPath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value ?? defaultValue;\n};\n\n/**\n * Helper util to filter out objects with duplicate values for a given property.\n *\n * @param {Object[]} array Array of objects to filter.\n * @param {string} property Property to filter unique values by.\n *\n * @return {Object[]} Array of objects with unique values for the specified property.\n */\nexport function uniqByProperty( array, property ) {\n\tconst seen = new Set();\n\treturn array.filter( ( item ) => {\n\t\tconst value = item[ property ];\n\t\treturn seen.has( value ) ? false : seen.add( value );\n\t} );\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,YAAYA,CAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAG;EACnD;EACAD,IAAI,GAAGE,KAAK,CAACC,OAAO,CAAEH,IAAK,CAAC,GAAG,CAAE,GAAGA,IAAI,CAAE,GAAG,CAAEA,IAAI,CAAE;;EAErD;EACAD,MAAM,GAAGG,KAAK,CAACC,OAAO,CAAEJ,MAAO,CAAC,GAAG,CAAE,GAAGA,MAAM,CAAE,GAAG;IAAE,GAAGA;EAAO,CAAC;EAEhE,MAAMK,IAAI,GAAGJ,IAAI,CAACK,GAAG,CAAC,CAAC;;EAEvB;EACA,IAAIC,IAAI,GAAGP,MAAM;EACjB,KAAM,MAAMQ,GAAG,IAAIP,IAAI,EAAG;IACzB,MAAMQ,GAAG,GAAGF,IAAI,CAAEC,GAAG,CAAE;IACvBD,IAAI,GAAGA,IAAI,CAAEC,GAAG,CAAE,GAAGL,KAAK,CAACC,OAAO,CAAEK,GAAI,CAAC,GAAG,CAAE,GAAGA,GAAG,CAAE,GAAG;MAAE,GAAGA;IAAI,CAAC;EACpE;EAEAF,IAAI,CAAEF,IAAI,CAAE,GAAGH,KAAK;EAEpB,OAAOF,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMU,sBAAsB,GAAGA,CAAEV,MAAM,EAAEC,IAAI,EAAEU,YAAY,KAAM;EAAA,IAAAC,MAAA;EACvE,MAAMC,SAAS,GAAGV,KAAK,CAACC,OAAO,CAAEH,IAAK,CAAC,GAAGA,IAAI,GAAGA,IAAI,CAACa,KAAK,CAAE,GAAI,CAAC;EAClE,IAAIZ,KAAK,GAAGF,MAAM;EAClBa,SAAS,CAACE,OAAO,CAAIC,SAAS,IAAM;IACnCd,KAAK,GAAGA,KAAK,GAAIc,SAAS,CAAE;EAC7B,CAAE,CAAC;EACH,QAAAJ,MAAA,GAAOV,KAAK,cAAAU,MAAA,cAAAA,MAAA,GAAID,YAAY;AAC7B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,cAAcA,CAAEC,KAAK,EAAEC,QAAQ,EAAG;EACjD,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAC,CAAC;EACtB,OAAOH,KAAK,CAACI,MAAM,CAAIC,IAAI,IAAM;IAChC,MAAMrB,KAAK,GAAGqB,IAAI,CAAEJ,QAAQ,CAAE;IAC9B,OAAOC,IAAI,CAACI,GAAG,CAAEtB,KAAM,CAAC,GAAG,KAAK,GAAGkB,IAAI,CAACK,GAAG,CAAEvB,KAAM,CAAC;EACrD,CAAE,CAAC;AACJ","ignoreList":[]}
@@ -803,7 +803,7 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
803
803
 
804
804
  .block-editor-iframe__html {
805
805
  transform-origin: top center;
806
- transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96), transform 0s, scale 0s, padding 0s;
806
+ transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96), transform 0s, scale 0s, padding 0s, translate 0s;
807
807
  }
808
808
  @media (prefers-reduced-motion: reduce) {
809
809
  .block-editor-iframe__html {
@@ -812,7 +812,14 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
812
812
  }
813
813
  }
814
814
  .block-editor-iframe__html.zoom-out-animation {
815
- transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96), transform 0s;
815
+ position: fixed;
816
+ right: 0;
817
+ left: 0;
818
+ top: calc(-1 * var(--wp-block-editor-iframe-zoom-out-scroll-top, 0));
819
+ bottom: 0;
820
+ translate: 0 calc(var(--wp-block-editor-iframe-zoom-out-scroll-top, 0) - var(--wp-block-editor-iframe-zoom-out-scroll-top-next, 0));
821
+ overflow-y: scroll;
822
+ transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96), transform 0s, top 0s, bottom 0s, left 0s, right 0s;
816
823
  }
817
824
  @media (prefers-reduced-motion: reduce) {
818
825
  .block-editor-iframe__html.zoom-out-animation {
@@ -803,7 +803,7 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
803
803
 
804
804
  .block-editor-iframe__html {
805
805
  transform-origin: top center;
806
- transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96), transform 0s, scale 0s, padding 0s;
806
+ transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96), transform 0s, scale 0s, padding 0s, translate 0s;
807
807
  }
808
808
  @media (prefers-reduced-motion: reduce) {
809
809
  .block-editor-iframe__html {
@@ -812,7 +812,14 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
812
812
  }
813
813
  }
814
814
  .block-editor-iframe__html.zoom-out-animation {
815
- transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96), transform 0s;
815
+ position: fixed;
816
+ left: 0;
817
+ right: 0;
818
+ top: calc(-1 * var(--wp-block-editor-iframe-zoom-out-scroll-top, 0));
819
+ bottom: 0;
820
+ translate: 0 calc(var(--wp-block-editor-iframe-zoom-out-scroll-top, 0) - var(--wp-block-editor-iframe-zoom-out-scroll-top-next, 0));
821
+ overflow-y: scroll;
822
+ transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96), transform 0s, top 0s, bottom 0s, right 0s, left 0s;
816
823
  }
817
824
  @media (prefers-reduced-motion: reduce) {
818
825
  .block-editor-iframe__html.zoom-out-animation {
@@ -2032,8 +2032,7 @@ iframe[name=editor-canvas] {
2032
2032
  .block-editor-block-types-list__item-title {
2033
2033
  padding: 4px 2px 8px;
2034
2034
  font-size: 12px;
2035
- -webkit-hyphens: auto;
2036
- hyphens: auto;
2035
+ hyphens: auto;
2037
2036
  }
2038
2037
 
2039
2038
  .show-icon-labels .block-editor-block-inspector__tabs [role=tablist] .components-button {
@@ -2033,8 +2033,7 @@ iframe[name=editor-canvas] {
2033
2033
  .block-editor-block-types-list__item-title {
2034
2034
  padding: 4px 2px 8px;
2035
2035
  font-size: 12px;
2036
- -webkit-hyphens: auto;
2037
- hyphens: auto;
2036
+ hyphens: auto;
2038
2037
  }
2039
2038
 
2040
2039
  .show-icon-labels .block-editor-block-inspector__tabs [role=tablist] .components-button {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "14.3.14",
3
+ "version": "14.3.16",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -40,11 +40,11 @@
40
40
  "@wordpress/api-fetch": "^7.8.2",
41
41
  "@wordpress/blob": "^4.8.1",
42
42
  "@wordpress/block-serialization-default-parser": "^5.8.1",
43
- "@wordpress/blocks": "^13.8.5",
44
- "@wordpress/commands": "^1.8.10",
45
- "@wordpress/components": "^28.8.10",
46
- "@wordpress/compose": "^7.8.3",
47
- "@wordpress/data": "^10.8.3",
43
+ "@wordpress/blocks": "^13.8.6",
44
+ "@wordpress/commands": "^1.8.12",
45
+ "@wordpress/components": "^28.8.12",
46
+ "@wordpress/compose": "^7.8.4",
47
+ "@wordpress/data": "^10.8.4",
48
48
  "@wordpress/date": "^5.8.2",
49
49
  "@wordpress/deprecated": "^4.8.2",
50
50
  "@wordpress/dom": "^4.8.2",
@@ -55,12 +55,12 @@
55
55
  "@wordpress/i18n": "^5.8.2",
56
56
  "@wordpress/icons": "^10.8.2",
57
57
  "@wordpress/is-shallow-equal": "^5.8.1",
58
- "@wordpress/keyboard-shortcuts": "^5.8.3",
58
+ "@wordpress/keyboard-shortcuts": "^5.8.4",
59
59
  "@wordpress/keycodes": "^4.8.2",
60
- "@wordpress/notices": "^5.8.3",
61
- "@wordpress/preferences": "^4.8.10",
60
+ "@wordpress/notices": "^5.8.4",
61
+ "@wordpress/preferences": "^4.8.12",
62
62
  "@wordpress/private-apis": "^1.8.1",
63
- "@wordpress/rich-text": "^7.8.3",
63
+ "@wordpress/rich-text": "^7.8.4",
64
64
  "@wordpress/style-engine": "^2.8.1",
65
65
  "@wordpress/token-list": "^3.8.1",
66
66
  "@wordpress/url": "^4.8.1",
@@ -88,5 +88,5 @@
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
- "gitHead": "da8043074e6e71d3ce0495fb29738e876480b7d2"
91
+ "gitHead": "51ed4f305ec646b18e2b56eeeebcd4b1d7c0b736"
92
92
  }
@@ -204,11 +204,13 @@ export function PrivateBlockToolbar( {
204
204
  disabled={ ! isDefaultEditingMode }
205
205
  isUsingBindings={ isUsingBindings }
206
206
  />
207
- { ! isMultiToolbar && showLockButtons && (
208
- <BlockLockToolbar
209
- clientId={ blockClientId }
210
- />
211
- ) }
207
+ { ! isMultiToolbar &&
208
+ showLockButtons &&
209
+ isDefaultEditingMode && (
210
+ <BlockLockToolbar
211
+ clientId={ blockClientId }
212
+ />
213
+ ) }
212
214
  <BlockMover
213
215
  clientIds={ blockClientIds }
214
216
  hideDragHandle={ hideDragHandle }
@@ -7,7 +7,7 @@ import clsx from 'clsx';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { Button } from '@wordpress/components';
10
- import { forwardRef, useRef } from '@wordpress/element';
10
+ import { forwardRef } from '@wordpress/element';
11
11
  import { _x, sprintf } from '@wordpress/i18n';
12
12
  import { Icon, plus } from '@wordpress/icons';
13
13
  import deprecated from '@wordpress/deprecated';
@@ -16,15 +16,11 @@ import deprecated from '@wordpress/deprecated';
16
16
  * Internal dependencies
17
17
  */
18
18
  import Inserter from '../inserter';
19
- import { useMergeRefs } from '@wordpress/compose';
20
19
 
21
20
  function ButtonBlockAppender(
22
21
  { rootClientId, className, onFocus, tabIndex, onSelect },
23
22
  ref
24
23
  ) {
25
- const inserterButtonRef = useRef();
26
-
27
- const mergedInserterButtonRef = useMergeRefs( [ inserterButtonRef, ref ] );
28
24
  return (
29
25
  <Inserter
30
26
  position="bottom center"
@@ -34,7 +30,6 @@ function ButtonBlockAppender(
34
30
  if ( onSelect && typeof onSelect === 'function' ) {
35
31
  onSelect( ...args );
36
32
  }
37
- inserterButtonRef.current?.focus();
38
33
  } }
39
34
  renderToggle={ ( {
40
35
  onToggle,
@@ -61,7 +56,7 @@ function ButtonBlockAppender(
61
56
  return (
62
57
  <Button
63
58
  __next40pxDefaultSize
64
- ref={ mergedInserterButtonRef }
59
+ ref={ ref }
65
60
  onFocus={ onFocus }
66
61
  tabIndex={ tabIndex }
67
62
  className={ clsx(
@@ -7,13 +7,26 @@
7
7
  // We don't want to animate the transform of the translateX because it is used
8
8
  // to "center" the canvas. Leaving it on causes the canvas to slide around in
9
9
  // odd ways.
10
- @include editor-canvas-resize-animation(transform 0s, scale 0s, padding 0s);
10
+ @include editor-canvas-resize-animation( transform 0s, scale 0s, padding 0s, translate 0s);
11
11
 
12
12
  &.zoom-out-animation {
13
- // we only want to animate the scaling when entering zoom out. When sidebars
13
+ $scroll-top: var(--wp-block-editor-iframe-zoom-out-scroll-top, 0);
14
+ $scroll-top-next: var(--wp-block-editor-iframe-zoom-out-scroll-top-next, 0);
15
+
16
+ position: fixed;
17
+ left: 0;
18
+ right: 0;
19
+ top: calc(-1 * #{$scroll-top});
20
+ bottom: 0;
21
+ translate: 0 calc(#{$scroll-top} - #{$scroll-top-next});
22
+ // Force preserving a scrollbar gutter as scrollbar-gutter isn't supported in all browsers yet,
23
+ // and removing the scrollbar causes the content to shift.
24
+ overflow-y: scroll;
25
+
26
+ // We only want to animate the scaling when entering zoom out. When sidebars
14
27
  // are toggled, the resizing of the iframe handles scaling the canvas as well,
15
28
  // and the doubled animations cause very odd animations.
16
- @include editor-canvas-resize-animation(transform 0s);
29
+ @include editor-canvas-resize-animation( transform 0s, top 0s, bottom 0s, right 0s, left 0s );
17
30
  }
18
31
  }
19
32
 
@@ -20,6 +20,7 @@ import {
20
20
  useMergeRefs,
21
21
  useRefEffect,
22
22
  useDisabled,
23
+ useReducedMotion,
23
24
  } from '@wordpress/compose';
24
25
  import { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';
25
26
  import { useSelect } from '@wordpress/data';
@@ -121,6 +122,7 @@ function Iframe( {
121
122
  };
122
123
  }, [] );
123
124
  const { styles = '', scripts = '' } = resolvedAssets;
125
+ /** @type {[Document, import('react').Dispatch<Document>]} */
124
126
  const [ iframeDocument, setIframeDocument ] = useState();
125
127
  const initialContainerWidth = useRef( 0 );
126
128
  const [ bodyClasses, setBodyClasses ] = useState( [] );
@@ -130,6 +132,7 @@ function Iframe( {
130
132
  useResizeObserver();
131
133
  const [ containerResizeListener, { width: containerWidth } ] =
132
134
  useResizeObserver();
135
+ const prefersReducedMotion = useReducedMotion();
133
136
 
134
137
  const setRef = useRefEffect( ( node ) => {
135
138
  node._load = () => {
@@ -252,6 +255,19 @@ function Iframe( {
252
255
  containerWidth
253
256
  );
254
257
 
258
+ const frameSizeValue = parseInt( frameSize );
259
+
260
+ const maxWidth = 750;
261
+ const scaleValue =
262
+ scale === 'default'
263
+ ? ( Math.min( containerWidth, maxWidth ) - frameSizeValue * 2 ) /
264
+ scaleContainerWidth
265
+ : scale;
266
+
267
+ const prevScaleRef = useRef( scaleValue );
268
+ const prevFrameSizeRef = useRef( frameSizeValue );
269
+ const prevClientHeightRef = useRef( /* Initialized in the useEffect. */ );
270
+
255
271
  const disabledRef = useDisabled( { isDisabled: ! readonly } );
256
272
  const bodyRef = useMergeRefs( [
257
273
  useBubbleEvents( iframeDocument ),
@@ -303,47 +319,173 @@ function Iframe( {
303
319
 
304
320
  useEffect( () => cleanup, [ cleanup ] );
305
321
 
306
- const zoomOutAnimationClassnameRef = useRef( null );
307
-
308
- // Toggle zoom out CSS Classes only when zoom out mode changes. We could add these into the useEffect
309
- // that controls settings the CSS variables, but then we would need to do more work to ensure we're
310
- // only toggling these when the zoom out mode changes, as that useEffect is also triggered by a large
311
- // number of dependencies.
312
322
  useEffect( () => {
313
- if ( ! iframeDocument || ! isZoomedOut ) {
323
+ if (
324
+ ! iframeDocument ||
325
+ // HACK: Checking if isZoomedOut differs from prevIsZoomedOut here
326
+ // instead of the dependency array to appease the linter.
327
+ ( scaleValue === 1 ) === ( prevScaleRef.current === 1 )
328
+ ) {
314
329
  return;
315
330
  }
316
331
 
317
- const handleZoomOutAnimationClassname = () => {
318
- clearTimeout( zoomOutAnimationClassnameRef.current );
332
+ // Unscaled height of the current iframe container.
333
+ const clientHeight = iframeDocument.documentElement.clientHeight;
334
+
335
+ // Scaled height of the current iframe content.
336
+ const scrollHeight = iframeDocument.documentElement.scrollHeight;
337
+
338
+ // Previous scale value.
339
+ const prevScale = prevScaleRef.current;
340
+
341
+ // Unscaled size of the previous padding around the iframe content.
342
+ const prevFrameSize = prevFrameSizeRef.current;
343
+
344
+ // Unscaled height of the previous iframe container.
345
+ const prevClientHeight = prevClientHeightRef.current ?? clientHeight;
346
+
347
+ // We can't trust the set value from contentHeight, as it was measured
348
+ // before the zoom out mode was changed. After zoom out mode is changed,
349
+ // appenders may appear or disappear, so we need to get the height from
350
+ // the iframe at this point when we're about to animate the zoom out.
351
+ // The iframe scrollTop, scrollHeight, and clientHeight will all be
352
+ // accurate. The client height also does change when the zoom out mode
353
+ // is toggled, as the bottom bar about selecting the template is
354
+ // added/removed when toggling zoom out mode.
355
+ const scrollTop = iframeDocument.documentElement.scrollTop;
356
+
357
+ // Step 0: Start with the current scrollTop.
358
+ let scrollTopNext = scrollTop;
359
+
360
+ // Step 1: Undo the effects of the previous scale and frame around the
361
+ // midpoint of the visible area.
362
+ scrollTopNext =
363
+ ( scrollTopNext + prevClientHeight / 2 - prevFrameSize ) /
364
+ prevScale -
365
+ prevClientHeight / 2;
366
+
367
+ // Step 2: Apply the new scale and frame around the midpoint of the
368
+ // visible area.
369
+ scrollTopNext =
370
+ ( scrollTopNext + clientHeight / 2 ) * scaleValue +
371
+ frameSizeValue -
372
+ clientHeight / 2;
373
+
374
+ // Step 3: Handle an edge case so that you scroll to the top of the
375
+ // iframe if the top of the iframe content is visible in the container.
376
+ // The same edge case for the bottom is skipped because changing content
377
+ // makes calculating it impossible.
378
+ scrollTopNext = scrollTop <= prevFrameSize ? 0 : scrollTopNext;
379
+
380
+ // This is the scrollTop value if you are scrolled to the bottom of the
381
+ // iframe. We can't just let the browser handle it because we need to
382
+ // animate the scaling.
383
+ const maxScrollTop =
384
+ scrollHeight * ( scaleValue / prevScale ) +
385
+ frameSizeValue * 2 -
386
+ clientHeight;
387
+
388
+ // Step 4: Clamp the scrollTopNext between the minimum and maximum
389
+ // possible scrollTop positions. Round the value to avoid subpixel
390
+ // truncation by the browser which sometimes causes a 1px error.
391
+ scrollTopNext = Math.round(
392
+ Math.min(
393
+ Math.max( 0, scrollTopNext ),
394
+ Math.max( 0, maxScrollTop )
395
+ )
396
+ );
319
397
 
320
- iframeDocument.documentElement.classList.add(
398
+ iframeDocument.documentElement.style.setProperty(
399
+ '--wp-block-editor-iframe-zoom-out-scroll-top',
400
+ `${ scrollTop }px`
401
+ );
402
+
403
+ iframeDocument.documentElement.style.setProperty(
404
+ '--wp-block-editor-iframe-zoom-out-scroll-top-next',
405
+ `${ scrollTopNext }px`
406
+ );
407
+
408
+ iframeDocument.documentElement.classList.add( 'zoom-out-animation' );
409
+
410
+ function onZoomOutTransitionEnd() {
411
+ // Remove the position fixed for the animation.
412
+ iframeDocument.documentElement.classList.remove(
321
413
  'zoom-out-animation'
322
414
  );
323
415
 
324
- zoomOutAnimationClassnameRef.current = setTimeout( () => {
325
- iframeDocument.documentElement.classList.remove(
326
- 'zoom-out-animation'
416
+ // Update previous values.
417
+ prevClientHeightRef.current = clientHeight;
418
+ prevFrameSizeRef.current = frameSizeValue;
419
+ prevScaleRef.current = scaleValue;
420
+
421
+ // Set the final scroll position that was just animated to.
422
+ iframeDocument.documentElement.scrollTop = scrollTopNext;
423
+ }
424
+
425
+ let raf;
426
+ if ( prefersReducedMotion ) {
427
+ // Hack: Wait for the window values to recalculate.
428
+ raf = iframeDocument.defaultView.requestAnimationFrame(
429
+ onZoomOutTransitionEnd
430
+ );
431
+ } else {
432
+ iframeDocument.documentElement.addEventListener(
433
+ 'transitionend',
434
+ onZoomOutTransitionEnd,
435
+ { once: true }
436
+ );
437
+ }
438
+
439
+ return () => {
440
+ iframeDocument.documentElement.style.removeProperty(
441
+ '--wp-block-editor-iframe-zoom-out-scroll-top'
442
+ );
443
+ iframeDocument.documentElement.style.removeProperty(
444
+ '--wp-block-editor-iframe-zoom-out-scroll-top-next'
445
+ );
446
+ iframeDocument.documentElement.classList.remove(
447
+ 'zoom-out-animation'
448
+ );
449
+ if ( prefersReducedMotion ) {
450
+ iframeDocument.defaultView.cancelAnimationFrame( raf );
451
+ } else {
452
+ iframeDocument.documentElement.removeEventListener(
453
+ 'transitionend',
454
+ onZoomOutTransitionEnd
327
455
  );
328
- }, 400 ); // 400ms should match the animation speed used in components/iframe/content.scss
456
+ }
329
457
  };
458
+ }, [ iframeDocument, scaleValue, frameSizeValue, prefersReducedMotion ] );
330
459
 
331
- handleZoomOutAnimationClassname();
332
- iframeDocument.documentElement.classList.add( 'is-zoomed-out' );
460
+ // Toggle zoom out CSS Classes only when zoom out mode changes. We could add these into the useEffect
461
+ // that controls settings the CSS variables, but then we would need to do more work to ensure we're
462
+ // only toggling these when the zoom out mode changes, as that useEffect is also triggered by a large
463
+ // number of dependencies.
464
+ useEffect( () => {
465
+ if ( ! iframeDocument ) {
466
+ return;
467
+ }
333
468
 
334
- return () => {
335
- handleZoomOutAnimationClassname();
469
+ if ( isZoomedOut ) {
470
+ iframeDocument.documentElement.classList.add( 'is-zoomed-out' );
471
+ } else {
472
+ // HACK: Since we can't remove this in the cleanup, we need to do it here.
336
473
  iframeDocument.documentElement.classList.remove( 'is-zoomed-out' );
474
+ }
475
+
476
+ return () => {
477
+ // HACK: Skipping cleanup because it causes issues with the zoom out
478
+ // animation. More refactoring is needed to fix this properly.
479
+ // iframeDocument.documentElement.classList.remove( 'is-zoomed-out' );
337
480
  };
338
481
  }, [ iframeDocument, isZoomedOut ] );
339
482
 
340
483
  // Calculate the scaling and CSS variables for the zoom out canvas
341
484
  useEffect( () => {
342
- if ( ! iframeDocument || ! isZoomedOut ) {
485
+ if ( ! iframeDocument ) {
343
486
  return;
344
487
  }
345
488
 
346
- const maxWidth = 750;
347
489
  // Note: When we initialize the zoom out when the canvas is smaller (sidebars open),
348
490
  // initialContainerWidth will be smaller than the full page, and reflow will happen
349
491
  // when the canvas area becomes larger due to sidebars closing. This is a known but
@@ -354,11 +496,7 @@ function Iframe( {
354
496
  // but calc( 100px / 2px ) is not.
355
497
  iframeDocument.documentElement.style.setProperty(
356
498
  '--wp-block-editor-iframe-zoom-out-scale',
357
- scale === 'default'
358
- ? ( Math.min( containerWidth, maxWidth ) -
359
- parseInt( frameSize ) * 2 ) /
360
- scaleContainerWidth
361
- : scale
499
+ scaleValue
362
500
  );
363
501
 
364
502
  // frameSize has to be a px value for the scaling and frame size to be computed correctly.
@@ -384,27 +522,29 @@ function Iframe( {
384
522
  );
385
523
 
386
524
  return () => {
387
- iframeDocument.documentElement.style.removeProperty(
388
- '--wp-block-editor-iframe-zoom-out-scale'
389
- );
390
- iframeDocument.documentElement.style.removeProperty(
391
- '--wp-block-editor-iframe-zoom-out-frame-size'
392
- );
393
- iframeDocument.documentElement.style.removeProperty(
394
- '--wp-block-editor-iframe-zoom-out-content-height'
395
- );
396
- iframeDocument.documentElement.style.removeProperty(
397
- '--wp-block-editor-iframe-zoom-out-inner-height'
398
- );
399
- iframeDocument.documentElement.style.removeProperty(
400
- '--wp-block-editor-iframe-zoom-out-container-width'
401
- );
402
- iframeDocument.documentElement.style.removeProperty(
403
- '--wp-block-editor-iframe-zoom-out-scale-container-width'
404
- );
525
+ // HACK: Skipping cleanup because it causes issues with the zoom out
526
+ // animation. More refactoring is needed to fix this properly.
527
+ // iframeDocument.documentElement.style.removeProperty(
528
+ // '--wp-block-editor-iframe-zoom-out-scale'
529
+ // );
530
+ // iframeDocument.documentElement.style.removeProperty(
531
+ // '--wp-block-editor-iframe-zoom-out-frame-size'
532
+ // );
533
+ // iframeDocument.documentElement.style.removeProperty(
534
+ // '--wp-block-editor-iframe-zoom-out-content-height'
535
+ // );
536
+ // iframeDocument.documentElement.style.removeProperty(
537
+ // '--wp-block-editor-iframe-zoom-out-inner-height'
538
+ // );
539
+ // iframeDocument.documentElement.style.removeProperty(
540
+ // '--wp-block-editor-iframe-zoom-out-container-width'
541
+ // );
542
+ // iframeDocument.documentElement.style.removeProperty(
543
+ // '--wp-block-editor-iframe-zoom-out-scale-container-width'
544
+ // );
405
545
  };
406
546
  }, [
407
- scale,
547
+ scaleValue,
408
548
  frameSize,
409
549
  iframeDocument,
410
550
  iframeWindowInnerHeight,
@@ -85,10 +85,10 @@ function PatternList( {
85
85
  return true;
86
86
  }
87
87
  if ( selectedCategory === 'uncategorized' ) {
88
- const hasKnownCategory = pattern.categories.some(
89
- ( category ) =>
88
+ const hasKnownCategory =
89
+ pattern.categories?.some( ( category ) =>
90
90
  registeredPatternCategories.includes( category )
91
- );
91
+ ) ?? false;
92
92
 
93
93
  return ! pattern.categories?.length || ! hasKnownCategory;
94
94
  }