@wordpress/block-library 9.7.1-next.1f6eadc42.0 → 9.8.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 (114) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/categories/edit.js +38 -17
  3. package/build/categories/edit.js.map +1 -1
  4. package/build/categories/index.js +10 -3
  5. package/build/categories/index.js.map +1 -1
  6. package/build/categories/variations.js +43 -0
  7. package/build/categories/variations.js.map +1 -0
  8. package/build/embed/edit.js +1 -0
  9. package/build/embed/edit.js.map +1 -1
  10. package/build/embed/edit.native.js +1 -0
  11. package/build/embed/edit.native.js.map +1 -1
  12. package/build/embed/embed-preview.js +80 -100
  13. package/build/embed/embed-preview.js.map +1 -1
  14. package/build/embed/embed-preview.native.js +1 -0
  15. package/build/embed/embed-preview.native.js.map +1 -1
  16. package/build/form/view.js +1 -0
  17. package/build/form/view.js.map +1 -1
  18. package/build/image/image.js +5 -2
  19. package/build/image/image.js.map +1 -1
  20. package/build/index.js +1 -0
  21. package/build/index.js.map +1 -1
  22. package/build/navigation-submenu/index.js +13 -0
  23. package/build/navigation-submenu/index.js.map +1 -1
  24. package/build/post-template/edit.js +6 -1
  25. package/build/post-template/edit.js.map +1 -1
  26. package/build/post-title/index.js +1 -4
  27. package/build/post-title/index.js.map +1 -1
  28. package/build/query/edit/inspector-controls/format-controls.js +102 -0
  29. package/build/query/edit/inspector-controls/format-controls.js.map +1 -0
  30. package/build/query/edit/inspector-controls/index.js +45 -9
  31. package/build/query/edit/inspector-controls/index.js.map +1 -1
  32. package/build/query/edit/query-content.js +26 -10
  33. package/build/query/edit/query-content.js.map +1 -1
  34. package/build/query/index.js +3 -1
  35. package/build/query/index.js.map +1 -1
  36. package/build/query/utils.js +12 -1
  37. package/build/query/utils.js.map +1 -1
  38. package/build/site-title/index.js +1 -4
  39. package/build/site-title/index.js.map +1 -1
  40. package/build/social-link/edit.js +13 -11
  41. package/build/social-link/edit.js.map +1 -1
  42. package/build-module/categories/edit.js +40 -19
  43. package/build-module/categories/edit.js.map +1 -1
  44. package/build-module/categories/index.js +10 -3
  45. package/build-module/categories/index.js.map +1 -1
  46. package/build-module/categories/variations.js +36 -0
  47. package/build-module/categories/variations.js.map +1 -0
  48. package/build-module/embed/edit.js +1 -0
  49. package/build-module/embed/edit.js.map +1 -1
  50. package/build-module/embed/edit.native.js +1 -0
  51. package/build-module/embed/edit.native.js.map +1 -1
  52. package/build-module/embed/embed-preview.js +80 -100
  53. package/build-module/embed/embed-preview.js.map +1 -1
  54. package/build-module/embed/embed-preview.native.js +1 -0
  55. package/build-module/embed/embed-preview.native.js.map +1 -1
  56. package/build-module/form/view.js +1 -0
  57. package/build-module/form/view.js.map +1 -1
  58. package/build-module/image/image.js +5 -2
  59. package/build-module/image/image.js.map +1 -1
  60. package/build-module/index.js +1 -0
  61. package/build-module/index.js.map +1 -1
  62. package/build-module/navigation-submenu/index.js +13 -0
  63. package/build-module/navigation-submenu/index.js.map +1 -1
  64. package/build-module/post-template/edit.js +6 -1
  65. package/build-module/post-template/edit.js.map +1 -1
  66. package/build-module/post-title/index.js +1 -4
  67. package/build-module/post-title/index.js.map +1 -1
  68. package/build-module/query/edit/inspector-controls/format-controls.js +96 -0
  69. package/build-module/query/edit/inspector-controls/format-controls.js.map +1 -0
  70. package/build-module/query/edit/inspector-controls/index.js +45 -9
  71. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  72. package/build-module/query/edit/query-content.js +27 -11
  73. package/build-module/query/edit/query-content.js.map +1 -1
  74. package/build-module/query/index.js +3 -1
  75. package/build-module/query/index.js.map +1 -1
  76. package/build-module/query/utils.js +12 -1
  77. package/build-module/query/utils.js.map +1 -1
  78. package/build-module/site-title/index.js +1 -4
  79. package/build-module/site-title/index.js.map +1 -1
  80. package/build-module/social-link/edit.js +14 -12
  81. package/build-module/social-link/edit.js.map +1 -1
  82. package/build-style/editor-rtl.css +1 -1
  83. package/build-style/editor.css +1 -1
  84. package/build-style/gallery/editor-rtl.css +1 -1
  85. package/build-style/gallery/editor.css +1 -1
  86. package/build-style/post-title/style-rtl.css +4 -18
  87. package/build-style/post-title/style.css +4 -18
  88. package/build-style/site-title/style-rtl.css +4 -18
  89. package/build-style/site-title/style.css +4 -18
  90. package/build-style/style-rtl.css +8 -36
  91. package/build-style/style.css +8 -36
  92. package/package.json +35 -35
  93. package/src/categories/block.json +7 -2
  94. package/src/categories/edit.js +69 -30
  95. package/src/categories/index.js +2 -0
  96. package/src/categories/index.php +21 -9
  97. package/src/categories/variations.js +40 -0
  98. package/src/comments-pagination-next/index.php +1 -1
  99. package/src/comments-pagination-previous/index.php +2 -1
  100. package/src/embed/embed-preview.js +96 -112
  101. package/src/image/image.js +2 -1
  102. package/src/navigation-submenu/block.json +13 -0
  103. package/src/post-template/edit.js +6 -0
  104. package/src/post-template/index.php +5 -0
  105. package/src/post-title/block.json +1 -4
  106. package/src/post-title/style.scss +4 -21
  107. package/src/query/block.json +3 -1
  108. package/src/query/edit/inspector-controls/format-controls.js +90 -0
  109. package/src/query/edit/inspector-controls/index.js +68 -9
  110. package/src/query/edit/query-content.js +38 -5
  111. package/src/query/utils.js +16 -1
  112. package/src/site-title/block.json +1 -4
  113. package/src/site-title/style.scss +4 -21
  114. package/src/social-link/edit.js +11 -7
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ exports.default = EmbedPreview;
8
8
  var _util = require("./util");
