Skip to content

Commit

Permalink
Update peer dependencies version (niuware#246)
Browse files Browse the repository at this point in the history
* Format examples sources

* Update dependencies

* Audit fix dependencies
  • Loading branch information
niuware committed Mar 29, 2021
1 parent 52c7723 commit b7f70ed
Show file tree
Hide file tree
Showing 22 changed files with 112 additions and 117 deletions.
11 changes: 5 additions & 6 deletions examples/async-atomic-custom-block/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useRef, useState, FunctionComponent, useEffect } from 'react'
import MUIRichTextEditor from '../..'
import { TMUIRichTextEditorRef, TAsyncAtomicBlockResponse} from '../../src/MUIRichTextEditor'
import MUIRichTextEditor, { TMUIRichTextEditorRef, TAsyncAtomicBlockResponse } from '../..'
import { makeStyles } from '@material-ui/core/styles'
import Card from '@material-ui/core/Card'
import CardContent from '@material-ui/core/CardContent'
Expand Down Expand Up @@ -140,9 +139,9 @@ const MyCardPopover: FunctionComponent<IMyCardPopoverProps> = (props) => {
>
<Grid container spacing={1} className={classes.root}>
<Grid item xs={12}>
<TextField
<TextField
{...textFieldProps}
autoFocus={true}
autoFocus={true}
label="Search term"
name="searchTerm"
placeholder="Type anything here..."
Expand Down Expand Up @@ -174,12 +173,12 @@ const MyCardPopover: FunctionComponent<IMyCardPopoverProps> = (props) => {
}

const AsyncAtomicCustomBlock: FunctionComponent = () => {

const ref = useRef<TMUIRichTextEditorRef>(null)
const [anchor, setAnchor] = useState<HTMLElement | null>(null)
return (
<>
<MyCardPopover
<MyCardPopover
anchor={anchor}
onSubmit={(data, insert) => {
if (insert && data.searchTerm) {
Expand Down
9 changes: 4 additions & 5 deletions examples/async-image-upload/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useRef, useState, FunctionComponent, useEffect } from 'react'
import MUIRichTextEditor from '../..'
import { TMUIRichTextEditorRef, TAsyncAtomicBlockResponse } from '../../src/MUIRichTextEditor'
import MUIRichTextEditor, { TMUIRichTextEditorRef, TAsyncAtomicBlockResponse } from '../..'
import Grid from '@material-ui/core/Grid'
import { makeStyles } from '@material-ui/core/styles'
import Popover from '@material-ui/core/Popover'
Expand Down Expand Up @@ -106,8 +105,8 @@ const UploadImagePopover: FunctionComponent<IUploadImagePopoverProps> = (props)
>
<Grid container spacing={1} className={classes.root}>
<Grid item xs={10}>
<TextField
className={classes.textField}
<TextField
className={classes.textField}
disabled
value={data.file?.name || ""}
placeholder="Click icon to attach image"
Expand Down Expand Up @@ -167,7 +166,7 @@ const AsyncImageUpload: FunctionComponent = () => {

return (
<>
<UploadImagePopover
<UploadImagePopover
anchor={anchor}
onSubmit={(data, insert) => {
if (insert && data.file) {
Expand Down
29 changes: 15 additions & 14 deletions examples/atomic-custom-block/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useRef, useState, FunctionComponent, useEffect } from 'react'
import MUIRichTextEditor from '../..'
import { TMUIRichTextEditorRef } from '../../src/MUIRichTextEditor'
import { Card, CardHeader, Avatar, CardMedia, CardContent,
Typography, IconButton, CardActions, Grid } from '@material-ui/core'
import MUIRichTextEditor, { TMUIRichTextEditorRef } from '../..'
import {
Card, CardHeader, Avatar, CardMedia, CardContent,
Typography, IconButton, CardActions, Grid
} from '@material-ui/core'
import { makeStyles } from '@material-ui/core/styles'
import Popover from '@material-ui/core/Popover'
import TextField from '@material-ui/core/TextField'
Expand Down Expand Up @@ -94,12 +95,12 @@ const MyCard: FunctionComponent<any> = (props) => {
</Typography>
</CardContent>
<CardActions disableSpacing>
<IconButton
aria-label="like card"
<IconButton
aria-label="like card"
onClick={handleLiked}>
<FavoriteIcon />
</IconButton>
<IconButton
<IconButton
aria-label="share"
onClick={handleShared}
>
Expand Down Expand Up @@ -161,29 +162,29 @@ const MyCardPopover: FunctionComponent<IMyCardPopoverProps> = (props) => {
>
<Grid container spacing={1} className={classes.root}>
<Grid item xs={6}>
<TextField
<TextField
{...textFieldProps}
autoFocus={true}
autoFocus={true}
label="Title"
name="title"
/>
</Grid>
<Grid item xs={6}>
<TextField
<TextField
{...textFieldProps}
label="Name"
name="name"
/>
</Grid>
<Grid item xs={12}>
<TextField
<TextField
{...textFieldProps}
label="Text"
name="text"
/>
</Grid>
<Grid item xs={12}>
<TextField
<TextField
{...textFieldProps}
label="Image URL"
name="image"
Expand Down Expand Up @@ -215,12 +216,12 @@ const MyCardPopover: FunctionComponent<IMyCardPopoverProps> = (props) => {
}

const AtomicCustomBlock: FunctionComponent = () => {

const ref = useRef<TMUIRichTextEditorRef>(null)
const [anchor, setAnchor] = useState<HTMLElement | null>(null)
return (
<>
<MyCardPopover
<MyCardPopover
anchor={anchor}
onSubmit={(data, insert) => {
if (insert) {
Expand Down
15 changes: 7 additions & 8 deletions examples/autocomplete-atomic/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { FunctionComponent } from 'react'
import Avatar from '@material-ui/core/Avatar'
import Chip from '@material-ui/core/Chip'
import MUIRichTextEditor from '../../'
import { TAutocompleteItem } from '../../src/components/Autocomplete'
import MUIRichTextEditor, { TAutocompleteItem } from '../../'

const save = (data: string) => {
console.log(data)
Expand Down Expand Up @@ -52,17 +51,17 @@ const CityChip: FunctionComponent<any> = (props) => {
}

return (
<Chip
avatar={<Avatar>{value.image}</Avatar>}
label={value.name}
onClick={handleClick}
<Chip
avatar={<Avatar>{value.image}</Avatar>}
label={value.name}
onClick={handleClick}
/>
)
}

const AutocompleteAtomic = () => {
return (
<MUIRichTextEditor
<MUIRichTextEditor
label="Try typing '/mexico'..."
onSave={save}
customControls={[
Expand All @@ -85,4 +84,4 @@ const AutocompleteAtomic = () => {
)
}

export default AutocompleteAtomic
export default AutocompleteAtomic
7 changes: 3 additions & 4 deletions examples/autocomplete/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React, { FunctionComponent } from 'react'
import ListItemText from '@material-ui/core/ListItemText'
import ListItemAvatar from '@material-ui/core/ListItemAvatar'
import Avatar from '@material-ui/core/Avatar'
import MUIRichTextEditor from '../../'
import { TAutocompleteItem } from '../../src/components/Autocomplete'
import MUIRichTextEditor, { TAutocompleteItem } from '../../'

const save = (data: string) => {
console.log(data)
Expand Down Expand Up @@ -107,7 +106,7 @@ const staff = [

const Autocomplete = () => {
return (
<MUIRichTextEditor
<MUIRichTextEditor
label="Try typing ':grin' or '/mexico'..."
onSave={save}
autocomplete={{
Expand All @@ -131,4 +130,4 @@ const Autocomplete = () => {
)
}

export default Autocomplete
export default Autocomplete
4 changes: 2 additions & 2 deletions examples/basic/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ const save = (data: string) => {

const Basic = () => {
return (
<MUIRichTextEditor
<MUIRichTextEditor
label="Type something here..."
onSave={save}
/>
)
}

export default Basic
export default Basic
15 changes: 7 additions & 8 deletions examples/custom-controls/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { FunctionComponent } from 'react'
import { Chip, Avatar, Button } from '@material-ui/core'
import InvertColorsIcon from '@material-ui/icons/InvertColors'
import MUIRichTextEditor from '../../'
import { TToolbarComponentProps } from '../../src/components/Toolbar'
import MUIRichTextEditor, { TToolbarComponentProps } from '../../'
import { EditorState } from 'draft-js'

const save = (data: string) => {
Expand All @@ -23,9 +22,9 @@ const MyBlock = (props: any) => {

const MyCallbackComponent: FunctionComponent<TToolbarComponentProps> = (props) => {
return (
<Chip
<Chip
id={props.id}
avatar={<Avatar>C</Avatar>}
avatar={<Avatar>C</Avatar>}
onClick={props.onMouseDown}
label="Callback"
disabled={props.disabled}
Expand All @@ -35,7 +34,7 @@ const MyCallbackComponent: FunctionComponent<TToolbarComponentProps> = (props) =

const ClearComponent: FunctionComponent<TToolbarComponentProps> = (props) => {
return (
<Chip
<Chip
id={props.id}
onClick={props.onMouseDown}
label="Clear all"
Expand All @@ -50,7 +49,7 @@ const MyBlockComponent: FunctionComponent<TToolbarComponentProps> = (props) => {
id={props.id}
variant="contained"
onMouseDown={props.onMouseDown}
color={props.active ? "primary": "default"}
color={props.active ? "primary" : "default"}
disabled={props.disabled}
>
My Block
Expand All @@ -60,7 +59,7 @@ const MyBlockComponent: FunctionComponent<TToolbarComponentProps> = (props) => {

const CustomControls = () => {
return (
<MUIRichTextEditor
<MUIRichTextEditor
label="Type something here..."
onSave={save}
controls={["title", "bold", "my-block", "my-style", "clear", "my-callback", "clear-callback", "save"]}
Expand Down Expand Up @@ -101,4 +100,4 @@ const CustomControls = () => {
)
}

export default CustomControls
export default CustomControls
4 changes: 2 additions & 2 deletions examples/custom-inline-toolbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const save = (data: string) => {

const CustomInlineToolbar = () => {
return (
<MUIRichTextEditor
<MUIRichTextEditor
label="Try selecting some text to show the inline toolbar..."
inlineToolbar={true}
inlineToolbarControls={["bold", "italic", "my-style", "link"]}
Expand All @@ -28,4 +28,4 @@ const CustomInlineToolbar = () => {
)
}

export default CustomInlineToolbar
export default CustomInlineToolbar
4 changes: 2 additions & 2 deletions examples/decorator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const MyAtDecorator = (props: any) => {

const Decorators = () => {
return (
<MUIRichTextEditor
<MUIRichTextEditor
label="Try writing a #hashtag or a @mention..."
onSave={save}
decorators={[
Expand All @@ -49,4 +49,4 @@ const Decorators = () => {
)
}

export default Decorators
export default Decorators
4 changes: 2 additions & 2 deletions examples/events/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const blur = () => {

const Events = () => {
return (
<MUIRichTextEditor
<MUIRichTextEditor
label="Open the console to see the event callback as you type..."
onSave={save}
onChange={change}
Expand All @@ -42,4 +42,4 @@ const Events = () => {
)
}

export default Events
export default Events
2 changes: 1 addition & 1 deletion examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
<div id="root"></div>
<script type="text/javascript" src="./bundle.js"></script>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions examples/inline-toolbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import MUIRichTextEditor from '../../'

const InlineToolbar = () => {
return (
<MUIRichTextEditor
<MUIRichTextEditor
label="Try selecting some text to show the inline toolbar..."
inlineToolbar={true}
/>
)
}

export default InlineToolbar
export default InlineToolbar
4 changes: 2 additions & 2 deletions examples/key-bindings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const save = (data: string) => {

const KeyBindings = () => {
return (
<MUIRichTextEditor
<MUIRichTextEditor
label="Press CMD + C to clear the editor or CMD + K to add 'italic' style to the selection..."
onSave={save}
controls={["title", "italic", "save"]}
Expand All @@ -33,4 +33,4 @@ const KeyBindings = () => {
)
}

export default KeyBindings
export default KeyBindings
6 changes: 3 additions & 3 deletions examples/load-html/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ const save = (data: string) => {

const LoadHTML = () => {
return (
<MUIRichTextEditor
defaultValue={content}
<MUIRichTextEditor
defaultValue={content}
onSave={save}
/>
)
}

export default LoadHTML
export default LoadHTML

0 comments on commit b7f70ed

Please sign in to comment.