mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 23:40:35 -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:
parent
0c87def58c
commit
aa7311195f
1 changed files with 2 additions and 3 deletions
|
@ -381,15 +381,14 @@ var keyHandlers = {
|
||||||
self._removeZWS();
|
self._removeZWS();
|
||||||
// If no selection and in an empty block
|
// If no selection and in an empty block
|
||||||
if ( range.collapsed &&
|
if ( range.collapsed &&
|
||||||
rangeDoesStartAtBlockBoundary( range ) &&
|
rangeDoesStartAtBlockBoundary( range ) ) {
|
||||||
rangeDoesEndAtBlockBoundary( range ) ) {
|
|
||||||
node = getStartBlockOfRange( range );
|
node = getStartBlockOfRange( range );
|
||||||
// Iterate through the block's parents
|
// Iterate through the block's parents
|
||||||
while ( parent = node.parentNode ) {
|
while ( parent = node.parentNode ) {
|
||||||
// If we find a UL or OL (so are in a list, node must be an LI)
|
// If we find a UL or OL (so are in a list, node must be an LI)
|
||||||
if ( parent.nodeName === 'UL' || parent.nodeName === 'OL' ) {
|
if ( parent.nodeName === 'UL' || parent.nodeName === 'OL' ) {
|
||||||
// AND the LI is not the first in the list
|
// 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
|
// Then increase the list level
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
self.modifyBlocks( increaseListLevel, range );
|
self.modifyBlocks( increaseListLevel, range );
|
||||||
|
|
Loading…
Reference in a new issue