mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-06 23:00:08 -05:00
Handle enter when within a preformatted tag.
This commit is contained in:
parent
e133f26db1
commit
a60ee8f902
3 changed files with 22 additions and 2 deletions
|
@ -1326,6 +1326,16 @@ var keyHandlers = {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( /^PRE|CODE|SAMP$/.test( block.nodeName ) ) {
|
||||
// Inside a preformatted block, insert a linebreak, and done.
|
||||
insertNodeInRange( range, self._doc.createTextNode( '\n' ) );
|
||||
range.collapse( false );
|
||||
block.normalize();
|
||||
self.setSelection( range );
|
||||
self._updatePath( range, true );
|
||||
return;
|
||||
}
|
||||
|
||||
// If in a list, we'll split the LI instead.
|
||||
if ( parent = getNearest( block, 'LI' ) ) {
|
||||
block = parent;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -175,6 +175,16 @@ var keyHandlers = {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( /^PRE|CODE|SAMP$/.test( block.nodeName ) ) {
|
||||
// Inside a preformatted block, insert a linebreak, and done.
|
||||
insertNodeInRange( range, self._doc.createTextNode( '\n' ) );
|
||||
range.collapse( false );
|
||||
block.normalize();
|
||||
self.setSelection( range );
|
||||
self._updatePath( range, true );
|
||||
return;
|
||||
}
|
||||
|
||||
// If in a list, we'll split the LI instead.
|
||||
if ( parent = getNearest( block, 'LI' ) ) {
|
||||
block = parent;
|
||||
|
|
Loading…
Reference in a new issue