@atlaskit/adf-schema 25.2.2 → 25.3.0
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 +12 -0
- package/dist/cjs/schema/marks/link.js +6 -3
- package/dist/cjs/utils/url.js +8 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/schema/marks/link.js +7 -4
- package/dist/es2019/utils/url.js +7 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/schema/marks/link.js +7 -4
- package/dist/esm/utils/url.js +7 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/utils/url.d.ts +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# @atlaskit/adf-schema
|
2
2
|
|
3
|
+
## 25.3.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- [`7f755f463e0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7f755f463e0) - EDM-4553: allowing root relative links to be copied and pasted as a link by appending the parent root to the root relative link when it is copy and pasted.
|
8
|
+
|
9
|
+
## 25.2.3
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- [`85f02a75990`](https://bitbucket.org/atlassian/atlassian-frontend/commits/85f02a75990) - [hot-102658] Dummy patch added to stabalise package build failures caused because of bad remote cache
|
14
|
+
|
3
15
|
## 25.2.2
|
4
16
|
|
5
17
|
### Patch Changes
|
@@ -17,11 +17,14 @@ var getLinkAttrs = function getLinkAttrs(attribute) {
|
|
17
17
|
var attrs = {
|
18
18
|
__confluenceMetadata: dom.hasAttribute('__confluenceMetadata') ? JSON.parse(dom.getAttribute('__confluenceMetadata') || '') : undefined
|
19
19
|
};
|
20
|
-
if ((0, _url.isSafeUrl)(href)) {
|
21
|
-
attrs.href = (0, _url.normalizeUrl)(href);
|
22
|
-
} else {
|
20
|
+
if (!(0, _url.isSafeUrl)(href)) {
|
23
21
|
return false;
|
24
22
|
}
|
23
|
+
if ((0, _url.isRootRelative)(href)) {
|
24
|
+
attrs.href = href;
|
25
|
+
return attrs;
|
26
|
+
}
|
27
|
+
attrs.href = (0, _url.normalizeUrl)(href);
|
25
28
|
return attrs;
|
26
29
|
};
|
27
30
|
};
|
package/dist/cjs/utils/url.js
CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.LINK_REGEXP = void 0;
|
8
8
|
exports.getLinkMatch = getLinkMatch;
|
9
|
+
exports.isRootRelative = isRootRelative;
|
9
10
|
exports.linkifyMatch = exports.linkify = exports.isSafeUrl = void 0;
|
10
11
|
exports.normalizeUrl = normalizeUrl;
|
11
12
|
var _linkifyIt = _interopRequireDefault(require("linkify-it"));
|
@@ -85,4 +86,11 @@ function getLinkMatch(str) {
|
|
85
86
|
function normalizeUrl(url) {
|
86
87
|
var match = getLinkMatch(url);
|
87
88
|
return match && match.url || '';
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* checks if root relative link
|
93
|
+
*/
|
94
|
+
function isRootRelative(url) {
|
95
|
+
return url.startsWith('/');
|
88
96
|
}
|
package/dist/cjs/version.json
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
import { LINK } from '../groups';
|
2
|
-
import { isSafeUrl, normalizeUrl } from '../../utils/url';
|
2
|
+
import { isRootRelative, isSafeUrl, normalizeUrl } from '../../utils/url';
|
3
3
|
const getLinkAttrs = attribute => domNode => {
|
4
4
|
const dom = domNode;
|
5
5
|
const href = dom.getAttribute(attribute) || '';
|
6
6
|
const attrs = {
|
7
7
|
__confluenceMetadata: dom.hasAttribute('__confluenceMetadata') ? JSON.parse(dom.getAttribute('__confluenceMetadata') || '') : undefined
|
8
8
|
};
|
9
|
-
if (isSafeUrl(href)) {
|
10
|
-
attrs.href = normalizeUrl(href);
|
11
|
-
} else {
|
9
|
+
if (!isSafeUrl(href)) {
|
12
10
|
return false;
|
13
11
|
}
|
12
|
+
if (isRootRelative(href)) {
|
13
|
+
attrs.href = href;
|
14
|
+
return attrs;
|
15
|
+
}
|
16
|
+
attrs.href = normalizeUrl(href);
|
14
17
|
return attrs;
|
15
18
|
};
|
16
19
|
export const link = {
|
package/dist/es2019/utils/url.js
CHANGED
@@ -68,4 +68,11 @@ export function getLinkMatch(str) {
|
|
68
68
|
export function normalizeUrl(url) {
|
69
69
|
const match = getLinkMatch(url);
|
70
70
|
return match && match.url || '';
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* checks if root relative link
|
75
|
+
*/
|
76
|
+
export function isRootRelative(url) {
|
77
|
+
return url.startsWith('/');
|
71
78
|
}
|
package/dist/es2019/version.json
CHANGED
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
4
4
|
import { LINK } from '../groups';
|
5
|
-
import { isSafeUrl, normalizeUrl } from '../../utils/url';
|
5
|
+
import { isRootRelative, isSafeUrl, normalizeUrl } from '../../utils/url';
|
6
6
|
var getLinkAttrs = function getLinkAttrs(attribute) {
|
7
7
|
return function (domNode) {
|
8
8
|
var dom = domNode;
|
@@ -10,11 +10,14 @@ var getLinkAttrs = function getLinkAttrs(attribute) {
|
|
10
10
|
var attrs = {
|
11
11
|
__confluenceMetadata: dom.hasAttribute('__confluenceMetadata') ? JSON.parse(dom.getAttribute('__confluenceMetadata') || '') : undefined
|
12
12
|
};
|
13
|
-
if (isSafeUrl(href)) {
|
14
|
-
attrs.href = normalizeUrl(href);
|
15
|
-
} else {
|
13
|
+
if (!isSafeUrl(href)) {
|
16
14
|
return false;
|
17
15
|
}
|
16
|
+
if (isRootRelative(href)) {
|
17
|
+
attrs.href = href;
|
18
|
+
return attrs;
|
19
|
+
}
|
20
|
+
attrs.href = normalizeUrl(href);
|
18
21
|
return attrs;
|
19
22
|
};
|
20
23
|
};
|
package/dist/esm/utils/url.js
CHANGED
@@ -70,4 +70,11 @@ export function getLinkMatch(str) {
|
|
70
70
|
export function normalizeUrl(url) {
|
71
71
|
var match = getLinkMatch(url);
|
72
72
|
return match && match.url || '';
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* checks if root relative link
|
77
|
+
*/
|
78
|
+
export function isRootRelative(url) {
|
79
|
+
return url.startsWith('/');
|
73
80
|
}
|
package/dist/esm/version.json
CHANGED
@@ -25,3 +25,7 @@ export declare function getLinkMatch(str?: string): Match | null;
|
|
25
25
|
* Adds protocol to url if needed.
|
26
26
|
*/
|
27
27
|
export declare function normalizeUrl(url?: string): string;
|
28
|
+
/**
|
29
|
+
* checks if root relative link
|
30
|
+
*/
|
31
|
+
export declare function isRootRelative(url: string): boolean;
|
package/package.json
CHANGED