From 0abfcafd41934d63d5e10886e70a90f2e5e55b71 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Wed, 13 Mar 2024 22:09:24 +0100 Subject: [PATCH] Add missing length property --- .../src/components/content-blocks/ContentComponent.vue | 10 +++++----- .../content-blocks/assignment/Assignment.vue | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/src/components/content-blocks/ContentComponent.vue b/client/src/components/content-blocks/ContentComponent.vue index a48fdbdb..97dd967c 100644 --- a/client/src/components/content-blocks/ContentComponent.vue +++ b/client/src/components/content-blocks/ContentComponent.vue @@ -150,14 +150,14 @@ const componentClass = computed(() => { }); const childElements = computed(() => { + if (props.component.type === 'assignment') { + // we don't need the childElements for an assignment component for now + return []; + } if (contentComponentDiv.value) { // todo: this is almost the same as the one in Assignment.vue, refactor and make one function let highlightParentSelector; - if (props.component.type === 'assignment') { - highlightParentSelector = '.assignment-text'; - } else { - highlightParentSelector = '.content-component__content'; - } + highlightParentSelector = '.content-component__content'; const parent = contentComponentDiv.value.querySelector(highlightParentSelector); if (!parent) { console.warn('Parent does not exist, this should not be possible'); diff --git a/client/src/components/content-blocks/assignment/Assignment.vue b/client/src/components/content-blocks/assignment/Assignment.vue index fb1a7947..0b6d4208 100644 --- a/client/src/components/content-blocks/assignment/Assignment.vue +++ b/client/src/components/content-blocks/assignment/Assignment.vue @@ -214,7 +214,7 @@ const feedbackText = computed(() => { const containsParagraphs = (str: string) => { const parser = new DOMParser(); const doc = parser.parseFromString(str, 'text/html'); - return doc.querySelectorAll('p') > 0; + return doc.querySelectorAll('p').length > 0; }; const assignmentHtml = computed(() => { const assignmentText = assignment.value.assignment;