@atlaskit/editor-common 78.23.4 → 78.23.5
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 +7 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/utils/hyperlink.js +61 -4
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/utils/hyperlink.js +58 -3
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/utils/hyperlink.js +60 -5
- package/dist/types/utils/hyperlink.d.ts +6 -1
- package/dist/types-ts4.5/utils/hyperlink.d.ts +6 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 78.23.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#87218](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87218) [`697e394e4300`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/697e394e4300) - NO-ISSUE Refactor linkifyContent and findLinkMatches
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
3
10
|
## 78.23.4
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "78.23.
|
|
19
|
+
var packageVersion = "78.23.5";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -22,7 +22,7 @@ var _templateObject, _templateObject2, _templateObject3;
|
|
|
22
22
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
23
23
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */
|
|
24
24
|
var packageName = "@atlaskit/editor-common";
|
|
25
|
-
var packageVersion = "78.23.
|
|
25
|
+
var packageVersion = "78.23.5";
|
|
26
26
|
var halfFocusRing = 1;
|
|
27
27
|
var dropOffset = '0, 8';
|
|
28
28
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -10,6 +10,8 @@ exports.getLinkDomain = getLinkDomain;
|
|
|
10
10
|
exports.isFromCurrentDomain = isFromCurrentDomain;
|
|
11
11
|
exports.isLinkInMatches = void 0;
|
|
12
12
|
exports.linkifyContent = linkifyContent;
|
|
13
|
+
exports.linkifyContentNew = linkifyContentNew;
|
|
14
|
+
exports.linkifyContentOld = linkifyContentOld;
|
|
13
15
|
exports.normalizeUrl = normalizeUrl;
|
|
14
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
17
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -86,11 +88,17 @@ function normalizeUrl(url) {
|
|
|
86
88
|
}
|
|
87
89
|
return (0, _adfSchema.normalizeUrl)(url);
|
|
88
90
|
}
|
|
91
|
+
function linkifyContent(schema) {
|
|
92
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.prevent-suspicious-linkification')) {
|
|
93
|
+
return linkifyContentNew(schema);
|
|
94
|
+
}
|
|
95
|
+
return linkifyContentOld(schema);
|
|
96
|
+
}
|
|
89
97
|
|
|
90
98
|
/**
|
|
91
99
|
* Linkify content in a slice (eg. after a rich text paste)
|
|
92
100
|
*/
|
|
93
|
-
function
|
|
101
|
+
function linkifyContentOld(schema) {
|
|
94
102
|
return function (slice) {
|
|
95
103
|
return (0, _slice.mapSlice)(slice, function (node, parent) {
|
|
96
104
|
var isAllowedInParent = !parent || parent.type !== schema.nodes.codeBlock;
|
|
@@ -101,9 +109,7 @@ function linkifyContent(schema) {
|
|
|
101
109
|
if (isAllowedInParent && node.isText && !link.isInSet(node.marks)) {
|
|
102
110
|
var linkified = [];
|
|
103
111
|
var text = node.text;
|
|
104
|
-
var matches = (
|
|
105
|
-
return (0, _shouldAutoLinkifyTld.shouldAutoLinkifyTld)(match.title);
|
|
106
|
-
}) : findLinkMatches(text);
|
|
112
|
+
var matches = findLinkMatchesOld(text);
|
|
107
113
|
var pos = 0;
|
|
108
114
|
var filepaths = findFilepaths(text);
|
|
109
115
|
matches.forEach(function (match) {
|
|
@@ -127,6 +133,45 @@ function linkifyContent(schema) {
|
|
|
127
133
|
});
|
|
128
134
|
};
|
|
129
135
|
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Linkify content in a slice (eg. after a rich text paste)
|
|
139
|
+
*/
|
|
140
|
+
function linkifyContentNew(schema) {
|
|
141
|
+
return function (slice) {
|
|
142
|
+
return (0, _slice.mapSlice)(slice, function (node, parent) {
|
|
143
|
+
var isAllowedInParent = !parent || parent.type !== schema.nodes.codeBlock;
|
|
144
|
+
var link = node.type.schema.marks.link;
|
|
145
|
+
if (link === undefined) {
|
|
146
|
+
throw new Error('Link not in schema - unable to linkify content');
|
|
147
|
+
}
|
|
148
|
+
if (isAllowedInParent && node.isText && !link.isInSet(node.marks)) {
|
|
149
|
+
var linkified = [];
|
|
150
|
+
var text = node.text;
|
|
151
|
+
var matches = findLinkMatches(text).filter(_shouldAutoLinkifyTld.shouldAutoLinkifyMatch);
|
|
152
|
+
var pos = 0;
|
|
153
|
+
var filepaths = findFilepaths(text);
|
|
154
|
+
matches.forEach(function (match) {
|
|
155
|
+
if (isLinkInMatches(match.index, filepaths)) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (match.index > 0) {
|
|
159
|
+
linkified.push(node.cut(pos, match.index));
|
|
160
|
+
}
|
|
161
|
+
linkified.push(node.cut(match.index, match.lastIndex).mark(link.create({
|
|
162
|
+
href: normalizeUrl(match.url)
|
|
163
|
+
}).addToSet(node.marks)));
|
|
164
|
+
pos = match.lastIndex;
|
|
165
|
+
});
|
|
166
|
+
if (pos < text.length) {
|
|
167
|
+
linkified.push(node.cut(pos));
|
|
168
|
+
}
|
|
169
|
+
return linkified;
|
|
170
|
+
}
|
|
171
|
+
return node;
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
}
|
|
130
175
|
function getLinkDomain(url) {
|
|
131
176
|
// Remove protocol and www., if either exists
|
|
132
177
|
var withoutProtocol = url.toLowerCase().replace(/^(.*):\/\//, '');
|
|
@@ -143,7 +188,19 @@ function isFromCurrentDomain(url) {
|
|
|
143
188
|
var linkDomain = getLinkDomain(url);
|
|
144
189
|
return currentDomain === linkDomain;
|
|
145
190
|
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Fetch linkify matches from text
|
|
194
|
+
* @param text Input text from a node
|
|
195
|
+
* @returns Array of linkify matches. Returns empty array if text is empty or no matches found;
|
|
196
|
+
*/
|
|
146
197
|
function findLinkMatches(text) {
|
|
198
|
+
if (text === '') {
|
|
199
|
+
return [];
|
|
200
|
+
}
|
|
201
|
+
return _adfSchema.linkify.match(text) || [];
|
|
202
|
+
}
|
|
203
|
+
function findLinkMatchesOld(text) {
|
|
147
204
|
var matches = [];
|
|
148
205
|
var linkMatches = text && _adfSchema.linkify.match(text);
|
|
149
206
|
if (linkMatches && linkMatches.length > 0) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
2
2
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
3
|
-
const packageVersion = "78.23.
|
|
3
|
+
const packageVersion = "78.23.5";
|
|
4
4
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
5
5
|
// Remove URL as it has UGC
|
|
6
6
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
7
7
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
8
8
|
import Layer from '../Layer';
|
|
9
9
|
const packageName = "@atlaskit/editor-common";
|
|
10
|
-
const packageVersion = "78.23.
|
|
10
|
+
const packageVersion = "78.23.5";
|
|
11
11
|
const halfFocusRing = 1;
|
|
12
12
|
const dropOffset = '0, 8';
|
|
13
13
|
class DropList extends Component {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { isSafeUrl, linkify, normalizeUrl as normaliseLinkHref } from '@atlaskit/adf-schema';
|
|
5
5
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analytics/types';
|
|
7
|
-
import {
|
|
7
|
+
import { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
|
|
8
8
|
import { mapSlice } from './slice';
|
|
9
9
|
|
|
10
10
|
// Regular expression for a windows filepath in the format <DRIVE LETTER>:\<folder name>\
|
|
@@ -59,11 +59,17 @@ export function normalizeUrl(url) {
|
|
|
59
59
|
}
|
|
60
60
|
return normaliseLinkHref(url);
|
|
61
61
|
}
|
|
62
|
+
export function linkifyContent(schema) {
|
|
63
|
+
if (getBooleanFF('platform.linking-platform.prevent-suspicious-linkification')) {
|
|
64
|
+
return linkifyContentNew(schema);
|
|
65
|
+
}
|
|
66
|
+
return linkifyContentOld(schema);
|
|
67
|
+
}
|
|
62
68
|
|
|
63
69
|
/**
|
|
64
70
|
* Linkify content in a slice (eg. after a rich text paste)
|
|
65
71
|
*/
|
|
66
|
-
export function
|
|
72
|
+
export function linkifyContentOld(schema) {
|
|
67
73
|
return slice => mapSlice(slice, (node, parent) => {
|
|
68
74
|
const isAllowedInParent = !parent || parent.type !== schema.nodes.codeBlock;
|
|
69
75
|
const link = node.type.schema.marks.link;
|
|
@@ -73,7 +79,7 @@ export function linkifyContent(schema) {
|
|
|
73
79
|
if (isAllowedInParent && node.isText && !link.isInSet(node.marks)) {
|
|
74
80
|
const linkified = [];
|
|
75
81
|
const text = node.text;
|
|
76
|
-
const matches =
|
|
82
|
+
const matches = findLinkMatchesOld(text);
|
|
77
83
|
let pos = 0;
|
|
78
84
|
const filepaths = findFilepaths(text);
|
|
79
85
|
matches.forEach(match => {
|
|
@@ -96,6 +102,43 @@ export function linkifyContent(schema) {
|
|
|
96
102
|
return node;
|
|
97
103
|
});
|
|
98
104
|
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Linkify content in a slice (eg. after a rich text paste)
|
|
108
|
+
*/
|
|
109
|
+
export function linkifyContentNew(schema) {
|
|
110
|
+
return slice => mapSlice(slice, (node, parent) => {
|
|
111
|
+
const isAllowedInParent = !parent || parent.type !== schema.nodes.codeBlock;
|
|
112
|
+
const link = node.type.schema.marks.link;
|
|
113
|
+
if (link === undefined) {
|
|
114
|
+
throw new Error('Link not in schema - unable to linkify content');
|
|
115
|
+
}
|
|
116
|
+
if (isAllowedInParent && node.isText && !link.isInSet(node.marks)) {
|
|
117
|
+
const linkified = [];
|
|
118
|
+
const text = node.text;
|
|
119
|
+
const matches = findLinkMatches(text).filter(shouldAutoLinkifyMatch);
|
|
120
|
+
let pos = 0;
|
|
121
|
+
const filepaths = findFilepaths(text);
|
|
122
|
+
matches.forEach(match => {
|
|
123
|
+
if (isLinkInMatches(match.index, filepaths)) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (match.index > 0) {
|
|
127
|
+
linkified.push(node.cut(pos, match.index));
|
|
128
|
+
}
|
|
129
|
+
linkified.push(node.cut(match.index, match.lastIndex).mark(link.create({
|
|
130
|
+
href: normalizeUrl(match.url)
|
|
131
|
+
}).addToSet(node.marks)));
|
|
132
|
+
pos = match.lastIndex;
|
|
133
|
+
});
|
|
134
|
+
if (pos < text.length) {
|
|
135
|
+
linkified.push(node.cut(pos));
|
|
136
|
+
}
|
|
137
|
+
return linkified;
|
|
138
|
+
}
|
|
139
|
+
return node;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
99
142
|
export function getLinkDomain(url) {
|
|
100
143
|
// Remove protocol and www., if either exists
|
|
101
144
|
const withoutProtocol = url.toLowerCase().replace(/^(.*):\/\//, '');
|
|
@@ -112,7 +155,19 @@ export function isFromCurrentDomain(url) {
|
|
|
112
155
|
const linkDomain = getLinkDomain(url);
|
|
113
156
|
return currentDomain === linkDomain;
|
|
114
157
|
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Fetch linkify matches from text
|
|
161
|
+
* @param text Input text from a node
|
|
162
|
+
* @returns Array of linkify matches. Returns empty array if text is empty or no matches found;
|
|
163
|
+
*/
|
|
115
164
|
function findLinkMatches(text) {
|
|
165
|
+
if (text === '') {
|
|
166
|
+
return [];
|
|
167
|
+
}
|
|
168
|
+
return linkify.match(text) || [];
|
|
169
|
+
}
|
|
170
|
+
function findLinkMatchesOld(text) {
|
|
116
171
|
const matches = [];
|
|
117
172
|
let linkMatches = text && linkify.match(text);
|
|
118
173
|
if (linkMatches && linkMatches.length > 0) {
|
|
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
8
8
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
9
|
-
var packageVersion = "78.23.
|
|
9
|
+
var packageVersion = "78.23.5";
|
|
10
10
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
11
11
|
// Remove URL as it has UGC
|
|
12
12
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -17,7 +17,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
17
17
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
18
18
|
import Layer from '../Layer';
|
|
19
19
|
var packageName = "@atlaskit/editor-common";
|
|
20
|
-
var packageVersion = "78.23.
|
|
20
|
+
var packageVersion = "78.23.5";
|
|
21
21
|
var halfFocusRing = 1;
|
|
22
22
|
var dropOffset = '0, 8';
|
|
23
23
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -6,7 +6,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
6
6
|
import { isSafeUrl, linkify, normalizeUrl as normaliseLinkHref } from '@atlaskit/adf-schema';
|
|
7
7
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analytics/types';
|
|
9
|
-
import {
|
|
9
|
+
import { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
|
|
10
10
|
import { mapSlice } from './slice';
|
|
11
11
|
|
|
12
12
|
// Regular expression for a windows filepath in the format <DRIVE LETTER>:\<folder name>\
|
|
@@ -75,11 +75,17 @@ export function normalizeUrl(url) {
|
|
|
75
75
|
}
|
|
76
76
|
return normaliseLinkHref(url);
|
|
77
77
|
}
|
|
78
|
+
export function linkifyContent(schema) {
|
|
79
|
+
if (getBooleanFF('platform.linking-platform.prevent-suspicious-linkification')) {
|
|
80
|
+
return linkifyContentNew(schema);
|
|
81
|
+
}
|
|
82
|
+
return linkifyContentOld(schema);
|
|
83
|
+
}
|
|
78
84
|
|
|
79
85
|
/**
|
|
80
86
|
* Linkify content in a slice (eg. after a rich text paste)
|
|
81
87
|
*/
|
|
82
|
-
export function
|
|
88
|
+
export function linkifyContentOld(schema) {
|
|
83
89
|
return function (slice) {
|
|
84
90
|
return mapSlice(slice, function (node, parent) {
|
|
85
91
|
var isAllowedInParent = !parent || parent.type !== schema.nodes.codeBlock;
|
|
@@ -90,9 +96,7 @@ export function linkifyContent(schema) {
|
|
|
90
96
|
if (isAllowedInParent && node.isText && !link.isInSet(node.marks)) {
|
|
91
97
|
var linkified = [];
|
|
92
98
|
var text = node.text;
|
|
93
|
-
var matches =
|
|
94
|
-
return shouldAutoLinkifyTld(match.title);
|
|
95
|
-
}) : findLinkMatches(text);
|
|
99
|
+
var matches = findLinkMatchesOld(text);
|
|
96
100
|
var pos = 0;
|
|
97
101
|
var filepaths = findFilepaths(text);
|
|
98
102
|
matches.forEach(function (match) {
|
|
@@ -116,6 +120,45 @@ export function linkifyContent(schema) {
|
|
|
116
120
|
});
|
|
117
121
|
};
|
|
118
122
|
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Linkify content in a slice (eg. after a rich text paste)
|
|
126
|
+
*/
|
|
127
|
+
export function linkifyContentNew(schema) {
|
|
128
|
+
return function (slice) {
|
|
129
|
+
return mapSlice(slice, function (node, parent) {
|
|
130
|
+
var isAllowedInParent = !parent || parent.type !== schema.nodes.codeBlock;
|
|
131
|
+
var link = node.type.schema.marks.link;
|
|
132
|
+
if (link === undefined) {
|
|
133
|
+
throw new Error('Link not in schema - unable to linkify content');
|
|
134
|
+
}
|
|
135
|
+
if (isAllowedInParent && node.isText && !link.isInSet(node.marks)) {
|
|
136
|
+
var linkified = [];
|
|
137
|
+
var text = node.text;
|
|
138
|
+
var matches = findLinkMatches(text).filter(shouldAutoLinkifyMatch);
|
|
139
|
+
var pos = 0;
|
|
140
|
+
var filepaths = findFilepaths(text);
|
|
141
|
+
matches.forEach(function (match) {
|
|
142
|
+
if (isLinkInMatches(match.index, filepaths)) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (match.index > 0) {
|
|
146
|
+
linkified.push(node.cut(pos, match.index));
|
|
147
|
+
}
|
|
148
|
+
linkified.push(node.cut(match.index, match.lastIndex).mark(link.create({
|
|
149
|
+
href: normalizeUrl(match.url)
|
|
150
|
+
}).addToSet(node.marks)));
|
|
151
|
+
pos = match.lastIndex;
|
|
152
|
+
});
|
|
153
|
+
if (pos < text.length) {
|
|
154
|
+
linkified.push(node.cut(pos));
|
|
155
|
+
}
|
|
156
|
+
return linkified;
|
|
157
|
+
}
|
|
158
|
+
return node;
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
}
|
|
119
162
|
export function getLinkDomain(url) {
|
|
120
163
|
// Remove protocol and www., if either exists
|
|
121
164
|
var withoutProtocol = url.toLowerCase().replace(/^(.*):\/\//, '');
|
|
@@ -132,7 +175,19 @@ export function isFromCurrentDomain(url) {
|
|
|
132
175
|
var linkDomain = getLinkDomain(url);
|
|
133
176
|
return currentDomain === linkDomain;
|
|
134
177
|
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Fetch linkify matches from text
|
|
181
|
+
* @param text Input text from a node
|
|
182
|
+
* @returns Array of linkify matches. Returns empty array if text is empty or no matches found;
|
|
183
|
+
*/
|
|
135
184
|
function findLinkMatches(text) {
|
|
185
|
+
if (text === '') {
|
|
186
|
+
return [];
|
|
187
|
+
}
|
|
188
|
+
return linkify.match(text) || [];
|
|
189
|
+
}
|
|
190
|
+
function findLinkMatchesOld(text) {
|
|
136
191
|
var matches = [];
|
|
137
192
|
var linkMatches = text && linkify.match(text);
|
|
138
193
|
if (linkMatches && linkMatches.length > 0) {
|
|
@@ -15,10 +15,15 @@ export declare class LinkMatcher {
|
|
|
15
15
|
* Adds protocol to url if needed.
|
|
16
16
|
*/
|
|
17
17
|
export declare function normalizeUrl(url?: string | null): string;
|
|
18
|
+
export declare function linkifyContent(schema: Schema): (slice: Slice) => Slice;
|
|
18
19
|
/**
|
|
19
20
|
* Linkify content in a slice (eg. after a rich text paste)
|
|
20
21
|
*/
|
|
21
|
-
export declare function
|
|
22
|
+
export declare function linkifyContentOld(schema: Schema): (slice: Slice) => Slice;
|
|
23
|
+
/**
|
|
24
|
+
* Linkify content in a slice (eg. after a rich text paste)
|
|
25
|
+
*/
|
|
26
|
+
export declare function linkifyContentNew(schema: Schema): (slice: Slice) => Slice;
|
|
22
27
|
export declare function getLinkDomain(url: string): string;
|
|
23
28
|
export declare function isFromCurrentDomain(url: string): boolean;
|
|
24
29
|
interface filepathMatch {
|
|
@@ -15,10 +15,15 @@ export declare class LinkMatcher {
|
|
|
15
15
|
* Adds protocol to url if needed.
|
|
16
16
|
*/
|
|
17
17
|
export declare function normalizeUrl(url?: string | null): string;
|
|
18
|
+
export declare function linkifyContent(schema: Schema): (slice: Slice) => Slice;
|
|
18
19
|
/**
|
|
19
20
|
* Linkify content in a slice (eg. after a rich text paste)
|
|
20
21
|
*/
|
|
21
|
-
export declare function
|
|
22
|
+
export declare function linkifyContentOld(schema: Schema): (slice: Slice) => Slice;
|
|
23
|
+
/**
|
|
24
|
+
* Linkify content in a slice (eg. after a rich text paste)
|
|
25
|
+
*/
|
|
26
|
+
export declare function linkifyContentNew(schema: Schema): (slice: Slice) => Slice;
|
|
22
27
|
export declare function getLinkDomain(url: string): string;
|
|
23
28
|
export declare function isFromCurrentDomain(url: string): boolean;
|
|
24
29
|
interface filepathMatch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "78.23.
|
|
3
|
+
"version": "78.23.5",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"@atlaskit/media-common": "^11.1.0",
|
|
122
122
|
"@atlaskit/media-file-preview": "^0.5.0",
|
|
123
123
|
"@atlaskit/media-picker": "^66.4.0",
|
|
124
|
-
"@atlaskit/media-ui": "^25.
|
|
124
|
+
"@atlaskit/media-ui": "^25.5.0",
|
|
125
125
|
"@atlaskit/media-viewer": "48.4.3",
|
|
126
126
|
"@atlaskit/mention": "^23.0.0",
|
|
127
127
|
"@atlaskit/menu": "^2.1.0",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"@atlaskit/primitives": "^5.5.0",
|
|
130
130
|
"@atlaskit/profilecard": "^19.11.0",
|
|
131
131
|
"@atlaskit/section-message": "^6.4.0",
|
|
132
|
-
"@atlaskit/smart-card": "^26.
|
|
132
|
+
"@atlaskit/smart-card": "^26.52.0",
|
|
133
133
|
"@atlaskit/smart-user-picker": "^6.9.0",
|
|
134
134
|
"@atlaskit/spinner": "^16.0.0",
|
|
135
135
|
"@atlaskit/task-decision": "^17.9.0",
|