0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 07:13:08 -05:00
kyuwoo.choi 2017-02-23 15:24:26 +09:00
parent 52b92abe47
commit b8053d5ba6
3 changed files with 20 additions and 2 deletions

View file

@ -1448,6 +1448,15 @@ var keyHandlers = {
// If this is a malformed bit of document or in a table;
// just play it safe and insert a <br>.
if ( !block || /^T[HD]$/.test( block.nodeName ) ) {
// Move cursor out of tags if the cursor is at the end of inline tags
parent = range.commonAncestorContainer;
if ( /^T[HD]$/.test( block.nodeName ) ) {
while ( isInline( parent ) && getLength( parent ) === range.endOffset ) {
range.setStartAfter( parent );
range.collapse( true );
parent = range.commonAncestorContainer;
}
}
insertNodeInRange( range, self.createElement( 'BR' ) );
range.collapse( false );
self.setSelection( range );

File diff suppressed because one or more lines are too long

View file

@ -169,6 +169,15 @@ var keyHandlers = {
// If this is a malformed bit of document or in a table;
// just play it safe and insert a <br>.
if ( !block || /^T[HD]$/.test( block.nodeName ) ) {
// Move cursor out of tags if the cursor is at the end of inline tags
parent = range.commonAncestorContainer;
if ( /^T[HD]$/.test( block.nodeName ) ) {
while ( isInline( parent ) && getLength( parent ) === range.endOffset ) {
range.setStartAfter( parent );
range.collapse( true );
parent = range.commonAncestorContainer;
}
}
insertNodeInRange( range, self.createElement( 'BR' ) );
range.collapse( false );
self.setSelection( range );