Fixed new lines in paste data

This commit is contained in:
benweet 2014-06-09 12:58:18 +01:00
parent b2f2734533
commit 4d97ba5f84

View File

@ -239,6 +239,7 @@ define([
} }
undoMgr.saveSelectionState(); undoMgr.saveSelectionState();
} }
var nextTickAdjustScroll = false; var nextTickAdjustScroll = false;
var debouncedSave = utils.debounce(function() { var debouncedSave = utils.debounce(function() {
save(); save();
@ -759,9 +760,18 @@ define([
}, 0); }, 0);
}) })
.on('mouseup', _.bind(selectionMgr.saveSelectionState, selectionMgr, true, false)) .on('mouseup', _.bind(selectionMgr.saveSelectionState, selectionMgr, true, false))
.on('paste', function() { .on('paste', function(evt) {
undoMgr.currentMode = 'paste'; undoMgr.currentMode = 'paste';
adjustCursorPosition(); adjustCursorPosition();
try {
var data = evt.originalEvent.clipboardData.getData("text/plain");
if(data) {
evt.preventDefault();
document.execCommand("insertHTML", false, data);
}
}
catch(e) {
}
}) })
.on('cut', function() { .on('cut', function() {
undoMgr.currentMode = 'cut'; undoMgr.currentMode = 'cut';