@gechiui/block-editor
Version:
61 lines (57 loc) • 1.56 kB
JavaScript
import { createElement } from "@gechiui/element";
/**
* External dependencies
*/
import { View } from 'react-native';
/**
* GeChiUI dependencies
*/
import { createBlock } from '@gechiui/blocks';
import { RichText } from '@gechiui/block-editor';
import { __ } from '@gechiui/i18n';
const Caption = _ref => {
let {
accessibilityLabelCreator,
accessible,
inlineToolbar,
isSelected,
onBlur,
onChange,
onFocus,
placeholder = __('添加说明文字'),
placeholderTextColor,
shouldDisplay = true,
style,
value,
insertBlocksAfter = () => {}
} = _ref;
return createElement(View, {
accessibilityLabel: accessibilityLabelCreator ? accessibilityLabelCreator(value) : undefined,
accessibilityRole: "button",
accessible: accessible,
style: {
flex: 1,
display: shouldDisplay ? 'flex' : 'none'
}
}, createElement(RichText, {
__unstableMobileNoFocusOnMount: true,
fontSize: style && style.fontSize ? style.fontSize : 14,
inlineToolbar: inlineToolbar,
isSelected: isSelected,
onBlur: onBlur,
onChange: onChange,
placeholder: placeholder,
placeholderTextColor: placeholderTextColor,
rootTagsToEliminate: ['p'],
style: style,
tagName: "p",
textAlign: "center",
underlineColorAndroid: "transparent",
unstableOnFocus: onFocus,
value: value,
__unstableOnSplitAtEnd: () => insertBlocksAfter(createBlock('core/paragraph')),
deleteEnter: true
}));
};
export default Caption;
//# sourceMappingURL=index.native.js.map