add local storage
This commit is contained in:
parent
30a6e277bc
commit
5a932cc8a8
@ -93,10 +93,17 @@ editor.getSession().setMode("ace/mode/markdown")
|
|||||||
editor.getSession().setUseWrapMode(true)
|
editor.getSession().setUseWrapMode(true)
|
||||||
editor.renderer.setShowPrintMargin(false)
|
editor.renderer.setShowPrintMargin(false)
|
||||||
|
|
||||||
|
# do we have anything saved?
|
||||||
|
if essay = localStorage?.getItem('essay')
|
||||||
|
editor.getSession().setValue(essay)
|
||||||
|
|
||||||
refreshTimer = null
|
refreshTimer = null
|
||||||
editor.getSession().on 'change', ->
|
editor.getSession().on 'change', ->
|
||||||
clearTimeout(refreshTimer)
|
clearTimeout(refreshTimer)
|
||||||
refreshTimer = setTimeout(refresh, 1000)
|
refreshTimer = setTimeout(->
|
||||||
|
refresh()
|
||||||
|
localStorage?.setItem('essay', editor.getSession().getValue())
|
||||||
|
, 1000)
|
||||||
|
|
||||||
window.refresh = ->
|
window.refresh = ->
|
||||||
stream = blobStream()
|
stream = blobStream()
|
||||||
|
Loading…
Reference in New Issue
Block a user