Fix custom card documentation url (#15439)

Fix custom card documentation
This commit is contained in:
Paul Bottein 2023-02-13 17:28:45 +01:00 committed by GitHub
parent 714c6aab98
commit 1c5b476bda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -154,7 +154,7 @@ const _lazyCreate = <T extends keyof CreateElementConfigTypes>(
const _getCustomTag = (type: string) =>
type.startsWith(CUSTOM_TYPE_PREFIX)
? type.substr(CUSTOM_TYPE_PREFIX.length)
? type.slice(CUSTOM_TYPE_PREFIX.length)
: undefined;
export const createLovelaceElement = <T extends keyof CreateElementConfigTypes>(

View File

@ -10,7 +10,8 @@ export const getCardDocumentationURL = (
type: string
): string | undefined => {
if (type.startsWith(CUSTOM_TYPE_PREFIX)) {
return getCustomCardEntry(type)?.documentationURL;
return getCustomCardEntry(type.slice(CUSTOM_TYPE_PREFIX.length))
?.documentationURL;
}
return `${documentationUrl(hass, "/lovelace/")}${type}`;