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 db56d7d commit d937bc6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/common/CKEditor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +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 handleUploadButtonClick = () => {
setModalOpen(true);
};
Expand Down Expand Up @@ -96,6 +97,8 @@ 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)
};

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

onChange(data, false);
}}
Expand Down

0 comments on commit d937bc6

Please sign in to comment.