diff --git a/content/src/controller.js b/content/src/controller.js index 73f5d5dc..07bde499 100644 --- a/content/src/controller.js +++ b/content/src/controller.js @@ -334,7 +334,7 @@ view.on('share', function() { var shortfilename = modelatpos('left').filename.replace(/^.*\//, ''); if (!shortfilename) { shortfilename = 'clip'; } var doc = view.getPaneEditorData(paneatpos('left')); - if (isEmptyDoc(doc)) { return; } + if(newdata.data===''){shareAction();} // First save if needed (including login user if necessary) if (view.isPaneEditorDirty(paneatpos('left'))) { saveAction(false, 'Log in to share', shareAction); @@ -358,7 +358,7 @@ view.on('share', function() { // There is no editor on the left (or it is misbehaving) - do nothing. console.log("Nothing to share."); return; - } else if (doc.data !== '') { // If program is not empty, generate thumbnail. + } else if (doc.data !== '' || (newdata.data ==='' && window.downloadhtml!=='') || (newdata.data ==='' && window.downloadcss!=='')) { // If program is not empty, generate thumbnail. if (model.tempThumbnail) { postThumbnailGeneration(model.tempThumbnail); } else { diff --git a/content/src/view.js b/content/src/view.js index 1b9c6cca..152bd17a 100644 --- a/content/src/view.js +++ b/content/src/view.js @@ -18,7 +18,8 @@ function htmlEscape(s) { return s.replace(/[<>&"]/g, function(c) { return c=='<'?'<':c=='>'?'>':c=='&'?'&':'"';}); } - +var downloadhtml; +var downloadcss; // The view has three panes, #left, #right, and #back (the offscreen pane). // // Any of the three panes can show: @@ -2924,9 +2925,11 @@ function updateMeta(paneState) { // Grab the html and the CSS from the editors. if (paneState.htmlEditor) { paneState.meta.html = paneState.htmlEditor.getValue(); + window.downloadhtml=paneState.meta.html; } if (paneState.cssEditor) { paneState.meta.css = paneState.cssEditor.getValue(); + window.downloadcss=paneState.meta.css; } } function getPaneEditorData(pane) {