diff --git a/src/screens/EPub/views/EditEPubChapter/ChapterEditor/ChapterContent.js b/src/screens/EPub/views/EditEPubChapter/ChapterEditor/ChapterContent.js index 85135af92..54eb5b391 100644 --- a/src/screens/EPub/views/EditEPubChapter/ChapterEditor/ChapterContent.js +++ b/src/screens/EPub/views/EditEPubChapter/ChapterEditor/ChapterContent.js @@ -1,5 +1,6 @@ import React, {useState, useRef} from 'react'; import { CTFragment } from 'layout'; +import { v4 as uuidv4 } from 'uuid'; import Typography from '@material-ui/core/Typography'; import Box from '@material-ui/core/Box'; import TextField from '@material-ui/core/TextField'; @@ -24,7 +25,7 @@ let Tags = ({data, handleDelete}) => { } return ( - + {data} - {tags.map((data) => ( - - ))} + {tags.map((data) => { + const uuid = uuidv4(); + return ( + + )})} diff --git a/src/screens/EPub/views/EditEPubChapter/ChapterEditor/ChapterInfo.js b/src/screens/EPub/views/EditEPubChapter/ChapterEditor/ChapterInfo.js index c1049f291..0083c6cb1 100644 --- a/src/screens/EPub/views/EditEPubChapter/ChapterEditor/ChapterInfo.js +++ b/src/screens/EPub/views/EditEPubChapter/ChapterEditor/ChapterInfo.js @@ -1,5 +1,6 @@ import React from 'react'; import { CTFragment } from 'layout'; +import { v4 as uuidv4 } from 'uuid'; import { epub } from '../../../controllers'; import { ChapterTitle } from '../../../components'; import ChapterContent from './ChapterContent'; @@ -59,20 +60,22 @@ function ChapterInfo({ chapter, currChIndex, dispatch }) { onSave={onSaveTitle} /> - {contents.map((content, index) => ( - - ))} + {contents.map((content, index) => { + const uuid = uuidv4(); + return ( + + )})} diff --git a/src/screens/EPub/views/EditEPubChapter/ChapterEditor/SubChapterItem.js b/src/screens/EPub/views/EditEPubChapter/ChapterEditor/SubChapterItem.js index 44a06c4fa..601be88da 100644 --- a/src/screens/EPub/views/EditEPubChapter/ChapterEditor/SubChapterItem.js +++ b/src/screens/EPub/views/EditEPubChapter/ChapterEditor/SubChapterItem.js @@ -1,6 +1,7 @@ /* eslint-disable react/no-array-index-key */ import React from 'react'; import { CTFragment, CTText } from 'layout'; +import { v4 as uuidv4 } from 'uuid'; import { epub } from '../../../controllers'; import { ChapterTitle } from '../../../components'; import ChapterContent from './ChapterContent'; @@ -66,18 +67,20 @@ function SubChapterItem({ onSave={onSaveTitle} /> - {contents.map((content, index) => ( - - ))} + {contents.map((content, index) => { + const uuid = uuidv4(); + return ( + + )})} diff --git a/src/screens/EPub/views/EditINote/INoteEditor/INoteChapter.js b/src/screens/EPub/views/EditINote/INoteEditor/INoteChapter.js index 8e607229b..bdf80e936 100644 --- a/src/screens/EPub/views/EditINote/INoteEditor/INoteChapter.js +++ b/src/screens/EPub/views/EditINote/INoteEditor/INoteChapter.js @@ -6,6 +6,7 @@ import { connect } from 'dva' import { Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions} from '@material-ui/core'; import { EPubImageData } from 'entities/EPubs'; import { timestr } from 'utils'; +import { v4 as uuidv4 } from 'uuid'; import { ChapterImage, ChapterText, ChapterTitle, MDEditorModal } from '../../../components'; import {epub as epubTools} from '../../../controllers'; @@ -246,64 +247,66 @@ function INoteChapter ({ ) : (// If the chapter has elements, then iterate through all of them - chapter.contents.map((content, itemIdx) => ( - - - {mergeChapterBtnElement(itemIdx)} - {splitBtnElement(itemIdx)} - {addImgElement(itemIdx)} - {addTextElement(itemIdx)} - {watchVideoElement(itemIdx)} - + chapter.contents.map((content, itemIdx) => { + const uuid = uuidv4(); + return ( + + + {mergeChapterBtnElement(itemIdx)} + {splitBtnElement(itemIdx)} + {addImgElement(itemIdx)} + {addTextElement(itemIdx)} + {watchVideoElement(itemIdx)} + - {typeof content === "object" ? ( // image - - + + + + Delete Image Block + + + + Do you want to delete the Image Block? + + + + + + + + + ) : ( // text + + - - - Delete Image Block - - - - Do you want to delete the Image Block? - - - - - - - - - ) : ( // text - - - - )} - {itemIdx === chapter.contents.length - 1 && ( - - {mergeChapterBtnElement(chapter.contents.length)} - {splitBtnElement(chapter.contents.length)} - {addImgElement(chapter.contents.length)} - {addTextElement(chapter.contents.length)} - {watchVideoElement(chapter.contents.length)} - )} - - )))} + + )} + {itemIdx === chapter.contents.length - 1 && ( + + {mergeChapterBtnElement(chapter.contents.length)} + {splitBtnElement(chapter.contents.length)} + {addImgElement(chapter.contents.length)} + {addTextElement(chapter.contents.length)} + {watchVideoElement(chapter.contents.length)} + )} + + )}))} {insertType !== null && (