Merge remote-tracking branch 'misskey-dev/develop' into io

This commit is contained in:
まっちゃとーにゅ 2024-05-09 00:21:37 +09:00
commit f2743a09e2
No known key found for this signature in database
GPG key ID: 143DE582A97FE052
23 changed files with 1001 additions and 1106 deletions

View file

@ -20,7 +20,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<div class="detail">
<div>
<Mfm :text="report.comment" :linkBehavior="'window'"/>
<Mfm :text="report.comment" :linkNavigationBehavior="'window'"/>
</div>
<hr/>
<div>{{ i18n.ts.reporter }}: <MkA :to="`/admin/user/${report.reporter.id}`" class="_link" :behavior="'window'">@{{ report.reporter.username }}</MkA></div>

View file

@ -44,6 +44,8 @@ SPDX-License-Identifier: AGPL-3.0-only
:instant="true"
:initialText="c.form?.text"
:initialCw="c.form?.cw"
:initialVisibility="c.form?.visibility"
:initialLocalOnly="c.form?.localOnly"
/>
</div>
<MkFolder v-else-if="c.type === 'folder'" :defaultOpen="c.opened">
@ -111,6 +113,8 @@ function openPostForm() {
os.post({
initialText: form.text,
initialCw: form.cw,
initialVisibility: form.visibility,
initialLocalOnly: form.localOnly,
instant: true,
});
}

View file

@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:[attr]="self ? url.substring(local.length) : url"
:rel="rel ?? 'nofollow noopener'"
:target="target"
:behavior="props.behavior"
:behavior="props.navigationBehavior"
:title="url"
@click="(ev: MouseEvent) => warningExternalWebsite(ev, url)"
>
@ -33,7 +33,7 @@ import { MkABehavior } from '@/components/global/MkA.vue';
const props = withDefaults(defineProps<{
url: string;
rel?: null | string;
behavior?: MkABehavior;
navigationBehavior?: MkABehavior;
}>(), {
});

View file

@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<MkA v-user-preview="canonical" :class="[$style.root, { [$style.isMe]: isMe }]" :to="url" :style="{ background: bgCss }" :behavior="behavior">
<MkA v-user-preview="canonical" :class="[$style.root, { [$style.isMe]: isMe }]" :to="url" :style="{ background: bgCss }" :behavior="navigationBehavior">
<img :class="$style.icon" :src="avatarUrl" alt="">
<span>
<span>@{{ username }}</span>
@ -26,7 +26,7 @@ import { MkABehavior } from '@/components/global/MkA.vue';
const props = defineProps<{
username: string;
host: string;
behavior?: MkABehavior;
navigationBehavior?: MkABehavior;
}>();
const canonical = props.host === localHost ? `@${props.username}` : `@${props.username}@${toUnicode(props.host)}`;

View file

@ -14,7 +14,7 @@ export type MkABehavior = 'window' | 'browser' | null;
</script>
<script lang="ts" setup>
import { computed, shallowRef } from 'vue';
import { computed, inject, shallowRef } from 'vue';
import * as os from '@/os.js';
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
import { url } from '@/config.js';
@ -30,7 +30,7 @@ const props = withDefaults(defineProps<{
behavior: null,
});
const linkBehaviour = props.behavior;
const behavior = props.behavior ?? inject<MkABehavior>('linkNavigationBehavior', null);
const el = shallowRef<HTMLElement>();
@ -86,15 +86,13 @@ function openWindow() {
}
function nav(ev: MouseEvent) {
if (props.behavior === 'browser') {
if (behavior === 'browser') {
location.href = props.to;
return;
}
if (props.behavior) {
if (props.behavior === 'window') {
return openWindow();
}
if (behavior === 'window') {
return openWindow();
}
if (ev.shiftKey) {

View file

@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { VNode, h, SetupContext } from 'vue';
import { VNode, h, SetupContext, provide } from 'vue';
import * as mfm from 'mfm-js';
import * as Misskey from 'misskey-js';
import MkUrl from '@/components/global/MkUrl.vue';
@ -43,7 +43,7 @@ type MfmProps = {
parsedNodes?: mfm.MfmNode[] | null;
enableEmojiMenu?: boolean;
enableEmojiMenuReaction?: boolean;
linkBehavior?: MkABehavior;
linkNavigationBehavior?: MkABehavior;
};
type MfmEvents = {
@ -52,6 +52,8 @@ type MfmEvents = {
// eslint-disable-next-line import/no-default-export
export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEvents>['emit'] }) {
provide('linkNavigationBehavior', props.linkNavigationBehavior);
const isNote = props.isNote ?? true;
const shouldNyaize = props.nyaize ? props.nyaize === 'respect' ? props.author?.isCat : false : false;
@ -343,7 +345,6 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
key: Math.random(),
url: token.props.url,
rel: 'nofollow noopener',
behavior: props.linkBehavior,
})];
}
@ -352,7 +353,6 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
key: Math.random(),
url: token.props.url,
rel: 'nofollow noopener',
behavior: props.linkBehavior,
}, genEl(token.children, scale, true))];
}
@ -361,7 +361,6 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
key: Math.random(),
host: (token.props.host == null && props.author?.host ? props.author.host : token.props.host) ?? host,
username: token.props.username,
behavior: props.linkBehavior,
})];
}
@ -370,7 +369,6 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
key: Math.random(),
to: isNote ? `/tags/${encodeURIComponent(token.props.hashtag)}` : `/user-tags/${encodeURIComponent(token.props.hashtag)}`,
style: 'color:var(--hashtag);',
behavior: props.linkBehavior,
}, `#${token.props.hashtag}`)];
}

View file

@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:[attr]="self ? props.url.substring(local.length) : props.url"
:rel="rel ?? 'nofollow noopener'"
:target="target"
:behavior = "props.behavior"
:behavior="props.navigationBehavior"
@click="(ev: MouseEvent) => warningExternalWebsite(ev, props.url)"
@contextmenu.stop="() => {}"
>
@ -46,7 +46,7 @@ const props = withDefaults(defineProps<{
url: string;
rel?: string;
showUrlPreview?: boolean;
behavior?: MkABehavior;
navigationBehavior?: MkABehavior;
}>(), {
showUrlPreview: true,
});