diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag index 602b80bc11..fdc9ab4cef 100644 --- a/src/web/app/ch/tags/channel.tag +++ b/src/web/app/ch/tags/channel.tag @@ -182,12 +182,13 @@

>>{ reply.index } ({ reply.user.name }): [x]

- +
+
  1. { name }
@@ -202,6 +203,19 @@ this.mixin('api'); this.channel = this.opts.channel; + this.files = null; + + this.on('mount', () => { + this.refs.uploader.on('uploaded', file => { + this.update({ + files: [file] + }); + }); + }); + + this.upload = file => { + this.refs.uploader.upload(file); + }; this.clearReply = () => { this.update({ @@ -217,7 +231,7 @@ this.refs.text.value = ''; }; - this.post = e => { + this.post = () => { this.update({ wait: true }); @@ -250,5 +264,17 @@ }; window.open(CONFIG.url + '/selectdrive?multiple=true', '_blank'); }; + + this.onkeydown = e => { + if ((e.which == 10 || e.which == 13) && (e.ctrlKey || e.metaKey)) this.post(); + }; + + this.onpaste = e => { + e.clipboardData.items.forEach(item => { + if (item.kind == 'file') { + this.upload(item.getAsFile()); + } + }); + };