Skip to content

Commit

Permalink
fix: slate plugins error
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Jul 29, 2019
1 parent eeecfc3 commit 065fd2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { Switch } from "webiny-ui/Switch";
import type { WithCrudFormProps } from "webiny-admin/components";
import { CircularProgress } from "webiny-ui/Progress";
import LocaleCodesAutoComplete from "./LocaleCodesAutoComplete";
import { I18NInput } from "webiny-app-i18n/admin/components";
import {
SimpleForm,
SimpleFormFooter,
Expand Down Expand Up @@ -43,22 +42,6 @@ const I18NLocaleForm = ({ onSubmit, loading, data, invalidFields }: WithCrudForm
</Bind>
</Cell>
</Grid>

{/* TODO: @sven*/}
<Grid>
<Cell span={12}>
<Bind name="simpleText">
<I18NInput label={"Simple text"} />
</Bind>
</Cell>
<Cell span={12}>
<Bind name="simpleText">
<Bind name="richText">
<I18NInput label={"Rich text"} richText />
</Bind>
</Bind>
</Cell>
</Grid>
</SimpleFormContent>
<SimpleFormFooter>
<ButtonPrimary type="primary" onClick={form.submit} align="right">
Expand Down
9 changes: 7 additions & 2 deletions packages/webiny-ui/src/RichTextEditor/RichTextEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ export class RichTextEditor extends React.Component<RichTextEditorPropsType, Sta
editor = React.createRef();

id: string;
constructor(props: Props) {
plugins: { editor: Array<Object> };
constructor(props: RichTextEditorPropsType) {
super();
this.id = shortid.generate();

Expand All @@ -84,6 +85,10 @@ export class RichTextEditor extends React.Component<RichTextEditorPropsType, Sta
readOnly: !props.onChange,
activePlugin: null
};

this.plugins = {
editor: props.plugins.map(plugin => plugin.editor).filter(Boolean)
};
}

static getDerivedStateFromProps(props: Object, state: Object) {
Expand Down Expand Up @@ -195,7 +200,7 @@ export class RichTextEditor extends React.Component<RichTextEditorPropsType, Sta
ref={this.editor}
autoCorrect={false}
spellCheck={false}
plugins={plugins.map(plugin => plugin.editor).filter(Boolean)}
plugins={this.plugins.editor}
placeholder="Enter some text..."
value={this.state.value}
onChange={this.onChange}
Expand Down

0 comments on commit 065fd2d

Please sign in to comment.