Skip to content

Commit

Permalink
feat: resize iframe when subcontent height changes (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
henriettemoe authored Mar 27, 2023
1 parent 75fc03a commit df2b93a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"machineName": "H5P.VocabularyDrill",
"majorVersion": 1,
"minorVersion": 0,
"patchVersion": 14,
"patchVersion": 15,
"runnable": 1,
"license": "MIT",
"author": "NDLA",
Expand Down
2 changes: 1 addition & 1 deletion library.json.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ declare const json: {
"machineName": "H5P.VocabularyDrill",
"majorVersion": 1,
"minorVersion": 0,
"patchVersion": 14,
"patchVersion": 15,
"runnable": 1,
"license": "MIT",
"author": "NDLA",
Expand Down
6 changes: 6 additions & 0 deletions src/components/VocabularyDrill/VocabularyDrill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type VocabularyDrillProps = {
contentType: ChildContentType,
) => void;
onChangeLanguageMode: (languageMode: LanguageModeType) => void;
onResize: () => void;
};

export const VocabularyDrill: FC<VocabularyDrillProps> = ({
Expand All @@ -32,6 +33,7 @@ export const VocabularyDrill: FC<VocabularyDrillProps> = ({
previousState,
onChangeContentType,
onChangeLanguageMode,
onResize,
}) => {
const {
behaviour,
Expand Down Expand Up @@ -183,6 +185,10 @@ export const VocabularyDrill: FC<VocabularyDrillProps> = ({
}
}

activeContentType.on('resize', () => {
onResize();
});

onChangeContentType(activeAnswerMode, activeContentType);
};

Expand Down
1 change: 1 addition & 0 deletions src/h5p-vocabulary-drill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class VocabularyDrillContentType
onChangeLanguageMode={(languageMode) =>
this.handleLanguageModeChange(languageMode)
}
onResize={() => this.resize()}
/>
</ContentIdContext.Provider>
</L10nContext.Provider>
Expand Down

0 comments on commit df2b93a

Please sign in to comment.