summaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-11-01 16:42:15 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-11-01 16:42:15 +0900
commit86901b68b84bb68167c6a3d8cd043e63ba66bed2 (patch)
tree361c388bf7e08cd62afab94e2667afe461b8b927 /src/web
parentwip (diff)
downloadsharkey-86901b68b84bb68167c6a3d8cd043e63ba66bed2.tar.gz
sharkey-86901b68b84bb68167c6a3d8cd043e63ba66bed2.tar.bz2
sharkey-86901b68b84bb68167c6a3d8cd043e63ba66bed2.zip
いい感じに
Diffstat (limited to 'src/web')
-rw-r--r--src/web/app/ch/tags/channel.tag30
1 files changed, 28 insertions, 2 deletions
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 @@
<mk-channel-form>
<p if={ reply }><b>&gt;&gt;{ reply.index }</b> ({ reply.user.name }): <a onclick={ clearReply }>[x]</a></p>
- <textarea ref="text" disabled={ wait }></textarea>
+ <textarea ref="text" disabled={ wait } oninput={ update } onkeydown={ onkeydown } onpaste={ onpaste }></textarea>
<button class={ wait: wait } ref="submit" disabled={ wait || (refs.text.value.length == 0) } onclick={ post }>
{ wait ? 'やってます' : 'やる' }<mk-ellipsis if={ wait }/>
</button>
<br>
<button onclick={ drive }>ドライブ</button>
+ <mk-uploader ref="uploader"/>
<ol if={ files }>
<li each={ files }>{ name }</li>
</ol>
@@ -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());
+ }
+ });
+ };
</script>
</mk-channel-form>