Gives back the half-written dump when the dump creation modal is closed by mistake, with Escape or a click outside. It is kept in localStorage, all but an attached file, which can't be stored.

There is one draft, not one per tab: whoever closed the modal by mistake wants back what they were just writing, wherever they reopen it.

Functions

f
clearDumpDraft(): void

Removes the stored draft, once the dump is posted or the poster chose to start afresh.

f
isDumpDraftEmpty(draft: DumpDraft): boolean

Checks whether draft holds nothing worth restoring. A title taken from the preview doesn't count, since the preview gives it back.

f
loadDumpDraft(): DumpDraft | null

Returns the stored draft, or null when there is none worth restoring or storage is blocked. A field that doesn't parse takes its empty value.

f
saveDumpDraft(draft: DumpDraft): void

Stores draft, or removes the stored one when draft is empty. A failure is silent: the draft is a convenience, never a precondition for posting.

Interfaces

I
DumpDraft

Saved by DumpCreateModal on every change, and restored when it next opens without a shared link. Posting the dump clears it.

Variables

v
EMPTY_DUMP_DRAFT: DumpDraft

The modal's starting values, when no draft is restored.