Search: close dialog when appropriate, move special layer logic to themeViewState

This commit is contained in:
Pieter Vander Vennet 2024-09-12 16:14:57 +02:00
parent 902a479e3b
commit 05e5a63a12
11 changed files with 165 additions and 81 deletions

View file

@ -70,7 +70,11 @@ export class OsmPreferences {
this.setPreferencesAll(key, initialValue)
}
pref.addCallback(v => {
length.set(Math.ceil(v.length / maxLength))
if(v === null || v === undefined || v === ""){
length.set(null)
return
}
length.set(Math.ceil((v?.length ?? 1) / maxLength))
let i = 0
while (v.length > 0) {
this.UploadPreference(key + "-" + i, v.substring(0, maxLength))
@ -97,6 +101,7 @@ export class OsmPreferences {
}
}
/**
* OSM preferences can be at most 255 chars.
* This method chains multiple together.