[FIX] website: avoid double start edition

issue: 'enable_editor' and click on 'edit' before loading edition, or
double click on 'edit'
This commit is contained in:
Christophe Matthieu
2019-02-19 08:43:51 +00:00
parent 9fff365d4a
commit 41b470456c
@@ -89,6 +89,9 @@ var EditPageMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({
*/
_startEditMode: function () {
var self = this;
if (this.editModeEnable) {
return;
}
this.trigger_up('animation_stop_demand', {
$target: this._targetForEdition(),
});
@@ -97,6 +100,7 @@ var EditPageMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({
$welcomeMessageParent = this.$welcomeMessage.parent();
this.$welcomeMessage.detach(); // detach from the readonly rendering before the clone by summernote
}
this.editModeEnable = true;
return new EditorMenu(this).prependTo(document.body).then(function () {
if (self.$welcomeMessage) {
$welcomeMessageParent.append(self.$welcomeMessage); // reappend if the user cancel the edition
@@ -197,6 +201,7 @@ var EditPageMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({
this.trigger_up('animation_start_demand', {
$target: this._targetForEdition(),
});
this.editModeEnable = false;
},
/**
* Called when a snippet is cloned in the page. Notifies the WebsiteRoot