Skip to content

Commit

Permalink
Merge pull request #7 from michael-silva/master
Browse files Browse the repository at this point in the history
Move the color dialog to document root
  • Loading branch information
Link2Twenty authored Dec 8, 2017
2 parents 72fcfd1 + cab5784 commit 7193cc1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bower_components
21 changes: 12 additions & 9 deletions l2t-paper-color.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@
<iron-icon icon="label" slot="prefix"></iron-icon>
<iron-icon icon="image:palette" slot="suffix"></iron-icon>
</paper-input>
<l2t-paper-color-dialog
colors="{{colors}}"
hide-advanced$="[[hideAdvanced]]">
</l2t-paper-color-dialog>

</template>

Expand Down Expand Up @@ -140,7 +136,8 @@
*/
_dialogHandler(e) {
if(e.detail) {
this.value = this.shadowRoot.querySelector('l2t-paper-color-dialog').color;
this.value = this.colorDialog.color;
this.dispatchEvent(new CustomEvent('change'));
}
}
/**
Expand All @@ -150,13 +147,19 @@
if(this.readonly)
return

var colorDialog = this.shadowRoot.querySelector('l2t-paper-color-dialog');
colorDialog.color=this.value||colorDialog.color;
colorDialog.open();
this.colorDialog.color = this.value||this.colorDialog.color;
this.colorDialog.open();
}
_createDialog() {
this.colorDialog = document.createElement('l2t-paper-color-dialog');
this.colorDialog.colors = this.colors;
this.colorDialog.hideAdvanced = this.hideAdvanced;
document.body.appendChild(this.colorDialog);
}
ready(){
super.ready();
this.addEventListener("paper-color-dialog-closed", function(e){this._dialogHandler(e)}, false);
this._createDialog();
this.colorDialog.addEventListener("paper-color-dialog-closed", (e) => this._dialogHandler(e), false);
}
}

Expand Down
7 changes: 7 additions & 0 deletions polymer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"lint": {
"rules": [
"polymer-2"
]
}
}

0 comments on commit 7193cc1

Please sign in to comment.