Skip to content

Commit 99e8506

Browse files
committed
Støtter expandall-flagg på ReadMore
1 parent f0b1811 commit 99e8506

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/parts/readMorePart/ReadMorePart.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useRef, useState } from 'react';
1+
import React, { useEffect, useRef, useState } from 'react';
22
import { ReadMore } from '@navikt/ds-react';
33
import { EditorHelp } from 'components/_editor-only/editor-help/EditorHelp';
44
import { ParsedHtml } from 'components/_common/parsedHtml/ParsedHtml';
@@ -32,6 +32,13 @@ export const ReadMorePart = ({ config }: PartComponentProps<PartType.ReadMore>)
3232
callback: () => setIsOpen(true),
3333
});
3434

35+
useEffect(() => {
36+
if (window.location.toString().includes('expandall=true')) {
37+
setIsOpen(true);
38+
return;
39+
}
40+
}, []);
41+
3542
if (!config?.html || !config.title) {
3643
return <EditorHelp text={'Legg inn tittel og beskrivelse for "les mer".'} type={'error'} />;
3744
}

0 commit comments

Comments
 (0)