mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
chore: typescript refactor
This commit is contained in:
parent
81aead7611
commit
054f07e0e9
6 changed files with 29 additions and 43 deletions
62
front/components/LectureViews/DynamicCanva/DynamicCanva.tsx
Normal file
62
front/components/LectureViews/DynamicCanva/DynamicCanva.tsx
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
import React from "react";
|
||||
import { useEditor, EditorContent } from "@tiptap/react";
|
||||
import StarterKit from "@tiptap/starter-kit";
|
||||
// Custom Extensions
|
||||
import InfoCallout from "@editor/Extensions/Callout/Info/InfoCallout";
|
||||
import WarningCallout from "@editor/Extensions/Callout/Warning/WarningCallout";
|
||||
import ImageBlock from "@editor/Extensions/Image/ImageBlock";
|
||||
import Youtube from "@tiptap/extension-youtube";
|
||||
import { EditorContentWrapper } from "@editor/Editor";
|
||||
import VideoBlock from "@editor/Extensions/Video/VideoBlock";
|
||||
import { styled } from "styled-components";
|
||||
|
||||
interface Editor {
|
||||
content: string;
|
||||
element: any;
|
||||
//course: any;
|
||||
}
|
||||
|
||||
function Canva(props: Editor) {
|
||||
const isEditable = false;
|
||||
const editor: any = useEditor({
|
||||
editable: isEditable,
|
||||
extensions: [
|
||||
StarterKit,
|
||||
// Custom Extensions
|
||||
InfoCallout.configure({
|
||||
editable: isEditable,
|
||||
}),
|
||||
WarningCallout.configure({
|
||||
editable: isEditable,
|
||||
}),
|
||||
ImageBlock.configure({
|
||||
editable: isEditable,
|
||||
element: props.element,
|
||||
}),
|
||||
VideoBlock.configure({
|
||||
editable: true,
|
||||
element: props.element,
|
||||
}),
|
||||
Youtube.configure({
|
||||
controls: true,
|
||||
modestBranding: true,
|
||||
}),
|
||||
],
|
||||
|
||||
content: props.content,
|
||||
});
|
||||
|
||||
return (
|
||||
<CanvaWrapper>
|
||||
<EditorContent editor={editor} />
|
||||
</CanvaWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
const CanvaWrapper = styled.div`
|
||||
padding-top: 20px;
|
||||
width: 1300px;
|
||||
margin: 0 auto;
|
||||
`;
|
||||
|
||||
export default Canva;
|
||||
Loading…
Add table
Add a link
Reference in a new issue