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

Merge pull request #77 from mkoryak-master

This commit is contained in:
Neil Jenkins 2015-05-03 13:18:45 +07:00
commit 96bdda13ca
4 changed files with 28 additions and 20 deletions

View file

@ -1,4 +1,4 @@
/* Copyright © 2011-2013 by Neil Jenkins. MIT Licensed. */ /* Copyright © 2011-2015 by Neil Jenkins. MIT Licensed. */
( function ( doc, undefined ) { ( function ( doc, undefined ) {
@ -3082,21 +3082,25 @@ proto._onPaste = function ( event ) {
removeEmptyInlines( frag ); removeEmptyInlines( frag );
var node = frag, var node = frag,
doPaste = true; doPaste = true,
event = {
fragment: frag,
preventDefault: function () {
doPaste = false;
},
isDefaultPrevented: function () {
return !doPaste;
}
};
while ( node = getNextBlock( node ) ) { while ( node = getNextBlock( node ) ) {
fixCursor( node ); fixCursor( node );
} }
self.fireEvent( 'willPaste', { self.fireEvent( 'willPaste', event );
fragment: frag,
preventDefault: function () {
doPaste = false;
}
});
// Insert pasted data // Insert pasted data
if ( doPaste ) { if ( doPaste ) {
insertTreeFragmentIntoRange( range, frag ); insertTreeFragmentIntoRange( range, event.fragment );
if ( !canObserveMutations ) { if ( !canObserveMutations ) {
self._docWasChanged(); self._docWasChanged();
} }

File diff suppressed because one or more lines are too long

View file

@ -1658,21 +1658,25 @@ proto._onPaste = function ( event ) {
removeEmptyInlines( frag ); removeEmptyInlines( frag );
var node = frag, var node = frag,
doPaste = true; doPaste = true,
event = {
fragment: frag,
preventDefault: function () {
doPaste = false;
},
isDefaultPrevented: function () {
return !doPaste;
}
};
while ( node = getNextBlock( node ) ) { while ( node = getNextBlock( node ) ) {
fixCursor( node ); fixCursor( node );
} }
self.fireEvent( 'willPaste', { self.fireEvent( 'willPaste', event );
fragment: frag,
preventDefault: function () {
doPaste = false;
}
});
// Insert pasted data // Insert pasted data
if ( doPaste ) { if ( doPaste ) {
insertTreeFragmentIntoRange( range, frag ); insertTreeFragmentIntoRange( range, event.fragment );
if ( !canObserveMutations ) { if ( !canObserveMutations ) {
self._docWasChanged(); self._docWasChanged();
} }

View file

@ -1,4 +1,4 @@
/* Copyright © 2011-2013 by Neil Jenkins. MIT Licensed. */ /* Copyright © 2011-2015 by Neil Jenkins. MIT Licensed. */
/*jshint ignore:start */ /*jshint ignore:start */
( function ( doc, undefined ) { ( function ( doc, undefined ) {