This commit is contained in:
syuilo 2017-02-20 14:51:19 +09:00
parent 02be6a08f9
commit b0c1ec3124
3 changed files with 17 additions and 19 deletions

View File

@ -50,7 +50,7 @@
this.mixin('api'); this.mixin('api');
this.mixin('i'); this.mixin('i');
this.close = (e) => { this.close = e => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@ -61,7 +61,6 @@
no_donation: this.I.data.no_donation no_donation: this.I.data.no_donation
this.unmount(); this.unmount();
};
this.parent.parent.set-root-layout!
</script> </script>
</mk-donation> </mk-donation>

View File

@ -21,7 +21,7 @@
<style> <style>
:scope :scope
display block display block
position fixed position sticky
top 0 top 0
z-index 1024 z-index 1024
width 100% width 100%

View File

@ -9,29 +9,28 @@
<style> <style>
:scope :scope
display block display block
</style> </style>
<script> <script>
this.mixin('i'); this.mixin('i');
this.open-post-form = () => { this.openPostForm = () => {
riot.mount document.body.appendChild document.createElement 'mk-post-form-window' riot.mount(document.body.appendChild(document.createElement('mk-post-form-window');
};
this.set-root-layout = () => {
this.root.style.padding-top = this.refs.header.root.client-height + 'px'
this.on('mount', () => { this.on('mount', () => {
@set-root-layout! document.addEventListener('keydown', this.onkeydown);
document.addEventListener 'keydown' this.onkeydown });
this.on('unmount', () => { this.on('unmount', () => {
document.removeEventListener 'keydown' this.onkeydown document.removeEventListener('keydown', this.onkeydown);
});
this.onkeydown = (e) => { this.onkeydown = e => {
tag = e.target.tag-name.to-lower-case! if (e.target.tagName == 'input' || e.target.tagName == 'textarea') return;
if tag != 'input' and tag != 'textarea'
if e.which == 80 or e.which == 78 // p or n if (e.which == 80 || e.which == 78) { // p or n
e.preventDefault(); e.preventDefault();
@open-post-form! this.openPostForm();
};
</script> </script>
</mk-ui> </mk-ui>