File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,6 +77,10 @@ export default function TiptapToolbar({ editor }: Props) {
7777 < Toolbar variant = "floating"
7878 className = "rounded! bg-card flex-wrap gap-1" >
7979 { /* TEXT MARKS */ }
80+ < ToolbarSeparator />
81+ < TableControls editor = { editor } />
82+ < ToolbarSeparator />
83+
8084 < ToolbarGroup className = "" >
8185 < HeadingDropdown editor = { editor } />
8286 < FontSizeDropdown editor = { editor } />
@@ -169,6 +173,8 @@ export default function TiptapToolbar({ editor }: Props) {
169173 < Button onClick = { ( ) => editor . chain ( ) . focus ( ) . clearContent ( ) . run ( ) } > < TrashIcon /> </ Button >
170174 </ ToolbarGroup >
171175
176+
177+
172178 </ Toolbar >
173179 )
174180}
@@ -212,6 +218,31 @@ function HeadingDropdown({ editor }: { editor: Editor }) {
212218 )
213219}
214220
221+ function TableControls ( { editor } : { editor : Editor } ) {
222+ if ( ! editor . isActive ( "table" ) ) return null
223+
224+ return (
225+ < ToolbarGroup >
226+ < Button onClick = { ( ) => editor . chain ( ) . focus ( ) . addRowBefore ( ) . run ( ) } >
227+ +Row ↑
228+ </ Button >
229+ < Button onClick = { ( ) => editor . chain ( ) . focus ( ) . addRowAfter ( ) . run ( ) } >
230+ +Row ↓
231+ </ Button >
232+ < Button onClick = { ( ) => editor . chain ( ) . focus ( ) . addColumnBefore ( ) . run ( ) } >
233+ +Col ←
234+ </ Button >
235+ < Button onClick = { ( ) => editor . chain ( ) . focus ( ) . addColumnAfter ( ) . run ( ) } >
236+ +Col →
237+ </ Button >
238+ < Button onClick = { ( ) => editor . chain ( ) . focus ( ) . deleteTable ( ) . run ( ) } >
239+ Delete
240+ </ Button >
241+ </ ToolbarGroup >
242+ )
243+ }
244+
245+
215246const SIZES = [
216247 { label : "8px" , value : "8px" } ,
217248 { label : "10px" , value : "10px" } ,
Original file line number Diff line number Diff line change @@ -766,6 +766,10 @@ body {
766766}
767767
768768
769+
770+
771+
772+
769773. tiptap {
770774 color : hsl ( var ( --foreground ) ) !important ;
771775}
You can’t perform that action at this time.
0 commit comments