summaryrefslogtreecommitdiff
path: root/addons/web_editor
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-09-22 14:23:07 +0200
committerChristophe Simonis <chs@odoo.com>2016-09-22 14:23:07 +0200
commitb1b700adb1f26bb43e8f4b77b85f969a4b52d36c (patch)
treefd1febbefe6cdb41fb2a063fec4af3718860b9a9 /addons/web_editor
parent5a0a29b5285ea8f18716f936d58960b9b5c0f0d9 (diff)
parent6854887ade204c635fb99a16275f7e0ca664697a (diff)
[MERGE] forward port branch saas-11 up to 6854887
Diffstat (limited to 'addons/web_editor')
-rw-r--r--addons/web_editor/static/lib/summernote/src/js/module/Editor.js4
-rw-r--r--addons/web_editor/static/src/js/rte.js2
-rw-r--r--addons/web_editor/static/src/js/widgets.js16
-rw-r--r--addons/web_editor/static/src/less/web_editor.ui.less2
-rw-r--r--addons/web_editor/static/src/xml/editor.xml2
5 files changed, 18 insertions, 8 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 a30ee9c18c8..b7ba30bfcd1 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
@@ -616,7 +616,6 @@ define([
var linkUrl = linkInfo.url;
var linkText = linkInfo.text;
var isNewWindow = linkInfo.isNewWindow;
- var className = linkInfo.className || null; // ODOO: addition
var rng = linkInfo.range || this.createRange($editable);
var isTextChanged = rng.toString() !== linkText;
@@ -647,7 +646,8 @@ define([
$.each(anchors, function (idx, anchor) {
$(anchor).attr('href', linkUrl);
- $(anchor).attr('class', className); // ODOO: addition
+ $(anchor).attr('class', linkInfo.className || null); // ODOO: addition
+ $(anchor).css(linkInfo.style || {}); // ODOO: addition
if (isNewWindow) {
$(anchor).attr('target', '_blank');
} else {
diff --git a/addons/web_editor/static/src/js/rte.js b/addons/web_editor/static/src/js/rte.js
index 8fc84008693..e79c0ece4c1 100644
--- a/addons/web_editor/static/src/js/rte.js
+++ b/addons/web_editor/static/src/js/rte.js
@@ -516,7 +516,7 @@ var RTE = Widget.extend({
// add contenteditable on link to improve its editing behaviour
$target.attr('contenteditable', true);
setTimeout(function () {
- $editable.attr('contenteditable', false);
+ $editable.not($target).attr('contenteditable', false);
});
// once clicked outside, remove contenteditable on link
var reactive_editable = function(e){
diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js
index bb89c27a1c0..e4e838567c2 100644
--- a/addons/web_editor/static/src/js/widgets.js
+++ b/addons/web_editor/static/src/js/widgets.js
@@ -768,7 +768,9 @@ var fontIconsDialog = Widget.extend({
});
-function createVideoNode(url) {
+function createVideoNode(url, options) {
+ options = options || {};
+
// video url patterns(youtube, instagram, vimeo, dailymotion, youku)
var ytRegExp = /^(?:(?:https?:)?\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;
var ytMatch = url.match(ytRegExp);
@@ -838,6 +840,10 @@ function createVideoNode(url) {
});
}
+ if (options.autoplay) {
+ $video.attr("src", $video.attr("src") + "?autoplay=1");
+ }
+
$video.attr('frameborder', 0);
return $video;
@@ -852,6 +858,7 @@ var VideoDialog = Widget.extend({
events : _.extend({}, Dialog.prototype.events, {
'click input#urlvideo ~ button': 'get_video',
'click input#embedvideo ~ button': 'get_embed_video',
+ 'change input#autoplay': 'get_video',
'change input#urlvideo': 'change_input',
'keyup input#urlvideo': 'change_input',
'change input#embedvideo': 'change_input',
@@ -870,6 +877,7 @@ var VideoDialog = Widget.extend({
if ($media.hasClass("media_iframe_video")) {
var src = $media.data('src');
this.$("input#urlvideo").val(src);
+ this.$("input#autoplay").prop("checked", (src || "").indexOf("autoplay") >= 0);
this.get_video();
}
return this._super.apply(this, arguments);
@@ -894,7 +902,7 @@ var VideoDialog = Widget.extend({
},
get_video: function (event) {
if (event) event.preventDefault();
- var $video = createVideoNode(this.$("input#urlvideo").val());
+ var $video = createVideoNode(this.$("input#urlvideo").val(), {autoplay: this.$("input#autoplay").is(":checked")});
this.$iframe.replaceWith($video);
this.$iframe = $video;
return false;
@@ -1085,7 +1093,9 @@ var LinkDialog = Dialog.extend({
self.data.isNewWindow = new_window;
self.data.text = label;
self.data.className = classes.replace(/\s+/gi, ' ').replace(/^\s+|\s+$/gi, '');
-
+ if (classes.replace(/(^|[ ])(btn-default|btn-success|btn-primary|btn-info|btn-warning|btn-danger)([ ]|$)/gi, ' ')) {
+ self.data.style = {'background-color': '', 'color': ''};
+ }
self.trigger("save", self.data);
}).then(_super);
},
diff --git a/addons/web_editor/static/src/less/web_editor.ui.less b/addons/web_editor/static/src/less/web_editor.ui.less
index f453d0ca384..2a311a622d1 100644
--- a/addons/web_editor/static/src/less/web_editor.ui.less
+++ b/addons/web_editor/static/src/less/web_editor.ui.less
@@ -992,7 +992,7 @@ body.editor_enable {
p {
margin: initial;
}
- a, a:hover {
+ a:not(.btn), a:not(.btn):hover {
color: inherit;
}
}
diff --git a/addons/web_editor/static/src/xml/editor.xml b/addons/web_editor/static/src/xml/editor.xml
index ff22af71f3d..9ee57536083 100644
--- a/addons/web_editor/static/src/xml/editor.xml
+++ b/addons/web_editor/static/src/xml/editor.xml
@@ -210,7 +210,7 @@
</div>
<div class="text-center mt32">
<div class="checkbox">
- <label>
+ <label title="The feature might not be supported for every video type">
<input id="autoplay" type="checkbox"/>Autoplay</label>
</div>
</div>