[MERGE] forward port branch saas-12 up to b1b700a
This commit is contained in:
@@ -509,7 +509,7 @@ var RTE = Widget.extend({
|
||||
*/
|
||||
$target.attr('contenteditable', true);
|
||||
_.defer(function () {
|
||||
$editable.attr('contenteditable', false);
|
||||
$editable.not($target).attr('contenteditable', false);
|
||||
$target.focus();
|
||||
});
|
||||
|
||||
|
||||
@@ -1001,10 +1001,12 @@ data.Editor = Class.extend({
|
||||
},
|
||||
|
||||
on_remove: function (event) {
|
||||
event.preventDefault();
|
||||
this.on_blur();
|
||||
if (event !== undefined) {
|
||||
event.preventDefault();
|
||||
this.buildingBlock.getParent().rte.historyRecordUndo(this.$target);
|
||||
}
|
||||
|
||||
this.buildingBlock.getParent().rte.historyRecordUndo(this.$target);
|
||||
this.on_blur();
|
||||
|
||||
var index = _.indexOf(this.buildingBlock.snippets, this.$target.get(0));
|
||||
this.buildingBlock.call_for_all_snippets(this.$target, function (editor, $snippet) {
|
||||
@@ -1037,7 +1039,7 @@ data.Editor = Class.extend({
|
||||
}
|
||||
if ($parent.children().length === 0 && $parent.text().trim() === "") {
|
||||
_.defer(function () {
|
||||
$parent.data("snippet-editor").on_remove(event);
|
||||
$parent.data("snippet-editor").on_remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -767,7 +767,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);
|
||||
@@ -837,6 +839,10 @@ function createVideoNode(url) {
|
||||
});
|
||||
}
|
||||
|
||||
if (options.autoplay) {
|
||||
$video.attr("src", $video.attr("src") + "?autoplay=1");
|
||||
}
|
||||
|
||||
$video.attr('frameborder', 0);
|
||||
|
||||
return $video;
|
||||
@@ -851,6 +857,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',
|
||||
@@ -869,6 +876,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);
|
||||
@@ -893,7 +901,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;
|
||||
@@ -1084,7 +1092,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);
|
||||
},
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user