Skip to content

Commit

Permalink
Fix H5P contract before attached
Browse files Browse the repository at this point in the history
  • Loading branch information
otacke committed May 25, 2024
1 parent c8e70c3 commit 6b47020
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions src/scripts/h5p-crossword.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,41 @@ export default class Crossword extends H5P.Question {
word.clue = Util.stripHTML(Util.htmlDecode(word.clue));
return word;
});

this.content = new CrosswordContent(
{
scoreWords: this.params.behaviour.scoreWords,
applyPenalties: this.params.behaviour.applyPenalties,
theme: this.params.theme,
contentId: this.contentId,
instantFeedback: this.params.behaviour.enableInstantFeedback,
l10n: {
couldNotGenerateCrossword: this.params.l10n.couldNotGenerateCrossword,
couldNotGenerateCrosswordTooFewWords: this.params.l10n.couldNotGenerateCrosswordTooFewWords,
problematicWords: this.params.l10n.problematicWords,
across: this.params.l10n.across,
down: this.params.l10n.down,
extraClue: this.params.l10n.extraClue,
closeWindow: this.params.l10n.closeWindow
},
a11y: this.params.a11y,
poolSize: this.params.behaviour.poolSize,
solutionWord: Util.toUpperCase(this.params.solutionWord.replace(/'\s'/g, ''), Util.UPPERCASE_EXCEPTIONS),
words: this.params.words,
previousState: this.previousState
},
{
onTableFilled: () => {
this.handleContentFilled();
},
onInitialized: (result) => {
this.handleContentInitialized(result);
},
onRead: (text) => {
this.handleRead(text);
}
}
);
}

/**
Expand All @@ -144,41 +179,6 @@ export default class Crossword extends H5P.Question {
this.setIntroduction(this.introduction);
}

this.content = new CrosswordContent(
{
scoreWords: this.params.behaviour.scoreWords,
applyPenalties: this.params.behaviour.applyPenalties,
theme: this.params.theme,
contentId: this.contentId,
instantFeedback: this.params.behaviour.enableInstantFeedback,
l10n: {
couldNotGenerateCrossword: this.params.l10n.couldNotGenerateCrossword,
couldNotGenerateCrosswordTooFewWords: this.params.l10n.couldNotGenerateCrosswordTooFewWords,
problematicWords: this.params.l10n.problematicWords,
across: this.params.l10n.across,
down: this.params.l10n.down,
extraClue: this.params.l10n.extraClue,
closeWindow: this.params.l10n.closeWindow
},
a11y: this.params.a11y,
poolSize: this.params.behaviour.poolSize,
solutionWord: Util.toUpperCase(this.params.solutionWord.replace(/'\s'/g, ''), Util.UPPERCASE_EXCEPTIONS),
words: this.params.words,
previousState: this.previousState
},
{
onTableFilled: () => {
this.handleContentFilled();
},
onInitialized: (result) => {
this.handleContentInitialized(result);
},
onRead: (text) => {
this.handleRead(text);
}
}
);

// Register content with H5P.Question
this.setContent(this.content.getDOM());

Expand Down

0 comments on commit 6b47020

Please sign in to comment.