mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-03 05:00:13 -05:00
parent
52b92abe47
commit
bb593e879a
3 changed files with 15 additions and 1 deletions
|
@ -1448,6 +1448,13 @@ var keyHandlers = {
|
||||||
// If this is a malformed bit of document or in a table;
|
// If this is a malformed bit of document or in a table;
|
||||||
// just play it safe and insert a <br>.
|
// just play it safe and insert a <br>.
|
||||||
if ( !block || /^T[HD]$/.test( block.nodeName ) ) {
|
if ( !block || /^T[HD]$/.test( block.nodeName ) ) {
|
||||||
|
// If inside an <a>, move focus out
|
||||||
|
parent = getNearest( range.endContainer, root, 'A' );
|
||||||
|
if ( parent ) {
|
||||||
|
parent = parent.parentNode;
|
||||||
|
moveRangeBoundariesUpTree( range, parent, parent, root );
|
||||||
|
range.collapse( false );
|
||||||
|
}
|
||||||
insertNodeInRange( range, self.createElement( 'BR' ) );
|
insertNodeInRange( range, self.createElement( 'BR' ) );
|
||||||
range.collapse( false );
|
range.collapse( false );
|
||||||
self.setSelection( range );
|
self.setSelection( range );
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -169,6 +169,13 @@ var keyHandlers = {
|
||||||
// If this is a malformed bit of document or in a table;
|
// If this is a malformed bit of document or in a table;
|
||||||
// just play it safe and insert a <br>.
|
// just play it safe and insert a <br>.
|
||||||
if ( !block || /^T[HD]$/.test( block.nodeName ) ) {
|
if ( !block || /^T[HD]$/.test( block.nodeName ) ) {
|
||||||
|
// If inside an <a>, move focus out
|
||||||
|
parent = getNearest( range.endContainer, root, 'A' );
|
||||||
|
if ( parent ) {
|
||||||
|
parent = parent.parentNode;
|
||||||
|
moveRangeBoundariesUpTree( range, parent, parent, root );
|
||||||
|
range.collapse( false );
|
||||||
|
}
|
||||||
insertNodeInRange( range, self.createElement( 'BR' ) );
|
insertNodeInRange( range, self.createElement( 'BR' ) );
|
||||||
range.collapse( false );
|
range.collapse( false );
|
||||||
self.setSelection( range );
|
self.setSelection( range );
|
||||||
|
|
Loading…
Reference in a new issue