From 43ac9db50c98091d4511b5b82dc8ba02542b3b87 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Fri, 27 Sep 2019 11:18:27 +0200 Subject: [PATCH] Keep advanced and basic editor in sync --- js/control/Profile.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/control/Profile.js b/js/control/Profile.js index a807ba6..dd32c3d 100644 --- a/js/control/Profile.js +++ b/js/control/Profile.js @@ -91,7 +91,7 @@ BR.Profile = L.Evented.extend({ }); }, - _save: function(evt) { + _buildCustomProfile: function() { var profileText = this.cache[this.profileName]; document.querySelectorAll('#profile_params input, #profile_params select').forEach(function(input) { var name = input.name; @@ -111,6 +111,11 @@ BR.Profile = L.Evented.extend({ return p1 + value + p3; }); }); + return profileText; + }, + + _save: function(evt) { + var profileText = this._buildCustomProfile(); this.fire('update', { profileText: profileText, callback: function() {} @@ -262,10 +267,11 @@ BR.Profile = L.Evented.extend({ if (L.DomUtil.get('profile_editor').style.display == 'flex') { L.DomUtil.get('profile_params_container').style.display = 'initial'; L.DomUtil.get('profile_editor').style.display = 'none'; + this._setValue(this.editor.getValue()); } else { L.DomUtil.get('profile_params_container').style.display = 'none'; L.DomUtil.get('profile_editor').style.display = 'flex'; + this._setValue(this._buildCustomProfile()); } - this._setValue(this.cache[this.profileName]); } });