UNPKG

@gechiui/block-editor

Version:
57 lines (51 loc) 1.15 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement } from "@gechiui/element"; /** * External dependencies */ import { isEmpty } from 'lodash'; /** * GeChiUI dependencies */ import { SelectControl } from '@gechiui/components'; import { __ } from '@gechiui/i18n'; /** * Internal dependencies */ import useSetting from '../use-setting'; export default function FontFamilyControl(_ref) { let { value = '', onChange, fontFamilies, ...props } = _ref; const blockLevelFontFamilies = useSetting('typography.fontFamilies'); if (!fontFamilies) { fontFamilies = blockLevelFontFamilies; } if (isEmpty(fontFamilies)) { return null; } const options = [{ value: '', label: __('默认') }, ...fontFamilies.map(_ref2 => { let { fontFamily, name } = _ref2; return { value: fontFamily, label: name || fontFamily }; })]; return createElement(SelectControl, _extends({ label: __('字体'), options: options, value: value, onChange: onChange, labelPosition: "top" }, props)); } //# sourceMappingURL=index.js.map