mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Add shift-tab keyboard shortcut.
If at beginning of list item, shift-tab decreases indent (to mirror tab to indent).
This commit is contained in:
parent
f7cc582c93
commit
bf8f796ea4
3 changed files with 26 additions and 2 deletions
|
@ -1545,6 +1545,18 @@ var keyHandlers = {
|
|||
}
|
||||
}
|
||||
},
|
||||
'shift-tab': function ( self, event, range ) {
|
||||
self._removeZWS();
|
||||
// If no selection and at start of block
|
||||
if ( range.collapsed && rangeDoesStartAtBlockBoundary( range ) ) {
|
||||
// Break list
|
||||
var node = range.startContainer;
|
||||
if ( getNearest( node, 'UL' ) || getNearest( node, 'OL' ) ) {
|
||||
event.preventDefault();
|
||||
self.modifyBlocks( decreaseListLevel, range );
|
||||
}
|
||||
}
|
||||
},
|
||||
space: function ( self, _, range ) {
|
||||
var node, parent;
|
||||
self._recordUndoState( range );
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -396,6 +396,18 @@ var keyHandlers = {
|
|||
}
|
||||
}
|
||||
},
|
||||
'shift-tab': function ( self, event, range ) {
|
||||
self._removeZWS();
|
||||
// If no selection and at start of block
|
||||
if ( range.collapsed && rangeDoesStartAtBlockBoundary( range ) ) {
|
||||
// Break list
|
||||
var node = range.startContainer;
|
||||
if ( getNearest( node, 'UL' ) || getNearest( node, 'OL' ) ) {
|
||||
event.preventDefault();
|
||||
self.modifyBlocks( decreaseListLevel, range );
|
||||
}
|
||||
}
|
||||
},
|
||||
space: function ( self, _, range ) {
|
||||
var node, parent;
|
||||
self._recordUndoState( range );
|
||||
|
|
Loading…
Reference in a new issue