mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-08 03:06:40 +02:00
keep cursor at edit position while typing in the middle
This commit is contained in:
@@ -52,6 +52,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
* Properly handle case sensitive tag values in taginfo suggestions in raw tag editor ([#9640])
|
||||
* Fix dysfunctional autocomplete of wikidata fields for some languages with country-codes ([#9638])
|
||||
* Prevent certain tag values from corrupting css classes when they contain whitespaces ([#9637], thanks [@k-yle])
|
||||
* Don't move the cursor to the end of (some) input fields while editing in the middle ([#9233])
|
||||
#### :earth_asia: Localization
|
||||
* Send `Accept-Language` header on Nominatim API calls ([#9501], thanks [@k-yle])
|
||||
* Add Address and Phone format for India ([#9482], thanks [@biswajit-k])
|
||||
@@ -69,6 +70,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
* Build icons from configured presets source and also process field value `icons` in `npm run build:data`
|
||||
|
||||
[#7427]: https://github.com/openstreetmap/iD/issues/7427
|
||||
[#9233]: https://github.com/openstreetmap/iD/issues/9233
|
||||
[#9482]: https://github.com/openstreetmap/iD/pull/9482
|
||||
[#9483]: https://github.com/openstreetmap/iD/pull/9483
|
||||
[#9492]: https://github.com/openstreetmap/iD/pull/9492
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// which can result in layout/repaint thrashing in some situations.
|
||||
/** @returns {string} */
|
||||
export function utilGetSetValue(selection, value) {
|
||||
function d3_selection_value(value) {
|
||||
function setValue(value) {
|
||||
function valueNull() {
|
||||
delete this.value;
|
||||
}
|
||||
@@ -27,9 +27,17 @@ export function utilGetSetValue(selection, value) {
|
||||
? valueFunction : valueConstant);
|
||||
}
|
||||
|
||||
function stickyCursor(func) {
|
||||
return function() {
|
||||
const cursor = { start: this.selectionStart, end: this.selectionEnd };
|
||||
func.apply(this, arguments);
|
||||
this.setSelectionRange(cursor.start, cursor.end);
|
||||
}
|
||||
}
|
||||
|
||||
if (arguments.length === 1) {
|
||||
return selection.property('value');
|
||||
}
|
||||
|
||||
return selection.each(d3_selection_value(value));
|
||||
return selection.each(stickyCursor(setValue(value)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user