Add client drafts, add app version to template
This commit is contained in:
parent
e3e9d844c6
commit
c53cc54d1a
3 changed files with 20 additions and 8 deletions
|
|
@ -7,6 +7,9 @@
|
|||
|
||||
var textInput = getFirst(document.getElementsByClassName('text-input'));
|
||||
var overTextInput = getFirst(document.getElementsByClassName('over-text-input'));
|
||||
|
||||
// TODO saving draft
|
||||
var autosaveInterval = null;
|
||||
|
||||
overTextInput.innerHTML = [
|
||||
'<span class="oti-modified"> </span>',
|
||||
|
|
@ -22,8 +25,9 @@
|
|||
if(newText != oldText){
|
||||
oldText = newText;
|
||||
|
||||
overTextInput.children[0].innerHTML = newText == originalText? ' ' : '(*)';
|
||||
overTextInput.children[0].innerHTML = newText === originalText? ' ' : '(*)';
|
||||
overTextInput.children[1].innerHTML = newText.length + ' char' + (newText.length == 1? '' : 's');
|
||||
if (!autosaveInterval) autosaveInterval = setInterval(autosaveText, 30000);
|
||||
}
|
||||
}
|
||||
overTextInput.children[1].innerHTML = originalText.length + ' char' + (originalText.length == 1? '' : 's');
|
||||
|
|
@ -53,6 +57,7 @@
|
|||
var saveButton = document.getElementById('save-button');
|
||||
saveButton.onclick = function(){
|
||||
window.onbeforeunload = null;
|
||||
localStorage.removeItem('draft' + (page_info.editing.page_id || 'new'));
|
||||
}
|
||||
var previewButton = document.getElementById('preview-button');
|
||||
previewButton.onclick = function(){
|
||||
|
|
@ -66,4 +71,8 @@
|
|||
|
||||
// TODO tag editor
|
||||
var tagsInput = getFirst(document.getElementsByClassName('tags-input'));
|
||||
|
||||
function autosaveText(){
|
||||
localStorage.setItem('draft' + (page_info.editing.page_id || 'new'), textInput.value);
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue