summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/summernote.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-11-02 17:56:37 +0100
committerChristophe Simonis <chs@odoo.com>2016-11-02 17:56:37 +0100
commitab9852331589ac344d9d8143ff402be0b9d4c601 (patch)
tree6b0ac85d91cf0346ab48cce298adea4ca256609f /addons/web_editor/static/src/js/summernote.js
parent2948aacd9e09543aba17e698d70840166fa7ef74 (diff)
parent0ca99ffc1f675d194c013c1d9e3455e7c0379c71 (diff)
[MERGE] forward port branch saas-12 up to 0ca99ff
Diffstat (limited to 'addons/web_editor/static/src/js/summernote.js')
-rw-r--r--addons/web_editor/static/src/js/summernote.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/addons/web_editor/static/src/js/summernote.js b/addons/web_editor/static/src/js/summernote.js
index 101c3463e6e..28bfe83a345 100644
--- a/addons/web_editor/static/src/js/summernote.js
+++ b/addons/web_editor/static/src/js/summernote.js
@@ -2302,13 +2302,16 @@ eventHandler.modules.popover.update = function ($popover, oStyle, isAirMode) {
}
};
-options.onPaste = function (e) {
- e.preventDefault(); // FIXME this does not work with our custom out-dated summernote.
- document.execCommand("undo"); // FIXME ... so use this hack until we decide to do something about it.
-
- var pastedText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text');
- var formattedText = pastedText.replace(/([^.!?:;])\r?\n/g, "$1").trim(); // Remove linebreaks which are not at the end of a sentence
- document.execCommand("insertText", false, formattedText);
+// override summernote clipboard functionality
+eventHandler.modules.clipboard.attach = function(layoutInfo) {
+ var $editable = layoutInfo.editable();
+ $editable.on('paste', function(e) {
+ e.preventDefault();
+ $editable.data('NoteHistory').recordUndo($editable);
+ var pastedText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text');
+ var formattedText = pastedText.replace(/([^.!?:;])\r?\n/g, "$1").trim(); // Remove linebreaks which are not at the end of a sentence
+ document.execCommand("insertText", false, formattedText);
+ });
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////