mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-03 05:00:13 -05:00
parent
7ecf75f246
commit
6deae3c188
3 changed files with 42 additions and 14 deletions
|
@ -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
|
@ -1609,9 +1609,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;
|
||||
|
@ -1621,9 +1635,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;
|
||||
|
|
Loading…
Reference in a new issue