summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-09-22 13:05:29 +0200
committerChristophe Simonis <chs@odoo.com>2016-09-22 13:05:29 +0200
commit477482ed9fb5cfd90641050d549b9af9a62f7eda (patch)
tree5a05afefcb11f4b10bd6703ae92f316a8dcf3535 /addons/web_editor/static/src
parent7233add42bf72cadd63cc931e9b610b4d39c1c5f (diff)
parent78f6117db04bedb77fcc8c0e8211be2866f36922 (diff)
[MERGE] forward port branch 9.0 up to 78f6117
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/rte.js2
-rw-r--r--addons/web_editor/static/src/js/widgets.js12
-rw-r--r--addons/web_editor/static/src/xml/editor.xml2
3 files changed, 12 insertions, 4 deletions
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 dcb5f58f5b8..13126beba6a 100644
--- a/addons/web_editor/static/src/js/widgets.js
+++ b/addons/web_editor/static/src/js/widgets.js
@@ -784,7 +784,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);
@@ -842,6 +844,10 @@ function createVideoNode(url) {
.attr('src', url);
}
+ if (options.autoplay) {
+ $video.attr("src", $video.attr("src") + "?autoplay=1");
+ }
+
$video.attr('frameborder', 0);
return $video;
@@ -856,6 +862,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',
@@ -874,6 +881,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();
@@ -898,7 +906,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;
diff --git a/addons/web_editor/static/src/xml/editor.xml b/addons/web_editor/static/src/xml/editor.xml
index 49743987fc3..87fd78fe624 100644
--- a/addons/web_editor/static/src/xml/editor.xml
+++ b/addons/web_editor/static/src/xml/editor.xml
@@ -355,7 +355,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>