Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createValueFromString = props =>
RichTextEditor.createValueFromString(
// @todo This should not be needed after https://github.com/jsdrupal/drupal-admin-ui/issues/195
(Array.isArray(props.value) &&
props.value.length &&
props.value[0].value) ||
props.value.value ||
'',
'html',
);
buildValue(strValue, language) {
return strValue ? RichTextEditor.createValueFromString(strValue, language) : RichTextEditor.createEmptyValue()
}
constructor(props: any) {
super(props)
this.state = {
value: RichTextEditor.createValueFromString(
props.initialValue || "",
"markdown"
)
}
}
const [editor, setEditor] = useState(() => {
return RichTextEditor.createValueFromString(markdown, 'markdown');
});
show() {
const project = this.props.project;
super.show({
id: project.id,
title: project.title,
description:
RichTextEditor.createValueFromString(project.description, 'html')
});
}
constructor (props) {
super(props)
if (props.defaultValue) {
const value = RichTextEditor.createValueFromString(props.defaultValue, 'html')
this.state = { value }
} else {
const value = RichTextEditor.createEmptyValue()
this.state = { value }
}
this.focus = () => this[props.name].focus()
this.onChange = (value) => {
this.setState({ value })
this.props.onChange(value.toString('html'))
}
}
constructor(props) {
super(props);
let {
formData = "",
uiSchema: { rte: { format = DEFAULT_FORMAT } = {} },
} = props;
this.state = {
value: RichTextEditor.createValueFromString(formData, format),
};
}