Skip to content

Commit

Permalink
fix: mobile video not uploading (#1885)
Browse files Browse the repository at this point in the history
* Update Editor.tsx

* Update Editor.tsx

* Update Editor.tsx
  • Loading branch information
RiXelanya authored Aug 28, 2023
1 parent f99a618 commit 867ed19
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 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,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);
};

return (
Expand All @@ -116,7 +121,13 @@ export const Editor: React.FC<EditorProps> = props => {
});
}}
onChange={(event, editor) => {
const data = editor.getData();
let 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 867ed19

Please sign in to comment.