@wordpress/block-editor 12.3.5 → 12.3.7

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 (76) hide show
  1. package/build/components/block-draggable/index.js +6 -3
  2. package/build/components/block-draggable/index.js.map +1 -1
  3. package/build/components/iframe/index.js +21 -46
  4. package/build/components/iframe/index.js.map +1 -1
  5. package/build/components/inserter/reusable-block-rename-hint.js +1 -1
  6. package/build/components/inserter/reusable-block-rename-hint.js.map +1 -1
  7. package/build/components/link-control/constants.js +1 -1
  8. package/build/components/link-control/constants.js.map +1 -1
  9. package/build/components/link-control/search-create-button.js +5 -21
  10. package/build/components/link-control/search-create-button.js.map +1 -1
  11. package/build/components/link-control/search-item.js +13 -30
  12. package/build/components/link-control/search-item.js.map +1 -1
  13. package/build/components/link-control/search-results.js +2 -2
  14. package/build/components/link-control/search-results.js.map +1 -1
  15. package/build/components/rich-text/content.js +0 -36
  16. package/build/components/rich-text/content.js.map +1 -1
  17. package/build/components/rich-text/get-rich-text-values.js +112 -0
  18. package/build/components/rich-text/get-rich-text-values.js.map +1 -0
  19. package/build/components/use-block-display-information/index.js +7 -3
  20. package/build/components/use-block-display-information/index.js.map +1 -1
  21. package/build/hooks/margin.js +1 -1
  22. package/build/hooks/margin.js.map +1 -1
  23. package/build/hooks/padding.js +1 -1
  24. package/build/hooks/padding.js.map +1 -1
  25. package/build/private-apis.js +2 -2
  26. package/build/private-apis.js.map +1 -1
  27. package/build/store/selectors.js +1 -1
  28. package/build/store/selectors.js.map +1 -1
  29. package/build-module/components/block-draggable/index.js +6 -3
  30. package/build-module/components/block-draggable/index.js.map +1 -1
  31. package/build-module/components/iframe/index.js +22 -47
  32. package/build-module/components/iframe/index.js.map +1 -1
  33. package/build-module/components/inserter/reusable-block-rename-hint.js +1 -1
  34. package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -1
  35. package/build-module/components/link-control/constants.js +1 -1
  36. package/build-module/components/link-control/constants.js.map +1 -1
  37. package/build-module/components/link-control/search-create-button.js +7 -20
  38. package/build-module/components/link-control/search-create-button.js.map +1 -1
  39. package/build-module/components/link-control/search-item.js +14 -28
  40. package/build-module/components/link-control/search-item.js.map +1 -1
  41. package/build-module/components/link-control/search-results.js +3 -3
  42. package/build-module/components/link-control/search-results.js.map +1 -1
  43. package/build-module/components/rich-text/content.js +1 -36
  44. package/build-module/components/rich-text/content.js.map +1 -1
  45. package/build-module/components/rich-text/get-rich-text-values.js +99 -0
  46. package/build-module/components/rich-text/get-rich-text-values.js.map +1 -0
  47. package/build-module/components/use-block-display-information/index.js +7 -3
  48. package/build-module/components/use-block-display-information/index.js.map +1 -1
  49. package/build-module/hooks/margin.js +1 -1
  50. package/build-module/hooks/margin.js.map +1 -1
  51. package/build-module/hooks/padding.js +1 -1
  52. package/build-module/hooks/padding.js.map +1 -1
  53. package/build-module/private-apis.js +1 -1
  54. package/build-module/private-apis.js.map +1 -1
  55. package/build-module/store/selectors.js +1 -1
  56. package/build-module/store/selectors.js.map +1 -1
  57. package/build-style/style-rtl.css +20 -83
  58. package/build-style/style.css +20 -83
  59. package/package.json +5 -5
  60. package/src/components/block-draggable/index.js +13 -4
  61. package/src/components/iframe/index.js +16 -47
  62. package/src/components/inserter/reusable-block-rename-hint.js +1 -1
  63. package/src/components/link-control/constants.js +1 -1
  64. package/src/components/link-control/search-create-button.js +8 -26
  65. package/src/components/link-control/search-item.js +21 -43
  66. package/src/components/link-control/search-results.js +48 -46
  67. package/src/components/link-control/style.scss +25 -95
  68. package/src/components/link-control/test/index.js +6 -7
  69. package/src/components/rich-text/content.js +1 -46
  70. package/src/components/rich-text/get-rich-text-values.js +95 -0
  71. package/src/components/use-block-display-information/index.js +12 -5
  72. package/src/hooks/margin.js +4 -1
  73. package/src/hooks/padding.js +4 -1
  74. package/src/private-apis.js +1 -1
  75. package/src/store/selectors.js +1 -1
  76. package/src/store/test/selectors.js +1 -1
