summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorDavid Monjoie <dmo@odoo.com>2019-08-07 09:04:35 +0000
committerDavid Monjoie <dmo@odoo.com>2019-08-07 10:09:28 +0000
commitd0e80593304415b605bc28f00239a391604a4fcf (patch)
tree5fe10b66a796ffadb0ef8dd575656305abc5eaa5 /addons/web_editor/static/src
parent5578b98ad7dcbee97cb2eaea29f91daae4914060 (diff)
[FIX] web_editor: disable custom handling for Safari MacOS
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js11
-rw-r--r--addons/web_editor/static/src/js/wysiwyg/plugin/text.js5
2 files changed, 13 insertions, 3 deletions
diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js b/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js
index 534fdcab523..141d4c1bf2e 100644
--- a/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js
+++ b/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js
@@ -16,9 +16,9 @@ var keycode = ({
'46': 'DELETE',
});
+var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
var iPhone = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
-
var KeyboardPlugin = AbstractPlugin.extend({
events: iPhone ?
{
@@ -1203,8 +1203,10 @@ var KeyboardPlugin = AbstractPlugin.extend({
*/
_onKeyPress: function (e) {
console.log(e.originalEvent);
- e.preventDefault();
- this.context.invoke('HelperPlugin.insertTextInline', e.key);
+ if (!isSafari || iPhone) {
+ e.preventDefault();
+ this.context.invoke('HelperPlugin.insertTextInline', e.key);
+ }
},
/**
* Handle char input.
@@ -1213,6 +1215,9 @@ var KeyboardPlugin = AbstractPlugin.extend({
* @param {jQueryEvent} e
*/
_onTextInput: function (e) {
+ if (isSafari && !iPhone) {
+ return;
+ }
e.originalEvent.preventDefault();
var text = e.originalEvent.data;
diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/text.js b/addons/web_editor/static/src/js/wysiwyg/plugin/text.js
index 5337661fa76..2b7d10d02fd 100644
--- a/addons/web_editor/static/src/js/wysiwyg/plugin/text.js
+++ b/addons/web_editor/static/src/js/wysiwyg/plugin/text.js
@@ -766,6 +766,11 @@ var TextPlugin = AbstractPlugin.extend({
* @param {jQueryEvent} e
*/
_onPaste: function (se, e) {
+ var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
+ var iPhone = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
+ if (isSafari && !iPhone) {
+ return;
+ }
se.preventDefault();
se.stopImmediatePropagation();
e.preventDefault();