Added markdown support for maintenance

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
pull/2570/head
Matthew Nickson 2 years ago
parent 852a088529
commit 80f2d6e2a7
No known key found for this signature in database
GPG Key ID: BF229DCFD4748E05

@ -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 -->

@ -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>

Loading…
Cancel
Save