2023-07-27 08:31:52 +03:00
|
|
|
<!--
|
2024-02-13 17:59:27 +02:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 08:31:52 +03:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-01-29 21:37:25 +02:00
|
|
|
<template>
|
2022-07-05 17:01:23 +03:00
|
|
|
<div
|
2023-01-14 07:57:48 +02:00
|
|
|
:class="[$style.root, { [$style.modal]: modal, _popup: modal }]"
|
2020-01-29 21:37:25 +02:00
|
|
|
@dragover.stop="onDragover"
|
|
|
|
@dragenter="onDragenter"
|
|
|
|
@dragleave="onDragleave"
|
|
|
|
@drop.stop="onDrop"
|
|
|
|
>
|
2023-01-14 07:57:48 +02:00
|
|
|
<header :class="$style.header">
|
2023-04-05 08:30:03 +03:00
|
|
|
<div :class="$style.headerLeft">
|
2023-09-30 22:53:52 +03:00
|
|
|
<button v-if="!fixed" :class="$style.cancel" class="_button" @click="cancel"><i class="ph-x ph-bold ph-lg"></i></button>
|
2023-04-05 08:30:03 +03:00
|
|
|
<button v-click-anime v-tooltip="i18n.ts.switchAccount" :class="$style.account" class="_button" @click="openAccountMenu">
|
|
|
|
<MkAvatar :user="postAccount ?? $i" :class="$style.avatar"/>
|
|
|
|
</button>
|
|
|
|
</div>
|
2023-01-14 07:57:48 +02:00
|
|
|
<div :class="$style.headerRight">
|
2023-04-05 08:30:03 +03:00
|
|
|
<template v-if="!(channel != null && fixed)">
|
|
|
|
<button v-if="channel == null" ref="visibilityButton" v-click-anime v-tooltip="i18n.ts.visibility" :class="['_button', $style.headerRightItem, $style.visibility]" @click="setVisibility">
|
2023-09-30 22:53:52 +03:00
|
|
|
<span v-if="visibility === 'public'"><i class="ph-globe-hemisphere-west ph-bold ph-lg"></i></span>
|
|
|
|
<span v-if="visibility === 'home'"><i class="ph-house ph-bold ph-lg"></i></span>
|
|
|
|
<span v-if="visibility === 'followers'"><i class="ph-lock ph-bold ph-lg"></i></span>
|
|
|
|
<span v-if="visibility === 'specified'"><i class="ph-envelope ph-bold ph-lg"></i></span>
|
2023-04-05 08:30:03 +03:00
|
|
|
<span :class="$style.headerRightButtonText">{{ i18n.ts._visibility[visibility] }}</span>
|
|
|
|
</button>
|
2023-05-30 06:16:39 +03:00
|
|
|
<button v-else class="_button" :class="[$style.headerRightItem, $style.visibility]" disabled>
|
2023-09-30 22:53:52 +03:00
|
|
|
<span><i class="ph-television ph-bold ph-lg"></i></span>
|
2023-04-05 08:30:03 +03:00
|
|
|
<span :class="$style.headerRightButtonText">{{ channel.name }}</span>
|
|
|
|
</button>
|
|
|
|
</template>
|
2023-06-01 11:19:46 +03:00
|
|
|
<button v-click-anime v-tooltip="i18n.ts._visibility.disableFederation" class="_button" :class="[$style.headerRightItem, { [$style.danger]: localOnly }]" :disabled="channel != null || visibility === 'specified'" @click="toggleLocalOnly">
|
2023-11-04 00:20:53 +02:00
|
|
|
<span v-if="!localOnly"><i class="ph-rocket-launch ph-bold ph-lg"></i></span>
|
|
|
|
<span v-else><i class="ph-rocket ph-bold ph-lg"></i></span>
|
2023-04-05 08:30:03 +03:00
|
|
|
</button>
|
2023-06-01 11:19:46 +03:00
|
|
|
<button v-click-anime v-tooltip="i18n.ts.reactionAcceptance" class="_button" :class="[$style.headerRightItem, { [$style.danger]: reactionAcceptance === 'likeOnly' }]" @click="toggleReactionAcceptance">
|
2023-09-30 22:53:52 +03:00
|
|
|
<span v-if="reactionAcceptance === 'likeOnly'"><i class="ph-heart ph-bold ph-lg"></i></span>
|
|
|
|
<span v-else-if="reactionAcceptance === 'likeOnlyForRemote'"><i class="ph-heart ph-bold ph-lg"></i></span>
|
2023-11-04 00:20:53 +02:00
|
|
|
<span v-else><i class="ph-smiley ph-bold ph-lg"></i></span>
|
2020-02-05 14:28:51 +02:00
|
|
|
</button>
|
2023-06-01 11:19:46 +03:00
|
|
|
<button v-click-anime class="_button" :class="$style.submit" :disabled="!canPost" data-cy-open-post-form-submit @click="post">
|
2023-01-14 07:57:48 +02:00
|
|
|
<div :class="$style.submitInner">
|
2022-12-31 12:46:16 +02:00
|
|
|
<template v-if="posted"></template>
|
|
|
|
<template v-else-if="posting"><MkEllipsis/></template>
|
|
|
|
<template v-else>{{ submitText }}</template>
|
2023-11-04 00:20:53 +02:00
|
|
|
<i style="margin-left: 6px;" :class="posted ? 'ph-check ph-bold ph-lg' : 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>
|
2022-12-31 12:46:16 +02:00
|
|
|
</div>
|
|
|
|
</button>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
|
|
|
</header>
|
2023-10-20 01:27:24 +03:00
|
|
|
<MkNoteSimple v-if="reply" :class="$style.targetNote" :hideFiles="true" :note="reply"/>
|
|
|
|
<MkNoteSimple v-if="renote" :class="$style.targetNote" :hideFiles="true" :note="renote"/>
|
2023-09-30 22:53:52 +03:00
|
|
|
<div v-if="quoteId" :class="$style.withQuote"><i class="ph-quotes ph-bold ph-lg"></i> {{ i18n.ts.quoteAttached }}<button @click="quoteId = null"><i class="ph-x ph-bold ph-lg"></i></button></div>
|
2023-04-05 08:30:03 +03:00
|
|
|
<div v-if="visibility === 'specified'" :class="$style.toSpecified">
|
|
|
|
<span style="margin-right: 8px;">{{ i18n.ts.recipient }}</span>
|
|
|
|
<div :class="$style.visibleUsers">
|
|
|
|
<span v-for="u in visibleUsers" :key="u.id" :class="$style.visibleUser">
|
|
|
|
<MkAcct :user="u"/>
|
2023-09-30 22:53:52 +03:00
|
|
|
<button class="_button" style="padding: 4px 8px;" @click="removeVisibleUser(u)"><i class="ph-x ph-bold ph-lg"></i></button>
|
2023-04-05 08:30:03 +03:00
|
|
|
</span>
|
2023-10-31 20:44:34 +02:00
|
|
|
<button class="_buttonPrimary" style="padding: 4px; border-radius: var(--radius-sm);" @click="addVisibleUser"><i class="ph-plus ph-bold ph-lg ti-fw"></i></button>
|
2023-03-08 01:56:47 +02:00
|
|
|
</div>
|
2023-04-05 08:30:03 +03:00
|
|
|
</div>
|
|
|
|
<MkInfo v-if="hasNotSpecifiedMentions" warn :class="$style.hasNotSpecifiedMentions">{{ i18n.ts.notSpecifiedMentionWarning }} - <button class="_textButton" @click="addMissingMention()">{{ i18n.ts.add }}</button></MkInfo>
|
|
|
|
<input v-show="useCw" ref="cwInputEl" v-model="cw" :class="$style.cw" :placeholder="i18n.ts.annotation" @keydown="onKeydown">
|
|
|
|
<div :class="[$style.textOuter, { [$style.withCw]: useCw }]">
|
2023-12-16 07:13:38 +02:00
|
|
|
<div v-if="channel" :class="$style.colorBar" :style="{ background: channel.color }"></div>
|
2023-12-04 11:12:14 +02:00
|
|
|
<textarea ref="textareaEl" v-model="text" :class="[$style.text]" :disabled="posting || posted" :readonly="textAreaReadOnly" :placeholder="placeholder" data-cy-post-form-text @keydown="onKeydown" @paste="onPaste" @compositionupdate="onCompositionUpdate" @compositionend="onCompositionEnd"/>
|
2023-04-05 08:30:03 +03:00
|
|
|
<div v-if="maxTextLength - textLength < 100" :class="['_acrylic', $style.textCount, { [$style.textOver]: textLength > maxTextLength }]">{{ maxTextLength - textLength }}</div>
|
|
|
|
</div>
|
|
|
|
<input v-show="withHashtags" ref="hashtagsInputEl" v-model="hashtags" :class="$style.hashtags" :placeholder="i18n.ts.hashtags" list="hashtags">
|
2023-07-05 07:54:40 +03:00
|
|
|
<XPostFormAttaches v-model="files" @detach="detachFile" @changeSensitive="updateFileSensitive" @changeName="updateFileName" @replaceFile="replaceFile"/>
|
2023-04-05 08:30:03 +03:00
|
|
|
<MkPollEditor v-if="poll" v-model="poll" @destroyed="poll = null"/>
|
2023-11-30 06:49:31 +02:00
|
|
|
<MkNotePreview v-if="showPreview" :class="$style.preview" :text="text" :files="files" :poll="poll ?? undefined" :useCw="useCw" :cw="cw" :user="postAccount ?? $i"/>
|
2023-04-05 08:30:03 +03:00
|
|
|
<div v-if="showingOptions" style="padding: 8px 16px;">
|
|
|
|
</div>
|
|
|
|
<footer :class="$style.footer">
|
|
|
|
<div :class="$style.footerLeft">
|
2023-09-30 22:53:52 +03:00
|
|
|
<button v-tooltip="i18n.ts.attachFile" class="_button" :class="$style.footerButton" @click="chooseFileFrom"><i class="ph-image-square ph-bold ph-lg-plus"></i></button>
|
2023-11-04 00:20:53 +02:00
|
|
|
<button v-tooltip="i18n.ts.poll" class="_button" :class="[$style.footerButton, { [$style.footerButtonActive]: poll }]" @click="togglePoll"><i class="ph-chart-bar-horizontal ph-bold ph-lg"></i></button>
|
2023-09-30 22:53:52 +03:00
|
|
|
<button v-tooltip="i18n.ts.useCw" class="_button" :class="[$style.footerButton, { [$style.footerButtonActive]: useCw }]" @click="useCw = !useCw"><i class="ph-eye-slash ph-bold ph-lg"></i></button>
|
|
|
|
<button v-tooltip="i18n.ts.mention" class="_button" :class="$style.footerButton" @click="insertMention"><i class="ph-at ph-bold ph-lg"></i></button>
|
|
|
|
<button v-tooltip="i18n.ts.hashtags" class="_button" :class="[$style.footerButton, { [$style.footerButtonActive]: withHashtags }]" @click="withHashtags = !withHashtags"><i class="ph-hash ph-bold ph-lg"></i></button>
|
2024-02-03 21:19:44 +02:00
|
|
|
<button v-if="postFormActions.length > 0" v-tooltip="i18n.ts.plugins" class="_button" :class="$style.footerButton" @click="showActions"><i class="ph-plug ph-bold ph-lg"></i></button>
|
2023-09-30 22:53:52 +03:00
|
|
|
<button v-tooltip="i18n.ts.emoji" :class="['_button', $style.footerButton]" @click="insertEmoji"><i class="ph-smiley ph-bold ph-lg"></i></button>
|
2023-12-27 13:57:43 +02:00
|
|
|
<button v-if="showAddMfmFunction" v-tooltip="i18n.ts.addMfmFunction" :class="['_button', $style.footerButton]" @click="insertMfmFunction"><i class="ph-palette ph-bold ph-lg"></i></button>
|
2023-04-05 08:30:03 +03:00
|
|
|
</div>
|
|
|
|
<div :class="$style.footerRight">
|
2023-09-30 22:53:52 +03:00
|
|
|
<button v-tooltip="i18n.ts.previewNoteText" class="_button" :class="[$style.footerButton, { [$style.previewButtonActive]: showPreview }]" @click="showPreview = !showPreview"><i class="ph-eye ph-bold ph-lg"></i></button>
|
2023-10-04 04:36:26 +03:00
|
|
|
<button v-tooltip="'MFM Cheatsheet'" class="_button" :class="$style.footerButton" @click="MFMWindow"><i class="ph-notebook ph-bold ph-lg"></i></button>
|
2023-09-30 22:53:52 +03:00
|
|
|
<!--<button v-tooltip="i18n.ts.more" class="_button" :class="$style.footerButton" @click="showingOptions = !showingOptions"><i class="ph-dots-three ph-bold ph-lg"></i></button>-->
|
2023-04-05 08:30:03 +03:00
|
|
|
</div>
|
|
|
|
</footer>
|
|
|
|
<datalist id="hashtags">
|
|
|
|
<option v-for="hashtag in recentHashtags" :key="hashtag" :value="hashtag"/>
|
|
|
|
</datalist>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
<script lang="ts" setup>
|
2024-02-16 22:53:27 +02:00
|
|
|
import { inject, watch, nextTick, onMounted, defineAsyncComponent, provide, shallowRef, ref, computed, toRaw } from 'vue';
|
2024-02-03 16:01:09 +02:00
|
|
|
import * as mfm from '@transfem-org/sfm-js';
|
2023-09-04 07:33:38 +03:00
|
|
|
import * as Misskey from 'misskey-js';
|
2019-05-27 09:38:14 +03:00
|
|
|
import insertTextAtCursor from 'insert-text-at-cursor';
|
2021-04-04 07:00:39 +03:00
|
|
|
import { toASCII } from 'punycode/';
|
2022-12-30 06:56:22 +02:00
|
|
|
import MkNoteSimple from '@/components/MkNoteSimple.vue';
|
2023-03-31 08:14:30 +03:00
|
|
|
import MkNotePreview from '@/components/MkNotePreview.vue';
|
2022-08-30 18:24:33 +03:00
|
|
|
import XPostFormAttaches from '@/components/MkPostFormAttaches.vue';
|
2024-01-30 12:53:53 +02:00
|
|
|
import MkPollEditor, { type PollEditorModelValue } from '@/components/MkPollEditor.vue';
|
2023-09-19 10:37:43 +03:00
|
|
|
import { host, url } from '@/config.js';
|
|
|
|
import { erase, unique } from '@/scripts/array.js';
|
|
|
|
import { extractMentions } from '@/scripts/extract-mentions.js';
|
|
|
|
import { formatTimeString } from '@/scripts/format-time-string.js';
|
|
|
|
import { Autocomplete } from '@/scripts/autocomplete.js';
|
|
|
|
import * as os from '@/os.js';
|
2024-01-04 11:32:46 +02:00
|
|
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
2023-09-19 10:37:43 +03:00
|
|
|
import { selectFiles } from '@/scripts/select-file.js';
|
|
|
|
import { defaultStore, notePostInterruptors, postFormActions } from '@/store.js';
|
2022-09-06 12:21:49 +03:00
|
|
|
import MkInfo from '@/components/MkInfo.vue';
|
2023-09-19 10:37:43 +03:00
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { instance } from '@/instance.js';
|
2024-01-05 08:25:26 +02:00
|
|
|
import { signinRequired, notesCount, incNotesCount, getAccounts, openAccountMenu as openAccountMenu_ } from '@/account.js';
|
2023-09-19 10:37:43 +03:00
|
|
|
import { uploadFile } from '@/scripts/upload.js';
|
|
|
|
import { deepClone } from '@/scripts/clone.js';
|
2023-01-01 05:28:30 +02:00
|
|
|
import MkRippleEffect from '@/components/MkRippleEffect.vue';
|
2023-09-19 10:37:43 +03:00
|
|
|
import { miLocalStorage } from '@/local-storage.js';
|
|
|
|
import { claimAchievement } from '@/scripts/achievements.js';
|
2023-12-03 10:25:34 +02:00
|
|
|
import { emojiPicker } from '@/scripts/emoji-picker.js';
|
2023-12-27 13:57:43 +02:00
|
|
|
import { mfmFunctionPicker } from '@/scripts/mfm-function-picker.js';
|
2022-01-15 18:46:25 +02:00
|
|
|
|
2024-01-05 08:25:26 +02:00
|
|
|
const $i = signinRequired();
|
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
const modal = inject('modal');
|
|
|
|
|
|
|
|
const props = withDefaults(defineProps<{
|
2023-09-04 07:33:38 +03:00
|
|
|
reply?: Misskey.entities.Note;
|
|
|
|
renote?: Misskey.entities.Note;
|
|
|
|
channel?: Misskey.entities.Channel; // TODO
|
|
|
|
mention?: Misskey.entities.User;
|
2024-01-30 12:53:53 +02:00
|
|
|
specified?: Misskey.entities.UserDetailed;
|
2022-01-15 18:46:25 +02:00
|
|
|
initialText?: string;
|
2023-12-09 06:14:51 +02:00
|
|
|
initialCw?: string;
|
2023-09-04 07:33:38 +03:00
|
|
|
initialVisibility?: (typeof Misskey.noteVisibilities)[number];
|
|
|
|
initialFiles?: Misskey.entities.DriveFile[];
|
2022-01-15 18:46:25 +02:00
|
|
|
initialLocalOnly?: boolean;
|
2024-01-30 12:53:53 +02:00
|
|
|
initialVisibleUsers?: Misskey.entities.UserDetailed[];
|
2023-09-04 07:33:38 +03:00
|
|
|
initialNote?: Misskey.entities.Note;
|
2022-01-27 10:38:02 +02:00
|
|
|
instant?: boolean;
|
2022-01-15 18:46:25 +02:00
|
|
|
fixed?: boolean;
|
|
|
|
autofocus?: boolean;
|
2022-12-31 12:46:16 +02:00
|
|
|
freezeAfterPosted?: boolean;
|
2023-12-23 03:09:23 +02:00
|
|
|
editId?: Misskey.entities.Note['id'];
|
2023-11-03 08:35:07 +02:00
|
|
|
mock?: boolean;
|
2022-01-15 18:46:25 +02:00
|
|
|
}>(), {
|
2022-05-26 16:53:09 +03:00
|
|
|
initialVisibleUsers: () => [],
|
2022-01-15 18:46:25 +02:00
|
|
|
autofocus: true,
|
2023-11-03 08:35:07 +02:00
|
|
|
mock: false,
|
2022-01-15 18:46:25 +02:00
|
|
|
});
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-11-03 08:35:07 +02:00
|
|
|
provide('mock', props.mock);
|
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
const emit = defineEmits<{
|
2022-01-25 20:26:12 +02:00
|
|
|
(ev: 'posted'): void;
|
|
|
|
(ev: 'cancel'): void;
|
|
|
|
(ev: 'esc'): void;
|
2023-11-03 08:35:07 +02:00
|
|
|
|
|
|
|
// Mock用
|
|
|
|
(ev: 'fileChangeSensitive', fileId: string, to: boolean): void;
|
2022-01-15 18:46:25 +02:00
|
|
|
}>();
|
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const textareaEl = shallowRef<HTMLTextAreaElement | null>(null);
|
|
|
|
const cwInputEl = shallowRef<HTMLInputElement | null>(null);
|
|
|
|
const hashtagsInputEl = shallowRef<HTMLInputElement | null>(null);
|
2024-03-02 18:36:49 +02:00
|
|
|
const visibilityButton = shallowRef<HTMLElement>();
|
2022-01-15 18:46:25 +02:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const posting = ref(false);
|
|
|
|
const posted = ref(false);
|
|
|
|
const text = ref(props.initialText ?? '');
|
|
|
|
const files = ref(props.initialFiles ?? []);
|
2024-01-30 12:53:53 +02:00
|
|
|
const poll = ref<PollEditorModelValue | null>(null);
|
2023-12-09 06:14:51 +02:00
|
|
|
const useCw = ref<boolean>(!!props.initialCw);
|
2023-12-07 07:42:09 +02:00
|
|
|
const showPreview = ref(defaultStore.state.showPreview);
|
|
|
|
watch(showPreview, () => defaultStore.set('showPreview', showPreview.value));
|
2023-12-27 13:57:43 +02:00
|
|
|
const showAddMfmFunction = ref(defaultStore.state.enableQuickAddMfmFunction);
|
|
|
|
watch(showAddMfmFunction, () => defaultStore.set('enableQuickAddMfmFunction', showAddMfmFunction.value));
|
2023-12-09 06:14:51 +02:00
|
|
|
const cw = ref<string | null>(props.initialCw ?? null);
|
2023-12-07 07:42:09 +02:00
|
|
|
const localOnly = ref<boolean>(props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly);
|
|
|
|
const visibility = ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility) as typeof Misskey.noteVisibilities[number]);
|
2023-12-26 07:19:35 +02:00
|
|
|
const visibleUsers = ref<Misskey.entities.UserDetailed[]>([]);
|
2022-02-01 14:49:34 +02:00
|
|
|
if (props.initialVisibleUsers) {
|
|
|
|
props.initialVisibleUsers.forEach(pushVisibleUser);
|
|
|
|
}
|
2023-12-07 07:42:09 +02:00
|
|
|
const reactionAcceptance = ref(defaultStore.state.reactionAcceptance);
|
|
|
|
const autocomplete = ref(null);
|
|
|
|
const draghover = ref(false);
|
2023-12-26 07:19:35 +02:00
|
|
|
const quoteId = ref<string | null>(null);
|
2023-12-07 07:42:09 +02:00
|
|
|
const hasNotSpecifiedMentions = ref(false);
|
|
|
|
const recentHashtags = ref(JSON.parse(miLocalStorage.getItem('hashtags') ?? '[]'));
|
|
|
|
const imeText = ref('');
|
|
|
|
const showingOptions = ref(false);
|
2023-12-04 11:12:14 +02:00
|
|
|
const textAreaReadOnly = ref(false);
|
2022-01-15 18:46:25 +02:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const draftKey = computed((): string => {
|
2022-01-15 18:46:25 +02:00
|
|
|
let key = props.channel ? `channel:${props.channel.id}` : '';
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
if (props.renote) {
|
|
|
|
key += `renote:${props.renote.id}`;
|
|
|
|
} else if (props.reply) {
|
|
|
|
key += `reply:${props.reply.id}`;
|
|
|
|
} else {
|
2023-03-10 12:30:21 +02:00
|
|
|
key += `note:${$i.id}`;
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
2021-01-15 16:20:47 +02:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
return key;
|
|
|
|
});
|
2020-02-10 16:17:42 +02:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const placeholder = computed((): string => {
|
2022-01-15 18:46:25 +02:00
|
|
|
if (props.renote) {
|
2022-01-28 04:39:49 +02:00
|
|
|
return i18n.ts._postForm.quotePlaceholder;
|
2022-01-15 18:46:25 +02:00
|
|
|
} else if (props.reply) {
|
2022-01-28 04:39:49 +02:00
|
|
|
return i18n.ts._postForm.replyPlaceholder;
|
2022-01-15 18:46:25 +02:00
|
|
|
} else if (props.channel) {
|
2022-01-28 04:39:49 +02:00
|
|
|
return i18n.ts._postForm.channelPlaceholder;
|
2022-01-15 18:46:25 +02:00
|
|
|
} else {
|
|
|
|
const xs = [
|
2022-01-28 04:39:49 +02: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 17:01:23 +03:00
|
|
|
i18n.ts._postForm._placeholders.f,
|
2022-01-15 18:46:25 +02:00
|
|
|
];
|
|
|
|
return xs[Math.floor(Math.random() * xs.length)];
|
|
|
|
}
|
|
|
|
});
|
2021-08-07 06:47:01 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const submitText = computed((): string => {
|
2022-01-15 18:46:25 +02:00
|
|
|
return props.renote
|
2022-01-28 04:39:49 +02:00
|
|
|
? i18n.ts.quote
|
2022-01-15 18:46:25 +02:00
|
|
|
: props.reply
|
2022-01-28 04:39:49 +02:00
|
|
|
? i18n.ts.reply
|
|
|
|
: i18n.ts.note;
|
2022-01-15 18:46:25 +02:00
|
|
|
});
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const textLength = computed((): number => {
|
|
|
|
return (text.value + imeText.value).trim().length;
|
2022-01-15 18:46:25 +02:00
|
|
|
});
|
2021-04-15 18:13:20 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const maxTextLength = computed((): number => {
|
2022-01-15 18:46:25 +02:00
|
|
|
return instance ? instance.maxNoteTextLength : 1000;
|
|
|
|
});
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const canPost = computed((): boolean => {
|
|
|
|
return !props.mock && !posting.value && !posted.value &&
|
|
|
|
(1 <= textLength.value || 1 <= files.value.length || !!poll.value || !!props.renote) &&
|
|
|
|
(textLength.value <= maxTextLength.value) &&
|
|
|
|
(!poll.value || poll.value.choices.length >= 2);
|
2022-01-15 18:46:25 +02:00
|
|
|
});
|
2021-10-19 21:10:36 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const withHashtags = computed(defaultStore.makeGetterSetter('postFormWithHashtags'));
|
|
|
|
const hashtags = computed(defaultStore.makeGetterSetter('postFormHashtags'));
|
2021-10-19 21:10:36 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
watch(text, () => {
|
2022-01-15 18:46:25 +02:00
|
|
|
checkMissingMention();
|
2023-02-12 07:00:15 +02:00
|
|
|
}, { immediate: true });
|
2021-10-19 21:10:36 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
watch(visibility, () => {
|
2023-04-16 01:59:23 +03:00
|
|
|
checkMissingMention();
|
|
|
|
}, { immediate: true });
|
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
watch(visibleUsers, () => {
|
2022-01-15 18:46:25 +02:00
|
|
|
checkMissingMention();
|
|
|
|
}, {
|
|
|
|
deep: true,
|
|
|
|
});
|
2021-11-18 16:32:43 +02:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
if (props.mention) {
|
2023-12-07 07:42:09 +02:00
|
|
|
text.value = props.mention.host ? `@${props.mention.username}@${toASCII(props.mention.host)}` : `@${props.mention.username}`;
|
|
|
|
text.value += ' ';
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-05-07 11:01:01 +03:00
|
|
|
if (props.reply && (props.reply.user.username !== $i.username || (props.reply.user.host != null && props.reply.user.host !== host))) {
|
2023-12-07 07:42:09 +02:00
|
|
|
text.value = `@${props.reply.user.username}${props.reply.user.host != null ? '@' + toASCII(props.reply.user.host) : ''} `;
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
if (props.reply && props.reply.text != null) {
|
|
|
|
const ast = mfm.parse(props.reply.text);
|
|
|
|
const otherHost = props.reply.user.host;
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
for (const x of extractMentions(ast)) {
|
|
|
|
const mention = x.host ?
|
2022-07-05 17:01:23 +03:00
|
|
|
`@${x.username}@${toASCII(x.host)}` :
|
|
|
|
(otherHost == null || otherHost === host) ?
|
|
|
|
`@${x.username}` :
|
|
|
|
`@${x.username}@${toASCII(otherHost)}`;
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
// 自分は除外
|
2022-05-07 11:01:01 +03:00
|
|
|
if ($i.username === x.username && (x.host == null || x.host === host)) continue;
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
// 重複は除外
|
2023-12-07 07:42:09 +02:00
|
|
|
if (text.value.includes(`${mention} `)) continue;
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
text.value += `${mention} `;
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-05 08:25:26 +02:00
|
|
|
if ($i.isSilenced && visibility.value === 'public') {
|
2023-12-07 07:42:09 +02:00
|
|
|
visibility.value = 'home';
|
2023-11-03 10:52:31 +02:00
|
|
|
}
|
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
if (props.channel) {
|
2023-12-07 07:42:09 +02:00
|
|
|
visibility.value = 'public';
|
|
|
|
localOnly.value = true; // TODO: チャンネルが連合するようになった折には消す
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 公開以外へのリプライ時は元の公開範囲を引き継ぐ
|
|
|
|
if (props.reply && ['home', 'followers', 'specified'].includes(props.reply.visibility)) {
|
2023-12-07 07:42:09 +02:00
|
|
|
if (props.reply.visibility === 'home' && visibility.value === 'followers') {
|
|
|
|
visibility.value = 'followers';
|
|
|
|
} else if (['home', 'followers'].includes(props.reply.visibility) && visibility.value === 'specified') {
|
|
|
|
visibility.value = 'specified';
|
2022-12-02 23:14:37 +02:00
|
|
|
} else {
|
2023-12-07 07:42:09 +02:00
|
|
|
visibility.value = props.reply.visibility;
|
2022-12-02 23:14:37 +02:00
|
|
|
}
|
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
if (visibility.value === 'specified') {
|
2022-12-02 23:14:37 +02:00
|
|
|
if (props.reply.visibleUserIds) {
|
2024-01-04 11:32:46 +02:00
|
|
|
misskeyApi('users/show', {
|
2024-01-30 12:53:53 +02:00
|
|
|
userIds: props.reply.visibleUserIds.filter(uid => uid !== $i.id && uid !== props.reply?.userId),
|
2022-12-02 23:14:37 +02:00
|
|
|
}).then(users => {
|
|
|
|
users.forEach(pushVisibleUser);
|
|
|
|
});
|
|
|
|
}
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
if (props.reply.userId !== $i.id) {
|
2024-01-04 11:32:46 +02:00
|
|
|
misskeyApi('users/show', { userId: props.reply.userId }).then(user => {
|
2022-02-01 14:49:34 +02:00
|
|
|
pushVisibleUser(user);
|
2022-01-15 18:46:25 +02:00
|
|
|
});
|
2020-08-18 16:44:21 +03:00
|
|
|
}
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (props.specified) {
|
2023-12-07 07:42:09 +02:00
|
|
|
visibility.value = 'specified';
|
2022-02-01 14:49:34 +02:00
|
|
|
pushVisibleUser(props.specified);
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// keep cw when reply
|
|
|
|
if (defaultStore.state.keepCw && props.reply && props.reply.cw) {
|
2023-12-07 07:42:09 +02:00
|
|
|
useCw.value = true;
|
|
|
|
cw.value = props.reply.cw;
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function watchForDraft() {
|
2023-12-07 07:42:09 +02:00
|
|
|
watch(text, () => saveDraft());
|
|
|
|
watch(useCw, () => saveDraft());
|
|
|
|
watch(cw, () => saveDraft());
|
|
|
|
watch(poll, () => saveDraft());
|
|
|
|
watch(files, () => saveDraft(), { deep: true });
|
|
|
|
watch(visibility, () => saveDraft());
|
|
|
|
watch(localOnly, () => saveDraft());
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
2023-10-04 04:36:26 +03:00
|
|
|
function MFMWindow() {
|
|
|
|
os.popup(defineAsyncComponent(() => import('@/components/MkMfmWindow.vue')), {}, {}, 'closed');
|
|
|
|
}
|
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
function checkMissingMention() {
|
2023-12-07 07:42:09 +02:00
|
|
|
if (visibility.value === 'specified') {
|
|
|
|
const ast = mfm.parse(text.value);
|
2022-01-15 18:46:25 +02:00
|
|
|
|
|
|
|
for (const x of extractMentions(ast)) {
|
2023-12-07 07:42:09 +02:00
|
|
|
if (!visibleUsers.value.some(u => (u.username === x.username) && (u.host === x.host))) {
|
|
|
|
hasNotSpecifiedMentions.value = true;
|
2022-01-15 18:46:25 +02:00
|
|
|
return;
|
2019-08-25 10:12:01 +03:00
|
|
|
}
|
2019-05-27 09:38:14 +03:00
|
|
|
}
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
2023-12-07 07:42:09 +02:00
|
|
|
hasNotSpecifiedMentions.value = false;
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
function addMissingMention() {
|
2023-12-07 07:42:09 +02:00
|
|
|
const ast = mfm.parse(text.value);
|
2020-10-17 14:12:00 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
for (const x of extractMentions(ast)) {
|
2023-12-07 07:42:09 +02:00
|
|
|
if (!visibleUsers.value.some(u => (u.username === x.username) && (u.host === x.host))) {
|
2024-01-04 11:32:46 +02:00
|
|
|
misskeyApi('users/show', { username: x.username, host: x.host }).then(user => {
|
2023-12-07 07:42:09 +02:00
|
|
|
visibleUsers.value.push(user);
|
2020-10-17 14:12:00 +03:00
|
|
|
});
|
|
|
|
}
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function togglePoll() {
|
2023-12-07 07:42:09 +02:00
|
|
|
if (poll.value) {
|
|
|
|
poll.value = null;
|
2022-01-15 18:46:25 +02:00
|
|
|
} else {
|
2023-12-07 07:42:09 +02:00
|
|
|
poll.value = {
|
2022-01-15 18:46:25 +02:00
|
|
|
choices: ['', ''],
|
|
|
|
multiple: false,
|
|
|
|
expiresAt: null,
|
|
|
|
expiredAfter: null,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2020-10-17 14:12:00 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
function addTag(tag: string) {
|
2023-12-07 07:42:09 +02:00
|
|
|
insertTextAtCursor(textareaEl.value, ` #${tag} `);
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
function focus() {
|
2023-12-07 07:42:09 +02:00
|
|
|
if (textareaEl.value) {
|
|
|
|
textareaEl.value.focus();
|
|
|
|
textareaEl.value.setSelectionRange(textareaEl.value.value.length, textareaEl.value.value.length);
|
2022-02-09 14:27:42 +02:00
|
|
|
}
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
2021-04-15 18:13:20 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
function chooseFileFrom(ev) {
|
2023-11-03 08:35:07 +02:00
|
|
|
if (props.mock) return;
|
|
|
|
|
2022-01-28 04:53:12 +02:00
|
|
|
selectFiles(ev.currentTarget ?? ev.target, i18n.ts.attachFile).then(files_ => {
|
2022-01-19 16:51:28 +02:00
|
|
|
for (const file of files_) {
|
2023-12-07 07:42:09 +02:00
|
|
|
files.value.push(file);
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function detachFile(id) {
|
2023-12-07 07:42:09 +02:00
|
|
|
files.value = files.value.filter(x => x.id !== id);
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function updateFileSensitive(file, sensitive) {
|
2023-11-03 08:35:07 +02:00
|
|
|
if (props.mock) {
|
|
|
|
emit('fileChangeSensitive', file.id, sensitive);
|
|
|
|
}
|
2023-12-07 07:42:09 +02:00
|
|
|
files.value[files.value.findIndex(x => x.id === file.id)].isSensitive = sensitive;
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function updateFileName(file, name) {
|
2023-12-07 07:42:09 +02:00
|
|
|
files.value[files.value.findIndex(x => x.id === file.id)].name = name;
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
2023-09-04 07:33:38 +03:00
|
|
|
function replaceFile(file: Misskey.entities.DriveFile, newFile: Misskey.entities.DriveFile): void {
|
2023-12-07 07:42:09 +02:00
|
|
|
files.value[files.value.findIndex(x => x.id === file.id)] = newFile;
|
2023-07-05 07:54:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function upload(file: File, name?: string): void {
|
2023-11-03 08:35:07 +02:00
|
|
|
if (props.mock) return;
|
|
|
|
|
2022-04-28 05:14:03 +03:00
|
|
|
uploadFile(file, defaultStore.state.uploadFolder, name).then(res => {
|
2023-12-07 07:42:09 +02:00
|
|
|
files.value.push(res);
|
2022-01-15 18:46:25 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function setVisibility() {
|
|
|
|
if (props.channel) {
|
2023-12-07 07:42:09 +02:00
|
|
|
visibility.value = 'public';
|
|
|
|
localOnly.value = true; // TODO: チャンネルが連合するようになった折には消す
|
2022-01-15 18:46:25 +02:00
|
|
|
return;
|
|
|
|
}
|
2021-04-15 18:13:20 +03:00
|
|
|
|
2022-08-30 18:24:33 +03:00
|
|
|
os.popup(defineAsyncComponent(() => import('@/components/MkVisibilityPicker.vue')), {
|
2023-12-07 07:42:09 +02:00
|
|
|
currentVisibility: visibility.value,
|
2024-01-05 08:25:26 +02:00
|
|
|
isSilenced: $i.isSilenced,
|
2023-12-07 07:42:09 +02:00
|
|
|
localOnly: localOnly.value,
|
|
|
|
src: visibilityButton.value,
|
2024-03-02 18:36:49 +02:00
|
|
|
...(props.reply ? { isReplyVisibilitySpecified: props.reply.visibility === 'specified' } : {}),
|
2022-01-15 18:46:25 +02:00
|
|
|
}, {
|
2022-01-16 01:49:27 +02:00
|
|
|
changeVisibility: v => {
|
2023-12-07 07:42:09 +02:00
|
|
|
visibility.value = v;
|
2022-01-15 18:46:25 +02:00
|
|
|
if (defaultStore.state.rememberNoteVisibility) {
|
2023-12-07 07:42:09 +02:00
|
|
|
defaultStore.set('visibility', visibility.value);
|
2021-04-15 18:13:20 +03:00
|
|
|
}
|
|
|
|
},
|
2022-01-15 18:46:25 +02:00
|
|
|
}, 'closed');
|
|
|
|
}
|
|
|
|
|
2023-04-05 08:30:03 +03:00
|
|
|
async function toggleLocalOnly() {
|
|
|
|
if (props.channel) {
|
2023-12-07 07:42:09 +02:00
|
|
|
visibility.value = 'public';
|
|
|
|
localOnly.value = true; // TODO: チャンネルが連合するようになった折には消す
|
2023-04-05 08:30:03 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const neverShowInfo = miLocalStorage.getItem('neverShowLocalOnlyInfo');
|
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
if (!localOnly.value && neverShowInfo !== 'true') {
|
2023-04-05 08:30:03 +03:00
|
|
|
const confirm = await os.actions({
|
|
|
|
type: 'question',
|
|
|
|
title: i18n.ts.disableFederationConfirm,
|
|
|
|
text: i18n.ts.disableFederationConfirmWarn,
|
|
|
|
actions: [
|
|
|
|
{
|
|
|
|
value: 'yes' as const,
|
|
|
|
text: i18n.ts.disableFederationOk,
|
|
|
|
primary: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'neverShow' as const,
|
|
|
|
text: `${i18n.ts.disableFederationOk} (${i18n.ts.neverShow})`,
|
|
|
|
danger: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'no' as const,
|
|
|
|
text: i18n.ts.cancel,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
if (confirm.canceled) return;
|
|
|
|
if (confirm.result === 'no') return;
|
|
|
|
|
|
|
|
if (confirm.result === 'neverShow') {
|
|
|
|
miLocalStorage.setItem('neverShowLocalOnlyInfo', 'true');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
localOnly.value = !localOnly.value;
|
2023-04-05 08:30:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
async function toggleReactionAcceptance() {
|
|
|
|
const select = await os.select({
|
|
|
|
title: i18n.ts.reactionAcceptance,
|
|
|
|
items: [
|
|
|
|
{ value: null, text: i18n.ts.all },
|
|
|
|
{ value: 'likeOnlyForRemote' as const, text: i18n.ts.likeOnlyForRemote },
|
2023-05-19 03:43:38 +03:00
|
|
|
{ value: 'nonSensitiveOnly' as const, text: i18n.ts.nonSensitiveOnly },
|
|
|
|
{ value: 'nonSensitiveOnlyForLocalLikeOnlyForRemote' as const, text: i18n.ts.nonSensitiveOnlyForLocalLikeOnlyForRemote },
|
|
|
|
{ value: 'likeOnly' as const, text: i18n.ts.likeOnly },
|
2023-04-05 08:30:03 +03:00
|
|
|
],
|
2023-12-07 07:42:09 +02:00
|
|
|
default: reactionAcceptance.value,
|
2023-04-05 08:30:03 +03:00
|
|
|
});
|
|
|
|
if (select.canceled) return;
|
2023-12-07 07:42:09 +02:00
|
|
|
reactionAcceptance.value = select.result;
|
2023-04-05 08:30:03 +03:00
|
|
|
}
|
|
|
|
|
2024-01-30 12:53:53 +02:00
|
|
|
function pushVisibleUser(user: Misskey.entities.UserDetailed) {
|
2023-12-07 07:42:09 +02:00
|
|
|
if (!visibleUsers.value.some(u => u.username === user.username && u.host === user.host)) {
|
|
|
|
visibleUsers.value.push(user);
|
2022-02-01 14:49:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
function addVisibleUser() {
|
|
|
|
os.selectUser().then(user => {
|
2022-02-01 14:49:34 +02:00
|
|
|
pushVisibleUser(user);
|
2023-03-07 10:12:46 +02:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
if (!text.value.toLowerCase().includes(`@${user.username.toLowerCase()}`)) {
|
|
|
|
text.value = `@${Misskey.acct.toString(user)} ${text.value}`;
|
2023-03-07 10:12:46 +02:00
|
|
|
}
|
2022-01-15 18:46:25 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeVisibleUser(user) {
|
2023-12-07 07:42:09 +02:00
|
|
|
visibleUsers.value = erase(user, visibleUsers.value);
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function clear() {
|
2023-12-07 07:42:09 +02:00
|
|
|
text.value = '';
|
|
|
|
files.value = [];
|
|
|
|
poll.value = null;
|
|
|
|
quoteId.value = null;
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
2022-05-07 11:01:01 +03:00
|
|
|
function onKeydown(ev: KeyboardEvent) {
|
2023-12-07 07:42:09 +02:00
|
|
|
if (ev.key === 'Enter' && (ev.ctrlKey || ev.metaKey) && canPost.value) post();
|
2023-03-01 08:24:09 +02:00
|
|
|
if (ev.key === 'Escape') emit('esc');
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
2022-05-07 11:01:01 +03:00
|
|
|
function onCompositionUpdate(ev: CompositionEvent) {
|
2023-12-07 07:42:09 +02:00
|
|
|
imeText.value = ev.data;
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
2022-05-07 11:01:01 +03:00
|
|
|
function onCompositionEnd(ev: CompositionEvent) {
|
2023-12-07 07:42:09 +02:00
|
|
|
imeText.value = '';
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
2022-05-07 11:01:01 +03:00
|
|
|
async function onPaste(ev: ClipboardEvent) {
|
2023-11-03 08:35:07 +02:00
|
|
|
if (props.mock) return;
|
2024-01-30 12:53:53 +02:00
|
|
|
if (!ev.clipboardData) return;
|
2023-11-03 08:35:07 +02:00
|
|
|
|
2024-01-30 12:53:53 +02:00
|
|
|
for (const { item, i } of Array.from(ev.clipboardData.items, (data, x) => ({ item: data, i: x }))) {
|
2022-05-07 11:01:01 +03:00
|
|
|
if (item.kind === 'file') {
|
2022-01-15 18:46:25 +02:00
|
|
|
const file = item.getAsFile();
|
2024-01-30 12:53:53 +02:00
|
|
|
if (!file) continue;
|
2022-01-15 18:46:25 +02:00
|
|
|
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-05 05:50:09 +02:00
|
|
|
|
2022-05-07 11:01:01 +03:00
|
|
|
const paste = ev.clipboardData.getData('text');
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
if (!props.renote && !quoteId.value && paste.startsWith(url + '/notes/')) {
|
2022-05-07 11:01:01 +03:00
|
|
|
ev.preventDefault();
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
os.confirm({
|
|
|
|
type: 'info',
|
2022-01-28 04:39:49 +02:00
|
|
|
text: i18n.ts.quoteQuestion,
|
2022-01-15 18:46:25 +02:00
|
|
|
}).then(({ canceled }) => {
|
|
|
|
if (canceled) {
|
2023-12-07 07:42:09 +02:00
|
|
|
insertTextAtCursor(textareaEl.value, paste);
|
2020-08-18 16:44:21 +03:00
|
|
|
return;
|
|
|
|
}
|
2020-10-17 14:12:00 +03:00
|
|
|
|
2024-01-30 12:53:53 +02:00
|
|
|
quoteId.value = paste.substring(url.length).match(/^\/notes\/(.+?)\/?$/)?.[1] ?? null;
|
2022-01-15 18:46:25 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-07 11:01:01 +03: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 18:46:25 +02:00
|
|
|
if (isFile || isDriveFile) {
|
2022-05-07 11:01:01 +03:00
|
|
|
ev.preventDefault();
|
2023-12-07 07:42:09 +02:00
|
|
|
draghover.value = true;
|
2022-07-25 15:16:11 +03:00
|
|
|
switch (ev.dataTransfer.effectAllowed) {
|
|
|
|
case 'all':
|
|
|
|
case 'uninitialized':
|
2023-03-01 08:24:09 +02:00
|
|
|
case 'copy':
|
|
|
|
case 'copyLink':
|
|
|
|
case 'copyMove':
|
2022-07-25 15:16:11 +03:00
|
|
|
ev.dataTransfer.dropEffect = 'copy';
|
|
|
|
break;
|
|
|
|
case 'linkMove':
|
|
|
|
case 'move':
|
|
|
|
ev.dataTransfer.dropEffect = 'move';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ev.dataTransfer.dropEffect = 'none';
|
|
|
|
break;
|
|
|
|
}
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
}
|
2021-01-15 16:20:47 +02:00
|
|
|
|
2024-01-30 12:53:53 +02:00
|
|
|
function onDragenter() {
|
2023-12-07 07:42:09 +02:00
|
|
|
draghover.value = true;
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
2021-01-15 16:20:47 +02:00
|
|
|
|
2024-01-30 12:53:53 +02:00
|
|
|
function onDragleave() {
|
2023-12-07 07:42:09 +02:00
|
|
|
draghover.value = false;
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2024-01-30 12:53:53 +02:00
|
|
|
function onDrop(ev: DragEvent): void {
|
2023-12-07 07:42:09 +02:00
|
|
|
draghover.value = false;
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
// ファイルだったら
|
2024-01-30 12:53:53 +02:00
|
|
|
if (ev.dataTransfer && ev.dataTransfer.files.length > 0) {
|
2022-05-07 11:01:01 +03:00
|
|
|
ev.preventDefault();
|
|
|
|
for (const x of Array.from(ev.dataTransfer.files)) upload(x);
|
2022-01-15 18:46:25 +02:00
|
|
|
return;
|
|
|
|
}
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
//#region ドライブのファイル
|
2024-01-30 12:53:53 +02:00
|
|
|
const driveFile = ev.dataTransfer?.getData(_DATA_TRANSFER_DRIVE_FILE_);
|
2022-05-07 11:01:01 +03:00
|
|
|
if (driveFile != null && driveFile !== '') {
|
2022-01-15 18:46:25 +02:00
|
|
|
const file = JSON.parse(driveFile);
|
2023-12-07 07:42:09 +02:00
|
|
|
files.value.push(file);
|
2022-05-07 11:01:01 +03:00
|
|
|
ev.preventDefault();
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
//#endregion
|
|
|
|
}
|
|
|
|
|
|
|
|
function saveDraft() {
|
2023-11-03 08:35:07 +02:00
|
|
|
if (props.instant || props.mock) return;
|
2023-09-09 03:54:54 +03:00
|
|
|
|
2023-02-22 08:28:17 +02:00
|
|
|
const draftData = JSON.parse(miLocalStorage.getItem('drafts') ?? '{}');
|
2022-01-15 18:46:25 +02:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
draftData[draftKey.value] = {
|
2022-01-15 18:46:25 +02:00
|
|
|
updatedAt: new Date(),
|
|
|
|
data: {
|
2023-12-07 07:42:09 +02:00
|
|
|
text: text.value,
|
|
|
|
useCw: useCw.value,
|
|
|
|
cw: cw.value,
|
|
|
|
visibility: visibility.value,
|
|
|
|
localOnly: localOnly.value,
|
|
|
|
files: files.value,
|
|
|
|
poll: poll.value,
|
2022-07-05 17:01:23 +03:00
|
|
|
},
|
2022-01-15 18:46:25 +02:00
|
|
|
};
|
|
|
|
|
2023-01-07 03:13:02 +02:00
|
|
|
miLocalStorage.setItem('drafts', JSON.stringify(draftData));
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function deleteDraft() {
|
2023-01-07 03:13:02 +02:00
|
|
|
const draftData = JSON.parse(miLocalStorage.getItem('drafts') ?? '{}');
|
2022-01-15 18:46:25 +02:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
delete draftData[draftKey.value];
|
2022-01-15 18:46:25 +02:00
|
|
|
|
2023-01-07 03:13:02 +02:00
|
|
|
miLocalStorage.setItem('drafts', JSON.stringify(draftData));
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
2022-12-31 12:46:16 +02:00
|
|
|
async function post(ev?: MouseEvent) {
|
2023-12-07 07:42:09 +02:00
|
|
|
if (useCw.value && (cw.value == null || cw.value.trim() === '')) {
|
2023-11-03 01:17:35 +02:00
|
|
|
os.alert({
|
|
|
|
type: 'error',
|
|
|
|
text: i18n.ts.cwNotationRequired,
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-12-31 12:46:16 +02:00
|
|
|
if (ev) {
|
2024-01-30 12:53:53 +02:00
|
|
|
const el = (ev.currentTarget ?? ev.target) as HTMLElement | null;
|
|
|
|
|
|
|
|
if (el) {
|
|
|
|
const rect = el.getBoundingClientRect();
|
|
|
|
const x = rect.left + (el.offsetWidth / 2);
|
|
|
|
const y = rect.top + (el.offsetHeight / 2);
|
|
|
|
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
|
|
|
}
|
2022-12-31 12:46:16 +02:00
|
|
|
}
|
|
|
|
|
2023-11-03 08:35:07 +02:00
|
|
|
if (props.mock) return;
|
|
|
|
|
2023-02-11 06:54:27 +02:00
|
|
|
const annoying =
|
2023-12-07 07:42:09 +02:00
|
|
|
text.value.includes('$[x2') ||
|
|
|
|
text.value.includes('$[x3') ||
|
|
|
|
text.value.includes('$[x4') ||
|
|
|
|
text.value.includes('$[scale') ||
|
|
|
|
text.value.includes('$[position');
|
2023-04-03 03:59:35 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
if (annoying && visibility.value === 'public') {
|
2023-02-11 06:54:27 +02:00
|
|
|
const { canceled, result } = await os.actions({
|
|
|
|
type: 'warning',
|
|
|
|
text: i18n.ts.thisPostMayBeAnnoying,
|
|
|
|
actions: [{
|
|
|
|
value: 'home',
|
|
|
|
text: i18n.ts.thisPostMayBeAnnoyingHome,
|
|
|
|
primary: true,
|
|
|
|
}, {
|
|
|
|
value: 'cancel',
|
|
|
|
text: i18n.ts.thisPostMayBeAnnoyingCancel,
|
|
|
|
}, {
|
|
|
|
value: 'ignore',
|
|
|
|
text: i18n.ts.thisPostMayBeAnnoyingIgnore,
|
|
|
|
}],
|
|
|
|
});
|
|
|
|
|
|
|
|
if (canceled) return;
|
|
|
|
if (result === 'cancel') return;
|
|
|
|
if (result === 'home') {
|
2023-12-07 07:42:09 +02:00
|
|
|
visibility.value = 'home';
|
2023-02-11 06:54:27 +02:00
|
|
|
}
|
|
|
|
}
|
2024-02-16 22:53:27 +02:00
|
|
|
|
|
|
|
if (defaultStore.state.warnMissingAltText) {
|
|
|
|
const filesData = toRaw(files.value);
|
2024-02-19 21:53:13 +02:00
|
|
|
|
|
|
|
const isMissingAltText = filesData.some(file => !file.comment);
|
|
|
|
|
|
|
|
if (isMissingAltText) {
|
|
|
|
const { canceled, result } = await os.actions({
|
|
|
|
type: 'warning',
|
|
|
|
text: i18n.ts.thisPostIsMissingAltText,
|
|
|
|
actions: [{
|
|
|
|
value: 'cancel',
|
|
|
|
text: i18n.ts.thisPostIsMissingAltTextCancel,
|
|
|
|
}, {
|
|
|
|
value: 'ignore',
|
|
|
|
text: i18n.ts.thisPostIsMissingAltTextIgnore,
|
|
|
|
}],
|
|
|
|
});
|
|
|
|
|
|
|
|
if (canceled) return;
|
|
|
|
if (result === 'cancel') return;
|
2024-02-16 22:53:27 +02:00
|
|
|
}
|
|
|
|
}
|
2023-02-11 06:54:27 +02:00
|
|
|
|
2022-05-07 11:01:01 +03:00
|
|
|
let postData = {
|
2023-12-07 07:42:09 +02:00
|
|
|
text: text.value === '' ? null : text.value,
|
|
|
|
fileIds: files.value.length > 0 ? files.value.map(f => f.id) : undefined,
|
2022-01-15 18:46:25 +02:00
|
|
|
replyId: props.reply ? props.reply.id : undefined,
|
2023-12-07 07:42:09 +02:00
|
|
|
renoteId: props.renote ? props.renote.id : quoteId.value ? quoteId.value : undefined,
|
2022-01-15 18:46:25 +02:00
|
|
|
channelId: props.channel ? props.channel.id : undefined,
|
2023-12-07 07:42:09 +02:00
|
|
|
poll: poll.value,
|
|
|
|
cw: useCw.value ? cw.value ?? '' : null,
|
|
|
|
localOnly: localOnly.value,
|
|
|
|
visibility: visibility.value,
|
|
|
|
visibleUserIds: visibility.value === 'specified' ? visibleUsers.value.map(u => u.id) : undefined,
|
|
|
|
reactionAcceptance: reactionAcceptance.value,
|
2023-09-22 23:33:18 +03:00
|
|
|
editId: props.editId ? props.editId : undefined,
|
2022-01-15 18:46:25 +02:00
|
|
|
};
|
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
if (withHashtags.value && hashtags.value && hashtags.value.trim() !== '') {
|
|
|
|
const hashtags_ = hashtags.value.trim().split(' ').map(x => x.startsWith('#') ? x : '#' + x).join(' ');
|
2023-12-29 11:22:40 +02:00
|
|
|
if (!postData.text) {
|
|
|
|
postData.text = hashtags_;
|
|
|
|
} else {
|
|
|
|
const postTextLines = postData.text.split('\n');
|
|
|
|
if (postTextLines[postTextLines.length - 1].trim() === '') {
|
|
|
|
postTextLines[postTextLines.length - 1] += hashtags_;
|
|
|
|
} else {
|
|
|
|
postTextLines[postTextLines.length - 1] += ' ' + hashtags_;
|
|
|
|
}
|
|
|
|
postData.text = postTextLines.join('\n');
|
|
|
|
}
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
// plugin
|
|
|
|
if (notePostInterruptors.length > 0) {
|
|
|
|
for (const interruptor of notePostInterruptors) {
|
2023-11-06 04:21:43 +02:00
|
|
|
try {
|
2024-01-30 12:53:53 +02:00
|
|
|
postData = await interruptor.handler(deepClone(postData)) as typeof postData;
|
2023-11-06 04:21:43 +02:00
|
|
|
} catch (err) {
|
|
|
|
console.error(err);
|
|
|
|
}
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
}
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2024-01-30 12:53:53 +02:00
|
|
|
let token: string | undefined = undefined;
|
2022-01-21 13:17:31 +02:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
if (postAccount.value) {
|
2022-01-21 13:17:31 +02:00
|
|
|
const storedAccounts = await getAccounts();
|
2024-01-30 12:53:53 +02:00
|
|
|
token = storedAccounts.find(x => x.id === postAccount.value?.id)?.token;
|
2022-01-21 13:17:31 +02:00
|
|
|
}
|
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
posting.value = true;
|
2024-01-09 03:57:57 +02:00
|
|
|
misskeyApi(postData.editId ? 'notes/edit' : 'notes/create', postData, token).then(() => {
|
2022-12-31 12:46:16 +02:00
|
|
|
if (props.freezeAfterPosted) {
|
2023-12-07 07:42:09 +02:00
|
|
|
posted.value = true;
|
2022-12-31 12:46:16 +02:00
|
|
|
} else {
|
|
|
|
clear();
|
|
|
|
}
|
2022-01-15 18:46:25 +02:00
|
|
|
nextTick(() => {
|
|
|
|
deleteDraft();
|
|
|
|
emit('posted');
|
2022-05-07 11:01:01 +03:00
|
|
|
if (postData.text && postData.text !== '') {
|
2024-01-30 12:53:53 +02:00
|
|
|
const hashtags_ = mfm.parse(postData.text).map(x => x.type === 'hashtag' && x.props.hashtag).filter(x => x) as string[];
|
2023-02-22 08:28:17 +02:00
|
|
|
const history = JSON.parse(miLocalStorage.getItem('hashtags') ?? '[]') as string[];
|
2023-01-07 03:13:02 +02:00
|
|
|
miLocalStorage.setItem('hashtags', JSON.stringify(unique(hashtags_.concat(history))));
|
2019-05-27 09:38:14 +03:00
|
|
|
}
|
2023-12-07 07:42:09 +02:00
|
|
|
posting.value = false;
|
|
|
|
postAccount.value = null;
|
2023-01-21 06:14:55 +02:00
|
|
|
|
|
|
|
incNotesCount();
|
|
|
|
if (notesCount === 1) {
|
|
|
|
claimAchievement('notes1');
|
|
|
|
}
|
|
|
|
|
2023-07-28 11:46:43 +03:00
|
|
|
const text = postData.text ?? '';
|
|
|
|
const lowerCase = text.toLowerCase();
|
2023-09-22 23:33:18 +03:00
|
|
|
if ((lowerCase.includes('love') || lowerCase.includes('❤')) && lowerCase.includes('sharkey')) {
|
2023-01-21 06:14:55 +02:00
|
|
|
claimAchievement('iLoveMisskey');
|
|
|
|
}
|
2023-07-28 11:46:43 +03:00
|
|
|
if ([
|
|
|
|
'https://youtu.be/Efrlqw8ytg4',
|
|
|
|
'https://www.youtube.com/watch?v=Efrlqw8ytg4',
|
|
|
|
'https://m.youtube.com/watch?v=Efrlqw8ytg4',
|
2023-09-04 07:33:38 +03:00
|
|
|
|
2023-07-28 11:46:43 +03:00
|
|
|
'https://youtu.be/XVCwzwxdHuA',
|
|
|
|
'https://www.youtube.com/watch?v=XVCwzwxdHuA',
|
|
|
|
'https://m.youtube.com/watch?v=XVCwzwxdHuA',
|
|
|
|
|
|
|
|
'https://open.spotify.com/track/3Cuj0mZrlLoXx9nydNi7RB',
|
|
|
|
'https://open.spotify.com/track/7anfcaNPQWlWCwyCHmZqNy',
|
|
|
|
'https://open.spotify.com/track/5Odr16TvEN4my22K9nbH7l',
|
|
|
|
'https://open.spotify.com/album/5bOlxyl4igOrp2DwVQxBco',
|
|
|
|
].some(url => text.includes(url))) {
|
2023-01-21 06:14:55 +02:00
|
|
|
claimAchievement('brainDiver');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (props.renote && (props.renote.userId === $i.id) && text.length > 0) {
|
|
|
|
claimAchievement('selfQuote');
|
|
|
|
}
|
|
|
|
|
|
|
|
const date = new Date();
|
|
|
|
const h = date.getHours();
|
|
|
|
const m = date.getMinutes();
|
|
|
|
const s = date.getSeconds();
|
|
|
|
if (h >= 0 && h <= 3) {
|
|
|
|
claimAchievement('postedAtLateNight');
|
|
|
|
}
|
|
|
|
if (m === 0 && s === 0) {
|
|
|
|
claimAchievement('postedAt0min0sec');
|
|
|
|
}
|
2022-01-15 18:46:25 +02:00
|
|
|
});
|
|
|
|
}).catch(err => {
|
2023-12-07 07:42:09 +02:00
|
|
|
posting.value = false;
|
2022-01-15 18:46:25 +02:00
|
|
|
os.alert({
|
|
|
|
type: 'error',
|
|
|
|
text: err.message + '\n' + (err as any).id,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function cancel() {
|
|
|
|
emit('cancel');
|
|
|
|
}
|
|
|
|
|
|
|
|
function insertMention() {
|
2024-02-02 09:49:09 +02:00
|
|
|
os.selectUser({ localOnly: localOnly.value, includeSelf: true }).then(user => {
|
2023-12-07 07:42:09 +02:00
|
|
|
insertTextAtCursor(textareaEl.value, '@' + Misskey.acct.toString(user) + ' ');
|
2022-01-15 18:46:25 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-01-21 13:17:31 +02:00
|
|
|
async function insertEmoji(ev: MouseEvent) {
|
2023-12-04 11:12:14 +02:00
|
|
|
textAreaReadOnly.value = true;
|
2024-01-30 12:53:53 +02:00
|
|
|
const target = ev.currentTarget ?? ev.target;
|
|
|
|
if (target == null) return;
|
2023-12-03 10:25:34 +02:00
|
|
|
emojiPicker.show(
|
2024-01-30 12:53:53 +02:00
|
|
|
target as HTMLElement,
|
2023-12-03 10:25:34 +02:00
|
|
|
emoji => {
|
2023-12-07 07:42:09 +02:00
|
|
|
insertTextAtCursor(textareaEl.value, emoji);
|
2023-12-03 10:25:34 +02:00
|
|
|
},
|
|
|
|
() => {
|
2023-12-04 11:12:14 +02:00
|
|
|
textAreaReadOnly.value = false;
|
2023-12-14 07:11:20 +02:00
|
|
|
nextTick(() => focus());
|
2023-12-03 10:25:34 +02:00
|
|
|
},
|
|
|
|
);
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
|
|
|
|
2023-12-27 13:57:43 +02:00
|
|
|
async function insertMfmFunction(ev: MouseEvent) {
|
2024-01-30 12:53:53 +02:00
|
|
|
if (textareaEl.value == null) return;
|
2023-12-27 13:57:43 +02:00
|
|
|
mfmFunctionPicker(
|
|
|
|
ev.currentTarget ?? ev.target,
|
|
|
|
textareaEl.value,
|
|
|
|
text,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-01-30 12:53:53 +02:00
|
|
|
function showActions(ev: MouseEvent) {
|
2022-01-15 18:46:25 +02:00
|
|
|
os.popupMenu(postFormActions.map(action => ({
|
|
|
|
text: action.title,
|
|
|
|
action: () => {
|
|
|
|
action.handler({
|
2023-12-07 07:42:09 +02:00
|
|
|
text: text.value,
|
|
|
|
cw: cw.value,
|
2024-01-30 12:53:53 +02:00
|
|
|
}, (key, value: any) => {
|
|
|
|
if (typeof key !== 'string') return;
|
2023-12-07 07:42:09 +02:00
|
|
|
if (key === 'text') { text.value = value; }
|
|
|
|
if (key === 'cw') { useCw.value = value !== null; cw.value = value; }
|
2022-01-15 18:46:25 +02:00
|
|
|
});
|
2022-07-05 17:01:23 +03:00
|
|
|
},
|
2022-01-28 04:53:12 +02:00
|
|
|
})), ev.currentTarget ?? ev.target);
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const postAccount = ref<Misskey.entities.UserDetailed | null>(null);
|
2022-01-21 13:17:31 +02:00
|
|
|
|
|
|
|
function openAccountMenu(ev: MouseEvent) {
|
2023-11-03 08:35:07 +02:00
|
|
|
if (props.mock) return;
|
|
|
|
|
2022-01-21 13:17:31 +02:00
|
|
|
openAccountMenu_({
|
|
|
|
withExtraOperation: false,
|
|
|
|
includeCurrentAccount: true,
|
2023-12-07 07:42:09 +02:00
|
|
|
active: postAccount.value != null ? postAccount.value.id : $i.id,
|
2022-01-21 13:17:31 +02:00
|
|
|
onChoose: (account) => {
|
|
|
|
if (account.id === $i.id) {
|
2023-12-07 07:42:09 +02:00
|
|
|
postAccount.value = null;
|
2022-01-21 13:17:31 +02:00
|
|
|
} else {
|
2023-12-07 07:42:09 +02:00
|
|
|
postAccount.value = account;
|
2022-01-21 13:17:31 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
}, ev);
|
|
|
|
}
|
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
onMounted(() => {
|
|
|
|
if (props.autofocus) {
|
|
|
|
focus();
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
nextTick(() => {
|
|
|
|
focus();
|
|
|
|
});
|
|
|
|
}
|
2019-05-27 09:38:14 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
// TODO: detach when unmount
|
2024-01-30 12:53:53 +02:00
|
|
|
if (textareaEl.value) new Autocomplete(textareaEl.value, text);
|
|
|
|
if (cwInputEl.value) new Autocomplete(cwInputEl.value, cw);
|
|
|
|
if (hashtagsInputEl.value) new Autocomplete(hashtagsInputEl.value, hashtags);
|
2022-01-15 18:46:25 +02:00
|
|
|
|
|
|
|
nextTick(() => {
|
|
|
|
// 書きかけの投稿を復元
|
2023-11-03 08:35:07 +02:00
|
|
|
if (!props.instant && !props.mention && !props.specified && !props.mock) {
|
2023-12-07 07:42:09 +02:00
|
|
|
const draft = JSON.parse(miLocalStorage.getItem('drafts') ?? '{}')[draftKey.value];
|
2022-01-15 18:46:25 +02:00
|
|
|
if (draft) {
|
2023-11-27 21:12:20 +02:00
|
|
|
if (typeof draft.data.text === 'string' && draft.data.text.trim()) {
|
|
|
|
text.value = draft.data.text;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeof draft.data.cw === 'string' && draft.data.cw.trim()) {
|
|
|
|
cw.value = draft.data.cw;
|
|
|
|
}
|
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
useCw.value = draft.data.useCw;
|
|
|
|
visibility.value = draft.data.visibility;
|
|
|
|
localOnly.value = draft.data.localOnly;
|
|
|
|
files.value = (draft.data.files || []).filter(draftFile => draftFile);
|
2023-11-27 21:12:20 +02:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
if (draft.data.poll) {
|
2023-12-07 07:42:09 +02:00
|
|
|
poll.value = draft.data.poll;
|
2019-05-27 09:38:14 +03:00
|
|
|
}
|
2021-08-07 06:47:01 +03:00
|
|
|
}
|
2022-01-15 18:46:25 +02:00
|
|
|
}
|
2021-08-07 06:47:01 +03:00
|
|
|
|
2022-01-15 18:46:25 +02:00
|
|
|
// 削除して編集
|
|
|
|
if (props.initialNote) {
|
|
|
|
const init = props.initialNote;
|
2023-12-07 07:42:09 +02:00
|
|
|
text.value = init.text ? init.text : '';
|
2024-01-30 12:53:53 +02:00
|
|
|
files.value = init.files ?? [];
|
|
|
|
cw.value = init.cw ?? null;
|
2023-12-07 07:42:09 +02:00
|
|
|
useCw.value = init.cw != null;
|
2022-01-15 18:46:25 +02:00
|
|
|
if (init.poll) {
|
2023-12-07 07:42:09 +02:00
|
|
|
poll.value = {
|
2022-01-15 18:46:25 +02:00
|
|
|
choices: init.poll.choices.map(x => x.text),
|
|
|
|
multiple: init.poll.multiple,
|
2024-01-30 12:53:53 +02:00
|
|
|
expiresAt: init.poll.expiresAt ? (new Date(init.poll.expiresAt)).getTime() : null,
|
|
|
|
expiredAfter: null,
|
2022-01-15 18:46:25 +02:00
|
|
|
};
|
2020-07-29 17:37:50 +03:00
|
|
|
}
|
2023-12-07 07:42:09 +02:00
|
|
|
visibility.value = init.visibility;
|
2024-01-30 12:53:53 +02:00
|
|
|
localOnly.value = init.localOnly ?? false;
|
2023-12-07 07:42:09 +02:00
|
|
|
quoteId.value = init.renote ? init.renote.id : null;
|
2020-07-11 18:38:55 +03:00
|
|
|
}
|
2022-01-15 18:46:25 +02:00
|
|
|
|
|
|
|
nextTick(() => watchForDraft());
|
|
|
|
});
|
2019-05-27 09:38:14 +03:00
|
|
|
});
|
2022-12-31 12:46:16 +02:00
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
clear,
|
|
|
|
});
|
2020-01-29 21:37:25 +02:00
|
|
|
</script>
|
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2020-10-17 14:12:00 +03:00
|
|
|
position: relative;
|
2023-04-05 08:30:03 +03:00
|
|
|
container-type: inline-size;
|
2020-10-17 14:12:00 +03:00
|
|
|
|
|
|
|
&.modal {
|
|
|
|
width: 100%;
|
|
|
|
max-width: 520px;
|
|
|
|
}
|
2023-01-14 07:57:48 +02:00
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-04-05 08:30:03 +03:00
|
|
|
//#region header
|
2023-01-14 07:57:48 +02:00
|
|
|
.header {
|
|
|
|
z-index: 1000;
|
2023-04-05 08:30:03 +03:00
|
|
|
min-height: 50px;
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
gap: 4px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.headerLeft {
|
2023-04-13 14:27:21 +03:00
|
|
|
display: flex;
|
|
|
|
flex: 0 1 100px;
|
2023-01-14 07:57:48 +02:00
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.cancel {
|
|
|
|
padding: 0;
|
|
|
|
font-size: 1em;
|
2023-04-05 08:30:03 +03:00
|
|
|
height: 100%;
|
2023-04-13 14:27:21 +03:00
|
|
|
flex: 0 1 50px;
|
2023-01-14 07:57:48 +02:00
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.account {
|
|
|
|
height: 100%;
|
|
|
|
display: inline-flex;
|
|
|
|
vertical-align: bottom;
|
2023-04-13 14:27:21 +03:00
|
|
|
flex: 0 1 50px;
|
2023-01-14 07:57:48 +02:00
|
|
|
}
|
2022-01-21 13:17:31 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.avatar {
|
|
|
|
width: 28px;
|
|
|
|
height: 28px;
|
2023-04-13 14:27:21 +03:00
|
|
|
margin: auto;
|
2023-01-14 07:57:48 +02:00
|
|
|
}
|
2022-01-21 13:17:31 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.headerRight {
|
2023-04-05 08:30:03 +03:00
|
|
|
display: flex;
|
|
|
|
min-height: 48px;
|
|
|
|
font-size: 0.9em;
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
align-items: center;
|
|
|
|
margin-left: auto;
|
|
|
|
gap: 4px;
|
|
|
|
overflow: clip;
|
|
|
|
padding-left: 4px;
|
2023-01-14 07:57:48 +02:00
|
|
|
}
|
2020-02-08 10:49:54 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.submit {
|
2023-04-05 08:30:03 +03:00
|
|
|
margin: 12px 12px 12px 6px;
|
2023-01-14 07:57:48 +02:00
|
|
|
vertical-align: bottom;
|
2022-12-31 12:46:16 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
&:disabled {
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
2023-01-01 07:12:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
&.posting {
|
|
|
|
cursor: wait;
|
|
|
|
}
|
2023-01-01 07:12:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
&:not(:disabled):hover {
|
|
|
|
> .inner {
|
|
|
|
background: linear-gradient(90deg, var(--X8), var(--X8));
|
2020-01-29 21:37:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
&:not(:disabled):active {
|
|
|
|
> .inner {
|
|
|
|
background: linear-gradient(90deg, var(--X8), var(--X8));
|
2020-01-29 21:37:25 +02:00
|
|
|
}
|
2023-01-14 07:57:48 +02:00
|
|
|
}
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-12-16 07:13:38 +02:00
|
|
|
.colorBar {
|
|
|
|
position: absolute;
|
|
|
|
top: 0px;
|
|
|
|
left: 12px;
|
|
|
|
width: 5px;
|
|
|
|
height: 100% ;
|
2023-12-23 14:20:51 +02:00
|
|
|
border-radius: var(--radius-ellipse);
|
2023-12-16 07:13:38 +02:00
|
|
|
pointer-events: none;
|
|
|
|
}
|
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.submitInner {
|
|
|
|
padding: 0 12px;
|
|
|
|
line-height: 34px;
|
|
|
|
font-weight: bold;
|
2023-10-31 20:44:34 +02:00
|
|
|
border-radius: var(--radius-sm);
|
2023-01-14 07:57:48 +02:00
|
|
|
min-width: 90px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
color: var(--fgOnAccent);
|
|
|
|
background: linear-gradient(90deg, var(--buttonGradateA), var(--buttonGradateB));
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-04-05 08:30:03 +03:00
|
|
|
.headerRightItem {
|
|
|
|
margin: 0;
|
|
|
|
padding: 8px;
|
2023-10-31 20:44:34 +02:00
|
|
|
border-radius: var(--radius-sm);
|
2023-04-05 08:30:03 +03:00
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background: var(--X5);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:disabled {
|
|
|
|
background: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.danger {
|
|
|
|
color: #ff2a2a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.headerRightButtonText {
|
|
|
|
padding-left: 6px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.visibility {
|
|
|
|
overflow: clip;
|
2023-12-02 05:04:11 +02:00
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
max-width: 210px;
|
2023-04-05 08:30:03 +03:00
|
|
|
|
|
|
|
&:enabled {
|
|
|
|
> .headerRightButtonText {
|
|
|
|
opacity: 0.8;
|
|
|
|
}
|
|
|
|
}
|
2023-01-14 07:57:48 +02:00
|
|
|
}
|
2023-04-05 08:30:03 +03:00
|
|
|
//#endregion
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.preview {
|
|
|
|
padding: 16px 20px 0 20px;
|
2023-11-11 09:07:07 +02:00
|
|
|
min-height: 75px;
|
2023-07-08 12:55:02 +03:00
|
|
|
max-height: 150px;
|
|
|
|
overflow: auto;
|
2023-01-14 07:57:48 +02:00
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.targetNote {
|
2023-07-26 11:17:26 +03:00
|
|
|
padding: 0 20px 16px 20px;
|
2023-01-14 07:57:48 +02:00
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.withQuote {
|
|
|
|
margin: 0 0 8px 0;
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.toSpecified {
|
|
|
|
padding: 6px 24px;
|
|
|
|
margin-bottom: 8px;
|
|
|
|
overflow: auto;
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.visibleUsers {
|
|
|
|
display: inline;
|
|
|
|
top: -1px;
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.visibleUser {
|
|
|
|
margin-right: 14px;
|
|
|
|
padding: 8px 0 8px 8px;
|
2023-10-31 20:44:34 +02:00
|
|
|
border-radius: var(--radius-sm);
|
2023-01-14 07:57:48 +02:00
|
|
|
background: var(--X4);
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.hasNotSpecifiedMentions {
|
|
|
|
margin: 0 20px 16px 20px;
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.cw,
|
|
|
|
.hashtags,
|
|
|
|
.text {
|
|
|
|
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);
|
|
|
|
font-family: inherit;
|
2021-04-15 18:13:20 +03:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
&:focus {
|
|
|
|
outline: none;
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
&:disabled {
|
|
|
|
opacity: 0.5;
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.cw {
|
|
|
|
z-index: 1;
|
|
|
|
padding-bottom: 8px;
|
|
|
|
border-bottom: solid 0.5px var(--divider);
|
|
|
|
}
|
2020-02-05 01:59:24 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.hashtags {
|
|
|
|
z-index: 1;
|
|
|
|
padding-top: 8px;
|
|
|
|
padding-bottom: 8px;
|
|
|
|
border-top: solid 0.5px var(--divider);
|
|
|
|
}
|
2021-08-07 06:47:01 +03:00
|
|
|
|
2023-04-05 08:30:03 +03:00
|
|
|
.textOuter {
|
|
|
|
width: 100%;
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
&.withCw {
|
|
|
|
padding-top: 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.text {
|
|
|
|
max-width: 100%;
|
|
|
|
min-width: 100%;
|
2023-04-05 08:30:03 +03:00
|
|
|
width: 100%;
|
2023-01-14 07:57:48 +02:00
|
|
|
min-height: 90px;
|
2023-04-05 08:30:03 +03:00
|
|
|
height: 100%;
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-04-05 08:30:03 +03:00
|
|
|
.textCount {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
right: 2px;
|
|
|
|
padding: 4px 6px;
|
|
|
|
font-size: .9em;
|
|
|
|
color: var(--warn);
|
2023-10-31 20:44:34 +02:00
|
|
|
border-radius: var(--radius-sm);
|
2023-04-05 08:30:03 +03:00
|
|
|
min-width: 1.6em;
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
&.textOver {
|
|
|
|
color: #ff2a2a;
|
2023-01-14 07:57:48 +02:00
|
|
|
}
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.footer {
|
2023-04-05 08:30:03 +03:00
|
|
|
display: flex;
|
2023-01-14 07:57:48 +02:00
|
|
|
padding: 0 16px 16px 16px;
|
2023-04-05 08:30:03 +03:00
|
|
|
font-size: 1em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.footerLeft {
|
|
|
|
flex: 1;
|
|
|
|
display: grid;
|
|
|
|
grid-auto-flow: row;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
|
2023-04-11 08:57:06 +03:00
|
|
|
grid-auto-rows: 40px;
|
2023-04-05 08:30:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
.footerRight {
|
2023-10-04 04:36:26 +03:00
|
|
|
flex: 0.3;
|
2023-04-05 08:30:03 +03:00
|
|
|
margin-left: auto;
|
|
|
|
display: grid;
|
|
|
|
grid-auto-flow: row;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
|
2023-04-11 08:57:06 +03:00
|
|
|
grid-auto-rows: 40px;
|
2023-04-05 08:30:03 +03:00
|
|
|
direction: rtl;
|
2023-01-14 07:57:48 +02:00
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.footerButton {
|
|
|
|
display: inline-block;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
font-size: 1em;
|
2023-04-05 08:30:03 +03:00
|
|
|
width: auto;
|
|
|
|
height: 100%;
|
2023-10-31 20:44:34 +02:00
|
|
|
border-radius: var(--radius-sm);
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
&:hover {
|
|
|
|
background: var(--X5);
|
|
|
|
}
|
2020-02-05 02:15:28 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
&.footerButtonActive {
|
|
|
|
color: var(--accent);
|
2020-01-29 21:37:25 +02:00
|
|
|
}
|
|
|
|
}
|
2022-12-26 01:40:13 +02:00
|
|
|
|
2023-04-05 08:30:03 +03:00
|
|
|
.previewButtonActive {
|
|
|
|
color: var(--accent);
|
2023-03-08 01:56:47 +02:00
|
|
|
}
|
|
|
|
|
2022-12-26 01:40:13 +02:00
|
|
|
@container (max-width: 500px) {
|
2023-04-05 08:30:03 +03:00
|
|
|
.headerRight {
|
|
|
|
font-size: .9em;
|
|
|
|
}
|
2023-01-14 07:57:48 +02:00
|
|
|
|
2023-04-05 08:30:03 +03:00
|
|
|
.headerRightButtonText {
|
|
|
|
display: none;
|
|
|
|
}
|
2022-12-26 01:40:13 +02:00
|
|
|
|
2023-04-05 08:30:03 +03:00
|
|
|
.visibility {
|
|
|
|
overflow: initial;
|
|
|
|
}
|
2022-12-26 01:40:13 +02:00
|
|
|
|
2023-04-05 08:30:03 +03:00
|
|
|
.submit {
|
|
|
|
margin: 8px 8px 8px 4px;
|
2023-01-14 07:57:48 +02:00
|
|
|
}
|
2022-12-26 01:40:13 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.toSpecified {
|
|
|
|
padding: 6px 16px;
|
|
|
|
}
|
2022-12-26 01:40:13 +02:00
|
|
|
|
2023-04-05 08:30:03 +03:00
|
|
|
.preview {
|
|
|
|
padding: 16px 14px 0 14px;
|
|
|
|
}
|
2023-01-14 07:57:48 +02:00
|
|
|
.cw,
|
|
|
|
.hashtags,
|
|
|
|
.text {
|
|
|
|
padding: 0 16px;
|
|
|
|
}
|
2022-12-26 01:40:13 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.text {
|
|
|
|
min-height: 80px;
|
|
|
|
}
|
2022-12-26 01:40:13 +02:00
|
|
|
|
2023-01-14 07:57:48 +02:00
|
|
|
.footer {
|
|
|
|
padding: 0 8px 8px 8px;
|
2022-12-26 01:40:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-11 08:57:06 +03:00
|
|
|
@container (max-width: 350px) {
|
|
|
|
.footer {
|
|
|
|
font-size: 0.9em;
|
2023-04-05 08:30:03 +03:00
|
|
|
}
|
|
|
|
|
2023-04-11 08:57:06 +03:00
|
|
|
.footerLeft {
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
|
|
|
|
}
|
|
|
|
|
|
|
|
.footerRight {
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
|
|
|
|
}
|
|
|
|
|
|
|
|
.headerRight {
|
|
|
|
gap: 0;
|
2022-12-26 01:40:13 +02:00
|
|
|
}
|
2023-12-16 07:13:38 +02:00
|
|
|
|
2022-12-26 01:40:13 +02:00
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
</style>
|