Skip to content

Commit

Permalink
Update Editor.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
RiXelanya committed Aug 26, 2023
1 parent d937bc6 commit 77a570c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/components/common/CKEditor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const Editor: React.FC<EditorProps> = props => {
const styles = useStyles({ mobile, counter: true });
const [modalOpen, setModalOpen] = useState(false);
const [uploadedVideos, setUploadedVideos] = useState([]);
const [editorData, setEditorData] = useState('') ;
const [editorData, setEditorData] = useState('');
const handleUploadButtonClick = () => {
setModalOpen(true);
};
Expand Down Expand Up @@ -97,8 +97,10 @@ export const Editor: React.FC<EditorProps> = props => {

setUploadedVideos([...uploadedVideos, videoURL]);
setModalOpen(false);
const dataWithVideo = editorData + `<video controls src='${videoURL}'>your browser does not support video</video>` ;
onChange(dataWithVideo , false)
const dataWithVideo =
editorData +
`<video controls src='${videoURL}'>your browser does not support video</video>`;
onChange(dataWithVideo, false);
};

return (
Expand All @@ -120,8 +122,10 @@ export const Editor: React.FC<EditorProps> = props => {
}}
onChange={(event, editor) => {
var data = editor.getData();
if (uploadedVideos.length !== 0) {
data = data + `<video controls src='${uploadedVideos[0]}'>your browser does not support video</video>` ;
if (uploadedVideos.length !== 0) {
data =
data +
`<video controls src='${uploadedVideos[0]}'>your browser does not support video</video>`;
}
setEditorData(data);

Expand Down

0 comments on commit 77a570c

Please sign in to comment.