Support text composition events that contain line breaks

Using the paste-handler for text that contains new lines
allows the inserted text to correctly create new paragraphs
as necessary.
This commit is contained in:
Philip Peitsch
2014-04-17 19:36:27 +10:00
parent db1dd02731
commit 38cbe0746d
+7 -1
View File
@@ -729,7 +729,13 @@ gui.SessionControllerOptions = function () {
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-compositionend
var input = e.data;
if (input) {
textController.insertText(input);
if (input.indexOf("\n") === -1) {
textController.insertText(input);
} else {
// Multi-line input should be handled as if it was pasted, rather than inserted as one giant
// single string.
session.enqueue(pasteHandler.createPasteOps(input));
}
}
}