2020-01-29 11:37:25 -08:00
|
|
|
<template>
|
2022-07-05 07:01:23 -07:00
|
|
|
<div
|
2022-12-27 16:32:22 -08:00
|
|
|
class="gafaadew"
|
2021-11-19 02:36:12 -08:00
|
|
|
:class="{ modal, _popup: modal }"
|
2020-01-29 11:37:25 -08:00
|
|
|
@dragover.stop="onDragover"
|
|
|
|
@dragenter="onDragenter"
|
|
|
|
@dragleave="onDragleave"
|
|
|
|
@drop.stop="onDrop"
|
|
|
|
>
|
|
|
|
<header>
|
2022-12-19 02:01:30 -08:00
|
|
|
<button v-if="!fixed" class="cancel _button" @click="cancel"><i class="ti ti-x"></i></button>
|
2022-01-27 18:39:49 -08:00
|
|
|
<button v-click-anime v-tooltip="i18n.ts.switchAccount" class="account _button" @click="openAccountMenu">
|
2022-01-21 03:17:31 -08:00
|
|
|
<MkAvatar :user="postAccount ?? $i" class="avatar"/>
|
|
|
|
</button>
|
2022-07-05 07:01:23 -07:00
|
|
|
<div class="right">
|
2022-01-15 08:46:25 -08:00
|
|
|
<span class="text-count" :class="{ over: textLength > maxTextLength }">{{ maxTextLength - textLength }}</span>
|
2022-12-19 02:01:30 -08:00
|
|
|
<span v-if="localOnly" class="local-only"><i class="ti ti-world-off"></i></span>
|
2022-01-27 18:39:49 -08:00
|
|
|
<button ref="visibilityButton" v-tooltip="i18n.ts.visibility" class="_button visibility" :disabled="channel != null" @click="setVisibility">
|
2022-12-19 02:01:30 -08:00
|
|
|
<span v-if="visibility === 'public'"><i class="ti ti-world"></i></span>
|
|
|
|
<span v-if="visibility === 'home'"><i class="ti ti-home"></i></span>
|
|
|
|
<span v-if="visibility === 'followers'"><i class="ti ti-lock-open"></i></span>
|
|
|
|
<span v-if="visibility === 'specified'"><i class="ti ti-mail"></i></span>
|
2020-02-05 04:28:51 -08:00
|
|
|
</button>
|
2022-12-19 15:35:49 -08:00
|
|
|
<button v-tooltip="i18n.ts.previewNoteText" class="_button preview" :class="{ active: showPreview }" @click="showPreview = !showPreview"><i class="ti ti-eye"></i></button>
|
2022-12-19 02:01:30 -08:00
|
|
|
<button class="submit _buttonGradate" :disabled="!canPost" data-cy-open-post-form-submit @click="post">{{ submitText }}<i :class="reply ? 'ti ti-arrow-back-up' : renote ? 'ti ti-quote' : 'ti ti-send'"></i></button>
|
2020-01-29 11:37:25 -08:00
|
|
|
</div>
|
|
|
|
</header>
|
2020-02-18 10:11:09 -08:00
|
|
|
<div class="form" :class="{ fixed }">
|
2021-11-19 02:36:12 -08:00
|
|
|
<XNoteSimple v-if="reply" class="preview" :note="reply"/>
|
|
|
|
<XNoteSimple v-if="renote" class="preview" :note="renote"/>
|
2022-12-19 02:01:30 -08:00
|
|
|
<div v-if="quoteId" class="with-quote"><i class="ti ti-quote"></i> {{ i18n.ts.quoteAttached }}<button @click="quoteId = null"><i class="ti ti-x"></i></button></div>
|
2020-01-29 11:37:25 -08:00
|
|
|
<div v-if="visibility === 'specified'" class="to-specified">
|
2022-01-27 18:39:49 -08:00
|
|
|
<span style="margin-right: 8px;">{{ i18n.ts.recipient }}</span>
|
2020-01-29 11:37:25 -08:00
|
|
|
<div class="visibleUsers">
|
2020-06-02 21:30:17 -07:00
|
|
|
<span v-for="u in visibleUsers" :key="u.id">
|
2020-10-17 04:12:00 -07:00
|
|
|
<MkAcct :user="u"/>
|
2022-12-19 02:01:30 -08:00
|
|
|
<button class="_button" @click="removeVisibleUser(u)"><i class="ti ti-x"></i></button>
|
2020-01-29 11:37:25 -08:00
|
|
|
</span>
|
2022-12-19 02:01:30 -08:00
|
|
|
<button class="_buttonPrimary" @click="addVisibleUser"><i class="ti ti-plus ti-fw"></i></button>
|
2020-01-29 11:37:25 -08:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-01-27 18:39:49 -08:00
|
|
|
<MkInfo v-if="hasNotSpecifiedMentions" warn class="hasNotSpecifiedMentions">{{ i18n.ts.notSpecifiedMentionWarning }} - <button class="_textButton" @click="addMissingMention()">{{ i18n.ts.add }}</button></MkInfo>
|
|
|
|
<input v-show="useCw" ref="cwInputEl" v-model="cw" class="cw" :placeholder="i18n.ts.annotation" @keydown="onKeydown">
|
2022-01-15 08:46:25 -08:00
|
|
|
<textarea ref="textareaEl" v-model="text" class="text" :class="{ withCw: useCw }" :disabled="posting" :placeholder="placeholder" data-cy-post-form-text @keydown="onKeydown" @paste="onPaste" @compositionupdate="onCompositionUpdate" @compositionend="onCompositionEnd"/>
|
2022-01-27 18:39:49 -08:00
|
|
|
<input v-show="withHashtags" ref="hashtagsInputEl" v-model="hashtags" class="hashtags" :placeholder="i18n.ts.hashtags" list="hashtags">
|
2022-12-21 23:51:48 -08:00
|
|
|
<XPostFormAttaches v-model="files" class="attaches" @detach="detachFile" @change-sensitive="updateFileSensitive" @change-name="updateFileName"/>
|
2022-01-25 10:26:12 -08:00
|
|
|
<XPollEditor v-if="poll" v-model="poll" @destroyed="poll = null"/>
|
2021-11-19 02:36:12 -08:00
|
|
|
<XNotePreview v-if="showPreview" class="preview" :text="text"/>
|
2020-01-29 11:37:25 -08:00
|
|
|
<footer>
|
2022-12-19 02:01:30 -08:00
|
|
|
<button v-tooltip="i18n.ts.attachFile" class="_button" @click="chooseFileFrom"><i class="ti ti-photo-plus"></i></button>
|
|
|
|
<button v-tooltip="i18n.ts.poll" class="_button" :class="{ active: poll }" @click="togglePoll"><i class="ti ti-chart-arrows"></i></button>
|
|
|
|
<button v-tooltip="i18n.ts.useCw" class="_button" :class="{ active: useCw }" @click="useCw = !useCw"><i class="ti ti-eye-off"></i></button>
|
|
|
|
<button v-tooltip="i18n.ts.mention" class="_button" @click="insertMention"><i class="ti ti-at"></i></button>
|
|
|
|
<button v-tooltip="i18n.ts.hashtags" class="_button" :class="{ active: withHashtags }" @click="withHashtags = !withHashtags"><i class="ti ti-hash"></i></button>
|
|
|
|
<button v-tooltip="i18n.ts.emoji" class="_button" @click="insertEmoji"><i class="ti ti-mood-happy"></i></button>
|
|
|
|
<button v-if="postFormActions.length > 0" v-tooltip="i18n.ts.plugin" class="_button" @click="showActions"><i class="ti ti-plug"></i></button>
|
2020-01-29 11:37:25 -08:00
|
|
|
</footer>
|
2021-08-06 20:47:01 -07:00
|
|
|
<datalist id="hashtags">
|
2021-11-19 02:36:12 -08:00
|
|
|
<option v-for="hashtag in recentHashtags" :key="hashtag" :value="hashtag"/>
|
2021-08-06 20:47:01 -07:00
|
|
|
</datalist>
|
2020-01-29 11:37:25 -08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
<script lang="ts" setup>
|
2022-05-01 06:51:07 -07:00
|
|
|
import { inject, watch, nextTick, onMounted, defineAsyncComponent } from 'vue';
|
2022-01-15 08:46:25 -08:00
|
|
|
import * as mfm from 'mfm-js';
|
|
|
|
import * as misskey from 'misskey-js';
|
2019-05-26 23:38:14 -07:00
|
|
|
import insertTextAtCursor from 'insert-text-at-cursor';
|
|
|
|
import { length } from 'stringz';
|
2021-04-03 21:00:39 -07:00
|
|
|
import { toASCII } from 'punycode/';
|
2022-07-05 07:01:23 -07:00
|
|
|
import * as Acct from 'misskey-js/built/acct';
|
|
|
|
import { throttle } from 'throttle-debounce';
|
2022-08-30 08:24:33 -07:00
|
|
|
import XNoteSimple from '@/components/MkNoteSimple.vue';
|
|
|
|
import XNotePreview from '@/components/MkNotePreview.vue';
|
|
|
|
import XPostFormAttaches from '@/components/MkPostFormAttaches.vue';
|
|
|
|
import XPollEditor from '@/components/MkPollEditor.vue';
|
2021-11-11 09:02:25 -08:00
|
|
|
import { host, url } from '@/config';
|
|
|
|
import { erase, unique } from '@/scripts/array';
|
|
|
|
import { extractMentions } from '@/scripts/extract-mentions';
|
|
|
|
import { formatTimeString } from '@/scripts/format-time-string';
|
|
|
|
import { Autocomplete } from '@/scripts/autocomplete';
|
|
|
|
import * as os from '@/os';
|
2021-12-29 05:13:09 -08:00
|
|
|
import { stream } from '@/stream';
|
2021-12-09 08:22:22 -08:00
|
|
|
import { selectFiles } from '@/scripts/select-file';
|
2021-11-11 09:02:25 -08:00
|
|
|
import { defaultStore, notePostInterruptors, postFormActions } from '@/store';
|
2022-09-06 02:21:49 -07:00
|
|
|
import MkInfo from '@/components/MkInfo.vue';
|
2022-01-15 08:46:25 -08:00
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
import { instance } from '@/instance';
|
2022-01-21 03:17:31 -08:00
|
|
|
import { $i, getAccounts, openAccountMenu as openAccountMenu_ } from '@/account';
|
2022-04-27 19:14:03 -07:00
|
|
|
import { uploadFile } from '@/scripts/upload';
|
2022-11-16 16:31:07 -08:00
|
|
|
import { deepClone } from '@/scripts/clone';
|
2022-01-15 08:46:25 -08:00
|
|
|
|
|
|
|
const modal = inject('modal');
|
|
|
|
|
|
|
|
const props = withDefaults(defineProps<{
|
|
|
|
reply?: misskey.entities.Note;
|
|
|
|
renote?: misskey.entities.Note;
|
|
|
|
channel?: any; // TODO
|
|
|
|
mention?: misskey.entities.User;
|
|
|
|
specified?: misskey.entities.User;
|
|
|
|
initialText?: string;
|
|
|
|
initialVisibility?: typeof misskey.noteVisibilities;
|
|
|
|
initialFiles?: misskey.entities.DriveFile[];
|
|
|
|
initialLocalOnly?: boolean;
|
|
|
|
initialVisibleUsers?: misskey.entities.User[];
|
|
|
|
initialNote?: misskey.entities.Note;
|
2022-01-27 00:38:02 -08:00
|
|
|
instant?: boolean;
|
2022-01-15 08:46:25 -08:00
|
|
|
fixed?: boolean;
|
|
|
|
autofocus?: boolean;
|
|
|
|
}>(), {
|
2022-05-26 06:53:09 -07:00
|
|
|
initialVisibleUsers: () => [],
|
2022-01-15 08:46:25 -08:00
|
|
|
autofocus: true,
|
|
|
|
});
|
2020-01-29 11:37:25 -08:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
const emit = defineEmits<{
|
2022-01-25 10:26:12 -08:00
|
|
|
(ev: 'posted'): void;
|
|
|
|
(ev: 'cancel'): void;
|
|
|
|
(ev: 'esc'): void;
|
2022-01-15 08:46:25 -08:00
|
|
|
}>();
|
|
|
|
|
|
|
|
const textareaEl = $ref<HTMLTextAreaElement | null>(null);
|
|
|
|
const cwInputEl = $ref<HTMLInputElement | null>(null);
|
|
|
|
const hashtagsInputEl = $ref<HTMLInputElement | null>(null);
|
|
|
|
const visibilityButton = $ref<HTMLElement | null>(null);
|
|
|
|
|
|
|
|
let posting = $ref(false);
|
|
|
|
let text = $ref(props.initialText ?? '');
|
|
|
|
let files = $ref(props.initialFiles ?? []);
|
|
|
|
let poll = $ref<{
|
|
|
|
choices: string[];
|
|
|
|
multiple: boolean;
|
2022-01-25 10:26:12 -08:00
|
|
|
expiresAt: string | null;
|
|
|
|
expiredAfter: string | null;
|
2022-01-15 08:46:25 -08:00
|
|
|
} | null>(null);
|
|
|
|
let useCw = $ref(false);
|
|
|
|
let showPreview = $ref(false);
|
|
|
|
let cw = $ref<string | null>(null);
|
|
|
|
let localOnly = $ref<boolean>(props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly);
|
|
|
|
let visibility = $ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility) as typeof misskey.noteVisibilities[number]);
|
2022-02-01 04:49:34 -08:00
|
|
|
let visibleUsers = $ref([]);
|
|
|
|
if (props.initialVisibleUsers) {
|
|
|
|
props.initialVisibleUsers.forEach(pushVisibleUser);
|
|
|
|
}
|
2022-01-15 08:46:25 -08:00
|
|
|
let autocomplete = $ref(null);
|
|
|
|
let draghover = $ref(false);
|
|
|
|
let quoteId = $ref(null);
|
|
|
|
let hasNotSpecifiedMentions = $ref(false);
|
|
|
|
let recentHashtags = $ref(JSON.parse(localStorage.getItem('hashtags') || '[]'));
|
|
|
|
let imeText = $ref('');
|
|
|
|
|
|
|
|
const typing = throttle(3000, () => {
|
|
|
|
if (props.channel) {
|
|
|
|
stream.send('typingOnChannel', { channel: props.channel.id });
|
|
|
|
}
|
|
|
|
});
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
const draftKey = $computed((): string => {
|
|
|
|
let key = props.channel ? `channel:${props.channel.id}` : '';
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
if (props.renote) {
|
|
|
|
key += `renote:${props.renote.id}`;
|
|
|
|
} else if (props.reply) {
|
|
|
|
key += `reply:${props.reply.id}`;
|
|
|
|
} else {
|
|
|
|
key += 'note';
|
|
|
|
}
|
2021-01-15 06:20:47 -08:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
return key;
|
|
|
|
});
|
2020-02-10 06:17:42 -08:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
const placeholder = $computed((): string => {
|
|
|
|
if (props.renote) {
|
2022-01-27 18:39:49 -08:00
|
|
|
return i18n.ts._postForm.quotePlaceholder;
|
2022-01-15 08:46:25 -08:00
|
|
|
} else if (props.reply) {
|
2022-01-27 18:39:49 -08:00
|
|
|
return i18n.ts._postForm.replyPlaceholder;
|
2022-01-15 08:46:25 -08:00
|
|
|
} else if (props.channel) {
|
2022-01-27 18:39:49 -08:00
|
|
|
return i18n.ts._postForm.channelPlaceholder;
|
2022-01-15 08:46:25 -08:00
|
|
|
} else {
|
|
|
|
const xs = [
|
2022-01-27 18:39:49 -08:00
|
|
|
i18n.ts._postForm._placeholders.a,
|
|
|
|
i18n.ts._postForm._placeholders.b,
|
|
|
|
i18n.ts._postForm._placeholders.c,
|
|
|
|
i18n.ts._postForm._placeholders.d,
|
|
|
|
i18n.ts._postForm._placeholders.e,
|
2022-07-05 07:01:23 -07:00
|
|
|
i18n.ts._postForm._placeholders.f,
|
2022-01-15 08:46:25 -08:00
|
|
|
];
|
|
|
|
return xs[Math.floor(Math.random() * xs.length)];
|
|
|
|
}
|
|
|
|
});
|
2021-08-06 20:47:01 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
const submitText = $computed((): string => {
|
|
|
|
return props.renote
|
2022-01-27 18:39:49 -08:00
|
|
|
? i18n.ts.quote
|
2022-01-15 08:46:25 -08:00
|
|
|
: props.reply
|
2022-01-27 18:39:49 -08:00
|
|
|
? i18n.ts.reply
|
|
|
|
: i18n.ts.note;
|
2022-01-15 08:46:25 -08:00
|
|
|
});
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
const textLength = $computed((): number => {
|
|
|
|
return length((text + imeText).trim());
|
|
|
|
});
|
2021-04-15 08:13:20 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
const maxTextLength = $computed((): number => {
|
|
|
|
return instance ? instance.maxNoteTextLength : 1000;
|
|
|
|
});
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
const canPost = $computed((): boolean => {
|
|
|
|
return !posting &&
|
|
|
|
(1 <= textLength || 1 <= files.length || !!poll || !!props.renote) &&
|
|
|
|
(textLength <= maxTextLength) &&
|
|
|
|
(!poll || poll.choices.length >= 2);
|
|
|
|
});
|
2021-10-19 11:10:36 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
const withHashtags = $computed(defaultStore.makeGetterSetter('postFormWithHashtags'));
|
|
|
|
const hashtags = $computed(defaultStore.makeGetterSetter('postFormHashtags'));
|
2021-10-19 11:10:36 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
watch($$(text), () => {
|
|
|
|
checkMissingMention();
|
|
|
|
});
|
2021-10-19 11:10:36 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
watch($$(visibleUsers), () => {
|
|
|
|
checkMissingMention();
|
|
|
|
}, {
|
|
|
|
deep: true,
|
|
|
|
});
|
2021-11-18 06:32:43 -08:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
if (props.mention) {
|
|
|
|
text = props.mention.host ? `@${props.mention.username}@${toASCII(props.mention.host)}` : `@${props.mention.username}`;
|
|
|
|
text += ' ';
|
|
|
|
}
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-05-07 01:01:01 -07:00
|
|
|
if (props.reply && (props.reply.user.username !== $i.username || (props.reply.user.host != null && props.reply.user.host !== host))) {
|
2022-01-15 08:46:25 -08:00
|
|
|
text = `@${props.reply.user.username}${props.reply.user.host != null ? '@' + toASCII(props.reply.user.host) : ''} `;
|
|
|
|
}
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
if (props.reply && props.reply.text != null) {
|
|
|
|
const ast = mfm.parse(props.reply.text);
|
|
|
|
const otherHost = props.reply.user.host;
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
for (const x of extractMentions(ast)) {
|
|
|
|
const mention = x.host ?
|
2022-07-05 07:01:23 -07:00
|
|
|
`@${x.username}@${toASCII(x.host)}` :
|
|
|
|
(otherHost == null || otherHost === host) ?
|
|
|
|
`@${x.username}` :
|
|
|
|
`@${x.username}@${toASCII(otherHost)}`;
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
// 自分は除外
|
2022-05-07 01:01:01 -07:00
|
|
|
if ($i.username === x.username && (x.host == null || x.host === host)) continue;
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
// 重複は除外
|
2022-05-07 01:01:01 -07:00
|
|
|
if (text.includes(`${mention} `)) continue;
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
text += `${mention} `;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (props.channel) {
|
|
|
|
visibility = 'public';
|
|
|
|
localOnly = true; // TODO: チャンネルが連合するようになった折には消す
|
|
|
|
}
|
|
|
|
|
|
|
|
// 公開以外へのリプライ時は元の公開範囲を引き継ぐ
|
|
|
|
if (props.reply && ['home', 'followers', 'specified'].includes(props.reply.visibility)) {
|
2022-12-02 13:14:37 -08:00
|
|
|
if (props.reply.visibility === 'home' && visibility === 'followers') {
|
|
|
|
visibility = 'followers';
|
|
|
|
} else if (['home', 'followers'].includes(props.reply.visibility) && visibility === 'specified') {
|
|
|
|
visibility = 'specified';
|
|
|
|
} else {
|
|
|
|
visibility = props.reply.visibility;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (visibility === 'specified') {
|
|
|
|
if (props.reply.visibleUserIds) {
|
|
|
|
os.api('users/show', {
|
|
|
|
userIds: props.reply.visibleUserIds.filter(uid => uid !== $i.id && uid !== props.reply.userId),
|
|
|
|
}).then(users => {
|
|
|
|
users.forEach(pushVisibleUser);
|
|
|
|
});
|
|
|
|
}
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
if (props.reply.userId !== $i.id) {
|
|
|
|
os.api('users/show', { userId: props.reply.userId }).then(user => {
|
2022-02-01 04:49:34 -08:00
|
|
|
pushVisibleUser(user);
|
2022-01-15 08:46:25 -08:00
|
|
|
});
|
2020-08-18 06:44:21 -07:00
|
|
|
}
|
2022-01-15 08:46:25 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (props.specified) {
|
|
|
|
visibility = 'specified';
|
2022-02-01 04:49:34 -08:00
|
|
|
pushVisibleUser(props.specified);
|
2022-01-15 08:46:25 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// keep cw when reply
|
|
|
|
if (defaultStore.state.keepCw && props.reply && props.reply.cw) {
|
|
|
|
useCw = true;
|
|
|
|
cw = props.reply.cw;
|
|
|
|
}
|
|
|
|
|
|
|
|
function watchForDraft() {
|
|
|
|
watch($$(text), () => saveDraft());
|
|
|
|
watch($$(useCw), () => saveDraft());
|
|
|
|
watch($$(cw), () => saveDraft());
|
|
|
|
watch($$(poll), () => saveDraft());
|
|
|
|
watch($$(files), () => saveDraft(), { deep: true });
|
|
|
|
watch($$(visibility), () => saveDraft());
|
|
|
|
watch($$(localOnly), () => saveDraft());
|
|
|
|
}
|
|
|
|
|
|
|
|
function checkMissingMention() {
|
|
|
|
if (visibility === 'specified') {
|
|
|
|
const ast = mfm.parse(text);
|
|
|
|
|
|
|
|
for (const x of extractMentions(ast)) {
|
2022-05-07 01:01:01 -07:00
|
|
|
if (!visibleUsers.some(u => (u.username === x.username) && (u.host === x.host))) {
|
2022-01-15 08:46:25 -08:00
|
|
|
hasNotSpecifiedMentions = true;
|
|
|
|
return;
|
2019-08-25 00:12:01 -07:00
|
|
|
}
|
2019-05-26 23:38:14 -07:00
|
|
|
}
|
2022-01-15 08:46:25 -08:00
|
|
|
hasNotSpecifiedMentions = false;
|
|
|
|
}
|
|
|
|
}
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
function addMissingMention() {
|
|
|
|
const ast = mfm.parse(text);
|
2020-10-17 04:12:00 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
for (const x of extractMentions(ast)) {
|
2022-05-07 01:01:01 -07:00
|
|
|
if (!visibleUsers.some(u => (u.username === x.username) && (u.host === x.host))) {
|
2022-01-15 08:46:25 -08:00
|
|
|
os.api('users/show', { username: x.username, host: x.host }).then(user => {
|
|
|
|
visibleUsers.push(user);
|
2020-10-17 04:12:00 -07:00
|
|
|
});
|
|
|
|
}
|
2022-01-15 08:46:25 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function togglePoll() {
|
|
|
|
if (poll) {
|
|
|
|
poll = null;
|
|
|
|
} else {
|
|
|
|
poll = {
|
|
|
|
choices: ['', ''],
|
|
|
|
multiple: false,
|
|
|
|
expiresAt: null,
|
|
|
|
expiredAfter: null,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2020-10-17 04:12:00 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
function addTag(tag: string) {
|
|
|
|
insertTextAtCursor(textareaEl, ` #${tag} `);
|
|
|
|
}
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
function focus() {
|
2022-02-09 04:27:42 -08:00
|
|
|
if (textareaEl) {
|
|
|
|
textareaEl.focus();
|
|
|
|
textareaEl.setSelectionRange(textareaEl.value.length, textareaEl.value.length);
|
|
|
|
}
|
2022-01-15 08:46:25 -08:00
|
|
|
}
|
2021-04-15 08:13:20 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
function chooseFileFrom(ev) {
|
2022-01-27 18:53:12 -08:00
|
|
|
selectFiles(ev.currentTarget ?? ev.target, i18n.ts.attachFile).then(files_ => {
|
2022-01-19 06:51:28 -08:00
|
|
|
for (const file of files_) {
|
2022-01-15 08:46:25 -08:00
|
|
|
files.push(file);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function detachFile(id) {
|
2022-05-07 01:01:01 -07:00
|
|
|
files = files.filter(x => x.id !== id);
|
2022-01-15 08:46:25 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function updateFileSensitive(file, sensitive) {
|
|
|
|
files[files.findIndex(x => x.id === file.id)].isSensitive = sensitive;
|
|
|
|
}
|
|
|
|
|
|
|
|
function updateFileName(file, name) {
|
|
|
|
files[files.findIndex(x => x.id === file.id)].name = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
function upload(file: File, name?: string) {
|
2022-04-27 19:14:03 -07:00
|
|
|
uploadFile(file, defaultStore.state.uploadFolder, name).then(res => {
|
2022-01-15 08:46:25 -08:00
|
|
|
files.push(res);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function setVisibility() {
|
|
|
|
if (props.channel) {
|
|
|
|
// TODO: information dialog
|
|
|
|
return;
|
|
|
|
}
|
2021-04-15 08:13:20 -07:00
|
|
|
|
2022-08-30 08:24:33 -07:00
|
|
|
os.popup(defineAsyncComponent(() => import('@/components/MkVisibilityPicker.vue')), {
|
2022-01-15 08:46:25 -08:00
|
|
|
currentVisibility: visibility,
|
|
|
|
currentLocalOnly: localOnly,
|
|
|
|
src: visibilityButton,
|
|
|
|
}, {
|
2022-01-15 15:49:27 -08:00
|
|
|
changeVisibility: v => {
|
|
|
|
visibility = v;
|
2022-01-15 08:46:25 -08:00
|
|
|
if (defaultStore.state.rememberNoteVisibility) {
|
|
|
|
defaultStore.set('visibility', visibility);
|
2021-04-15 08:13:20 -07:00
|
|
|
}
|
|
|
|
},
|
2022-01-15 15:49:27 -08:00
|
|
|
changeLocalOnly: v => {
|
|
|
|
localOnly = v;
|
2022-01-15 08:46:25 -08:00
|
|
|
if (defaultStore.state.rememberNoteVisibility) {
|
|
|
|
defaultStore.set('localOnly', localOnly);
|
2020-10-17 04:12:00 -07:00
|
|
|
}
|
2022-07-05 07:01:23 -07:00
|
|
|
},
|
2022-01-15 08:46:25 -08:00
|
|
|
}, 'closed');
|
|
|
|
}
|
|
|
|
|
2022-02-01 04:49:34 -08:00
|
|
|
function pushVisibleUser(user) {
|
|
|
|
if (!visibleUsers.some(u => u.username === user.username && u.host === user.host)) {
|
|
|
|
visibleUsers.push(user);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
function addVisibleUser() {
|
|
|
|
os.selectUser().then(user => {
|
2022-02-01 04:49:34 -08:00
|
|
|
pushVisibleUser(user);
|
2022-01-15 08:46:25 -08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeVisibleUser(user) {
|
|
|
|
visibleUsers = erase(user, visibleUsers);
|
|
|
|
}
|
|
|
|
|
|
|
|
function clear() {
|
|
|
|
text = '';
|
|
|
|
files = [];
|
|
|
|
poll = null;
|
|
|
|
quoteId = null;
|
|
|
|
}
|
|
|
|
|
2022-05-07 01:01:01 -07:00
|
|
|
function onKeydown(ev: KeyboardEvent) {
|
|
|
|
if ((ev.which === 10 || ev.which === 13) && (ev.ctrlKey || ev.metaKey) && canPost) post();
|
|
|
|
if (ev.which === 27) emit('esc');
|
2022-01-15 08:46:25 -08:00
|
|
|
typing();
|
|
|
|
}
|
|
|
|
|
2022-05-07 01:01:01 -07:00
|
|
|
function onCompositionUpdate(ev: CompositionEvent) {
|
|
|
|
imeText = ev.data;
|
2022-01-15 08:46:25 -08:00
|
|
|
typing();
|
|
|
|
}
|
|
|
|
|
2022-05-07 01:01:01 -07:00
|
|
|
function onCompositionEnd(ev: CompositionEvent) {
|
2022-01-15 08:46:25 -08:00
|
|
|
imeText = '';
|
|
|
|
}
|
|
|
|
|
2022-05-07 01:01:01 -07:00
|
|
|
async function onPaste(ev: ClipboardEvent) {
|
2022-06-09 22:36:55 -07:00
|
|
|
for (const { item, i } of Array.from(ev.clipboardData.items).map((item, i) => ({ item, i }))) {
|
2022-05-07 01:01:01 -07:00
|
|
|
if (item.kind === 'file') {
|
2022-01-15 08:46:25 -08:00
|
|
|
const file = item.getAsFile();
|
|
|
|
const lio = file.name.lastIndexOf('.');
|
|
|
|
const ext = lio >= 0 ? file.name.slice(lio) : '';
|
|
|
|
const formatted = `${formatTimeString(new Date(file.lastModified), defaultStore.state.pastedFileName).replace(/{{number}}/g, `${i + 1}`)}${ext}`;
|
|
|
|
upload(file, formatted);
|
|
|
|
}
|
|
|
|
}
|
2020-12-04 19:50:09 -08:00
|
|
|
|
2022-05-07 01:01:01 -07:00
|
|
|
const paste = ev.clipboardData.getData('text');
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
if (!props.renote && !quoteId && paste.startsWith(url + '/notes/')) {
|
2022-05-07 01:01:01 -07:00
|
|
|
ev.preventDefault();
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
os.confirm({
|
|
|
|
type: 'info',
|
2022-01-27 18:39:49 -08:00
|
|
|
text: i18n.ts.quoteQuestion,
|
2022-01-15 08:46:25 -08:00
|
|
|
}).then(({ canceled }) => {
|
|
|
|
if (canceled) {
|
|
|
|
insertTextAtCursor(textareaEl, paste);
|
2020-08-18 06:44:21 -07:00
|
|
|
return;
|
|
|
|
}
|
2020-10-17 04:12:00 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
quoteId = paste.substr(url.length).match(/^\/notes\/(.+?)\/?$/)[1];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-07 01:01:01 -07:00
|
|
|
function onDragover(ev) {
|
|
|
|
if (!ev.dataTransfer.items[0]) return;
|
|
|
|
const isFile = ev.dataTransfer.items[0].kind === 'file';
|
|
|
|
const isDriveFile = ev.dataTransfer.types[0] === _DATA_TRANSFER_DRIVE_FILE_;
|
2022-01-15 08:46:25 -08:00
|
|
|
if (isFile || isDriveFile) {
|
2022-05-07 01:01:01 -07:00
|
|
|
ev.preventDefault();
|
2022-01-15 08:46:25 -08:00
|
|
|
draghover = true;
|
2022-07-25 05:16:11 -07:00
|
|
|
switch (ev.dataTransfer.effectAllowed) {
|
|
|
|
case 'all':
|
|
|
|
case 'uninitialized':
|
|
|
|
case 'copy':
|
|
|
|
case 'copyLink':
|
|
|
|
case 'copyMove':
|
|
|
|
ev.dataTransfer.dropEffect = 'copy';
|
|
|
|
break;
|
|
|
|
case 'linkMove':
|
|
|
|
case 'move':
|
|
|
|
ev.dataTransfer.dropEffect = 'move';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ev.dataTransfer.dropEffect = 'none';
|
|
|
|
break;
|
|
|
|
}
|
2022-01-15 08:46:25 -08:00
|
|
|
}
|
|
|
|
}
|
2021-01-15 06:20:47 -08:00
|
|
|
|
2022-05-07 01:01:01 -07:00
|
|
|
function onDragenter(ev) {
|
2022-01-15 08:46:25 -08:00
|
|
|
draghover = true;
|
|
|
|
}
|
2021-01-15 06:20:47 -08:00
|
|
|
|
2022-05-07 01:01:01 -07:00
|
|
|
function onDragleave(ev) {
|
2022-01-15 08:46:25 -08:00
|
|
|
draghover = false;
|
|
|
|
}
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-05-07 01:01:01 -07:00
|
|
|
function onDrop(ev): void {
|
2022-01-15 08:46:25 -08:00
|
|
|
draghover = false;
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
// ファイルだったら
|
2022-05-07 01:01:01 -07:00
|
|
|
if (ev.dataTransfer.files.length > 0) {
|
|
|
|
ev.preventDefault();
|
|
|
|
for (const x of Array.from(ev.dataTransfer.files)) upload(x);
|
2022-01-15 08:46:25 -08:00
|
|
|
return;
|
|
|
|
}
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
//#region ドライブのファイル
|
2022-05-07 01:01:01 -07:00
|
|
|
const driveFile = ev.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FILE_);
|
|
|
|
if (driveFile != null && driveFile !== '') {
|
2022-01-15 08:46:25 -08:00
|
|
|
const file = JSON.parse(driveFile);
|
|
|
|
files.push(file);
|
2022-05-07 01:01:01 -07:00
|
|
|
ev.preventDefault();
|
2022-01-15 08:46:25 -08:00
|
|
|
}
|
|
|
|
//#endregion
|
|
|
|
}
|
|
|
|
|
|
|
|
function saveDraft() {
|
2022-05-07 01:01:01 -07:00
|
|
|
const draftData = JSON.parse(localStorage.getItem('drafts') || '{}');
|
2022-01-15 08:46:25 -08:00
|
|
|
|
2022-05-07 01:01:01 -07:00
|
|
|
draftData[draftKey] = {
|
2022-01-15 08:46:25 -08:00
|
|
|
updatedAt: new Date(),
|
|
|
|
data: {
|
|
|
|
text: text,
|
|
|
|
useCw: useCw,
|
|
|
|
cw: cw,
|
|
|
|
visibility: visibility,
|
|
|
|
localOnly: localOnly,
|
|
|
|
files: files,
|
2022-07-05 07:01:23 -07:00
|
|
|
poll: poll,
|
|
|
|
},
|
2022-01-15 08:46:25 -08:00
|
|
|
};
|
|
|
|
|
2022-05-07 01:01:01 -07:00
|
|
|
localStorage.setItem('drafts', JSON.stringify(draftData));
|
2022-01-15 08:46:25 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function deleteDraft() {
|
2022-12-05 19:06:17 -08:00
|
|
|
const draftData = JSON.parse(localStorage.getItem('drafts') ?? '{}');
|
2022-01-15 08:46:25 -08:00
|
|
|
|
2022-05-07 01:01:01 -07:00
|
|
|
delete draftData[draftKey];
|
2022-01-15 08:46:25 -08:00
|
|
|
|
2022-05-07 01:01:01 -07:00
|
|
|
localStorage.setItem('drafts', JSON.stringify(draftData));
|
2022-01-15 08:46:25 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
async function post() {
|
2022-05-07 01:01:01 -07:00
|
|
|
let postData = {
|
|
|
|
text: text === '' ? undefined : text,
|
2022-01-15 08:46:25 -08:00
|
|
|
fileIds: files.length > 0 ? files.map(f => f.id) : undefined,
|
|
|
|
replyId: props.reply ? props.reply.id : undefined,
|
|
|
|
renoteId: props.renote ? props.renote.id : quoteId ? quoteId : undefined,
|
|
|
|
channelId: props.channel ? props.channel.id : undefined,
|
|
|
|
poll: poll,
|
2022-12-05 19:06:17 -08:00
|
|
|
cw: useCw ? cw ?? '' : undefined,
|
2022-01-15 08:46:25 -08:00
|
|
|
localOnly: localOnly,
|
|
|
|
visibility: visibility,
|
2022-05-07 01:01:01 -07:00
|
|
|
visibleUserIds: visibility === 'specified' ? visibleUsers.map(u => u.id) : undefined,
|
2022-01-15 08:46:25 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
if (withHashtags && hashtags && hashtags.trim() !== '') {
|
2022-01-28 09:54:56 -08:00
|
|
|
const hashtags_ = hashtags.trim().split(' ').map(x => x.startsWith('#') ? x : '#' + x).join(' ');
|
2022-05-07 01:01:01 -07:00
|
|
|
postData.text = postData.text ? `${postData.text} ${hashtags_}` : hashtags_;
|
2022-01-15 08:46:25 -08:00
|
|
|
}
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
// plugin
|
|
|
|
if (notePostInterruptors.length > 0) {
|
|
|
|
for (const interruptor of notePostInterruptors) {
|
2022-11-16 16:31:07 -08:00
|
|
|
postData = await interruptor.handler(deepClone(postData));
|
2022-01-15 08:46:25 -08:00
|
|
|
}
|
|
|
|
}
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-21 03:17:31 -08:00
|
|
|
let token = undefined;
|
|
|
|
|
|
|
|
if (postAccount) {
|
|
|
|
const storedAccounts = await getAccounts();
|
|
|
|
token = storedAccounts.find(x => x.id === postAccount.id)?.token;
|
|
|
|
}
|
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
posting = true;
|
2022-05-07 01:01:01 -07:00
|
|
|
os.api('notes/create', postData, token).then(() => {
|
2022-01-15 08:46:25 -08:00
|
|
|
clear();
|
|
|
|
nextTick(() => {
|
|
|
|
deleteDraft();
|
|
|
|
emit('posted');
|
2022-05-07 01:01:01 -07:00
|
|
|
if (postData.text && postData.text !== '') {
|
|
|
|
const hashtags_ = mfm.parse(postData.text).filter(x => x.type === 'hashtag').map(x => x.props.hashtag);
|
2022-01-15 08:46:25 -08:00
|
|
|
const history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
|
2022-01-28 09:54:56 -08:00
|
|
|
localStorage.setItem('hashtags', JSON.stringify(unique(hashtags_.concat(history))));
|
2019-05-26 23:38:14 -07:00
|
|
|
}
|
2022-01-15 08:46:25 -08:00
|
|
|
posting = false;
|
2022-01-21 03:19:56 -08:00
|
|
|
postAccount = null;
|
2022-01-15 08:46:25 -08:00
|
|
|
});
|
|
|
|
}).catch(err => {
|
|
|
|
posting = false;
|
|
|
|
os.alert({
|
|
|
|
type: 'error',
|
|
|
|
text: err.message + '\n' + (err as any).id,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function cancel() {
|
|
|
|
emit('cancel');
|
|
|
|
}
|
|
|
|
|
|
|
|
function insertMention() {
|
|
|
|
os.selectUser().then(user => {
|
|
|
|
insertTextAtCursor(textareaEl, '@' + Acct.toString(user) + ' ');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-01-21 03:17:31 -08:00
|
|
|
async function insertEmoji(ev: MouseEvent) {
|
2022-01-27 18:53:12 -08:00
|
|
|
os.openEmojiPicker(ev.currentTarget ?? ev.target, {}, textareaEl);
|
2022-01-15 08:46:25 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function showActions(ev) {
|
|
|
|
os.popupMenu(postFormActions.map(action => ({
|
|
|
|
text: action.title,
|
|
|
|
action: () => {
|
|
|
|
action.handler({
|
2022-07-05 07:01:23 -07:00
|
|
|
text: text,
|
2022-01-15 08:46:25 -08:00
|
|
|
}, (key, value) => {
|
|
|
|
if (key === 'text') { text = value; }
|
|
|
|
});
|
2022-07-05 07:01:23 -07:00
|
|
|
},
|
2022-01-27 18:53:12 -08:00
|
|
|
})), ev.currentTarget ?? ev.target);
|
2022-01-15 08:46:25 -08:00
|
|
|
}
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-21 03:17:31 -08:00
|
|
|
let postAccount = $ref<misskey.entities.UserDetailed | null>(null);
|
|
|
|
|
|
|
|
function openAccountMenu(ev: MouseEvent) {
|
|
|
|
openAccountMenu_({
|
|
|
|
withExtraOperation: false,
|
|
|
|
includeCurrentAccount: true,
|
|
|
|
active: postAccount != null ? postAccount.id : $i.id,
|
|
|
|
onChoose: (account) => {
|
|
|
|
if (account.id === $i.id) {
|
|
|
|
postAccount = null;
|
|
|
|
} else {
|
|
|
|
postAccount = account;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}, ev);
|
|
|
|
}
|
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
onMounted(() => {
|
|
|
|
if (props.autofocus) {
|
|
|
|
focus();
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
nextTick(() => {
|
|
|
|
focus();
|
|
|
|
});
|
|
|
|
}
|
2019-05-26 23:38:14 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
// TODO: detach when unmount
|
|
|
|
new Autocomplete(textareaEl, $$(text));
|
|
|
|
new Autocomplete(cwInputEl, $$(cw));
|
|
|
|
new Autocomplete(hashtagsInputEl, $$(hashtags));
|
|
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
// 書きかけの投稿を復元
|
2022-01-27 00:38:02 -08:00
|
|
|
if (!props.instant && !props.mention && !props.specified) {
|
2022-01-15 08:46:25 -08:00
|
|
|
const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[draftKey];
|
|
|
|
if (draft) {
|
|
|
|
text = draft.data.text;
|
|
|
|
useCw = draft.data.useCw;
|
|
|
|
cw = draft.data.cw;
|
|
|
|
visibility = draft.data.visibility;
|
|
|
|
localOnly = draft.data.localOnly;
|
2022-05-07 01:01:01 -07:00
|
|
|
files = (draft.data.files || []).filter(draftFile => draftFile);
|
2022-01-15 08:46:25 -08:00
|
|
|
if (draft.data.poll) {
|
|
|
|
poll = draft.data.poll;
|
2019-05-26 23:38:14 -07:00
|
|
|
}
|
2021-08-06 20:47:01 -07:00
|
|
|
}
|
2022-01-15 08:46:25 -08:00
|
|
|
}
|
2021-08-06 20:47:01 -07:00
|
|
|
|
2022-01-15 08:46:25 -08:00
|
|
|
// 削除して編集
|
|
|
|
if (props.initialNote) {
|
|
|
|
const init = props.initialNote;
|
|
|
|
text = init.text ? init.text : '';
|
|
|
|
files = init.files;
|
|
|
|
cw = init.cw;
|
|
|
|
useCw = init.cw != null;
|
|
|
|
if (init.poll) {
|
|
|
|
poll = {
|
|
|
|
choices: init.poll.choices.map(x => x.text),
|
|
|
|
multiple: init.poll.multiple,
|
|
|
|
expiresAt: init.poll.expiresAt,
|
|
|
|
expiredAfter: init.poll.expiredAfter,
|
|
|
|
};
|
2020-07-29 07:37:50 -07:00
|
|
|
}
|
2022-01-15 08:46:25 -08:00
|
|
|
visibility = init.visibility;
|
|
|
|
localOnly = init.localOnly;
|
|
|
|
quoteId = init.renote ? init.renote.id : null;
|
2020-07-11 08:38:55 -07:00
|
|
|
}
|
2022-01-15 08:46:25 -08:00
|
|
|
|
|
|
|
nextTick(() => watchForDraft());
|
|
|
|
});
|
2019-05-26 23:38:14 -07:00
|
|
|
});
|
2020-01-29 11:37:25 -08:00
|
|
|
</script>
|
|
|
|
|
2022-12-27 01:29:39 -08:00
|
|
|
<style lang="scss" scoped>
|
2020-01-29 11:37:25 -08:00
|
|
|
.gafaadew {
|
2020-10-17 04:12:00 -07:00
|
|
|
position: relative;
|
|
|
|
|
|
|
|
&.modal {
|
|
|
|
width: 100%;
|
|
|
|
max-width: 520px;
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
|
|
|
|
> header {
|
|
|
|
z-index: 1000;
|
|
|
|
height: 66px;
|
|
|
|
|
|
|
|
> .cancel {
|
|
|
|
padding: 0;
|
2022-12-19 02:01:30 -08:00
|
|
|
font-size: 1em;
|
2020-01-29 11:37:25 -08:00
|
|
|
width: 64px;
|
|
|
|
line-height: 66px;
|
|
|
|
}
|
|
|
|
|
2022-01-21 03:17:31 -08:00
|
|
|
> .account {
|
|
|
|
height: 100%;
|
|
|
|
aspect-ratio: 1/1;
|
|
|
|
display: inline-flex;
|
|
|
|
vertical-align: bottom;
|
|
|
|
|
|
|
|
> .avatar {
|
|
|
|
width: 28px;
|
|
|
|
height: 28px;
|
|
|
|
margin: auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-05 07:01:23 -07:00
|
|
|
> .right {
|
2020-01-29 11:37:25 -08:00
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
|
|
|
|
> .text-count {
|
2020-02-11 09:55:35 -08:00
|
|
|
opacity: 0.7;
|
2020-01-29 11:37:25 -08:00
|
|
|
line-height: 66px;
|
|
|
|
}
|
|
|
|
|
2020-02-05 04:28:51 -08:00
|
|
|
> .visibility {
|
|
|
|
height: 34px;
|
|
|
|
width: 34px;
|
2021-10-15 09:19:49 -07:00
|
|
|
margin: 0 0 0 8px;
|
2020-05-16 05:50:16 -07:00
|
|
|
|
|
|
|
& + .localOnly {
|
|
|
|
margin-left: 0 !important;
|
|
|
|
}
|
|
|
|
}
|
2020-06-04 06:06:38 -07:00
|
|
|
|
2020-10-17 04:12:00 -07:00
|
|
|
> .local-only {
|
|
|
|
margin: 0 0 0 12px;
|
|
|
|
opacity: 0.7;
|
2020-02-05 04:28:51 -08:00
|
|
|
}
|
|
|
|
|
2021-10-15 09:19:49 -07: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-29 11:37:25 -08:00
|
|
|
> .submit {
|
2020-02-05 04:28:51 -08:00
|
|
|
margin: 16px 16px 16px 0;
|
2020-02-08 00:49:54 -08:00
|
|
|
padding: 0 12px;
|
2020-01-29 11:37:25 -08:00
|
|
|
line-height: 34px;
|
2020-02-08 00:49:54 -08:00
|
|
|
font-weight: bold;
|
2020-01-29 11:37:25 -08:00
|
|
|
vertical-align: bottom;
|
|
|
|
border-radius: 4px;
|
2021-10-15 23:00:55 -07:00
|
|
|
font-size: 0.9em;
|
2020-01-29 11:37:25 -08:00
|
|
|
|
|
|
|
&:disabled {
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
2020-02-08 00:49:54 -08:00
|
|
|
|
2021-04-20 07:22:59 -07:00
|
|
|
> i {
|
2020-02-08 00:49:54 -08:00
|
|
|
margin-left: 6px;
|
|
|
|
}
|
2020-01-29 11:37:25 -08: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-04 11:49:58 -07:00
|
|
|
background: var(--X4);
|
2020-01-29 11:37:25 -08:00
|
|
|
|
|
|
|
> button {
|
|
|
|
padding: 4px 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-15 08:13:20 -07:00
|
|
|
> .hasNotSpecifiedMentions {
|
|
|
|
margin: 0 20px 16px 20px;
|
|
|
|
}
|
|
|
|
|
2020-02-04 15:59:24 -08:00
|
|
|
> .cw,
|
2021-08-06 20:47:01 -07:00
|
|
|
> .hashtags,
|
2020-02-04 15:59:24 -08:00
|
|
|
> .text {
|
2020-01-29 11:37:25 -08: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 02:59:28 -08:00
|
|
|
font-family: inherit;
|
2020-01-29 11:37:25 -08:00
|
|
|
|
2021-11-07 10:43:14 -08:00
|
|
|
&:focus {
|
2020-01-29 11:37:25 -08:00
|
|
|
outline: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:disabled {
|
|
|
|
opacity: 0.5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-04 15:59:24 -08:00
|
|
|
> .cw {
|
|
|
|
z-index: 1;
|
|
|
|
padding-bottom: 8px;
|
2021-04-09 20:40:50 -07:00
|
|
|
border-bottom: solid 0.5px var(--divider);
|
2020-02-04 15:59:24 -08:00
|
|
|
}
|
|
|
|
|
2021-08-06 20:47:01 -07:00
|
|
|
> .hashtags {
|
|
|
|
z-index: 1;
|
|
|
|
padding-top: 8px;
|
|
|
|
padding-bottom: 8px;
|
|
|
|
border-top: solid 0.5px var(--divider);
|
|
|
|
}
|
|
|
|
|
2020-02-04 15:59:24 -08:00
|
|
|
> .text {
|
2020-01-29 11:37:25 -08:00
|
|
|
max-width: 100%;
|
|
|
|
min-width: 100%;
|
|
|
|
min-height: 90px;
|
|
|
|
|
2020-02-04 15:59:24 -08:00
|
|
|
&.withCw {
|
|
|
|
padding-top: 8px;
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
> footer {
|
|
|
|
padding: 0 16px 16px 16px;
|
|
|
|
|
2020-02-04 16:15:28 -08:00
|
|
|
> button {
|
2020-01-29 11:37:25 -08:00
|
|
|
display: inline-block;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
2022-12-19 02:01:30 -08:00
|
|
|
font-size: 1em;
|
|
|
|
width: 46px;
|
|
|
|
height: 46px;
|
2020-01-29 11:37:25 -08:00
|
|
|
border-radius: 6px;
|
|
|
|
|
|
|
|
&:hover {
|
2020-07-04 11:49:58 -07:00
|
|
|
background: var(--X5);
|
2020-01-29 11:37:25 -08:00
|
|
|
}
|
2020-02-04 16:15:28 -08:00
|
|
|
|
|
|
|
&.active {
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-12-25 15:40:13 -08:00
|
|
|
|
|
|
|
@container (max-width: 500px) {
|
|
|
|
.gafaadew {
|
|
|
|
> header {
|
|
|
|
height: 50px;
|
|
|
|
|
|
|
|
> .cancel {
|
|
|
|
width: 50px;
|
|
|
|
line-height: 50px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .right {
|
|
|
|
> .text-count {
|
|
|
|
line-height: 50px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .submit {
|
|
|
|
margin: 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .form {
|
|
|
|
> .to-specified {
|
|
|
|
padding: 6px 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .cw,
|
|
|
|
> .hashtags,
|
|
|
|
> .text {
|
|
|
|
padding: 0 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .text {
|
|
|
|
min-height: 80px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> footer {
|
|
|
|
padding: 0 8px 8px 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@container (max-width: 310px) {
|
|
|
|
.gafaadew {
|
|
|
|
> .form {
|
|
|
|
> footer {
|
|
|
|
> button {
|
|
|
|
font-size: 14px;
|
|
|
|
width: 44px;
|
|
|
|
height: 44px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
</style>
|