diff options
author | zotlabs <mike@macgirvin.com> | 2018-04-25 21:32:34 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-04-25 21:32:34 -0700 |
commit | 4409b2b40a2c088ede7b23ae19cd1d56f8db3c78 (patch) | |
tree | 9184d6fdfcf6b77c7d14911100558bbb1c5f5395 /view/tpl/jot-header.tpl | |
parent | 33f446fcd0992ad1bf1cb9fc04b6874101461e67 (diff) | |
download | volse-hubzilla-4409b2b40a2c088ede7b23ae19cd1d56f8db3c78.tar.gz volse-hubzilla-4409b2b40a2c088ede7b23ae19cd1d56f8db3c78.tar.bz2 volse-hubzilla-4409b2b40a2c088ede7b23ae19cd1d56f8db3c78.zip |
don't load jot autosave content into other document types or edits of other items, but do save these edits in case you need to recover them
Diffstat (limited to 'view/tpl/jot-header.tpl')
-rwxr-xr-x | view/tpl/jot-header.tpl | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index 991a4c8b1..df67e9b2d 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -568,11 +568,14 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del function postSaveChanges(action, type) { if({{$auto_save_draft}}) { + var doctype = $('#jot-webpage').val(); + var postid = '-' + doctype + '-' + $('#jot-postid').val(); + if(action != 'clean') { - localStorage.setItem("post_title", $("#jot-title").val()); - localStorage.setItem("post_body", $("#profile-jot-text").val()); + localStorage.setItem("post_title" + postid, $("#jot-title").val()); + localStorage.setItem("post_body" + postid, $("#profile-jot-text").val()); if($("#jot-category").length) - localStorage.setItem("post_category", $("#jot-category").val()); + localStorage.setItem("post_category + postid", $("#jot-category").val()); } if(action == 'start') { @@ -589,9 +592,9 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del if(action == 'clean') { clearTimeout(postSaveTimer); postSaveTimer = null; - localStorage.removeItem("post_title"); - localStorage.removeItem("post_body"); - localStorage.removeItem("post_category"); + localStorage.removeItem("post_title" + postid); + localStorage.removeItem("post_body" + postid); + localStorage.removeItem("post_category" + postid); } } @@ -602,9 +605,11 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del var cleaned = false; if({{$auto_save_draft}}) { - var postTitle = localStorage.getItem("post_title"); - var postBody = localStorage.getItem("post_body"); - var postCategory = (($("#jot-category").length) ? localStorage.getItem("post_category") : ''); + var doctype = $('#jot-webpage').val(); + var postid = '-' + doctype + '-' + $('#jot-postid').val(); + var postTitle = localStorage.getItem("post_title" + postid); + var postBody = localStorage.getItem("post_body" + postid); + var postCategory = (($("#jot-category").length) ? localStorage.getItem("post_category" + postid) : ''); var openEditor = false; if(postTitle) { |