@ncds/ui-admin 1.8.25 → 1.8.26-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/assets/scripts/notification/FullWidthNotification.js +2 -0
- package/dist/cjs/assets/scripts/notification/MessageNotification.js +30 -23
- package/dist/cjs/assets/scripts/notification/const/classNames.js +3 -0
- package/dist/cjs/assets/scripts/notification/const/icons.js +11 -2
- package/dist/cjs/assets/scripts/notification/const/index.js +9 -4
- package/dist/cjs/assets/scripts/notification/const/sizes.js +6 -1
- package/dist/cjs/assets/scripts/notification/const/types.js +1 -10
- package/dist/cjs/assets/scripts/notification/messageTemplate.js +20 -8
- package/dist/cjs/assets/scripts/notification/utils.js +21 -17
- package/dist/cjs/constant/notification.js +15 -1
- package/dist/cjs/src/components/feedback-and-status/badge/Badge.js +1 -1
- package/dist/cjs/src/components/overlays/notification/FloatingNotification.js +4 -7
- package/dist/cjs/src/components/overlays/notification/FullWidthNotification.js +13 -8
- package/dist/cjs/src/components/overlays/notification/MessageNotification.js +20 -14
- package/dist/cjs/src/components/overlays/notification/MessageNotificationParts.js +22 -15
- package/dist/cjs/src/components/overlays/notification/Notification.js +6 -0
- package/dist/cjs/src/components/overlays/notification/NotificationActionButtons.js +27 -0
- package/dist/cjs/src/components/overlays/notification/__tests__/supportTextLink.test.js +58 -0
- package/dist/cjs/src/components/overlays/notification/linkTarget.js +18 -0
- package/dist/cjs/src/generated/scoped-css.js +1 -1
- package/dist/cjs/src/utils/index.js +11 -0
- package/dist/cjs/src/utils/url/__tests__/isSafeUrl.test.js +49 -0
- package/dist/cjs/src/utils/url/index.js +16 -0
- package/dist/cjs/src/utils/url/isSafeUrl.js +32 -0
- package/dist/esm/assets/scripts/notification/FullWidthNotification.js +3 -1
- package/dist/esm/assets/scripts/notification/MessageNotification.js +32 -25
- package/dist/esm/assets/scripts/notification/const/classNames.js +3 -0
- package/dist/esm/assets/scripts/notification/const/icons.js +10 -1
- package/dist/esm/assets/scripts/notification/const/index.js +2 -3
- package/dist/esm/assets/scripts/notification/const/sizes.js +5 -0
- package/dist/esm/assets/scripts/notification/const/types.js +1 -8
- package/dist/esm/assets/scripts/notification/messageTemplate.js +21 -9
- package/dist/esm/assets/scripts/notification/utils.js +19 -16
- package/dist/esm/constant/notification.js +14 -0
- package/dist/esm/src/components/feedback-and-status/badge/Badge.js +1 -1
- package/dist/esm/src/components/overlays/notification/FloatingNotification.js +4 -7
- package/dist/esm/src/components/overlays/notification/FullWidthNotification.js +13 -8
- package/dist/esm/src/components/overlays/notification/MessageNotification.js +21 -15
- package/dist/esm/src/components/overlays/notification/MessageNotificationParts.js +22 -15
- package/dist/esm/src/components/overlays/notification/Notification.js +6 -0
- package/dist/esm/src/components/overlays/notification/NotificationActionButtons.js +21 -0
- package/dist/esm/src/components/overlays/notification/__tests__/supportTextLink.test.js +55 -0
- package/dist/esm/src/components/overlays/notification/linkTarget.js +12 -0
- package/dist/esm/src/generated/scoped-css.js +1 -1
- package/dist/esm/src/utils/index.js +3 -1
- package/dist/esm/src/utils/url/__tests__/isSafeUrl.test.js +47 -0
- package/dist/esm/src/utils/url/index.js +1 -0
- package/dist/esm/src/utils/url/isSafeUrl.js +26 -0
- package/dist/temp/assets/scripts/notification/FullWidthNotification.js +3 -2
- package/dist/temp/assets/scripts/notification/MessageNotification.d.ts +2 -0
- package/dist/temp/assets/scripts/notification/MessageNotification.js +30 -25
- package/dist/temp/assets/scripts/notification/const/classNames.d.ts +3 -0
- package/dist/temp/assets/scripts/notification/const/classNames.js +3 -0
- package/dist/temp/assets/scripts/notification/const/icons.d.ts +6 -0
- package/dist/temp/assets/scripts/notification/const/icons.js +9 -0
- package/dist/temp/assets/scripts/notification/const/index.d.ts +3 -4
- package/dist/temp/assets/scripts/notification/const/index.js +2 -3
- package/dist/temp/assets/scripts/notification/const/sizes.d.ts +4 -0
- package/dist/temp/assets/scripts/notification/const/sizes.js +5 -0
- package/dist/temp/assets/scripts/notification/const/types.d.ts +28 -1
- package/dist/temp/assets/scripts/notification/const/types.js +1 -8
- package/dist/temp/assets/scripts/notification/messageTemplate.d.ts +5 -1
- package/dist/temp/assets/scripts/notification/messageTemplate.js +16 -11
- package/dist/temp/assets/scripts/notification/utils.d.ts +10 -3
- package/dist/temp/assets/scripts/notification/utils.js +21 -18
- package/dist/temp/constant/notification.d.ts +13 -0
- package/dist/temp/constant/notification.js +14 -0
- package/dist/temp/src/components/feedback-and-status/badge/Badge.d.ts +1 -1
- package/dist/temp/src/components/feedback-and-status/badge/Badge.js +1 -1
- package/dist/temp/src/components/overlays/notification/FloatingNotification.js +2 -2
- package/dist/temp/src/components/overlays/notification/FullWidthNotification.d.ts +6 -1
- package/dist/temp/src/components/overlays/notification/FullWidthNotification.js +7 -2
- package/dist/temp/src/components/overlays/notification/MessageNotification.d.ts +15 -1
- package/dist/temp/src/components/overlays/notification/MessageNotification.js +11 -12
- package/dist/temp/src/components/overlays/notification/MessageNotificationParts.d.ts +10 -5
- package/dist/temp/src/components/overlays/notification/MessageNotificationParts.js +9 -6
- package/dist/temp/src/components/overlays/notification/Notification.d.ts +23 -2
- package/dist/temp/src/components/overlays/notification/Notification.js +3 -3
- package/dist/temp/src/components/overlays/notification/NotificationActionButtons.d.ts +12 -0
- package/dist/temp/src/components/overlays/notification/NotificationActionButtons.js +9 -0
- package/dist/temp/src/components/overlays/notification/__tests__/supportTextLink.test.d.ts +1 -0
- package/dist/temp/src/components/overlays/notification/__tests__/supportTextLink.test.js +73 -0
- package/dist/temp/src/components/overlays/notification/linkTarget.d.ts +11 -0
- package/dist/temp/src/components/overlays/notification/linkTarget.js +9 -0
- package/dist/temp/src/generated/scoped-css.js +1 -1
- package/dist/temp/src/utils/index.d.ts +1 -0
- package/dist/temp/src/utils/index.js +2 -0
- package/dist/temp/src/utils/url/__tests__/isSafeUrl.test.d.ts +1 -0
- package/dist/temp/src/utils/url/__tests__/isSafeUrl.test.js +61 -0
- package/dist/temp/src/utils/url/index.d.ts +1 -0
- package/dist/temp/src/utils/url/index.js +1 -0
- package/dist/temp/src/utils/url/isSafeUrl.d.ts +8 -0
- package/dist/temp/src/utils/url/isSafeUrl.js +29 -0
- package/dist/types/assets/scripts/notification/MessageNotification.d.ts +2 -0
- package/dist/types/assets/scripts/notification/const/classNames.d.ts +3 -0
- package/dist/types/assets/scripts/notification/const/icons.d.ts +6 -0
- package/dist/types/assets/scripts/notification/const/index.d.ts +3 -4
- package/dist/types/assets/scripts/notification/const/sizes.d.ts +4 -0
- package/dist/types/assets/scripts/notification/const/types.d.ts +28 -1
- package/dist/types/assets/scripts/notification/messageTemplate.d.ts +5 -1
- package/dist/types/assets/scripts/notification/utils.d.ts +10 -3
- package/dist/types/constant/notification.d.ts +13 -0
- package/dist/types/src/components/feedback-and-status/badge/Badge.d.ts +1 -1
- package/dist/types/src/components/overlays/notification/FullWidthNotification.d.ts +6 -1
- package/dist/types/src/components/overlays/notification/MessageNotification.d.ts +15 -1
- package/dist/types/src/components/overlays/notification/MessageNotificationParts.d.ts +10 -5
- package/dist/types/src/components/overlays/notification/Notification.d.ts +23 -2
- package/dist/types/src/components/overlays/notification/NotificationActionButtons.d.ts +12 -0
- package/dist/types/src/components/overlays/notification/__tests__/supportTextLink.test.d.ts +1 -0
- package/dist/types/src/components/overlays/notification/linkTarget.d.ts +11 -0
- package/dist/types/src/utils/index.d.ts +1 -0
- package/dist/types/src/utils/url/__tests__/isSafeUrl.test.d.ts +1 -0
- package/dist/types/src/utils/url/index.d.ts +1 -0
- package/dist/types/src/utils/url/isSafeUrl.d.ts +8 -0
- package/dist/ui-admin/assets/styles/style.css +54 -34
- package/package.json +1 -1
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AlertCircle, AlertTriangle, CheckCircle, Pin02 } from '@ncds/ui-admin-icon';
|
|
2
|
+
import { AlertCircle, AlertTriangle, CheckCircle, InfoCircle, Pin02 } from '@ncds/ui-admin-icon';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { MESSAGE_CLOSE_ICON_COLOR } from '../../../../constant/notification';
|
|
6
6
|
import { MessageNotificationActions, MessageNotificationContent } from './MessageNotificationParts';
|
|
7
7
|
const iconMap = {
|
|
8
8
|
neutral: Pin02,
|
|
9
9
|
error: AlertTriangle,
|
|
10
10
|
warning: AlertCircle,
|
|
11
|
-
success: CheckCircle
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
neutral: 'gray700',
|
|
15
|
-
error: 'red500',
|
|
16
|
-
warning: 'orange500',
|
|
17
|
-
success: 'green600'
|
|
11
|
+
success: CheckCircle,
|
|
12
|
+
// info 는 variant="block" 에서만 도달한다 (default 는 neutral 로 폴백).
|
|
13
|
+
info: InfoCircle
|
|
18
14
|
};
|
|
19
15
|
const MessageNotification = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
20
16
|
let {
|
|
@@ -27,13 +23,21 @@ const MessageNotification = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
27
23
|
actions,
|
|
28
24
|
onHidePermanently,
|
|
29
25
|
hidePermanentlyLabel,
|
|
26
|
+
variant = 'default',
|
|
27
|
+
supportTextLink,
|
|
28
|
+
supportTextLinkTarget,
|
|
30
29
|
...rest
|
|
31
30
|
} = _ref;
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const isBlock = variant === 'block';
|
|
32
|
+
// default 는 neutral, error, warning, success 4가지 색상만 지원 — info 는 block 에서만 유지한다.
|
|
33
|
+
const validColor = !isBlock && color === 'info' ? 'neutral' : color;
|
|
34
|
+
// FeaturedIcon 에는 info 색이 없다. block+info 의 violet 톤은 message SCSS 가 덮어쓴다.
|
|
35
|
+
const featuredIconColor = validColor === 'info' ? 'neutral' : validColor;
|
|
34
36
|
return _jsx("div", {
|
|
35
37
|
ref: ref,
|
|
36
|
-
className: classNames('ncua-message-notification', `ncua-message-notification--${validColor}`,
|
|
38
|
+
className: classNames('ncua-message-notification', `ncua-message-notification--${validColor}`, {
|
|
39
|
+
'ncua-message-notification--block': isBlock
|
|
40
|
+
}, className),
|
|
37
41
|
role: "alert",
|
|
38
42
|
...rest,
|
|
39
43
|
children: _jsx("div", {
|
|
@@ -43,15 +47,17 @@ const MessageNotification = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
43
47
|
children: [_jsx(MessageNotificationContent, {
|
|
44
48
|
title: title,
|
|
45
49
|
supportingText: supportingText,
|
|
50
|
+
supportTextLink: isBlock ? supportTextLink : undefined,
|
|
51
|
+
supportTextLinkTarget: supportTextLinkTarget,
|
|
46
52
|
icon: Icon || iconMap[validColor],
|
|
47
|
-
iconColor:
|
|
48
|
-
|
|
53
|
+
iconColor: featuredIconColor,
|
|
54
|
+
iconSize: isBlock ? 'sm' : 'md'
|
|
49
55
|
}), _jsx(MessageNotificationActions, {
|
|
50
56
|
actions: actions,
|
|
51
57
|
onClose: onClose,
|
|
52
58
|
onHidePermanently: onHidePermanently,
|
|
53
59
|
hidePermanentlyLabel: hidePermanentlyLabel,
|
|
54
|
-
closeIconColor:
|
|
60
|
+
closeIconColor: MESSAGE_CLOSE_ICON_COLOR[validColor]
|
|
55
61
|
})]
|
|
56
62
|
})
|
|
57
63
|
})
|
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Pin02, XClose } from '@ncds/ui-admin-icon';
|
|
3
3
|
import { HIDE_PERMANENTLY_LABEL } from '../../../../constant/notification';
|
|
4
|
-
import {
|
|
4
|
+
import { isSafeUrl } from '../../../utils/url';
|
|
5
5
|
import { FeaturedIcon } from '../../image-and-icons/featured-icon/FeaturedIcon';
|
|
6
|
-
|
|
6
|
+
import { getLinkTargetAttributes } from './linkTarget';
|
|
7
|
+
import { NotificationActionButtons } from './NotificationActionButtons';
|
|
8
|
+
/** 아이콘 + 제목/서포팅 텍스트(또는 텍스트 링크) 영역. */
|
|
7
9
|
const MessageNotificationContent = _ref => {
|
|
8
10
|
let {
|
|
9
11
|
title,
|
|
10
12
|
supportingText,
|
|
13
|
+
supportTextLink,
|
|
14
|
+
supportTextLinkTarget,
|
|
11
15
|
icon,
|
|
12
16
|
iconColor,
|
|
13
|
-
|
|
17
|
+
iconSize
|
|
14
18
|
} = _ref;
|
|
15
19
|
const featuredIconProps = {
|
|
16
20
|
icon: icon || Pin02,
|
|
17
|
-
size:
|
|
21
|
+
size: iconSize,
|
|
18
22
|
color: iconColor,
|
|
19
23
|
theme: 'light-circle'
|
|
20
24
|
};
|
|
25
|
+
const supportingTextNode = supportingText && _jsx("span", {
|
|
26
|
+
className: "ncua-message-notification__supporting-text",
|
|
27
|
+
children: supportingText
|
|
28
|
+
});
|
|
21
29
|
return _jsxs("div", {
|
|
22
30
|
className: "ncua-message-notification__content-wrapper",
|
|
23
|
-
children: [
|
|
31
|
+
children: [_jsx(FeaturedIcon, {
|
|
24
32
|
...featuredIconProps,
|
|
25
33
|
className: "ncua-message-notification__icon"
|
|
26
34
|
}), _jsxs("div", {
|
|
@@ -28,10 +36,12 @@ const MessageNotificationContent = _ref => {
|
|
|
28
36
|
children: [_jsx("span", {
|
|
29
37
|
className: "ncua-message-notification__title",
|
|
30
38
|
children: title
|
|
31
|
-
}),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
}), supportTextLink && isSafeUrl(supportTextLink) && supportingTextNode ? _jsx("a", {
|
|
40
|
+
href: supportTextLink,
|
|
41
|
+
className: "ncua-message-notification__link",
|
|
42
|
+
...getLinkTargetAttributes(supportTextLinkTarget),
|
|
43
|
+
children: supportingTextNode
|
|
44
|
+
}) : supportingTextNode]
|
|
35
45
|
})]
|
|
36
46
|
});
|
|
37
47
|
};
|
|
@@ -55,12 +65,9 @@ const MessageNotificationActions = _ref2 => {
|
|
|
55
65
|
className: "ncua-message-notification__actions-container",
|
|
56
66
|
children: [hasActions && _jsx("div", {
|
|
57
67
|
className: "ncua-message-notification__actions",
|
|
58
|
-
children:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
label: action.label,
|
|
62
|
-
onClick: action?.onClick
|
|
63
|
-
}, `${action.label}-${action.hierarchy}`))
|
|
68
|
+
children: _jsx(NotificationActionButtons, {
|
|
69
|
+
actions: actions ?? []
|
|
70
|
+
})
|
|
64
71
|
}), hasFooter && _jsxs("div", {
|
|
65
72
|
className: "ncua-message-notification__footer-container",
|
|
66
73
|
children: [onHidePermanently && _jsx("button", {
|
|
@@ -13,6 +13,8 @@ const Notification = /*#__PURE__*/forwardRef(
|
|
|
13
13
|
color = 'neutral',
|
|
14
14
|
width,
|
|
15
15
|
supportTextLink,
|
|
16
|
+
supportTextLinkTarget,
|
|
17
|
+
variant,
|
|
16
18
|
...rest
|
|
17
19
|
} = _ref;
|
|
18
20
|
if (type === 'floating') {
|
|
@@ -26,6 +28,7 @@ const Notification = /*#__PURE__*/forwardRef(
|
|
|
26
28
|
return _jsx(FullWidthNotification, {
|
|
27
29
|
color: color,
|
|
28
30
|
supportTextLink: supportTextLink,
|
|
31
|
+
supportTextLinkTarget: supportTextLinkTarget,
|
|
29
32
|
...rest,
|
|
30
33
|
ref: ref
|
|
31
34
|
});
|
|
@@ -33,6 +36,9 @@ const Notification = /*#__PURE__*/forwardRef(
|
|
|
33
36
|
if (type === 'message') {
|
|
34
37
|
return _jsx(MessageNotification, {
|
|
35
38
|
color: color,
|
|
39
|
+
variant: variant,
|
|
40
|
+
supportTextLink: supportTextLink,
|
|
41
|
+
supportTextLinkTarget: supportTextLinkTarget,
|
|
36
42
|
...rest,
|
|
37
43
|
ref: ref
|
|
38
44
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from '../../action/button';
|
|
3
|
+
/**
|
|
4
|
+
* 알림 액션 버튼 목록. 모든 type 이 같은 규격(`ncua-btn--xs` + hierarchy, 기본 `text`)을 쓴다(#535).
|
|
5
|
+
* Vanilla `renderActions`(assets/scripts/notification/utils.ts)와 같은 클래스를 산출해야 한다.
|
|
6
|
+
* 감싸는 래퍼(`__actions`)는 type 마다 클래스가 달라 호출부가 담당한다.
|
|
7
|
+
*/
|
|
8
|
+
const NotificationActionButtons = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
actions
|
|
11
|
+
} = _ref;
|
|
12
|
+
return _jsx(_Fragment, {
|
|
13
|
+
children: actions.map(action => _jsx(Button, {
|
|
14
|
+
size: "xs",
|
|
15
|
+
hierarchy: action.hierarchy || 'text',
|
|
16
|
+
label: action.label,
|
|
17
|
+
onClick: action.onClick
|
|
18
|
+
}, `${action.label}-${action.hierarchy}`))
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
export { NotificationActionButtons };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { createElement } from 'react';
|
|
3
|
+
import { createRoot } from 'react-dom/client';
|
|
4
|
+
import { act } from 'react-dom/test-utils';
|
|
5
|
+
import { afterEach, describe, expect, it } from 'vitest';
|
|
6
|
+
import { FullWidthNotification } from '../FullWidthNotification';
|
|
7
|
+
import { MessageNotification } from '../MessageNotification';
|
|
8
|
+
/**
|
|
9
|
+
* React 텍스트 링크(`supportTextLink`)의 프로토콜 검사 (#538 리뷰 H2).
|
|
10
|
+
* Vanilla `renderSupportingText` 와 같은 정책 — unsafe URL 이면 링크 없이 텍스트만 렌더한다.
|
|
11
|
+
*/
|
|
12
|
+
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
|
|
13
|
+
const cleanups = [];
|
|
14
|
+
afterEach(() => {
|
|
15
|
+
for (const cleanup of cleanups.splice(0)) cleanup();
|
|
16
|
+
});
|
|
17
|
+
function mount(element) {
|
|
18
|
+
const container = document.createElement('div');
|
|
19
|
+
document.body.appendChild(container);
|
|
20
|
+
const root = createRoot(container);
|
|
21
|
+
act(() => {
|
|
22
|
+
root.render(element);
|
|
23
|
+
});
|
|
24
|
+
cleanups.push(() => {
|
|
25
|
+
act(() => root.unmount());
|
|
26
|
+
container.remove();
|
|
27
|
+
});
|
|
28
|
+
return container;
|
|
29
|
+
}
|
|
30
|
+
const IMPLEMENTATIONS = [['MessageNotification(block)', supportTextLink => mount(/*#__PURE__*/createElement(MessageNotification, {
|
|
31
|
+
title: '공지',
|
|
32
|
+
variant: 'block',
|
|
33
|
+
supportingText: '자세히 보기',
|
|
34
|
+
supportTextLink
|
|
35
|
+
})), '.ncua-message-notification__supporting-text'], ['FullWidthNotification', supportTextLink => mount(/*#__PURE__*/createElement(FullWidthNotification, {
|
|
36
|
+
title: '공지',
|
|
37
|
+
supportingText: '자세히 보기',
|
|
38
|
+
supportTextLink
|
|
39
|
+
})), '.ncua-full-width-notification__supporting-text']];
|
|
40
|
+
const UNSAFE = ['javascript:alert(1)', ' JavaScript:alert(1)', 'JAVASCRIPT:alert(1)', '\tjavascript:alert(1)', 'data:text/html,<script>alert(1)</script>'];
|
|
41
|
+
const SAFE = ['https://example.com/notice/1', 'http://example.com/notice/1', '/notice/1', 'notice/1'];
|
|
42
|
+
describe.each(IMPLEMENTATIONS)('%s — supportTextLink 프로토콜 검사', (_, render, supportingTextSelector) => {
|
|
43
|
+
it.each(UNSAFE)('unsafe %j → 링크 없이 텍스트만 렌더한다', url => {
|
|
44
|
+
const container = render(url);
|
|
45
|
+
expect(container.querySelector('a')).toBeNull();
|
|
46
|
+
expect(container.querySelector(supportingTextSelector)?.textContent).toBe('자세히 보기');
|
|
47
|
+
});
|
|
48
|
+
it.each(SAFE)('safe %j → 그대로 링크로 렌더한다', url => {
|
|
49
|
+
const container = render(url);
|
|
50
|
+
const anchors = container.querySelectorAll('a');
|
|
51
|
+
expect(anchors).toHaveLength(1);
|
|
52
|
+
expect(anchors[0].getAttribute('href')).toBe(url);
|
|
53
|
+
expect(anchors[0].querySelector(supportingTextSelector)?.textContent).toBe('자세히 보기');
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 텍스트 링크(`supportTextLink`)의 `<a>`에 붙일 target·rel 속성.
|
|
3
|
+
*
|
|
4
|
+
* `'_blank'`일 때만 새 탭 + `rel="noopener noreferrer"`를 반환하고, `'_self'`(기본)는 아무 속성도 붙이지 않는다.
|
|
5
|
+
* Vanilla `applySupportTextLinkTarget`과 같은 마크업을 산출해야 한다.
|
|
6
|
+
*/
|
|
7
|
+
export function getLinkTargetAttributes(target) {
|
|
8
|
+
return target === '_blank' ? {
|
|
9
|
+
target: '_blank',
|
|
10
|
+
rel: 'noopener noreferrer'
|
|
11
|
+
} : undefined;
|
|
12
|
+
}
|