mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Modifications for https://github.com/the-djmaze/snappymail/issues/15
This commit is contained in:
parent
35b531caac
commit
a1a413dca2
1 changed files with 19 additions and 22 deletions
41
vendors/squire/build/squire-raw.js
vendored
41
vendors/squire/build/squire-raw.js
vendored
|
|
@ -166,39 +166,36 @@ const
|
||||||
},
|
},
|
||||||
|
|
||||||
getPath = ( node, root, config ) => {
|
getPath = ( node, root, config ) => {
|
||||||
let path = '';
|
let path = '', classNames, styleNames;
|
||||||
let id, className, classNames, dir, styleNames;
|
|
||||||
if ( node && node !== root ) {
|
if ( node && node !== root ) {
|
||||||
path = getPath( node.parentNode, root, config );
|
path = getPath( node.parentNode, root, config );
|
||||||
if ( node.nodeType === ELEMENT_NODE ) {
|
if ( node.nodeType === ELEMENT_NODE ) {
|
||||||
path += ( path ? '>' : '' ) + node.nodeName;
|
path += ( path ? '>' : '' ) + node.nodeName;
|
||||||
if ( id = node.id ) {
|
if ( node.id ) {
|
||||||
path += '#' + id;
|
path += '#' + node.id;
|
||||||
}
|
}
|
||||||
if ( className = node.className.trim() ) {
|
if ( node.classList.length ) {
|
||||||
classNames = className.split( /\s+/ );
|
classNames = [...node.classList].sort();
|
||||||
classNames.sort();
|
path += '.' + classNames.join( '.' );
|
||||||
path += '.';
|
|
||||||
path += classNames.join( '.' );
|
|
||||||
}
|
}
|
||||||
if ( dir = node.dir ) {
|
if ( node.dir ) {
|
||||||
path += '[dir=' + dir + ']';
|
path += '[dir=' + node.dir + ']';
|
||||||
}
|
}
|
||||||
if ( classNames ) {
|
if ( classNames ) {
|
||||||
styleNames = config.classNames;
|
styleNames = config.classNames;
|
||||||
if ( indexOf( classNames, styleNames.highlight ) > -1 ) {
|
if ( classNames.includes( styleNames.highlight ) ) {
|
||||||
path += '[backgroundColor=' +
|
path += '[backgroundColor=' +
|
||||||
node.style.backgroundColor.replace( / /g,'' ) + ']';
|
node.style.backgroundColor.replace( / /g,'' ) + ']';
|
||||||
}
|
}
|
||||||
if ( indexOf( classNames, styleNames.colour ) > -1 ) {
|
if ( classNames.includes( styleNames.colour ) ) {
|
||||||
path += '[color=' +
|
path += '[color=' +
|
||||||
node.style.color.replace( / /g,'' ) + ']';
|
node.style.color.replace( / /g,'' ) + ']';
|
||||||
}
|
}
|
||||||
if ( indexOf( classNames, styleNames.fontFamily ) > -1 ) {
|
if ( classNames.includes( styleNames.fontFamily ) ) {
|
||||||
path += '[fontFamily=' +
|
path += '[fontFamily=' +
|
||||||
node.style.fontFamily.replace( / /g,'' ) + ']';
|
node.style.fontFamily.replace( / /g,'' ) + ']';
|
||||||
}
|
}
|
||||||
if ( indexOf( classNames, styleNames.fontSize ) > -1 ) {
|
if ( classNames.includes( styleNames.fontSize ) ) {
|
||||||
path += '[fontSize=' + node.style.fontSize + ']';
|
path += '[fontSize=' + node.style.fontSize + ']';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -550,7 +547,7 @@ const
|
||||||
}
|
}
|
||||||
} else if ( isListItem ) {
|
} else if ( isListItem ) {
|
||||||
prev = createElement( doc, 'DIV' );
|
prev = createElement( doc, 'DIV' );
|
||||||
first.before( prev );
|
node.insertBefore( prev, first );
|
||||||
fixCursor( prev, root );
|
fixCursor( prev, root );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -622,7 +619,7 @@ const
|
||||||
if ( startOffset === childCount ) {
|
if ( startOffset === childCount ) {
|
||||||
startContainer.append( node );
|
startContainer.append( node );
|
||||||
} else {
|
} else {
|
||||||
children[ startOffset ].before( node );
|
startContainer.insertBefore( node, children[ startOffset ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( startContainer === endContainer ) {
|
if ( startContainer === endContainer ) {
|
||||||
|
|
@ -824,7 +821,7 @@ const
|
||||||
nodeBeforeSplit = nodeAfterSplit ?
|
nodeBeforeSplit = nodeAfterSplit ?
|
||||||
nodeAfterSplit.previousSibling :
|
nodeAfterSplit.previousSibling :
|
||||||
stopPoint.lastChild;
|
stopPoint.lastChild;
|
||||||
nodeAfterSplit.before( frag );
|
stopPoint.insertBefore( frag, nodeAfterSplit );
|
||||||
if ( nodeAfterSplit ) {
|
if ( nodeAfterSplit ) {
|
||||||
range.setEndBefore( nodeAfterSplit );
|
range.setEndBefore( nodeAfterSplit );
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -3924,7 +3921,7 @@ let addLinks = ( frag, root, self ) => {
|
||||||
endIndex = index + match[0].length;
|
endIndex = index + match[0].length;
|
||||||
if ( index ) {
|
if ( index ) {
|
||||||
child = doc.createTextNode( data.slice( 0, index ) );
|
child = doc.createTextNode( data.slice( 0, index ) );
|
||||||
node.before( child );
|
parent.insertBefore( child, node );
|
||||||
}
|
}
|
||||||
child = self.createElement( 'A', mergeObjects({
|
child = self.createElement( 'A', mergeObjects({
|
||||||
href: match[1] ?
|
href: match[1] ?
|
||||||
|
|
@ -3934,7 +3931,7 @@ let addLinks = ( frag, root, self ) => {
|
||||||
'mailto:' + match[0]
|
'mailto:' + match[0]
|
||||||
}, defaultAttributes, false ));
|
}, defaultAttributes, false ));
|
||||||
child.textContent = data.slice( index, endIndex );
|
child.textContent = data.slice( index, endIndex );
|
||||||
node.before( child );
|
parent.insertBefore( child, node );
|
||||||
node.data = data = data.slice( endIndex );
|
node.data = data = data.slice( endIndex );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4045,7 +4042,7 @@ proto.insertPlainText = function ( plainText, isPaste ) {
|
||||||
let text, event;
|
let text, event;
|
||||||
if ( !node || node.nodeType !== TEXT_NODE ) {
|
if ( !node || node.nodeType !== TEXT_NODE ) {
|
||||||
text = doc.createTextNode( '' );
|
text = doc.createTextNode( '' );
|
||||||
node.childNodes[ offset ].before( text );
|
node && node.childNodes[ offset ].before( text );
|
||||||
node = text;
|
node = text;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -4450,7 +4447,7 @@ proto.removeAllFormatting = function ( range ) {
|
||||||
// Restore selection
|
// Restore selection
|
||||||
childNodes = stopNode.childNodes;
|
childNodes = stopNode.childNodes;
|
||||||
if ( nodeInSplit ) {
|
if ( nodeInSplit ) {
|
||||||
nodeAfterSplit.before( cleanNodes );
|
stopNode.insertBefore( cleanNodes, nodeAfterSplit );
|
||||||
startOffset = indexOf( childNodes, nodeInSplit );
|
startOffset = indexOf( childNodes, nodeInSplit );
|
||||||
endOffset = indexOf( childNodes, nextNode ) + 1;
|
endOffset = indexOf( childNodes, nextNode ) + 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue