fix(frontend): リンク動作のオーバーライドが動作していないのを修正
This commit is contained in:
parent
3b0b4f83dd
commit
ea2675eaab
|
@ -38,8 +38,6 @@ const props = defineProps<{
|
||||||
host?: string | null;
|
host?: string | null;
|
||||||
url?: string;
|
url?: string;
|
||||||
useOriginalSize?: boolean;
|
useOriginalSize?: boolean;
|
||||||
menu?: boolean;
|
|
||||||
menuReaction?: boolean;
|
|
||||||
fallbackToImage?: boolean;
|
fallbackToImage?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
import { VNode, h, SetupContext, provide } from 'vue';
|
import { VNode, h, SetupContext, provide } from 'vue';
|
||||||
import * as mfm from 'mfm-js';
|
import * as mfm from 'mfm-js';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
|
import { host } from '@@/js/config.js';
|
||||||
import EmUrl from '@/components/EmUrl.vue';
|
import EmUrl from '@/components/EmUrl.vue';
|
||||||
import EmTime from '@/components/EmTime.vue';
|
import EmTime from '@/components/EmTime.vue';
|
||||||
import EmLink from '@/components/EmLink.vue';
|
import EmLink from '@/components/EmLink.vue';
|
||||||
|
@ -13,7 +14,6 @@ import EmMention from '@/components/EmMention.vue';
|
||||||
import EmEmoji from '@/components/EmEmoji.vue';
|
import EmEmoji from '@/components/EmEmoji.vue';
|
||||||
import EmCustomEmoji from '@/components/EmCustomEmoji.vue';
|
import EmCustomEmoji from '@/components/EmCustomEmoji.vue';
|
||||||
import EmA from '@/components/EmA.vue';
|
import EmA from '@/components/EmA.vue';
|
||||||
import { host } from '@@/js/config.js';
|
|
||||||
|
|
||||||
function safeParseFloat(str: unknown): number | null {
|
function safeParseFloat(str: unknown): number | null {
|
||||||
if (typeof str !== 'string' || str === '') return null;
|
if (typeof str !== 'string' || str === '') return null;
|
||||||
|
@ -41,9 +41,6 @@ type MfmProps = {
|
||||||
rootScale?: number;
|
rootScale?: number;
|
||||||
nyaize?: boolean | 'respect';
|
nyaize?: boolean | 'respect';
|
||||||
parsedNodes?: mfm.MfmNode[] | null;
|
parsedNodes?: mfm.MfmNode[] | null;
|
||||||
enableEmojiMenu?: boolean;
|
|
||||||
enableEmojiMenuReaction?: boolean;
|
|
||||||
linkNavigationBehavior?: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type MfmEvents = {
|
type MfmEvents = {
|
||||||
|
@ -52,8 +49,6 @@ type MfmEvents = {
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEvents>['emit'] }) {
|
export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEvents>['emit'] }) {
|
||||||
provide('linkNavigationBehavior', props.linkNavigationBehavior);
|
|
||||||
|
|
||||||
const isNote = props.isNote ?? true;
|
const isNote = props.isNote ?? true;
|
||||||
const shouldNyaize = props.nyaize ? props.nyaize === 'respect' ? props.author?.isCat : false : false;
|
const shouldNyaize = props.nyaize ? props.nyaize === 'respect' ? props.author?.isCat : false : false;
|
||||||
|
|
||||||
|
@ -397,8 +392,6 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
||||||
normal: props.plain,
|
normal: props.plain,
|
||||||
host: null,
|
host: null,
|
||||||
useOriginalSize: scale >= 2.5,
|
useOriginalSize: scale >= 2.5,
|
||||||
menu: props.enableEmojiMenu,
|
|
||||||
menuReaction: props.enableEmojiMenuReaction,
|
|
||||||
fallbackToImage: false,
|
fallbackToImage: false,
|
||||||
})];
|
})];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
import { VNode, h, SetupContext, provide } from 'vue';
|
import { VNode, h, SetupContext, provide } from 'vue';
|
||||||
import * as mfm from 'mfm-js';
|
import * as mfm from 'mfm-js';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
|
import { host } from '@@/js/config.js';
|
||||||
import MkUrl from '@/components/global/MkUrl.vue';
|
import MkUrl from '@/components/global/MkUrl.vue';
|
||||||
import MkTime from '@/components/global/MkTime.vue';
|
import MkTime from '@/components/global/MkTime.vue';
|
||||||
import MkLink from '@/components/MkLink.vue';
|
import MkLink from '@/components/MkLink.vue';
|
||||||
|
@ -17,7 +18,6 @@ import MkCodeInline from '@/components/MkCodeInline.vue';
|
||||||
import MkGoogle from '@/components/MkGoogle.vue';
|
import MkGoogle from '@/components/MkGoogle.vue';
|
||||||
import MkSparkle from '@/components/MkSparkle.vue';
|
import MkSparkle from '@/components/MkSparkle.vue';
|
||||||
import MkA, { MkABehavior } from '@/components/global/MkA.vue';
|
import MkA, { MkABehavior } from '@/components/global/MkA.vue';
|
||||||
import { host } from '@@/js/config.js';
|
|
||||||
import { defaultStore } from '@/store.js';
|
import { defaultStore } from '@/store.js';
|
||||||
|
|
||||||
function safeParseFloat(str: unknown): number | null {
|
function safeParseFloat(str: unknown): number | null {
|
||||||
|
@ -57,7 +57,8 @@ type MfmEvents = {
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEvents>['emit'] }) {
|
export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEvents>['emit'] }) {
|
||||||
provide('linkNavigationBehavior', props.linkNavigationBehavior);
|
// こうしたいところだけど functional component 内では provide は使えない
|
||||||
|
//provide('linkNavigationBehavior', props.linkNavigationBehavior);
|
||||||
|
|
||||||
const isNote = props.isNote ?? true;
|
const isNote = props.isNote ?? true;
|
||||||
const shouldNyaize = props.nyaize ? props.nyaize === 'respect' ? props.author?.isCat : false : false;
|
const shouldNyaize = props.nyaize ? props.nyaize === 'respect' ? props.author?.isCat : false : false;
|
||||||
|
@ -350,6 +351,7 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
||||||
key: Math.random(),
|
key: Math.random(),
|
||||||
url: token.props.url,
|
url: token.props.url,
|
||||||
rel: 'nofollow noopener',
|
rel: 'nofollow noopener',
|
||||||
|
navigationBehavior: props.linkNavigationBehavior,
|
||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,6 +360,7 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
||||||
key: Math.random(),
|
key: Math.random(),
|
||||||
url: token.props.url,
|
url: token.props.url,
|
||||||
rel: 'nofollow noopener',
|
rel: 'nofollow noopener',
|
||||||
|
navigationBehavior: props.linkNavigationBehavior,
|
||||||
}, genEl(token.children, scale, true))];
|
}, genEl(token.children, scale, true))];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,6 +369,7 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
||||||
key: Math.random(),
|
key: Math.random(),
|
||||||
host: (token.props.host == null && props.author && props.author.host != null ? props.author.host : token.props.host) ?? host,
|
host: (token.props.host == null && props.author && props.author.host != null ? props.author.host : token.props.host) ?? host,
|
||||||
username: token.props.username,
|
username: token.props.username,
|
||||||
|
navigationBehavior: props.linkNavigationBehavior,
|
||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,6 +378,7 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
||||||
key: Math.random(),
|
key: Math.random(),
|
||||||
to: isNote ? `/tags/${encodeURIComponent(token.props.hashtag)}` : `/user-tags/${encodeURIComponent(token.props.hashtag)}`,
|
to: isNote ? `/tags/${encodeURIComponent(token.props.hashtag)}` : `/user-tags/${encodeURIComponent(token.props.hashtag)}`,
|
||||||
style: 'color:var(--hashtag);',
|
style: 'color:var(--hashtag);',
|
||||||
|
behavior: props.linkNavigationBehavior,
|
||||||
}, `#${token.props.hashtag}`)];
|
}, `#${token.props.hashtag}`)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue