0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Add tab nesting capability to list items with text in them;

- This requires your cursor to be at the beginning of the list item.
- This implementation mimics Google Docs.
This commit is contained in:
Trey Cordova 2015-10-22 16:08:53 -07:00
parent 0c87def58c
commit aa7311195f

View file

@ -381,15 +381,14 @@ var keyHandlers = {
self._removeZWS();
// If no selection and in an empty block
if ( range.collapsed &&
rangeDoesStartAtBlockBoundary( range ) &&
rangeDoesEndAtBlockBoundary( range ) ) {
rangeDoesStartAtBlockBoundary( range ) ) {
node = getStartBlockOfRange( range );
// Iterate through the block's parents
while ( parent = node.parentNode ) {
// If we find a UL or OL (so are in a list, node must be an LI)
if ( parent.nodeName === 'UL' || parent.nodeName === 'OL' ) {
// AND the LI is not the first in the list
if ( node.previousSibling ) {
if ( node.previousSibling || node.parentNode.nodeName === 'LI' ) {
// Then increase the list level
event.preventDefault();
self.modifyBlocks( increaseListLevel, range );