Format the formatted tab for mail logs

The default markup is built by the jQuery plugin, meaning the formatted tab just shows raw data.

This checks for a Message-ID: string in the source to identify email logs, and uses the unescaped content of the raw tab to show a formatted email.
This commit is contained in:
Dave Shoreman 2016-09-25 04:10:53 +01:00 committed by GitHub
parent 3499db5e53
commit 67e682f4ff
1 changed files with 5 additions and 1 deletions

View File

@ -324,6 +324,10 @@
'<div class="tab-pane pane-inset" id="beautifier-tab-raw"></div>' +
'</div></div>')
if (source.indexOf('Message-ID:') > 0) {
markup = '<div class="beautifier-raw-content">' + source.trim().replace(/\r\n|\r|\n/g, '<br>').replace(/ {2}/g, '&nbsp;&nbsp;') + '</div>'
}
tabs.find('#beautifier-tab-formatted').append(markup)
tabs.find('#beautifier-tab-raw').append('<div class="beautifier-raw-content">' + $.oc.escapeHtmlString(source.trim()).replace(/\r\n|\r|\n/g, '<br>').replace(/ {2}/g, '&nbsp;&nbsp;') + '</div>')
@ -358,4 +362,4 @@
$('[data-plugin="exception-beautifier"]').exceptionBeautifier()
})
}(window.jQuery)
}(window.jQuery)