@@ -15,6 +15,8 @@ import { InputRule } from "@tiptap/core";
15
15
// import UploadImagesPlugin from "@/components/editor/editor/plugins/upload-images";
16
16
import UpdatedImage from "./updated-image" ;
17
17
import Document from "@tiptap/extension-document" ;
18
+ import Paragraph from "@tiptap/extension-paragraph" ;
19
+ import Text from "@tiptap/extension-text" ;
18
20
import TextAlign from "@tiptap/extension-text-align" ;
19
21
import Subscript from "@tiptap/extension-subscript" ;
20
22
import Superscript from "@tiptap/extension-superscript" ;
@@ -27,6 +29,14 @@ import TableHeader from "@tiptap/extension-table-header";
27
29
import TableRow from "@tiptap/extension-table-row" ;
28
30
import { ReactNodeViewRenderer , NodeViewProps } from "@tiptap/react" ;
29
31
import CustomTableNodeView from "../components/Table/CustomTableNodeView" ;
32
+ import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight" ;
33
+
34
+ import { lowlight } from "lowlight" ;
35
+
36
+ // Highlight syntax select your style from here (https://highlightjs.org/examples)
37
+ import "highlight.js/styles/monokai-sublime.css" ;
38
+
39
+ import CodeBlock from "../components/CodeBlock/CodeBlock" ;
30
40
31
41
// const CustomImage = TiptapImage.extend({
32
42
// addProseMirrorPlugins() {
@@ -38,6 +48,21 @@ const CustomDocument = Document.extend({
38
48
content : "heading block*" ,
39
49
} ) ;
40
50
51
+ export const CustomCodeBlockEdit = CodeBlockLowlight . extend ( {
52
+ addNodeView ( ) {
53
+ return ReactNodeViewRenderer ( CodeBlock ) ;
54
+ } ,
55
+ } ) . configure ( { lowlight } ) ;
56
+
57
+ // Two CodeBlockNodes need to be created to disable selector menu
58
+ export const CustomCodeBlockReadOnly = CodeBlockLowlight . extend ( {
59
+ addNodeView ( ) {
60
+ return ReactNodeViewRenderer ( ( props : NodeViewProps ) => (
61
+ < CodeBlock { ...props } readOnly />
62
+ ) ) ;
63
+ } ,
64
+ } ) . configure ( { lowlight } ) ;
65
+
41
66
export const CustomTable = Table . extend ( {
42
67
addNodeView ( ) {
43
68
return ReactNodeViewRenderer ( ( props : NodeViewProps ) => (
@@ -70,6 +95,8 @@ export const TiptapExtensions = [
70
95
"text-neutral-900 bg-neutral-100 border border-neutral-500 flex-1 flex p-1" ,
71
96
} ,
72
97
} ) ,
98
+ Paragraph ,
99
+ Text ,
73
100
StarterKit . configure ( {
74
101
document : false ,
75
102
bulletList : {
0 commit comments