2018-02-27 05:50:03 +00:00
|
|
|
<div class="compose-box-toolbar">
|
2018-03-25 01:04:54 +00:00
|
|
|
<div class="compose-box-toolbar-items">
|
|
|
|
<IconButton
|
2019-05-29 05:24:22 +00:00
|
|
|
className="compose-toolbar-button"
|
2018-03-25 01:04:54 +00:00
|
|
|
label="Insert emoji"
|
|
|
|
href="#fa-smile"
|
|
|
|
on:click="onEmojiClick()"
|
|
|
|
/>
|
|
|
|
<IconButton
|
2019-05-29 05:24:22 +00:00
|
|
|
className="compose-toolbar-button"
|
2018-05-02 00:05:36 +00:00
|
|
|
svgClassName={$uploadingMedia ? 'spin' : ''}
|
2018-03-25 01:04:54 +00:00
|
|
|
label="Add media"
|
2018-05-02 00:05:36 +00:00
|
|
|
href={$uploadingMedia ? '#fa-spinner' : '#fa-camera'}
|
2018-03-25 01:04:54 +00:00
|
|
|
on:click="onMediaClick()"
|
2018-05-02 00:05:36 +00:00
|
|
|
disabled={$uploadingMedia || (media.length === 4)}
|
2018-03-25 01:04:54 +00:00
|
|
|
/>
|
2019-05-27 07:24:47 +00:00
|
|
|
<IconButton
|
2019-05-29 05:24:22 +00:00
|
|
|
className="compose-toolbar-button"
|
2019-05-27 08:05:55 +00:00
|
|
|
label="{poll && poll.options && poll.options.length ? 'Remove poll' : 'Add poll'}"
|
2019-05-27 07:24:47 +00:00
|
|
|
href="#fa-bar-chart"
|
|
|
|
on:click="onPollClick()"
|
|
|
|
pressable="true"
|
|
|
|
pressed={poll && poll.options && poll.options.length}
|
|
|
|
/>
|
2018-03-25 01:04:54 +00:00
|
|
|
<IconButton
|
2019-05-29 05:24:22 +00:00
|
|
|
className="compose-toolbar-button"
|
2018-05-02 00:05:36 +00:00
|
|
|
label="Adjust privacy (currently {postPrivacy.label})"
|
|
|
|
href={postPrivacy.icon}
|
2018-03-25 01:04:54 +00:00
|
|
|
on:click="onPostPrivacyClick()"
|
|
|
|
/>
|
|
|
|
<IconButton
|
2019-05-29 05:24:22 +00:00
|
|
|
className="compose-toolbar-button"
|
2018-05-02 00:05:36 +00:00
|
|
|
label={contentWarningShown ? 'Remove content warning' : 'Add content warning'}
|
2018-03-25 01:04:54 +00:00
|
|
|
href="#fa-exclamation-triangle"
|
|
|
|
on:click="onContentWarningClick()"
|
|
|
|
pressable="true"
|
2018-05-02 00:05:36 +00:00
|
|
|
pressed={contentWarningShown}
|
2018-03-25 01:04:54 +00:00
|
|
|
/>
|
|
|
|
</div>
|
2018-03-01 17:02:42 +00:00
|
|
|
<input ref:input
|
2018-03-01 17:29:11 +00:00
|
|
|
on:change="onFileChange(event)"
|
2018-03-01 17:02:42 +00:00
|
|
|
style="display: none;"
|
|
|
|
type="file"
|
2018-12-15 10:06:12 +00:00
|
|
|
accept={mediaAccept} >
|
2018-02-27 05:50:03 +00:00
|
|
|
</div>
|
|
|
|
<style>
|
|
|
|
.compose-box-toolbar {
|
|
|
|
grid-area: toolbar;
|
|
|
|
align-self: center;
|
2018-03-25 01:04:54 +00:00
|
|
|
}
|
|
|
|
.compose-box-toolbar-items {
|
2018-02-27 05:50:03 +00:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
2019-05-29 05:24:22 +00:00
|
|
|
|
|
|
|
@media (max-width: 320px) {
|
|
|
|
:global(button.icon-button.compose-toolbar-button) {
|
2019-06-01 21:27:50 +00:00
|
|
|
padding-left: 5px;
|
|
|
|
padding-right: 5px;
|
2019-05-29 05:24:22 +00:00
|
|
|
}
|
|
|
|
}
|
2018-02-27 05:50:03 +00:00
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
import IconButton from '../IconButton.html'
|
2018-02-28 07:18:07 +00:00
|
|
|
import { store } from '../../_store/store'
|
2018-04-21 16:56:53 +00:00
|
|
|
import { importShowEmojiDialog, importShowPostPrivacyDialog } from '../dialog/asyncDialogs'
|
2018-03-02 05:21:49 +00:00
|
|
|
import { doMediaUpload } from '../../_actions/media'
|
2018-03-03 23:44:43 +00:00
|
|
|
import { toggleContentWarningShown } from '../../_actions/contentWarnings'
|
2018-12-15 10:06:12 +00:00
|
|
|
import { mediaAccept } from '../../_static/media'
|
2019-05-27 07:24:47 +00:00
|
|
|
import { enablePoll, disablePoll } from '../../_actions/composePoll'
|
2018-02-28 07:18:07 +00:00
|
|
|
|
2018-02-27 05:50:03 +00:00
|
|
|
export default {
|
|
|
|
components: {
|
2019-05-06 15:34:03 +00:00
|
|
|
IconButton
|
2018-02-28 07:18:07 +00:00
|
|
|
},
|
2018-12-15 10:06:12 +00:00
|
|
|
data: () => ({
|
|
|
|
mediaAccept
|
|
|
|
}),
|
2018-02-28 07:18:07 +00:00
|
|
|
store: () => store,
|
|
|
|
methods: {
|
2018-04-20 04:38:01 +00:00
|
|
|
async onEmojiClick () {
|
2019-08-03 20:49:37 +00:00
|
|
|
const { realm } = this.get()
|
|
|
|
const showEmojiDialog = await importShowEmojiDialog()
|
2018-04-21 16:56:53 +00:00
|
|
|
showEmojiDialog(realm)
|
2018-03-01 17:02:42 +00:00
|
|
|
},
|
2018-04-20 04:38:01 +00:00
|
|
|
onMediaClick () {
|
2018-03-01 17:02:42 +00:00
|
|
|
this.refs.input.click()
|
2018-03-01 17:29:11 +00:00
|
|
|
},
|
2018-04-20 04:38:01 +00:00
|
|
|
onFileChange (e) {
|
2019-08-03 20:49:37 +00:00
|
|
|
const file = e.target.files[0]
|
|
|
|
const { realm } = this.get()
|
2018-03-03 18:11:32 +00:00
|
|
|
doMediaUpload(realm, file)
|
2018-03-03 21:23:26 +00:00
|
|
|
},
|
2018-04-20 04:38:01 +00:00
|
|
|
async onPostPrivacyClick () {
|
2019-08-03 20:49:37 +00:00
|
|
|
const { realm } = this.get()
|
|
|
|
const showPostPrivacyDialog = await importShowPostPrivacyDialog()
|
2018-04-21 16:56:53 +00:00
|
|
|
showPostPrivacyDialog(realm)
|
2018-03-03 23:44:43 +00:00
|
|
|
},
|
2018-04-20 04:38:01 +00:00
|
|
|
onContentWarningClick () {
|
2019-08-03 20:49:37 +00:00
|
|
|
const { realm } = this.get()
|
2018-04-19 16:37:05 +00:00
|
|
|
toggleContentWarningShown(realm)
|
2019-05-27 07:24:47 +00:00
|
|
|
},
|
|
|
|
onPollClick () {
|
2019-08-03 20:49:37 +00:00
|
|
|
const { poll, realm } = this.get()
|
2019-05-27 07:24:47 +00:00
|
|
|
if (poll && poll.options && poll.options.length) {
|
|
|
|
disablePoll(realm)
|
|
|
|
} else {
|
|
|
|
enablePoll(realm)
|
|
|
|
}
|
2018-02-28 07:18:07 +00:00
|
|
|
}
|
2018-02-27 05:50:03 +00:00
|
|
|
}
|
|
|
|
}
|
2018-12-15 10:06:12 +00:00
|
|
|
</script>
|