@wordpress/block-editor 14.7.1-next.082ed6819.0 → 14.8.1-next.a9f418477.0

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 (303) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/autocompleters/block.js +2 -4
  3. package/build/autocompleters/block.js.map +1 -1
  4. package/build/autocompleters/link.js +2 -4
  5. package/build/autocompleters/link.js.map +1 -1
  6. package/build/components/block-canvas/index.js +3 -6
  7. package/build/components/block-canvas/index.js.map +1 -1
  8. package/build/components/block-list/block.js +6 -5
  9. package/build/components/block-list/block.js.map +1 -1
  10. package/build/components/block-list/index.js +0 -1
  11. package/build/components/block-list/index.js.map +1 -1
  12. package/build/components/block-list/use-block-props/index.js +6 -2
  13. package/build/components/block-list/use-block-props/index.js.map +1 -1
  14. package/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +87 -0
  15. package/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map +1 -0
  16. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +98 -5
  17. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  18. package/build/components/block-lock/modal.js +4 -4
  19. package/build/components/block-lock/modal.js.map +1 -1
  20. package/build/components/block-parent-selector/index.js +2 -15
  21. package/build/components/block-parent-selector/index.js.map +1 -1
  22. package/build/components/block-patterns-list/index.js +13 -4
  23. package/build/components/block-patterns-list/index.js.map +1 -1
  24. package/build/components/block-popover/inbetween.js +4 -0
  25. package/build/components/block-popover/inbetween.js.map +1 -1
  26. package/build/components/block-settings-menu/block-settings-dropdown.js +7 -4
  27. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  28. package/build/components/block-settings-menu-controls/index.js +1 -1
  29. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  30. package/build/components/block-switcher/index.js +12 -22
  31. package/build/components/block-switcher/index.js.map +1 -1
  32. package/build/components/block-switcher/use-transformed-patterns.js +0 -1
  33. package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
  34. package/build/components/block-switcher/utils.js +0 -1
  35. package/build/components/block-switcher/utils.js.map +1 -1
  36. package/build/components/block-toolbar/index.js +17 -9
  37. package/build/components/block-toolbar/index.js.map +1 -1
  38. package/build/components/block-variation-transforms/index.js +0 -1
  39. package/build/components/block-variation-transforms/index.js.map +1 -1
  40. package/build/components/date-format-picker/index.js +0 -1
  41. package/build/components/date-format-picker/index.js.map +1 -1
  42. package/build/components/font-appearance-control/index.js +1 -0
  43. package/build/components/font-appearance-control/index.js.map +1 -1
  44. package/build/components/font-family/index.js +10 -0
  45. package/build/components/font-family/index.js.map +1 -1
  46. package/build/components/global-styles/dimensions-panel.js +17 -16
  47. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  48. package/build/components/global-styles/get-global-styles-changes.js +0 -1
  49. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  50. package/build/components/iframe/index.js +12 -216
  51. package/build/components/iframe/index.js.map +1 -1
  52. package/build/components/iframe/use-scale-canvas.js +398 -0
  53. package/build/components/iframe/use-scale-canvas.js.map +1 -0
  54. package/build/components/image-editor/use-save-image.js +22 -3
  55. package/build/components/image-editor/use-save-image.js.map +1 -1
  56. package/build/components/inserter/block-patterns-tab/index.js +0 -10
  57. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  58. package/build/components/inserter/menu.js +2 -1
  59. package/build/components/inserter/menu.js.map +1 -1
  60. package/build/components/inserter-draggable-blocks/index.js +19 -10
  61. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  62. package/build/components/inspector-controls/slot.js +2 -13
  63. package/build/components/inspector-controls/slot.js.map +1 -1
  64. package/build/components/letter-spacing-control/index.js +10 -0
  65. package/build/components/letter-spacing-control/index.js.map +1 -1
  66. package/build/components/line-height-control/index.js +1 -0
  67. package/build/components/line-height-control/index.js.map +1 -1
  68. package/build/components/media-placeholder/index.js +18 -18
  69. package/build/components/media-placeholder/index.js.map +1 -1
  70. package/build/components/multi-selection-inspector/index.js +9 -25
  71. package/build/components/multi-selection-inspector/index.js.map +1 -1
  72. package/build/components/observe-typing/index.js +0 -1
  73. package/build/components/observe-typing/index.js.map +1 -1
  74. package/build/components/recursion-provider/index.js +0 -1
  75. package/build/components/recursion-provider/index.js.map +1 -1
  76. package/build/components/rich-text/index.js +5 -1
  77. package/build/components/rich-text/index.js.map +1 -1
  78. package/build/components/rich-text/native/use-format-types.js +0 -1
  79. package/build/components/rich-text/native/use-format-types.js.map +1 -1
  80. package/build/components/rich-text/use-format-types.js +0 -1
  81. package/build/components/rich-text/use-format-types.js.map +1 -1
  82. package/build/components/spacing-sizes-control/utils.js +0 -1
  83. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  84. package/build/components/typewriter/index.js +0 -1
  85. package/build/components/typewriter/index.js.map +1 -1
  86. package/build/components/use-block-drop-zone/index.js +11 -2
  87. package/build/components/use-block-drop-zone/index.js.map +1 -1
  88. package/build/components/use-moving-animation/index.js +15 -2
  89. package/build/components/use-moving-animation/index.js.map +1 -1
  90. package/build/components/use-resize-canvas/index.js +1 -1
  91. package/build/components/use-resize-canvas/index.js.map +1 -1
  92. package/build/components/warning/index.js +2 -3
  93. package/build/components/warning/index.js.map +1 -1
  94. package/build/components/writing-flow/use-drag-selection.js +11 -0
  95. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  96. package/build/components/writing-flow/use-tab-nav.js +6 -2
  97. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  98. package/build/hooks/block-bindings.js +4 -3
  99. package/build/hooks/block-bindings.js.map +1 -1
  100. package/build/hooks/gap.js +1 -1
  101. package/build/hooks/gap.js.map +1 -1
  102. package/build/hooks/generated-class-name.js +0 -1
  103. package/build/hooks/generated-class-name.js.map +1 -1
  104. package/build/hooks/use-zoom-out.js +47 -14
  105. package/build/hooks/use-zoom-out.js.map +1 -1
  106. package/build/store/private-selectors.js +1 -7
  107. package/build/store/private-selectors.js.map +1 -1
  108. package/build/store/reducer.js +478 -2
  109. package/build/store/reducer.js.map +1 -1
  110. package/build/store/selectors.js +12 -55
  111. package/build/store/selectors.js.map +1 -1
  112. package/build/utils/object.js +0 -1
  113. package/build/utils/object.js.map +1 -1
  114. package/build-module/autocompleters/block.js +2 -4
  115. package/build-module/autocompleters/block.js.map +1 -1
  116. package/build-module/autocompleters/link.js +2 -4
  117. package/build-module/autocompleters/link.js.map +1 -1
  118. package/build-module/components/block-canvas/index.js +3 -6
  119. package/build-module/components/block-canvas/index.js.map +1 -1
  120. package/build-module/components/block-list/block.js +8 -7
  121. package/build-module/components/block-list/block.js.map +1 -1
  122. package/build-module/components/block-list/index.js +0 -1
  123. package/build-module/components/block-list/index.js.map +1 -1
  124. package/build-module/components/block-list/use-block-props/index.js +6 -2
  125. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  126. package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +80 -0
  127. package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map +1 -0
  128. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +97 -5
  129. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  130. package/build-module/components/block-lock/modal.js +4 -4
  131. package/build-module/components/block-lock/modal.js.map +1 -1
  132. package/build-module/components/block-parent-selector/index.js +2 -15
  133. package/build-module/components/block-parent-selector/index.js.map +1 -1
  134. package/build-module/components/block-patterns-list/index.js +13 -4
  135. package/build-module/components/block-patterns-list/index.js.map +1 -1
  136. package/build-module/components/block-popover/inbetween.js +4 -0
  137. package/build-module/components/block-popover/inbetween.js.map +1 -1
  138. package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -4
  139. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  140. package/build-module/components/block-settings-menu-controls/index.js +1 -1
  141. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  142. package/build-module/components/block-switcher/index.js +13 -23
  143. package/build-module/components/block-switcher/index.js.map +1 -1
  144. package/build-module/components/block-switcher/use-transformed-patterns.js +0 -1
  145. package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
  146. package/build-module/components/block-switcher/utils.js +0 -1
  147. package/build-module/components/block-switcher/utils.js.map +1 -1
  148. package/build-module/components/block-toolbar/index.js +17 -9
  149. package/build-module/components/block-toolbar/index.js.map +1 -1
  150. package/build-module/components/block-variation-transforms/index.js +0 -1
  151. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  152. package/build-module/components/date-format-picker/index.js +0 -1
  153. package/build-module/components/date-format-picker/index.js.map +1 -1
  154. package/build-module/components/font-appearance-control/index.js +1 -0
  155. package/build-module/components/font-appearance-control/index.js.map +1 -1
  156. package/build-module/components/font-family/index.js +10 -0
  157. package/build-module/components/font-family/index.js.map +1 -1
  158. package/build-module/components/global-styles/dimensions-panel.js +17 -16
  159. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  160. package/build-module/components/global-styles/get-global-styles-changes.js +0 -1
  161. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  162. package/build-module/components/iframe/index.js +14 -218
  163. package/build-module/components/iframe/index.js.map +1 -1
  164. package/build-module/components/iframe/use-scale-canvas.js +392 -0
  165. package/build-module/components/iframe/use-scale-canvas.js.map +1 -0
  166. package/build-module/components/image-editor/use-save-image.js +22 -3
  167. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  168. package/build-module/components/inserter/block-patterns-tab/index.js +1 -11
  169. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  170. package/build-module/components/inserter/menu.js +2 -1
  171. package/build-module/components/inserter/menu.js.map +1 -1
  172. package/build-module/components/inserter-draggable-blocks/index.js +20 -11
  173. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  174. package/build-module/components/inspector-controls/slot.js +3 -14
  175. package/build-module/components/inspector-controls/slot.js.map +1 -1
  176. package/build-module/components/letter-spacing-control/index.js +9 -0
  177. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  178. package/build-module/components/line-height-control/index.js +1 -0
  179. package/build-module/components/line-height-control/index.js.map +1 -1
  180. package/build-module/components/media-placeholder/index.js +18 -18
  181. package/build-module/components/media-placeholder/index.js.map +1 -1
  182. package/build-module/components/multi-selection-inspector/index.js +9 -25
  183. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  184. package/build-module/components/observe-typing/index.js +0 -1
  185. package/build-module/components/observe-typing/index.js.map +1 -1
  186. package/build-module/components/recursion-provider/index.js +0 -1
  187. package/build-module/components/recursion-provider/index.js.map +1 -1
  188. package/build-module/components/rich-text/index.js +5 -1
  189. package/build-module/components/rich-text/index.js.map +1 -1
  190. package/build-module/components/rich-text/native/use-format-types.js +0 -1
  191. package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
  192. package/build-module/components/rich-text/use-format-types.js +0 -1
  193. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  194. package/build-module/components/spacing-sizes-control/utils.js +0 -1
  195. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  196. package/build-module/components/typewriter/index.js +0 -1
  197. package/build-module/components/typewriter/index.js.map +1 -1
  198. package/build-module/components/use-block-drop-zone/index.js +11 -2
  199. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  200. package/build-module/components/use-moving-animation/index.js +15 -2
  201. package/build-module/components/use-moving-animation/index.js.map +1 -1
  202. package/build-module/components/use-resize-canvas/index.js +1 -1
  203. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  204. package/build-module/components/warning/index.js +2 -3
  205. package/build-module/components/warning/index.js.map +1 -1
  206. package/build-module/components/writing-flow/use-drag-selection.js +11 -0
  207. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  208. package/build-module/components/writing-flow/use-tab-nav.js +6 -2
  209. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  210. package/build-module/hooks/block-bindings.js +4 -3
  211. package/build-module/hooks/block-bindings.js.map +1 -1
  212. package/build-module/hooks/gap.js +1 -1
  213. package/build-module/hooks/gap.js.map +1 -1
  214. package/build-module/hooks/generated-class-name.js +0 -1
  215. package/build-module/hooks/generated-class-name.js.map +1 -1
  216. package/build-module/hooks/use-zoom-out.js +48 -15
  217. package/build-module/hooks/use-zoom-out.js.map +1 -1
  218. package/build-module/store/private-selectors.js +1 -6
  219. package/build-module/store/private-selectors.js.map +1 -1
  220. package/build-module/store/reducer.js +479 -3
  221. package/build-module/store/reducer.js.map +1 -1
  222. package/build-module/store/selectors.js +12 -55
  223. package/build-module/store/selectors.js.map +1 -1
  224. package/build-module/utils/object.js +0 -1
  225. package/build-module/utils/object.js.map +1 -1
  226. package/build-style/content-rtl.css +25 -27
  227. package/build-style/content.css +25 -27
  228. package/build-style/style-rtl.css +55 -64
  229. package/build-style/style.css +55 -64
  230. package/package.json +32 -32
  231. package/src/autocompleters/block.js +2 -4
  232. package/src/autocompleters/link.js +2 -4
  233. package/src/components/alignment-control/stories/aliginment-toolbar.story.js +47 -0
  234. package/src/components/alignment-control/stories/index.story.js +51 -0
  235. package/src/components/alignment-control/test/__snapshots__/index.js.snap +5 -5
  236. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +4 -4
  237. package/src/components/block-canvas/index.js +3 -5
  238. package/src/components/block-canvas/style.scss +2 -1
  239. package/src/components/block-draggable/content.scss +11 -5
  240. package/src/components/block-list/block.js +7 -13
  241. package/src/components/block-list/content.scss +6 -0
  242. package/src/components/block-list/use-block-props/index.js +5 -0
  243. package/src/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +83 -0
  244. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +112 -8
  245. package/src/components/block-lock/modal.js +4 -6
  246. package/src/components/block-parent-selector/index.js +1 -19
  247. package/src/components/block-patterns-list/index.js +12 -1
  248. package/src/components/block-patterns-list/stories/fixtures.js +1 -0
  249. package/src/components/block-patterns-list/style.scss +16 -5
  250. package/src/components/block-popover/inbetween.js +4 -0
  251. package/src/components/block-settings-menu/block-settings-dropdown.js +6 -1
  252. package/src/components/block-settings-menu-controls/index.js +2 -1
  253. package/src/components/block-switcher/index.js +19 -21
  254. package/src/components/block-switcher/style.scss +0 -9
  255. package/src/components/block-title/test/index.js +2 -0
  256. package/src/components/block-toolbar/index.js +17 -6
  257. package/src/components/block-tools/style.scss +44 -0
  258. package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +3 -3
  259. package/src/components/color-palette/test/__snapshots__/control.js.snap +2 -2
  260. package/src/components/dimensions-tool/stories/aspect-ratio-tool.story.js +1 -1
  261. package/src/components/dimensions-tool/stories/index.story.js +1 -1
  262. package/src/components/dimensions-tool/stories/scale-tool.story.js +1 -1
  263. package/src/components/dimensions-tool/stories/width-height-tool.story.js +1 -1
  264. package/src/components/font-appearance-control/index.js +1 -0
  265. package/src/components/font-family/index.js +10 -0
  266. package/src/components/font-family/style.scss +5 -0
  267. package/src/components/global-styles/dimensions-panel.js +16 -16
  268. package/src/components/iframe/content.scss +40 -42
  269. package/src/components/iframe/index.js +13 -313
  270. package/src/components/iframe/use-scale-canvas.js +490 -0
  271. package/src/components/image-editor/use-save-image.js +27 -2
  272. package/src/components/inserter/block-patterns-tab/index.js +1 -17
  273. package/src/components/inserter/menu.js +8 -1
  274. package/src/components/inserter-draggable-blocks/index.js +19 -29
  275. package/src/components/inspector-controls/slot.js +3 -22
  276. package/src/components/letter-spacing-control/README.md +2 -1
  277. package/src/components/letter-spacing-control/index.js +17 -0
  278. package/src/components/line-height-control/index.js +1 -0
  279. package/src/components/media-placeholder/index.js +25 -28
  280. package/src/components/multi-selection-inspector/index.js +17 -27
  281. package/src/components/multi-selection-inspector/style.scss +0 -12
  282. package/src/components/resolution-tool/stories/index.story.js +1 -1
  283. package/src/components/rich-text/index.js +5 -0
  284. package/src/components/spacing-sizes-control/style.scss +0 -29
  285. package/src/components/text-alignment-control/stories/index.story.js +1 -1
  286. package/src/components/use-block-drop-zone/index.js +18 -1
  287. package/src/components/use-moving-animation/index.js +15 -0
  288. package/src/components/use-resize-canvas/index.js +1 -1
  289. package/src/components/warning/index.js +3 -4
  290. package/src/components/warning/test/index.js +3 -1
  291. package/src/components/writing-flow/use-drag-selection.js +11 -0
  292. package/src/components/writing-flow/use-tab-nav.js +9 -6
  293. package/src/hooks/block-bindings.js +8 -4
  294. package/src/hooks/gap.js +1 -1
  295. package/src/hooks/use-zoom-out.js +48 -16
  296. package/src/store/private-selectors.js +2 -17
  297. package/src/store/reducer.js +639 -2
  298. package/src/store/selectors.js +19 -69
  299. package/src/store/test/private-selectors.js +1 -0
  300. package/src/store/test/reducer.js +849 -0
  301. package/src/store/test/selectors.js +4 -110
  302. package/src/style.scss +1 -0
  303. package/tsconfig.tsbuildinfo +1 -1
