mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 15:23:29 -05:00
Wrap LI contents when merging.
This commit is contained in:
parent
ca5c08e4d0
commit
46706db889
3 changed files with 26 additions and 6 deletions
|
@ -507,14 +507,24 @@ function mergeWithBlock ( block, next, range ) {
|
|||
function mergeContainers ( node ) {
|
||||
var prev = node.previousSibling,
|
||||
first = node.firstChild,
|
||||
isListItem = ( node.nodeName === 'LI' );
|
||||
isListItem = ( node.nodeName === 'LI' ),
|
||||
block;
|
||||
|
||||
// Do not merge LIs, unless it only contains a UL
|
||||
if ( isListItem && ( !first || !/^[OU]L$/.test( first.nodeName ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( prev && areAlike( prev, node ) && isContainer( prev ) ) {
|
||||
if ( prev && areAlike( prev, node ) ) {
|
||||
if ( !isContainer( prev ) ) {
|
||||
if ( isListItem ) {
|
||||
block = prev.ownerDocument.createElement( 'div' );
|
||||
block.appendChild( empty( prev ) );
|
||||
prev.appendChild( block );
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
detach( node );
|
||||
prev.appendChild( empty( node ) );
|
||||
if ( first ) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -365,14 +365,24 @@ function mergeWithBlock ( block, next, range ) {
|
|||
function mergeContainers ( node ) {
|
||||
var prev = node.previousSibling,
|
||||
first = node.firstChild,
|
||||
isListItem = ( node.nodeName === 'LI' );
|
||||
isListItem = ( node.nodeName === 'LI' ),
|
||||
block;
|
||||
|
||||
// Do not merge LIs, unless it only contains a UL
|
||||
if ( isListItem && ( !first || !/^[OU]L$/.test( first.nodeName ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( prev && areAlike( prev, node ) && isContainer( prev ) ) {
|
||||
if ( prev && areAlike( prev, node ) ) {
|
||||
if ( !isContainer( prev ) ) {
|
||||
if ( isListItem ) {
|
||||
block = prev.ownerDocument.createElement( 'div' );
|
||||
block.appendChild( empty( prev ) );
|
||||
prev.appendChild( block );
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
detach( node );
|
||||
prev.appendChild( empty( node ) );
|
||||
if ( first ) {
|
||||
|
|
Loading…
Reference in a new issue