0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Fix converting OL <-> UL

This commit is contained in:
Neil Jenkins 2016-10-19 14:44:39 +11:00
parent 8e843a1afc
commit e517f1505b
3 changed files with 14 additions and 8 deletions

View file

@ -3715,8 +3715,11 @@ var makeList = function ( self, frag, type ) {
listItemAttrs = tagAttributes.li; listItemAttrs = tagAttributes.li;
while ( node = walker.nextNode() ) { while ( node = walker.nextNode() ) {
tag = node.parentNode.nodeName; if ( node.parentNode.nodeName === 'LI' ) {
if ( tag !== 'LI' ) { node = node.parentNode;
walker.currentNode = node.lastChild;
}
if ( node.nodeName !== 'LI' ) {
newLi = self.createElement( 'LI', listItemAttrs ); newLi = self.createElement( 'LI', listItemAttrs );
if ( node.dir ) { if ( node.dir ) {
newLi.dir = node.dir; newLi.dir = node.dir;
@ -3739,7 +3742,7 @@ var makeList = function ( self, frag, type ) {
newLi.appendChild( empty( node ) ); newLi.appendChild( empty( node ) );
walker.currentNode = newLi; walker.currentNode = newLi;
} else { } else {
node = node.parentNode.parentNode; node = node.parentNode;
tag = node.nodeName; tag = node.nodeName;
if ( tag !== type && ( /^[OU]L$/.test( tag ) ) ) { if ( tag !== type && ( /^[OU]L$/.test( tag ) ) ) {
replaceWith( node, replaceWith( node,

File diff suppressed because one or more lines are too long

View file

@ -1360,8 +1360,11 @@ var makeList = function ( self, frag, type ) {
listItemAttrs = tagAttributes.li; listItemAttrs = tagAttributes.li;
while ( node = walker.nextNode() ) { while ( node = walker.nextNode() ) {
tag = node.parentNode.nodeName; if ( node.parentNode.nodeName === 'LI' ) {
if ( tag !== 'LI' ) { node = node.parentNode;
walker.currentNode = node.lastChild;
}
if ( node.nodeName !== 'LI' ) {
newLi = self.createElement( 'LI', listItemAttrs ); newLi = self.createElement( 'LI', listItemAttrs );
if ( node.dir ) { if ( node.dir ) {
newLi.dir = node.dir; newLi.dir = node.dir;
@ -1384,7 +1387,7 @@ var makeList = function ( self, frag, type ) {
newLi.appendChild( empty( node ) ); newLi.appendChild( empty( node ) );
walker.currentNode = newLi; walker.currentNode = newLi;
} else { } else {
node = node.parentNode.parentNode; node = node.parentNode;
tag = node.nodeName; tag = node.nodeName;
if ( tag !== type && ( /^[OU]L$/.test( tag ) ) ) { if ( tag !== type && ( /^[OU]L$/.test( tag ) ) ) {
replaceWith( node, replaceWith( node,