9
9
  var _clsx = _interopRequireDefault(require("clsx"));
10
10
  var _i18n = require("@wordpress/i18n");
@@ -31,114 +31,94 @@ var _jsxRuntime = require("react/jsx-runtime");
31
31
  * Internal dependencies
32
32
  */
33
33
 
34
- class EmbedPreview extends _element.Component {
35
- constructor() {
36
- super(...arguments);
37
- this.hideOverlay = this.hideOverlay.bind(this);
38
- this.state = {
39
- interactive: false
40
- };
34
+ function EmbedPreview({
35
+ preview,
36
+ previewable,
37
+ url,
38
+ type,
39
+ isSelected,
40
+ className,
41
+ icon,
42
+ label,
43
+ insertBlocksAfter,
44
+ attributes,
45
+ setAttributes
46
+ }) {
47
+ const [interactive, setInteractive] = (0, _element.useState)(false);
48
+ if (!isSelected && interactive) {
49
+ // We only want to change this when the block is not selected, because changing it when
50
+ // the block becomes selected makes the overlap disappear too early. Hiding the overlay
51
+ // happens on mouseup when the overlay is clicked.
52
+ setInteractive(false);
41
53
  }
42
- static getDerivedStateFromProps(nextProps, state) {
43
- if (!nextProps.isSelected && state.interactive) {
44
- // We only want to change this when the block is not selected, because changing it when
45
- // the block becomes selected makes the overlap disappear too early. Hiding the overlay
46
- // happens on mouseup when the overlay is clicked.
47
- return {
48
- interactive: false
49
- };
50
- }
51
- return null;
52
- }
53
- hideOverlay() {
54
+ const hideOverlay = () => {
54
55
  // This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop
55
56
  // changing, because that happens on mouse down, and the overlay immediately disappears,
56
57
  // and the mouse event can end up in the preview content. We can't use onClick on
57
58
  // the overlay to hide it either, because then the editor misses the mouseup event, and
58
59
  // thinks we're multi-selecting blocks.
59
- this.setState({
60
- interactive: true
61
- });
62
- }
63
- render() {
64
- const {
65
- preview,
66
- previewable,
67
- url,
68
- type,
69
- className,
70
- icon,
71
- label,
72
- insertBlocksAfter,
73
- attributes,
74
- setAttributes,
75
- isSelected
76
- } = this.props;
77
- const {
78
- scripts
79
- } = preview;
80
- const {
81
- interactive
82
- } = this.state;
83
- const html = 'photo' === type ? (0, _util.getPhotoHtml)(preview) : preview.html;
84
- const embedSourceUrl = (0, _url.getAuthority)(url);
85
- const iframeTitle = (0, _i18n.sprintf)(
86
- // translators: %s: host providing embed content e.g: www.youtube.com
87
- (0, _i18n.__)('Embedded content from %s'), embedSourceUrl);
88
- const sandboxClassnames = (0, _clsx.default)(type, className, 'wp-block-embed__wrapper');
60
+ setInteractive(true);
61
+ };
62
+ const {
63
+ scripts
64
+ } = preview;
65
+ const html = 'photo' === type ? (0, _util.getPhotoHtml)(preview) : preview.html;
66
+ const embedSourceUrl = (0, _url.getAuthority)(url);
67
+ const iframeTitle = (0, _i18n.sprintf)(
68
+ // translators: %s: host providing embed content e.g: www.youtube.com
69
+ (0, _i18n.__)('Embedded content from %s'), embedSourceUrl);
70
+ const sandboxClassnames = (0, _clsx.default)(type, className, 'wp-block-embed__wrapper');
89
71
 
90
- // Disabled because the overlay div doesn't actually have a role or functionality
91
- // as far as the user is concerned. We're just catching the first click so that
92
- // the block can be selected without interacting with the embed preview that the overlay covers.
93
- /* eslint-disable jsx-a11y/no-static-element-interactions */
94
- const embedWrapper = 'wp-embed' === type ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_wpEmbedPreview.default, {
95
- html: html
96
- }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
97
- className: "wp-block-embed__wrapper",
98
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SandBox, {
99
- html: html,
100
- scripts: scripts,
101
- title: iframeTitle,
102
- type: sandboxClassnames,
103
- onFocus: this.hideOverlay
104
- }), !interactive && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
105
- className: "block-library-embed__interactive-overlay",
106
- onMouseUp: this.hideOverlay
107
- })]
108
- });
109
- /* eslint-enable jsx-a11y/no-static-element-interactions */
72
+ // Disabled because the overlay div doesn't actually have a role or functionality
73
+ // as far as the user is concerned. We're just catching the first click so that
74
+ // the block can be selected without interacting with the embed preview that the overlay covers.
75
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
76
+ const embedWrapper = 'wp-embed' === type ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_wpEmbedPreview.default, {
77
+ html: html
78
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
79
+ className: "wp-block-embed__wrapper",
80
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SandBox, {
81
+ html: html,
82
+ scripts: scripts,
83
+ title: iframeTitle,
84
+ type: sandboxClassnames,
85
+ onFocus: hideOverlay
86
+ }), !interactive && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
87
+ className: "block-library-embed__interactive-overlay",
88
+ onMouseUp: hideOverlay
89
+ })]
90
+ });
91
+ /* eslint-enable jsx-a11y/no-static-element-interactions */
110
92
 
111
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("figure", {
112
- className: (0, _clsx.default)(className, 'wp-block-embed', {
113
- 'is-type-video': 'video' === type
93
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("figure", {
94
+ className: (0, _clsx.default)(className, 'wp-block-embed', {
95
+ 'is-type-video': 'video' === type
96
+ }),
97
+ children: [previewable ? embedWrapper : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Placeholder, {
98
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockIcon, {
99
+ icon: icon,
100
+ showColors: true
114
101
  }),
115
- children: [previewable ? embedWrapper : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Placeholder, {
116
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockIcon, {
117
- icon: icon,
118
- showColors: true
119
- }),
120
- label: label,
121
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
122
- className: "components-placeholder__error",
123
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
124
- href: url,
125
- children: url
126
- })
127
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
128
- className: "components-placeholder__error",
129
- children: (0, _i18n.sprintf)( /* translators: %s: host providing embed content e.g: www.youtube.com */
130
- (0, _i18n.__)("Embedded content from %s can't be previewed in the editor."), embedSourceUrl)
131
- })]
132
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_caption.Caption, {
133
- attributes: attributes,
134
- setAttributes: setAttributes,
135
- isSelected: isSelected,
136
- insertBlocksAfter: insertBlocksAfter,
137
- label: (0, _i18n.__)('Embed caption text'),
138
- showToolbarButton: isSelected
102
+ label: label,
103
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
104
+ className: "components-placeholder__error",
105
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
106
+ href: url,
107
+ children: url
108
+ })
109
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
110
+ className: "components-placeholder__error",
111
+ children: (0, _i18n.sprintf)( /* translators: %s: host providing embed content e.g: www.youtube.com */
112
+ (0, _i18n.__)("Embedded content from %s can't be previewed in the editor."), embedSourceUrl)
139
113
  })]
140
- });
141
- }
114
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_caption.Caption, {
115
+ attributes: attributes,
116
+ setAttributes: setAttributes,
117
+ isSelected: isSelected,
118
+ insertBlocksAfter: insertBlocksAfter,
119
+ label: (0, _i18n.__)('Embed caption text'),
120
+ showToolbarButton: isSelected
121
+ })]
122
+ });
142
123
  }
