✌️
This commit is contained in:
		
							parent
							
								
									cc07e85ef4
								
							
						
					
					
						commit
						8512e3046a
					
				
					 1 changed files with 15 additions and 13 deletions
				
			
		| 
						 | 
					@ -105,7 +105,10 @@
 | 
				
			||||||
			display block
 | 
								display block
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			> p
 | 
								> p
 | 
				
			||||||
 | 
									margin 0
 | 
				
			||||||
 | 
									padding 16px
 | 
				
			||||||
				text-align center
 | 
									text-align center
 | 
				
			||||||
 | 
									color #aaa
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			> div
 | 
								> div
 | 
				
			||||||
				height calc(100% - 38px)
 | 
									height calc(100% - 38px)
 | 
				
			||||||
| 
						 | 
					@ -237,15 +240,12 @@
 | 
				
			||||||
		this.form = this.opts.form;
 | 
							this.form = this.opts.form;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.reply = () => {
 | 
							this.reply = () => {
 | 
				
			||||||
			this.form.update({
 | 
								this.form.refs.text.value = `>>${ this.post.index } `;
 | 
				
			||||||
				reply: this.post
 | 
					 | 
				
			||||||
			});
 | 
					 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
	</script>
 | 
						</script>
 | 
				
			||||||
</mk-channel-post>
 | 
					</mk-channel-post>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<mk-channel-form>
 | 
					<mk-channel-form>
 | 
				
			||||||
	<p if={ reply }><b>>>{ reply.index }</b> ({ reply.user.name }): <a onclick={ clearReply }>[x]</a></p>
 | 
					 | 
				
			||||||
	<input ref="text" disabled={ wait } onkeydown={ onkeydown } placeholder="書いて">
 | 
						<input ref="text" disabled={ wait } onkeydown={ onkeydown } placeholder="書いて">
 | 
				
			||||||
	<style>
 | 
						<style>
 | 
				
			||||||
		:scope
 | 
							:scope
 | 
				
			||||||
| 
						 | 
					@ -272,14 +272,7 @@
 | 
				
			||||||
	<script>
 | 
						<script>
 | 
				
			||||||
		this.mixin('api');
 | 
							this.mixin('api');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.clearReply = () => {
 | 
					 | 
				
			||||||
			this.update({
 | 
					 | 
				
			||||||
				reply: null
 | 
					 | 
				
			||||||
			});
 | 
					 | 
				
			||||||
		};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		this.clear = () => {
 | 
							this.clear = () => {
 | 
				
			||||||
			this.clearReply();
 | 
					 | 
				
			||||||
			this.refs.text.value = '';
 | 
								this.refs.text.value = '';
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -292,9 +285,18 @@
 | 
				
			||||||
				wait: true
 | 
									wait: true
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								let text = this.refs.text.value;
 | 
				
			||||||
 | 
								let reply = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (/^>>([0-9]+) /.test(text)) {
 | 
				
			||||||
 | 
									const index = text.match(/^>>([0-9]+) /)[1];
 | 
				
			||||||
 | 
									reply = this.parent.posts.find(p => p.index.toString() == index);
 | 
				
			||||||
 | 
									text = text.replace(/^>>([0-9]+) /, '');
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			this.api('posts/create', {
 | 
								this.api('posts/create', {
 | 
				
			||||||
				text: this.refs.text.value,
 | 
									text: text,
 | 
				
			||||||
				reply_id: this.reply ? this.reply.id : undefined,
 | 
									reply_id: reply ? reply.id : undefined,
 | 
				
			||||||
				channel_id: this.parent.channel.id
 | 
									channel_id: this.parent.channel.id
 | 
				
			||||||
			}).then(data => {
 | 
								}).then(data => {
 | 
				
			||||||
				this.clear();
 | 
									this.clear();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue