fix(abbreviations): restore ancestor duplicate check; clear stale validity on input change
This commit is contained in:
1 file changed
+4
-1
@@ -117,7 +117,9 @@ export function RoomAbbreviations({ requestClose, isSpace }: AbbreviationsProps)
|
||||
const definition = definitionInput.value.trim();
|
||||
if (!term || !definition) return;
|
||||
|
||||
const alreadyExists = entries.some((e) => e.term.toLowerCase() === term.toLowerCase());
|
||||
const alreadyExists =
|
||||
entries.some((e) => e.term.toLowerCase() === term.toLowerCase()) ||
|
||||
allAncestorEntries.some((e) => e.term.toLowerCase() === term.toLowerCase());
|
||||
if (alreadyExists) {
|
||||
termInput.setCustomValidity('This term already exists.');
|
||||
termInput.reportValidity();
|
||||
@@ -187,6 +189,7 @@ export function RoomAbbreviations({ requestClose, isSpace }: AbbreviationsProps)
|
||||
radii="300"
|
||||
placeholder="e.g. FOSS"
|
||||
readOnly={saving}
|
||||
onChange={(e) => e.currentTarget.setCustomValidity('')}
|
||||
/>
|
||||
</Box>
|
||||
<Box direction="Column" gap="100">
|
||||
|
||||
Reference in new issue
Block a user