diff --git a/apps/presentor/interface.html b/apps/presentor/interface.html index a3c0fd890..ac748a9f9 100644 --- a/apps/presentor/interface.html +++ b/apps/presentor/interface.html @@ -135,7 +135,12 @@ } function save() { - cmpStr = getJSON(); + let savestr = getJSON(); + Util.showModal('Saving...'); + Puck.write(`\x10require('Storage').writeJSON(${JSON.stringify('presentor.json')},${savestr})\n`,()=>{ + Util.hideModal(); + }); + cmpStr = savestr; } function loadJSON(str) { @@ -146,6 +151,14 @@ } } + function load() { + Util.showModal('Loading...'); + Puck.eval(`require('Storage').readJSON(${JSON.stringify('presentor.json')})`,data => { + Util.hideModal(); + loadJSON(data); + }); + } + function addFormPPart(partData = {}) { let part = document.createElement('div'); part.classList.add('ppartrow'); @@ -241,8 +254,9 @@ document.getElementById('loader').style.display = 'none'; // load from watch first. - let qq = `[{"subject":"Hello","minutes":55,"seconds":4,"notes":""},{"subject":"dsfafds","minutes":4,"seconds":33,"notes":"fdasdfsafasfsd"},{"subject":"dsadsf","minutes":0,"seconds":4,"notes":""},{"subject":"sdasf","minutes":0,"seconds":0,"notes":""}]`; - loadJSON(qq); + // let qq = `[{"subject":"Hello","minutes":55,"seconds":4,"notes":""},{"subject":"dsfafds","minutes":4,"seconds":33,"notes":"fdasdfsafasfsd"},{"subject":"dsadsf","minutes":0,"seconds":4,"notes":""},{"subject":"sdasf","minutes":0,"seconds":0,"notes":""}]`; + // loadJSON(qq); + load(); addFormPPart(); // load empty element on startup