From 8549db6c95724f60214137707cd2619798902fba Mon Sep 17 00:00:00 2001 From: Amay Agrawal Date: Sun, 10 Jan 2016 03:15:08 +0530 Subject: [PATCH 1/4] Update controller.js --- content/src/controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/src/controller.js b/content/src/controller.js index 73f5d5dc..09ed9866 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 { From e974cccc17cc43ca7bcf7347faf87a497ca0bfd7 Mon Sep 17 00:00:00 2001 From: Amay Agrawal Date: Sun, 10 Jan 2016 03:20:20 +0530 Subject: [PATCH 2/4] Update view.js --- content/src/view.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) { From 164685eb8e4c699e9387e0b71c7581f13dff156c Mon Sep 17 00:00:00 2001 From: Amay Agrawal Date: Mon, 11 Jan 2016 00:59:22 +0530 Subject: [PATCH 3/4] Update controller.js --- content/src/controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/src/controller.js b/content/src/controller.js index 09ed9866..01425fd3 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(newdata.data===''){shareAction();} + 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 !== '' || (newdata.data==='' && window.downloadhtml!=='') || (newdata.data==='' && window.downloadcss!=='')) { // 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 { From 7d7403df46b0933764233518587222cfb7abeaa7 Mon Sep 17 00:00:00 2001 From: Amay Agrawal Date: Mon, 11 Jan 2016 01:19:09 +0530 Subject: [PATCH 4/4] Update controller.js --- content/src/controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/src/controller.js b/content/src/controller.js index 01425fd3..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(newdata.data ==''){shareAction();} + 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 !== '' || (newdata.data =='' && window.downloadhtml!='') || (newdata.data =='' && window.downloadcss!='')) { // 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 {