From dff6ba5b6ab704dfafb3f27461736ea18d47fa27 Mon Sep 17 00:00:00 2001 From: Botho <1258870+elbotho@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:57:11 +0100 Subject: [PATCH] fix(web): also activate learner events in exercise collections --- apps/web/src/components/taxonomy/topic.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/taxonomy/topic.tsx b/apps/web/src/components/taxonomy/topic.tsx index 256063250d..7a2bd200d0 100644 --- a/apps/web/src/components/taxonomy/topic.tsx +++ b/apps/web/src/components/taxonomy/topic.tsx @@ -1,3 +1,4 @@ +import { editorLearnerEvent } from '@editor/plugin/helpers/editor-learner-event' import { editorRenderers } from '@editor/plugin/helpers/editor-renderer' import { EditorPluginType } from '@editor/types/editor-plugin-type' import { EditorRowsDocument } from '@editor/types/editor-plugins' @@ -27,6 +28,7 @@ import { import { TaxonomyTermType } from '@/fetcher/graphql-types/operations' import { createRenderers } from '@/serlo-editor-integration/create-renderers' import { EditorRenderer } from '@/serlo-editor-integration/editor-renderer' +import { useSerloHandleLearnerEvent } from '@/serlo-editor-integration/use-handle-learner-event' export interface TopicProps { data: TaxonomyData @@ -42,6 +44,10 @@ const DonationsBanner = dynamic(() => export function Topic({ data, breadcrumbs }: TopicProps) { const { strings } = useInstanceData() + const handleLearnerEvent = useSerloHandleLearnerEvent() + editorLearnerEvent.init(handleLearnerEvent) + editorRenderers.init(createRenderers()) + const isExerciseFolder = data.taxonomyType === TaxonomyTermType.ExerciseFolder const isTopic = data.taxonomyType === TaxonomyTermType.Topic @@ -54,8 +60,6 @@ export function Topic({ data, breadcrumbs }: TopicProps) { const hasExercises = data.exercisesContent.length > 0 - editorRenderers.init(createRenderers()) - return ( <> {data.trashed && renderTrashedNotice()}