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 committed by Neil Jenkins
parent 2bade7e868
commit 85c9002ce5
3 changed files with 5 additions and 9 deletions

View file

@ -1528,10 +1528,8 @@ var keyHandlers = {
tab: function ( self, event, range ) { tab: function ( self, event, range ) {
var node, parent; var node, parent;
self._removeZWS(); self._removeZWS();
// If no selection and in an empty block // If no selection and at start of 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 ) {

File diff suppressed because one or more lines are too long

View file

@ -379,10 +379,8 @@ var keyHandlers = {
tab: function ( self, event, range ) { tab: function ( self, event, range ) {
var node, parent; var node, parent;
self._removeZWS(); self._removeZWS();
// If no selection and in an empty block // If no selection and at start of 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 ) {