-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit files for #21; setup custom domain
- Loading branch information
Showing
5 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
appl-tracky.shaungc.com |
21 changes: 21 additions & 0 deletions
21
src/components/form-factory/form-rich-text-field/form-rich-text-field-meta.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// base field | ||
import { FormBaseFieldMeta, IFormBaseFieldProps, IFieldBaseMetaProps } from "../form-base-field/form-base-field-meta"; | ||
// input field | ||
import { FormRichTextField } from "./form-rich-text-field"; | ||
|
||
|
||
// API for caller to new props for input field | ||
export interface IFormRichTextFieldProps extends IFormBaseFieldProps { | ||
} | ||
|
||
// for defining meta | ||
export interface IFormRichTextFieldMetaProps extends IFieldBaseMetaProps { | ||
} | ||
|
||
export class FormRichTextFieldMeta extends FormBaseFieldMeta { | ||
|
||
constructor(props: IFormRichTextFieldMetaProps) { | ||
super(props) | ||
this.formField = FormRichTextField; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/components/form-factory/form-rich-text-field/form-rich-text-field.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React, { Component } from "react"; | ||
|
||
/** Components */ | ||
// mdc react icon | ||
import MaterialIcon from "@material/react-material-icon"; | ||
// mdc react button | ||
import "@material/react-button/dist/button.css"; | ||
// mdc-react input | ||
import "@material/react-text-field/dist/text-field.css"; | ||
import TextField, { Input } from "@material/react-text-field"; | ||
// formik | ||
import { | ||
Field, FieldProps, | ||
ErrorMessage, | ||
} from "formik"; | ||
// input field | ||
import { IFormRichTextFieldProps } from "./form-rich-text-field-meta"; | ||
// ckeditor | ||
import CKEditor from '@ckeditor/ckeditor5-react'; | ||
import BalloonEditor from '@ckeditor/ckeditor5-build-balloon'; | ||
|
||
export class FormRichTextField extends Component<IFormRichTextFieldProps> { | ||
render() { | ||
return ( | ||
<div className="FormRichTextField"> | ||
<Field | ||
name={this.props.fieldName} | ||
render={({ field, form }: FieldProps<number | string>) => { | ||
return ( | ||
<div className="RichTextFieldInput"> | ||
<div><strong>{this.props.label}</strong></div> | ||
<CKEditor | ||
editor={BalloonEditor} | ||
data={field.value} | ||
onChange={ ( event: any, editor: any ) => { | ||
form.setFieldValue(field.name, editor.getData()); | ||
} } | ||
/> | ||
</div> | ||
)}} | ||
/> | ||
<ErrorMessage name={this.props.fieldName} /> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
declare module '@ckeditor/ckeditor5-react'; | ||
|
||
declare module '@ckeditor/ckeditor5-build-balloon'; |