Add ability to restore drafts
This commit is contained in:
parent
4097e79bbb
commit
74c9bcf213
3 changed files with 13 additions and 2 deletions
2
app.py
2
app.py
|
|
@ -32,7 +32,7 @@ try:
|
|||
except ImportError:
|
||||
slugify = None
|
||||
|
||||
__version__ = '0.5-dev'
|
||||
__version__ = '0.5'
|
||||
|
||||
#### CONSTANTS ####
|
||||
|
||||
|
|
|
|||
|
|
@ -8,14 +8,17 @@
|
|||
var textInput = getFirst(document.getElementsByClassName('text-input'));
|
||||
var overTextInput = getFirst(document.getElementsByClassName('over-text-input'));
|
||||
|
||||
// TODO saving draft
|
||||
// saving draft
|
||||
var autosaveInterval = null;
|
||||
|
||||
page_info.editing = page_info.editing || {};
|
||||
|
||||
overTextInput.innerHTML = [
|
||||
'<span class="oti-modified"> </span>',
|
||||
'<span class="oti-charcount">? chars</span>',
|
||||
'<span class="oti-fontselect"><select><option value="sans">Sans-serif</option><option value="serif">Serif</option><option value="monospace">Monospace</option></select></span>',
|
||||
//'<span class="oti-linkpage">Link page</span>',
|
||||
'<span class="oti-draft">' + (localStorage.getItem('draft' + (page_info.editing.page_id || 'new')) !== null? '<a href="javascript:restoreDraft();">Draft found</a>': '') + '</span>'
|
||||
].join(' ');
|
||||
|
||||
// character counter
|
||||
|
|
@ -72,7 +75,13 @@
|
|||
// TODO tag editor
|
||||
var tagsInput = getFirst(document.getElementsByClassName('tags-input'));
|
||||
|
||||
// draft management
|
||||
function autosaveText(){
|
||||
localStorage.setItem('draft' + (page_info.editing.page_id || 'new'), textInput.value);
|
||||
}
|
||||
|
||||
window.restoreDraft = function(){
|
||||
textInput.value = localStorage.getItem('draft' + (page_info.editing.page_id || 'new'));
|
||||
overTextInput.querySelector('.oti-draft').innerHTML = '';
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ body{font-family:sans-serif;background-color:#faf5e9}
|
|||
.inner-content h1{color: #99081f}
|
||||
.inner-content table {font-family: sans-serif}
|
||||
.inner-content h2, .inner-content h3, .inner-content h4, .inner-content h5, .inner-content h6{font-family:sans-serif; color: black; font-weight: normal}
|
||||
.inner-content h2{border-bottom: 1px solid black}
|
||||
.inner-content h3{margin:0.8em 0}
|
||||
.inner-content h4{margin:0.6em 0}
|
||||
.inner-content h5{margin:0.5em 0}
|
||||
|
|
@ -128,6 +129,7 @@ a:hover{color:#0088ff}
|
|||
body.dark, .dark input, .dark textarea{background-color: #1f1f1f; color: white}
|
||||
.dark .inner-content{color: #e5e5e5}
|
||||
.dark .inner-content em,.dark .inner-content strong,.dark .inner-content h2,.dark .inner-content h3,.dark .inner-content h4,.dark .inner-content h5,.dark .inner-content h6,.dark .inner-content table{color: white}
|
||||
.dark .inner-content h2 {border-bottom-color: white}
|
||||
.dark .inner-content h1{color:#ff4860}
|
||||
.dark .inner-content blockquote{color:#cecece;border-left-color:#555}
|
||||
.dark .inner-content table,.dark .inner-content table > * > tr > th,.dark .inner-content table > * > tr > td,.dark .inner-content table > tr > th,.dark .inner-content table > tr > td{border-color:#555}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue