diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-09-22 14:23:07 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-09-22 14:23:07 +0200 |
| commit | b1b700adb1f26bb43e8f4b77b85f969a4b52d36c (patch) | |
| tree | fd1febbefe6cdb41fb2a063fec4af3718860b9a9 /addons/web_editor/static/src/js | |
| parent | 5a0a29b5285ea8f18716f936d58960b9b5c0f0d9 (diff) | |
| parent | 6854887ade204c635fb99a16275f7e0ca664697a (diff) | |
[MERGE] forward port branch saas-11 up to 6854887
Diffstat (limited to 'addons/web_editor/static/src/js')
| -rw-r--r-- | addons/web_editor/static/src/js/rte.js | 2 | ||||
| -rw-r--r-- | addons/web_editor/static/src/js/widgets.js | 16 |
2 files changed, 14 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 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); }, |
