Select parts of trackname in export dialog for easier overwriting
Users might want to assign custom tracknames, which requires deleting the
default name either entirely or parts of it.
By pre-selecting parts of the trackname, users can start typing right away
after opening the dialog. `Ctrl+A` to select everything is still possible,
but keeping the distance in the filename by default comes in handy,
e.g. when using a file manager not displaying the track length.
NB: Might need adaptation once trackname validation becomes less strict,
i.e. currently "(" and "->" as specified in the message catalog are replaced
with ' - ' by the validator before being inserted into the dialog.
Test Plan:
- Open "Export" dialog ("Location - Other Location - 2km")
- Open "Export" dialog for roundtrip ("Location - 1km")
- In both cases the complete trackname except for the distance
information (including separator) should be selected.
- No unwanted behaviour even if Nominatim is slow or down.
This commit is contained in:
parent
13794c3df3
commit
7edae911dc
1 changed files with 6 additions and 0 deletions
|
|
@ -71,6 +71,10 @@ BR.Export = L.Class.extend({
|
|||
}
|
||||
},
|
||||
|
||||
_selectTrackname: function () {
|
||||
trackname.setSelectionRange(0, trackname.value.lastIndexOf(' - '));
|
||||
},
|
||||
|
||||
_generateTrackname: function () {
|
||||
var trackname = this.trackname;
|
||||
this._getCityAtPosition(
|
||||
|
|
@ -103,6 +107,8 @@ BR.Export = L.Class.extend({
|
|||
trackname.value = trackname.value.replace(/[>)]/g, '').replace(/ \(/g, ' - ');
|
||||
this._validationMessage();
|
||||
}
|
||||
|
||||
this._selectTrackname();
|
||||
}, this)
|
||||
);
|
||||
}, this)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue