summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-06-14 17:29:56 +0200
committerChristophe Simonis <chs@odoo.com>2018-06-14 17:29:56 +0200
commit23a1bce2a9c3a7a9cbfbb4c554ebacb337d9470e (patch)
treea547ed9fafa293d2500f079aa91c045c22a8f396 /addons
parent84acd427b8adc6f2c3dc3767ca8ee8f99e4ccbd7 (diff)
parent90165e2d96ac27dd1dbb2e367d47b8a38b7aea40 (diff)
[MERGE] forward port branch 9.0 up to 90165e2d96a
Diffstat (limited to 'addons')
-rw-r--r--addons/web_editor/static/lib/summernote/src/js/module/Editor.js4
-rw-r--r--addons/web_editor/static/src/js/widgets.js5
-rw-r--r--addons/website/models/ir_http.py6
3 files changed, 11 insertions, 4 deletions
diff --git a/addons/web_editor/static/lib/summernote/src/js/module/Editor.js b/addons/web_editor/static/lib/summernote/src/js/module/Editor.js
index b7ba30bfcd1..99947c346cf 100644
--- a/addons/web_editor/static/lib/summernote/src/js/module/Editor.js
+++ b/addons/web_editor/static/lib/summernote/src/js/module/Editor.js
@@ -628,9 +628,9 @@ define([
}
var anchors = [];
- // ODOO: adding this branch to modify existing anchor
+ // ODOO: adding this branch to modify existing anchor if it fully contains the range
var ancestor_anchor = dom.ancestor(rng.sc, dom.isAnchor);
- if(ancestor_anchor) {
+ if(ancestor_anchor && ancestor_anchor === dom.ancestor(rng.ec, dom.isAnchor)) {
anchors.push($(ancestor_anchor).html(linkText).get(0));
} else if (isTextChanged) {
// Create a new link when text changed.
diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js
index 005d085fec8..dc347c61690 100644
--- a/addons/web_editor/static/src/js/widgets.js
+++ b/addons/web_editor/static/src/js/widgets.js
@@ -320,8 +320,7 @@ var ImageDialog = Widget.extend({
var img = this.images[0];
if (!img) {
- var id = this.$(".existing-attachments [data-src]:first").data('id');
- img = _.find(this.images, function (img) { return img.id === id;});
+ return this.media;
}
var media;
@@ -1023,6 +1022,8 @@ var LinkDialog = Dialog.extend({
if (dom.ancestor(nodes[i], dom.isImg)) {
this.data.images.push(dom.ancestor(nodes[i], dom.isImg));
text += '[IMG]';
+ } else if (!is_link && nodes[i].nodeType === 1) {
+ // just use text nodes from listBetween
} else if (!is_link && i===0) {
text += nodes[i].textContent.slice(so, Infinity);
} else if (!is_link && i===nodes.length-1) {
diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py
index e04b486a54a..8149a23b406 100644
--- a/addons/website/models/ir_http.py
+++ b/addons/website/models/ir_http.py
@@ -6,6 +6,7 @@ import os
import re
import traceback
+import pytz
import werkzeug
import werkzeug.routing
import werkzeug.utils
@@ -204,6 +205,11 @@ class Http(models.AbstractModel):
context['edit_translations'] = False
if not context.get('tz'):
context['tz'] = request.session.get('geoip', {}).get('time_zone')
+ try:
+ pytz.timezone(context['tz'] or '')
+ except pytz.UnknownTimeZoneError:
+ context.pop('tz')
+
# bind modified context
request.context = context
request.website = request.website.with_context(context)