0
Fork 0
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:
Gert K. Sønderby 2015-09-25 16:05:42 +02:00 committed by Gert Sønderby
parent e133f26db1
commit a60ee8f902
3 changed files with 22 additions and 2 deletions

View file

@ -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

View file

@ -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;