@@ -1897,6 +1897,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
1897
1897
  }
1898
1898
 
1899
1899
  .block-editor-link-control__search-input-wrapper {
1900
+ margin-bottom: 8px;
1900
1901
  position: relative;
1901
1902
  }
1902
1903
 
@@ -1973,32 +1974,9 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
1973
1974
  order: 20;
1974
1975
  }
1975
1976
 
1976
- .block-editor-link-control__search-results-wrapper {
1977
- position: relative;
1978
- }
1979
- .block-editor-link-control__search-results-wrapper::before, .block-editor-link-control__search-results-wrapper::after {
1980
- content: "";
1981
- position: absolute;
1982
- right: -1px;
1983
- left: 16px;
1984
- display: block;
1985
- pointer-events: none;
1986
- z-index: 100;
1987
- }
1988
- .block-editor-link-control__search-results-wrapper::before {
1989
- height: 8px;
1990
- top: 0;
1991
- bottom: auto;
1992
- }
1993
- .block-editor-link-control__search-results-wrapper::after {
1994
- height: 16px;
1995
- bottom: 0;
1996
- top: auto;
1997
- }
1998
-
1999
1977
  .block-editor-link-control__search-results {
2000
- margin: 0;
2001
- padding: 8px 16px 8px;
1978
+ margin-top: -16px;
1979
+ padding: 8px;
2002
1980
  max-height: 200px;
2003
1981
  overflow-y: auto;
2004
1982
  }
@@ -2006,35 +1984,29 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2006
1984
  opacity: 0.2;
2007
1985
  }
2008
1986
 
