feat(variables): auto replace spaces with underscores in variable name inputs (#21843)

This commit is contained in:
Minamiyama
2025-07-03 10:36:38 +08:00
committed by GitHub
parent cb0d4a1e15
commit a45aa1e505
6 changed files with 36 additions and 7 deletions

View File

@@ -120,3 +120,13 @@ export function getMarketplaceUrl(path: string, params?: Record<string, string |
}
return `${MARKETPLACE_URL_PREFIX}${path}?${searchParams.toString()}`
}
export const replaceSpaceWithUnderscreInVarNameInput = (input: HTMLInputElement) => {
const start = input.selectionStart
const end = input.selectionEnd
input.value = input.value.replaceAll(' ', '_')
if (start !== null && end !== null)
input.setSelectionRange(start, end)
}