0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 07:13:08 -05:00

Update to latest squire build

This commit is contained in:
Neil Jenkins 2016-05-26 13:10:38 +10:00
parent f2198ef2d0
commit 0928d5f8ab
2 changed files with 22 additions and 8 deletions

View file

@ -3837,9 +3837,23 @@ var addLinks = function ( frag, root, self ) {
// insertTreeFragmentIntoRange will delete the selection so that it is replaced
// by the html being inserted.
proto.insertHTML = function ( html, isPaste ) {
var range = this.getSelection(),
frag = this._doc.createDocumentFragment(),
div = this.createElement( 'DIV' );
var range = this.getSelection();
var frag = this._doc.createDocumentFragment();
var div = this.createElement( 'DIV' );
var startFragmentIndex, endFragmentIndex;
var root, node, event;
// Edge doesn't just copy the fragment, but includes the surrounding guff
// including the full <head> of the page. Need to strip this out. In the
// future should probably run all pastes through DOMPurify, but this will
// do for now
if ( isPaste ) {
startFragmentIndex = html.indexOf( '<!--StartFragment-->' );
endFragmentIndex = html.lastIndexOf( '<!--EndFragment-->' );
if ( startFragmentIndex > -1 && endFragmentIndex > -1 ) {
html = html.slice( startFragmentIndex + 20, endFragmentIndex );
}
}
// Parse HTML into DOM tree
div.innerHTML = html;
@ -3849,9 +3863,9 @@ proto.insertHTML = function ( html, isPaste ) {
this.saveUndoState( range );
try {
var root = this._root;
var node = frag;
var event = {
root = this._root;
node = frag;
event = {
fragment: frag,
preventDefault: function () {
this.defaultPrevented = true;

File diff suppressed because one or more lines are too long