143
- var _default = exports.default = EmbedPreview;
144
124
  //# sourceMappingURL=embed-preview.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_util","require","_clsx","_interopRequireDefault","_i18n","_components","_blockEditor","_element","_url","_wpEmbedPreview","_caption","_jsxRuntime","EmbedPreview","Component","constructor","arguments","hideOverlay","bind","state","interactive","getDerivedStateFromProps","nextProps","isSelected","setState","render","preview","previewable","url","type","className","icon","label","insertBlocksAfter","attributes","setAttributes","props","scripts","html","getPhotoHtml","embedSourceUrl","getAuthority","iframeTitle","sprintf","__","sandboxClassnames","clsx","embedWrapper","jsx","default","jsxs","children","SandBox","title","onFocus","onMouseUp","Placeholder","BlockIcon","showColors","href","Caption","showToolbarButton","_default","exports"],"sources":["@wordpress/block-library/src/embed/embed-preview.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getPhotoHtml } from './util';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Placeholder, SandBox } from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { Component } from '@wordpress/element';\nimport { getAuthority } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WpEmbedPreview from './wp-embed-preview';\nimport { Caption } from '../utils/caption';\n\nclass EmbedPreview extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.hideOverlay = this.hideOverlay.bind( this );\n\t\tthis.state = {\n\t\t\tinteractive: false,\n\t\t};\n\t}\n\n\tstatic getDerivedStateFromProps( nextProps, state ) {\n\t\tif ( ! nextProps.isSelected && state.interactive ) {\n\t\t\t// We only want to change this when the block is not selected, because changing it when\n\t\t\t// the block becomes selected makes the overlap disappear too early. Hiding the overlay\n\t\t\t// happens on mouseup when the overlay is clicked.\n\t\t\treturn { interactive: false };\n\t\t}\n\n\t\treturn null;\n\t}\n\n\thideOverlay() {\n\t\t// This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop\n\t\t// changing, because that happens on mouse down, and the overlay immediately disappears,\n\t\t// and the mouse event can end up in the preview content. We can't use onClick on\n\t\t// the overlay to hide it either, because then the editor misses the mouseup event, and\n\t\t// thinks we're multi-selecting blocks.\n\t\tthis.setState( { interactive: true } );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tpreview,\n\t\t\tpreviewable,\n\t\t\turl,\n\t\t\ttype,\n\t\t\tclassName,\n\t\t\ticon,\n\t\t\tlabel,\n\t\t\tinsertBlocksAfter,\n\t\t\tattributes,\n\t\t\tsetAttributes,\n\t\t\tisSelected,\n\t\t} = this.props;\n\t\tconst { scripts } = preview;\n\t\tconst { interactive } = this.state;\n\n\t\tconst html = 'photo' === type ? getPhotoHtml( preview ) : preview.html;\n\t\tconst embedSourceUrl = getAuthority( url );\n\t\tconst iframeTitle = sprintf(\n\t\t\t// translators: %s: host providing embed content e.g: www.youtube.com\n\t\t\t__( 'Embedded content from %s' ),\n\t\t\tembedSourceUrl\n\t\t);\n\t\tconst sandboxClassnames = clsx(\n\t\t\ttype,\n\t\t\tclassName,\n\t\t\t'wp-block-embed__wrapper'\n\t\t);\n\n\t\t// Disabled because the overlay div doesn't actually have a role or functionality\n\t\t// as far as the user is concerned. We're just catching the first click so that\n\t\t// the block can be selected without interacting with the embed preview that the overlay covers.\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\tconst embedWrapper =\n\t\t\t'wp-embed' === type ? (\n\t\t\t\t<WpEmbedPreview html={ html } />\n\t\t\t) : (\n\t\t\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t\t\t\t<SandBox\n\t\t\t\t\t\thtml={ html }\n\t\t\t\t\t\tscripts={ scripts }\n\t\t\t\t\t\ttitle={ iframeTitle }\n\t\t\t\t\t\ttype={ sandboxClassnames }\n\t\t\t\t\t\tonFocus={ this.hideOverlay }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! interactive && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"block-library-embed__interactive-overlay\"\n\t\t\t\t\t\t\tonMouseUp={ this.hideOverlay }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t);\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\n\t\treturn (\n\t\t\t<figure\n\t\t\t\tclassName={ clsx( className, 'wp-block-embed', {\n\t\t\t\t\t'is-type-video': 'video' === type,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ previewable ? (\n\t\t\t\t\tembedWrapper\n\t\t\t\t) : (\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t>\n\t\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t\t<a href={ url }>{ url }</a>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: host providing embed content e.g: www.youtube.com */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\"Embedded content from %s can't be previewed in the editor.\"\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tembedSourceUrl\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</Placeholder>\n\t\t\t\t) }\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tlabel={ __( 'Embed caption text' ) }\n\t\t\t\t\tshowToolbarButton={ isSelected }\n\t\t\t\t/>\n\t\t\t</figure>\n\t\t);\n\t}\n}\n\nexport default EmbedPreview;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AAKA,IAAAQ,eAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAA2C,IAAAU,WAAA,GAAAV,OAAA;AAvB3C;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;;AAIA,MAAMW,YAAY,SAASC,kBAAS,CAAC;EACpCC,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IACrB,IAAI,CAACC,WAAW,GAAG,IAAI,CAACA,WAAW,CAACC,IAAI,CAAE,IAAK,CAAC;IAChD,IAAI,CAACC,KAAK,GAAG;MACZC,WAAW,EAAE;IACd,CAAC;EACF;EAEA,OAAOC,wBAAwBA,CAAEC,SAAS,EAAEH,KAAK,EAAG;IACnD,IAAK,CAAE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UAAY;QACzBC,aAAa,EAAGA,aAAe;QAC/BZ,UAAU,EAAGA,UAAY;QACzBU,iBAAiB,EAAGA,iBAAmB;QACvCD,KAAK,EAAG,IAAAY,QAAE,EAAE,oBAAqB,CAAG;QACpCiB,iBAAiB,EAAGtC;MAAY,CAChC,CAAC;IAAA,CACK,CAAC;EAEX;AACD;AAAC,IAAAuC,QAAA,GAAAC,OAAA,CAAAd,OAAA,GAEcpC,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["_util","require","_clsx","_interopRequireDefault","_i18n","_components","_blockEditor","_element","_url","_wpEmbedPreview","_caption","_jsxRuntime","EmbedPreview","preview","previewable","url","type","isSelected","className","icon","label","insertBlocksAfter","attributes","setAttributes","interactive","setInteractive","useState","hideOverlay","scripts","html","getPhotoHtml","embedSourceUrl","getAuthority","iframeTitle","sprintf","__","sandboxClassnames","clsx","embedWrapper","jsx","default","jsxs","children","SandBox","title","onFocus","onMouseUp","Placeholder","BlockIcon","showColors","href","Caption","showToolbarButton"],"sources":["@wordpress/block-library/src/embed/embed-preview.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getPhotoHtml } from './util';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Placeholder, SandBox } from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { getAuthority } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WpEmbedPreview from './wp-embed-preview';\nimport { Caption } from '../utils/caption';\n\nexport default function EmbedPreview( {\n\tpreview,\n\tpreviewable,\n\turl,\n\ttype,\n\tisSelected,\n\tclassName,\n\ticon,\n\tlabel,\n\tinsertBlocksAfter,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst [ interactive, setInteractive ] = useState( false );\n\n\tif ( ! isSelected && interactive ) {\n\t\t// We only want to change this when the block is not selected, because changing it when\n\t\t// the block becomes selected makes the overlap disappear too early. Hiding the overlay\n\t\t// happens on mouseup when the overlay is clicked.\n\t\tsetInteractive( false );\n\t}\n\n\tconst hideOverlay = () => {\n\t\t// This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop\n\t\t// changing, because that happens on mouse down, and the overlay immediately disappears,\n\t\t// and the mouse event can end up in the preview content. We can't use onClick on\n\t\t// the overlay to hide it either, because then the editor misses the mouseup event, and\n\t\t// thinks we're multi-selecting blocks.\n\t\tsetInteractive( true );\n\t};\n\n\tconst { scripts } = preview;\n\n\tconst html = 'photo' === type ? getPhotoHtml( preview ) : preview.html;\n\tconst embedSourceUrl = getAuthority( url );\n\tconst iframeTitle = sprintf(\n\t\t// translators: %s: host providing embed content e.g: www.youtube.com\n\t\t__( 'Embedded content from %s' ),\n\t\tembedSourceUrl\n\t);\n\tconst sandboxClassnames = clsx(\n\t\ttype,\n\t\tclassName,\n\t\t'wp-block-embed__wrapper'\n\t);\n\n\t// Disabled because the overlay div doesn't actually have a role or functionality\n\t// as far as the user is concerned. We're just catching the first click so that\n\t// the block can be selected without interacting with the embed preview that the overlay covers.\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\tconst embedWrapper =\n\t\t'wp-embed' === type ? (\n\t\t\t<WpEmbedPreview html={ html } />\n\t\t) : (\n\t\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t\t\t<SandBox\n\t\t\t\t\thtml={ html }\n\t\t\t\t\tscripts={ scripts }\n\t\t\t\t\ttitle={ iframeTitle }\n\t\t\t\t\ttype={ sandboxClassnames }\n\t\t\t\t\tonFocus={ hideOverlay }\n\t\t\t\t/>\n\t\t\t\t{ ! interactive && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"block-library-embed__interactive-overlay\"\n\t\t\t\t\t\tonMouseUp={ hideOverlay }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\n\treturn (\n\t\t<figure\n\t\t\tclassName={ clsx( className, 'wp-block-embed', {\n\t\t\t\t'is-type-video': 'video' === type,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ previewable ? (\n\t\t\t\tembedWrapper\n\t\t\t) : (\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t>\n\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t<a href={ url }>{ url }</a>\n\t\t\t\t\t</p>\n\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: host providing embed content e.g: www.youtube.com */\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\"Embedded content from %s can't be previewed in the editor.\"\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tembedSourceUrl\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t\t<Caption\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\tlabel={ __( 'Embed caption text' ) }\n\t\t\t\tshowToolbarButton={ isSelected }\n\t\t\t/>\n\t\t</figure>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AAKA,IAAAQ,eAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAA2C,IAAAU,WAAA,GAAAV,OAAA;AAvB3C;AACA;A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MAC/BN,UAAU,EAAGA,UAAY;MACzBI,iBAAiB,EAAGA,iBAAmB;MACvCD,KAAK,EAAG,IAAAe,QAAE,EAAE,oBAAqB,CAAG;MACpCiB,iBAAiB,EAAGnC;IAAY,CAChC,CAAC;EAAA,CACK,CAAC;AAEX","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_clsx","_interopRequireDefault","_primitives","_blockEditor","_i18n","_element","_components","_data","_util","_embedNoPreview","_wpEmbedPreview","_styles","_jsxRuntime","EmbedPreview","align","className","clientId","icon","insertBlocksAfter","isSelected","label","onFocus","preview","previewable","isProviderPreviewable","type","url","isDefaultEmbedInfo","isCaptionSelected","setIsCaptionSelected","useState","locale","useSelect","blockEditorStore","getSettings","wrapperStyle","styles","wrapperAlignStyle","sandboxAlignStyle","accessibilityLabelCreator","caption","RichText","isEmpty","__","sprintf","onEmbedPreviewPress","onFocusCaption","provider_url","providerUrl","html","getPhotoHtml","parsedHost","URL","host","split","parsedHostBaseUrl","splice","length","join","iframeTitle","sandboxClassnames","clsx","PreviewContent","WpEmbedPreview","SandBox","embedWrapper","jsx","Fragment","children","TouchableWithoutFeedback","onPress","View","pointerEvents","style","lang","title","containerStyle","accessible","disabled","jsxs","default","BlockCaption","_default","exports","memo"],"sources":["@wordpress/block-library/src/embed/embed-preview.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { TouchableWithoutFeedback } from 'react-native';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { View } from '@wordpress/primitives';\nimport {\n\tBlockCaption,\n\tRichText,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { memo, useState } from '@wordpress/element';\nimport { SandBox } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { getPhotoHtml } from './util';\nimport EmbedNoPreview from './embed-no-preview';\nimport WpEmbedPreview from './wp-embed-preview';\nimport styles from './styles.scss';\n\nconst EmbedPreview = ( {\n\talign,\n\tclassName,\n\tclientId,\n\ticon,\n\tinsertBlocksAfter,\n\tisSelected,\n\tlabel,\n\tonFocus,\n\tpreview,\n\tpreviewable,\n\tisProviderPreviewable,\n\ttype,\n\turl,\n\tisDefaultEmbedInfo,\n} ) => {\n\tconst [ isCaptionSelected, setIsCaptionSelected ] = useState( false );\n\tconst { locale } = useSelect( blockEditorStore ).getSettings();\n\n\tconst wrapperStyle = styles[ 'embed-preview__wrapper' ];\n\tconst wrapperAlignStyle =\n\t\tstyles[ `embed-preview__wrapper--align-${ align }` ];\n\tconst sandboxAlignStyle =\n\t\tstyles[ `embed-preview__sandbox--align-${ align }` ];\n\n\tfunction accessibilityLabelCreator( caption ) {\n\t\treturn RichText.isEmpty( caption )\n\t\t\t? /* translators: accessibility text. Empty Embed caption. */\n\t\t\t __( 'Embed caption. Empty' )\n\t\t\t: sprintf(\n\t\t\t\t\t/* translators: accessibility text. %s: Embed caption. */\n\t\t\t\t\t__( 'Embed caption. %s' ),\n\t\t\t\t\tcaption\n\t\t\t );\n\t}\n\n\tfunction onEmbedPreviewPress() {\n\t\tsetIsCaptionSelected( false );\n\t}\n\n\tfunction onFocusCaption() {\n\t\tif ( onFocus ) {\n\t\t\tonFocus();\n\t\t}\n\t\tif ( ! isCaptionSelected ) {\n\t\t\tsetIsCaptionSelected( true );\n\t\t}\n\t}\n\n\tconst { provider_url: providerUrl } = preview;\n\tconst html = 'photo' === type ? getPhotoHtml( preview ) : preview.html;\n\tconst parsedHost = new URL( url ).host.split( '.' );\n\tconst parsedHostBaseUrl = parsedHost\n\t\t.splice( parsedHost.length - 2, parsedHost.length - 1 )\n\t\t.join( '.' );\n\tconst iframeTitle = sprintf(\n\t\t// translators: %s: host providing embed content e.g: www.youtube.com\n\t\t__( 'Embedded content from %s' ),\n\t\tparsedHostBaseUrl\n\t);\n\tconst sandboxClassnames = clsx(\n\t\ttype,\n\t\tclassName,\n\t\t'wp-block-embed__wrapper'\n\t);\n\n\tconst PreviewContent = 'wp-embed' === type ? WpEmbedPreview : SandBox;\n\tconst embedWrapper = (\n\t\t<>\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\tonPress={ () => {\n\t\t\t\t\tif ( onFocus ) {\n\t\t\t\t\t\tonFocus();\n\t\t\t\t\t}\n\t\t\t\t\tif ( isCaptionSelected ) {\n\t\t\t\t\t\tsetIsCaptionSelected( false );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<View\n\t\t\t\t\tpointerEvents=\"box-only\"\n\t\t\t\t\tstyle={ [ wrapperStyle, wrapperAlignStyle ] }\n\t\t\t\t>\n\t\t\t\t\t<PreviewContent\n\t\t\t\t\t\thtml={ html }\n\t\t\t\t\t\tlang={ locale }\n\t\t\t\t\t\ttitle={ iframeTitle }\n\t\t\t\t\t\ttype={ sandboxClassnames }\n\t\t\t\t\t\tproviderUrl={ providerUrl }\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tcontainerStyle={ sandboxAlignStyle }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t</>\n\t);\n\treturn (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessible={ ! isSelected }\n\t\t\tonPress={ onEmbedPreviewPress }\n\t\t\tdisabled={ ! isSelected }\n\t\t>\n\t\t\t<View>\n\t\t\t\t{ isProviderPreviewable && previewable ? (\n\t\t\t\t\tembedWrapper\n\t\t\t\t) : (\n\t\t\t\t\t<EmbedNoPreview\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tonPress={ () => setIsCaptionSelected( false ) }\n\t\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\t\tisDefaultEmbedInfo={ isDefaultEmbedInfo }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockCaption\n\t\t\t\t\taccessibilityLabelCreator={ accessibilityLabelCreator }\n\t\t\t\t\taccessible\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tisSelected={ isCaptionSelected }\n\t\t\t\t\tonFocus={ onFocusCaption }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n};\n\nexport default memo( EmbedPreview );\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,eAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,eAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,OAAA,GAAAV,sBAAA,CAAAF,OAAA;AAAmC,IAAAa,WAAA,GAAAb,OAAA;AA1BnC;AACA;AACA;;AAIA;AACA;AACA;;AAYA;AACA;AACA;;AAMA,MAAMc,YAAY,GAAGA,CAAE;EACtBC,KAAK;EACLC,SAAS;EACTC,QAAQ;EACRC,IAAI;EACJC,iBAAiB;EACjBC,UAAU;EACVC,KAAK;EACLC,OAAO;EACPC,OAAO;EACPC,WAAW;EACXC,qBAAqB;EACrBC,IAAI;EACJC,GAAG;EACHC;AACD,CAAC,KAAM;EACN,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACrE,MAAM;IAAEC;EAAO,CAAC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,WAAA,CAAAqE,IAAI;MAAAH,QAAA,GACF5C,qBAAqB,IAAID,WAAW,GACrC0C,YAAY,gBAEZ,IAAArD,WAAA,CAAAsD,GAAA,EAACzD,eAAA,CAAAuE,OAAc;QACd5D,KAAK,EAAGA,KAAO;QACfH,IAAI,EAAGA,IAAM;QACbE,UAAU,EAAGA,UAAY;QACzBmD,OAAO,EAAGA,CAAA,KAAMzC,oBAAoB,CAAE,KAAM,CAAG;QAC/CN,WAAW,EAAGA,WAAa;QAC3BI,kBAAkB,EAAGA;MAAoB,CACzC,CACD,eACD,IAAAf,WAAA,CAAAsD,GAAA,EAAC/D,YAAA,CAAA8E,YAAY;QACZ1C,yBAAyB,EAAGA,yBAA2B;QACvDsC,UAAU;QACV7D,QAAQ,EAAGA,QAAU;QACrBE,iBAAiB,EAAGA,iBAAmB;QACvCC,UAAU,EAAGS,iBAAmB;QAChCP,OAAO,EAAGyB;MAAgB,CAC1B,CAAC;IAAA,CACG;EAAC,CACkB,CAAC;AAE7B,CAAC;AAAC,IAAAoC,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEa,IAAAI,aAAI,EAAEvE,YAAa,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_clsx","_interopRequireDefault","_primitives","_blockEditor","_i18n","_element","_components","_data","_util","_embedNoPreview","_wpEmbedPreview","_styles","_jsxRuntime","EmbedPreview","align","className","clientId","icon","insertBlocksAfter","isSelected","label","onFocus","preview","previewable","isProviderPreviewable","type","url","isDefaultEmbedInfo","isCaptionSelected","setIsCaptionSelected","useState","locale","useSelect","blockEditorStore","getSettings","wrapperStyle","styles","wrapperAlignStyle","sandboxAlignStyle","accessibilityLabelCreator","caption","RichText","isEmpty","__","sprintf","onEmbedPreviewPress","onFocusCaption","provider_url","providerUrl","html","getPhotoHtml","parsedHost","URL","host","split","parsedHostBaseUrl","splice","length","join","iframeTitle","sandboxClassnames","clsx","PreviewContent","WpEmbedPreview","SandBox","embedWrapper","jsx","Fragment","children","TouchableWithoutFeedback","onPress","View","pointerEvents","style","lang","title","containerStyle","accessible","disabled","jsxs","default","BlockCaption","_default","exports","memo"],"sources":["@wordpress/block-library/src/embed/embed-preview.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { TouchableWithoutFeedback } from 'react-native';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { View } from '@wordpress/primitives';\nimport {\n\tBlockCaption,\n\tRichText,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { memo, useState } from '@wordpress/element';\nimport { SandBox } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { getPhotoHtml } from './util';\nimport EmbedNoPreview from './embed-no-preview';\nimport WpEmbedPreview from './wp-embed-preview';\nimport styles from './styles.scss';\n\nconst EmbedPreview = ( {\n\talign,\n\tclassName,\n\tclientId,\n\ticon,\n\tinsertBlocksAfter,\n\tisSelected,\n\tlabel,\n\tonFocus,\n\tpreview,\n\tpreviewable,\n\tisProviderPreviewable,\n\ttype,\n\turl,\n\tisDefaultEmbedInfo,\n} ) => {\n\tconst [ isCaptionSelected, setIsCaptionSelected ] = useState( false );\n\tconst { locale } = useSelect( blockEditorStore ).getSettings();\n\n\tconst wrapperStyle = styles[ 'embed-preview__wrapper' ];\n\tconst wrapperAlignStyle =\n\t\tstyles[ `embed-preview__wrapper--align-${ align }` ];\n\tconst sandboxAlignStyle =\n\t\tstyles[ `embed-preview__sandbox--align-${ align }` ];\n\n\tfunction accessibilityLabelCreator( caption ) {\n\t\treturn RichText.isEmpty( caption )\n\t\t\t? /* translators: accessibility text. Empty Embed caption. */\n\t\t\t __( 'Embed caption. Empty' )\n\t\t\t: sprintf(\n\t\t\t\t\t/* translators: accessibility text. %s: Embed caption. */\n\t\t\t\t\t__( 'Embed caption. %s' ),\n\t\t\t\t\tcaption\n\t\t\t );\n\t}\n\n\tfunction onEmbedPreviewPress() {\n\t\tsetIsCaptionSelected( false );\n\t}\n\n\tfunction onFocusCaption() {\n\t\tif ( onFocus ) {\n\t\t\tonFocus();\n\t\t}\n\t\tif ( ! isCaptionSelected ) {\n\t\t\tsetIsCaptionSelected( true );\n\t\t}\n\t}\n\n\tconst { provider_url: providerUrl } = preview;\n\tconst html = 'photo' === type ? getPhotoHtml( preview ) : preview.html;\n\tconst parsedHost = new URL( url ).host.split( '.' );\n\tconst parsedHostBaseUrl = parsedHost\n\t\t.splice( parsedHost.length - 2, parsedHost.length - 1 )\n\t\t.join( '.' );\n\tconst iframeTitle = sprintf(\n\t\t// translators: %s: host providing embed content e.g: www.youtube.com\n\t\t__( 'Embedded content from %s' ),\n\t\tparsedHostBaseUrl\n\t);\n\tconst sandboxClassnames = clsx(\n\t\ttype,\n\t\tclassName,\n\t\t'wp-block-embed__wrapper'\n\t);\n\n\tconst PreviewContent = 'wp-embed' === type ? WpEmbedPreview : SandBox;\n\tconst embedWrapper = (\n\t\t<>\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\tonPress={ () => {\n\t\t\t\t\tif ( onFocus ) {\n\t\t\t\t\t\tonFocus();\n\t\t\t\t\t}\n\t\t\t\t\tif ( isCaptionSelected ) {\n\t\t\t\t\t\tsetIsCaptionSelected( false );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<View\n\t\t\t\t\tpointerEvents=\"box-only\"\n\t\t\t\t\tstyle={ [ wrapperStyle, wrapperAlignStyle ] }\n\t\t\t\t>\n\t\t\t\t\t<PreviewContent\n\t\t\t\t\t\thtml={ html }\n\t\t\t\t\t\tlang={ locale }\n\t\t\t\t\t\ttitle={ iframeTitle }\n\t\t\t\t\t\ttype={ sandboxClassnames }\n\t\t\t\t\t\tproviderUrl={ providerUrl }\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tcontainerStyle={ sandboxAlignStyle }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t</>\n\t);\n\treturn (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessible={ ! isSelected }\n\t\t\tonPress={ onEmbedPreviewPress }\n\t\t\tdisabled={ ! isSelected }\n\t\t>\n\t\t\t<View>\n\t\t\t\t{ isProviderPreviewable && previewable ? (\n\t\t\t\t\tembedWrapper\n\t\t\t\t) : (\n\t\t\t\t\t<EmbedNoPreview\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tonPress={ () => setIsCaptionSelected( false ) }\n\t\t\t\t\t\tpreviewable={ previewable }\n\t\t\t\t\t\tisDefaultEmbedInfo={ isDefaultEmbedInfo }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockCaption\n\t\t\t\t\taccessibilityLabelCreator={ accessibilityLabelCreator }\n\t\t\t\t\taccessible\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tisSelected={ isCaptionSelected }\n\t\t\t\t\tonFocus={ onFocusCaption }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n};\n\nexport default memo( EmbedPreview );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,eAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,eAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,OAAA,GAAAV,sBAAA,CAAAF,OAAA;AAAm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comments/disable-enable-pair