2009
- .block-editor-link-control__search-item {
2010
- position: relative;
2011
- display: flex;
2012
- align-items: flex-start;
2013
- font-size: 13px;
2014
- cursor: pointer;
2015
- background: #fff;
2016
- width: 100%;
2017
- border: none;
2018
- text-align: right;
2019
- padding: 12px 16px;
2020
- border-radius: 2px;
1987
+ .block-editor-link-control__search-item.components-button.components-menu-item__button {
2021
1988
  height: auto;
1989
+ text-align: right;
2022
1990
  }
2023
- .block-editor-link-control__search-item:hover, .block-editor-link-control__search-item:focus {
2024
- background-color: #f0f0f0;
1991
+ .block-editor-link-control__search-item .components-menu-item__item {
1992
+ overflow: hidden;
1993
+ text-overflow: ellipsis;
1994
+ display: inline-block;
1995
+ width: 100%;
2025
1996
  }
2026
- .block-editor-link-control__search-item:hover .block-editor-link-control__search-item-type, .block-editor-link-control__search-item:focus .block-editor-link-control__search-item-type {
2027
- background: #fff;
1997
+ .block-editor-link-control__search-item .components-menu-item__item mark {
1998
+ font-weight: 600;
1999
+ color: inherit;
2000
+ background-color: transparent;
2028
2001
  }
2029
- .block-editor-link-control__search-item:focus:not(:disabled) {
2030
- box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color) inset;
2002
+ .block-editor-link-control__search-item .components-menu-item__shortcut {
2003
+ color: #757575;
2004
+ text-transform: capitalize;
2005
+ white-space: nowrap;
2031
2006
  }
2032
- .block-editor-link-control__search-item.is-selected {
2007
+ .block-editor-link-control__search-item[aria-selected] {
2033
2008
  background: #f0f0f0;
2034
2009
  }
2035
- .block-editor-link-control__search-item.is-selected .block-editor-link-control__search-item-type {
2036
- background: #fff;
2037
- }
2038
2010
  .block-editor-link-control__search-item.is-current {
2039
2011
  flex-direction: column;
2040
2012
  background: transparent;
@@ -2063,7 +2035,6 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2063
2035
  }
2064
2036
  .block-editor-link-control__search-item .block-editor-link-control__search-item-icon {
2065
2037
  position: relative;
2066
- top: 0.2em;
2067
2038
  margin-left: 8px;
2068
2039
  max-height: 24px;
2069
2040
  flex-shrink: 0;
@@ -2079,17 +2050,6 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2079
2050
  width: 32px;
2080
2051
  max-height: 32px;
2081
2052
  }
2082
- .block-editor-link-control__search-item .block-editor-link-control__search-item-info,
2083
- .block-editor-link-control__search-item .block-editor-link-control__search-item-title {
2084
- overflow: hidden;
2085
- text-overflow: ellipsis;
2086
- }
2087
- .block-editor-link-control__search-item .block-editor-link-control__search-item-info .components-external-link__icon,
2088
- .block-editor-link-control__search-item .block-editor-link-control__search-item-title .components-external-link__icon {
2089
- position: absolute;
2090
- left: 0;
2091
- margin-top: 0;
2092
- }
2093
2053
  .block-editor-link-control__search-item .block-editor-link-control__search-item-title {
2094
2054
  display: block;
2095
2055
  margin-bottom: 0.2em;
@@ -2097,7 +2057,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2097
2057
  position: relative;
2098
2058
  }
2099
2059
  .block-editor-link-control__search-item .block-editor-link-control__search-item-title mark {
2100
- font-weight: 700;
2060
+ font-weight: 600;
2101
2061
  color: inherit;
2102
2062
  background-color: transparent;
2103
2063
  }
@@ -2107,25 +2067,6 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2107
2067
  .block-editor-link-control__search-item .block-editor-link-control__search-item-title svg {
2108
2068
  display: none;
2109
2069
  }
2110
- .block-editor-link-control__search-item .block-editor-link-control__search-item-info {
2111
- display: block;
2112
- color: #757575;
2113
- font-size: 0.9em;
2114
- line-height: 1.3;
2115
- }
2116
- .block-editor-link-control__search-item .block-editor-link-control__search-item-error-notice {
2117
- font-style: italic;
2118
- font-size: 1.1em;
2119
- }
2120
- .block-editor-link-control__search-item .block-editor-link-control__search-item-type {
2121
- display: block;
2122
- padding: 3px 6px;
2123
- margin-right: auto;
2124
- font-size: 0.9em;
2125
- background-color: #f0f0f0;
2126
- border-radius: 2px;
2127
- white-space: nowrap;
2128
- }
2129
2070
  .block-editor-link-control__search-item .block-editor-link-control__search-item-description {
2130
2071
  padding-top: 12px;
2131
2072
  margin: 0;
@@ -2240,10 +2181,6 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2240
2181
  top: 0;
2241
2182
  }
2242
2183
 
2243
- .block-editor-link-control__search-results div[role=menu] > .block-editor-link-control__search-item.block-editor-link-control__search-item {
2244
- padding: 10px;
2245
- }
2246
-
2247
2184
  .block-editor-link-control__drawer {
2248
2185
  display: flex;
2249
2186
  order: 30;
@@ -1898,6 +1898,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
1898
1898
  }
1899
1899
 
1900
1900
  .block-editor-link-control__search-input-wrapper {
1901
+ margin-bottom: 8px;
1901
1902
  position: relative;
1902
1903
  }
1903
1904
 
@@ -1974,32 +1975,9 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
1974
1975
  order: 20;
1975
1976
  }
1976
1977
 
1977
- .block-editor-link-control__search-results-wrapper {
1978
- position: relative;
1979
- }
1980
- .block-editor-link-control__search-results-wrapper::before, .block-editor-link-control__search-results-wrapper::after {
1981
- content: "";
1982
- position: absolute;
1983
- left: -1px;
1984
- right: 16px;
1985
- display: block;
1986
- pointer-events: none;
1987
- z-index: 100;
1988
- }
1989
- .block-editor-link-control__search-results-wrapper::before {
1990
- height: 8px;
1991
- top: 0;
1992
- bottom: auto;
1993
- }
1994
- .block-editor-link-control__search-results-wrapper::after {
1995
- height: 16px;
1996
- bottom: 0;
1997
- top: auto;
1998
- }
1999
-
2000
1978
  .block-editor-link-control__search-results {
2001
- margin: 0;
2002
- padding: 8px 16px 8px;
1979
+ margin-top: -16px;
1980
+ padding: 8px;
2003
1981
  max-height: 200px;
2004
1982
  overflow-y: auto;
2005
1983
  }
@@ -2007,35 +1985,29 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2007
1985
  opacity: 0.2;
2008
1986
  }
2009
1987
 
2010
- .block-editor-link-control__search-item {
2011
- position: relative;
2012
- display: flex;
2013
- align-items: flex-start;
2014
- font-size: 13px;
2015
- cursor: pointer;
2016
- background: #fff;
2017
- width: 100%;
2018
- border: none;
2019
- text-align: left;
2020
- padding: 12px 16px;
2021
- border-radius: 2px;
1988
+ .block-editor-link-control__search-item.components-button.components-menu-item__button {
2022
1989
  height: auto;
1990
+ text-align: left;
2023
1991
  }
2024
- .block-editor-link-control__search-item:hover, .block-editor-link-control__search-item:focus {
2025
- background-color: #f0f0f0;
1992
+ .block-editor-link-control__search-item .components-menu-item__item {
1993
+ overflow: hidden;
1994
+ text-overflow: ellipsis;
1995
+ display: inline-block;
1996
+ width: 100%;
2026
1997
  }
2027
- .block-editor-link-control__search-item:hover .block-editor-link-control__search-item-type, .block-editor-link-control__search-item:focus .block-editor-link-control__search-item-type {
2028
- background: #fff;
1998
+ .block-editor-link-control__search-item .components-menu-item__item mark {
1999
+ font-weight: 600;
2000
+ color: inherit;
2001
+ background-color: transparent;
2029
2002
  }
2030
- .block-editor-link-control__search-item:focus:not(:disabled) {
2031
- box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color) inset;
2003
+ .block-editor-link-control__search-item .components-menu-item__shortcut {
2004
+ color: #757575;
2005
+ text-transform: capitalize;
2006
+ white-space: nowrap;
2032
2007
  }
2033
- .block-editor-link-control__search-item.is-selected {
2008
+ .block-editor-link-control__search-item[aria-selected] {
2034
2009
  background: #f0f0f0;
2035
2010
  }
2036
- .block-editor-link-control__search-item.is-selected .block-editor-link-control__search-item-type {
2037
- background: #fff;
2038
- }
2039
2011
  .block-editor-link-control__search-item.is-current {
2040
2012
  flex-direction: column;
2041
2013
  background: transparent;
@@ -2064,7 +2036,6 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2064
2036
  }
2065
2037
  .block-editor-link-control__search-item .block-editor-link-control__search-item-icon {
2066
2038
  position: relative;
2067
- top: 0.2em;
2068
2039
  margin-right: 8px;
2069
2040
  max-height: 24px;
2070
2041
  flex-shrink: 0;
@@ -2080,17 +2051,6 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2080
2051
  width: 32px;
2081
2052
  max-height: 32px;
2082
2053
  }
2083
- .block-editor-link-control__search-item .block-editor-link-control__search-item-info,
2084
- .block-editor-link-control__search-item .block-editor-link-control__search-item-title {
2085
- overflow: hidden;
2086
- text-overflow: ellipsis;
2087
- }
2088
- .block-editor-link-control__search-item .block-editor-link-control__search-item-info .components-external-link__icon,
2089
- .block-editor-link-control__search-item .block-editor-link-control__search-item-title .components-external-link__icon {
2090
- position: absolute;
2091
- right: 0;
2092
- margin-top: 0;
2093
- }
2094
2054
  .block-editor-link-control__search-item .block-editor-link-control__search-item-title {
2095
2055
  display: block;
2096
2056
  margin-bottom: 0.2em;
@@ -2098,7 +2058,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2098
2058
  position: relative;
2099
2059
  }
2100
2060
  .block-editor-link-control__search-item .block-editor-link-control__search-item-title mark {
2101
- font-weight: 700;
2061
+ font-weight: 600;
2102
2062
  color: inherit;
2103
2063
  background-color: transparent;
2104
2064
  }
@@ -2108,25 +2068,6 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2108
2068
  .block-editor-link-control__search-item .block-editor-link-control__search-item-title svg {
2109
2069
  display: none;
2110
2070
  }
2111
- .block-editor-link-control__search-item .block-editor-link-control__search-item-info {
2112
- display: block;
2113
- color: #757575;
2114
- font-size: 0.9em;
2115
- line-height: 1.3;
2116
- }
2117
- .block-editor-link-control__search-item .block-editor-link-control__search-item-error-notice {
2118
- font-style: italic;
2119
- font-size: 1.1em;
2120
- }
2121
- .block-editor-link-control__search-item .block-editor-link-control__search-item-type {
2122
- display: block;
2123
- padding: 3px 6px;
2124
- margin-left: auto;
2125
- font-size: 0.9em;
2126
- background-color: #f0f0f0;
2127
- border-radius: 2px;
2128
- white-space: nowrap;
2129
- }
2130
2071
  .block-editor-link-control__search-item .block-editor-link-control__search-item-description {
2131
2072
  padding-top: 12px;
2132
2073
  margin: 0;
@@ -2241,10 +2182,6 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2241
2182
  top: 0;
2242
2183
  }
2243
2184
 
2244
- .block-editor-link-control__search-results div[role=menu] > .block-editor-link-control__search-item.block-editor-link-control__search-item {
2245
- padding: 10px;
2246
- }
2247
-
2248
2185
  .block-editor-link-control__drawer {
2249
2186
  display: flex;
2250
2187
  order: 30;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "12.3.5",
3
+ "version": "12.3.7",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -38,7 +38,7 @@
38
38
  "@wordpress/api-fetch": "^6.32.1",
39
39
  "@wordpress/blob": "^3.35.1",
40
40
  "@wordpress/blocks": "^12.12.3",
41
- "@wordpress/components": "^25.1.5",
41
+ "@wordpress/components": "^25.1.7",
42
42
  "@wordpress/compose": "^6.12.1",
43
43
  "@wordpress/data": "^9.5.3",
44
44
  "@wordpress/date": "^4.35.1",
@@ -54,9 +54,9 @@
54
54
  "@wordpress/keyboard-shortcuts": "^4.12.3",
55
55
  "@wordpress/keycodes": "^3.35.1",
56
56
  "@wordpress/notices": "^4.3.3",
57
- "@wordpress/preferences": "^3.12.5",
57
+ "@wordpress/preferences": "^3.12.7",
58
58
  "@wordpress/private-apis": "^0.17.1",
59
- "@wordpress/rich-text": "^6.12.3",
59
+ "@wordpress/rich-text": "^6.12.4",
60
60
  "@wordpress/shortcode": "^3.35.1",
61
61
  "@wordpress/style-engine": "^1.18.1",
62
62
  "@wordpress/token-list": "^2.35.1",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "3eeb607ebb76c3bf06cb8acb462f0dc068f340f9"
88
+ "gitHead": "5a52ea1ed29bbf8f3ead96f83b17d2c1cf84c880"
89
89
  }
@@ -22,16 +22,25 @@ const BlockDraggable = ( {
22
22
  } ) => {
23
23
  const { srcRootClientId, isDraggable, icon } = useSelect(
24
24
  ( select ) => {
25
- const { canMoveBlocks, getBlockRootClientId, getBlockName } =
26
- select( blockEditorStore );
27
- const { getBlockType } = select( blocksStore );
25
+ const {
26
+ canMoveBlocks,
27
+ getBlockRootClientId,
28
+ getBlockName,
29
+ getBlockAttributes,
30
+ } = select( blockEditorStore );
31
+ const { getBlockType, getActiveBlockVariation } =
32
+ select( blocksStore );
28
33
  const rootClientId = getBlockRootClientId( clientIds[ 0 ] );
29
34
  const blockName = getBlockName( clientIds[ 0 ] );
35
+ const variation = getActiveBlockVariation(
36
+ blockName,
37
+ getBlockAttributes( clientIds[ 0 ] )
38
+ );
30
39
 
31
40
  return {
32
41
  srcRootClientId: rootClientId,
33
42
  isDraggable: canMoveBlocks( clientIds, rootClientId ),
34
- icon: getBlockType( blockName )?.icon,
43
+ icon: variation?.icon || getBlockType( blockName )?.icon,
35
44
  };
36
45
  },
37
46
  [ clientIds ]
@@ -11,7 +11,6 @@ import {
11
11
  createPortal,
12
12
  forwardRef,
13
13
  useMemo,
14
- useReducer,
15
14
  useEffect,
16
15
  } from '@wordpress/element';
17
16
  import { __ } from '@wordpress/i18n';
@@ -78,29 +77,6 @@ function bubbleEvents( doc ) {
78
77
  }
79
78
  }
80
79
 
81
- function useParsedAssets( html ) {
82
- return useMemo( () => {
83
- const doc = document.implementation.createHTMLDocument( '' );
84
- doc.body.innerHTML = html;
85
- return Array.from( doc.body.children );
86
- }, [ html ] );
87
- }
88
-
89
- async function loadScript( head, { id, src } ) {
90
- return new Promise( ( resolve, reject ) => {
91
- const script = head.ownerDocument.createElement( 'script' );
92
- script.id = id;
93
- if ( src ) {
94
- script.src = src;
95
- script.onload = () => resolve();
96
- script.onerror = () => reject();
97
- } else {
98
- resolve();
99
- }
100
- head.appendChild( script );
101
- } );
102
- }
103
-
104
80
  function Iframe( {
105
81
  contentRef,
106
82
  children,
@@ -112,21 +88,22 @@ function Iframe( {
112
88
  forwardedRef: ref,
113
89
  ...props
114
90
  } ) {
115
- const assets = useSelect(
91
+ const { styles = '', scripts = '' } = useSelect(
116
92
  ( select ) =>
117
93
  select( blockEditorStore ).getSettings().__unstableResolvedAssets,
118
94
  []
119
95
  );
120
- const [ , forceRender ] = useReducer( () => ( {} ) );
121
96
  const [ iframeDocument, setIframeDocument ] = useState();
122
97
  const [ bodyClasses, setBodyClasses ] = useState( [] );
123
98
  const compatStyles = useCompatibilityStyles();
124
- const scripts = useParsedAssets( assets?.scripts );
125
99
  const clearerRef = useBlockSelectionClearer();
126
100
  const [ before, writingFlowRef, after ] = useWritingFlow();
127
101
  const [ contentResizeListener, { height: contentHeight } ] =
128
102
  useResizeObserver();
129
103
  const setRef = useRefEffect( ( node ) => {
104
+ node._load = () => {
105
+ setIframeDocument( node.contentDocument );
106
+ };
130
107
  let iFrameDocument;
131
108
  // Prevent the default browser action for files dropped outside of dropzones.
132
109
  function preventFileDropDefault( event ) {
@@ -138,7 +115,6 @@ function Iframe( {
138
115
  iFrameDocument = contentDocument;
139
116
 
140
117
  bubbleEvents( contentDocument );
141
- setIframeDocument( contentDocument );
142
118
  clearerRef( documentElement );
143
119
 
144
120
  // Ideally ALL classes that are added through get_body_class should
@@ -154,7 +130,6 @@ function Iframe( {
154
130
  );
155
131
 
156
132
  contentDocument.dir = ownerDocument.dir;
157
- documentElement.removeChild( contentDocument.body );
158
133
 
159
134
  for ( const compatStyle of compatStyles ) {
160
135
  if ( contentDocument.getElementById( compatStyle.id ) ) {
@@ -199,35 +174,29 @@ function Iframe( {
199
174
  };
200
175
  }, [] );
201
176
 
202
- const headRef = useRefEffect( ( element ) => {
203
- scripts
204
- .reduce(
205
- ( promise, script ) =>
206
- promise.then( () => loadScript( element, script ) ),
207
- Promise.resolve()
208
- )
209
- .finally( () => {
210
- // When script are loaded, re-render blocks to allow them
211
- // to initialise.
212
- forceRender();
213
- } );
214
- }, [] );
215
177
  const disabledRef = useDisabled( { isDisabled: ! readonly } );
216
178
  const bodyRef = useMergeRefs( [
217
179
  contentRef,
218
180
  clearerRef,
219
181
  writingFlowRef,
220
182
  disabledRef,
221
- headRef,
222
183
  ] );
223
184
 
224
185
  // Correct doctype is required to enable rendering in standards
225
186
  // mode. Also preload the styles to avoid a flash of unstyled
226
187
  // content.
227
- const html =
228
- '<!doctype html>' +
229
- '<style>html{height:auto!important;min-height:100%;}body{margin:0}</style>' +
230
- ( assets?.styles ?? '' );
188
+ const html = `<!doctype html>
189
+ <html>
190
+ <head>
191
+ <script>window.frameElement._load()</script>
192
+ <style>html{height:auto!important;min-height:100%;}body{margin:0}</style>
193
+ ${ styles }
194
+ ${ scripts }
195
+ </head>
196
+ <body>
197
+ <script>document.currentScript.parentElement.remove()</script>
198
+ </body>
199
+ </html>`;
231
200
 
232
201
  const [ src, cleanup ] = useMemo( () => {
233
202
  const _src = URL.createObjectURL(
@@ -29,7 +29,7 @@ export default function ReusableBlocksRenameHint() {
29
29
  <div ref={ ref } className="reusable-blocks-menu-items__rename-hint">
30
30
  <div className="reusable-blocks-menu-items__rename-hint-content">
31
31
  { __(
32
- 'Reusable blocks are now called patterns. A synced pattern will behave in exactly the same way as a reusable block.'
32
+ 'Reusable blocks are now synced patterns. A synced pattern will behave in exactly the same way as a reusable block.'
33
33
  ) }
34
34
  </div>
35
35
  <Button
@@ -8,7 +8,7 @@ import { __ } from '@wordpress/i18n';
8
8
  // order to handle it as a unique case.
9
9
  export const CREATE_TYPE = '__CREATE__';
10
10
  export const TEL_TYPE = 'tel';
11
- export const URL_TYPE = 'URL';
11
+ export const URL_TYPE = 'link';
12
12
  export const MAILTO_TYPE = 'mailto';
13
13
  export const INTERNAL_TYPE = 'internal';
14
14
 
@@ -1,21 +1,15 @@
1
- /**
2
- * External dependencies
3
- */
4
- import classnames from 'classnames';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
9
4
  import { __, sprintf } from '@wordpress/i18n';
10
- import { Button } from '@wordpress/components';
5
+ import { MenuItem } from '@wordpress/components';
11
6
  import { createInterpolateElement } from '@wordpress/element';
12
- import { Icon, plus } from '@wordpress/icons';
7
+ import { plus } from '@wordpress/icons';
13
8
 
14
9
  export const LinkControlSearchCreate = ( {
15
10
  searchTerm,
16
11
  onClick,
17
12
  itemProps,
18
- isSelected,
19
13
  buttonText,
20
14
  } ) => {
21
15
  if ( ! searchTerm ) {
@@ -40,27 +34,15 @@ export const LinkControlSearchCreate = ( {
40
34
  }
41
35
 
42
36
  return (
43
- <Button
37
+ <MenuItem
44
38
  { ...itemProps }
45
- className={ classnames(
46
- 'block-editor-link-control__search-create block-editor-link-control__search-item',
47
- {
48
- 'is-selected': isSelected,
49
- }
50
- ) }
39
+ iconPosition="left"
40
+ icon={ plus }
41
+ className="block-editor-link-control__search-item"
51
42
  onClick={ onClick }
52
43
  >
53
- <Icon
54
- className="block-editor-link-control__search-item-icon"
55
- icon={ plus }
56
- />
57
-
58
- <span className="block-editor-link-control__search-item-header">
59
- <span className="block-editor-link-control__search-item-title">
60
- { text }
61
- </span>
62
- </span>
63
- </Button>
44
+ { text }
45
+ </MenuItem>
64
46
  );
65
47
  };
66
48
 
@@ -1,14 +1,8 @@
1
- /**
2
- * External dependencies
3
- */
4
- import classnames from 'classnames';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
9
- import { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';
10
4
  import { __ } from '@wordpress/i18n';
11
- import { Button, TextHighlight } from '@wordpress/components';
5
+ import { MenuItem, TextHighlight } from '@wordpress/components';
12
6
  import {
13
7
  Icon,
14
8
  globe,
@@ -19,6 +13,7 @@ import {
19
13
  file,
20
14
  } from '@wordpress/icons';
21
15
  import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
16
+ import { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';
22
17
 
23
18
  const ICONS_MAP = {
24
19
  post: postList,
@@ -52,50 +47,33 @@ function SearchItemIcon( { isURL, suggestion } ) {
52
47
  export const LinkControlSearchItem = ( {
53
48
  itemProps,
54
49
  suggestion,
55
- isSelected = false,
50
+ searchTerm,
56
51
  onClick,
57
52
  isURL = false,
58
- searchTerm = '',
59
53
  shouldShowType = false,
60
54
  } ) => {
55
+ const info = isURL
56
+ ? __( 'Press ENTER to add this link' )
57
+ : filterURLForDisplay( safeDecodeURI( suggestion?.url ) );
58
+
61
59
  return (
62
- <Button
60
+ <MenuItem
63
61
  { ...itemProps }
62
+ info={ info }
63
+ iconPosition="left"
64
+ icon={
65
+ <SearchItemIcon suggestion={ suggestion } isURL={ isURL } />
66
+ }
64
67
  onClick={ onClick }
65
- className={ classnames( 'block-editor-link-control__search-item', {
66
- 'is-selected': isSelected,
67
- 'is-url': isURL,
68
- 'is-entity': ! isURL,
69
- } ) }
68
+ shortcut={ shouldShowType && getVisualTypeName( suggestion ) }
69
+ className="block-editor-link-control__search-item"
70
70
  >
71
- <SearchItemIcon suggestion={ suggestion } isURL={ isURL } />
72
-
73
- <span className="block-editor-link-control__search-item-header">
74
- <span className="block-editor-link-control__search-item-title">
75
- <TextHighlight
76
- // The component expects a plain text string.
77
- text={ stripHTML( suggestion.title ) }
78
- highlight={ searchTerm }
79
- />
80
- </span>
81
- <span
82
- aria-hidden={ ! isURL }
83
- className="block-editor-link-control__search-item-info"
84
- >
85
- { ! isURL &&
86
- ( filterURLForDisplay(
87
- safeDecodeURI( suggestion.url )
88
- ) ||
89
- '' ) }
90
- { isURL && __( 'Press ENTER to add this link' ) }
91
- </span>
92
- </span>
93
- { shouldShowType && suggestion.type && (
94
- <span className="block-editor-link-control__search-item-type">
95
- { getVisualTypeName( suggestion ) }
96
- </span>
97
- ) }
98
- </Button>
71
+ <TextHighlight
72
+ // The component expects a plain text string.
73
+ text={ stripHTML( suggestion.title ) }
74
+ highlight={ searchTerm }
75
+ />
76
+ </MenuItem>
99
77
  );
100
78
  };
101
79