2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2020-10-17 20:12:00 +09:00
|
|
|
<div class="gafaadew" :class="{ modal, _popup: modal }"
|
2021-10-14 18:51:15 +09:00
|
|
|
v-size="{ max: [310, 500] }"
|
2020-01-30 04:37:25 +09:00
|
|
|
@dragover.stop="onDragover"
|
|
|
|
@dragenter="onDragenter"
|
|
|
|
@dragleave="onDragleave"
|
|
|
|
@drop.stop="onDrop"
|
|
|
|
>
|
|
|
|
<header>
|
2021-04-20 23:22:59 +09:00
|
|
|
<button v-if="!fixed" class="cancel _button" @click="cancel"><i class="fas fa-times"></i></button>
|
2020-01-30 04:37:25 +09:00
|
|
|
<div>
|
2021-01-15 23:20:47 +09:00
|
|
|
<span class="text-count" :class="{ over: textLength > max }">{{ max - textLength }}</span>
|
2021-04-20 23:22:59 +09:00
|
|
|
<span class="local-only" v-if="localOnly"><i class="fas fa-biohazard"></i></span>
|
2020-12-26 10:47:36 +09:00
|
|
|
<button class="_button visibility" @click="setVisibility" ref="visibilityButton" v-tooltip="$ts.visibility" :disabled="channel != null">
|
2021-04-20 23:22:59 +09:00
|
|
|
<span v-if="visibility === 'public'"><i class="fas fa-globe"></i></span>
|
|
|
|
<span v-if="visibility === 'home'"><i class="fas fa-home"></i></span>
|
|
|
|
<span v-if="visibility === 'followers'"><i class="fas fa-unlock"></i></span>
|
|
|
|
<span v-if="visibility === 'specified'"><i class="fas fa-envelope"></i></span>
|
2020-02-05 21:28:51 +09:00
|
|
|
</button>
|
2021-10-16 01:34:23 +09:00
|
|
|
<button class="_button preview" @click="showPreview = !showPreview" :class="{ active: showPreview }" v-tooltip="$ts.previewNoteText"><i class="fas fa-file-code"></i></button>
|
2021-10-16 15:00:55 +09:00
|
|
|
<button class="submit _buttonGradate" :disabled="!canPost" @click="post" data-cy-open-post-form-submit>{{ submitText }}<i :class="reply ? 'fas fa-reply' : renote ? 'fas fa-quote-right' : 'fas fa-paper-plane'"></i></button>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</header>
|
2020-02-19 03:11:09 +09:00
|
|
|
<div class="form" :class="{ fixed }">
|
2021-10-16 01:28:34 +09:00
|
|
|
<XNoteSimple class="preview" v-if="reply" :note="reply"/>
|
|
|
|
<XNoteSimple class="preview" v-if="renote" :note="renote"/>
|
2021-04-20 23:22:59 +09:00
|
|
|
<div class="with-quote" v-if="quoteId"><i class="fas fa-quote-left"></i> {{ $ts.quoteAttached }}<button @click="quoteId = null"><i class="fas fa-times"></i></button></div>
|
2020-01-30 04:37:25 +09:00
|
|
|
<div v-if="visibility === 'specified'" class="to-specified">
|
2020-12-26 10:47:36 +09:00
|
|
|
<span style="margin-right: 8px;">{{ $ts.recipient }}</span>
|
2020-01-30 04:37:25 +09:00
|
|
|
<div class="visibleUsers">
|
2020-06-03 13:30:17 +09:00
|
|
|
<span v-for="u in visibleUsers" :key="u.id">
|
2020-10-17 20:12:00 +09:00
|
|
|
<MkAcct :user="u"/>
|
2021-04-20 23:22:59 +09:00
|
|
|
<button class="_button" @click="removeVisibleUser(u)"><i class="fas fa-times"></i></button>
|
2020-01-30 04:37:25 +09:00
|
|
|
</span>
|
2021-04-20 23:22:59 +09:00
|
|
|
<button @click="addVisibleUser" class="_buttonPrimary"><i class="fas fa-plus fa-fw"></i></button>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-04-16 00:13:20 +09:00
|
|
|
<MkInfo warn v-if="hasNotSpecifiedMentions" class="hasNotSpecifiedMentions">{{ $ts.notSpecifiedMentionWarning }} - <button class="_textButton" @click="addMissingMention()">{{ $ts.add }}</button></MkInfo>
|
2020-12-26 10:47:36 +09:00
|
|
|
<input v-show="useCw" ref="cw" class="cw" v-model="cw" :placeholder="$ts.annotation" @keydown="onKeydown">
|
2021-08-12 19:05:07 +09:00
|
|
|
<textarea v-model="text" class="text" :class="{ withCw: useCw }" ref="text" :disabled="posting" :placeholder="placeholder" @keydown="onKeydown" @paste="onPaste" @compositionupdate="onCompositionUpdate" @compositionend="onCompositionEnd" data-cy-post-form-text/>
|
2021-08-07 12:47:01 +09:00
|
|
|
<input v-show="withHashtags" ref="hashtags" class="hashtags" v-model="hashtags" :placeholder="$ts.hashtags" list="hashtags">
|
2020-12-05 12:50:09 +09:00
|
|
|
<XPostFormAttaches class="attaches" :files="files" @updated="updateFiles" @detach="detachFile" @changeSensitive="updateFileSensitive" @changeName="updateFileName"/>
|
2020-10-17 20:12:00 +09:00
|
|
|
<XPollEditor v-if="poll" :poll="poll" @destroyed="poll = null" @updated="onPollUpdate"/>
|
2021-10-16 01:34:23 +09:00
|
|
|
<XNotePreview class="preview" v-if="showPreview" :text="text"/>
|
2020-01-30 04:37:25 +09:00
|
|
|
<footer>
|
2021-04-20 23:22:59 +09:00
|
|
|
<button class="_button" @click="chooseFileFrom" v-tooltip="$ts.attachFile"><i class="fas fa-photo-video"></i></button>
|
|
|
|
<button class="_button" @click="togglePoll" :class="{ active: poll }" v-tooltip="$ts.poll"><i class="fas fa-poll-h"></i></button>
|
|
|
|
<button class="_button" @click="useCw = !useCw" :class="{ active: useCw }" v-tooltip="$ts.useCw"><i class="fas fa-eye-slash"></i></button>
|
|
|
|
<button class="_button" @click="insertMention" v-tooltip="$ts.mention"><i class="fas fa-at"></i></button>
|
2021-08-10 15:29:30 +09:00
|
|
|
<button class="_button" @click="withHashtags = !withHashtags" :class="{ active: withHashtags }" v-tooltip="$ts.hashtags"><i class="fas fa-hashtag"></i></button>
|
2021-04-20 23:22:59 +09:00
|
|
|
<button class="_button" @click="insertEmoji" v-tooltip="$ts.emoji"><i class="fas fa-laugh-squint"></i></button>
|
|
|
|
<button class="_button" @click="showActions" v-tooltip="$ts.plugin" v-if="postFormActions.length > 0"><i class="fas fa-plug"></i></button>
|
2020-01-30 04:37:25 +09:00
|
|
|
</footer>
|
2021-08-07 12:47:01 +09:00
|
|
|
<datalist id="hashtags">
|
|
|
|
<option v-for="hashtag in recentHashtags" :value="hashtag" :key="hashtag"/>
|
|
|
|
</datalist>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 20:12:00 +09:00
|
|
|
import { defineComponent, defineAsyncComponent } from 'vue';
|
2019-05-27 15:38:14 +09:00
|
|
|
import insertTextAtCursor from 'insert-text-at-cursor';
|
|
|
|
import { length } from 'stringz';
|
2021-04-04 13:00:39 +09:00
|
|
|
import { toASCII } from 'punycode/';
|
2021-10-16 01:28:34 +09:00
|
|
|
import XNoteSimple from './note-simple.vue';
|
2021-10-16 01:34:23 +09:00
|
|
|
import XNotePreview from './note-preview.vue';
|
2021-04-02 10:36:11 +09:00
|
|
|
import * as mfm from 'mfm-js';
|
2021-03-23 17:30:14 +09:00
|
|
|
import { host, url } from '@client/config';
|
2020-01-30 04:37:25 +09:00
|
|
|
import { erase, unique } from '../../prelude/array';
|
2021-04-10 17:50:18 +09:00
|
|
|
import { extractMentions } from '@/misc/extract-mentions';
|
2021-07-15 20:45:32 +09:00
|
|
|
import { getAcct } from '@/misc/acct';
|
2021-03-23 17:43:07 +09:00
|
|
|
import { formatTimeString } from '@/misc/format-time-string';
|
2021-03-23 17:30:14 +09:00
|
|
|
import { Autocomplete } from '@client/scripts/autocomplete';
|
2020-06-04 19:13:24 +09:00
|
|
|
import { noteVisibilities } from '../../types';
|
2021-03-23 17:30:14 +09:00
|
|
|
import * as os from '@client/os';
|
|
|
|
import { selectFile } from '@client/scripts/select-file';
|
2021-08-07 12:47:01 +09:00
|
|
|
import { defaultStore, notePostInterruptors, postFormActions } from '@client/store';
|
2021-03-23 17:30:14 +09:00
|
|
|
import { isMobile } from '@client/scripts/is-mobile';
|
2021-02-20 20:20:05 +09:00
|
|
|
import { throttle } from 'throttle-debounce';
|
2021-04-16 00:13:20 +09:00
|
|
|
import MkInfo from '@client/components/ui/info.vue';
|
2021-08-07 12:47:01 +09:00
|
|
|
import { defaultStore } from '@client/store';
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
export default defineComponent({
|
2019-05-27 15:38:14 +09:00
|
|
|
components: {
|
2021-10-16 01:28:34 +09:00
|
|
|
XNoteSimple,
|
2021-10-16 01:34:23 +09:00
|
|
|
XNotePreview,
|
2020-10-17 20:12:00 +09:00
|
|
|
XPostFormAttaches: defineAsyncComponent(() => import('./post-form-attaches.vue')),
|
2021-04-16 00:13:20 +09:00
|
|
|
XPollEditor: defineAsyncComponent(() => import('./poll-editor.vue')),
|
|
|
|
MkInfo,
|
2019-05-27 15:38:14 +09:00
|
|
|
},
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
inject: ['modal'],
|
|
|
|
|
2019-05-27 15:38:14 +09:00
|
|
|
props: {
|
|
|
|
reply: {
|
|
|
|
type: Object,
|
|
|
|
required: false
|
|
|
|
},
|
|
|
|
renote: {
|
|
|
|
type: Object,
|
|
|
|
required: false
|
|
|
|
},
|
2020-08-18 22:44:21 +09:00
|
|
|
channel: {
|
|
|
|
type: Object,
|
|
|
|
required: false
|
|
|
|
},
|
2019-05-27 15:38:14 +09:00
|
|
|
mention: {
|
|
|
|
type: Object,
|
|
|
|
required: false
|
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
specified: {
|
|
|
|
type: Object,
|
|
|
|
required: false
|
|
|
|
},
|
2019-05-27 15:38:14 +09:00
|
|
|
initialText: {
|
|
|
|
type: String,
|
|
|
|
required: false
|
|
|
|
},
|
2021-10-20 03:10:36 +09:00
|
|
|
initialVisibility: {
|
|
|
|
type: String,
|
|
|
|
required: false
|
|
|
|
},
|
|
|
|
initialFiles: {
|
|
|
|
type: Array,
|
|
|
|
required: false
|
|
|
|
},
|
|
|
|
initialLocalOnly: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false
|
|
|
|
},
|
|
|
|
visibleUsers: {
|
|
|
|
type: Array,
|
|
|
|
required: false,
|
|
|
|
default: () => []
|
|
|
|
},
|
2019-07-28 05:33:12 +09:00
|
|
|
initialNote: {
|
|
|
|
type: Object,
|
|
|
|
required: false
|
|
|
|
},
|
2021-10-20 03:10:36 +09:00
|
|
|
share: {
|
2019-05-27 15:38:14 +09:00
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false
|
2020-02-19 03:11:09 +09:00
|
|
|
},
|
|
|
|
fixed: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false
|
2020-10-17 20:12:00 +09:00
|
|
|
},
|
|
|
|
autofocus: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: true
|
|
|
|
},
|
2019-05-27 15:38:14 +09:00
|
|
|
},
|
|
|
|
|
2020-10-19 14:46:55 +09:00
|
|
|
emits: ['posted', 'cancel', 'esc'],
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2019-05-27 15:38:14 +09:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
posting: false,
|
|
|
|
text: '',
|
|
|
|
files: [],
|
2020-10-17 20:12:00 +09:00
|
|
|
poll: null,
|
2019-05-27 15:38:14 +09:00
|
|
|
useCw: false,
|
2021-10-16 01:19:49 +09:00
|
|
|
showPreview: false,
|
2019-05-27 15:38:14 +09:00
|
|
|
cw: null,
|
2020-12-19 10:55:52 +09:00
|
|
|
localOnly: this.$store.state.rememberNoteVisibility ? this.$store.state.localOnly : this.$store.state.defaultNoteLocalOnly,
|
2021-10-20 03:10:36 +09:00
|
|
|
visibility: (this.$store.state.rememberNoteVisibility ? this.$store.state.visibility : this.$store.state.defaultNoteVisibility) as typeof noteVisibilities[number],
|
2019-05-27 15:38:14 +09:00
|
|
|
autocomplete: null,
|
|
|
|
draghover: false,
|
|
|
|
quoteId: null,
|
2021-04-16 00:13:20 +09:00
|
|
|
hasNotSpecifiedMentions: false,
|
2019-05-27 15:38:14 +09:00
|
|
|
recentHashtags: JSON.parse(localStorage.getItem('hashtags') || '[]'),
|
2021-01-15 23:20:47 +09:00
|
|
|
imeText: '',
|
2021-02-20 20:20:05 +09:00
|
|
|
typing: throttle(3000, () => {
|
|
|
|
if (this.channel) {
|
|
|
|
os.stream.send('typingOnChannel', { channel: this.channel.id });
|
|
|
|
}
|
|
|
|
}),
|
2020-10-17 20:12:00 +09:00
|
|
|
postFormActions,
|
2019-05-27 15:38:14 +09:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2020-08-18 22:44:21 +09:00
|
|
|
draftKey(): string {
|
|
|
|
let key = this.channel ? `channel:${this.channel.id}` : '';
|
|
|
|
|
|
|
|
if (this.renote) {
|
|
|
|
key += `renote:${this.renote.id}`;
|
|
|
|
} else if (this.reply) {
|
|
|
|
key += `reply:${this.reply.id}`;
|
|
|
|
} else {
|
|
|
|
key += 'note';
|
|
|
|
}
|
|
|
|
|
|
|
|
return key;
|
2019-05-27 15:38:14 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
placeholder(): string {
|
2020-08-18 22:44:21 +09:00
|
|
|
if (this.renote) {
|
2020-12-26 10:47:36 +09:00
|
|
|
return this.$ts._postForm.quotePlaceholder;
|
2020-08-18 22:44:21 +09:00
|
|
|
} else if (this.reply) {
|
2020-12-26 10:47:36 +09:00
|
|
|
return this.$ts._postForm.replyPlaceholder;
|
2020-08-18 22:44:21 +09:00
|
|
|
} else if (this.channel) {
|
2020-12-26 10:47:36 +09:00
|
|
|
return this.$ts._postForm.channelPlaceholder;
|
2020-08-18 22:44:21 +09:00
|
|
|
} else {
|
|
|
|
const xs = [
|
2020-12-26 10:47:36 +09:00
|
|
|
this.$ts._postForm._placeholders.a,
|
|
|
|
this.$ts._postForm._placeholders.b,
|
|
|
|
this.$ts._postForm._placeholders.c,
|
|
|
|
this.$ts._postForm._placeholders.d,
|
|
|
|
this.$ts._postForm._placeholders.e,
|
|
|
|
this.$ts._postForm._placeholders.f
|
2020-08-18 22:44:21 +09:00
|
|
|
];
|
|
|
|
return xs[Math.floor(Math.random() * xs.length)];
|
|
|
|
}
|
2019-05-27 15:38:14 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
submitText(): string {
|
|
|
|
return this.renote
|
2020-12-26 10:47:36 +09:00
|
|
|
? this.$ts.quote
|
2019-05-27 15:38:14 +09:00
|
|
|
: this.reply
|
2020-12-26 10:47:36 +09:00
|
|
|
? this.$ts.reply
|
|
|
|
: this.$ts.note;
|
2019-05-27 15:38:14 +09:00
|
|
|
},
|
|
|
|
|
2021-01-15 23:20:47 +09:00
|
|
|
textLength(): number {
|
|
|
|
return length((this.text + this.imeText).trim());
|
|
|
|
},
|
|
|
|
|
2019-05-27 15:38:14 +09:00
|
|
|
canPost(): boolean {
|
|
|
|
return !this.posting &&
|
2021-01-15 23:20:47 +09:00
|
|
|
(1 <= this.textLength || 1 <= this.files.length || !!this.poll || !!this.renote) &&
|
|
|
|
(this.textLength <= this.max) &&
|
2020-10-17 20:12:00 +09:00
|
|
|
(!this.poll || this.poll.choices.length >= 2);
|
2020-02-10 23:17:42 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
max(): number {
|
2020-12-19 10:55:52 +09:00
|
|
|
return this.$instance ? this.$instance.maxNoteTextLength : 1000;
|
2021-08-07 12:47:01 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
withHashtags: defaultStore.makeGetterSetter('postFormWithHashtags'),
|
|
|
|
hashtags: defaultStore.makeGetterSetter('postFormHashtags'),
|
2019-05-27 15:38:14 +09:00
|
|
|
},
|
|
|
|
|
2021-04-16 00:13:20 +09:00
|
|
|
watch: {
|
|
|
|
text() {
|
|
|
|
this.checkMissingMention();
|
|
|
|
},
|
|
|
|
visibleUsers: {
|
|
|
|
handler() {
|
|
|
|
this.checkMissingMention();
|
|
|
|
},
|
|
|
|
deep: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-05-27 15:38:14 +09:00
|
|
|
mounted() {
|
|
|
|
if (this.initialText) {
|
|
|
|
this.text = this.initialText;
|
|
|
|
}
|
|
|
|
|
2021-10-20 03:10:36 +09:00
|
|
|
if (this.initialVisibility) {
|
|
|
|
this.visibility = this.initialVisibility;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.initialFiles) {
|
|
|
|
this.files = this.initialFiles;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeof this.initialLocalOnly === 'boolean') {
|
|
|
|
this.localOnly = this.initialLocalOnly;
|
|
|
|
}
|
|
|
|
|
2019-05-27 15:38:14 +09:00
|
|
|
if (this.mention) {
|
|
|
|
this.text = this.mention.host ? `@${this.mention.username}@${toASCII(this.mention.host)}` : `@${this.mention.username}`;
|
|
|
|
this.text += ' ';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.reply && this.reply.user.host != null) {
|
|
|
|
this.text = `@${this.reply.user.username}@${toASCII(this.reply.user.host)} `;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.reply && this.reply.text != null) {
|
2021-04-02 10:36:11 +09:00
|
|
|
const ast = mfm.parse(this.reply.text);
|
2019-05-27 15:38:14 +09:00
|
|
|
|
|
|
|
for (const x of extractMentions(ast)) {
|
|
|
|
const mention = x.host ? `@${x.username}@${toASCII(x.host)}` : `@${x.username}`;
|
|
|
|
|
|
|
|
// 自分は除外
|
2020-12-19 10:55:52 +09:00
|
|
|
if (this.$i.username == x.username && x.host == null) continue;
|
|
|
|
if (this.$i.username == x.username && x.host == host) continue;
|
2019-05-27 15:38:14 +09:00
|
|
|
|
|
|
|
// 重複は除外
|
|
|
|
if (this.text.indexOf(`${mention} `) != -1) continue;
|
|
|
|
|
|
|
|
this.text += `${mention} `;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-19 14:46:55 +09:00
|
|
|
if (this.channel) {
|
|
|
|
this.visibility = 'public';
|
|
|
|
this.localOnly = true; // TODO: チャンネルが連合するようになった折には消す
|
2020-08-18 22:44:21 +09:00
|
|
|
}
|
2019-05-27 15:38:14 +09:00
|
|
|
|
|
|
|
// 公開以外へのリプライ時は元の公開範囲を引き継ぐ
|
|
|
|
if (this.reply && ['home', 'followers', 'specified'].includes(this.reply.visibility)) {
|
|
|
|
this.visibility = this.reply.visibility;
|
2019-07-07 17:14:08 +09:00
|
|
|
if (this.reply.visibility === 'specified') {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.api('users/show', {
|
2020-12-19 10:55:52 +09:00
|
|
|
userIds: this.reply.visibleUserIds.filter(uid => uid !== this.$i.id && uid !== this.reply.userId)
|
2019-07-07 17:14:08 +09:00
|
|
|
}).then(users => {
|
|
|
|
this.visibleUsers.push(...users);
|
|
|
|
});
|
2019-05-27 15:38:14 +09:00
|
|
|
|
2020-12-19 10:55:52 +09:00
|
|
|
if (this.reply.userId !== this.$i.id) {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.api('users/show', { userId: this.reply.userId }).then(user => {
|
2019-08-25 16:12:01 +09:00
|
|
|
this.visibleUsers.push(user);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2019-05-27 15:38:14 +09:00
|
|
|
}
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
if (this.specified) {
|
|
|
|
this.visibility = 'specified';
|
|
|
|
this.visibleUsers.push(this.specified);
|
|
|
|
}
|
|
|
|
|
2019-05-27 15:38:14 +09:00
|
|
|
// keep cw when reply
|
2021-01-11 20:38:34 +09:00
|
|
|
if (this.$store.state.keepCw && this.reply && this.reply.cw) {
|
2019-05-27 15:38:14 +09:00
|
|
|
this.useCw = true;
|
|
|
|
this.cw = this.reply.cw;
|
|
|
|
}
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
if (this.autofocus) {
|
2019-05-27 15:38:14 +09:00
|
|
|
this.focus();
|
2020-10-17 20:12:00 +09:00
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.focus();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: detach when unmount
|
|
|
|
new Autocomplete(this.$refs.text, this, { model: 'text' });
|
|
|
|
new Autocomplete(this.$refs.cw, this, { model: 'cw' });
|
2021-08-07 12:47:01 +09:00
|
|
|
new Autocomplete(this.$refs.hashtags, this, { model: 'hashtags' });
|
2019-05-27 15:38:14 +09:00
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
// 書きかけの投稿を復元
|
2021-10-20 03:10:36 +09:00
|
|
|
if (!this.share && !this.mention && !this.specified) {
|
2020-08-18 22:44:21 +09:00
|
|
|
const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[this.draftKey];
|
2019-05-27 15:38:14 +09:00
|
|
|
if (draft) {
|
|
|
|
this.text = draft.data.text;
|
2020-02-05 08:59:24 +09:00
|
|
|
this.useCw = draft.data.useCw;
|
|
|
|
this.cw = draft.data.cw;
|
2020-10-19 14:46:55 +09:00
|
|
|
this.visibility = draft.data.visibility;
|
2020-02-05 09:50:03 +09:00
|
|
|
this.localOnly = draft.data.localOnly;
|
2019-05-27 15:38:14 +09:00
|
|
|
this.files = (draft.data.files || []).filter(e => e);
|
|
|
|
if (draft.data.poll) {
|
2020-10-17 20:12:00 +09:00
|
|
|
this.poll = draft.data.poll;
|
2019-05-27 15:38:14 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-25 16:12:01 +09:00
|
|
|
|
|
|
|
// 削除して編集
|
2019-07-28 05:33:12 +09:00
|
|
|
if (this.initialNote) {
|
|
|
|
const init = this.initialNote;
|
|
|
|
this.text = init.text ? init.text : '';
|
|
|
|
this.files = init.files;
|
|
|
|
this.cw = init.cw;
|
|
|
|
this.useCw = init.cw != null;
|
|
|
|
if (init.poll) {
|
2021-08-21 11:16:56 +09:00
|
|
|
this.poll = {
|
|
|
|
choices: init.poll.choices.map(x => x.text),
|
|
|
|
multiple: init.poll.multiple,
|
|
|
|
expiresAt: init.poll.expiresAt,
|
|
|
|
expiredAfter: init.poll.expiredAfter,
|
|
|
|
};
|
2019-07-28 05:33:12 +09:00
|
|
|
}
|
|
|
|
this.visibility = init.visibility;
|
2020-03-21 18:58:05 +09:00
|
|
|
this.localOnly = init.localOnly;
|
2019-07-28 05:33:12 +09:00
|
|
|
this.quoteId = init.renote ? init.renote.id : null;
|
|
|
|
}
|
2019-05-27 15:38:14 +09:00
|
|
|
|
|
|
|
this.$nextTick(() => this.watch());
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
watch() {
|
|
|
|
this.$watch('text', () => this.saveDraft());
|
2020-02-05 08:59:24 +09:00
|
|
|
this.$watch('useCw', () => this.saveDraft());
|
|
|
|
this.$watch('cw', () => this.saveDraft());
|
2019-05-27 15:38:14 +09:00
|
|
|
this.$watch('poll', () => this.saveDraft());
|
2020-10-17 20:12:00 +09:00
|
|
|
this.$watch('files', () => this.saveDraft(), { deep: true });
|
2020-02-05 09:50:03 +09:00
|
|
|
this.$watch('visibility', () => this.saveDraft());
|
|
|
|
this.$watch('localOnly', () => this.saveDraft());
|
2019-05-27 15:38:14 +09:00
|
|
|
},
|
|
|
|
|
2021-04-16 00:13:20 +09:00
|
|
|
checkMissingMention() {
|
|
|
|
if (this.visibility === 'specified') {
|
|
|
|
const ast = mfm.parse(this.text);
|
|
|
|
|
|
|
|
for (const x of extractMentions(ast)) {
|
|
|
|
if (!this.visibleUsers.some(u => (u.username === x.username) && (u.host == x.host))) {
|
|
|
|
this.hasNotSpecifiedMentions = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.hasNotSpecifiedMentions = false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
addMissingMention() {
|
|
|
|
const ast = mfm.parse(this.text);
|
|
|
|
|
|
|
|
for (const x of extractMentions(ast)) {
|
|
|
|
if (!this.visibleUsers.some(u => (u.username === x.username) && (u.host == x.host))) {
|
|
|
|
os.api('users/show', { username: x.username, host: x.host }).then(user => {
|
|
|
|
this.visibleUsers.push(user);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
togglePoll() {
|
|
|
|
if (this.poll) {
|
|
|
|
this.poll = null;
|
|
|
|
} else {
|
|
|
|
this.poll = {
|
|
|
|
choices: ['', ''],
|
|
|
|
multiple: false,
|
|
|
|
expiresAt: null,
|
|
|
|
expiredAfter: null,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-05-27 15:38:14 +09:00
|
|
|
addTag(tag: string) {
|
|
|
|
insertTextAtCursor(this.$refs.text, ` #${tag} `);
|
|
|
|
},
|
|
|
|
|
|
|
|
focus() {
|
|
|
|
(this.$refs.text as any).focus();
|
|
|
|
},
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
chooseFileFrom(ev) {
|
2020-12-26 10:47:36 +09:00
|
|
|
selectFile(ev.currentTarget || ev.target, this.$ts.attachFile, true).then(files => {
|
2020-01-30 04:37:25 +09:00
|
|
|
for (const file of files) {
|
2020-10-17 20:12:00 +09:00
|
|
|
this.files.push(file);
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
2019-05-27 15:38:14 +09:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2020-12-05 12:50:09 +09:00
|
|
|
detachFile(id) {
|
2019-05-27 15:38:14 +09:00
|
|
|
this.files = this.files.filter(x => x.id != id);
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
|
2020-12-05 12:50:09 +09:00
|
|
|
updateFiles(files) {
|
|
|
|
this.files = files;
|
|
|
|
},
|
|
|
|
|
|
|
|
updateFileSensitive(file, sensitive) {
|
|
|
|
this.files[this.files.findIndex(x => x.id === file.id)].isSensitive = sensitive;
|
|
|
|
},
|
|
|
|
|
|
|
|
updateFileName(file, name) {
|
|
|
|
this.files[this.files.findIndex(x => x.id === file.id)].name = name;
|
2019-05-27 15:38:14 +09:00
|
|
|
},
|
|
|
|
|
2019-07-08 13:46:31 +09:00
|
|
|
upload(file: File, name?: string) {
|
2020-12-19 10:55:52 +09:00
|
|
|
os.upload(file, this.$store.state.uploadFolder, name).then(res => {
|
2020-10-17 20:12:00 +09:00
|
|
|
this.files.push(res);
|
|
|
|
});
|
2019-05-27 15:38:14 +09:00
|
|
|
},
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
onPollUpdate(poll) {
|
|
|
|
this.poll = poll;
|
2019-05-27 15:38:14 +09:00
|
|
|
this.saveDraft();
|
|
|
|
},
|
|
|
|
|
2020-11-03 15:22:55 +09:00
|
|
|
setVisibility() {
|
2020-08-18 22:44:21 +09:00
|
|
|
if (this.channel) {
|
|
|
|
// TODO: information dialog
|
|
|
|
return;
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2020-11-03 15:22:55 +09:00
|
|
|
os.popup(import('./visibility-picker.vue'), {
|
2020-06-04 22:06:38 +09:00
|
|
|
currentVisibility: this.visibility,
|
2020-10-17 20:12:00 +09:00
|
|
|
currentLocalOnly: this.localOnly,
|
|
|
|
src: this.$refs.visibilityButton
|
|
|
|
}, {
|
|
|
|
changeVisibility: visibility => {
|
2020-10-19 14:46:55 +09:00
|
|
|
this.visibility = visibility;
|
2020-12-19 10:55:52 +09:00
|
|
|
if (this.$store.state.rememberNoteVisibility) {
|
|
|
|
this.$store.set('visibility', visibility);
|
2020-10-19 14:46:55 +09:00
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
},
|
|
|
|
changeLocalOnly: localOnly => {
|
|
|
|
this.localOnly = localOnly;
|
2020-12-19 10:55:52 +09:00
|
|
|
if (this.$store.state.rememberNoteVisibility) {
|
|
|
|
this.$store.set('localOnly', localOnly);
|
2020-10-19 14:46:55 +09:00
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
}
|
|
|
|
}, 'closed');
|
2019-05-27 15:38:14 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
addVisibleUser() {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.selectUser().then(user => {
|
2019-05-27 15:38:14 +09:00
|
|
|
this.visibleUsers.push(user);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
removeVisibleUser(user) {
|
|
|
|
this.visibleUsers = erase(user, this.visibleUsers);
|
|
|
|
},
|
|
|
|
|
|
|
|
clear() {
|
|
|
|
this.text = '';
|
|
|
|
this.files = [];
|
2020-10-17 20:12:00 +09:00
|
|
|
this.poll = null;
|
2019-07-20 03:23:16 +09:00
|
|
|
this.quoteId = null;
|
2019-05-27 15:38:14 +09:00
|
|
|
},
|
|
|
|
|
2021-01-15 23:20:47 +09:00
|
|
|
onKeydown(e: KeyboardEvent) {
|
2020-10-17 20:12:00 +09:00
|
|
|
if ((e.which === 10 || e.which === 13) && (e.ctrlKey || e.metaKey) && this.canPost) this.post();
|
|
|
|
if (e.which === 27) this.$emit('esc');
|
2021-02-20 20:20:05 +09:00
|
|
|
this.typing();
|
2019-05-27 15:38:14 +09:00
|
|
|
},
|
|
|
|
|
2021-01-15 23:20:47 +09:00
|
|
|
onCompositionUpdate(e: CompositionEvent) {
|
|
|
|
this.imeText = e.data;
|
2021-02-20 20:20:05 +09:00
|
|
|
this.typing();
|
2021-01-15 23:20:47 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
onCompositionEnd(e: CompositionEvent) {
|
|
|
|
this.imeText = '';
|
|
|
|
},
|
|
|
|
|
2019-07-08 13:46:31 +09:00
|
|
|
async onPaste(e: ClipboardEvent) {
|
|
|
|
for (const { item, i } of Array.from(e.clipboardData.items).map((item, i) => ({item, i}))) {
|
2019-05-27 15:38:14 +09:00
|
|
|
if (item.kind == 'file') {
|
2019-07-08 13:46:31 +09:00
|
|
|
const file = item.getAsFile();
|
|
|
|
const lio = file.name.lastIndexOf('.');
|
|
|
|
const ext = lio >= 0 ? file.name.slice(lio) : '';
|
2020-12-19 10:55:52 +09:00
|
|
|
const formatted = `${formatTimeString(new Date(file.lastModified), this.$store.state.pastedFileName).replace(/{{number}}/g, `${i + 1}`)}${ext}`;
|
2020-01-30 04:37:25 +09:00
|
|
|
this.upload(file, formatted);
|
2019-05-27 15:38:14 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const paste = e.clipboardData.getData('text');
|
|
|
|
|
2019-07-20 03:23:16 +09:00
|
|
|
if (!this.renote && !this.quoteId && paste.startsWith(url + '/notes/')) {
|
2019-05-27 15:38:14 +09:00
|
|
|
e.preventDefault();
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
os.dialog({
|
2019-05-27 15:38:14 +09:00
|
|
|
type: 'info',
|
2020-12-26 10:47:36 +09:00
|
|
|
text: this.$ts.quoteQuestion,
|
2019-05-27 15:38:14 +09:00
|
|
|
showCancelButton: true
|
|
|
|
}).then(({ canceled }) => {
|
|
|
|
if (canceled) {
|
|
|
|
insertTextAtCursor(this.$refs.text, paste);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.quoteId = paste.substr(url.length).match(/^\/notes\/(.+?)\/?$/)[1];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
onDragover(e) {
|
2020-01-30 04:37:25 +09:00
|
|
|
if (!e.dataTransfer.items[0]) return;
|
2019-05-27 15:38:14 +09:00
|
|
|
const isFile = e.dataTransfer.items[0].kind == 'file';
|
2020-10-17 20:12:00 +09:00
|
|
|
const isDriveFile = e.dataTransfer.types[0] == _DATA_TRANSFER_DRIVE_FILE_;
|
2019-05-27 15:38:14 +09:00
|
|
|
if (isFile || isDriveFile) {
|
|
|
|
e.preventDefault();
|
|
|
|
this.draghover = true;
|
|
|
|
e.dataTransfer.dropEffect = e.dataTransfer.effectAllowed == 'all' ? 'copy' : 'move';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
onDragenter(e) {
|
|
|
|
this.draghover = true;
|
|
|
|
},
|
|
|
|
|
|
|
|
onDragleave(e) {
|
|
|
|
this.draghover = false;
|
|
|
|
},
|
|
|
|
|
|
|
|
onDrop(e): void {
|
|
|
|
this.draghover = false;
|
|
|
|
|
|
|
|
// ファイルだったら
|
|
|
|
if (e.dataTransfer.files.length > 0) {
|
|
|
|
e.preventDefault();
|
|
|
|
for (const x of Array.from(e.dataTransfer.files)) this.upload(x);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//#region ドライブのファイル
|
2020-10-17 20:12:00 +09:00
|
|
|
const driveFile = e.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FILE_);
|
2019-05-27 15:38:14 +09:00
|
|
|
if (driveFile != null && driveFile != '') {
|
|
|
|
const file = JSON.parse(driveFile);
|
|
|
|
this.files.push(file);
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
//#endregion
|
|
|
|
},
|
|
|
|
|
|
|
|
saveDraft() {
|
|
|
|
const data = JSON.parse(localStorage.getItem('drafts') || '{}');
|
|
|
|
|
2020-08-18 22:44:21 +09:00
|
|
|
data[this.draftKey] = {
|
2019-05-27 15:38:14 +09:00
|
|
|
updatedAt: new Date(),
|
|
|
|
data: {
|
|
|
|
text: this.text,
|
2020-02-05 08:59:24 +09:00
|
|
|
useCw: this.useCw,
|
|
|
|
cw: this.cw,
|
2020-02-05 09:50:03 +09:00
|
|
|
visibility: this.visibility,
|
|
|
|
localOnly: this.localOnly,
|
2019-05-27 15:38:14 +09:00
|
|
|
files: this.files,
|
2020-10-17 20:12:00 +09:00
|
|
|
poll: this.poll
|
2019-05-27 15:38:14 +09:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
localStorage.setItem('drafts', JSON.stringify(data));
|
|
|
|
},
|
|
|
|
|
|
|
|
deleteDraft() {
|
|
|
|
const data = JSON.parse(localStorage.getItem('drafts') || '{}');
|
|
|
|
|
2020-08-18 22:44:21 +09:00
|
|
|
delete data[this.draftKey];
|
2019-05-27 15:38:14 +09:00
|
|
|
|
|
|
|
localStorage.setItem('drafts', JSON.stringify(data));
|
|
|
|
},
|
|
|
|
|
2020-07-29 23:37:50 +09:00
|
|
|
async post() {
|
|
|
|
let data = {
|
2019-05-27 15:38:14 +09:00
|
|
|
text: this.text == '' ? undefined : this.text,
|
|
|
|
fileIds: this.files.length > 0 ? this.files.map(f => f.id) : undefined,
|
|
|
|
replyId: this.reply ? this.reply.id : undefined,
|
|
|
|
renoteId: this.renote ? this.renote.id : this.quoteId ? this.quoteId : undefined,
|
2020-08-18 22:44:21 +09:00
|
|
|
channelId: this.channel ? this.channel.id : undefined,
|
2020-10-17 20:12:00 +09:00
|
|
|
poll: this.poll,
|
2019-05-27 15:38:14 +09:00
|
|
|
cw: this.useCw ? this.cw || '' : undefined,
|
2020-02-05 09:15:28 +09:00
|
|
|
localOnly: this.localOnly,
|
2019-05-27 15:38:14 +09:00
|
|
|
visibility: this.visibility,
|
|
|
|
visibleUserIds: this.visibility == 'specified' ? this.visibleUsers.map(u => u.id) : undefined,
|
2021-02-17 21:34:20 +09:00
|
|
|
viaMobile: isMobile
|
2020-07-29 23:37:50 +09:00
|
|
|
};
|
|
|
|
|
2021-08-10 16:06:14 +09:00
|
|
|
if (this.withHashtags && this.hashtags && this.hashtags.trim() !== '') {
|
2021-08-07 12:47:01 +09:00
|
|
|
const hashtags = this.hashtags.trim().split(' ').map(x => x.startsWith('#') ? x : '#' + x).join(' ');
|
|
|
|
data.text = data.text ? `${data.text} ${hashtags}` : hashtags;
|
|
|
|
}
|
|
|
|
|
2020-07-29 23:37:50 +09:00
|
|
|
// plugin
|
2020-10-17 20:12:00 +09:00
|
|
|
if (notePostInterruptors.length > 0) {
|
|
|
|
for (const interruptor of notePostInterruptors) {
|
|
|
|
data = await interruptor.handler(JSON.parse(JSON.stringify(data)));
|
2020-07-29 23:37:50 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.posting = true;
|
2020-10-17 20:12:00 +09:00
|
|
|
os.api('notes/create', data).then(() => {
|
2019-05-27 15:38:14 +09:00
|
|
|
this.clear();
|
2020-10-19 14:46:55 +09:00
|
|
|
this.$nextTick(() => {
|
|
|
|
this.deleteDraft();
|
|
|
|
this.$emit('posted');
|
2021-08-07 12:47:01 +09:00
|
|
|
if (data.text && data.text != '') {
|
|
|
|
const hashtags = mfm.parse(data.text).filter(x => x.type === 'hashtag').map(x => x.props.hashtag);
|
2020-10-19 14:46:55 +09:00
|
|
|
const history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
|
|
|
|
localStorage.setItem('hashtags', JSON.stringify(unique(hashtags.concat(history))));
|
|
|
|
}
|
|
|
|
this.posting = false;
|
|
|
|
});
|
2019-05-27 15:38:14 +09:00
|
|
|
}).catch(err => {
|
|
|
|
this.posting = false;
|
2020-10-25 11:19:20 +09:00
|
|
|
os.dialog({
|
|
|
|
type: 'error',
|
2020-10-28 22:47:57 +09:00
|
|
|
text: err.message + '\n' + (err as any).id,
|
2020-10-25 11:19:20 +09:00
|
|
|
});
|
2019-05-27 15:38:14 +09:00
|
|
|
});
|
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
|
|
|
|
cancel() {
|
2020-10-19 14:46:55 +09:00
|
|
|
this.$emit('cancel');
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
insertMention() {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.selectUser().then(user => {
|
|
|
|
insertTextAtCursor(this.$refs.text, '@' + getAcct(user) + ' ');
|
2020-01-30 04:37:25 +09:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2020-01-30 07:53:19 +09:00
|
|
|
async insertEmoji(ev) {
|
2021-02-27 13:08:34 +09:00
|
|
|
os.openEmojiPicker(ev.currentTarget || ev.target, {}, this.$refs.text);
|
2020-06-03 13:30:17 +09:00
|
|
|
},
|
2020-07-12 00:38:55 +09:00
|
|
|
|
|
|
|
showActions(ev) {
|
2021-08-08 12:19:10 +09:00
|
|
|
os.popupMenu(postFormActions.map(action => ({
|
2020-10-17 20:12:00 +09:00
|
|
|
text: action.title,
|
|
|
|
action: () => {
|
|
|
|
action.handler({
|
|
|
|
text: this.text
|
|
|
|
}, (key, value) => {
|
|
|
|
if (key === 'text') { this.text = value; }
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})), ev.currentTarget || ev.target);
|
2020-07-12 00:38:55 +09:00
|
|
|
}
|
2019-05-27 15:38:14 +09:00
|
|
|
}
|
|
|
|
});
|
2020-01-30 04:37:25 +09:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.gafaadew {
|
2020-10-17 20:12:00 +09:00
|
|
|
position: relative;
|
|
|
|
|
|
|
|
&.modal {
|
|
|
|
width: 100%;
|
|
|
|
max-width: 520px;
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
|
|
|
|
> header {
|
|
|
|
z-index: 1000;
|
|
|
|
height: 66px;
|
|
|
|
|
|
|
|
> .cancel {
|
|
|
|
padding: 0;
|
|
|
|
font-size: 20px;
|
|
|
|
width: 64px;
|
|
|
|
line-height: 66px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> div {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
|
|
|
|
> .text-count {
|
2020-02-12 02:55:35 +09:00
|
|
|
opacity: 0.7;
|
2020-01-30 04:37:25 +09:00
|
|
|
line-height: 66px;
|
|
|
|
}
|
|
|
|
|
2020-02-05 21:28:51 +09:00
|
|
|
> .visibility {
|
|
|
|
height: 34px;
|
|
|
|
width: 34px;
|
2021-10-16 01:19:49 +09:00
|
|
|
margin: 0 0 0 8px;
|
2020-05-16 21:50:16 +09:00
|
|
|
|
|
|
|
& + .localOnly {
|
|
|
|
margin-left: 0 !important;
|
|
|
|
}
|
|
|
|
}
|
2020-06-04 22:06:38 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
> .local-only {
|
|
|
|
margin: 0 0 0 12px;
|
|
|
|
opacity: 0.7;
|
2020-02-05 21:28:51 +09:00
|
|
|
}
|
|
|
|
|
2021-10-16 01:19:49 +09:00
|
|
|
> .preview {
|
|
|
|
display: inline-block;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0 8px 0 0;
|
|
|
|
font-size: 16px;
|
|
|
|
width: 34px;
|
|
|
|
height: 34px;
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background: var(--X5);
|
|
|
|
}
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
> .submit {
|
2020-02-05 21:28:51 +09:00
|
|
|
margin: 16px 16px 16px 0;
|
2020-02-08 17:49:54 +09:00
|
|
|
padding: 0 12px;
|
2020-01-30 04:37:25 +09:00
|
|
|
line-height: 34px;
|
2020-02-08 17:49:54 +09:00
|
|
|
font-weight: bold;
|
2020-01-30 04:37:25 +09:00
|
|
|
vertical-align: bottom;
|
|
|
|
border-radius: 4px;
|
2021-10-16 15:00:55 +09:00
|
|
|
font-size: 0.9em;
|
2020-01-30 04:37:25 +09:00
|
|
|
|
|
|
|
&:disabled {
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
2020-02-08 17:49:54 +09:00
|
|
|
|
2021-04-20 23:22:59 +09:00
|
|
|
> i {
|
2020-02-08 17:49:54 +09:00
|
|
|
margin-left: 6px;
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .form {
|
|
|
|
> .preview {
|
|
|
|
padding: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .with-quote {
|
|
|
|
margin: 0 0 8px 0;
|
|
|
|
color: var(--accent);
|
|
|
|
|
|
|
|
> button {
|
|
|
|
padding: 4px 8px;
|
|
|
|
color: var(--accentAlpha04);
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: var(--accentAlpha06);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:active {
|
|
|
|
color: var(--accentDarken30);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .to-specified {
|
|
|
|
padding: 6px 24px;
|
|
|
|
margin-bottom: 8px;
|
|
|
|
overflow: auto;
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
|
|
> .visibleUsers {
|
|
|
|
display: inline;
|
|
|
|
top: -1px;
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
|
|
> button {
|
|
|
|
padding: 4px;
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> span {
|
|
|
|
margin-right: 14px;
|
|
|
|
padding: 8px 0 8px 8px;
|
|
|
|
border-radius: 8px;
|
2020-07-05 03:49:58 +09:00
|
|
|
background: var(--X4);
|
2020-01-30 04:37:25 +09:00
|
|
|
|
|
|
|
> button {
|
|
|
|
padding: 4px 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-16 00:13:20 +09:00
|
|
|
> .hasNotSpecifiedMentions {
|
|
|
|
margin: 0 20px 16px 20px;
|
|
|
|
}
|
|
|
|
|
2020-02-05 08:59:24 +09:00
|
|
|
> .cw,
|
2021-08-07 12:47:01 +09:00
|
|
|
> .hashtags,
|
2020-02-05 08:59:24 +09:00
|
|
|
> .text {
|
2020-01-30 04:37:25 +09:00
|
|
|
display: block;
|
|
|
|
box-sizing: border-box;
|
|
|
|
padding: 0 24px;
|
|
|
|
margin: 0;
|
|
|
|
width: 100%;
|
|
|
|
font-size: 16px;
|
|
|
|
border: none;
|
|
|
|
border-radius: 0;
|
|
|
|
background: transparent;
|
|
|
|
color: var(--fg);
|
2020-02-09 19:59:28 +09:00
|
|
|
font-family: inherit;
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2021-10-03 02:46:58 +09:00
|
|
|
&:focus-visible {
|
2020-01-30 04:37:25 +09:00
|
|
|
outline: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:disabled {
|
|
|
|
opacity: 0.5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-05 08:59:24 +09:00
|
|
|
> .cw {
|
|
|
|
z-index: 1;
|
|
|
|
padding-bottom: 8px;
|
2021-04-10 12:40:50 +09:00
|
|
|
border-bottom: solid 0.5px var(--divider);
|
2020-02-05 08:59:24 +09:00
|
|
|
}
|
|
|
|
|
2021-08-07 12:47:01 +09:00
|
|
|
> .hashtags {
|
|
|
|
z-index: 1;
|
|
|
|
padding-top: 8px;
|
|
|
|
padding-bottom: 8px;
|
|
|
|
border-top: solid 0.5px var(--divider);
|
|
|
|
}
|
|
|
|
|
2020-02-05 08:59:24 +09:00
|
|
|
> .text {
|
2020-01-30 04:37:25 +09:00
|
|
|
max-width: 100%;
|
|
|
|
min-width: 100%;
|
|
|
|
min-height: 90px;
|
|
|
|
|
2020-02-05 08:59:24 +09:00
|
|
|
&.withCw {
|
|
|
|
padding-top: 8px;
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
> footer {
|
|
|
|
padding: 0 16px 16px 16px;
|
|
|
|
|
2020-02-05 09:15:28 +09:00
|
|
|
> button {
|
2020-01-30 04:37:25 +09:00
|
|
|
display: inline-block;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
font-size: 16px;
|
|
|
|
width: 48px;
|
|
|
|
height: 48px;
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
|
|
&:hover {
|
2020-07-05 03:49:58 +09:00
|
|
|
background: var(--X5);
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
2020-02-05 09:15:28 +09:00
|
|
|
|
|
|
|
&.active {
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-17 20:12:00 +09:00
|
|
|
|
|
|
|
&.max-width_500px {
|
|
|
|
> header {
|
|
|
|
height: 50px;
|
|
|
|
|
|
|
|
> .cancel {
|
|
|
|
width: 50px;
|
|
|
|
line-height: 50px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> div {
|
|
|
|
> .text-count {
|
|
|
|
line-height: 50px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .submit {
|
|
|
|
margin: 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .form {
|
|
|
|
> .to-specified {
|
|
|
|
padding: 6px 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .cw,
|
2021-08-07 12:47:01 +09:00
|
|
|
> .hashtags,
|
2020-10-17 20:12:00 +09:00
|
|
|
> .text {
|
|
|
|
padding: 0 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .text {
|
|
|
|
min-height: 80px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> footer {
|
|
|
|
padding: 0 8px 8px 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-10-14 18:51:15 +09:00
|
|
|
|
|
|
|
&.max-width_310px {
|
|
|
|
> .form {
|
|
|
|
> footer {
|
|
|
|
> button {
|
|
|
|
font-size: 14px;
|
|
|
|
width: 44px;
|
|
|
|
height: 44px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
</style>
|