mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 15:23:29 -05:00
IE requires handlers on before(cut|paste) events.
This commit is contained in:
parent
3b09cbf703
commit
75109c404e
2 changed files with 9 additions and 4 deletions
File diff suppressed because one or more lines are too long
|
@ -21,7 +21,8 @@ document.addEventListener( 'DOMContentLoaded', function () {
|
||||||
body = doc.body;
|
body = doc.body;
|
||||||
|
|
||||||
var isOpera = !!win.opera;
|
var isOpera = !!win.opera;
|
||||||
var useTextFixer = isOpera || !!win.ie;
|
var isIE = !!win.ie;
|
||||||
|
var useTextFixer = isOpera || isOpera;
|
||||||
|
|
||||||
// --- DOM Sugar ---
|
// --- DOM Sugar ---
|
||||||
|
|
||||||
|
@ -959,14 +960,18 @@ document.addEventListener( 'DOMContentLoaded', function () {
|
||||||
|
|
||||||
// --- Cut and Paste ---
|
// --- Cut and Paste ---
|
||||||
|
|
||||||
doc.addEventListener( 'cut', function () {
|
doc.addEventListener( isIE ? 'beforecut' : 'cut', function () {
|
||||||
|
// Save undo checkpoint
|
||||||
|
var range = getSelection();
|
||||||
|
recordUndoState( range );
|
||||||
|
getRangeAndRemoveBookmark( range );
|
||||||
// If all content removed, ensure div at start of body.
|
// If all content removed, ensure div at start of body.
|
||||||
setTimeout( function () {
|
setTimeout( function () {
|
||||||
body.fixCursor();
|
body.fixCursor();
|
||||||
}, 0 );
|
}, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
doc.addEventListener( 'paste', function () {
|
doc.addEventListener( isIE ? 'beforepaste' : 'paste', function () {
|
||||||
var range = getSelection(),
|
var range = getSelection(),
|
||||||
startContainer = range.startContainer,
|
startContainer = range.startContainer,
|
||||||
startOffset = range.startOffset,
|
startOffset = range.startOffset,
|
||||||
|
|
Loading…
Reference in a new issue