Merged in fix/original-url-rte (pull request #483)
fix(SW-106): add support for original_url in rte Approved-by: Michael Zetterberg
This commit is contained in:
@@ -315,12 +315,17 @@ export const renderOptions: RenderOptions = {
|
||||
return (
|
||||
<ImageContainer leftImage={leftImage} rightImage={rightImage} />
|
||||
)
|
||||
} else {
|
||||
} else if (
|
||||
entry?.node.__typename === EmbedEnum.LoyaltyPage ||
|
||||
entry?.node.__typename === EmbedEnum.ContentPage ||
|
||||
entry?.node.__typename === EmbedEnum.AccountPage
|
||||
) {
|
||||
// If entry is not an ImageContainer, it is a page and we return it as a link
|
||||
const props = extractPossibleAttributes(node.attrs)
|
||||
const href = node.attrs?.locale
|
||||
? `/${node.attrs.locale}${node.attrs.href}`
|
||||
: node.attrs.href
|
||||
const href =
|
||||
entry.node?.web?.original_url ??
|
||||
`/${entry.node.system.locale}${entry.node.url}`
|
||||
|
||||
return (
|
||||
<Link
|
||||
{...props}
|
||||
|
||||
@@ -69,6 +69,7 @@ query GetLoyaltyPage($locale: String!, $uid: String!) {
|
||||
__typename
|
||||
...LoyaltyPageLink
|
||||
...ContentPageLink
|
||||
...AccountPageLink
|
||||
...Image
|
||||
... on ImageContainer {
|
||||
title
|
||||
@@ -233,6 +234,12 @@ query GetLoyaltyPageRefs($locale: String!, $uid: String!) {
|
||||
...System
|
||||
}
|
||||
}
|
||||
... on AccountPage {
|
||||
__typename
|
||||
system {
|
||||
...System
|
||||
}
|
||||
}
|
||||
... on ImageContainer {
|
||||
__typename
|
||||
system {
|
||||
|
||||
@@ -17,7 +17,6 @@ import { removeMultipleSlashes } from "@/utils/url"
|
||||
|
||||
import { removeEmptyObjects } from "../../utils"
|
||||
import {
|
||||
LoyaltyPage,
|
||||
type LoyaltyPageRefsDataRaw,
|
||||
validateLoyaltyPageRefsSchema,
|
||||
validateLoyaltyPageSchema,
|
||||
|
||||
@@ -1,4 +1,20 @@
|
||||
import { EmbedEnum } from "./utils/embeds"
|
||||
import { PageLink } from "./utils/pageLink"
|
||||
import { Typename } from "./utils/typename"
|
||||
|
||||
import type { ImageContainer } from "./imageContainer"
|
||||
import type { SysAsset } from "./utils/asset"
|
||||
|
||||
export type Embeds = SysAsset | ImageContainer
|
||||
type PageLinkWithOriginalUrl = PageLink & {
|
||||
web: { original_url?: string | null }
|
||||
}
|
||||
type ContentPage = Typename<PageLinkWithOriginalUrl, EmbedEnum.ContentPage>
|
||||
type LoyaltyPage = Typename<PageLinkWithOriginalUrl, EmbedEnum.LoyaltyPage>
|
||||
type AccountPage = Typename<PageLinkWithOriginalUrl, EmbedEnum.AccountPage>
|
||||
|
||||
export type Embeds =
|
||||
| SysAsset
|
||||
| ImageContainer
|
||||
| ContentPage
|
||||
| LoyaltyPage
|
||||
| AccountPage
|
||||
|
||||
Reference in New Issue
Block a user