refactor (minor): update MkPostForm
This commit is contained in:
parent
a5dac3931f
commit
e0c1d9ce00
@ -344,7 +344,6 @@ const visibleUsers = ref([]);
|
|||||||
if (props.initialVisibleUsers) {
|
if (props.initialVisibleUsers) {
|
||||||
props.initialVisibleUsers.forEach(pushVisibleUser);
|
props.initialVisibleUsers.forEach(pushVisibleUser);
|
||||||
}
|
}
|
||||||
const autocomplete = ref(null);
|
|
||||||
const draghover = ref(false);
|
const draghover = ref(false);
|
||||||
const quoteId = ref(null);
|
const quoteId = ref(null);
|
||||||
const hasNotSpecifiedMentions = ref(false);
|
const hasNotSpecifiedMentions = ref(false);
|
||||||
@ -476,11 +475,11 @@ if (props.reply && props.reply.text != null) {
|
|||||||
? `@${x.username}`
|
? `@${x.username}`
|
||||||
: `@${x.username}@${toASCII(otherHost)}`;
|
: `@${x.username}@${toASCII(otherHost)}`;
|
||||||
|
|
||||||
// 自分は除外
|
// exclude me
|
||||||
if ($i.username === x.username && (x.host == null || x.host === host))
|
if ($i.username === x.username && (x.host == null || x.host === host))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// 重複は除外
|
// remove duplicates
|
||||||
if (text.value.includes(`${mention} `)) continue;
|
if (text.value.includes(`${mention} `)) continue;
|
||||||
|
|
||||||
text.value += `${mention} `;
|
text.value += `${mention} `;
|
||||||
@ -489,10 +488,10 @@ if (props.reply && props.reply.text != null) {
|
|||||||
|
|
||||||
if (props.channel) {
|
if (props.channel) {
|
||||||
visibility.value = "public";
|
visibility.value = "public";
|
||||||
localOnly.value = true; // TODO: チャンネルが連合するようになった折には消す
|
localOnly.value = true; // TODO: Delete this once channels get federated
|
||||||
}
|
}
|
||||||
|
|
||||||
// 公開以外へのリプライ時は元の公開範囲を引き継ぐ
|
// Inherit the original visibility
|
||||||
if (
|
if (
|
||||||
props.reply &&
|
props.reply &&
|
||||||
["home", "followers", "specified"].includes(props.reply.visibility)
|
["home", "followers", "specified"].includes(props.reply.visibility)
|
||||||
@ -611,10 +610,6 @@ function togglePoll() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addTag(tag: string) {
|
|
||||||
insertTextAtCursor(textareaEl.value, ` #${tag} `);
|
|
||||||
}
|
|
||||||
|
|
||||||
function focus() {
|
function focus() {
|
||||||
if (textareaEl.value) {
|
if (textareaEl.value) {
|
||||||
textareaEl.value.focus();
|
textareaEl.value.focus();
|
||||||
@ -718,6 +713,8 @@ function clear() {
|
|||||||
quoteId.value = null;
|
quoteId.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: ev.which is deprecated
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/which
|
||||||
function onKeydown(ev: KeyboardEvent) {
|
function onKeydown(ev: KeyboardEvent) {
|
||||||
if (
|
if (
|
||||||
(ev.which === 10 || ev.which === 13) &&
|
(ev.which === 10 || ev.which === 13) &&
|
||||||
@ -754,7 +751,7 @@ async function onPaste(ev: ClipboardEvent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const paste = ev.clipboardData.getData("text");
|
const paste = ev.clipboardData?.getData("text") ?? "";
|
||||||
|
|
||||||
if (!props.renote && !quoteId.value && paste.startsWith(url + "/notes/")) {
|
if (!props.renote && !quoteId.value && paste.startsWith(url + "/notes/")) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
@ -769,7 +766,7 @@ async function onPaste(ev: ClipboardEvent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
quoteId.value = paste
|
quoteId.value = paste
|
||||||
.substr(url.length)
|
.substring(url.length)
|
||||||
.match(/^\/notes\/(.+?)\/?$/)[1];
|
.match(/^\/notes\/(.+?)\/?$/)[1];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user