@wordpress/block-library
Version:
Block library for the WordPress editor.
43 lines (40 loc) • 1.65 kB
JavaScript
import { createElement } from "@wordpress/element";
/**
* External dependencies
*/
import { View } from 'react-native';
/**
* WordPress dependencies
*/
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
/**
* Internal dependencies
*/
import WebPreformattedEdit from './edit.js';
import styles from './styles.scss';
export default function PreformattedEdit(props) {
const {
style
} = props;
const textBaseStyle = usePreferredColorSchemeStyle(styles.wpRichTextLight, styles.wpRichTextDark);
const wpBlockPreformatted = usePreferredColorSchemeStyle(styles.wpBlockPreformattedLight, styles.wpBlockPreformattedDark);
const richTextStyle = { ...(!(style !== null && style !== void 0 && style.baseColors) && textBaseStyle),
...((style === null || style === void 0 ? void 0 : style.fontSize) && {
fontSize: style.fontSize
}),
...((style === null || style === void 0 ? void 0 : style.color) && {
color: style.color
})
};
const hasBaseColors = (style === null || style === void 0 ? void 0 : style.baseColors) && Object.entries(style.baseColors).length !== 0;
const containerStyles = [wpBlockPreformatted, (style === null || style === void 0 ? void 0 : style.backgroundColor) && {
backgroundColor: style.backgroundColor
}, hasBaseColors && !(style !== null && style !== void 0 && style.backgroundColor) && styles['wp-block-preformatted__no-background']];
const propsWithStyle = { ...props,
style: richTextStyle
};
return createElement(View, {
style: containerStyles
}, createElement(WebPreformattedEdit, propsWithStyle));
}
//# sourceMappingURL=edit.native.js.map