Keep advanced and basic editor in sync

This commit is contained in:
Phyks (Lucas Verney) 2019-09-27 11:18:27 +02:00
parent 83390fc05c
commit 43ac9db50c

View file

@ -91,7 +91,7 @@ BR.Profile = L.Evented.extend({
}); });
}, },
_save: function(evt) { _buildCustomProfile: function() {
var profileText = this.cache[this.profileName]; var profileText = this.cache[this.profileName];
document.querySelectorAll('#profile_params input, #profile_params select').forEach(function(input) { document.querySelectorAll('#profile_params input, #profile_params select').forEach(function(input) {
var name = input.name; var name = input.name;
@ -111,6 +111,11 @@ BR.Profile = L.Evented.extend({
return p1 + value + p3; return p1 + value + p3;
}); });
}); });
return profileText;
},
_save: function(evt) {
var profileText = this._buildCustomProfile();
this.fire('update', { this.fire('update', {
profileText: profileText, profileText: profileText,
callback: function() {} callback: function() {}
@ -262,10 +267,11 @@ BR.Profile = L.Evented.extend({
if (L.DomUtil.get('profile_editor').style.display == 'flex') { if (L.DomUtil.get('profile_editor').style.display == 'flex') {
L.DomUtil.get('profile_params_container').style.display = 'initial'; L.DomUtil.get('profile_params_container').style.display = 'initial';
L.DomUtil.get('profile_editor').style.display = 'none'; L.DomUtil.get('profile_editor').style.display = 'none';
this._setValue(this.editor.getValue());
} else { } else {
L.DomUtil.get('profile_params_container').style.display = 'none'; L.DomUtil.get('profile_params_container').style.display = 'none';
L.DomUtil.get('profile_editor').style.display = 'flex'; L.DomUtil.get('profile_editor').style.display = 'flex';
this._setValue(this._buildCustomProfile());
} }
this._setValue(this.cache[this.profileName]);
} }
}); });