@atlaskit/help-article 6.0.24 → 6.0.26
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/CHANGELOG.md +15 -0
- package/afm-cc/tsconfig.json +2 -1
- package/afm-jira/tsconfig.json +3 -2
- package/afm-products/tsconfig.json +2 -1
- package/dist/cjs/components/ArticleBody/index.js +38 -2
- package/dist/cjs/components/HelpArticle.js +2 -2
- package/dist/cjs/index.js +8 -1
- package/dist/es2019/components/ArticleBody/index.js +37 -1
- package/dist/es2019/components/HelpArticle.js +1 -1
- package/dist/es2019/index.js +2 -1
- package/dist/esm/components/ArticleBody/index.js +37 -1
- package/dist/esm/components/HelpArticle.js +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/types/components/ArticleBody/index.d.ts +6 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types-ts4.5/components/ArticleBody/index.d.ts +6 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/docs/0-intro.tsx +2 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/help-article
|
|
2
2
|
|
|
3
|
+
## 6.0.26
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6a82d7964a37b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6a82d7964a37b) -
|
|
8
|
+
Icon entrypoint migration
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 6.0.25
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`a7e68749821fe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a7e68749821fe) -
|
|
16
|
+
[ux] fix issue where link inside article was opening within an iframe
|
|
17
|
+
|
|
3
18
|
## 6.0.24
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"declaration": true,
|
|
5
5
|
"target": "es5",
|
|
6
|
-
"outDir": "../../../../../tsDist/@atlaskit__help-article/app",
|
|
6
|
+
"outDir": "../../../../../jira/tsDist/@atlaskit__help-article/app",
|
|
7
7
|
"rootDir": "../",
|
|
8
|
-
"composite": true
|
|
8
|
+
"composite": true,
|
|
9
|
+
"noCheck": true
|
|
9
10
|
},
|
|
10
11
|
"include": [
|
|
11
12
|
"../src/**/*.ts",
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = exports.ArticleBody = void 0;
|
|
8
|
+
exports.processLinksForNewTab = exports.default = exports.ArticleBody = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
11
11
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
@@ -18,6 +18,40 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
18
18
|
|
|
19
19
|
var IFRAME_CONTAINER_ID = 'help-iframe-container';
|
|
20
20
|
var IFRAME_ID = 'help-iframe';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Processes HTML content to ensure all links open in a new tab
|
|
24
|
+
* @param htmlContent - The HTML string to process
|
|
25
|
+
* @returns The processed HTML with target="_blank" added to all links
|
|
26
|
+
*/
|
|
27
|
+
var processLinksForNewTab = exports.processLinksForNewTab = function processLinksForNewTab(htmlContent) {
|
|
28
|
+
// Create a temporary DOM element to parse the HTML
|
|
29
|
+
var tempDiv = document.createElement('div');
|
|
30
|
+
tempDiv.innerHTML = htmlContent;
|
|
31
|
+
|
|
32
|
+
// Find all anchor tags
|
|
33
|
+
var links = tempDiv.querySelectorAll('a[href]');
|
|
34
|
+
|
|
35
|
+
// Process each link
|
|
36
|
+
links.forEach(function (link) {
|
|
37
|
+
// Add target="_blank" if no target is specified or if target is not already "_blank"
|
|
38
|
+
if (!link.hasAttribute('target') || link.getAttribute('target') !== '_blank') {
|
|
39
|
+
link.setAttribute('target', '_blank');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Always add security attributes for all external links
|
|
43
|
+
var existingRel = link.getAttribute('rel');
|
|
44
|
+
var relValues = existingRel ? existingRel.split(' ') : [];
|
|
45
|
+
if (!relValues.includes('noopener')) {
|
|
46
|
+
relValues.push('noopener');
|
|
47
|
+
}
|
|
48
|
+
if (!relValues.includes('noreferrer')) {
|
|
49
|
+
relValues.push('noreferrer');
|
|
50
|
+
}
|
|
51
|
+
link.setAttribute('rel', relValues.join(' '));
|
|
52
|
+
});
|
|
53
|
+
return tempDiv.innerHTML;
|
|
54
|
+
};
|
|
21
55
|
var ArticleBody = exports.ArticleBody = function ArticleBody(props) {
|
|
22
56
|
/**
|
|
23
57
|
* Set article height
|
|
@@ -96,7 +130,9 @@ var ArticleBody = exports.ArticleBody = function ArticleBody(props) {
|
|
|
96
130
|
if (newIframe !== null) {
|
|
97
131
|
var iframeDocument = newIframe.document;
|
|
98
132
|
iframeDocument.open();
|
|
99
|
-
|
|
133
|
+
// Process the HTML to ensure all links open in new tabs
|
|
134
|
+
var processedBody = processLinksForNewTab(body);
|
|
135
|
+
iframeDocument.write("<div>".concat(processedBody, "</div>"));
|
|
100
136
|
iframeDocument.close();
|
|
101
137
|
var head = iframeDocument.head || iframeDocument.getElementsByTagName('head')[0];
|
|
102
138
|
var style = iframeDocument.createElement('style');
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
|
|
10
10
|
var _heading = _interopRequireDefault(require("@atlaskit/heading"));
|
|
11
11
|
var _HelpArticle = require("../model/HelpArticle");
|
|
12
12
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
@@ -26,7 +26,7 @@ var HelpArticle = function HelpArticle(props) {
|
|
|
26
26
|
target: "_blank"
|
|
27
27
|
}, /*#__PURE__*/_react.default.createElement(_heading.default, {
|
|
28
28
|
size: "large"
|
|
29
|
-
}, title, /*#__PURE__*/_react.default.createElement(_compiled.Text, null, " "), /*#__PURE__*/_react.default.createElement(
|
|
29
|
+
}, title, /*#__PURE__*/_react.default.createElement(_compiled.Text, null, " "), /*#__PURE__*/_react.default.createElement(_linkExternal.default, {
|
|
30
30
|
color: "currentColor",
|
|
31
31
|
label: "link icon",
|
|
32
32
|
LEGACY_size: "small"
|
package/dist/cjs/index.js
CHANGED
|
@@ -16,5 +16,12 @@ Object.defineProperty(exports, "default", {
|
|
|
16
16
|
return _HelpArticle.default;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
+
Object.defineProperty(exports, "processLinksForNewTab", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function get() {
|
|
22
|
+
return _ArticleBody.processLinksForNewTab;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
19
25
|
var _HelpArticle = _interopRequireDefault(require("./components/HelpArticle"));
|
|
20
|
-
var _HelpArticle2 = require("./model/HelpArticle");
|
|
26
|
+
var _HelpArticle2 = require("./model/HelpArticle");
|
|
27
|
+
var _ArticleBody = require("./components/ArticleBody");
|
|
@@ -9,6 +9,40 @@ import resetCSS from './resetCss';
|
|
|
9
9
|
import { ArticleFrame } from './styled';
|
|
10
10
|
const IFRAME_CONTAINER_ID = 'help-iframe-container';
|
|
11
11
|
const IFRAME_ID = 'help-iframe';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Processes HTML content to ensure all links open in a new tab
|
|
15
|
+
* @param htmlContent - The HTML string to process
|
|
16
|
+
* @returns The processed HTML with target="_blank" added to all links
|
|
17
|
+
*/
|
|
18
|
+
export const processLinksForNewTab = htmlContent => {
|
|
19
|
+
// Create a temporary DOM element to parse the HTML
|
|
20
|
+
const tempDiv = document.createElement('div');
|
|
21
|
+
tempDiv.innerHTML = htmlContent;
|
|
22
|
+
|
|
23
|
+
// Find all anchor tags
|
|
24
|
+
const links = tempDiv.querySelectorAll('a[href]');
|
|
25
|
+
|
|
26
|
+
// Process each link
|
|
27
|
+
links.forEach(link => {
|
|
28
|
+
// Add target="_blank" if no target is specified or if target is not already "_blank"
|
|
29
|
+
if (!link.hasAttribute('target') || link.getAttribute('target') !== '_blank') {
|
|
30
|
+
link.setAttribute('target', '_blank');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Always add security attributes for all external links
|
|
34
|
+
const existingRel = link.getAttribute('rel');
|
|
35
|
+
const relValues = existingRel ? existingRel.split(' ') : [];
|
|
36
|
+
if (!relValues.includes('noopener')) {
|
|
37
|
+
relValues.push('noopener');
|
|
38
|
+
}
|
|
39
|
+
if (!relValues.includes('noreferrer')) {
|
|
40
|
+
relValues.push('noreferrer');
|
|
41
|
+
}
|
|
42
|
+
link.setAttribute('rel', relValues.join(' '));
|
|
43
|
+
});
|
|
44
|
+
return tempDiv.innerHTML;
|
|
45
|
+
};
|
|
12
46
|
export const ArticleBody = props => {
|
|
13
47
|
/**
|
|
14
48
|
* Set article height
|
|
@@ -85,7 +119,9 @@ export const ArticleBody = props => {
|
|
|
85
119
|
if (newIframe !== null) {
|
|
86
120
|
const iframeDocument = newIframe.document;
|
|
87
121
|
iframeDocument.open();
|
|
88
|
-
|
|
122
|
+
// Process the HTML to ensure all links open in new tabs
|
|
123
|
+
const processedBody = processLinksForNewTab(body);
|
|
124
|
+
iframeDocument.write(`<div>${processedBody}</div>`);
|
|
89
125
|
iframeDocument.close();
|
|
90
126
|
const head = iframeDocument.head || iframeDocument.getElementsByTagName('head')[0];
|
|
91
127
|
const style = iframeDocument.createElement('style');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import ShortcutIcon from '@atlaskit/icon/core/
|
|
2
|
+
import ShortcutIcon from '@atlaskit/icon/core/link-external';
|
|
3
3
|
import Heading from '@atlaskit/heading';
|
|
4
4
|
import { BODY_FORMAT_TYPES } from '../model/HelpArticle';
|
|
5
5
|
import { Text } from '@atlaskit/primitives/compiled';
|
package/dist/es2019/index.js
CHANGED
|
@@ -9,6 +9,40 @@ import resetCSS from './resetCss';
|
|
|
9
9
|
import { ArticleFrame } from './styled';
|
|
10
10
|
var IFRAME_CONTAINER_ID = 'help-iframe-container';
|
|
11
11
|
var IFRAME_ID = 'help-iframe';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Processes HTML content to ensure all links open in a new tab
|
|
15
|
+
* @param htmlContent - The HTML string to process
|
|
16
|
+
* @returns The processed HTML with target="_blank" added to all links
|
|
17
|
+
*/
|
|
18
|
+
export var processLinksForNewTab = function processLinksForNewTab(htmlContent) {
|
|
19
|
+
// Create a temporary DOM element to parse the HTML
|
|
20
|
+
var tempDiv = document.createElement('div');
|
|
21
|
+
tempDiv.innerHTML = htmlContent;
|
|
22
|
+
|
|
23
|
+
// Find all anchor tags
|
|
24
|
+
var links = tempDiv.querySelectorAll('a[href]');
|
|
25
|
+
|
|
26
|
+
// Process each link
|
|
27
|
+
links.forEach(function (link) {
|
|
28
|
+
// Add target="_blank" if no target is specified or if target is not already "_blank"
|
|
29
|
+
if (!link.hasAttribute('target') || link.getAttribute('target') !== '_blank') {
|
|
30
|
+
link.setAttribute('target', '_blank');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Always add security attributes for all external links
|
|
34
|
+
var existingRel = link.getAttribute('rel');
|
|
35
|
+
var relValues = existingRel ? existingRel.split(' ') : [];
|
|
36
|
+
if (!relValues.includes('noopener')) {
|
|
37
|
+
relValues.push('noopener');
|
|
38
|
+
}
|
|
39
|
+
if (!relValues.includes('noreferrer')) {
|
|
40
|
+
relValues.push('noreferrer');
|
|
41
|
+
}
|
|
42
|
+
link.setAttribute('rel', relValues.join(' '));
|
|
43
|
+
});
|
|
44
|
+
return tempDiv.innerHTML;
|
|
45
|
+
};
|
|
12
46
|
export var ArticleBody = function ArticleBody(props) {
|
|
13
47
|
/**
|
|
14
48
|
* Set article height
|
|
@@ -87,7 +121,9 @@ export var ArticleBody = function ArticleBody(props) {
|
|
|
87
121
|
if (newIframe !== null) {
|
|
88
122
|
var iframeDocument = newIframe.document;
|
|
89
123
|
iframeDocument.open();
|
|
90
|
-
|
|
124
|
+
// Process the HTML to ensure all links open in new tabs
|
|
125
|
+
var processedBody = processLinksForNewTab(body);
|
|
126
|
+
iframeDocument.write("<div>".concat(processedBody, "</div>"));
|
|
91
127
|
iframeDocument.close();
|
|
92
128
|
var head = iframeDocument.head || iframeDocument.getElementsByTagName('head')[0];
|
|
93
129
|
var style = iframeDocument.createElement('style');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import ShortcutIcon from '@atlaskit/icon/core/
|
|
2
|
+
import ShortcutIcon from '@atlaskit/icon/core/link-external';
|
|
3
3
|
import Heading from '@atlaskit/heading';
|
|
4
4
|
import { BODY_FORMAT_TYPES } from '../model/HelpArticle';
|
|
5
5
|
import { Text } from '@atlaskit/primitives/compiled';
|
package/dist/esm/index.js
CHANGED
|
@@ -7,5 +7,11 @@ export interface Props {
|
|
|
7
7
|
onArticleRenderBegin?(): void;
|
|
8
8
|
onArticleRenderDone?(): void;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Processes HTML content to ensure all links open in a new tab
|
|
12
|
+
* @param htmlContent - The HTML string to process
|
|
13
|
+
* @returns The processed HTML with target="_blank" added to all links
|
|
14
|
+
*/
|
|
15
|
+
export declare const processLinksForNewTab: (htmlContent: string) => string;
|
|
10
16
|
export declare const ArticleBody: (props: Props) => React.JSX.Element | null;
|
|
11
17
|
export default ArticleBody;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,5 +7,11 @@ export interface Props {
|
|
|
7
7
|
onArticleRenderBegin?(): void;
|
|
8
8
|
onArticleRenderDone?(): void;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Processes HTML content to ensure all links open in a new tab
|
|
12
|
+
* @param htmlContent - The HTML string to process
|
|
13
|
+
* @returns The processed HTML with target="_blank" added to all links
|
|
14
|
+
*/
|
|
15
|
+
export declare const processLinksForNewTab: (htmlContent: string) => string;
|
|
10
16
|
export declare const ArticleBody: (props: Props) => React.JSX.Element | null;
|
|
11
17
|
export default ArticleBody;
|
package/docs/0-intro.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { md, code, Example, Props, AtlassianInternalWarning } from '@atlaskit/docs';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const intro: React.ReactElement = md`
|
|
5
5
|
${(<AtlassianInternalWarning />)}
|
|
6
6
|
|
|
7
7
|
## Usage
|
|
@@ -34,4 +34,4 @@ const _default_1: any = md`
|
|
|
34
34
|
|
|
35
35
|
${(<Props props={require('!!extract-react-types-loader!../src/components/HelpArticle')} />)}
|
|
36
36
|
`;
|
|
37
|
-
export default
|
|
37
|
+
export default intro;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/help-article",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.26",
|
|
4
4
|
"description": "A cross-product help-article component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/css-reset": "^7.3.0",
|
|
35
35
|
"@atlaskit/heading": "^5.2.0",
|
|
36
|
-
"@atlaskit/icon": "^29.
|
|
37
|
-
"@atlaskit/primitives": "^
|
|
38
|
-
"@atlaskit/renderer": "^124.
|
|
39
|
-
"@atlaskit/tokens": "^
|
|
36
|
+
"@atlaskit/icon": "^29.3.0",
|
|
37
|
+
"@atlaskit/primitives": "^17.0.0",
|
|
38
|
+
"@atlaskit/renderer": "^124.22.0",
|
|
39
|
+
"@atlaskit/tokens": "^9.0.0",
|
|
40
40
|
"@babel/runtime": "^7.0.0",
|
|
41
41
|
"@compiled/react": "^0.18.6",
|
|
42
42
|
"lodash": "^4.17.21"
|