Added markdown support for maintenance

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
This commit is contained in:
Matthew Nickson 2023-01-08 20:54:16 +00:00
parent 852a088529
commit 80f2d6e2a7
No known key found for this signature in database
GPG Key ID: BF229DCFD4748E05
2 changed files with 14 additions and 1 deletions

View File

@ -21,6 +21,9 @@
<textarea <textarea
id="description" v-model="maintenance.description" class="form-control" id="description" v-model="maintenance.description" class="form-control"
></textarea> ></textarea>
<div class="form-text">
{{ $t("markdownSupported") }}
</div>
</div> </div>
<!-- Affected Monitors --> <!-- Affected Monitors -->

View File

@ -244,7 +244,8 @@
class="shadow-box alert mb-4 p-3 bg-maintenance mt-4 position-relative" role="alert" class="shadow-box alert mb-4 p-3 bg-maintenance mt-4 position-relative" role="alert"
> >
<h4 class="alert-heading">{{ maintenance.title }}</h4> <h4 class="alert-heading">{{ maintenance.title }}</h4>
<div class="content">{{ maintenance.description }}</div> <!-- eslint-disable-next-line vue/no-v-html-->
<div class="content" v-html="maintenanceHTML(maintenance.description)"></div>
<MaintenanceTime :maintenance="maintenance" /> <MaintenanceTime :maintenance="maintenance" />
</div> </div>
</template> </template>
@ -855,6 +856,15 @@ export default {
this.config.domainNameList.splice(index, 1); this.config.domainNameList.splice(index, 1);
}, },
/**
* Generate sanitized HTML from maintenance description
* @param {string} description
* @returns {string} Sanitized HTML
*/
maintenanceHTML(description) {
return DOMPurify.sanitize(marked(description));
},
} }
}; };
</script> </script>