Skip to content

Commit 62a3b8b

Browse files
author
Garry Yao
committed
Handled backspace/del key at the start/end of table cell, to move cursor.
1 parent bc7b037 commit 62a3b8b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

core/editable.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,16 @@
528528

529529
evt.data.preventDefault();
530530
}
531-
531+
// BACKSPACE/DEL pressed at the start/end of table cell.
532+
else if ( ( parent = path.contains( [ 'td', 'th', 'caption' ] ) ) &&
533+
range.checkBoundaryOfElement( parent, rtl ? CKEDITOR.START : CKEDITOR.END ) ) {
534+
next = parent[ rtl ? 'getPreviousSourceNode' : 'getNextSourceNode' ]( 1, CKEDITOR.NODE_ELEMENT );
535+
if ( next && !next.isReadOnly() && range.root.contains( next ) ) {
536+
range[ rtl ? 'moveToElementEditEnd' : 'moveToElementEditStart' ]( next );
537+
range.select();
538+
evt.data.preventDefault();
539+
}
540+
}
532541
}
533542

534543
}

0 commit comments

Comments
 (0)