diff --git a/elements/designer-element/designer-element.html b/elements/designer-element/designer-element.html
index 27b37107..011a792b 100644
--- a/elements/designer-element/designer-element.html
+++ b/elements/designer-element/designer-element.html
@@ -9,7 +9,7 @@
-
+
@@ -63,8 +63,8 @@
-
+
@@ -73,9 +73,6 @@
Polymer('designer-element', {
selected: 'design',
remoteHtml: '',
- fileName: 'designer.html',
- githubUser: 'designer-polymer',
- githubToken: '77777d8808da580cd6134b7390b5fd306c66d1d6',
ready: function() {
document.addEventListener('keydown',
@@ -208,7 +205,7 @@
saveAction: function() {
var options = {};
- options[this.fileName] = {content: this.html};
+ options[this.$.githubInfo.fileName] = {content: this.html};
if (this.fileId) {
this.$.github.update(this.fileId, 'designer', true, options);
} else {
@@ -238,7 +235,7 @@
},
documentLoaded: function(event, detail) {
- var doc = detail && detail[this.fileName];
+ var doc = detail && detail[this.$.githubInfo.fileName];
if (doc) {
this.remoteHtml = doc.content;
}
@@ -272,15 +269,16 @@
},
getGistUrl: function() {
- return 'https://gist.github.com/' + this.githubUser + '/' + this.fileId;
+ return 'https://gist.github.com/' + this.$.githubInfo.user + '/' + this.fileId;
},
previewAction: function() {
- var html = this.html;
- // TODO(sorvell): need a better way to inject the element
- var name = this.designer.$.canvas.designHost.name;
- html += '\n\n<' + name + '>' + name + '>\n';
- this.$.preview.open(html);
+ if (this.fileId) {
+ if (this.previewWindow) {
+ this.previewWindow.close();
+ }
+ this.previewWindow = window.open('preview.html#' + this.fileId, 'preview');
+ }
}
});
diff --git a/elements/x-preview/x-gist-element-preview.html b/elements/x-preview/x-gist-element-preview.html
index 1123ca2d..cbd66e68 100644
--- a/elements/x-preview/x-gist-element-preview.html
+++ b/elements/x-preview/x-gist-element-preview.html
@@ -4,9 +4,9 @@
license that can be found in the LICENSE file.
-->
+
-
diff --git a/elements/x-preview/x-preview.html b/elements/x-preview/x-preview.html
index 73508aff..f2dd02c1 100644
--- a/elements/x-preview/x-preview.html
+++ b/elements/x-preview/x-preview.html
@@ -50,16 +50,18 @@
outputPreviewHTML: function() {
var url = new URL(document.baseURI);
- url.pathname += 'components/element/';
- url = url.origin + url.pathname;
+ var path = url.pathname.split('/');
+ path.pop();
+ path = path.join('/');
+ path += '/components/element/';
+ url = url.origin + path;
// put base href in head
var h = '\n';
return this.makeOutputHTML(h, this.htmlContent);
},
- makeOutputLink: function() {
- var dataUrl = 'data:text/html;base64,';
- return dataUrl + btoa(this.outputSource());
+ makeLink: function(html) {
+ return 'data:text/html;base64,' + btoa(html);
},
makeOutputHTML: function(head, body) {
@@ -72,6 +74,7 @@
// style
html += '
+
-
+
+