From a0c6222fec513f0b799bd72c846e673ec6d64093 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Mon, 15 Aug 2016 15:04:12 +0200 Subject: [PATCH] Ensuring markdown docs use the unformatted text for raw text and clone, fixes #63 --- js/privatebin.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 20f34128..c7528822 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -741,6 +741,7 @@ $(function() { this.passwordInput.val(password); if (cleartext.length > 0) { + $('#pasteFormatter').val(paste.meta.formatter); this.formatPaste(paste.meta.formatter, cleartext); } } @@ -1237,7 +1238,8 @@ $(function() { rawText: function(event) { event.preventDefault(); - var paste = this.clearText.html(); + var paste = $('#pasteFormatter').val() === 'markdown' ? + this.prettyPrint.text() : this.clearText.text(); var newDoc = document.open('text/html', 'replace'); newDoc.write('
' + paste + '
'); newDoc.close(); @@ -1262,7 +1264,10 @@ $(function() { this.clonedFile.removeClass('hidden'); this.fileWrap.addClass('hidden'); } - this.message.text(this.clearText.text()); + this.message.text( + $('#pasteFormatter').val() === 'markdown' ? + this.prettyPrint.text() : this.clearText.text() + ); $('.navbar-toggle').click(); },