| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  | <div class="compose-box-toolbar"> | 
					
						
							| 
									
										
										
										
											2018-03-24 18:04:54 -07:00
										 |  |  |   <div class="compose-box-toolbar-items"> | 
					
						
							|  |  |  |     <IconButton | 
					
						
							|  |  |  |       label="Insert emoji" | 
					
						
							|  |  |  |       href="#fa-smile" | 
					
						
							|  |  |  |       on:click="onEmojiClick()" | 
					
						
							|  |  |  |     /> | 
					
						
							|  |  |  |     <IconButton | 
					
						
							| 
									
										
										
										
											2018-05-01 17:05:36 -07:00
										 |  |  |       svgClassName={$uploadingMedia ? 'spin' : ''} | 
					
						
							| 
									
										
										
										
											2018-03-24 18:04:54 -07:00
										 |  |  |       label="Add media" | 
					
						
							| 
									
										
										
										
											2018-05-01 17:05:36 -07:00
										 |  |  |       href={$uploadingMedia ? '#fa-spinner' : '#fa-camera'} | 
					
						
							| 
									
										
										
										
											2018-03-24 18:04:54 -07:00
										 |  |  |       on:click="onMediaClick()" | 
					
						
							| 
									
										
										
										
											2018-05-01 17:05:36 -07:00
										 |  |  |       disabled={$uploadingMedia || (media.length === 4)} | 
					
						
							| 
									
										
										
										
											2018-03-24 18:04:54 -07:00
										 |  |  |     /> | 
					
						
							|  |  |  |     <IconButton | 
					
						
							| 
									
										
										
										
											2018-05-01 17:05:36 -07:00
										 |  |  |       label="Adjust privacy (currently {postPrivacy.label})" | 
					
						
							|  |  |  |       href={postPrivacy.icon} | 
					
						
							| 
									
										
										
										
											2018-03-24 18:04:54 -07:00
										 |  |  |       on:click="onPostPrivacyClick()" | 
					
						
							|  |  |  |     /> | 
					
						
							|  |  |  |     <IconButton | 
					
						
							| 
									
										
										
										
											2018-05-01 17:05:36 -07:00
										 |  |  |       label={contentWarningShown ? 'Remove content warning' : 'Add content warning'} | 
					
						
							| 
									
										
										
										
											2018-03-24 18:04:54 -07:00
										 |  |  |       href="#fa-exclamation-triangle" | 
					
						
							|  |  |  |       on:click="onContentWarningClick()" | 
					
						
							|  |  |  |       pressable="true" | 
					
						
							| 
									
										
										
										
											2018-05-01 17:05:36 -07:00
										 |  |  |       pressed={contentWarningShown} | 
					
						
							| 
									
										
										
										
											2018-03-24 18:04:54 -07:00
										 |  |  |     /> | 
					
						
							|  |  |  |   </div> | 
					
						
							| 
									
										
										
										
											2018-03-01 09:02:42 -08:00
										 |  |  |   <input ref:input | 
					
						
							| 
									
										
										
										
											2018-03-01 09:29:11 -08:00
										 |  |  |          on:change="onFileChange(event)" | 
					
						
							| 
									
										
										
										
											2018-03-01 09:02:42 -08:00
										 |  |  |          style="display: none;" | 
					
						
							|  |  |  |          type="file" | 
					
						
							|  |  |  |          accept=".jpg,.jpeg,.png,.gif,.webm,.mp4,.m4v,image/jpeg,image/png,image/gif,video/webm,video/mp4"> | 
					
						
							| 
									
										
										
										
											2018-05-01 17:05:36 -07:00
										 |  |  |   <ComposeAutosuggest {realm} {text} /> | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  | </div> | 
					
						
							|  |  |  | <style> | 
					
						
							|  |  |  |   .compose-box-toolbar { | 
					
						
							|  |  |  |     grid-area: toolbar; | 
					
						
							| 
									
										
										
										
											2018-03-24 18:04:54 -07:00
										 |  |  |     position: relative; | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |     align-self: center; | 
					
						
							| 
									
										
										
										
											2018-03-24 18:04:54 -07:00
										 |  |  |   } | 
					
						
							|  |  |  |   .compose-box-toolbar-items { | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |     display: flex; | 
					
						
							|  |  |  |     align-items: center; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | </style> | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  |   import IconButton from '../IconButton.html' | 
					
						
							| 
									
										
										
										
											2018-02-27 23:18:07 -08:00
										 |  |  |   import { store } from '../../_store/store' | 
					
						
							| 
									
										
										
										
											2018-04-21 09:56:53 -07:00
										 |  |  |   import { importShowEmojiDialog, importShowPostPrivacyDialog } from '../dialog/asyncDialogs' | 
					
						
							| 
									
										
										
										
											2018-03-01 21:21:49 -08:00
										 |  |  |   import { doMediaUpload } from '../../_actions/media' | 
					
						
							| 
									
										
										
										
											2018-03-03 15:44:43 -08:00
										 |  |  |   import { toggleContentWarningShown } from '../../_actions/contentWarnings' | 
					
						
							| 
									
										
										
										
											2018-03-24 18:04:54 -07:00
										 |  |  |   import ComposeAutosuggest from './ComposeAutosuggest.html' | 
					
						
							| 
									
										
										
										
											2018-02-27 23:18:07 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |   export default { | 
					
						
							| 
									
										
										
										
											2018-04-19 21:38:01 -07:00
										 |  |  |     oncreate () { | 
					
						
							| 
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 |  |  |       // for testing | 
					
						
							|  |  |  |       window.__fakeFileInput = (file) => { | 
					
						
							|  |  |  |         this.onFileChange({ | 
					
						
							|  |  |  |           target: { | 
					
						
							|  |  |  |             files: [file] | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         }) | 
					
						
							| 
									
										
										
										
											2018-03-02 17:54:38 -08:00
										 |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |     components: { | 
					
						
							| 
									
										
										
										
											2018-03-24 18:04:54 -07:00
										 |  |  |       IconButton, | 
					
						
							|  |  |  |       ComposeAutosuggest | 
					
						
							| 
									
										
										
										
											2018-02-27 23:18:07 -08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     store: () => store, | 
					
						
							|  |  |  |     methods: { | 
					
						
							| 
									
										
										
										
											2018-04-19 21:38:01 -07:00
										 |  |  |       async onEmojiClick () { | 
					
						
							| 
									
										
										
										
											2018-04-19 09:37:05 -07:00
										 |  |  |         let { realm } = this.get() | 
					
						
							| 
									
										
										
										
											2018-04-21 09:56:53 -07:00
										 |  |  |         let showEmojiDialog = await importShowEmojiDialog() | 
					
						
							|  |  |  |         showEmojiDialog(realm) | 
					
						
							| 
									
										
										
										
											2018-03-01 09:02:42 -08:00
										 |  |  |       }, | 
					
						
							| 
									
										
										
										
											2018-04-19 21:38:01 -07:00
										 |  |  |       onMediaClick () { | 
					
						
							| 
									
										
										
										
											2018-03-01 09:02:42 -08:00
										 |  |  |         this.refs.input.click() | 
					
						
							| 
									
										
										
										
											2018-03-01 09:29:11 -08:00
										 |  |  |       }, | 
					
						
							| 
									
										
										
										
											2018-04-19 21:38:01 -07:00
										 |  |  |       onFileChange (e) { | 
					
						
							| 
									
										
										
										
											2018-03-01 09:29:11 -08:00
										 |  |  |         let file = e.target.files[0] | 
					
						
							| 
									
										
										
										
											2018-04-19 09:37:05 -07:00
										 |  |  |         let { realm } = this.get() | 
					
						
							| 
									
										
										
										
											2018-03-03 10:11:32 -08:00
										 |  |  |         doMediaUpload(realm, file) | 
					
						
							| 
									
										
										
										
											2018-03-03 13:23:26 -08:00
										 |  |  |       }, | 
					
						
							| 
									
										
										
										
											2018-04-19 21:38:01 -07:00
										 |  |  |       async onPostPrivacyClick () { | 
					
						
							| 
									
										
										
										
											2018-04-19 09:37:05 -07:00
										 |  |  |         let { realm } = this.get() | 
					
						
							| 
									
										
										
										
											2018-04-21 09:56:53 -07:00
										 |  |  |         let showPostPrivacyDialog = await importShowPostPrivacyDialog() | 
					
						
							|  |  |  |         showPostPrivacyDialog(realm) | 
					
						
							| 
									
										
										
										
											2018-03-03 15:44:43 -08:00
										 |  |  |       }, | 
					
						
							| 
									
										
										
										
											2018-04-19 21:38:01 -07:00
										 |  |  |       onContentWarningClick () { | 
					
						
							| 
									
										
										
										
											2018-04-19 09:37:05 -07:00
										 |  |  |         let { realm } = this.get() | 
					
						
							|  |  |  |         toggleContentWarningShown(realm) | 
					
						
							| 
									
										
										
										
											2018-02-27 23:18:07 -08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2018-02-26 21:50:03 -08:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | </script> |