summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/rte.summernote.js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2016-09-02 09:40:54 +0100
committerqsm-odoo <qsm@odoo.com>2016-09-02 10:04:58 +0100
commitc227b8fd88e0ed635a8e807501b559b46fee7786 (patch)
tree5f837066c5f7faa20efd233915ef4bb487c11a2a /addons/web_editor/static/src/js/rte.summernote.js
parent8c0c308eca992812ab90e543a40826c31e22959a (diff)
[FIX] web_editor: remove some defaults in text edition
* On firefox, you had to click twice on a link to be able to start typing text * When selecting text which contained a <br/>, you were not able to replacing it correctly (you had to click again before starting typing) * When replacing a whole paragraph content which was below a title, the text was not replaced and you had to click again and the title transformed into a paragraph. * ...
Diffstat (limited to 'addons/web_editor/static/src/js/rte.summernote.js')
-rw-r--r--addons/web_editor/static/src/js/rte.summernote.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/addons/web_editor/static/src/js/rte.summernote.js b/addons/web_editor/static/src/js/rte.summernote.js
index 9bcbdb49ead..11b2dea7d81 100644
--- a/addons/web_editor/static/src/js/rte.summernote.js
+++ b/addons/web_editor/static/src/js/rte.summernote.js
@@ -405,18 +405,22 @@ $.summernote.pluginEvents.alt = function (event, editor, layoutInfo, sorted) {
//////////////////////////////////////////////////////////////////////////////////////////////////////////
-var fn_is_void = dom.isVoid;
+var fn_is_void = dom.isVoid || function () {};
dom.isVoid = function (node) {
return fn_is_void(node) || dom.isImgFont(node) || (node && node.className && node.className.match(/(^|\s)media_iframe_video(\s|$)/i));
};
+var fn_is_img = dom.isImg || function () {};
dom.isImg = function (node) {
- return dom.isImgFont(node) || (node && (node.nodeName === "IMG" || (node.className && node.className.match(/(^|\s)(media_iframe_video|o_image)(\s|$)/i)) ));
+ return fn_is_img(node) || dom.isImgFont(node) || (node && (node.nodeName === "IMG" || (node.className && node.className.match(/(^|\s)(media_iframe_video|o_image)(\s|$)/i)) ));
};
+var fn_is_forbidden_node = dom.isForbiddenNode || function () {};
dom.isForbiddenNode = function (node) {
- return $(node).is(".media_iframe_video, .fa, img");
+ return fn_is_forbidden_node(node) || $(node).is(".media_iframe_video");
};
-
+var fn_is_img_font = dom.isImgFont || function () {};
dom.isImgFont = function (node) {
+ if (fn_is_img_font(node)) return true;
+
var nodeName = node && node.nodeName.toUpperCase();
var className = (node && node.className || "");
if (node && (nodeName === "SPAN" || nodeName === "I") && className.length) {
@@ -429,17 +433,16 @@ dom.isImgFont = function (node) {
}
return false;
};
-// re-overwrite font to include theme icons
-var isFont = dom.isFont;
+var fn_is_font = dom.isFont; // re-overwrite font to include theme icons
dom.isFont = function (node) {
- return dom.isImgFont(node) || isFont(node);
+ return fn_is_font(node) || dom.isImgFont(node);
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////
var fn_visible = $.summernote.pluginEvents.visible;
$.summernote.pluginEvents.visible = function (event, editor, layoutInfo) {
- var res = fn_visible.call(this, event, editor, layoutInfo);
+ var res = fn_visible.apply(this, arguments);
var rng = range.create();
if(!rng) return res;
var $node = $(dom.node(rng.sc));