-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UU-Disclaimer embed updates #2659
base: master
Are you sure you want to change the base?
Conversation
28c4c3d
to
e842a11
Compare
e842a11
to
02a477e
Compare
6bb2f0c
to
7e501a6
Compare
17b695b
to
8c15da5
Compare
Kan sikkert ta inn denne og publisere pakker. Eksisterende kode vil jo ikkje påvirkes av nye versjoner her. |
@@ -15,7 +15,10 @@ import { type PluginType } from "../types"; | |||
export const uuDisclaimerEmbedPlugin: PluginType = (element, opts, transformOpts) => { | |||
const props = attributesToProps(element.attribs); | |||
const data = JSON.parse(props["data-json"] as string) as UuDisclaimerMetaData; | |||
const transformedDisclaimer = transform(data.embedData.disclaimer, transformOpts); | |||
if (data.status === "error") { | |||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Burde vi ha bedre errorhåndtering her? vurderte å legge til støtte for uu-disclaimer i EmbedErrorPlaceholder
, innspill?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Synes det høres lurt ut, jeg. Evt bare vise innhold direkte?
08ce135
to
abf854d
Compare
const props = attributesToProps(element.attribs); | ||
const data = JSON.parse(props["data-json"] as string) as UuDisclaimerMetaData; | ||
return <UuDisclaimerEmbed embed={data}>{domToReact(element.children as DOMNode[], opts)}</UuDisclaimerEmbed>; | ||
if (data.status === "error") { | ||
return <>{domToReact(element.children as DOMNode[], opts)}</>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trenger vi et fragment her?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jepp, ellers blir TS sinna pga return typen til funksjonen
}, | ||
}); | ||
|
||
const UuDisclaimerEmbed = ({ embed, children }: Props) => { | ||
const UuDisclaimerEmbed = ({ embed, transformedDisclaimer, children }: Props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vil vi fortsatt returnere ingenting dersom disclaimer har feil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm hva med å returnere innholdet også vise en feilmelding over eller noe?
aria-label={t("uuDisclaimer.title")} | ||
title={t("uuDisclaimer.title")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jeg mistenker at disse vil bli satt av PopoverTitle automatisk. Kan det stemme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jeg tror ikke det, ser dårlig ut
https://github.com/NDLANO/Issues/issues/4245
relatert: NDLANO/graphql-api#528
Tilhørende PR i ed kommer også