@@ -15,6 +15,7 @@ var _data = require("@wordpress/data");
15
15
  var _blockSelectionClearer = require("../block-selection-clearer");
16
16
  var _writingFlow = require("../writing-flow");
17
17
  var _getCompatibilityStyles = require("./get-compatibility-styles");
18
+ var _useScaleCanvas = require("./use-scale-canvas");
18
19
  var _store = require("../../store");
19
20
  var _jsxRuntime = require("react/jsx-runtime");
20
21
  /**
@@ -127,17 +128,9 @@ function Iframe({
127
128
  } = resolvedAssets;
128
129
  /** @type {[Document, import('react').Dispatch<Document>]} */
129
130
  const [iframeDocument, setIframeDocument] = (0, _element.useState)();
130
- const initialContainerWidthRef = (0, _element.useRef)(0);
131
131
  const [bodyClasses, setBodyClasses] = (0, _element.useState)([]);
132
132
  const clearerRef = (0, _blockSelectionClearer.useBlockSelectionClearer)();
133
133
  const [before, writingFlowRef, after] = (0, _writingFlow.useWritingFlow)();
134
- const [contentResizeListener, {
135
- height: contentHeight
136
- }] = (0, _compose.useResizeObserver)();
137
- const [containerResizeListener, {
138
- width: containerWidth
139
- }] = (0, _compose.useResizeObserver)();
140
- const prefersReducedMotion = (0, _compose.useReducedMotion)();
141
134
  const setRef = (0, _compose.useRefEffect)(node => {
142
135
  node._load = () => {
143
136
  setIframeDocument(node.contentDocument);
@@ -200,51 +193,20 @@ function Iframe({
200
193
  iFrameDocument?.removeEventListener('drop', preventFileDropDefault);
201
194
  };
202
195
  }, []);
203
- const [iframeWindowInnerHeight, setIframeWindowInnerHeight] = (0, _element.useState)();
204
- const iframeResizeRef = (0, _compose.useRefEffect)(node => {
205
- const nodeWindow = node.ownerDocument.defaultView;
206
- setIframeWindowInnerHeight(nodeWindow.innerHeight);
207
- const onResize = () => {
208
- setIframeWindowInnerHeight(nodeWindow.innerHeight);
209
- };
210
- nodeWindow.addEventListener('resize', onResize);
211
- return () => {
212
- nodeWindow.removeEventListener('resize', onResize);
213
- };
214
- }, []);
215
- const [windowInnerWidth, setWindowInnerWidth] = (0, _element.useState)();
216
- const windowResizeRef = (0, _compose.useRefEffect)(node => {
217
- const nodeWindow = node.ownerDocument.defaultView;
218
- setWindowInnerWidth(nodeWindow.innerWidth);
219
- const onResize = () => {
220
- setWindowInnerWidth(nodeWindow.innerWidth);
221
- };
222
- nodeWindow.addEventListener('resize', onResize);
223
- return () => {
224
- nodeWindow.removeEventListener('resize', onResize);
225
- };
226
- }, []);
227
- const isZoomedOut = scale !== 1;
228
- (0, _element.useEffect)(() => {
229
- if (!isZoomedOut) {
230
- initialContainerWidthRef.current = containerWidth;
231
- }
232
- }, [containerWidth, isZoomedOut]);
233
- const scaleContainerWidth = Math.max(initialContainerWidthRef.current, containerWidth);
234
- const frameSizeValue = parseInt(frameSize);
235
- const maxWidth = 750;
236
- const scaleValue = scale === 'auto-scaled' ? (Math.min(containerWidth, maxWidth) - frameSizeValue * 2) / scaleContainerWidth : scale;
237
- const prevScaleRef = (0, _element.useRef)(scaleValue);
238
- const prevFrameSizeRef = (0, _element.useRef)(frameSizeValue);
239
- const prevClientHeightRef = (0, _element.useRef)(/* Initialized in the useEffect. */);
196
+ const {
197
+ contentResizeListener,
198
+ containerResizeListener,
199
+ isZoomedOut,
200
+ scaleContainerWidth
201
+ } = (0, _useScaleCanvas.useScaleCanvas)({
202
+ scale,
203
+ frameSize: parseInt(frameSize),
204
+ iframeDocument
205
+ });
240
206
  const disabledRef = (0, _compose.useDisabled)({
241
207
  isDisabled: !readonly
242
208
  });
243
- const bodyRef = (0, _compose.useMergeRefs)([useBubbleEvents(iframeDocument), contentRef, clearerRef, writingFlowRef, disabledRef,
244
- // Avoid resize listeners when not needed, these will trigger
245
- // unnecessary re-renders when animating the iframe width, or when
246
- // expanding preview iframes.
247
- isZoomedOut ? iframeResizeRef : null]);
209
+ const bodyRef = (0, _compose.useMergeRefs)([useBubbleEvents(iframeDocument), contentRef, clearerRef, writingFlowRef, disabledRef]);
248
210
 
249
211
  // Correct doctype is required to enable rendering in standards
250
212
  // mode. Also preload the styles to avoid a flash of unstyled
@@ -282,171 +244,6 @@ function Iframe({
282
244
  return [_src, () => URL.revokeObjectURL(_src)];
283
245
  }, [html]);
284
246
  (0, _element.useEffect)(() => cleanup, [cleanup]);
285
- (0, _element.useEffect)(() => {
286
- var _prevClientHeightRef$;
287
- if (!iframeDocument ||
288
- // HACK: Checking if isZoomedOut differs from prevIsZoomedOut here
289
- // instead of the dependency array to appease the linter.
290
- scaleValue === 1 === (prevScaleRef.current === 1)) {
291
- return;
292
- }
293
-
294
- // Unscaled height of the current iframe container.
295
- const clientHeight = iframeDocument.documentElement.clientHeight;
296
-
297
- // Scaled height of the current iframe content.
298
- const scrollHeight = iframeDocument.documentElement.scrollHeight;
299
-
300
- // Previous scale value.
301
- const prevScale = prevScaleRef.current;
302
-
303
- // Unscaled size of the previous padding around the iframe content.
304
- const prevFrameSize = prevFrameSizeRef.current;
305
-
306
- // Unscaled height of the previous iframe container.
307
- const prevClientHeight = (_prevClientHeightRef$ = prevClientHeightRef.current) !== null && _prevClientHeightRef$ !== void 0 ? _prevClientHeightRef$ : clientHeight;
308
-
309
- // We can't trust the set value from contentHeight, as it was measured
310
- // before the zoom out mode was changed. After zoom out mode is changed,
311
- // appenders may appear or disappear, so we need to get the height from
312
- // the iframe at this point when we're about to animate the zoom out.
313
- // The iframe scrollTop, scrollHeight, and clientHeight will all be
314
- // accurate. The client height also does change when the zoom out mode
315
- // is toggled, as the bottom bar about selecting the template is
316
- // added/removed when toggling zoom out mode.
317
- const scrollTop = iframeDocument.documentElement.scrollTop;
318
-
319
- // Step 0: Start with the current scrollTop.
320
- let scrollTopNext = scrollTop;
321
-
322
- // Step 1: Undo the effects of the previous scale and frame around the
323
- // midpoint of the visible area.
324
- scrollTopNext = (scrollTopNext + prevClientHeight / 2 - prevFrameSize) / prevScale - prevClientHeight / 2;
325
-
326
- // Step 2: Apply the new scale and frame around the midpoint of the
327
- // visible area.
328
- scrollTopNext = (scrollTopNext + clientHeight / 2) * scaleValue + frameSizeValue - clientHeight / 2;
329
-
330
- // Step 3: Handle an edge case so that you scroll to the top of the
331
- // iframe if the top of the iframe content is visible in the container.
332
- // The same edge case for the bottom is skipped because changing content
333
- // makes calculating it impossible.
334
- scrollTopNext = scrollTop <= prevFrameSize ? 0 : scrollTopNext;
335
-
336
- // This is the scrollTop value if you are scrolled to the bottom of the
337
- // iframe. We can't just let the browser handle it because we need to
338
- // animate the scaling.
339
- const maxScrollTop = scrollHeight * (scaleValue / prevScale) + frameSizeValue * 2 - clientHeight;
340
-
341
- // Step 4: Clamp the scrollTopNext between the minimum and maximum
342
- // possible scrollTop positions. Round the value to avoid subpixel
343
- // truncation by the browser which sometimes causes a 1px error.
344
- scrollTopNext = Math.round(Math.min(Math.max(0, scrollTopNext), Math.max(0, maxScrollTop)));
345
- iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scroll-top', `${scrollTop}px`);
346
- iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scroll-top-next', `${scrollTopNext}px`);
347
- iframeDocument.documentElement.classList.add('zoom-out-animation');
348
- function onZoomOutTransitionEnd() {
349
- // Remove the position fixed for the animation.
350
- iframeDocument.documentElement.classList.remove('zoom-out-animation');
351
-
352
- // Update previous values.
353
- prevClientHeightRef.current = clientHeight;
354
- prevFrameSizeRef.current = frameSizeValue;
355
- prevScaleRef.current = scaleValue;
356
-
357
- // Set the final scroll position that was just animated to.
358
- // Disable reason: Eslint isn't smart enough to know that this is a
359
- // DOM element. https://github.com/facebook/react/issues/31483
360
- // eslint-disable-next-line react-compiler/react-compiler
361
- iframeDocument.documentElement.scrollTop = scrollTopNext;
362
- }
363
- let raf;
364
- if (prefersReducedMotion) {
365
- // Hack: Wait for the window values to recalculate.
366
- raf = iframeDocument.defaultView.requestAnimationFrame(onZoomOutTransitionEnd);
367
- } else {
368
- iframeDocument.documentElement.addEventListener('transitionend', onZoomOutTransitionEnd, {
369
- once: true
370
- });
371
- }
372
- return () => {
373
- iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-scroll-top');
374
- iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-scroll-top-next');
375
- iframeDocument.documentElement.classList.remove('zoom-out-animation');
376
- if (prefersReducedMotion) {
377
- iframeDocument.defaultView.cancelAnimationFrame(raf);
378
- } else {
379
- iframeDocument.documentElement.removeEventListener('transitionend', onZoomOutTransitionEnd);
380
- }
381
- };
382
- }, [iframeDocument, scaleValue, frameSizeValue, prefersReducedMotion]);
383
-
384
- // Toggle zoom out CSS Classes only when zoom out mode changes. We could add these into the useEffect
385
- // that controls settings the CSS variables, but then we would need to do more work to ensure we're
386
- // only toggling these when the zoom out mode changes, as that useEffect is also triggered by a large
387
- // number of dependencies.
388
- (0, _element.useEffect)(() => {
389
- if (!iframeDocument) {
390
- return;
391
- }
392
- if (isZoomedOut) {
393
- iframeDocument.documentElement.classList.add('is-zoomed-out');
394
- } else {
395
- // HACK: Since we can't remove this in the cleanup, we need to do it here.
396
- iframeDocument.documentElement.classList.remove('is-zoomed-out');
397
- }
398
- return () => {
399
- // HACK: Skipping cleanup because it causes issues with the zoom out
400
- // animation. More refactoring is needed to fix this properly.
401
- // iframeDocument.documentElement.classList.remove( 'is-zoomed-out' );
402
- };
403
- }, [iframeDocument, isZoomedOut]);
404
-
405
- // Calculate the scaling and CSS variables for the zoom out canvas
406
- (0, _element.useEffect)(() => {
407
- if (!iframeDocument) {
408
- return;
409
- }
410
-
411
- // Note: When we initialize the zoom out when the canvas is smaller (sidebars open),
412
- // initialContainerWidthRef will be smaller than the full page, and reflow will happen
413
- // when the canvas area becomes larger due to sidebars closing. This is a known but
414
- // minor divergence for now.
415
-
416
- // This scaling calculation has to happen within the JS because CSS calc() can
417
- // only divide and multiply by a unitless value. I.e. calc( 100px / 2 ) is valid
418
- // but calc( 100px / 2px ) is not.
419
- iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scale', scaleValue);
420
-
421
- // frameSize has to be a px value for the scaling and frame size to be computed correctly.
422
- iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-frame-size', typeof frameSize === 'number' ? `${frameSize}px` : frameSize);
423
- iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-content-height', `${contentHeight}px`);
424
- iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-inner-height', `${iframeWindowInnerHeight}px`);
425
- iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-container-width', `${containerWidth}px`);
426
- iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scale-container-width', `${scaleContainerWidth}px`);
427
- return () => {
428
- // HACK: Skipping cleanup because it causes issues with the zoom out
429
- // animation. More refactoring is needed to fix this properly.
430
- // iframeDocument.documentElement.style.removeProperty(
431
- // '--wp-block-editor-iframe-zoom-out-scale'
432
- // );
433
- // iframeDocument.documentElement.style.removeProperty(
434
- // '--wp-block-editor-iframe-zoom-out-frame-size'
435
- // );
436
- // iframeDocument.documentElement.style.removeProperty(
437
- // '--wp-block-editor-iframe-zoom-out-content-height'
438
- // );
439
- // iframeDocument.documentElement.style.removeProperty(
440
- // '--wp-block-editor-iframe-zoom-out-inner-height'
441
- // );
442
- // iframeDocument.documentElement.style.removeProperty(
443
- // '--wp-block-editor-iframe-zoom-out-container-width'
444
- // );
445
- // iframeDocument.documentElement.style.removeProperty(
446
- // '--wp-block-editor-iframe-zoom-out-scale-container-width'
447
- // );
448
- };
449
- }, [scaleValue, frameSize, iframeDocument, iframeWindowInnerHeight, contentHeight, containerWidth, windowInnerWidth, isZoomedOut, scaleContainerWidth]);
450
247
 
451
248
  // Make sure to not render the before and after focusable div elements in view
452
249
  // mode. They're only needed to capture focus in edit mode.
@@ -509,7 +306,6 @@ function Iframe({
509
306
  });
510
307
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
511
308
  className: "block-editor-iframe__container",
512
- ref: windowResizeRef,
513
309
  children: [containerResizeListener, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
514
310
  className: (0, _clsx.default)('block-editor-iframe__scale-container', isZoomedOut && 'is-zoomed-out'),
515
311
  style: {
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_i18n","_compose","_components","_data","_blockSelectionClearer","_writingFlow","_getCompatibilityStyles","_store","_jsxRuntime","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","useRefEffect","frameElement","html","documentElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","readonly","forwardedRef","ref","title","__","props","resolvedAssets","isPreviewMode","useSelect","select","getSettings","blockEditorStore","settings","__unstableResolvedAssets","styles","scripts","setIframeDocument","useState","initialContainerWidthRef","useRef","bodyClasses","setBodyClasses","clearerRef","useBlockSelectionClearer","before","writingFlowRef","after","useWritingFlow","contentResizeListener","height","contentHeight","useResizeObserver","containerResizeListener","width","containerWidth","prefersReducedMotion","useReducedMotion","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","classList","add","Array","from","body","filter","startsWith","dir","compatStyle","getCompatibilityStyles","getElementById","id","head","appendChild","cloneNode","console","warn","target","tagName","href","getAttribute","location","hash","slice","iframeWindowInnerHeight","setIframeWindowInnerHeight","iframeResizeRef","nodeWindow","innerHeight","onResize","windowInnerWidth","setWindowInnerWidth","windowResizeRef","innerWidth","isZoomedOut","useEffect","current","scaleContainerWidth","Math","max","frameSizeValue","parseInt","maxWidth","scaleValue","min","prevScaleRef","prevFrameSizeRef","prevClientHeightRef","disabledRef","useDisabled","isDisabled","bodyRef","useMergeRefs","origin","src","cleanup","useMemo","_src","URL","createObjectURL","Blob","revokeObjectURL","_prevClientHeightRef$","clientHeight","scrollHeight","prevScale","prevFrameSize","prevClientHeight","scrollTop","scrollTopNext","maxScrollTop","round","style","setProperty","onZoomOutTransitionEnd","remove","raf","requestAnimationFrame","once","removeProperty","cancelAnimationFrame","shouldRenderFocusCaptureElements","iframe","jsxs","Fragment","jsx","border","onKeyDown","currentTarget","stopPropagation","nativeEvent","KeyboardEvent","createPortal","className","clsx","__experimentalStyleProvider","document","IframeIfReady","isInitialised","__internalIsInitialized","_default","exports","default","forwardRef"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n\tuseReducedMotion,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { getCompatibilityStyles } from './get-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\treadonly,\n\tforwardedRef: ref,\n\ttitle = __( 'Editor canvas' ),\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst settings = getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.isPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\t/** @type {[Document, import('react').Dispatch<Document>]} */\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst initialContainerWidthRef = useRef( 0 );\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst [ containerResizeListener, { width: containerWidth } ] =\n\t\tuseResizeObserver();\n\tconst prefersReducedMotion = useReducedMotion();\n\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tdocumentElement.classList.add( 'block-editor-iframe__html' );\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of getCompatibilityStyles() ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\t// Prevent clicks on links from navigating away. Note that links\n\t\t\t// inside `contenteditable` are already disabled by the browser, so\n\t\t\t// this is for links in blocks outside of `contenteditable`.\n\t\t\tiFrameDocument.addEventListener( 'click', ( event ) => {\n\t\t\t\tif ( event.target.tagName === 'A' ) {\n\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t// Appending a hash to the current URL will not reload the\n\t\t\t\t\t// page. This is useful for e.g. footnotes.\n\t\t\t\t\tconst href = event.target.getAttribute( 'href' );\n\t\t\t\t\tif ( href.startsWith( '#' ) ) {\n\t\t\t\t\t\tiFrameDocument.defaultView.location.hash =\n\t\t\t\t\t\t\thref.slice( 1 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst [ iframeWindowInnerHeight, setIframeWindowInnerHeight ] = useState();\n\n\tconst iframeResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\tconst onResize = () => {\n\t\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst [ windowInnerWidth, setWindowInnerWidth ] = useState();\n\n\tconst windowResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\tconst onResize = () => {\n\t\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst isZoomedOut = scale !== 1;\n\n\tuseEffect( () => {\n\t\tif ( ! isZoomedOut ) {\n\t\t\tinitialContainerWidthRef.current = containerWidth;\n\t\t}\n\t}, [ containerWidth, isZoomedOut ] );\n\n\tconst scaleContainerWidth = Math.max(\n\t\tinitialContainerWidthRef.current,\n\t\tcontainerWidth\n\t);\n\n\tconst frameSizeValue = parseInt( frameSize );\n\n\tconst maxWidth = 750;\n\tconst scaleValue =\n\t\tscale === 'auto-scaled'\n\t\t\t? ( Math.min( containerWidth, maxWidth ) - frameSizeValue * 2 ) /\n\t\t\t scaleContainerWidth\n\t\t\t: scale;\n\n\tconst prevScaleRef = useRef( scaleValue );\n\tconst prevFrameSizeRef = useRef( frameSizeValue );\n\tconst prevClientHeightRef = useRef( /* Initialized in the useEffect. */ );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t\t// Avoid resize listeners when not needed, these will trigger\n\t\t// unnecessary re-renders when animating the iframe width, or when\n\t\t// expanding preview iframes.\n\t\tisZoomedOut ? iframeResizeRef : null,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<base href=\"${ window.location.origin }\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>\n\t\t\thtml{\n\t\t\t\theight: auto !important;\n\t\t\t\tmin-height: 100%;\n\t\t\t}\n\t\t\t/* Lowest specificity to not override global styles */\n\t\t\t:where(body) {\n\t\t\t\tmargin: 0;\n\t\t\t\t/* Default background color in case zoom out mode background\n\t\t\t\tcolors the html element */\n\t\t\t\tbackground-color: white;\n\t\t\t}\n\t\t</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! iframeDocument ||\n\t\t\t// HACK: Checking if isZoomedOut differs from prevIsZoomedOut here\n\t\t\t// instead of the dependency array to appease the linter.\n\t\t\t( scaleValue === 1 ) === ( prevScaleRef.current === 1 )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Unscaled height of the current iframe container.\n\t\tconst clientHeight = iframeDocument.documentElement.clientHeight;\n\n\t\t// Scaled height of the current iframe content.\n\t\tconst scrollHeight = iframeDocument.documentElement.scrollHeight;\n\n\t\t// Previous scale value.\n\t\tconst prevScale = prevScaleRef.current;\n\n\t\t// Unscaled size of the previous padding around the iframe content.\n\t\tconst prevFrameSize = prevFrameSizeRef.current;\n\n\t\t// Unscaled height of the previous iframe container.\n\t\tconst prevClientHeight = prevClientHeightRef.current ?? clientHeight;\n\n\t\t// We can't trust the set value from contentHeight, as it was measured\n\t\t// before the zoom out mode was changed. After zoom out mode is changed,\n\t\t// appenders may appear or disappear, so we need to get the height from\n\t\t// the iframe at this point when we're about to animate the zoom out.\n\t\t// The iframe scrollTop, scrollHeight, and clientHeight will all be\n\t\t// accurate. The client height also does change when the zoom out mode\n\t\t// is toggled, as the bottom bar about selecting the template is\n\t\t// added/removed when toggling zoom out mode.\n\t\tconst scrollTop = iframeDocument.documentElement.scrollTop;\n\n\t\t// Step 0: Start with the current scrollTop.\n\t\tlet scrollTopNext = scrollTop;\n\n\t\t// Step 1: Undo the effects of the previous scale and frame around the\n\t\t// midpoint of the visible area.\n\t\tscrollTopNext =\n\t\t\t( scrollTopNext + prevClientHeight / 2 - prevFrameSize ) /\n\t\t\t\tprevScale -\n\t\t\tprevClientHeight / 2;\n\n\t\t// Step 2: Apply the new scale and frame around the midpoint of the\n\t\t// visible area.\n\t\tscrollTopNext =\n\t\t\t( scrollTopNext + clientHeight / 2 ) * scaleValue +\n\t\t\tframeSizeValue -\n\t\t\tclientHeight / 2;\n\n\t\t// Step 3: Handle an edge case so that you scroll to the top of the\n\t\t// iframe if the top of the iframe content is visible in the container.\n\t\t// The same edge case for the bottom is skipped because changing content\n\t\t// makes calculating it impossible.\n\t\tscrollTopNext = scrollTop <= prevFrameSize ? 0 : scrollTopNext;\n\n\t\t// This is the scrollTop value if you are scrolled to the bottom of the\n\t\t// iframe. We can't just let the browser handle it because we need to\n\t\t// animate the scaling.\n\t\tconst maxScrollTop =\n\t\t\tscrollHeight * ( scaleValue / prevScale ) +\n\t\t\tframeSizeValue * 2 -\n\t\t\tclientHeight;\n\n\t\t// Step 4: Clamp the scrollTopNext between the minimum and maximum\n\t\t// possible scrollTop positions. Round the value to avoid subpixel\n\t\t// truncation by the browser which sometimes causes a 1px error.\n\t\tscrollTopNext = Math.round(\n\t\t\tMath.min(\n\t\t\t\tMath.max( 0, scrollTopNext ),\n\t\t\t\tMath.max( 0, maxScrollTop )\n\t\t\t)\n\t\t);\n\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-scroll-top',\n\t\t\t`${ scrollTop }px`\n\t\t);\n\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-scroll-top-next',\n\t\t\t`${ scrollTopNext }px`\n\t\t);\n\n\t\tiframeDocument.documentElement.classList.add( 'zoom-out-animation' );\n\n\t\tfunction onZoomOutTransitionEnd() {\n\t\t\t// Remove the position fixed for the animation.\n\t\t\tiframeDocument.documentElement.classList.remove(\n\t\t\t\t'zoom-out-animation'\n\t\t\t);\n\n\t\t\t// Update previous values.\n\t\t\tprevClientHeightRef.current = clientHeight;\n\t\t\tprevFrameSizeRef.current = frameSizeValue;\n\t\t\tprevScaleRef.current = scaleValue;\n\n\t\t\t// Set the final scroll position that was just animated to.\n\t\t\t// Disable reason: Eslint isn't smart enough to know that this is a\n\t\t\t// DOM element. https://github.com/facebook/react/issues/31483\n\t\t\t// eslint-disable-next-line react-compiler/react-compiler\n\t\t\tiframeDocument.documentElement.scrollTop = scrollTopNext;\n\t\t}\n\n\t\tlet raf;\n\t\tif ( prefersReducedMotion ) {\n\t\t\t// Hack: Wait for the window values to recalculate.\n\t\t\traf = iframeDocument.defaultView.requestAnimationFrame(\n\t\t\t\tonZoomOutTransitionEnd\n\t\t\t);\n\t\t} else {\n\t\t\tiframeDocument.documentElement.addEventListener(\n\t\t\t\t'transitionend',\n\t\t\t\tonZoomOutTransitionEnd,\n\t\t\t\t{ once: true }\n\t\t\t);\n\t\t}\n\n\t\treturn () => {\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-scroll-top'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-scroll-top-next'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.classList.remove(\n\t\t\t\t'zoom-out-animation'\n\t\t\t);\n\t\t\tif ( prefersReducedMotion ) {\n\t\t\t\tiframeDocument.defaultView.cancelAnimationFrame( raf );\n\t\t\t} else {\n\t\t\t\tiframeDocument.documentElement.removeEventListener(\n\t\t\t\t\t'transitionend',\n\t\t\t\t\tonZoomOutTransitionEnd\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\t}, [ iframeDocument, scaleValue, frameSizeValue, prefersReducedMotion ] );\n\n\t// Toggle zoom out CSS Classes only when zoom out mode changes. We could add these into the useEffect\n\t// that controls settings the CSS variables, but then we would need to do more work to ensure we're\n\t// only toggling these when the zoom out mode changes, as that useEffect is also triggered by a large\n\t// number of dependencies.\n\tuseEffect( () => {\n\t\tif ( ! iframeDocument ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isZoomedOut ) {\n\t\t\tiframeDocument.documentElement.classList.add( 'is-zoomed-out' );\n\t\t} else {\n\t\t\t// HACK: Since we can't remove this in the cleanup, we need to do it here.\n\t\t\tiframeDocument.documentElement.classList.remove( 'is-zoomed-out' );\n\t\t}\n\n\t\treturn () => {\n\t\t\t// HACK: Skipping cleanup because it causes issues with the zoom out\n\t\t\t// animation. More refactoring is needed to fix this properly.\n\t\t\t// iframeDocument.documentElement.classList.remove( 'is-zoomed-out' );\n\t\t};\n\t}, [ iframeDocument, isZoomedOut ] );\n\n\t// Calculate the scaling and CSS variables for the zoom out canvas\n\tuseEffect( () => {\n\t\tif ( ! iframeDocument ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Note: When we initialize the zoom out when the canvas is smaller (sidebars open),\n\t\t// initialContainerWidthRef will be smaller than the full page, and reflow will happen\n\t\t// when the canvas area becomes larger due to sidebars closing. This is a known but\n\t\t// minor divergence for now.\n\n\t\t// This scaling calculation has to happen within the JS because CSS calc() can\n\t\t// only divide and multiply by a unitless value. I.e. calc( 100px / 2 ) is valid\n\t\t// but calc( 100px / 2px ) is not.\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-scale',\n\t\t\tscaleValue\n\t\t);\n\n\t\t// frameSize has to be a px value for the scaling and frame size to be computed correctly.\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size',\n\t\t\ttypeof frameSize === 'number' ? `${ frameSize }px` : frameSize\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-content-height',\n\t\t\t`${ contentHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height',\n\t\t\t`${ iframeWindowInnerHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-container-width',\n\t\t\t`${ containerWidth }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-scale-container-width',\n\t\t\t`${ scaleContainerWidth }px`\n\t\t);\n\n\t\treturn () => {\n\t\t\t// HACK: Skipping cleanup because it causes issues with the zoom out\n\t\t\t// animation. More refactoring is needed to fix this properly.\n\t\t\t// iframeDocument.documentElement.style.removeProperty(\n\t\t\t// \t'--wp-block-editor-iframe-zoom-out-scale'\n\t\t\t// );\n\t\t\t// iframeDocument.documentElement.style.removeProperty(\n\t\t\t// \t'--wp-block-editor-iframe-zoom-out-frame-size'\n\t\t\t// );\n\t\t\t// iframeDocument.documentElement.style.removeProperty(\n\t\t\t// \t'--wp-block-editor-iframe-zoom-out-content-height'\n\t\t\t// );\n\t\t\t// iframeDocument.documentElement.style.removeProperty(\n\t\t\t// \t'--wp-block-editor-iframe-zoom-out-inner-height'\n\t\t\t// );\n\t\t\t// iframeDocument.documentElement.style.removeProperty(\n\t\t\t// \t'--wp-block-editor-iframe-zoom-out-container-width'\n\t\t\t// );\n\t\t\t// iframeDocument.documentElement.style.removeProperty(\n\t\t\t// \t'--wp-block-editor-iframe-zoom-out-scale-container-width'\n\t\t\t// );\n\t\t};\n\t}, [\n\t\tscaleValue,\n\t\tframeSize,\n\t\tiframeDocument,\n\t\tiframeWindowInnerHeight,\n\t\tcontentHeight,\n\t\tcontainerWidth,\n\t\twindowInnerWidth,\n\t\tisZoomedOut,\n\t\tscaleContainerWidth,\n\t] );\n\n\t// Make sure to not render the before and after focusable div elements in view\n\t// mode. They're only needed to capture focus in edit mode.\n\tconst shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;\n\n\tconst iframe = (\n\t\t<>\n\t\t\t{ shouldRenderFocusCaptureElements && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: props.style?.height,\n\t\t\t\t\tborder: 0,\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ title }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( props.onKeyDown ) {\n\t\t\t\t\t\tprops.onKeyDown( event );\n\t\t\t\t\t}\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We should only stop propagation of the React event,\n\t\t\t\t\t\t// the native event should further bubble inside the\n\t\t\t\t\t\t// iframe to the document and window.\n\t\t\t\t\t\t// Alternatively, we could consider redispatching the\n\t\t\t\t\t\t// native event in the iframe.\n\t\t\t\t\t\tconst { stopPropagation } = event.nativeEvent;\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = () => {};\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = stopPropagation;\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ shouldRenderFocusCaptureElements && after }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-iframe__container\" ref={ windowResizeRef }>\n\t\t\t{ containerResizeListener }\n\t\t\t<div\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-iframe__scale-container',\n\t\t\t\t\tisZoomedOut && 'is-zoomed-out'\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-scale-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ scaleContainerWidth }px`,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframe }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,Q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5BC,MAAM,IACPA,MAAM,CAAEE,YAAiB,CAAC,CAACD,WAAW,CAAC,CAAC,CAACqI,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,oBAAO,IAAA3L,WAAA,CAAA8K,GAAA,EAACvI,MAAM;IAAA,GAAMW,KAAK;IAAGJ,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAAC,IAAA8I,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,mBAAU,EAAEN,aAAc,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_i18n","_compose","_components","_data","_blockSelectionClearer","_writingFlow","_getCompatibilityStyles","_useScaleCanvas","_store","_jsxRuntime","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","useRefEffect","frameElement","html","documentElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","readonly","forwardedRef","ref","title","__","props","resolvedAssets","isPreviewMode","useSelect","select","getSettings","blockEditorStore","settings","__unstableResolvedAssets","styles","scripts","setIframeDocument","useState","bodyClasses","setBodyClasses","clearerRef","useBlockSelectionClearer","before","writingFlowRef","after","useWritingFlow","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","classList","add","Array","from","body","filter","startsWith","dir","compatStyle","getCompatibilityStyles","getElementById","id","head","appendChild","cloneNode","console","warn","target","tagName","href","getAttribute","location","hash","slice","contentResizeListener","containerResizeListener","isZoomedOut","scaleContainerWidth","useScaleCanvas","parseInt","disabledRef","useDisabled","isDisabled","bodyRef","useMergeRefs","origin","src","cleanup","useMemo","_src","URL","createObjectURL","Blob","revokeObjectURL","useEffect","shouldRenderFocusCaptureElements","iframe","jsxs","Fragment","jsx","style","height","border","onKeyDown","currentTarget","stopPropagation","nativeEvent","KeyboardEvent","createPortal","className","clsx","__experimentalStyleProvider","document","IframeIfReady","isInitialised","__internalIsInitialized","_default","exports","default","forwardRef"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs, useRefEffect, useDisabled } from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { getCompatibilityStyles } from './get-compatibility-styles';\nimport { useScaleCanvas } from './use-scale-canvas';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\treadonly,\n\tforwardedRef: ref,\n\ttitle = __( 'Editor canvas' ),\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst settings = getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.isPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\t/** @type {[Document, import('react').Dispatch<Document>]} */\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tdocumentElement.classList.add( 'block-editor-iframe__html' );\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of getCompatibilityStyles() ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\t// Prevent clicks on links from navigating away. Note that links\n\t\t\t// inside `contenteditable` are already disabled by the browser, so\n\t\t\t// this is for links in blocks outside of `contenteditable`.\n\t\t\tiFrameDocument.addEventListener( 'click', ( event ) => {\n\t\t\t\tif ( event.target.tagName === 'A' ) {\n\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t// Appending a hash to the current URL will not reload the\n\t\t\t\t\t// page. This is useful for e.g. footnotes.\n\t\t\t\t\tconst href = event.target.getAttribute( 'href' );\n\t\t\t\t\tif ( href.startsWith( '#' ) ) {\n\t\t\t\t\t\tiFrameDocument.defaultView.location.hash =\n\t\t\t\t\t\t\thref.slice( 1 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\tcontentResizeListener,\n\t\tcontainerResizeListener,\n\t\tisZoomedOut,\n\t\tscaleContainerWidth,\n\t} = useScaleCanvas( {\n\t\tscale,\n\t\tframeSize: parseInt( frameSize ),\n\t\tiframeDocument,\n\t} );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<base href=\"${ window.location.origin }\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>\n\t\t\thtml{\n\t\t\t\theight: auto !important;\n\t\t\t\tmin-height: 100%;\n\t\t\t}\n\t\t\t/* Lowest specificity to not override global styles */\n\t\t\t:where(body) {\n\t\t\t\tmargin: 0;\n\t\t\t\t/* Default background color in case zoom out mode background\n\t\t\t\tcolors the html element */\n\t\t\t\tbackground-color: white;\n\t\t\t}\n\t\t</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\t// Make sure to not render the before and after focusable div elements in view\n\t// mode. They're only needed to capture focus in edit mode.\n\tconst shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;\n\n\tconst iframe = (\n\t\t<>\n\t\t\t{ shouldRenderFocusCaptureElements && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: props.style?.height,\n\t\t\t\t\tborder: 0,\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ title }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( props.onKeyDown ) {\n\t\t\t\t\t\tprops.onKeyDown( event );\n\t\t\t\t\t}\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We should only stop propagation of the React event,\n\t\t\t\t\t\t// the native event should further bubble inside the\n\t\t\t\t\t\t// iframe to the document and window.\n\t\t\t\t\t\t// Alternatively, we could consider redispatching the\n\t\t\t\t\t\t// native event in the iframe.\n\t\t\t\t\t\tconst { stopPropagation } = event.nativeEvent;\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = () => {};\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = stopPropagation;\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ shouldRenderFocusCaptureElements && after }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-iframe__container\">\n\t\t\t{ containerResizeListener }\n\t\t\t<div\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-iframe__scale-container',\n\t\t\t\t\tisZoomedOut && 'is-zoomed-out'\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-scale-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ scaleContainerWidth }px`,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframe }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAOA,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