@wordpress/block-library
Version:
Block library for the WordPress editor.
51 lines (49 loc) • 1.95 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _i18n = require("@wordpress/i18n");
var _components = require("@wordpress/components");
var _blockEditor = require("@wordpress/block-editor");
var _icons = require("@wordpress/icons");
var _jsxRuntime = require("react/jsx-runtime");
/**
* WordPress dependencies
*/
function getResponsiveHelp(checked) {
return checked ? (0, _i18n.__)('This embed will preserve its aspect ratio when the browser is resized.') : (0, _i18n.__)('This embed may not preserve its aspect ratio when the browser is resized.');
}
const EmbedControls = ({
blockSupportsResponsive,
showEditButton,
themeSupportsResponsive,
allowResponsive,
toggleResponsive,
switchBackToURLInput
}) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockControls, {
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarGroup, {
children: showEditButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
className: "components-toolbar__control",
label: (0, _i18n.__)('Edit URL'),
icon: _icons.edit,
onClick: switchBackToURLInput
})
})
}), themeSupportsResponsive && blockSupportsResponsive && /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PanelBody, {
title: (0, _i18n.__)('Media settings'),
className: "blocks-responsive",
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0, _i18n.__)('Resize for smaller devices'),
checked: allowResponsive,
help: getResponsiveHelp,
onChange: toggleResponsive
})
})
})]
});
var _default = exports.default = EmbedControls;
//# sourceMappingURL=embed-controls.js.map