Skip to content

Commit

Permalink
editor: added config prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatimah committed Nov 16, 2023
1 parent ee9376c commit f955e06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/forms/RichEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ RichEditor.defaultProps = {
onChange: undefined,
onBlur: undefined,
onFocus: undefined,
editorConfig: null,
editorConfig: undefined,
};
5 changes: 4 additions & 1 deletion src/lib/forms/RichInputField.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Form } from "semantic-ui-react";

export class RichInputField extends Component {
renderFormField = (formikBag) => {
const { fieldPath, label, required, className, editor } = this.props;
const { fieldPath, label, required, className, editor, editorConfig } = this.props;
const value = getIn(formikBag.form.values, fieldPath, "");
const initialValue = getIn(formikBag.form.initialValues, fieldPath, "");
const error =
Expand All @@ -41,6 +41,7 @@ export class RichInputField extends Component {
<RichEditor
value={value}
optimized
editorConfig={editorConfig}
onBlur={(event, editor) => {
formikBag.form.setFieldValue(fieldPath, editor.getContent());
formikBag.form.setFieldTouched(fieldPath, true);
Expand Down Expand Up @@ -70,6 +71,7 @@ RichInputField.propTypes = {
optimized: PropTypes.bool,
label: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
required: PropTypes.bool,
editorConfig: PropTypes.object,
};

RichInputField.defaultProps = {
Expand All @@ -78,4 +80,5 @@ RichInputField.defaultProps = {
required: false,
label: "",
editor: undefined,
editorConfig: undefined,
};

0 comments on commit f955e06

Please sign in to comment.