File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,6 +117,37 @@ export const Columns = TiptapNode.create({
117117 }
118118 return false ;
119119 } ,
120+ // Backspace at start of empty column: if all columns empty → unset
121+ Backspace : ( ) => {
122+ const { state } = this . editor ;
123+ const { from, empty } = state . selection ;
124+ if ( ! empty ) return false ;
125+ const resolved = state . doc . resolve ( from ) ;
126+ // Find columns ancestor
127+ let columnsDepth = - 1 ;
128+ for ( let d = resolved . depth ; d > 0 ; d -- ) {
129+ if ( resolved . node ( d ) . type . name === this . name ) {
130+ columnsDepth = d ;
131+ break ;
132+ }
133+ }
134+ if ( columnsDepth === - 1 ) return false ;
135+ // Must be at start of current textblock
136+ const parentOffset = resolved . parentOffset ;
137+ if ( parentOffset !== 0 ) return false ;
138+ // All columns must be empty
139+ const columnsNode = resolved . node ( columnsDepth ) ;
140+ let allEmpty = true ;
141+ columnsNode . descendants ( ( node ) => {
142+ if ( node . isTextblock && node . textContent . length > 0 ) {
143+ allEmpty = false ;
144+ return false ;
145+ }
146+ return true ;
147+ } ) ;
148+ if ( ! allEmpty ) return false ;
149+ return this . editor . chain ( ) . focus ( ) . unsetColumns ( ) . run ( ) ;
150+ } ,
120151 } ;
121152 } ,
122153} ) ;
Original file line number Diff line number Diff line change 677677/* ── 컬럼 레이아웃 ── */
678678.tiptap div [data-type = "columns" ] {
679679 display : grid;
680- gap : 24 px ;
680+ gap : 16 px ;
681681 margin : 1em 0 ;
682682}
683683
691691
692692.tiptap div [data-type = "column" ] {
693693 min-width : 0 ;
694- padding : 4px 8 px ;
694+ padding : 4px 6 px ;
695695 border : 1px dashed var (--border );
696696 border-radius : 8px ;
697697}
You can’t perform that action at this time.
0 commit comments