enhance(frontend): 外部サイトへのリンクは移動の前に警告を表示するように (MisskeyIO#558)
This commit is contained in:
parent
722f01c4e7
commit
01ec286f3f
15 changed files with 141 additions and 7 deletions
|
@ -5,8 +5,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<template>
|
||||
<component
|
||||
:is="self ? 'MkA' : 'a'" ref="el" style="word-break: break-all;" class="_link" :[attr]="self ? url.substring(local.length) : url" :rel="rel ?? 'nofollow noopener'" :target="target"
|
||||
:is="self ? 'MkA' : 'a'"
|
||||
ref="el"
|
||||
style="word-break: break-all;"
|
||||
class="_link"
|
||||
:[attr]="self ? url.substring(local.length) : url"
|
||||
:rel="rel ?? 'nofollow noopener'"
|
||||
:target="target"
|
||||
:title="url"
|
||||
@click="(ev: MouseEvent) => warningExternalWebsite(ev, url)"
|
||||
>
|
||||
<slot></slot>
|
||||
<i v-if="target === '_blank'" class="ti ti-external-link" :class="$style.icon"></i>
|
||||
|
@ -17,6 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
import { defineAsyncComponent, ref } from 'vue';
|
||||
import { url as local } from '@/config.js';
|
||||
import { useTooltip } from '@/scripts/use-tooltip.js';
|
||||
import { warningExternalWebsite } from '@/scripts/warning-external-website.js';
|
||||
import * as os from '@/os.js';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
|
|
|
@ -5,7 +5,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<template>
|
||||
<component
|
||||
:is="self ? 'MkA' : 'a'" ref="el" :class="$style.root" class="_link" :[attr]="self ? props.url.substring(local.length) : props.url" :rel="rel ?? 'nofollow noopener'" :target="target"
|
||||
:is="self ? 'MkA' : 'a'"
|
||||
ref="el"
|
||||
:class="$style.root"
|
||||
class="_link"
|
||||
:[attr]="self ? props.url.substring(local.length) : props.url"
|
||||
:rel="rel ?? 'nofollow noopener'"
|
||||
:target="target"
|
||||
@click="(ev: MouseEvent) => warningExternalWebsite(ev, props.url)"
|
||||
@contextmenu.stop="() => {}"
|
||||
>
|
||||
<template v-if="!self">
|
||||
|
@ -30,6 +37,7 @@ import { url as local } from '@/config.js';
|
|||
import * as os from '@/os.js';
|
||||
import { useTooltip } from '@/scripts/use-tooltip.js';
|
||||
import { safeURIDecode } from '@/scripts/safe-uri-decode.js';
|
||||
import { warningExternalWebsite } from '@/scripts/warning-external-website.js';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
url: string;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue