mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
Merge pull request #110 from ksanjeev284/Ordered-List
Add Ordered list to Editor
This commit is contained in:
commit
23e5fa0525
3 changed files with 27 additions and 1 deletions
|
|
@ -23,6 +23,9 @@ import QuizBlock from "./Extensions/Quiz/QuizBlock";
|
|||
import ToolTip from "@components/StyledElements/Tooltip/Tooltip";
|
||||
import Link from "next/link";
|
||||
import { getCourseThumbnailMediaDirectory } from "@services/media/media";
|
||||
import { OrderedList } from "@tiptap/extension-ordered-list";
|
||||
import {ListItem} from '@tiptap/extension-list-item'
|
||||
|
||||
|
||||
interface Editor {
|
||||
content: string;
|
||||
|
|
@ -80,6 +83,8 @@ function Editor(props: Editor) {
|
|||
controls: true,
|
||||
modestBranding: true,
|
||||
}),
|
||||
OrderedList.configure(),
|
||||
|
||||
// Register the document with Tiptap
|
||||
// Collaboration.configure({
|
||||
// document: props.ydoc,
|
||||
|
|
@ -404,6 +409,14 @@ export const EditorContentWrapper = styled.div`
|
|||
display: block;
|
||||
outline: 0px solid transparent;
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
padding: 0 1rem;
|
||||
padding-left: 10px;
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
|
||||
`;
|
||||
|
||||
export default Editor;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import styled from "styled-components";
|
||||
import { FontBoldIcon, FontItalicIcon, StrikethroughIcon, ArrowLeftIcon, ArrowRightIcon, OpacityIcon, DividerVerticalIcon } from "@radix-ui/react-icons";
|
||||
import { FontBoldIcon, FontItalicIcon, StrikethroughIcon, ArrowLeftIcon, ArrowRightIcon, OpacityIcon, DividerVerticalIcon, ListBulletIcon } from "@radix-ui/react-icons";
|
||||
import { AlertCircle, AlertTriangle, FileText, GraduationCap, ImagePlus, Info, Sigma, Video, Youtube } from "lucide-react";
|
||||
import ToolTip from "@components/StyledElements/Tooltip/Tooltip";
|
||||
|
||||
|
|
@ -39,6 +39,9 @@ export const ToolbarButtons = ({ editor, props }: any) => {
|
|||
<ToolBtn onClick={() => editor.chain().focus().toggleStrike().run()} className={editor.isActive("strike") ? "is-active" : ""}>
|
||||
<StrikethroughIcon />
|
||||
</ToolBtn>
|
||||
<ToolBtn onClick={() => editor.chain().focus().toggleOrderedList().run()} className={editor.isActive('orderedList') ? 'is-active' : ''}>
|
||||
<ListBulletIcon />
|
||||
</ToolBtn>
|
||||
<ToolSelect
|
||||
onChange={(e) =>
|
||||
editor
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import ImageBlock from "@components/Objects/Editor/Extensions/Image/ImageBlock";
|
|||
import VideoBlock from "@components/Objects/Editor/Extensions/Video/VideoBlock";
|
||||
import MathEquationBlock from "@components/Objects/Editor/Extensions/MathEquation/MathEquationBlock";
|
||||
import PDFBlock from "@components/Objects/Editor/Extensions/PDF/PDFBlock";
|
||||
import { OrderedList } from "@tiptap/extension-ordered-list";
|
||||
|
||||
interface Editor {
|
||||
content: string;
|
||||
|
|
@ -49,6 +50,9 @@ function Canva(props: Editor) {
|
|||
controls: true,
|
||||
modestBranding: true,
|
||||
}),
|
||||
|
||||
OrderedList.configure()
|
||||
|
||||
],
|
||||
|
||||
content: props.content,
|
||||
|
|
@ -101,6 +105,12 @@ h5 {
|
|||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
padding: 0 1rem;
|
||||
padding-left: 10px;
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
|
||||
&:focus {
|
||||
outline: none !important;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue