4
$\begingroup$

I was in the midst of a lengthy edit to my answer to a question, when the question was deleted before I had saved the new text. The webpage was dynamically updated in my browser tab with an overlay with the message "This post has been deleted and is no longer viewable". My entered unsaved text is still visible underneath the overlay. Although it's so faint it's very hard to read, it is definitely still somehow resident in my browser's rendered page.

According to this recent post, deleting a question which has a correct answer is frowned upon. I would hope that deleting while further good faith efforts are in progress are doubly so. So in accordance with suggestions on that thread, I wanted to request the question be undeleted, so that I may finish my edits. But just one problem...

How can I recover my unsaved in-progress text?

Reloading the page and re-initiating the edit on the answer does not pull up the draft (unlike a new answer, which gets drafts saved). Users with 10K rep can see deleted questions and answers, but have no power to see drafts which were never submitted. Right-clicking and using the HTML inspector has not yielded any success either, though I may just need to navigate to the right DOM node.

Are there any other options? Maybe some javascript I can execute in the browser's console? It's Safari, FYI.

Edit: as of today, 30 Nov 2017, it seems that the software has changed. Now when you're editing an answer to a question that's been deleted, the page gets updated with a banner with the message "This question has been deleted - no more answers will be accepted", not an overlay. But you are no longer locked out of your textarea, so if you want to recover your text, you can just highlight and copy. The browser shenanigans are no longer necessary.

$\endgroup$
5
  • $\begingroup$ Perhaps you should get the Question reference ID from the URL (or simply post the entire URL). Only 10K users will be able to see the deleted Question and your Answer, but surely one will be agreeable to retrieve the text for you. Also you could post in the canonical thread for requests to undelete, reopen, reclose, etc. $\endgroup$
    – hardmath
    Commented Nov 18, 2017 at 5:13
  • 2
    $\begingroup$ @hard, OP did post in the requests to undelete, etc., thread, and the question has been undeleted, so all is good. $\endgroup$ Commented Nov 18, 2017 at 5:15
  • $\begingroup$ But now John Ma suggests it's a duplicate, and should be closed anyway. $\endgroup$ Commented Nov 18, 2017 at 12:08
  • 1
    $\begingroup$ @hardmath The problem is, a 10K user will only be able to see the previously submitted deleted answer. No one will be able to see my in progress edits, which were never submitted and saved to the thread. They only exist in some hidden state in my browser. Recovering these is what this question is about. $\endgroup$
    – ziggurism
    Commented Nov 18, 2017 at 13:37
  • 2
    $\begingroup$ @GerryMyerson the undeletion did take place, but this did not cause my in progress edits to be restored. I was able to recover them through browser shenanigans though. My edits are now saved, so even if the question is closed, by work is not deleted. so as you say, all is good. $\endgroup$
    – ziggurism
    Commented Nov 18, 2017 at 13:45

1 Answer 1

5
$\begingroup$

I was able eventually to find the correct HTML node for the textarea containing my unsaved text in the DOM inspector. However the value of this element in the DOM inspector shows only the text contained upon pageload, not the current rendered value, my unsaved draft text. However the javascript console does give the current value.

So in Safari, right-click the <textarea> containing the edited text, and choose "inspect element" (I believe similar tools are included with Firefox and Chrome, which should make this method work). The resulting DOM inspector shows the original text contents of the textarea at the time the page was loaded, and does not include my edits. However copying the id value from the element (eg <textarea id="abc123"...>), and then going to the console tab of the HTML inspector, and entering document.getElementById('abc123') returned the current draft of displayed on the page. All backslashes were escaped in the javascript string, which was annoying to undo manually (probably can make javascript do this for me?), but I got my edits back and am happy. Thanks.

$\endgroup$
6
  • 2
    $\begingroup$ It is not rare that user's who delete their Questions after receiving valid Answers are overruled by the Community, either in the form of voting by 10K users whose attention is called to the situation or by submitting a flag to a Moderator. $\endgroup$
    – hardmath
    Commented Nov 18, 2017 at 5:16
  • $\begingroup$ This seems rather browser specific. $\endgroup$ Commented Nov 18, 2017 at 7:21
  • 2
    $\begingroup$ @MichaelGreinecker yes, this answer should specify which browser it is for. However in my experience both Chrome and Firefox have inspectors which work in much the same way. Not sure about IE/Edge. $\endgroup$
    – ziggurism
    Commented Nov 18, 2017 at 13:17
  • 2
    $\begingroup$ +1 This is browser specific but it is good to know such a way does exist. $\endgroup$ Commented Nov 18, 2017 at 14:11
  • $\begingroup$ It's also machine-specific, as "right-click" is a foreign term to those of us in the Mac universe. But, yes, it's good to know it can be done. $\endgroup$ Commented Nov 18, 2017 at 21:07
  • $\begingroup$ @GerryMyerson I’m of course on a Mac, using a trackpad, where this action is a two-fingered click. But I still call it “right click” for some reason. I wonder whether there is a platform agnostic way to say it? Contextual menu? $\endgroup$
    – ziggurism
    Commented Nov 18, 2017 at 22:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .