From 407d8f74190a911b4e88d57b2880fff385dc5424 Mon Sep 17 00:00:00 2001
From: Gnome Ann <>
Date: Wed, 13 Oct 2021 12:05:15 -0400
Subject: [PATCH] Also apply the enter patch to pasted text
---
static/application.js | 4 ++--
templates/index.html | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/static/application.js b/static/application.js
index 5bbf8d32..9b584508 100644
--- a/static/application.js
+++ b/static/application.js
@@ -758,7 +758,7 @@ function chunkOnTextInput(event) {
// mobile devices, but the other method is also here as
// a fallback
if(document.queryCommandSupported && document.execCommand && document.queryCommandSupported('insertHTML')) {
- document.execCommand('insertHTML', false, event.originalEvent.data.slice(0, -1) + '
|');
+ document.execCommand('insertHTML', false, event.originalEvent.data.slice(0, -1).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\n/g, '
') + '
|');
var t = $('#_EDITOR_SENTINEL_').contents().filter(function() { return this.nodeType === 3; })[0];
} else {
var t = document.createTextNode('|');
@@ -1043,7 +1043,7 @@ function chunkOnPaste(event) {
// paste as plaintext
if(event.originalEvent.clipboardData && document.queryCommandSupported && document.execCommand && document.queryCommandSupported('insertText')) {
event.preventDefault();
- document.execCommand('insertText', false, event.originalEvent.clipboardData.getData('text/plain'));
+ document.execCommand('insertHTML', false, event.originalEvent.clipboardData.getData('text/plain').replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\n/g, '
'));
}
}
diff --git a/templates/index.html b/templates/index.html
index 98b1a8ff..6b774699 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -6,7 +6,7 @@
-
+