push state to history when displaying raw text to allow use of back button, fixes #7
This commit is contained in:
parent
e49e1e2079
commit
f957a1868f
1 changed files with 7 additions and 1 deletions
|
@ -1240,6 +1240,12 @@ $(function() {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var paste = $('#pasteFormatter').val() === 'markdown' ?
|
var paste = $('#pasteFormatter').val() === 'markdown' ?
|
||||||
this.prettyPrint.text() : this.clearText.text();
|
this.prettyPrint.text() : this.clearText.text();
|
||||||
|
history.pushState(
|
||||||
|
null, document.title, this.scriptLocation() + '?' +
|
||||||
|
this.pasteID() + '#' + this.pageKey()
|
||||||
|
);
|
||||||
|
// we use text/html instead of text/plain to avoid a bug when
|
||||||
|
// reloading the raw text view (it reverts to type text/html)
|
||||||
var newDoc = document.open('text/html', 'replace');
|
var newDoc = document.open('text/html', 'replace');
|
||||||
newDoc.write('<pre>' + paste + '</pre>');
|
newDoc.write('<pre>' + paste + '</pre>');
|
||||||
newDoc.close();
|
newDoc.close();
|
||||||
|
@ -1256,7 +1262,7 @@ $(function() {
|
||||||
this.stateNewPaste();
|
this.stateNewPaste();
|
||||||
|
|
||||||
// Erase the id and the key in url
|
// Erase the id and the key in url
|
||||||
history.replaceState(document.title, document.title, this.scriptLocation());
|
history.replaceState(null, document.title, this.scriptLocation());
|
||||||
|
|
||||||
this.showStatus('', false);
|
this.showStatus('', false);
|
||||||
if (this.attachmentLink.attr('href'))
|
if (this.attachmentLink.attr('href'))
|
||||||
|
|
Loading…
Reference in a new issue