mirror of
https://github.com/webodf/WebODF.git
synced 2026-12-01 16:56:05 +01:00
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:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user