Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion content/src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ function updateTopControls(addHistory) {
label: 'Save',
menu: [
{ id: 'save2', label: 'Save' },
{ id: 'saveas', label: 'Copy and Save As...' }
{ id: 'saveas', label: 'Copy and Save As...' },
{ id: 'download',label: 'Save code on local machine'},
{ id: 'download1', label: 'Download Html and Css'}
],
disabled: !cansave(),
}, {
Expand Down Expand Up @@ -523,6 +525,16 @@ $(window).on('beforeunload', function() {
return "There are unsaved changes."
}
});
//Saves the Main code on our local machine
view.on('download', function() {
uriContent = "data:application/octet-stream," + encodeURIComponent("Main Code"+"\n\n"+newdata.data);
window.open(uriContent, 'neuesDokument');
});
//Saves HTML and CSS on your local machine
view.on('download1', function() {
urlContent = "data:application/octet-stream," + encodeURIComponent("HTML"+"\n\n"+window.downloadhtml+"\n\n"+"CSS"+"\n\n"+window.downloadcss);
window.open(urlContent, 'neuesDokument');
});

view.on('logout', function() {
model.username = null;
Expand Down
5 changes: 4 additions & 1 deletion content/src/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ function htmlEscape(s) {
return s.replace(/[<>&"]/g, function(c) {
return c=='<'?'&lt;':c=='>'?'&gt;':c=='&'?'&amp;':'&quot;';});
}

var downloadhtml;
var downloadcss;
// The view has three panes, #left, #right, and #back (the offscreen pane).
//
// Any of the three panes can show:
Expand Down Expand Up @@ -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) {
Expand Down