Skip to content
Snippets Groups Projects
Unverified Commit f2c9e306 authored by Christoph Wurst's avatar Christoph Wurst Committed by GitHub
Browse files

Merge pull request #3648 from nextcloud/enhancement/collapse-plain-text-signature

Collapse plain text signatures into a detail element
parents 38024803 cdc046c4
No related branches found
No related tags found
No related merge requests found
<template>
<div>
<div id="mail-content" v-html="htmlBody" />
<div v-if="signature" class="mail-signature" v-html="htmlSignature" />
<div id="mail-content" v-html="nl2br(body)" />
<details v-if="signature" class="mail-signature">
<summary>{{ signatureSummaryAndBody.summary }}</summary>
<span v-html="nl2br(signatureSummaryAndBody.body)" />
</details>
</div>
</template>
<script>
const regFirstParagraph = /(.+\n\r?)+(\n\r?)+/
export default {
name: 'MessagePlainTextBody',
props: {
......@@ -19,11 +24,26 @@ export default {
},
},
computed: {
htmlBody() {
return this.nl2br(this.body)
signatureSummaryAndBody() {
const matches = this.signature.match(regFirstParagraph)
if (matches[0]) {
return {
summary: matches[0],
body: this.signature.substring(matches[0].length),
}
}
const lines = this.signature.trim().split(/\r?\n/)
return {
summary: lines[0],
body: lines.slice(1).join('\n'),
}
},
htmlSignature() {
return this.nl2br(this.signature)
signatureSummary() {
console.info(this.signature.match(regFirstParagraph))
return this.signatureSummaryAndBody.summary
},
},
methods: {
......@@ -34,7 +54,10 @@ export default {
}
</script>
<style scoped>
<style lang="scss" scoped>
#mail-content, .mail-signature {
white-space: pre;
}
.mail-signature {
color: var(--color-text-maxcontrast)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment