in src/component/base/DraftEditor.react.js [298:371]
text: nullthrows(this.props.placeholder),
textAlignment: this.props.textAlignment,
};
/* $FlowFixMe[incompatible-type] (>=0.112.0 site=www,mobile) This comment
* suppresses an error found when Flow v0.112 was deployed. To see the
* error delete this comment and run Flow. */
return <DraftEditorPlaceholder {...placeHolderProps} />;
}
return null;
}
/**
* returns ariaDescribedBy prop with EDITOR_ID_PLACEHOLDER replaced with
* the DOM id of the placeholder (if it exists)
* @returns aria-describedby attribute value
*/
_renderARIADescribedBy(): ?string {
const describedBy = this.props.ariaDescribedBy || '';
if (this.props.placeholderAriaHidden) {
return describedBy === EDITOR_ID_PLACEHOLDER ? undefined : describedBy;
}
const placeholderID = this._showPlaceholder()
? this._placeholderAccessibilityID
: '';
return (
describedBy.replace(EDITOR_ID_PLACEHOLDER, placeholderID) || undefined
);
}
render(): React.Node {
const {
blockRenderMap,
blockRendererFn,
blockStyleFn,
customStyleFn,
customStyleMap,
editorState,
preventScroll,
readOnly,
textAlignment,
textDirectionality,
} = this.props;
const rootClass = cx({
'DraftEditor/root': true,
'DraftEditor/alignLeft': textAlignment === 'left',
'DraftEditor/alignRight': textAlignment === 'right',
'DraftEditor/alignCenter': textAlignment === 'center',
});
const contentStyle = {
outline: 'none',
// fix parent-draggable Safari bug. #1326
userSelect: 'text',
WebkitUserSelect: 'text',
whiteSpace: 'pre-wrap',
wordWrap: 'break-word',
};
// The aria-expanded and aria-haspopup properties should only be rendered
// for a combobox.
/* $FlowFixMe[prop-missing] (>=0.68.0 site=www,mobile) This comment
* suppresses an error found when Flow v0.68 was deployed. To see the error
* delete this comment and run Flow. */
const ariaRole = this.props.role || 'textbox';
const ariaExpanded =
ariaRole === 'combobox' ? !!this.props.ariaExpanded : null;
const editorContentsProps = {
blockRenderMap,
blockRendererFn,
blockStyleFn,
customStyleMap: {