mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
chore: use lectures naming
This commit is contained in:
parent
d7f1e6f94a
commit
7237a4de49
36 changed files with 404 additions and 403 deletions
|
|
@ -24,7 +24,7 @@ interface Editor {
|
|||
content: string;
|
||||
ydoc: any;
|
||||
provider: any;
|
||||
element: any;
|
||||
lecture: any;
|
||||
course: any;
|
||||
setContent: (content: string) => void;
|
||||
}
|
||||
|
|
@ -48,11 +48,11 @@ function Editor(props: Editor) {
|
|||
}),
|
||||
ImageBlock.configure({
|
||||
editable: true,
|
||||
element: props.element,
|
||||
lecture: props.lecture,
|
||||
}),
|
||||
VideoBlock.configure({
|
||||
editable: true,
|
||||
element: props.element,
|
||||
lecture: props.lecture,
|
||||
}),
|
||||
Youtube.configure({
|
||||
controls: true,
|
||||
|
|
@ -96,7 +96,7 @@ function Editor(props: Editor) {
|
|||
<EditorInfoThumbnail src={`${getBackendUrl()}content/uploads/img/${props.course.course.thumbnail}`} alt=""></EditorInfoThumbnail>
|
||||
<EditorInfoDocName>
|
||||
{" "}
|
||||
<b>{props.course.course.name}</b> <SlashIcon /> {props.element.name}{" "}
|
||||
<b>{props.course.course.name}</b> <SlashIcon /> {props.lecture.name}{" "}
|
||||
</EditorInfoDocName>
|
||||
<EditorSaveButton onClick={() => props.setContent(editor.getJSON())}>
|
||||
Save <Save size={12} />
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ import { default as React, } from "react";
|
|||
import * as Y from "yjs";
|
||||
import { WebrtcProvider } from "y-webrtc";
|
||||
import Editor from "./Editor";
|
||||
import { updateElement } from "../../services/courses/elements";
|
||||
import { updateLecture } from "../../services/courses/lectures";
|
||||
|
||||
interface EditorWrapperProps {
|
||||
content: string;
|
||||
element: any;
|
||||
lecture: any;
|
||||
course:any
|
||||
}
|
||||
|
||||
|
|
@ -18,16 +18,16 @@ function EditorWrapper(props: EditorWrapperProps) : JSX.Element {
|
|||
const [isLoading, setIsLoading] = React.useState(true);
|
||||
|
||||
function createRTCProvider() {
|
||||
// const provider = new WebrtcProvider(props.element.element_id, ydoc);
|
||||
// const provider = new WebrtcProvider(props.lecture.lecture_id, ydoc);
|
||||
// setYdocState(ydoc);
|
||||
// setProviderState(provider);
|
||||
setIsLoading(false);
|
||||
}
|
||||
|
||||
async function setContent(content: any) {
|
||||
let element = props.element;
|
||||
element.content = content;
|
||||
const res = await updateElement(element, element.element_id);
|
||||
let lecture = props.lecture;
|
||||
lecture.content = content;
|
||||
const res = await updateLecture(lecture, lecture.lecture_id);
|
||||
alert(JSON.stringify(res));
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ function EditorWrapper(props: EditorWrapperProps) : JSX.Element {
|
|||
createRTCProvider();
|
||||
return <div>Loading...</div>;
|
||||
} else {
|
||||
return <Editor course={props.course} element={props.element} content={props.content} setContent={setContent} provider={providerState} ydoc={ydocState}></Editor>;
|
||||
return <Editor course={props.course} lecture={props.lecture} content={props.content} setContent={setContent} provider={providerState} ydoc={ydocState}></Editor>;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ function ImageBlockComponent(props: any) {
|
|||
const handleSubmit = async (e: any) => {
|
||||
e.preventDefault();
|
||||
setIsLoading(true);
|
||||
let object = await uploadNewImageFile(image, props.extension.options.element.element_id);
|
||||
let object = await uploadNewImageFile(image, props.extension.options.lecture.lecture_id);
|
||||
setIsLoading(false);
|
||||
setfileObject(object);
|
||||
props.updateAttributes({
|
||||
|
|
@ -41,7 +41,7 @@ function ImageBlockComponent(props: any) {
|
|||
{fileObject && (
|
||||
<BlockImage>
|
||||
<img
|
||||
src={`${getBackendUrl()}content/uploads/files/pictures/${props.extension.options.element.element_id}/${fileObject.file_id}.${
|
||||
src={`${getBackendUrl()}content/uploads/files/pictures/${props.extension.options.lecture.lecture_id}/${fileObject.file_id}.${
|
||||
fileObject.file_format
|
||||
}`}
|
||||
alt=""
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ function VideoBlockComponents(props: any) {
|
|||
const handleSubmit = async (e: any) => {
|
||||
e.preventDefault();
|
||||
setIsLoading(true);
|
||||
let object = await uploadNewVideoFile(video, props.extension.options.element.element_id);
|
||||
let object = await uploadNewVideoFile(video, props.extension.options.lecture.lecture_id);
|
||||
setIsLoading(false);
|
||||
setfileObject(object);
|
||||
props.updateAttributes({
|
||||
|
|
@ -42,7 +42,7 @@ function VideoBlockComponents(props: any) {
|
|||
<BlockVideo>
|
||||
<video
|
||||
controls
|
||||
src={`${getBackendUrl()}content/uploads/files/videos/${props.extension.options.element.element_id}/${fileObject.file_id}.${
|
||||
src={`${getBackendUrl()}content/uploads/files/videos/${props.extension.options.lecture.lecture_id}/${fileObject.file_id}.${
|
||||
fileObject.file_format
|
||||
}`}
|
||||
></video>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue