diff options
| author | qsm-odoo <qsm@odoo.com> | 2017-12-18 11:27:25 +0100 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2017-12-18 16:10:33 +0100 |
| commit | b1b13dbeede54d3473a0b80e6a8dc21bedfdc5c9 (patch) | |
| tree | 5fdf0ccc3b7f99590048933aade828a644298564 /addons/web_editor/static/src/js | |
| parent | 34ed42f16d4718ff97595db18505cebbc0dc6b40 (diff) | |
[FIX] web_editor: revert copy/paste feature of the editor
The feature was introduced and fixed by following commits:
- https://github.com/odoo/odoo/commit/906875fc78cb80f6c3d5f1f14f997008cd406473
- https://github.com/odoo/odoo/commit/76be5eed449c78eaf0b4208c381169132492ab4a
- https://github.com/odoo/odoo/commit/7401807510a103374fa8eb524ae5a5698ae21a39
The feature is however still buggy in lots of cases as it is a bad
heuristic that cannot handle simple pasting cases. The feature was
initially introduced to allow pasting PDF content without having to
remove all the unwanted line breaks this induces. As this feature is
not that important and introduced more bugs than it solved, the feature
is deleted by this commit. If we want that feature again, maybe it is
worth considering an "Import from PDF" button or something like that.
See https://github.com/odoo/odoo/issues/15665
Diffstat (limited to 'addons/web_editor/static/src/js')
| -rw-r--r-- | addons/web_editor/static/src/js/summernote.js | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/addons/web_editor/static/src/js/summernote.js b/addons/web_editor/static/src/js/summernote.js index af5e0112e38..e439f52824a 100644 --- a/addons/web_editor/static/src/js/summernote.js +++ b/addons/web_editor/static/src/js/summernote.js @@ -2370,26 +2370,6 @@ eventHandler.modules.popover.update = function ($popover, oStyle, isAirMode) { } }; -// override summernote clipboard functionality -eventHandler.modules.clipboard.attach = function(layoutInfo) { - var $editable = layoutInfo.editable(); - $editable.on('paste', function(e) { - var clipboardData = ((e.originalEvent || e).clipboardData || window.clipboardData); - // Change nothing if pasting html (copy from text editor / web / ...) or - // if clipboardData is not available (IE / ...) - if (clipboardData && clipboardData.types && clipboardData.types.length === 1 && clipboardData.types[0] === "text/plain") { - e.preventDefault(); - $editable.data('NoteHistory').recordUndo($editable); // FIXME - var pastedText = clipboardData.getData("text/plain"); - // Try removing linebreaks which are not really linebreaks (in a PDF, - // when a sentence goes over the next line, copying it considers it - // a linebreak for example). - var formattedText = pastedText.replace(/([\w-])\r?\n([\w-])/g, "$1 $2").trim(); - document.execCommand("insertText", false, formattedText); - } - }); -}; - ////////////////////////////////////////////////////////////////////////////////////////////////////////// var fn_attach = eventHandler.attach; |
