2018-02-11 16:06:17 +00:00
|
|
|
<template>
|
2019-05-20 19:21:43 +00:00
|
|
|
<div class="gjisdzwh"
|
2018-02-26 21:25:17 +00:00
|
|
|
@dragover.stop="onDragover"
|
2018-02-11 16:06:17 +00:00
|
|
|
@dragenter="onDragenter"
|
|
|
|
@dragleave="onDragleave"
|
2018-02-26 21:25:17 +00:00
|
|
|
@drop.stop="onDrop"
|
2018-02-11 16:06:17 +00:00
|
|
|
>
|
|
|
|
<div class="content">
|
2018-04-28 20:28:34 +00:00
|
|
|
<div v-if="visibility == 'specified'" class="visibleUsers">
|
2018-12-06 01:02:04 +00:00
|
|
|
<span v-for="u in visibleUsers">
|
2018-12-06 07:09:33 +00:00
|
|
|
<mk-user-name :user="u"/><a @click="removeVisibleUser(u)">[x]</a>
|
|
|
|
</span>
|
2019-05-27 06:38:14 +00:00
|
|
|
<a @click="addVisibleUser">{{ $t('@.post-form.add-visible-user') }}</a>
|
2018-04-28 20:28:34 +00:00
|
|
|
</div>
|
2018-08-16 21:03:03 +00:00
|
|
|
<div class="hashtags" v-if="recentHashtags.length > 0 && $store.state.settings.suggestRecentHashtags">
|
2019-05-27 06:38:14 +00:00
|
|
|
<b>{{ $t('@.post-form.recent-tags') }}:</b>
|
|
|
|
<a v-for="tag in recentHashtags.slice(0, 5)" @click="addTag(tag)" :title="$t('@.post-form.click-to-tagging')">#{{ tag }}</a>
|
2018-07-19 20:29:56 +00:00
|
|
|
</div>
|
2019-05-27 06:38:14 +00:00
|
|
|
<div class="with-quote" v-if="quoteId">{{ $t('@.post-form.quote-attached') }}</div>
|
|
|
|
<div class="local-only" v-if="localOnly == true">{{ $t('@.post-form.local-only-message') }}</div>
|
2019-05-27 09:06:01 +00:00
|
|
|
<input v-show="useCw" ref="cw" v-model="cw" :placeholder="$t('@.post-form.cw-placeholder')" v-autocomplete="{ model: 'cw' }">
|
2018-11-12 15:12:55 +00:00
|
|
|
<div class="textarea">
|
|
|
|
<textarea :class="{ with: (files.length != 0 || poll) }"
|
|
|
|
ref="text" v-model="text" :disabled="posting"
|
|
|
|
@keydown="onKeydown" @paste="onPaste" :placeholder="placeholder"
|
2018-12-15 23:45:10 +00:00
|
|
|
v-autocomplete="{ model: 'text' }"
|
2018-11-12 15:12:55 +00:00
|
|
|
></textarea>
|
|
|
|
<button class="emoji" @click="emoji" ref="emoji">
|
|
|
|
<fa :icon="['far', 'laugh']"/>
|
|
|
|
</button>
|
2019-04-14 08:12:04 +00:00
|
|
|
<x-post-form-attaches class="files" :class="{ with: poll }" :files="files"/>
|
2019-05-20 18:45:07 +00:00
|
|
|
<x-poll-editor class="poll-editor" v-if="poll" ref="poll" @destroyed="poll = false" @updated="onPollUpdate()"/>
|
2018-11-12 15:12:55 +00:00
|
|
|
</div>
|
2018-02-11 16:06:17 +00:00
|
|
|
</div>
|
2018-02-22 17:09:48 +00:00
|
|
|
<mk-uploader ref="uploader" @uploaded="attachMedia" @change="onChangeUploadings"/>
|
2019-05-27 06:38:14 +00:00
|
|
|
<button class="upload" :title="$t('@.post-form.attach-media-from-local')" @click="chooseFile"><fa icon="upload"/></button>
|
|
|
|
<button class="drive" :title="$t('@.post-form.attach-media-from-drive')" @click="chooseFileFromDrive"><fa icon="cloud"/></button>
|
|
|
|
<button class="kao" :title="$t('@.post-form.insert-a-kao')" @click="kao"><fa :icon="['far', 'smile']"/></button>
|
|
|
|
<button class="poll" :title="$t('@.post-form.create-poll')" @click="poll = !poll"><fa icon="chart-pie"/></button>
|
|
|
|
<button class="cw" :title="$t('@.post-form.hide-contents')" @click="useCw = !useCw"><fa :icon="['far', 'eye-slash']"/></button>
|
|
|
|
<button class="geo" :title="$t('@.post-form.attach-location-information')" @click="geo ? removeGeo() : setGeo()"><fa icon="map-marker-alt"/></button>
|
|
|
|
<button class="visibility" :title="$t('@.post-form.visibility')" @click="setVisibility" ref="visibilityButton">
|
2018-11-05 16:40:11 +00:00
|
|
|
<span v-if="visibility === 'public'"><fa icon="globe"/></span>
|
|
|
|
<span v-if="visibility === 'home'"><fa icon="home"/></span>
|
|
|
|
<span v-if="visibility === 'followers'"><fa icon="unlock"/></span>
|
2019-01-12 00:40:53 +00:00
|
|
|
<span v-if="visibility === 'specified'"><fa icon="envelope"/></span>
|
2018-07-26 11:46:50 +00:00
|
|
|
</button>
|
2018-11-08 23:26:32 +00:00
|
|
|
<p class="text-count" :class="{ over: trimmedLength(text) > maxNoteTextLength }">{{ maxNoteTextLength - trimmedLength(text) }}</p>
|
2018-12-12 16:18:17 +00:00
|
|
|
<ui-button primary :wait="posting" class="submit" :disabled="!canPost" @click="post">
|
2019-05-27 06:38:14 +00:00
|
|
|
{{ posting ? $t('@.post-form.posting') : submitText }}<mk-ellipsis v-if="posting"/>
|
2018-12-12 16:18:17 +00:00
|
|
|
</ui-button>
|
2018-09-15 19:34:46 +00:00
|
|
|
<input ref="file" type="file" multiple="multiple" tabindex="-1" @change="onChangeFile"/>
|
2018-02-11 16:06:17 +00:00
|
|
|
<div class="dropzone" v-if="draghover"></div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2018-02-12 03:21:26 +00:00
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-08 18:44:35 +00:00
|
|
|
import i18n from '../../../i18n';
|
2019-05-27 06:38:14 +00:00
|
|
|
import form from '../../../common/scripts/post-form';
|
2018-02-12 03:21:26 +00:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-11-08 18:44:35 +00:00
|
|
|
i18n: i18n('desktop/views/components/post-form.vue'),
|
2019-01-03 03:34:08 +00:00
|
|
|
|
2019-05-27 06:38:14 +00:00
|
|
|
mixins: [
|
|
|
|
form({
|
|
|
|
onSuccess: self => {
|
|
|
|
self.$notify(self.renote
|
|
|
|
? self.$t('reposted')
|
|
|
|
: self.reply
|
|
|
|
? self.$t('replied')
|
|
|
|
: self.$t('posted'));
|
|
|
|
},
|
|
|
|
onFailure: self => {
|
|
|
|
self.$notify(self.renote
|
|
|
|
? self.$t('renote-failed')
|
|
|
|
: self.reply
|
|
|
|
? self.$t('reply-failed')
|
|
|
|
: self.$t('note-failed'));
|
2018-02-12 09:49:06 +00:00
|
|
|
}
|
2019-05-27 06:38:14 +00:00
|
|
|
}),
|
|
|
|
],
|
2018-02-12 03:21:26 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2018-02-12 09:49:06 +00:00
|
|
|
<style lang="stylus" scoped>
|
2019-05-20 19:21:43 +00:00
|
|
|
.gjisdzwh
|
2018-02-12 09:49:06 +00:00
|
|
|
display block
|
|
|
|
padding 16px
|
2018-09-27 05:32:48 +00:00
|
|
|
background var(--desktopPostFormBg)
|
2018-09-30 13:45:24 +00:00
|
|
|
overflow hidden
|
2018-02-12 09:49:06 +00:00
|
|
|
|
|
|
|
&:after
|
|
|
|
content ""
|
|
|
|
display block
|
|
|
|
clear both
|
|
|
|
|
|
|
|
> .content
|
2018-04-22 08:04:52 +00:00
|
|
|
> input
|
2018-11-12 15:12:55 +00:00
|
|
|
> .textarea > textarea
|
2018-02-12 09:49:06 +00:00
|
|
|
display block
|
|
|
|
width 100%
|
2018-04-22 08:04:52 +00:00
|
|
|
padding 12px
|
2018-02-12 09:49:06 +00:00
|
|
|
font-size 16px
|
2018-09-27 05:32:48 +00:00
|
|
|
color var(--desktopPostFormTextareaFg)
|
|
|
|
background var(--desktopPostFormTextareaBg)
|
2018-02-12 09:49:06 +00:00
|
|
|
outline none
|
2018-09-26 11:19:35 +00:00
|
|
|
border solid 1px var(--primaryAlpha01)
|
2018-02-12 09:49:06 +00:00
|
|
|
border-radius 4px
|
2018-04-22 08:04:52 +00:00
|
|
|
transition border-color .2s ease
|
2018-11-16 08:41:52 +00:00
|
|
|
padding-right 30px
|
2018-02-12 09:49:06 +00:00
|
|
|
|
|
|
|
&:hover
|
2018-09-26 11:19:35 +00:00
|
|
|
border-color var(--primaryAlpha02)
|
2018-02-12 09:49:06 +00:00
|
|
|
transition border-color .1s ease
|
|
|
|
|
2018-04-22 08:04:52 +00:00
|
|
|
&:focus
|
2018-09-26 11:19:35 +00:00
|
|
|
border-color var(--primaryAlpha05)
|
2018-04-22 08:04:52 +00:00
|
|
|
transition border-color 0s ease
|
|
|
|
|
|
|
|
&:disabled
|
|
|
|
opacity 0.5
|
|
|
|
|
|
|
|
&::-webkit-input-placeholder
|
2018-09-26 11:19:35 +00:00
|
|
|
color var(--primaryAlpha03)
|
2018-04-22 08:04:52 +00:00
|
|
|
|
|
|
|
> input
|
|
|
|
margin-bottom 8px
|
|
|
|
|
2018-11-12 15:12:55 +00:00
|
|
|
> .textarea
|
|
|
|
> .emoji
|
|
|
|
position absolute
|
|
|
|
top 0
|
|
|
|
right 0
|
|
|
|
padding 10px
|
|
|
|
font-size 18px
|
|
|
|
color var(--text)
|
|
|
|
opacity 0.5
|
2018-04-22 08:04:52 +00:00
|
|
|
|
2018-11-12 15:12:55 +00:00
|
|
|
&:hover
|
|
|
|
color var(--textHighlighted)
|
|
|
|
opacity 1
|
2018-02-12 09:49:06 +00:00
|
|
|
|
2018-11-12 15:12:55 +00:00
|
|
|
&:active
|
|
|
|
color var(--primary)
|
|
|
|
opacity 1
|
2018-02-12 09:49:06 +00:00
|
|
|
|
2018-11-12 15:12:55 +00:00
|
|
|
> textarea
|
|
|
|
margin 0
|
|
|
|
max-width 100%
|
|
|
|
min-width 100%
|
|
|
|
min-height 84px
|
|
|
|
|
|
|
|
&:hover
|
|
|
|
& + * + *
|
2018-11-12 15:21:49 +00:00
|
|
|
& + * + * + *
|
2018-11-12 15:12:55 +00:00
|
|
|
border-color var(--primaryAlpha02)
|
|
|
|
transition border-color .1s ease
|
|
|
|
|
|
|
|
&:focus
|
|
|
|
& + * + *
|
2018-11-12 15:21:49 +00:00
|
|
|
& + * + * + *
|
2018-11-12 15:12:55 +00:00
|
|
|
border-color var(--primaryAlpha05)
|
|
|
|
transition border-color 0s ease
|
|
|
|
|
|
|
|
& + .emoji
|
|
|
|
opacity 0.7
|
|
|
|
|
|
|
|
&.with
|
|
|
|
border-bottom solid 1px var(--primaryAlpha01) !important
|
|
|
|
border-radius 4px 4px 0 0
|
2018-02-12 09:49:06 +00:00
|
|
|
|
2018-11-12 15:21:49 +00:00
|
|
|
> .files
|
|
|
|
margin 0
|
|
|
|
padding 0
|
|
|
|
background var(--desktopPostFormTextareaBg)
|
|
|
|
border solid 1px var(--primaryAlpha01)
|
|
|
|
border-top none
|
|
|
|
border-radius 0 0 4px 4px
|
|
|
|
transition border-color .3s ease
|
|
|
|
|
|
|
|
&.with
|
|
|
|
border-bottom solid 1px var(--primaryAlpha01) !important
|
|
|
|
border-radius 0
|
|
|
|
|
2019-05-20 18:45:07 +00:00
|
|
|
> .poll-editor
|
2018-11-12 15:21:49 +00:00
|
|
|
background var(--desktopPostFormTextareaBg)
|
|
|
|
border solid 1px var(--primaryAlpha01)
|
|
|
|
border-top none
|
|
|
|
border-radius 0 0 4px 4px
|
|
|
|
transition border-color .3s ease
|
|
|
|
|
2018-04-28 20:28:34 +00:00
|
|
|
> .visibleUsers
|
|
|
|
margin-bottom 8px
|
|
|
|
font-size 14px
|
|
|
|
|
|
|
|
> span
|
|
|
|
margin-right 16px
|
2018-09-27 08:42:51 +00:00
|
|
|
color var(--primary)
|
2018-04-28 20:28:34 +00:00
|
|
|
|
2018-07-19 20:29:56 +00:00
|
|
|
> .hashtags
|
2018-07-20 17:58:44 +00:00
|
|
|
margin 0 0 8px 0
|
|
|
|
overflow hidden
|
2018-07-20 16:21:27 +00:00
|
|
|
white-space nowrap
|
2018-07-20 17:58:44 +00:00
|
|
|
font-size 14px
|
|
|
|
|
|
|
|
> b
|
2018-09-27 08:42:51 +00:00
|
|
|
color var(--primary)
|
2018-07-20 17:58:44 +00:00
|
|
|
|
2018-07-19 20:29:56 +00:00
|
|
|
> *
|
2018-07-20 17:58:44 +00:00
|
|
|
margin-right 8px
|
2018-07-20 16:21:27 +00:00
|
|
|
white-space nowrap
|
2018-07-19 20:29:56 +00:00
|
|
|
|
2018-11-15 20:47:29 +00:00
|
|
|
> .local-only
|
|
|
|
margin 0 0 8px 0
|
|
|
|
color var(--primary)
|
|
|
|
|
2018-02-16 06:38:12 +00:00
|
|
|
> .mk-uploader
|
2018-02-12 09:49:06 +00:00
|
|
|
margin 8px 0 0 0
|
|
|
|
padding 8px
|
2018-09-26 11:19:35 +00:00
|
|
|
border solid 1px var(--primaryAlpha02)
|
2018-02-12 09:49:06 +00:00
|
|
|
border-radius 4px
|
|
|
|
|
2018-02-16 06:38:12 +00:00
|
|
|
input[type='file']
|
2018-02-12 09:49:06 +00:00
|
|
|
display none
|
|
|
|
|
2018-02-16 06:38:12 +00:00
|
|
|
.submit
|
2018-02-12 09:49:06 +00:00
|
|
|
display block
|
|
|
|
position absolute
|
|
|
|
bottom 16px
|
|
|
|
right 16px
|
|
|
|
width 110px
|
|
|
|
height 40px
|
|
|
|
|
2018-04-29 00:00:41 +00:00
|
|
|
> .text-count
|
|
|
|
pointer-events none
|
|
|
|
display block
|
|
|
|
position absolute
|
|
|
|
bottom 16px
|
|
|
|
right 138px
|
|
|
|
margin 0
|
|
|
|
line-height 40px
|
2018-09-26 11:19:35 +00:00
|
|
|
color var(--primaryAlpha05)
|
2018-04-29 00:00:41 +00:00
|
|
|
|
|
|
|
&.over
|
|
|
|
color #ec3828
|
|
|
|
|
2018-03-03 07:35:15 +00:00
|
|
|
> .upload
|
|
|
|
> .drive
|
|
|
|
> .kao
|
|
|
|
> .poll
|
2018-11-08 23:26:32 +00:00
|
|
|
> .cw
|
2018-03-04 23:44:37 +00:00
|
|
|
> .geo
|
2018-04-28 08:25:56 +00:00
|
|
|
> .visibility
|
2018-02-12 09:49:06 +00:00
|
|
|
display inline-block
|
|
|
|
cursor pointer
|
|
|
|
padding 0
|
|
|
|
margin 8px 4px 0 0
|
|
|
|
width 40px
|
|
|
|
height 40px
|
|
|
|
font-size 1em
|
2018-09-28 06:56:50 +00:00
|
|
|
color var(--desktopPostFormTransparentButtonFg)
|
2018-02-12 09:49:06 +00:00
|
|
|
background transparent
|
|
|
|
outline none
|
|
|
|
border solid 1px transparent
|
|
|
|
border-radius 4px
|
|
|
|
|
|
|
|
&:hover
|
|
|
|
background transparent
|
2018-09-28 06:56:50 +00:00
|
|
|
border-color var(--primaryAlpha03)
|
2018-02-12 09:49:06 +00:00
|
|
|
|
|
|
|
&:active
|
2018-09-26 11:19:35 +00:00
|
|
|
color var(--primaryAlpha06)
|
2018-09-28 06:56:50 +00:00
|
|
|
background linear-gradient(to bottom, var(--desktopPostFormTransparentButtonActiveGradientStart) 0%, var(--desktopPostFormTransparentButtonActiveGradientEnd) 100%)
|
2018-09-26 11:19:35 +00:00
|
|
|
border-color var(--primaryAlpha05)
|
2018-04-28 23:51:17 +00:00
|
|
|
box-shadow 0 2px 4px rgba(#000, 0.15) inset
|
2018-02-12 09:49:06 +00:00
|
|
|
|
|
|
|
&:focus
|
|
|
|
&:after
|
|
|
|
content ""
|
|
|
|
pointer-events none
|
|
|
|
position absolute
|
|
|
|
top -5px
|
|
|
|
right -5px
|
|
|
|
bottom -5px
|
|
|
|
left -5px
|
2018-09-26 11:19:35 +00:00
|
|
|
border 2px solid var(--primaryAlpha03)
|
2018-02-12 09:49:06 +00:00
|
|
|
border-radius 8px
|
|
|
|
|
|
|
|
> .dropzone
|
|
|
|
position absolute
|
|
|
|
left 0
|
|
|
|
top 0
|
|
|
|
width 100%
|
|
|
|
height 100%
|
2018-09-26 11:19:35 +00:00
|
|
|
border dashed 2px var(--primaryAlpha05)
|
2018-02-12 09:49:06 +00:00
|
|
|
pointer-events none
|
|
|
|
|
|
|
|
</style>
|