Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
allow saving from code view.
Browse files Browse the repository at this point in the history
  • Loading branch information
sorvell committed Apr 11, 2014
1 parent 0c197bd commit 31009d2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions elements/designer-element/designer-element.html
Expand Up @@ -176,12 +176,16 @@
return this.$.serializer.dumpElement(this.designer.$.canvas);
},

get code() {
return this.$.code.mirror.getValue();
},

designToCode: function() {
this.$.code.mirror.setValue(this.html);
},

codeToDesign: function() {
this.pendingHtml = this.$.code.mirror.getValue();
this.pendingHtml = this.code;
this.reloadDesigner();
},

Expand All @@ -205,7 +209,8 @@

saveAction: function() {
var options = {};
options[this.$.githubInfo.fileName] = {content: this.html};
var content = this.selected === 'code' ? this.code : this.html;
options[this.$.githubInfo.fileName] = {content: content};
if (this.fileId) {
this.$.github.update(this.fileId, 'designer', true, options);
} else {
Expand Down

0 comments on commit 31009d2

Please sign in to comment.