Add missing length property

This commit is contained in:
Ramon Wenger 2024-03-13 22:09:24 +01:00
parent 4ed03ac5f3
commit 0abfcafd41
2 changed files with 6 additions and 6 deletions

View File

@ -150,14 +150,14 @@ const componentClass = computed(() => {
}); });
const childElements = 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) { if (contentComponentDiv.value) {
// todo: this is almost the same as the one in Assignment.vue, refactor and make one function // todo: this is almost the same as the one in Assignment.vue, refactor and make one function
let highlightParentSelector; let highlightParentSelector;
if (props.component.type === 'assignment') { highlightParentSelector = '.content-component__content';
highlightParentSelector = '.assignment-text';
} else {
highlightParentSelector = '.content-component__content';
}
const parent = contentComponentDiv.value.querySelector(highlightParentSelector); const parent = contentComponentDiv.value.querySelector(highlightParentSelector);
if (!parent) { if (!parent) {
console.warn('Parent does not exist, this should not be possible'); console.warn('Parent does not exist, this should not be possible');

View File

@ -214,7 +214,7 @@ const feedbackText = computed(() => {
const containsParagraphs = (str: string) => { const containsParagraphs = (str: string) => {
const parser = new DOMParser(); const parser = new DOMParser();
const doc = parser.parseFromString(str, 'text/html'); const doc = parser.parseFromString(str, 'text/html');
return doc.querySelectorAll('p') > 0; return doc.querySelectorAll('p').length > 0;
}; };
const assignmentHtml = computed(() => { const assignmentHtml = computed(() => {
const assignmentText = assignment.value.assignment; const assignmentText = assignment.value.assignment;