mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 15:23:29 -05:00
Update to latest release
This commit is contained in:
parent
bfbec71507
commit
5d0731836c
2 changed files with 19 additions and 10 deletions
|
@ -1770,7 +1770,7 @@ var styleToSemantic = {
|
|||
}
|
||||
},
|
||||
fontWeight: {
|
||||
regexp: /^bold/i,
|
||||
regexp: /^bold|^700/i,
|
||||
replace: function ( doc ) {
|
||||
return createElement( doc, 'B' );
|
||||
}
|
||||
|
@ -1918,7 +1918,7 @@ var stylesRewriters = {
|
|||
}
|
||||
};
|
||||
|
||||
var allowedBlock = /^(?:A(?:DDRESS|RTICLE|SIDE|UDIO)|BLOCKQUOTE|CAPTION|D(?:[DLT]|IV)|F(?:IGURE|IGCAPTION|OOTER)|H[1-6]|HEADER|L(?:ABEL|EGEND|I)|O(?:L|UTPUT)|P(?:RE)?|SECTION|T(?:ABLE|BODY|D|FOOT|H|HEAD|R)|UL)$/;
|
||||
var allowedBlock = /^(?:A(?:DDRESS|RTICLE|SIDE|UDIO)|BLOCKQUOTE|CAPTION|D(?:[DLT]|IV)|F(?:IGURE|IGCAPTION|OOTER)|H[1-6]|HEADER|L(?:ABEL|EGEND|I)|O(?:L|UTPUT)|P(?:RE)?|SECTION|T(?:ABLE|BODY|D|FOOT|H|HEAD|R)|COL(?:GROUP)?|UL)$/;
|
||||
|
||||
var blacklist = /^(?:HEAD|META|STYLE)/;
|
||||
|
||||
|
@ -2096,6 +2096,19 @@ var cleanupBRs = function ( node, root ) {
|
|||
}
|
||||
};
|
||||
|
||||
// The (non-standard but supported enough) innerText property is based on the
|
||||
// render tree in Firefox and possibly other browsers, so we must insert the
|
||||
// DOM node into the document to ensure the text part is correct.
|
||||
var setClipboardData = function ( clipboardData, node ) {
|
||||
var body = node.ownerDocument.body;
|
||||
node.setAttribute( 'style',
|
||||
'position:fixed;overflow:hidden;bottom:100%;right:100%;' );
|
||||
body.appendChild( node );
|
||||
clipboardData.setData( 'text/html', node.innerHTML );
|
||||
clipboardData.setData( 'text/plain', node.innerText || node.textContent );
|
||||
body.removeChild( node );
|
||||
};
|
||||
|
||||
var onCut = function ( event ) {
|
||||
var clipboardData = event.clipboardData;
|
||||
var range = this.getSelection();
|
||||
|
@ -2112,9 +2125,7 @@ var onCut = function ( event ) {
|
|||
if ( !isEdge && !isIOS && clipboardData ) {
|
||||
moveRangeBoundariesUpTree( range, root );
|
||||
node.appendChild( deleteContentsOfRange( range, root ) );
|
||||
clipboardData.setData( 'text/html', node.innerHTML );
|
||||
clipboardData.setData( 'text/plain',
|
||||
node.innerText || node.textContent );
|
||||
setClipboardData( clipboardData, node );
|
||||
event.preventDefault();
|
||||
} else {
|
||||
setTimeout( function () {
|
||||
|
@ -2160,9 +2171,7 @@ var onCopy = function ( event ) {
|
|||
}
|
||||
node.appendChild( contents );
|
||||
|
||||
clipboardData.setData( 'text/html', node.innerHTML );
|
||||
clipboardData.setData( 'text/plain',
|
||||
node.innerText || node.textContent );
|
||||
setClipboardData( clipboardData, node );
|
||||
event.preventDefault();
|
||||
}
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue