firefish/packages/client/src/components/MkPostForm.vue

1724 lines
38 KiB
Vue
Raw Normal View History

<template>
2023-05-10 20:20:52 +00:00
<section
2023-04-08 00:01:42 +00:00
v-size="{ max: [310, 500] }"
class="gafaadew"
:class="{ modal, _popup: modal }"
2023-05-10 21:44:08 +00:00
:aria-label="i18n.ts._pages.blocks.post"
2023-04-08 00:01:42 +00:00
@dragover.stop="onDragover"
@dragenter="onDragenter"
@dragleave="onDragleave"
@drop.stop="onDrop"
>
<header>
<button v-if="!fixed" class="cancel _button" @click="cancel">
<i :class="icon('ph-x')" :aria-label="i18n.ts.close"></i>
2020-02-05 12:28:51 +00:00
</button>
2023-04-08 00:01:42 +00:00
<button
v-if="$props.editId == null"
2023-04-08 00:01:42 +00:00
v-click-anime
v-tooltip="i18n.ts.switchAccount"
class="account _button"
@click="openAccountMenu"
>
2024-04-13 15:08:58 +00:00
<MkAvatar :user="postAccount ?? me!" class="avatar" />
2023-04-08 00:01:42 +00:00
</button>
<div class="right">
<span
class="text-count"
:class="{ over: textLength > maxTextLength }"
>{{ maxTextLength - textLength }}</span
>
<span v-if="localOnly" class="local-only"
><i :class="icon('ph-users')"></i
2023-04-08 00:01:42 +00:00
></span>
<button
ref="visibilityButton"
v-tooltip="i18n.ts.visibility"
class="_button visibility"
:disabled="channel != null"
@click="setVisibility"
>
<span v-if="visibility === 'public'"
><i :class="icon('ph-planet')"></i
2023-04-08 00:01:42 +00:00
></span>
<span v-if="visibility === 'home'"
><i :class="icon('ph-house')"></i
2023-04-08 00:01:42 +00:00
></span>
<span v-if="visibility === 'followers'"
><i :class="icon('ph-lock')"></i
2023-04-08 00:01:42 +00:00
></span>
<span v-if="visibility === 'specified'"
><i :class="icon('ph-envelope-simple-open')"></i
2023-04-08 00:01:42 +00:00
></span>
2024-02-20 22:24:52 +00:00
<span v-if="visibility === 'private'"
><i :class="icon('ph-eye-slash')"></i
></span>
2023-04-08 00:01:42 +00:00
</button>
<button
ref="languageButton"
v-tooltip="i18n.ts.language"
class="_button language"
@click="setLanguage"
>
<i
v-if="language === '' || language == null"
class="_button"
:class="icon('ph-seal-warning')"
></i>
<p v-else class="_button" style="font-weight: bold">
{{ language.split("-")[0] }}
</p>
</button>
2023-04-08 00:01:42 +00:00
<button
v-tooltip="i18n.ts.previewNoteText"
class="_button preview"
:class="{ active: showPreview }"
@click="showPreview = !showPreview"
>
<i :class="icon('ph-binoculars')"></i>
2023-04-08 00:01:42 +00:00
</button>
<button
2024-02-15 19:14:19 +00:00
v-if="!showBigPostButton"
2024-03-02 05:24:05 +00:00
v-tooltip="submitText"
2023-04-08 00:01:42 +00:00
class="submit _buttonGradate"
:disabled="!canPost"
data-cy-open-post-form-submit
@click="post"
>
2024-04-05 03:40:58 +00:00
{{ submitText }}
<!-- 1.3333 is the em of .ph-lg -->
<MkLoading
v-if="posting"
class="spinner"
:em="true"
:colored="false"
:size-em="1.3333"
/>
<i
v-else
2023-04-08 00:01:42 +00:00
:class="
icon(
reply
? 'ph-arrow-u-up-left'
: renote
2024-02-11 17:50:57 +00:00
? 'ph-quotes'
: 'ph-paper-plane-tilt',
)
2023-04-08 00:01:42 +00:00
"
></i>
</button>
</div>
</header>
<div class="form" :class="{ fixed }">
<XNoteSimple v-if="reply" class="preview" :note="reply" />
<XNoteSimple v-if="renote" class="preview" :note="renote" />
<div v-if="quoteId" class="with-quote">
<i :class="icon('ph-quotes')"></i>
2023-04-08 00:01:42 +00:00
{{ i18n.ts.quoteAttached
2023-07-13 23:53:53 +00:00
}}<button
class="_button"
:aria-label="i18n.ts.removeQuote"
2023-09-01 23:27:33 +00:00
@click="quoteId = null"
2023-07-13 23:53:53 +00:00
>
<i :class="icon('ph-x')"></i>
2023-04-08 00:01:42 +00:00
</button>
</div>
2023-04-08 00:01:42 +00:00
<div v-if="visibility === 'specified'" class="to-specified">
<span style="margin-right: 8px">{{ i18n.ts.recipient }}</span>
<div class="visibleUsers">
<span v-for="u in visibleUsers" :key="u.id">
<MkAcct :user="u" />
2023-07-13 23:53:53 +00:00
<button
class="_button"
:aria-label="i18n.ts.removeRecipient"
2023-09-01 23:27:33 +00:00
@click="removeVisibleUser(u)"
2023-07-13 23:53:53 +00:00
>
<i :class="icon('ph-x')"></i>
2023-04-08 00:01:42 +00:00
</button>
</span>
<button class="_button" @click="addVisibleUser">
<i :class="icon('ph-plus ph-md ph-fw')"></i>
2023-04-08 00:01:42 +00:00
</button>
</div>
</div>
<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"
:lang="language ?? undefined"
2023-04-08 00:01:42 +00:00
@keydown="onKeydown"
/>
<textarea
ref="textareaEl"
v-model="text"
class="text"
:class="{ withCw: useCw }"
:disabled="posting"
:placeholder="placeholder"
:lang="language ?? undefined"
2023-04-08 00:01:42 +00:00
data-cy-post-form-text
@keydown="onKeydown"
@paste="onPaste"
@compositionupdate="onCompositionUpdate"
@compositionend="onCompositionEnd"
/>
<input
v-show="withHashtags"
ref="hashtagsInputEl"
v-model="hashtags"
class="hashtags"
:lang="language ?? undefined"
2023-04-08 00:01:42 +00:00
:placeholder="i18n.ts.hashtags"
list="hashtags"
/>
<XPostFormAttaches
class="attaches"
:files="files"
@updated="updateFiles"
@detach="detachFile"
@changeSensitive="updateFileSensitive"
@changeName="updateFileName"
/>
<XPollEditor
v-if="poll"
v-model="poll"
:lang="language ?? undefined"
@destroyed="poll = null"
/>
<XNotePreview
v-if="showPreview"
class="preview"
:lang="language ?? undefined"
:text="text"
/>
2023-04-08 00:01:42 +00:00
<footer>
<button
v-tooltip="i18n.ts.attachFile"
class="_button"
@click="chooseFileFrom"
>
<i :class="icon('ph-upload')"></i>
2023-04-08 00:01:42 +00:00
</button>
<button
v-tooltip="i18n.ts.poll"
class="_button"
:class="{ active: poll }"
@click="togglePoll"
>
<i :class="icon('ph-microphone-stage')"></i>
2023-04-08 00:01:42 +00:00
</button>
<button
v-tooltip="i18n.ts.useCw"
class="_button"
:class="{ active: useCw }"
@click="useCw = !useCw"
>
<i :class="icon('ph-eye-slash')"></i>
2023-04-08 00:01:42 +00:00
</button>
<button
v-tooltip="i18n.ts.mention"
class="_button"
@click="insertMention"
>
<i :class="icon('ph-at')"></i>
2023-04-08 00:01:42 +00:00
</button>
<button
v-tooltip="i18n.ts.hashtags"
class="_button"
:class="{ active: withHashtags }"
@click="withHashtags = !withHashtags"
>
<i :class="icon('ph-hash')"></i>
2023-04-08 00:01:42 +00:00
</button>
<button
v-tooltip="i18n.ts.emoji"
class="_button"
@click="insertEmoji"
>
<i :class="icon('ph-smiley')"></i>
2023-04-08 00:01:42 +00:00
</button>
<button
v-if="postFormActions.length > 0"
v-tooltip="i18n.ts.plugin"
class="_button"
@click="showActions"
>
<i :class="icon('ph-plug')"></i>
2023-04-08 00:01:42 +00:00
</button>
2023-05-20 06:38:36 +00:00
<!-- v-if="showMfmCheatsheet" -->
2023-04-08 00:01:42 +00:00
<button
v-tooltip="i18n.ts._mfm.cheatSheet"
class="_button right"
@click="openCheatSheet"
>
<i :class="icon('ph-question')"></i>
2023-04-08 00:01:42 +00:00
</button>
2024-02-15 19:14:19 +00:00
<div v-if="showBigPostButton">
<button
2024-03-02 05:24:05 +00:00
v-tooltip="submitText"
2024-02-15 19:14:19 +00:00
class="submit bigPostButton"
:disabled="!canPost"
data-cy-open-post-form-submit
@click="post"
>
{{ submitText
}}<i
:class="
reply
? 'ph-arrow-u-up-left ph-bold ph-lg'
: renote
? 'ph-quotes ph-bold ph-lg'
: 'ph-paper-plane-tilt ph-bold ph-lg'
"
></i>
</button>
</div>
2023-04-08 00:01:42 +00:00
</footer>
<datalist id="hashtags">
<option
v-for="hashtag in recentHashtags"
:key="hashtag"
:value="hashtag"
/>
</datalist>
</div>
2023-05-10 20:20:52 +00:00
</section>
</template>
<script lang="ts" setup>
import {
2024-04-13 15:08:58 +00:00
type Ref,
2023-09-01 23:27:33 +00:00
computed,
inject,
nextTick,
onMounted,
ref,
2023-09-01 23:27:33 +00:00
watch,
} from "vue";
2023-04-08 00:01:42 +00:00
import * as mfm from "mfm-js";
import autosize from "autosize";
2023-04-08 00:01:42 +00:00
import insertTextAtCursor from "insert-text-at-cursor";
import { length } from "stringz";
import { toASCII } from "punycode/";
2024-03-02 05:24:05 +00:00
import { acct } from "firefish-js";
2024-04-13 15:08:58 +00:00
import type { ApiTypes, entities, languages } from "firefish-js";
2023-04-08 00:01:42 +00:00
import { throttle } from "throttle-debounce";
import XNoteSimple from "@/components/MkNoteSimple.vue";
import XNotePreview from "@/components/MkNotePreview.vue";
import XPostFormAttaches from "@/components/MkPostFormAttaches.vue";
import XPollEditor from "@/components/MkPollEditor.vue";
import XCheatSheet from "@/components/MkCheatSheetDialog.vue";
import XMediaCaption from "@/components/MkMediaCaption.vue";
2023-04-08 00:01:42 +00: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";
import { useStream } from "@/stream";
2023-04-08 00:01:42 +00:00
import { selectFiles } from "@/scripts/select-file";
import { defaultStore, notePostInterruptors, postFormActions } from "@/store";
import MkInfo from "@/components/MkInfo.vue";
import { i18n } from "@/i18n";
import { instance } from "@/instance";
import { getAccounts, openAccountMenu as openAccountMenu_ } from "@/account";
2024-03-07 02:06:45 +00:00
import { me } from "@/me";
2023-04-08 00:01:42 +00:00
import { uploadFile } from "@/scripts/upload";
import { deepClone } from "@/scripts/clone";
import preprocess from "@/scripts/preprocess";
2023-09-17 21:59:09 +00:00
import { vibrate } from "@/scripts/vibrate";
import { langmap } from "@/scripts/langmap";
import {
detectLanguage,
isSameLanguage,
2024-03-30 16:30:50 +00:00
isSupportedLang,
languageContains,
parentLanguage,
} from "@/scripts/language-utils";
2024-03-02 05:24:05 +00:00
import type { MenuItem } from "@/types/menu";
import icon from "@/scripts/icon";
2024-04-09 11:29:27 +00:00
import MkVisibilityPicker from "@/components/MkVisibilityPicker.vue";
import type { NoteVisibility } from "@/types/note";
2024-04-13 15:08:58 +00:00
import type { NoteDraft, PollType } from "@/types/post-form";
2023-04-08 00:01:42 +00:00
const modal = inject("modal");
const props = withDefaults(
defineProps<{
reply?: entities.Note;
renote?: entities.Note;
2024-04-10 14:25:11 +00:00
channel?: entities.Channel;
mention?: entities.User;
specified?: entities.User;
2023-04-08 00:01:42 +00:00
initialText?: string;
2024-04-09 17:18:08 +00:00
initialVisibility?: NoteVisibility;
2024-04-13 15:08:58 +00:00
initialLanguage?: (typeof languages)[number];
initialFiles?: entities.DriveFile[];
2023-04-08 00:01:42 +00:00
initialLocalOnly?: boolean;
initialVisibleUsers?: entities.User[];
2024-04-13 15:08:58 +00:00
initialNote?: NoteDraft;
2023-04-08 00:01:42 +00:00
instant?: boolean;
fixed?: boolean;
autofocus?: boolean;
showMfmCheatSheet?: boolean;
editId?: entities.Note["id"];
2023-04-08 00:01:42 +00:00
}>(),
{
initialVisibleUsers: () => [],
autofocus: true,
showMfmCheatSheet: true,
2023-07-06 01:28:27 +00:00
},
2023-04-08 00:01:42 +00:00
);
const emit = defineEmits<{
2023-04-08 00:01:42 +00:00
(ev: "posted"): void;
(ev: "cancel"): void;
(ev: "esc"): void;
}>();
const stream = useStream();
const textareaEl = ref<HTMLTextAreaElement | null>(null);
const cwInputEl = ref<HTMLInputElement | null>(null);
const hashtagsInputEl = ref<HTMLInputElement | null>(null);
const visibilityButton = ref<HTMLElement | null>(null);
const languageButton = ref<HTMLElement | undefined>();
2024-02-15 19:14:19 +00:00
const showBigPostButton = defaultStore.state.showBigPostButton;
2023-09-01 23:27:33 +00:00
const posting = ref(false);
const text = ref(props.initialText ?? "");
const files = ref(props.initialFiles ?? ([] as entities.DriveFile[]));
2024-04-13 15:08:58 +00:00
const poll = ref<PollType | null>(null);
2023-09-01 23:27:33 +00:00
const useCw = ref(false);
const showPreview = ref(defaultStore.state.showPreviewByDefault);
2023-09-01 23:27:33 +00:00
const cw = ref<string | null>(null);
const localOnly = ref<boolean>(
2023-04-08 00:01:42 +00:00
props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility
? defaultStore.state.localOnly
2023-07-06 01:28:27 +00:00
: defaultStore.state.defaultNoteLocalOnly,
2023-04-08 00:01:42 +00:00
);
2023-09-01 23:27:33 +00:00
const visibility = ref(
2023-04-08 00:01:42 +00:00
props.initialVisibility ??
2024-04-09 11:29:27 +00:00
(defaultStore.state.rememberNoteVisibility
2023-04-08 00:01:42 +00:00
? defaultStore.state.visibility
2024-04-09 11:29:27 +00:00
: defaultStore.state.defaultNoteVisibility),
2023-04-08 00:01:42 +00:00
);
2023-11-23 08:49:13 +00:00
2024-04-13 15:08:58 +00:00
const visibleUsers = ref<entities.User[]>([]);
if (props.initialVisibleUsers) {
props.initialVisibleUsers.forEach(pushVisibleUser);
}
2023-09-01 23:27:33 +00:00
const draghover = ref(false);
2024-04-13 15:08:58 +00:00
const quoteId = ref<string | null>(null);
2023-09-01 23:27:33 +00:00
const hasNotSpecifiedMentions = ref(false);
const recentHashtags = ref(
JSON.parse(localStorage.getItem("hashtags") || "[]"),
);
const imeText = ref("");
const typing = throttle(3000, () => {
if (props.channel) {
2023-04-08 00:01:42 +00:00
stream.send("typingOnChannel", { channel: props.channel.id });
}
});
const draftKey = computed((): string => {
2023-05-07 10:27:25 +00:00
if (props.editId) {
return `edit:${props.editId}`;
}
2023-04-08 00:01:42 +00:00
let key = props.channel ? `channel:${props.channel.id}` : "";
if (props.renote) {
key += `renote:${props.renote.id}`;
} else if (props.reply) {
key += `reply:${props.reply.id}`;
} else {
2023-04-08 00:01:42 +00:00
key += "note";
}
return key;
});
const placeholder = computed((): string => {
if (props.renote) {
return i18n.ts._postForm.quotePlaceholder;
} else if (props.reply) {
return i18n.ts._postForm.replyPlaceholder;
} else if (props.channel) {
return i18n.ts._postForm.channelPlaceholder;
} else {
const xs = [
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,
i18n.ts._postForm._placeholders.f,
];
return xs[Math.floor(Math.random() * xs.length)];
}
});
const submitText = computed((): string => {
2023-05-07 10:27:25 +00:00
return props.editId
? i18n.ts.toEdit
2023-05-07 10:27:25 +00:00
: props.renote
? i18n.ts.toQuote
2024-02-11 17:50:57 +00:00
: props.reply
? i18n.ts.toReply
: i18n.ts.toPost;
});
const textLength = computed((): number => {
return length((preprocess(text.value) + imeText.value).trim());
});
2021-04-15 15:13:20 +00:00
const maxTextLength = computed((): number => {
2023-07-15 07:06:53 +00:00
return instance ? instance.maxNoteTextLength : 3000;
});
const canPost = computed((): boolean => {
2023-04-08 00:01:42 +00:00
return (
!posting.value &&
2023-09-01 23:27:33 +00:00
(textLength.value >= 1 ||
files.value.length >= 1 ||
!!poll.value ||
!!props.renote) &&
textLength.value <= maxTextLength.value &&
(!poll.value || poll.value.choices.length >= 2)
2023-04-08 00:01:42 +00:00
);
});
const withHashtags = computed(
2023-07-06 01:28:27 +00:00
defaultStore.makeGetterSetter("postFormWithHashtags"),
2023-04-08 00:01:42 +00:00
);
2024-04-13 15:08:58 +00:00
const hashtags = computed(
defaultStore.makeGetterSetter("postFormHashtags"),
) as Ref<string | null>;
let isFirstPostAttempt = true;
watch(text, () => {
checkMissingMention();
});
2023-04-08 00:01:42 +00:00
watch(
visibleUsers,
2023-04-08 00:01:42 +00:00
() => {
checkMissingMention();
},
{
deep: true,
2023-07-06 01:28:27 +00:00
},
2023-04-08 00:01:42 +00:00
);
if (props.mention) {
text.value = props.mention.host
2023-04-08 00:01:42 +00:00
? `@${props.mention.username}@${toASCII(props.mention.host)}`
: `@${props.mention.username}`;
text.value += " ";
}
2023-04-08 00:01:42 +00:00
if (
props.reply &&
2024-04-13 15:08:58 +00:00
(props.reply.user.username !== me!.username ||
2023-04-08 00:01:42 +00:00
(props.reply.user.host != null && props.reply.user.host !== host))
) {
text.value = `@${props.reply.user.username}${
2024-03-28 16:26:52 +00:00
props.reply.user.host != null ? "@" + toASCII(props.reply.user.host) : ""
2023-04-08 00:01:42 +00:00
} `;
}
if (props.reply && props.reply.text != null) {
const ast = mfm.parse(props.reply.text);
const otherHost = props.reply.user.host;
for (const x of extractMentions(ast)) {
2023-04-08 00:01:42 +00:00
const mention = x.host
? `@${x.username}@${toASCII(x.host)}`
: otherHost == null || otherHost === host
2024-02-11 17:50:57 +00:00
? `@${x.username}`
: `@${x.username}@${toASCII(otherHost)}`;
2023-11-22 13:21:47 +00:00
// exclude me
2024-04-13 15:08:58 +00:00
if (me!.username === x.username && (x.host == null || x.host === host))
2023-04-08 00:01:42 +00:00
continue;
2023-11-22 13:21:47 +00:00
// remove duplicates
if (text.value.includes(`${mention} `)) continue;
text.value += `${mention} `;
}
}
if (props.channel) {
visibility.value = "public";
2023-11-22 13:21:47 +00:00
localOnly.value = true; // TODO: Delete this once channels get federated
}
2023-11-22 13:21:47 +00:00
// Inherit the original visibility
2023-04-08 00:01:42 +00:00
if (
props.reply &&
["home", "followers", "specified"].includes(props.reply.visibility)
) {
if (props.reply.visibility === "home" && visibility.value === "followers") {
visibility.value = "followers";
2023-05-02 03:32:18 +00:00
} else if (
["home", "followers"].includes(props.reply.visibility) &&
visibility.value === "specified"
2023-05-02 03:32:18 +00:00
) {
visibility.value = "specified";
} else {
visibility.value = props.reply.visibility;
}
if (visibility.value === "specified") {
if (props.reply.visibleUserIds) {
2023-05-02 03:32:18 +00:00
os.api("users/show", {
userIds: props.reply.visibleUserIds.filter(
2024-04-13 15:08:58 +00:00
(uid) => uid !== me!.id && uid !== props.reply!.userId,
2023-05-02 03:32:18 +00:00
),
}).then((users) => {
users.forEach(pushVisibleUser);
});
2024-02-20 22:24:52 +00:00
} else {
visibility.value = "private";
}
2024-04-13 15:08:58 +00:00
if (props.reply.userId !== me!.id) {
2024-03-28 16:26:52 +00:00
os.api("users/show", { userId: props.reply.userId }).then((user) => {
pushVisibleUser(user);
});
}
}
}
if (props.specified) {
visibility.value = "specified";
pushVisibleUser(props.specified);
}
const addRe = (s: string) => {
if (
!defaultStore.state.addRe ||
s.trim() === "" ||
s.slice(0, 3).toLowerCase() === "re:"
)
return s;
return `re: ${s}`;
};
// keep cw when reply
if (defaultStore.state.keepCw && props.reply && props.reply.cw) {
useCw.value = true;
cw.value =
2024-04-13 15:08:58 +00:00
props.reply.user.username === me!.username
? props.reply.cw
: addRe(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());
watch(language, () => saveDraft());
}
function checkMissingMention() {
if (visibility.value === "specified") {
const ast = mfm.parse(text.value);
for (const x of extractMentions(ast)) {
2023-04-08 00:01:42 +00:00
if (
!visibleUsers.value.some(
2023-07-06 01:28:27 +00:00
(u) => u.username === x.username && u.host === x.host,
2023-04-08 00:01:42 +00:00
)
) {
hasNotSpecifiedMentions.value = true;
return;
}
}
hasNotSpecifiedMentions.value = false;
}
}
function addMissingMention() {
const ast = mfm.parse(text.value);
Migrate to Vue3 (#6587) * Update reaction.vue * fix bug * wip * wip * wjio * wip * Revert "wip" This reverts commit e427f2160adf4e8a4147006e25a89854edab0033. * wip * wip * wip * Update init.ts * Update drive-window.vue * wip * wip * Use PascalCase for components * Use PascalCase for components * update dep * wip * wip * wip * Update init.ts * wip * Update paging.ts * Update test.vue * watch deep * wip * lint * wip * wip * wip * wip * wiop * wip * Update webpack.config.ts * alllow null poll * wip * wip * wip * wiop * UI redesign & refactor (#6714) * wip * wip * wip * wip * wip * Update drive.vue * Update word-mute.vue * wip * wip * wip * clean up * wip * Update default.vue * wip * Update notes.vue * Update mfm.ts * Update index.home.vue * Update post-form.vue * Update post-form-attaches.vue * wip * Update post-form.vue * Update sidebar.vue * wip * wip * Update index.vue * wip * Update default.vue * Update index.vue * Update index.vue * wip * Update post-form-attaches.vue * Update note.vue * wip * clean up * Update notes.vue * wip * wip * Update ja-JP.yml * wip * wip * Update index.vue * wip * wip * wip * wip * wip * wip * wip * wip * Update default.vue * wip * Update _dark.json5 * wip * wip * wip * clean up * wip * wip * Update index.vue * Update test.vue * wip * wip * fix * wip * wip * wip * wip * clena yop * wip * wip * Update store.ts * Update messaging-room.vue * Update default.widgets.vue * fix * wip * wip * Update modal.vue * wip * Update os.ts * Update os.ts * Update deck.vue * Update init.ts * wip * Update ja-JP.yml * v-sizeは単にwindowのresizeを監視するだけで良いかもしれない * Update modal.vue * wip * Update tooltip.ts * wip * wip * wip * wip * wip * Update image-viewer.vue * wip * wip * Update style.scss * Update style.scss * Update visitor.vue * wip * Update init.ts * Update init.ts * wip * wip * Update visitor.vue * Update visitor.vue * Update visitor.vue * Update visitor.vue * wip * wip * Update modal.vue * Update header.vue * Update menu.vue * Update about.vue * Update about-misskey.vue * wip * wip * Update visitor.vue * Update tooltip.ts * wip * Update drive.vue * wip * Update style.scss * Update header.vue * wip * wip * Update users.user.vue * Update announcements.vue * wip * wip * wip * Update emojis.vue * wip * Update emojis.vue * Update style.scss * Update users.vue * wip * Update style.scss * wip * Update welcome.entrance.vue * Update radio.vue * Update size.ts * Update emoji-edit-dialog.vue * wip * Update emojis.vue * wip * Update emojis.vue * Update emojis.vue * Update emojis.vue * wip * wip * wip * wip * Update file-dialog.vue * wip * wip * Update token-generate-window.vue * Update notification-setting-window.vue * wip * wip * Update _error_.vue * Update ja-JP.yml * wip * wip * Update store.ts * Update emojis.vue * Update emojis.vue * Update emojis.vue * Update announcements.vue * Update store.ts * wip * Update page-editor.vue * wip * wip * Update modal.vue * wip * Update select-file.ts * Update timeline.vue * Update emojis.vue * Update os.ts * wip * Update user-select.vue * Update mfm.ts * Update get-file-info.ts * Update drive.vue * Update init.ts * Update mfm.ts * wip * wip * Update window.vue * Update note.vue * wip * wip * Update user-info.vue * wip * wip * wip * wip * wip * Update header.vue * Update header.vue * wip * Update explore.vue * wip * wip * wip * Update webpack.config.ts * wip * wip * wip * wip * wip * wip * Update autocomplete.ts * wip * wip * wip * Update toast.vue * wip * Update post-form-dialog.vue * wip * wip * wip * wip * wip * Update users.vue * wip * Update explore.vue * wip * wip * wip * Update package.json * wip * Update icon-dialog.vue * wip * wip * Update user-preview.ts * wip * wip * wip * wip * wip * Update instance.vue * Update user-name.vue * Update federation.vue * Update instance.vue * wip * wip * Update tag.vue * wip * wip * wip * wip * wip * Update instance.vue * wip * Update os.ts * Update os.ts * wip * wip * wip * Update router.ts * wip * Update init.ts * Update note.vue * Update messages.vue * wip * wip * wip * wip * wip * google * wip * wip * wip * wip * Update theme-editor.vue * wip * wip * Update room.vue * Update channel-editor.vue * wip * Update window.vue * Update window.vue * wip * Update window.vue * Update window.vue * wip * Update menu.vue * wip * wip * wip * wip * Update messaging-room.vue * wip * Update post-form.vue * Update default.widgets.vue * Update window.vue * wip
2020-10-17 11:12:00 +00:00
for (const x of extractMentions(ast)) {
2023-04-08 00:01:42 +00:00
if (
!visibleUsers.value.some(
2023-07-06 01:28:27 +00:00
(u) => u.username === x.username && u.host === x.host,
2023-04-08 00:01:42 +00:00
)
) {
os.api("users/show", { username: x.username, host: x.host }).then(
(user) => {
visibleUsers.value.push(user);
2023-07-06 01:28:27 +00:00
},
2023-04-08 00:01:42 +00:00
);
Migrate to Vue3 (#6587) * Update reaction.vue * fix bug * wip * wip * wjio * wip * Revert "wip" This reverts commit e427f2160adf4e8a4147006e25a89854edab0033. * wip * wip * wip * Update init.ts * Update drive-window.vue * wip * wip * Use PascalCase for components * Use PascalCase for components * update dep * wip * wip * wip * Update init.ts * wip * Update paging.ts * Update test.vue * watch deep * wip * lint * wip * wip * wip * wip * wiop * wip * Update webpack.config.ts * alllow null poll * wip * wip * wip * wiop * UI redesign & refactor (#6714) * wip * wip * wip * wip * wip * Update drive.vue * Update word-mute.vue * wip * wip * wip * clean up * wip * Update default.vue * wip * Update notes.vue * Update mfm.ts * Update index.home.vue * Update post-form.vue * Update post-form-attaches.vue * wip * Update post-form.vue * Update sidebar.vue * wip * wip * Update index.vue * wip * Update default.vue * Update index.vue * Update index.vue * wip * Update post-form-attaches.vue * Update note.vue * wip * clean up * Update notes.vue * wip * wip * Update ja-JP.yml * wip * wip * Update index.vue * wip * wip * wip * wip * wip * wip * wip * wip * Update default.vue * wip * Update _dark.json5 * wip * wip * wip * clean up * wip * wip * Update index.vue * Update test.vue * wip * wip * fix * wip * wip * wip * wip * clena yop * wip * wip * Update store.ts * Update messaging-room.vue * Update default.widgets.vue * fix * wip * wip * Update modal.vue * wip * Update os.ts * Update os.ts * Update deck.vue * Update init.ts * wip * Update ja-JP.yml * v-sizeは単にwindowのresizeを監視するだけで良いかもしれない * Update modal.vue * wip * Update tooltip.ts * wip * wip * wip * wip * wip * Update image-viewer.vue * wip * wip * Update style.scss * Update style.scss * Update visitor.vue * wip * Update init.ts * Update init.ts * wip * wip * Update visitor.vue * Update visitor.vue * Update visitor.vue * Update visitor.vue * wip * wip * Update modal.vue * Update header.vue * Update menu.vue * Update about.vue * Update about-misskey.vue * wip * wip * Update visitor.vue * Update tooltip.ts * wip * Update drive.vue * wip * Update style.scss * Update header.vue * wip * wip * Update users.user.vue * Update announcements.vue * wip * wip * wip * Update emojis.vue * wip * Update emojis.vue * Update style.scss * Update users.vue * wip * Update style.scss * wip * Update welcome.entrance.vue * Update radio.vue * Update size.ts * Update emoji-edit-dialog.vue * wip * Update emojis.vue * wip * Update emojis.vue * Update emojis.vue * Update emojis.vue * wip * wip * wip * wip * Update file-dialog.vue * wip * wip * Update token-generate-window.vue * Update notification-setting-window.vue * wip * wip * Update _error_.vue * Update ja-JP.yml * wip * wip * Update store.ts * Update emojis.vue * Update emojis.vue * Update emojis.vue * Update announcements.vue * Update store.ts * wip * Update page-editor.vue * wip * wip * Update modal.vue * wip * Update select-file.ts * Update timeline.vue * Update emojis.vue * Update os.ts * wip * Update user-select.vue * Update mfm.ts * Update get-file-info.ts * Update drive.vue * Update init.ts * Update mfm.ts * wip * wip * Update window.vue * Update note.vue * wip * wip * Update user-info.vue * wip * wip * wip * wip * wip * Update header.vue * Update header.vue * wip * Update explore.vue * wip * wip * wip * Update webpack.config.ts * wip * wip * wip * wip * wip * wip * Update autocomplete.ts * wip * wip * wip * Update toast.vue * wip * Update post-form-dialog.vue * wip * wip * wip * wip * wip * Update users.vue * wip * Update explore.vue * wip * wip * wip * Update package.json * wip * Update icon-dialog.vue * wip * wip * Update user-preview.ts * wip * wip * wip * wip * wip * Update instance.vue * Update user-name.vue * Update federation.vue * Update instance.vue * wip * wip * Update tag.vue * wip * wip * wip * wip * wip * Update instance.vue * wip * Update os.ts * Update os.ts * wip * wip * wip * Update router.ts * wip * Update init.ts * Update note.vue * Update messages.vue * wip * wip * wip * wip * wip * google * wip * wip * wip * wip * Update theme-editor.vue * wip * wip * Update room.vue * Update channel-editor.vue * wip * Update window.vue * Update window.vue * wip * Update window.vue * Update window.vue * wip * Update menu.vue * wip * wip * wip * wip * Update messaging-room.vue * wip * Update post-form.vue * Update default.widgets.vue * Update window.vue * wip
2020-10-17 11:12:00 +00:00
}
}
}
function togglePoll() {
if (poll.value) {
poll.value = null;
} else {
poll.value = {
2023-04-08 00:01:42 +00:00
choices: ["", ""],
multiple: false,
expiresAt: null,
expiredAfter: null,
};
}
}
Migrate to Vue3 (#6587) * Update reaction.vue * fix bug * wip * wip * wjio * wip * Revert "wip" This reverts commit e427f2160adf4e8a4147006e25a89854edab0033. * wip * wip * wip * Update init.ts * Update drive-window.vue * wip * wip * Use PascalCase for components * Use PascalCase for components * update dep * wip * wip * wip * Update init.ts * wip * Update paging.ts * Update test.vue * watch deep * wip * lint * wip * wip * wip * wip * wiop * wip * Update webpack.config.ts * alllow null poll * wip * wip * wip * wiop * UI redesign & refactor (#6714) * wip * wip * wip * wip * wip * Update drive.vue * Update word-mute.vue * wip * wip * wip * clean up * wip * Update default.vue * wip * Update notes.vue * Update mfm.ts * Update index.home.vue * Update post-form.vue * Update post-form-attaches.vue * wip * Update post-form.vue * Update sidebar.vue * wip * wip * Update index.vue * wip * Update default.vue * Update index.vue * Update index.vue * wip * Update post-form-attaches.vue * Update note.vue * wip * clean up * Update notes.vue * wip * wip * Update ja-JP.yml * wip * wip * Update index.vue * wip * wip * wip * wip * wip * wip * wip * wip * Update default.vue * wip * Update _dark.json5 * wip * wip * wip * clean up * wip * wip * Update index.vue * Update test.vue * wip * wip * fix * wip * wip * wip * wip * clena yop * wip * wip * Update store.ts * Update messaging-room.vue * Update default.widgets.vue * fix * wip * wip * Update modal.vue * wip * Update os.ts * Update os.ts * Update deck.vue * Update init.ts * wip * Update ja-JP.yml * v-sizeは単にwindowのresizeを監視するだけで良いかもしれない * Update modal.vue * wip * Update tooltip.ts * wip * wip * wip * wip * wip * Update image-viewer.vue * wip * wip * Update style.scss * Update style.scss * Update visitor.vue * wip * Update init.ts * Update init.ts * wip * wip * Update visitor.vue * Update visitor.vue * Update visitor.vue * Update visitor.vue * wip * wip * Update modal.vue * Update header.vue * Update menu.vue * Update about.vue * Update about-misskey.vue * wip * wip * Update visitor.vue * Update tooltip.ts * wip * Update drive.vue * wip * Update style.scss * Update header.vue * wip * wip * Update users.user.vue * Update announcements.vue * wip * wip * wip * Update emojis.vue * wip * Update emojis.vue * Update style.scss * Update users.vue * wip * Update style.scss * wip * Update welcome.entrance.vue * Update radio.vue * Update size.ts * Update emoji-edit-dialog.vue * wip * Update emojis.vue * wip * Update emojis.vue * Update emojis.vue * Update emojis.vue * wip * wip * wip * wip * Update file-dialog.vue * wip * wip * Update token-generate-window.vue * Update notification-setting-window.vue * wip * wip * Update _error_.vue * Update ja-JP.yml * wip * wip * Update store.ts * Update emojis.vue * Update emojis.vue * Update emojis.vue * Update announcements.vue * Update store.ts * wip * Update page-editor.vue * wip * wip * Update modal.vue * wip * Update select-file.ts * Update timeline.vue * Update emojis.vue * Update os.ts * wip * Update user-select.vue * Update mfm.ts * Update get-file-info.ts * Update drive.vue * Update init.ts * Update mfm.ts * wip * wip * Update window.vue * Update note.vue * wip * wip * Update user-info.vue * wip * wip * wip * wip * wip * Update header.vue * Update header.vue * wip * Update explore.vue * wip * wip * wip * Update webpack.config.ts * wip * wip * wip * wip * wip * wip * Update autocomplete.ts * wip * wip * wip * Update toast.vue * wip * Update post-form-dialog.vue * wip * wip * wip * wip * wip * Update users.vue * wip * Update explore.vue * wip * wip * wip * Update package.json * wip * Update icon-dialog.vue * wip * wip * Update user-preview.ts * wip * wip * wip * wip * wip * Update instance.vue * Update user-name.vue * Update federation.vue * Update instance.vue * wip * wip * Update tag.vue * wip * wip * wip * wip * wip * Update instance.vue * wip * Update os.ts * Update os.ts * wip * wip * wip * Update router.ts * wip * Update init.ts * Update note.vue * Update messages.vue * wip * wip * wip * wip * wip * google * wip * wip * wip * wip * Update theme-editor.vue * wip * wip * Update room.vue * Update channel-editor.vue * wip * Update window.vue * Update window.vue * wip * Update window.vue * Update window.vue * wip * Update menu.vue * wip * wip * wip * wip * Update messaging-room.vue * wip * Update post-form.vue * Update default.widgets.vue * Update window.vue * wip
2020-10-17 11:12:00 +00:00
function focus() {
if (textareaEl.value) {
textareaEl.value.focus();
textareaEl.value.setSelectionRange(
textareaEl.value.value.length,
textareaEl.value.value.length,
2023-04-08 00:01:42 +00:00
);
2022-02-09 12:27:42 +00:00
}
}
2021-04-15 15:13:20 +00:00
function chooseFileFrom(ev) {
2023-04-08 00:01:42 +00:00
selectFiles(ev.currentTarget ?? ev.target, i18n.ts.attachFile).then(
(files_) => {
for (const file of files_) {
files.value.push(file);
2023-04-08 00:01:42 +00:00
}
2023-07-06 01:28:27 +00:00
},
2023-04-08 00:01:42 +00:00
);
}
function detachFile(id) {
files.value = files.value.filter((x) => x.id !== id);
}
2022-01-20 14:15:08 +00:00
function updateFiles(_files) {
files.value = _files;
}
function updateFileSensitive(file, sensitive) {
files.value[files.value.findIndex((x) => x.id === file.id)].isSensitive =
sensitive;
}
function updateFileName(file, name) {
files.value[files.value.findIndex((x) => x.id === file.id)].name = name;
}
function upload(file: File, name?: string) {
2023-04-08 00:01:42 +00:00
uploadFile(file, defaultStore.state.uploadFolder, name).then((res) => {
files.value.push(res);
});
}
function setVisibility() {
if (props.channel) {
// TODO: information dialog
return;
}
2021-04-15 15:13:20 +00:00
2023-04-08 00:01:42 +00:00
os.popup(
2024-04-09 11:29:27 +00:00
MkVisibilityPicker,
2023-04-08 00:01:42 +00:00
{
currentVisibility: visibility.value,
currentLocalOnly: localOnly.value,
src: visibilityButton.value,
2021-04-15 15:13:20 +00:00
},
2023-04-08 00:01:42 +00:00
{
changeVisibility: (v) => {
visibility.value = v;
2023-04-08 00:01:42 +00:00
if (defaultStore.state.rememberNoteVisibility) {
defaultStore.set("visibility", visibility.value);
2023-04-08 00:01:42 +00:00
}
},
changeLocalOnly: (v) => {
localOnly.value = v;
2023-04-08 00:01:42 +00:00
if (defaultStore.state.rememberNoteVisibility) {
defaultStore.set("localOnly", localOnly.value);
2023-04-08 00:01:42 +00:00
}
},
},
2023-07-06 01:28:27 +00:00
"closed",
2023-04-08 00:01:42 +00:00
);
}
const language = ref<string | null>(
2023-11-23 08:49:13 +00:00
props.initialLanguage ??
defaultStore.state.recentlyUsedPostLanguages[0] ??
localStorage.getItem("lang")?.split("-")[0],
);
function filterSubclassLanguages(
langCode: string,
2023-11-22 19:24:21 +00:00
): { langCode: string; nativeName: string }[] {
return Object.entries(langmap)
.filter(([lc, _]) => languageContains(langCode, lc))
2023-11-22 19:24:21 +00:00
.map(([langCode, v]) => {
return { langCode, nativeName: v.nativeName };
});
}
function setLanguage() {
2023-11-17 08:17:46 +00:00
const actions: Array<MenuItem> = [];
2023-11-23 08:49:13 +00:00
const detectedLanguage: string = detectLanguage(text.value) ?? "";
if (detectedLanguage !== "" && detectedLanguage !== language.value) {
actions.push({
type: "label",
text: i18n.ts.suggested,
});
for (const v of filterSubclassLanguages(detectedLanguage)) {
actions.push({
text: v.nativeName,
2023-11-17 08:17:46 +00:00
danger: false,
active: false,
action: () => {
2023-11-22 19:24:21 +00:00
language.value = v.langCode;
2023-11-17 08:17:46 +00:00
},
});
}
actions.push(null);
}
2023-11-17 08:17:46 +00:00
if (language.value != null)
actions.push({
text: langmap[language.value].nativeName,
danger: false,
active: true,
action: () => {},
});
const langs = Object.keys(langmap);
2023-11-23 08:49:13 +00:00
// Show recently used language first
let recentlyUsedLanguagesExist = false;
for (const lang of defaultStore.state.recentlyUsedPostLanguages) {
if (lang === language.value) continue;
if (!langs.includes(lang)) continue;
actions.push({
text: langmap[lang].nativeName,
danger: false,
active: false,
action: () => {
language.value = lang;
},
});
recentlyUsedLanguagesExist = true;
}
if (recentlyUsedLanguagesExist) actions.push(null);
actions.push({
text: i18n.ts.noLanguage,
danger: false,
active: false,
action: () => {
language.value = null;
},
});
for (const lang of langs) {
if (lang === language.value) continue;
2024-03-28 16:26:52 +00:00
if (defaultStore.state.recentlyUsedPostLanguages.includes(lang)) continue;
actions.push({
text: langmap[lang].nativeName,
danger: false,
active: false,
action: () => {
language.value = lang;
},
});
}
os.popupMenu(actions, languageButton.value, {});
}
function pushVisibleUser(user) {
2023-04-08 00:01:42 +00:00
if (
!visibleUsers.value.some(
2023-07-06 01:28:27 +00:00
(u) => u.username === user.username && u.host === user.host,
2023-04-08 00:01:42 +00:00
)
) {
visibleUsers.value.push(user);
}
}
function addVisibleUser() {
2023-04-08 00:01:42 +00:00
os.selectUser().then((user) => {
pushVisibleUser(user);
});
}
function removeVisibleUser(user) {
visibleUsers.value = erase(user, visibleUsers.value);
}
function clear() {
text.value = "";
files.value = [];
poll.value = null;
quoteId.value = null;
}
2023-11-22 13:21:47 +00:00
// FIXME: ev.which is deprecated
// https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/which
function onKeydown(ev: KeyboardEvent) {
2023-04-08 00:01:42 +00:00
if (
(ev.which === 10 || ev.which === 13) &&
(ev.ctrlKey || ev.metaKey) &&
canPost.value
2023-04-08 00:01:42 +00:00
)
post();
if (ev.which === 27) emit("esc");
typing();
}
function onCompositionUpdate(ev: CompositionEvent) {
imeText.value = ev.data;
typing();
}
function onCompositionEnd(ev: CompositionEvent) {
imeText.value = "";
}
async function onPaste(ev: ClipboardEvent) {
2024-04-13 15:08:58 +00:00
if (ev.clipboardData == null) return;
2023-04-08 00:01:42 +00:00
for (const { item, i } of Array.from(ev.clipboardData.items).map(
2023-07-06 01:28:27 +00:00
(item, i) => ({ item, i }),
2023-04-08 00:01:42 +00:00
)) {
if (item.kind === "file") {
const file = item.getAsFile();
2024-04-13 15:08:58 +00:00
if (file == null) continue;
2023-04-08 00:01:42 +00:00
const lio = file.name.lastIndexOf(".");
const ext = lio >= 0 ? file.name.slice(lio) : "";
const formatted = `${formatTimeString(
new Date(file.lastModified),
2023-07-06 01:28:27 +00:00
defaultStore.state.pastedFileName,
2023-04-08 00:01:42 +00:00
).replace(/{{number}}/g, `${i + 1}`)}${ext}`;
upload(file, formatted);
}
}
2023-11-22 13:21:47 +00:00
const paste = ev.clipboardData?.getData("text") ?? "";
2024-04-13 15:08:58 +00:00
if (!props.renote && !quoteId.value && paste.startsWith(`${url}/notes/`)) {
ev.preventDefault();
2022-11-16 06:38:05 +00:00
os.yesno({
2023-04-08 00:01:42 +00:00
type: "info",
text: i18n.ts.quoteQuestion,
}).then(({ canceled }) => {
if (canceled) {
2024-04-13 15:08:58 +00:00
insertTextAtCursor(textareaEl.value!, paste);
return;
}
Migrate to Vue3 (#6587) * Update reaction.vue * fix bug * wip * wip * wjio * wip * Revert "wip" This reverts commit e427f2160adf4e8a4147006e25a89854edab0033. * wip * wip * wip * Update init.ts * Update drive-window.vue * wip * wip * Use PascalCase for components * Use PascalCase for components * update dep * wip * wip * wip * Update init.ts * wip * Update paging.ts * Update test.vue * watch deep * wip * lint * wip * wip * wip * wip * wiop * wip * Update webpack.config.ts * alllow null poll * wip * wip * wip * wiop * UI redesign & refactor (#6714) * wip * wip * wip * wip * wip * Update drive.vue * Update word-mute.vue * wip * wip * wip * clean up * wip * Update default.vue * wip * Update notes.vue * Update mfm.ts * Update index.home.vue * Update post-form.vue * Update post-form-attaches.vue * wip * Update post-form.vue * Update sidebar.vue * wip * wip * Update index.vue * wip * Update default.vue * Update index.vue * Update index.vue * wip * Update post-form-attaches.vue * Update note.vue * wip * clean up * Update notes.vue * wip * wip * Update ja-JP.yml * wip * wip * Update index.vue * wip * wip * wip * wip * wip * wip * wip * wip * Update default.vue * wip * Update _dark.json5 * wip * wip * wip * clean up * wip * wip * Update index.vue * Update test.vue * wip * wip * fix * wip * wip * wip * wip * clena yop * wip * wip * Update store.ts * Update messaging-room.vue * Update default.widgets.vue * fix * wip * wip * Update modal.vue * wip * Update os.ts * Update os.ts * Update deck.vue * Update init.ts * wip * Update ja-JP.yml * v-sizeは単にwindowのresizeを監視するだけで良いかもしれない * Update modal.vue * wip * Update tooltip.ts * wip * wip * wip * wip * wip * Update image-viewer.vue * wip * wip * Update style.scss * Update style.scss * Update visitor.vue * wip * Update init.ts * Update init.ts * wip * wip * Update visitor.vue * Update visitor.vue * Update visitor.vue * Update visitor.vue * wip * wip * Update modal.vue * Update header.vue * Update menu.vue * Update about.vue * Update about-misskey.vue * wip * wip * Update visitor.vue * Update tooltip.ts * wip * Update drive.vue * wip * Update style.scss * Update header.vue * wip * wip * Update users.user.vue * Update announcements.vue * wip * wip * wip * Update emojis.vue * wip * Update emojis.vue * Update style.scss * Update users.vue * wip * Update style.scss * wip * Update welcome.entrance.vue * Update radio.vue * Update size.ts * Update emoji-edit-dialog.vue * wip * Update emojis.vue * wip * Update emojis.vue * Update emojis.vue * Update emojis.vue * wip * wip * wip * wip * Update file-dialog.vue * wip * wip * Update token-generate-window.vue * Update notification-setting-window.vue * wip * wip * Update _error_.vue * Update ja-JP.yml * wip * wip * Update store.ts * Update emojis.vue * Update emojis.vue * Update emojis.vue * Update announcements.vue * Update store.ts * wip * Update page-editor.vue * wip * wip * Update modal.vue * wip * Update select-file.ts * Update timeline.vue * Update emojis.vue * Update os.ts * wip * Update user-select.vue * Update mfm.ts * Update get-file-info.ts * Update drive.vue * Update init.ts * Update mfm.ts * wip * wip * Update window.vue * Update note.vue * wip * wip * Update user-info.vue * wip * wip * wip * wip * wip * Update header.vue * Update header.vue * wip * Update explore.vue * wip * wip * wip * Update webpack.config.ts * wip * wip * wip * wip * wip * wip * Update autocomplete.ts * wip * wip * wip * Update toast.vue * wip * Update post-form-dialog.vue * wip * wip * wip * wip * wip * Update users.vue * wip * Update explore.vue * wip * wip * wip * Update package.json * wip * Update icon-dialog.vue * wip * wip * Update user-preview.ts * wip * wip * wip * wip * wip * Update instance.vue * Update user-name.vue * Update federation.vue * Update instance.vue * wip * wip * Update tag.vue * wip * wip * wip * wip * wip * Update instance.vue * wip * Update os.ts * Update os.ts * wip * wip * wip * Update router.ts * wip * Update init.ts * Update note.vue * Update messages.vue * wip * wip * wip * wip * wip * google * wip * wip * wip * wip * Update theme-editor.vue * wip * wip * Update room.vue * Update channel-editor.vue * wip * Update window.vue * Update window.vue * wip * Update window.vue * Update window.vue * wip * Update menu.vue * wip * wip * wip * wip * Update messaging-room.vue * wip * Update post-form.vue * Update default.widgets.vue * Update window.vue * wip
2020-10-17 11:12:00 +00:00
quoteId.value = paste
2023-11-22 13:21:47 +00:00
.substring(url.length)
2024-04-13 15:08:58 +00:00
.match(/^\/notes\/(.+?)\/?$/)![1];
});
}
}
function onDragover(ev) {
if (!ev.dataTransfer.items[0]) return;
2023-04-08 00:01:42 +00:00
const isFile = ev.dataTransfer.items[0].kind === "file";
const isDriveFile = ev.dataTransfer.types[0] === _DATA_TRANSFER_DRIVE_FILE_;
if (isFile || isDriveFile) {
ev.preventDefault();
draghover.value = true;
switch (ev.dataTransfer.effectAllowed) {
2023-04-08 00:01:42 +00:00
case "all":
case "uninitialized":
case "copy":
case "copyLink":
case "copyMove":
ev.dataTransfer.dropEffect = "copy";
break;
2023-04-08 00:01:42 +00:00
case "linkMove":
case "move":
ev.dataTransfer.dropEffect = "move";
break;
default:
2023-04-08 00:01:42 +00:00
ev.dataTransfer.dropEffect = "none";
break;
}
}
}
2024-04-13 15:08:58 +00:00
function onDragenter(_ev) {
draghover.value = true;
}
2024-04-13 15:08:58 +00:00
function onDragleave(_ev) {
draghover.value = false;
}
2024-04-13 15:08:58 +00:00
function onDrop(ev: DragEvent): void {
draghover.value = false;
2024-04-13 15:08:58 +00:00
if (ev.dataTransfer == null) return;
// ファイルだったら
if (ev.dataTransfer.files.length > 0) {
ev.preventDefault();
for (const x of Array.from(ev.dataTransfer.files)) upload(x);
return;
}
2023-09-01 23:27:33 +00:00
// #region ドライブのファイル
const driveFile = ev.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FILE_);
2023-04-08 00:01:42 +00:00
if (driveFile != null && driveFile !== "") {
const file = JSON.parse(driveFile);
files.value.push(file);
ev.preventDefault();
}
2023-09-01 23:27:33 +00:00
// #endregion
}
function saveDraft() {
2023-04-08 00:01:42 +00:00
const draftData = JSON.parse(localStorage.getItem("drafts") || "{}");
draftData[draftKey.value] = {
updatedAt: new Date(),
data: {
text: text.value,
useCw: useCw.value,
cw: cw.value,
visibility: visibility.value,
localOnly: localOnly.value,
lang: language.value,
files: files.value,
poll: poll.value,
},
};
2023-04-08 00:01:42 +00:00
localStorage.setItem("drafts", JSON.stringify(draftData));
}
function deleteDraft() {
2023-04-08 00:01:42 +00:00
const draftData = JSON.parse(localStorage.getItem("drafts") || "{}");
delete draftData[draftKey.value];
2023-04-08 00:01:42 +00:00
localStorage.setItem("drafts", JSON.stringify(draftData));
}
/**
* @returns whether the file is described
*/
2024-03-30 22:44:00 +00:00
function openFileDescriptionWindow(file: entities.DriveFile) {
return new Promise<boolean>((resolve, reject) => {
os.popup(
XMediaCaption,
{
title: i18n.ts.describeFile,
input: {
placeholder: i18n.ts.inputNewDescription,
default: file.comment !== null ? file.comment : "",
},
image: file,
},
{
done: (result) => {
if (!result || result.canceled) {
resolve(false);
return;
}
2024-04-21 22:14:56 +00:00
const comment = result.result?.length === 0 ? null : result.result;
2024-03-30 22:44:00 +00:00
os.api("drive/files/update", {
fileId: file.id,
comment,
2024-03-30 22:44:00 +00:00
})
.then(() => {
resolve(true);
2024-04-21 22:14:56 +00:00
file.comment = comment ?? null;
2024-03-30 22:44:00 +00:00
})
.catch((err: unknown) => {
reject(err);
});
},
},
"closed",
);
2024-03-30 22:44:00 +00:00
});
}
async function post() {
// For text that is too short, the false positive rate may be too high, so we don't show alarm.
if (defaultStore.state.autocorrectNoteLanguage && text.value.length > 10) {
const detectedLanguage: string = detectLanguage(text.value) ?? "";
const currentLanguageName: string | undefined | false =
language.value && langmap[language.value]?.nativeName;
const detectedLanguageName: string | undefined | false =
detectedLanguage !== "" && langmap[detectedLanguage]?.nativeName;
if (
currentLanguageName &&
detectedLanguageName &&
2024-03-24 03:00:49 +00:00
!isSameLanguage(detectedLanguage, language.value) &&
isSupportedLang(parentLanguage(language.value))
) {
// "canceled" means "post with detected language".
const { canceled } = await os.confirm({
type: "warning",
text: i18n.t("incorrectLanguageWarning", {
detected: detectedLanguageName,
current: currentLanguageName,
}),
okText: i18n.ts.no,
cancelText: i18n.ts.yes,
isPlaintext: true,
});
if (canceled) {
language.value = detectedLanguage;
}
}
}
if (
defaultStore.state.showAddFileDescriptionAtFirstPost &&
files.value.some((f) => f.comment == null || f.comment.length === 0)
) {
if (isFirstPostAttempt) {
for (const file of files.value) {
if (file.comment == null || file.comment.length === 0) {
const described = await openFileDescriptionWindow(file);
if (!described) {
return;
}
}
}
isFirstPostAttempt = false;
return;
}
}
if (
defaultStore.state.showNoAltTextWarning &&
files.value.some((f) => f.comment == null || f.comment.length === 0)
) {
// "canceled" means "post anyway"
const { canceled } = await os.confirm({
type: "warning",
text: i18n.ts.noAltTextWarning,
okText: i18n.ts.describeFile,
cancelText: i18n.ts.toPost,
isPlaintext: true,
});
if (!canceled) {
for (const file of files.value) {
if (file.comment == null || file.comment.length === 0) {
const described = await openFileDescriptionWindow(file);
if (!described) {
return;
}
}
}
return;
}
}
const processedText = preprocess(text.value);
2024-04-13 15:08:58 +00:00
let postData: ApiTypes.NoteSubmitReq = {
2023-05-07 10:27:25 +00:00
editId: props.editId ? props.editId : undefined,
2023-04-08 00:01:42 +00:00
text: processedText === "" ? undefined : processedText,
2024-03-28 16:26:52 +00:00
fileIds: files.value.length > 0 ? files.value.map((f) => f.id) : undefined,
replyId: props.reply ? props.reply.id : undefined,
2023-04-08 00:01:42 +00:00
renoteId: props.renote
? props.renote.id
: quoteId.value
2024-02-11 17:50:57 +00:00
? quoteId.value
: undefined,
channelId: props.channel ? props.channel.id : undefined,
poll: poll.value,
cw: useCw.value ? cw.value || "" : undefined,
lang: language.value ? language.value : undefined,
localOnly: localOnly.value,
2024-03-28 16:26:52 +00:00
visibility: visibility.value === "private" ? "specified" : visibility.value,
2023-04-08 00:01:42 +00:00
visibleUserIds:
2024-02-20 22:24:52 +00:00
visibility.value === "private"
? []
: visibility.value === "specified"
? visibleUsers.value.map((u) => u.id)
: undefined,
};
if (withHashtags.value && hashtags.value && hashtags.value.trim() !== "") {
const hashtags_ = hashtags.value
2023-04-08 00:01:42 +00:00
.trim()
.split(" ")
2024-04-13 15:08:58 +00:00
.map((x) => (x.startsWith("#") ? x : `#${x}`))
2023-04-08 00:01:42 +00:00
.join(" ");
2024-03-28 16:26:52 +00:00
postData.text = postData.text ? `${postData.text} ${hashtags_}` : hashtags_;
}
// plugin
if (notePostInterruptors.length > 0) {
for (const interruptor of notePostInterruptors) {
postData = await interruptor.handler(deepClone(postData));
}
}
2024-04-13 15:08:58 +00:00
let token: string | undefined;
if (postAccount.value) {
const storedAccounts = await getAccounts();
2024-04-13 15:08:58 +00:00
token = storedAccounts.find((x) => x.id === postAccount.value!.id)?.token;
}
posting.value = true;
2023-05-07 10:27:25 +00:00
os.api(postData.editId ? "notes/edit" : "notes/create", postData, token)
2023-04-08 00:01:42 +00:00
.then(() => {
clear();
nextTick(() => {
deleteDraft();
emit("posted");
if (postData.text && postData.text !== "") {
2024-04-13 15:08:58 +00:00
const hashtags_ = (
mfm
.parse(postData.text)
.filter((x) => x.type === "hashtag") as mfm.MfmHashtag[]
).map((x) => x.props.hashtag);
2023-04-08 00:01:42 +00:00
const history = JSON.parse(
2023-07-06 01:28:27 +00:00
localStorage.getItem("hashtags") || "[]",
2023-04-08 00:01:42 +00:00
) as string[];
localStorage.setItem(
"hashtags",
2023-07-06 01:28:27 +00:00
JSON.stringify(unique(hashtags_.concat(history))),
2023-04-08 00:01:42 +00:00
);
}
posting.value = false;
postAccount.value = null;
2024-04-13 15:08:58 +00:00
nextTick(() => autosize.update(textareaEl.value!));
2023-04-08 00:01:42 +00:00
});
})
2024-04-12 14:02:03 +00:00
.catch((err: { message: string; id: string }) => {
posting.value = false;
2023-04-08 00:01:42 +00:00
os.alert({
type: "error",
2024-04-12 14:02:03 +00:00
text: `${err.message}\n${err.id}`,
2023-04-08 00:01:42 +00:00
});
});
2023-09-17 21:59:09 +00:00
vibrate([10, 20, 10, 20, 10, 20, 60]);
2023-11-23 08:49:13 +00:00
// update recentlyUsedLanguages
if (language.value != null) {
const languages = Object.keys(langmap);
2023-11-23 16:31:24 +00:00
const maxLength = 6;
2023-11-23 08:49:13 +00:00
defaultStore.set(
"recentlyUsedPostLanguages",
[language.value]
.concat(
2024-03-28 16:26:52 +00:00
defaultStore.state.recentlyUsedPostLanguages.filter((lang) => {
return lang !== language.value && languages.includes(lang);
}),
)
.slice(0, maxLength),
);
2023-11-23 08:49:13 +00:00
}
}
function cancel() {
2023-04-08 00:01:42 +00:00
emit("cancel");
}
function insertMention() {
2023-04-08 00:01:42 +00:00
os.selectUser().then((user) => {
2024-04-13 15:08:58 +00:00
insertTextAtCursor(textareaEl.value!, `@${acct.toString(user)} `);
});
}
async function insertEmoji(ev: MouseEvent) {
2024-04-13 15:08:58 +00:00
os.openEmojiPicker(
(ev.currentTarget ?? ev.target) as HTMLElement,
{},
textareaEl.value!,
2024-04-13 15:08:58 +00:00
);
}
2023-01-29 02:56:48 +00:00
async function openCheatSheet(ev: MouseEvent) {
2023-04-08 00:01:42 +00:00
os.popup(XCheatSheet, {}, {}, "closed");
2023-01-29 02:56:48 +00:00
}
2024-04-13 15:08:58 +00:00
function showActions(ev: MouseEvent) {
2023-04-08 00:01:42 +00:00
os.popupMenu(
postFormActions.map((action) => ({
text: action.title,
action: () => {
action.handler(
{
text: text.value,
2023-04-08 00:01:42 +00:00
},
(key, value) => {
if (key === "text") {
text.value = value;
2023-04-08 00:01:42 +00:00
}
2023-07-06 01:28:27 +00:00
},
2023-04-08 00:01:42 +00:00
);
},
})),
2024-04-13 15:08:58 +00:00
(ev.currentTarget ?? ev.target) as HTMLElement,
2023-04-08 00:01:42 +00:00
);
}
const postAccount = ref<entities.UserDetailed | null>(null);
function openAccountMenu(ev: MouseEvent) {
2023-04-08 00:01:42 +00:00
openAccountMenu_(
{
withExtraOperation: false,
includeCurrentAccount: true,
2024-04-13 15:08:58 +00:00
active: postAccount.value != null ? postAccount.value.id : me!.id,
2023-04-08 00:01:42 +00:00
onChoose: (account) => {
2024-04-13 15:08:58 +00:00
if (account.id === me!.id) {
postAccount.value = null;
2023-04-08 00:01:42 +00:00
} else {
postAccount.value = account;
2023-04-08 00:01:42 +00:00
}
},
},
2023-07-06 01:28:27 +00:00
ev,
2023-04-08 00:01:42 +00:00
);
}
onMounted(() => {
if (props.autofocus) {
focus();
nextTick(() => {
focus();
});
}
// TODO: detach when unmount
2024-04-13 15:08:58 +00:00
new Autocomplete(textareaEl.value!, text);
new Autocomplete(cwInputEl.value!, cw as Ref<string>);
new Autocomplete(hashtagsInputEl.value!, hashtags as Ref<string>);
2024-04-13 15:08:58 +00:00
autosize(textareaEl.value!);
nextTick(() => {
2024-04-13 15:08:58 +00:00
autosize(textareaEl.value!);
// 書きかけの投稿を復元
2022-01-27 08:38:02 +00:00
if (!props.instant && !props.mention && !props.specified) {
2023-04-08 00:01:42 +00:00
const draft = JSON.parse(localStorage.getItem("drafts") || "{}")[
draftKey.value
2023-04-08 00:01:42 +00:00
];
if (draft) {
text.value = draft.data.text;
useCw.value = draft.data.useCw;
cw.value = draft.data.cw;
visibility.value = draft.data.visibility;
localOnly.value = draft.data.localOnly;
language.value = draft.data.lang;
2024-03-28 16:26:52 +00:00
files.value = (draft.data.files || []).filter((draftFile) => draftFile);
if (draft.data.poll) {
poll.value = draft.data.poll;
}
}
}
// 削除して編集
if (props.initialNote) {
const init = props.initialNote;
text.value = init.text ? init.text : "";
files.value = init.files;
cw.value = init.cw;
useCw.value = init.cw != null;
if (init.poll) {
poll.value = {
2023-04-08 00:01:42 +00:00
choices: init.poll.choices.map((x) => x.text),
multiple: init.poll.multiple,
expiresAt: init.poll.expiresAt,
expiredAfter: init.poll.expiredAfter,
};
}
visibility.value = init.visibility;
2024-04-13 15:08:58 +00:00
localOnly.value = init.localOnly ?? false;
language.value = init.lang ?? null;
quoteId.value = init.renote ? init.renote.id : null;
}
// Inherit language settings when quoting or replying
if (props.renote?.lang) {
language.value = props.renote.lang;
}
if (props.reply?.lang) {
language.value = props.reply.lang;
}
nextTick(() => watchForDraft());
2024-04-13 15:08:58 +00:00
nextTick(() => autosize.update(textareaEl.value!));
});
});
</script>
<style lang="scss" scoped>
2023-01-29 02:56:48 +00:00
.right {
2023-04-08 00:01:42 +00:00
float: right;
2023-01-29 02:56:48 +00:00
}
.gafaadew {
Migrate to Vue3 (#6587) * Update reaction.vue * fix bug * wip * wip * wjio * wip * Revert "wip" This reverts commit e427f2160adf4e8a4147006e25a89854edab0033. * wip * wip * wip * Update init.ts * Update drive-window.vue * wip * wip * Use PascalCase for components * Use PascalCase for components * update dep * wip * wip * wip * Update init.ts * wip * Update paging.ts * Update test.vue * watch deep * wip * lint * wip * wip * wip * wip * wiop * wip * Update webpack.config.ts * alllow null poll * wip * wip * wip * wiop * UI redesign & refactor (#6714) * wip * wip * wip * wip * wip * Update drive.vue * Update word-mute.vue * wip * wip * wip * clean up * wip * Update default.vue * wip * Update notes.vue * Update mfm.ts * Update index.home.vue * Update post-form.vue * Update post-form-attaches.vue * wip * Update post-form.vue * Update sidebar.vue * wip * wip * Update index.vue * wip * Update default.vue * Update index.vue * Update index.vue * wip * Update post-form-attaches.vue * Update note.vue * wip * clean up * Update notes.vue * wip * wip * Update ja-JP.yml * wip * wip * Update index.vue * wip * wip * wip * wip * wip * wip * wip * wip * Update default.vue * wip * Update _dark.json5 * wip * wip * wip * clean up * wip * wip * Update index.vue * Update test.vue * wip * wip * fix * wip * wip * wip * wip * clena yop * wip * wip * Update store.ts * Update messaging-room.vue * Update default.widgets.vue * fix * wip * wip * Update modal.vue * wip * Update os.ts * Update os.ts * Update deck.vue * Update init.ts * wip * Update ja-JP.yml * v-sizeは単にwindowのresizeを監視するだけで良いかもしれない * Update modal.vue * wip * Update tooltip.ts * wip * wip * wip * wip * wip * Update image-viewer.vue * wip * wip * Update style.scss * Update style.scss * Update visitor.vue * wip * Update init.ts * Update init.ts * wip * wip * Update visitor.vue * Update visitor.vue * Update visitor.vue * Update visitor.vue * wip * wip * Update modal.vue * Update header.vue * Update menu.vue * Update about.vue * Update about-misskey.vue * wip * wip * Update visitor.vue * Update tooltip.ts * wip * Update drive.vue * wip * Update style.scss * Update header.vue * wip * wip * Update users.user.vue * Update announcements.vue * wip * wip * wip * Update emojis.vue * wip * Update emojis.vue * Update style.scss * Update users.vue * wip * Update style.scss * wip * Update welcome.entrance.vue * Update radio.vue * Update size.ts * Update emoji-edit-dialog.vue * wip * Update emojis.vue * wip * Update emojis.vue * Update emojis.vue * Update emojis.vue * wip * wip * wip * wip * Update file-dialog.vue * wip * wip * Update token-generate-window.vue * Update notification-setting-window.vue * wip * wip * Update _error_.vue * Update ja-JP.yml * wip * wip * Update store.ts * Update emojis.vue * Update emojis.vue * Update emojis.vue * Update announcements.vue * Update store.ts * wip * Update page-editor.vue * wip * wip * Update modal.vue * wip * Update select-file.ts * Update timeline.vue * Update emojis.vue * Update os.ts * wip * Update user-select.vue * Update mfm.ts * Update get-file-info.ts * Update drive.vue * Update init.ts * Update mfm.ts * wip * wip * Update window.vue * Update note.vue * wip * wip * Update user-info.vue * wip * wip * wip * wip * wip * Update header.vue * Update header.vue * wip * Update explore.vue * wip * wip * wip * Update webpack.config.ts * wip * wip * wip * wip * wip * wip * Update autocomplete.ts * wip * wip * wip * Update toast.vue * wip * Update post-form-dialog.vue * wip * wip * wip * wip * wip * Update users.vue * wip * Update explore.vue * wip * wip * wip * Update package.json * wip * Update icon-dialog.vue * wip * wip * Update user-preview.ts * wip * wip * wip * wip * wip * Update instance.vue * Update user-name.vue * Update federation.vue * Update instance.vue * wip * wip * Update tag.vue * wip * wip * wip * wip * wip * Update instance.vue * wip * Update os.ts * Update os.ts * wip * wip * wip * Update router.ts * wip * Update init.ts * Update note.vue * Update messages.vue * wip * wip * wip * wip * wip * google * wip * wip * wip * wip * Update theme-editor.vue * wip * wip * Update room.vue * Update channel-editor.vue * wip * Update window.vue * Update window.vue * wip * Update window.vue * Update window.vue * wip * Update menu.vue * wip * wip * wip * wip * Update messaging-room.vue * wip * Update post-form.vue * Update default.widgets.vue * Update window.vue * wip
2020-10-17 11:12:00 +00:00
position: relative;
&.modal {
width: 100%;
max-width: 520px;
}
> header {
2023-05-29 22:29:42 +00:00
display: flex;
flex-wrap: wrap;
z-index: 1000;
height: 66px;
> .cancel {
padding: 0;
font-size: 20px;
width: 64px;
line-height: 66px;
}
> .account {
height: 100%;
aspect-ratio: 1/1;
display: inline-flex;
vertical-align: bottom;
> .avatar {
width: 28px;
height: 28px;
margin: auto;
}
}
> .right {
position: absolute;
top: 0;
right: 0;
display: flex;
align-items: center;
> .text-count {
2020-02-11 17:55:35 +00:00
opacity: 0.7;
line-height: 66px;
}
2020-02-05 12:28:51 +00:00
> .visibility {
height: 34px;
width: 34px;
margin: 0 0 0 8px;
& + .localOnly {
margin-left: 0 !important;
}
> span:only-child > i {
display: block;
}
}
2022-11-18 04:32:24 +00:00
Migrate to Vue3 (#6587) * Update reaction.vue * fix bug * wip * wip * wjio * wip * Revert "wip" This reverts commit e427f2160adf4e8a4147006e25a89854edab0033. * wip * wip * wip * Update init.ts * Update drive-window.vue * wip * wip * Use PascalCase for components * Use PascalCase for components * update dep * wip * wip * wip * Update init.ts * wip * Update paging.ts * Update test.vue * watch deep * wip * lint * wip * wip * wip * wip * wiop * wip * Update webpack.config.ts * alllow null poll * wip * wip * wip * wiop * UI redesign & refactor (#6714) * wip * wip * wip * wip * wip * Update drive.vue * Update word-mute.vue * wip * wip * wip * clean up * wip * Update default.vue * wip * Update notes.vue * Update mfm.ts * Update index.home.vue * Update post-form.vue * Update post-form-attaches.vue * wip * Update post-form.vue * Update sidebar.vue * wip * wip * Update index.vue * wip * Update default.vue * Update index.vue * Update index.vue * wip * Update post-form-attaches.vue * Update note.vue * wip * clean up * Update notes.vue * wip * wip * Update ja-JP.yml * wip * wip * Update index.vue * wip * wip * wip * wip * wip * wip * wip * wip * Update default.vue * wip * Update _dark.json5 * wip * wip * wip * clean up * wip * wip * Update index.vue * Update test.vue * wip * wip * fix * wip * wip * wip * wip * clena yop * wip * wip * Update store.ts * Update messaging-room.vue * Update default.widgets.vue * fix * wip * wip * Update modal.vue * wip * Update os.ts * Update os.ts * Update deck.vue * Update init.ts * wip * Update ja-JP.yml * v-sizeは単にwindowのresizeを監視するだけで良いかもしれない * Update modal.vue * wip * Update tooltip.ts * wip * wip * wip * wip * wip * Update image-viewer.vue * wip * wip * Update style.scss * Update style.scss * Update visitor.vue * wip * Update init.ts * Update init.ts * wip * wip * Update visitor.vue * Update visitor.vue * Update visitor.vue * Update visitor.vue * wip * wip * Update modal.vue * Update header.vue * Update menu.vue * Update about.vue * Update about-misskey.vue * wip * wip * Update visitor.vue * Update tooltip.ts * wip * Update drive.vue * wip * Update style.scss * Update header.vue * wip * wip * Update users.user.vue * Update announcements.vue * wip * wip * wip * Update emojis.vue * wip * Update emojis.vue * Update style.scss * Update users.vue * wip * Update style.scss * wip * Update welcome.entrance.vue * Update radio.vue * Update size.ts * Update emoji-edit-dialog.vue * wip * Update emojis.vue * wip * Update emojis.vue * Update emojis.vue * Update emojis.vue * wip * wip * wip * wip * Update file-dialog.vue * wip * wip * Update token-generate-window.vue * Update notification-setting-window.vue * wip * wip * Update _error_.vue * Update ja-JP.yml * wip * wip * Update store.ts * Update emojis.vue * Update emojis.vue * Update emojis.vue * Update announcements.vue * Update store.ts * wip * Update page-editor.vue * wip * wip * Update modal.vue * wip * Update select-file.ts * Update timeline.vue * Update emojis.vue * Update os.ts * wip * Update user-select.vue * Update mfm.ts * Update get-file-info.ts * Update drive.vue * Update init.ts * Update mfm.ts * wip * wip * Update window.vue * Update note.vue * wip * wip * Update user-info.vue * wip * wip * wip * wip * wip * Update header.vue * Update header.vue * wip * Update explore.vue * wip * wip * wip * Update webpack.config.ts * wip * wip * wip * wip * wip * wip * Update autocomplete.ts * wip * wip * wip * Update toast.vue * wip * Update post-form-dialog.vue * wip * wip * wip * wip * wip * Update users.vue * wip * Update explore.vue * wip * wip * wip * Update package.json * wip * Update icon-dialog.vue * wip * wip * Update user-preview.ts * wip * wip * wip * wip * wip * Update instance.vue * Update user-name.vue * Update federation.vue * Update instance.vue * wip * wip * Update tag.vue * wip * wip * wip * wip * wip * Update instance.vue * wip * Update os.ts * Update os.ts * wip * wip * wip * Update router.ts * wip * Update init.ts * Update note.vue * Update messages.vue * wip * wip * wip * wip * wip * google * wip * wip * wip * wip * Update theme-editor.vue * wip * wip * Update room.vue * Update channel-editor.vue * wip * Update window.vue * Update window.vue * wip * Update window.vue * Update window.vue * wip * Update menu.vue * wip * wip * wip * wip * Update messaging-room.vue * wip * Update post-form.vue * Update default.widgets.vue * Update window.vue * wip
2020-10-17 11:12:00 +00:00
> .local-only {
margin: 0 0 0 12px;
opacity: 0.7;
2020-02-05 12:28:51 +00:00
}
> .language {
height: 34px;
width: 34px;
}
> .preview {
display: inline-block;
padding: 0;
margin: 0 8px 0 0;
font-size: inherit !important;
width: 34px;
height: 34px;
border-radius: 6px;
&:hover {
background: var(--X5);
}
&.active {
color: var(--accent);
}
}
> .submit {
display: inline-flex;
align-items: center;
2020-02-05 12:28:51 +00:00
margin: 16px 16px 16px 0;
2020-02-08 08:49:54 +00:00
padding: 0 12px;
line-height: 34px;
2020-02-08 08:49:54 +00:00
font-weight: bold;
vertical-align: bottom;
border-radius: 4px;
2021-10-16 06:00:55 +00:00
font-size: 0.9em;
&:disabled {
opacity: 0.7;
}
2020-02-08 08:49:54 +00:00
2024-04-05 03:40:58 +00:00
> .spinner,
> i {
2020-02-08 08:49:54 +00:00
margin-left: 6px;
}
}
}
}
> .form {
> .preview {
padding: 16px;
}
> .with-quote {
display: flex;
align-items: center;
2023-05-10 21:08:51 +00:00
gap: 0.4em;
margin-inline: 24px;
margin-bottom: 12px;
color: var(--accent);
> button {
display: flex;
padding: 0;
color: var(--accentAlpha04);
&:hover {
color: var(--accentAlpha06);
}
&:active {
color: var(--accentDarken30);
}
}
}
> .to-specified {
padding: 6px 24px;
margin-bottom: 8px;
overflow: auto;
2022-11-18 05:01:05 +00:00
line-height: 2rem;
> .visibleUsers {
display: inline;
top: -1px;
font-size: 14px;
> button {
2022-11-18 04:32:24 +00:00
padding: 2px;
border-radius: 8px;
2022-11-18 04:32:24 +00:00
> i {
transform: translateX(2px);
}
}
2022-11-18 04:32:24 +00:00
> span {
margin: 0.3rem;
padding: 4px 0 4px 4px;
border-radius: 999px;
background: var(--X3);
> button {
padding: 4px 8px;
}
}
}
}
2021-04-15 15:13:20 +00:00
> .hasNotSpecifiedMentions {
margin: 0 20px 16px 20px;
}
2020-02-04 23:59:24 +00:00
> .cw,
> .hashtags,
2020-02-04 23:59:24 +00:00
> .text {
display: block;
box-sizing: border-box;
padding: 0 24px;
margin: 0;
width: 100%;
2023-06-13 19:18:43 +00:00
font-size: 1.05em;
border: none;
border-radius: 0;
background: transparent;
color: var(--fg);
font-family: inherit;
2021-11-07 18:43:14 +00:00
&:focus {
outline: none;
}
&:disabled {
opacity: 0.5;
}
}
2020-02-04 23:59:24 +00:00
> .cw {
z-index: 1;
padding-bottom: 8px;
border-bottom: solid 0.5px var(--divider);
2020-02-04 23:59:24 +00:00
}
> .hashtags {
z-index: 1;
padding-top: 8px;
padding-bottom: 8px;
border-top: solid 0.5px var(--divider);
}
2020-02-04 23:59:24 +00:00
> .text {
max-width: 100%;
min-width: 100%;
min-height: 90px;
2020-02-04 23:59:24 +00:00
&.withCw {
padding-top: 8px;
}
}
> footer {
padding: 0 16px 16px 16px;
2020-02-05 00:15:28 +00:00
> button {
display: inline-block;
padding: 0;
margin: 0;
font-size: 16px;
width: 48px;
height: 48px;
border-radius: 6px;
&:hover {
2020-07-04 18:49:58 +00:00
background: var(--X5);
}
2020-02-05 00:15:28 +00:00
&.active {
color: var(--accent);
}
}
}
}
Migrate to Vue3 (#6587) * Update reaction.vue * fix bug * wip * wip * wjio * wip * Revert "wip" This reverts commit e427f2160adf4e8a4147006e25a89854edab0033. * wip * wip * wip * Update init.ts * Update drive-window.vue * wip * wip * Use PascalCase for components * Use PascalCase for components * update dep * wip * wip * wip * Update init.ts * wip * Update paging.ts * Update test.vue * watch deep * wip * lint * wip * wip * wip * wip * wiop * wip * Update webpack.config.ts * alllow null poll * wip * wip * wip * wiop * UI redesign & refactor (#6714) * wip * wip * wip * wip * wip * Update drive.vue * Update word-mute.vue * wip * wip * wip * clean up * wip * Update default.vue * wip * Update notes.vue * Update mfm.ts * Update index.home.vue * Update post-form.vue * Update post-form-attaches.vue * wip * Update post-form.vue * Update sidebar.vue * wip * wip * Update index.vue * wip * Update default.vue * Update index.vue * Update index.vue * wip * Update post-form-attaches.vue * Update note.vue * wip * clean up * Update notes.vue * wip * wip * Update ja-JP.yml * wip * wip * Update index.vue * wip * wip * wip * wip * wip * wip * wip * wip * Update default.vue * wip * Update _dark.json5 * wip * wip * wip * clean up * wip * wip * Update index.vue * Update test.vue * wip * wip * fix * wip * wip * wip * wip * clena yop * wip * wip * Update store.ts * Update messaging-room.vue * Update default.widgets.vue * fix * wip * wip * Update modal.vue * wip * Update os.ts * Update os.ts * Update deck.vue * Update init.ts * wip * Update ja-JP.yml * v-sizeは単にwindowのresizeを監視するだけで良いかもしれない * Update modal.vue * wip * Update tooltip.ts * wip * wip * wip * wip * wip * Update image-viewer.vue * wip * wip * Update style.scss * Update style.scss * Update visitor.vue * wip * Update init.ts * Update init.ts * wip * wip * Update visitor.vue * Update visitor.vue * Update visitor.vue * Update visitor.vue * wip * wip * Update modal.vue * Update header.vue * Update menu.vue * Update about.vue * Update about-misskey.vue * wip * wip * Update visitor.vue * Update tooltip.ts * wip * Update drive.vue * wip * Update style.scss * Update header.vue * wip * wip * Update users.user.vue * Update announcements.vue * wip * wip * wip * Update emojis.vue * wip * Update emojis.vue * Update style.scss * Update users.vue * wip * Update style.scss * wip * Update welcome.entrance.vue * Update radio.vue * Update size.ts * Update emoji-edit-dialog.vue * wip * Update emojis.vue * wip * Update emojis.vue * Update emojis.vue * Update emojis.vue * wip * wip * wip * wip * Update file-dialog.vue * wip * wip * Update token-generate-window.vue * Update notification-setting-window.vue * wip * wip * Update _error_.vue * Update ja-JP.yml * wip * wip * Update store.ts * Update emojis.vue * Update emojis.vue * Update emojis.vue * Update announcements.vue * Update store.ts * wip * Update page-editor.vue * wip * wip * Update modal.vue * wip * Update select-file.ts * Update timeline.vue * Update emojis.vue * Update os.ts * wip * Update user-select.vue * Update mfm.ts * Update get-file-info.ts * Update drive.vue * Update init.ts * Update mfm.ts * wip * wip * Update window.vue * Update note.vue * wip * wip * Update user-info.vue * wip * wip * wip * wip * wip * Update header.vue * Update header.vue * wip * Update explore.vue * wip * wip * wip * Update webpack.config.ts * wip * wip * wip * wip * wip * wip * Update autocomplete.ts * wip * wip * wip * Update toast.vue * wip * Update post-form-dialog.vue * wip * wip * wip * wip * wip * Update users.vue * wip * Update explore.vue * wip * wip * wip * Update package.json * wip * Update icon-dialog.vue * wip * wip * Update user-preview.ts * wip * wip * wip * wip * wip * Update instance.vue * Update user-name.vue * Update federation.vue * Update instance.vue * wip * wip * Update tag.vue * wip * wip * wip * wip * wip * Update instance.vue * wip * Update os.ts * Update os.ts * wip * wip * wip * Update router.ts * wip * Update init.ts * Update note.vue * Update messages.vue * wip * wip * wip * wip * wip * google * wip * wip * wip * wip * Update theme-editor.vue * wip * wip * Update room.vue * Update channel-editor.vue * wip * Update window.vue * Update window.vue * wip * Update window.vue * Update window.vue * wip * Update menu.vue * wip * wip * wip * wip * Update messaging-room.vue * wip * Update post-form.vue * Update default.widgets.vue * Update window.vue * wip
2020-10-17 11:12:00 +00:00
&.max-width_500px {
> header {
height: 50px;
> .cancel {
width: 50px;
line-height: 50px;
}
> .right {
Migrate to Vue3 (#6587) * Update reaction.vue * fix bug * wip * wip * wjio * wip * Revert "wip" This reverts commit e427f2160adf4e8a4147006e25a89854edab0033. * wip * wip * wip * Update init.ts * Update drive-window.vue * wip * wip * Use PascalCase for components * Use PascalCase for components * update dep * wip * wip * wip * Update init.ts * wip * Update paging.ts * Update test.vue * watch deep * wip * lint * wip * wip * wip * wip * wiop * wip * Update webpack.config.ts * alllow null poll * wip * wip * wip * wiop * UI redesign & refactor (#6714) * wip * wip * wip * wip * wip * Update drive.vue * Update word-mute.vue * wip * wip * wip * clean up * wip * Update default.vue * wip * Update notes.vue * Update mfm.ts * Update index.home.vue * Update post-form.vue * Update post-form-attaches.vue * wip * Update post-form.vue * Update sidebar.vue * wip * wip * Update index.vue * wip * Update default.vue * Update index.vue * Update index.vue * wip * Update post-form-attaches.vue * Update note.vue * wip * clean up * Update notes.vue * wip * wip * Update ja-JP.yml * wip * wip * Update index.vue * wip * wip * wip * wip * wip * wip * wip * wip * Update default.vue * wip * Update _dark.json5 * wip * wip * wip * clean up * wip * wip * Update index.vue * Update test.vue * wip * wip * fix * wip * wip * wip * wip * clena yop * wip * wip * Update store.ts * Update messaging-room.vue * Update default.widgets.vue * fix * wip * wip * Update modal.vue * wip * Update os.ts * Update os.ts * Update deck.vue * Update init.ts * wip * Update ja-JP.yml * v-sizeは単にwindowのresizeを監視するだけで良いかもしれない * Update modal.vue * wip * Update tooltip.ts * wip * wip * wip * wip * wip * Update image-viewer.vue * wip * wip * Update style.scss * Update style.scss * Update visitor.vue * wip * Update init.ts * Update init.ts * wip * wip * Update visitor.vue * Update visitor.vue * Update visitor.vue * Update visitor.vue * wip * wip * Update modal.vue * Update header.vue * Update menu.vue * Update about.vue * Update about-misskey.vue * wip * wip * Update visitor.vue * Update tooltip.ts * wip * Update drive.vue * wip * Update style.scss * Update header.vue * wip * wip * Update users.user.vue * Update announcements.vue * wip * wip * wip * Update emojis.vue * wip * Update emojis.vue * Update style.scss * Update users.vue * wip * Update style.scss * wip * Update welcome.entrance.vue * Update radio.vue * Update size.ts * Update emoji-edit-dialog.vue * wip * Update emojis.vue * wip * Update emojis.vue * Update emojis.vue * Update emojis.vue * wip * wip * wip * wip * Update file-dialog.vue * wip * wip * Update token-generate-window.vue * Update notification-setting-window.vue * wip * wip * Update _error_.vue * Update ja-JP.yml * wip * wip * Update store.ts * Update emojis.vue * Update emojis.vue * Update emojis.vue * Update announcements.vue * Update store.ts * wip * Update page-editor.vue * wip * wip * Update modal.vue * wip * Update select-file.ts * Update timeline.vue * Update emojis.vue * Update os.ts * wip * Update user-select.vue * Update mfm.ts * Update get-file-info.ts * Update drive.vue * Update init.ts * Update mfm.ts * wip * wip * Update window.vue * Update note.vue * wip * wip * Update user-info.vue * wip * wip * wip * wip * wip * Update header.vue * Update header.vue * wip * Update explore.vue * wip * wip * wip * Update webpack.config.ts * wip * wip * wip * wip * wip * wip * Update autocomplete.ts * wip * wip * wip * Update toast.vue * wip * Update post-form-dialog.vue * wip * wip * wip * wip * wip * Update users.vue * wip * Update explore.vue * wip * wip * wip * Update package.json * wip * Update icon-dialog.vue * wip * wip * Update user-preview.ts * wip * wip * wip * wip * wip * Update instance.vue * Update user-name.vue * Update federation.vue * Update instance.vue * wip * wip * Update tag.vue * wip * wip * wip * wip * wip * Update instance.vue * wip * Update os.ts * Update os.ts * wip * wip * wip * Update router.ts * wip * Update init.ts * Update note.vue * Update messages.vue * wip * wip * wip * wip * wip * google * wip * wip * wip * wip * Update theme-editor.vue * wip * wip * Update room.vue * Update channel-editor.vue * wip * Update window.vue * Update window.vue * wip * Update window.vue * Update window.vue * wip * Update menu.vue * wip * wip * wip * wip * Update messaging-room.vue * wip * Update post-form.vue * Update default.widgets.vue * Update window.vue * wip
2020-10-17 11:12:00 +00:00
> .text-count {
line-height: 50px;
}
> .submit {
margin: 8px;
}
}
}
> .form {
> .to-specified {
padding: 6px 16px;
}
> .cw,
> .hashtags,
Migrate to Vue3 (#6587) * Update reaction.vue * fix bug * wip * wip * wjio * wip * Revert "wip" This reverts commit e427f2160adf4e8a4147006e25a89854edab0033. * wip * wip * wip * Update init.ts * Update drive-window.vue * wip * wip * Use PascalCase for components * Use PascalCase for components * update dep * wip * wip * wip * Update init.ts * wip * Update paging.ts * Update test.vue * watch deep * wip * lint * wip * wip * wip * wip * wiop * wip * Update webpack.config.ts * alllow null poll * wip * wip * wip * wiop * UI redesign & refactor (#6714) * wip * wip * wip * wip * wip * Update drive.vue * Update word-mute.vue * wip * wip * wip * clean up * wip * Update default.vue * wip * Update notes.vue * Update mfm.ts * Update index.home.vue * Update post-form.vue * Update post-form-attaches.vue * wip * Update post-form.vue * Update sidebar.vue * wip * wip * Update index.vue * wip * Update default.vue * Update index.vue * Update index.vue * wip * Update post-form-attaches.vue * Update note.vue * wip * clean up * Update notes.vue * wip * wip * Update ja-JP.yml * wip * wip * Update index.vue * wip * wip * wip * wip * wip * wip * wip * wip * Update default.vue * wip * Update _dark.json5 * wip * wip * wip * clean up * wip * wip * Update index.vue * Update test.vue * wip * wip * fix * wip * wip * wip * wip * clena yop * wip * wip * Update store.ts * Update messaging-room.vue * Update default.widgets.vue * fix * wip * wip * Update modal.vue * wip * Update os.ts * Update os.ts * Update deck.vue * Update init.ts * wip * Update ja-JP.yml * v-sizeは単にwindowのresizeを監視するだけで良いかもしれない * Update modal.vue * wip * Update tooltip.ts * wip * wip * wip * wip * wip * Update image-viewer.vue * wip * wip * Update style.scss * Update style.scss * Update visitor.vue * wip * Update init.ts * Update init.ts * wip * wip * Update visitor.vue * Update visitor.vue * Update visitor.vue * Update visitor.vue * wip * wip * Update modal.vue * Update header.vue * Update menu.vue * Update about.vue * Update about-misskey.vue * wip * wip * Update visitor.vue * Update tooltip.ts * wip * Update drive.vue * wip * Update style.scss * Update header.vue * wip * wip * Update users.user.vue * Update announcements.vue * wip * wip * wip * Update emojis.vue * wip * Update emojis.vue * Update style.scss * Update users.vue * wip * Update style.scss * wip * Update welcome.entrance.vue * Update radio.vue * Update size.ts * Update emoji-edit-dialog.vue * wip * Update emojis.vue * wip * Update emojis.vue * Update emojis.vue * Update emojis.vue * wip * wip * wip * wip * Update file-dialog.vue * wip * wip * Update token-generate-window.vue * Update notification-setting-window.vue * wip * wip * Update _error_.vue * Update ja-JP.yml * wip * wip * Update store.ts * Update emojis.vue * Update emojis.vue * Update emojis.vue * Update announcements.vue * Update store.ts * wip * Update page-editor.vue * wip * wip * Update modal.vue * wip * Update select-file.ts * Update timeline.vue * Update emojis.vue * Update os.ts * wip * Update user-select.vue * Update mfm.ts * Update get-file-info.ts * Update drive.vue * Update init.ts * Update mfm.ts * wip * wip * Update window.vue * Update note.vue * wip * wip * Update user-info.vue * wip * wip * wip * wip * wip * Update header.vue * Update header.vue * wip * Update explore.vue * wip * wip * wip * Update webpack.config.ts * wip * wip * wip * wip * wip * wip * Update autocomplete.ts * wip * wip * wip * Update toast.vue * wip * Update post-form-dialog.vue * wip * wip * wip * wip * wip * Update users.vue * wip * Update explore.vue * wip * wip * wip * Update package.json * wip * Update icon-dialog.vue * wip * wip * Update user-preview.ts * wip * wip * wip * wip * wip * Update instance.vue * Update user-name.vue * Update federation.vue * Update instance.vue * wip * wip * Update tag.vue * wip * wip * wip * wip * wip * Update instance.vue * wip * Update os.ts * Update os.ts * wip * wip * wip * Update router.ts * wip * Update init.ts * Update note.vue * Update messages.vue * wip * wip * wip * wip * wip * google * wip * wip * wip * wip * Update theme-editor.vue * wip * wip * Update room.vue * Update channel-editor.vue * wip * Update window.vue * Update window.vue * wip * Update window.vue * Update window.vue * wip * Update menu.vue * wip * wip * wip * wip * Update messaging-room.vue * wip * Update post-form.vue * Update default.widgets.vue * Update window.vue * wip
2020-10-17 11:12:00 +00:00
> .text {
padding: 0 16px;
}
> .text {
min-height: 80px;
}
> footer {
padding: 0 8px 8px 8px;
}
}
}
2021-10-14 09:51:15 +00:00
&.max-width_310px {
> .form {
> footer {
> button {
font-size: 14px;
width: 44px;
2023-04-08 00:01:42 +00:00
height: 44px;
2021-10-14 09:51:15 +00:00
}
}
}
}
}
2024-02-15 19:14:19 +00:00
.bigPostButton {
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
display: block ruby;
padding: 3%;
margin: 0 auto;
border: none;
cursor: pointer;
color: inherit;
touch-action: manipulation;
-webkit-tap-highlight-color: transparent;
font-size: 3em;
font-family: inherit;
text-decoration: none;
width: 100%;
border-radius: 10px;
user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
color: var(--fgOnAccent);
background: linear-gradient(
90deg,
var(--buttonGradateA),
var(--buttonGradateB)
);
> .ph-lg {
vertical-align: -0.125em;
margin-left: 12px;
}
}
.bigPostButton:disabled {
opacity: 0.7;
}
</style>