mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
@@ -182,11 +182,17 @@ export function uiFieldText(field, context) {
|
||||
|
||||
|
||||
function validIdentifierValueForLink() {
|
||||
const value = utilGetSetValue(input).trim().split(';')[0];
|
||||
const value = utilGetSetValue(input).trim();
|
||||
|
||||
if (field.type === 'url' && value) return value;
|
||||
if (field.type === 'url' && value) {
|
||||
try {
|
||||
return (new URL(value)).href;
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (field.type === 'identifier' && field.pattern) {
|
||||
return value && value.match(new RegExp(field.pattern));
|
||||
return value && value.match(new RegExp(field.pattern))[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user