@@ -1 +1 @@
1
- {"version":3,"names":["document","querySelectorAll","forEach","form","action","startsWith","redirectNotification","status","urlParams","URLSearchParams","window","location","search","append","toString","addEventListener","event","preventDefault","formData","Object","fromEntries","FormData","entries","formAction","_ajax_nonce","wpBlockFormSettings","nonce","_wp_http_referer","href","response","fetch","ajaxUrl","method","headers","body","ok","error"],"sources":["@wordpress/block-library/src/form/view.js"],"sourcesContent":["// eslint-disable-next-line eslint-comments/disable-enable-pair\n/* eslint-disable no-undef */\ndocument.querySelectorAll( 'form.wp-block-form' ).forEach( function ( form ) {\n\t// Bail If the form is not using the mailto: action.\n\tif ( ! form.action || ! form.action.startsWith( 'mailto:' ) ) {\n\t\treturn;\n\t}\n\n\tconst redirectNotification = ( status ) => {\n\t\tconst urlParams = new URLSearchParams( window.location.search );\n\t\turlParams.append( 'wp-form-result', status );\n\t\twindow.location.search = urlParams.toString();\n\t};\n\n\t// Add an event listener for the form submission.\n\tform.addEventListener( 'submit', async function ( event ) {\n\t\tevent.preventDefault();\n\t\t// Get the form data and merge it with the form action and nonce.\n\t\tconst formData = Object.fromEntries( new FormData( form ).entries() );\n\t\tformData.formAction = form.action;\n\t\tformData._ajax_nonce = wpBlockFormSettings.nonce;\n\t\tformData.action = wpBlockFormSettings.action;\n\t\tformData._wp_http_referer = window.location.href;\n\t\tformData.formAction = form.action;\n\n\t\ttry {\n\t\t\tconst response = await fetch( wpBlockFormSettings.ajaxUrl, {\n\t\t\t\tmethod: 'POST',\n\t\t\t\theaders: {\n\t\t\t\t\t'Content-Type': 'application/x-www-form-urlencoded',\n\t\t\t\t},\n\t\t\t\tbody: new URLSearchParams( formData ).toString(),\n\t\t\t} );\n\t\t\tif ( response.ok ) {\n\t\t\t\tredirectNotification( 'success' );\n\t\t\t} else {\n\t\t\t\tredirectNotification( 'error' );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tredirectNotification( 'error' );\n\t\t}\n\t} );\n} );\n"],"mappings":";;AAAA;AACA;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,CAAC;MAChD,CAAE,CAAC;MACH,IAAKe,QAAQ,CAACM,EAAE,EAAG;QAClB7B,oBAAoB,CAAE,SAAU,CAAC;MAClC,CAAC,MAAM;QACNA,oBAAoB,CAAE,OAAQ,CAAC;MAChC;IACD,CAAC,CAAC,OAAQ8B,KAAK,EAAG;MACjB9B,oBAAoB,CAAE,OAAQ,CAAC;IAChC;EACD,CAAE,CAAC;AACJ,CAAE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["document","querySelectorAll","forEach","form","action","startsWith","redirectNotification","status","urlParams","URLSearchParams","window","location","search","append","toString","addEventListener","event","preventDefault","formData","Object","fromEntries","FormData","entries","formAction","_ajax_nonce","wpBlockFormSettings","nonce","_wp_http_referer","href","response","fetch","ajaxUrl","method","headers","body","ok","error"],"sources":["@wordpress/block-library/src/form/view.js"],"sourcesContent":["// eslint-disable-next-line eslint-comments/disable-enable-pair\n/* eslint-disable no-undef */\ndocument.querySelectorAll( 'form.wp-block-form' ).forEach( function ( form ) {\n\t// Bail If the form is not using the mailto: action.\n\tif ( ! form.action || ! form.action.startsWith( 'mailto:' ) ) {\n\t\treturn;\n\t}\n\n\tconst redirectNotification = ( status ) => {\n\t\tconst urlParams = new URLSearchParams( window.location.search );\n\t\turlParams.append( 'wp-form-result', status );\n\t\twindow.location.search = urlParams.toString();\n\t};\n\n\t// Add an event listener for the form submission.\n\tform.addEventListener( 'submit', async function ( event ) {\n\t\tevent.preventDefault();\n\t\t// Get the form data and merge it with the form action and nonce.\n\t\tconst formData = Object.fromEntries( new FormData( form ).entries() );\n\t\tformData.formAction = form.action;\n\t\tformData._ajax_nonce = wpBlockFormSettings.nonce;\n\t\tformData.action = wpBlockFormSettings.action;\n\t\tformData._wp_http_referer = window.location.href;\n\t\tformData.formAction = form.action;\n\n\t\ttry {\n\t\t\tconst response = await fetch( wpBlockFormSettings.ajaxUrl, {\n\t\t\t\tmethod: 'POST',\n\t\t\t\theaders: {\n\t\t\t\t\t'Content-Type': 'application/x-www-form-urlencoded',\n\t\t\t\t},\n\t\t\t\tbody: new URLSearchParams( formData ).toString(),\n\t\t\t} );\n\t\t\tif ( response.ok ) {\n\t\t\t\tredirectNotification( 'success' );\n\t\t\t} else {\n\t\t\t\tredirectNotification( 'error' );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tredirectNotification( 'error' );\n\t\t}\n\t} );\n} );\n"],"mappings":";;;AAAA;AACA;AACAA,QAAQ,CAACC,gBAAgB,CAAE,oBAAqB,CAAC,CAACC,OAAO,CAAE,UAAWC,IAAI,EAAG;EAC5E;EACA,IAAK,CAAEA,IAAI,CAACC,MAAM,IAAI,CAAED,IAAI,CAACC,MAAM,CAACC,UAAU,CAAE,SAAU,CAAC,EAAG;IAC7D;EACD;EAEA,MAAMC,oBAAoB,GAAKC,MAAM,IAAM;IAC1C,MAAMC,SAAS,GAAG,IAAIC,eAAe,CAAEC,MAAM,CAACC,QAAQ,CAACC,MAAO,CAAC;IAC/DJ,SAAS,CAACK,MAAM,CAAE,gBAAgB,EAAEN,MAAO,CAAC;IAC5CG,MAAM,CAACC,QAAQ,CAACC,MAAM,GAAGJ,SAAS,CAACM,QAAQ,CAAC,CAAC;EAC9C,CAAC;;EAED;EACAX,IAAI,CAACY,gBAAgB,CAAE,QAAQ,EAAE,gBAAiBC,KAAK,EAAG;IACzDA,KAAK,CAACC,cAAc,CAAC,CAAC;IACtB;IACA,MAAMC,QAAQ,GAAGC,MAAM,CAACC,WAAW,CAAE,IAAIC,QAAQ,CAAElB,IAAK,CAAC,CAACmB,OAAO,CAAC,CAAE,CAAC;IACrEJ,QAAQ,CAACK,UAAU,GAAGpB,IAAI,CAACC,MAAM;IACjCc,QAAQ,CAACM,WAAW,GAAGC,mBAAmB,CAACC,KAAK;IAChDR,QAAQ,CAACd,MAAM,GAAGqB,mBAAmB,CAACrB,MAAM;IAC5Cc,QAAQ,CAACS,gBAAgB,GAAGjB,MAAM,CAACC,QAAQ,CAACiB,IAAI;IAChDV,QAAQ,CAACK,UAAU,GAAGpB,IAAI,CAACC,MAAM;IAEjC,IAAI;MACH,MAAMyB,QAAQ,GAAG,MAAMC,KAAK,CAAEL,mBAAmB,CAACM,OAAO,EAAE;QAC1DC,MAAM,EAAE,MAAM;QACdC,OAAO,EAAE;UACR,cAAc,EAAE;QACjB,CAAC;QACDC,IAAI,EAAE,IAAIzB,eAAe,CAAES,QAAS,CAAC,CAACJ,QAAQ,CAAC;MAChD,CAAE,CAAC;MACH,IAAKe,QAAQ,CAACM,EAAE,EAAG;QAClB7B,oBAAoB,CAAE,SAAU,CAAC;MAClC,CAAC,MAAM;QACNA,oBAAoB,CAAE,OAAQ,CAAC;MAChC;IACD,CAAC,CAAC,OAAQ8B,KAAK,EAAG;MACjB9B,oBAAoB,CAAE,OAAQ,CAAC;IAChC;EACD,CAAE,CAAC;AACJ,CAAE,CAAC","ignoreList":[]}
@@ -467,8 +467,11 @@ function Image({
467
467
  const showUrlInput = isSingleSelected && !isEditingImage && !lockHrefControls && !lockUrlControls;
468
468
  const showCoverControls = isSingleSelected && canInsertCover;
469
469
  const showBlockControls = showUrlInput || allowCrop || showCoverControls;
470
- const mediaReplaceFlow = isSingleSelected && !isEditingImage && !lockUrlControls && /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockControls, {
471
- group: "other",
470
+ const mediaReplaceFlow = isSingleSelected && !isEditingImage && !lockUrlControls &&
471
+ /*#__PURE__*/
472
+ // For contentOnly mode, put this button in its own area so it has borders around it.
473
+ (0, _jsxRuntime.jsx)(_blockEditor.BlockControls, {
474
+ group: isContentOnlyMode ? 'inline' : 'other',
472
475
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.MediaReplaceFlow, {
473
476
  mediaId: id,
474
477
  mediaURL: url,