Fix auto save content

parent 4674c089
......@@ -23,6 +23,9 @@
for the JavaScript code in this page.
*/
window.addEventListener('touchstart', {}); // in top window
window.addEventListener('touchmove', {}); // in top window
document.addEventListener('DOMContentLoaded', function() {
let sidenav = document.querySelectorAll('.sidenav');
let mboxed = document.querySelectorAll('.materialboxed');
......
......@@ -27,12 +27,9 @@ var children_nodes;
var quill;
var url_name;
var article_oid;
setInterval(_=>{ if (typeof quill !== 'undefined') localStorage.setItem('colt.saved_content', quill.root.innerHTML); }, 1000);
window.addEventListener('touchstart', {}); // in top window
function new_post(obj) {
let article_title = $('#edit-article-title')[0];
let article_title = document.getElementById('edit-article-title');
hljs.configure({
languages: ['javascript', 'ruby', 'python', 'lua', 'erlang',
'c++', 'scheme', 'rust', 'haskell', 'bash']
......@@ -52,12 +49,7 @@ function new_post(obj) {
theme: 'snow'
});
if (typeof article_title !== "undefined" &&
article_title !== null &&
"" === article_title.value) {
quill.root.innerHTML = localStorage.getItem('colt.saved_content');
}
quill.root.innerHTML = localStorage.getItem('colt.saved_content');
setInterval(_=>{ localStorage.setItem('colt.saved_content', quill.root.innerHTML); }, 1000);
}
......@@ -111,7 +103,7 @@ function cancel_edit() {
}
function show_msg_layer(msg) {
let ml = $('#msg-layer')[0];
let ml = document.getElementById('msg-layer');
ml.innerHTML = msg;
ml.classList.add('msg-layer');
ml.addEventListener('click', function (e) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment