@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
46 lines (43 loc) • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = PostAuthorSelect;
var _i18n = require("@wordpress/i18n");
var _data = require("@wordpress/data");
var _components = require("@wordpress/components");
var _store = require("../../store");
var _hook = require("./hook");
var _jsxRuntime = require("react/jsx-runtime");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PostAuthorSelect() {
const {
editPost
} = (0, _data.useDispatch)(_store.store);
const {
authorId,
authorOptions
} = (0, _hook.useAuthorsQuery)();
const setAuthorId = value => {
const author = Number(value);
editPost({
author
});
};
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
className: "post-author-selector",
label: (0, _i18n.__)('Author'),
options: authorOptions,
onChange: setAuthorId,
value: authorId,
hideLabelFromVision: true
});
}
//# sourceMappingURL=select.js.map