Implement RichTextBlock

This commit is contained in:
Elia Bieri 2023-05-17 10:58:54 +02:00
parent 45a27332cd
commit 652cd7d8fb
5 changed files with 28 additions and 7 deletions

View File

@ -8,11 +8,12 @@ import type { Component } from "vue";
import { computed, onUnmounted } from "vue";
import AssignmentBlock from "./blocks/AssignmentBlock.vue";
import AttendanceDayBlock from "./blocks/AttendanceDayBlock.vue";
import DescriptionBlock from "./blocks/DescriptionBlock.vue";
import FeedbackBlock from "./blocks/FeedbackBlock.vue";
import IframeBlock from "./blocks/IframeBlock.vue";
import MediaLibraryBlock from "./blocks/MediaLibraryBlock.vue";
import PlaceholderBlock from "./blocks/PlaceholderBlock.vue";
import DescriptionBlock from "./blocks/RichTextBlock.vue";
import RichTextBlock from "./blocks/RichTextBlock.vue";
import VideoBlock from "./blocks/VideoBlock.vue";
log.debug("LearningContent.vue setup");
@ -31,7 +32,7 @@ const COMPONENTS: Record<LearningContentType, Component> = {
"learnpath.LearningContentLearningModule": IframeBlock,
"learnpath.LearningContentMediaLibrary": MediaLibraryBlock,
"learnpath.LearningContentPlaceholder": PlaceholderBlock,
"learnpath.LearningContentRichText": DescriptionBlock,
"learnpath.LearningContentRichText": RichTextBlock,
"learnpath.LearningContentTest": IframeBlock,
"learnpath.LearningContentVideo": VideoBlock,
};

View File

@ -0,0 +1,15 @@
<template>
<div class="container-medium">
<div class="lg:mt-8">
<p class="text-large my-4">{{ props.content.description }}}</p>
</div>
</div>
</template>
<script setup lang="ts">
import type { LearningContentInterface } from "@/types";
const props = defineProps<{
content: LearningContentInterface;
}>();
</script>

View File

@ -1,15 +1,14 @@
<template>
<!-- eslint-disable vue/no-v-html -->
<div class="container-medium">
<div class="lg:mt-8">
<p class="text-large my-4">{{ props.content.description }}}</p>
</div>
<div v-html="props.content.text"></div>
</div>
</template>
<script setup lang="ts">
import type { LearningContentInterface } from "@/types";
import type { LearningContentRichText } from "@/types";
const props = defineProps<{
content: LearningContentInterface;
content: LearningContentRichText;
}>();
</script>

View File

@ -72,6 +72,7 @@ export interface LearningContentPlaceholder extends LearningContentInterface {
export interface LearningContentRichText extends LearningContentInterface {
readonly content_type: "learnpath.LearningContentRichText";
text: string;
}
export interface LearningContentTest extends LearningContentInterface {

View File

@ -306,8 +306,13 @@ class LearningContentTest(LearningContent):
class LearningContentRichText(LearningContent):
text = RichTextField(blank=True)
parent_page_types = ["learnpath.Circle"]
subpage_types = []
content_panels = LearningContent.content_panels + [
FieldPanel("text", classname="Text"),
]
class LearningContentAssignment(LearningContent):