@atlaskit/editor-plugin-hyperlink 2.8.7 → 2.9.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/pm-plugins/input-rule.js +15 -19
- package/dist/cjs/pm-plugins/keymap.js +2 -5
- package/dist/es2019/pm-plugins/input-rule.js +15 -19
- package/dist/es2019/pm-plugins/keymap.js +2 -5
- package/dist/esm/pm-plugins/input-rule.js +15 -19
- package/dist/esm/pm-plugins/keymap.js +2 -5
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-hyperlink
|
|
2
2
|
|
|
3
|
+
## 2.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#132800](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132800)
|
|
8
|
+
[`7868d12fa96a1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7868d12fa96a1) -
|
|
9
|
+
EDM-9074 Remove platform.linking-platform.prevent-suspicious-linkification feature flag
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 2.8.7
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -12,7 +12,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
12
12
|
var _card = require("@atlaskit/editor-common/card");
|
|
13
13
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
14
14
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
17
16
|
var _toolbarButtons = require("./toolbar-buttons");
|
|
18
17
|
/**
|
|
@@ -28,25 +27,22 @@ function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
|
28
27
|
}
|
|
29
28
|
var link = match;
|
|
30
29
|
var url;
|
|
31
|
-
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.prevent-suspicious-linkification')) {
|
|
32
|
-
// Property 'url' does not exist on type 'RegExpExecArray', the type of `match`.
|
|
33
|
-
// This check is in case the match is not a Linkify match, which has a url property.
|
|
34
|
-
if (link.url === undefined) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
if (!(0, _utils.shouldAutoLinkifyMatch)(link)) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
url = (0, _utils.normalizeUrl)(link.url);
|
|
41
30
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
31
|
+
// Property 'url' does not exist on type 'RegExpExecArray', the type of `match`.
|
|
32
|
+
// This check is in case the match is not a Linkify match, which has a url property.
|
|
33
|
+
if (link.url === undefined) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
if (!(0, _utils.shouldAutoLinkifyMatch)(link)) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
url = (0, _utils.normalizeUrl)(link.url);
|
|
40
|
+
|
|
41
|
+
// Not previously handled; don't create a link if the URL is empty.
|
|
42
|
+
// This will only happen if the `regexp` matches more links than the normalizeUrl validation;
|
|
43
|
+
// if they both use the same linkify instance this shouldn't happen.
|
|
44
|
+
if (url === '') {
|
|
45
|
+
return null;
|
|
50
46
|
}
|
|
51
47
|
var markType = schema.mark('link', {
|
|
52
48
|
href: url
|
|
@@ -11,7 +11,6 @@ var _card = require("@atlaskit/editor-common/card");
|
|
|
11
11
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
13
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
14
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
14
|
var _commands = require("../commands");
|
|
16
15
|
var _main = require("../pm-plugins/main");
|
|
17
16
|
var _toolbarButtons = require("./toolbar-buttons");
|
|
@@ -49,10 +48,8 @@ var mayConvertLastWordToHyperlink = function mayConvertLastWordToHyperlink(edito
|
|
|
49
48
|
var lastWord = words[words.length - 1];
|
|
50
49
|
var match = (0, _adfSchema.getLinkMatch)(lastWord);
|
|
51
50
|
if (match) {
|
|
52
|
-
if ((0,
|
|
53
|
-
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
51
|
+
if (!(0, _utils.shouldAutoLinkifyMatch)(match)) {
|
|
52
|
+
return false;
|
|
56
53
|
}
|
|
57
54
|
var hyperlinkedText = match.raw;
|
|
58
55
|
var start = state.selection.$from.pos - hyperlinkedText.length;
|
|
@@ -2,7 +2,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import { createRule, findFilepaths, getLinkCreationAnalyticsEvent, isLinkInMatches, LinkMatcher, normalizeUrl, shouldAutoLinkifyMatch } from '@atlaskit/editor-common/utils';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { createPlugin } from '@atlaskit/prosemirror-input-rules';
|
|
7
6
|
import { toolbarKey } from './toolbar-buttons';
|
|
8
7
|
|
|
@@ -21,25 +20,22 @@ export function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
|
21
20
|
}
|
|
22
21
|
const link = match;
|
|
23
22
|
let url;
|
|
24
|
-
if (getBooleanFF('platform.linking-platform.prevent-suspicious-linkification')) {
|
|
25
|
-
// Property 'url' does not exist on type 'RegExpExecArray', the type of `match`.
|
|
26
|
-
// This check is in case the match is not a Linkify match, which has a url property.
|
|
27
|
-
if (link.url === undefined) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
if (!shouldAutoLinkifyMatch(link)) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
url = normalizeUrl(link.url);
|
|
34
23
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
// Property 'url' does not exist on type 'RegExpExecArray', the type of `match`.
|
|
25
|
+
// This check is in case the match is not a Linkify match, which has a url property.
|
|
26
|
+
if (link.url === undefined) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
if (!shouldAutoLinkifyMatch(link)) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
url = normalizeUrl(link.url);
|
|
33
|
+
|
|
34
|
+
// Not previously handled; don't create a link if the URL is empty.
|
|
35
|
+
// This will only happen if the `regexp` matches more links than the normalizeUrl validation;
|
|
36
|
+
// if they both use the same linkify instance this shouldn't happen.
|
|
37
|
+
if (url === '') {
|
|
38
|
+
return null;
|
|
43
39
|
}
|
|
44
40
|
const markType = schema.mark('link', {
|
|
45
41
|
href: url
|
|
@@ -4,7 +4,6 @@ import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
|
4
4
|
import { addLink, bindKeymapWithCommand, bindKeymapWithEditorCommand, enter, escape, insertNewLine } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import { findFilepaths, getLinkCreationAnalyticsEvent, isLinkInMatches, shouldAutoLinkifyMatch } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { hideLinkToolbar, showLinkToolbar } from '../commands';
|
|
9
8
|
import { stateKey } from '../pm-plugins/main';
|
|
10
9
|
import { toolbarKey } from './toolbar-buttons';
|
|
@@ -42,10 +41,8 @@ const mayConvertLastWordToHyperlink = editorAnalyticsApi => {
|
|
|
42
41
|
const lastWord = words[words.length - 1];
|
|
43
42
|
const match = getLinkMatch(lastWord);
|
|
44
43
|
if (match) {
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
44
|
+
if (!shouldAutoLinkifyMatch(match)) {
|
|
45
|
+
return false;
|
|
49
46
|
}
|
|
50
47
|
const hyperlinkedText = match.raw;
|
|
51
48
|
const start = state.selection.$from.pos - hyperlinkedText.length;
|
|
@@ -3,7 +3,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
3
3
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
5
|
import { createRule, findFilepaths, getLinkCreationAnalyticsEvent, isLinkInMatches, LinkMatcher, normalizeUrl, shouldAutoLinkifyMatch } from '@atlaskit/editor-common/utils';
|
|
6
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { createPlugin } from '@atlaskit/prosemirror-input-rules';
|
|
8
7
|
import { toolbarKey } from './toolbar-buttons';
|
|
9
8
|
|
|
@@ -20,25 +19,22 @@ export function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
|
20
19
|
}
|
|
21
20
|
var link = match;
|
|
22
21
|
var url;
|
|
23
|
-
if (getBooleanFF('platform.linking-platform.prevent-suspicious-linkification')) {
|
|
24
|
-
// Property 'url' does not exist on type 'RegExpExecArray', the type of `match`.
|
|
25
|
-
// This check is in case the match is not a Linkify match, which has a url property.
|
|
26
|
-
if (link.url === undefined) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
if (!shouldAutoLinkifyMatch(link)) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
url = normalizeUrl(link.url);
|
|
33
22
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
// Property 'url' does not exist on type 'RegExpExecArray', the type of `match`.
|
|
24
|
+
// This check is in case the match is not a Linkify match, which has a url property.
|
|
25
|
+
if (link.url === undefined) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
if (!shouldAutoLinkifyMatch(link)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
url = normalizeUrl(link.url);
|
|
32
|
+
|
|
33
|
+
// Not previously handled; don't create a link if the URL is empty.
|
|
34
|
+
// This will only happen if the `regexp` matches more links than the normalizeUrl validation;
|
|
35
|
+
// if they both use the same linkify instance this shouldn't happen.
|
|
36
|
+
if (url === '') {
|
|
37
|
+
return null;
|
|
42
38
|
}
|
|
43
39
|
var markType = schema.mark('link', {
|
|
44
40
|
href: url
|
|
@@ -4,7 +4,6 @@ import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
|
4
4
|
import { addLink, bindKeymapWithCommand, bindKeymapWithEditorCommand, enter, escape, insertNewLine } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import { findFilepaths, getLinkCreationAnalyticsEvent, isLinkInMatches, shouldAutoLinkifyMatch } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { hideLinkToolbar, showLinkToolbar } from '../commands';
|
|
9
8
|
import { stateKey } from '../pm-plugins/main';
|
|
10
9
|
import { toolbarKey } from './toolbar-buttons';
|
|
@@ -42,10 +41,8 @@ var mayConvertLastWordToHyperlink = function mayConvertLastWordToHyperlink(edito
|
|
|
42
41
|
var lastWord = words[words.length - 1];
|
|
43
42
|
var match = getLinkMatch(lastWord);
|
|
44
43
|
if (match) {
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
44
|
+
if (!shouldAutoLinkifyMatch(match)) {
|
|
45
|
+
return false;
|
|
49
46
|
}
|
|
50
47
|
var hyperlinkedText = match.raw;
|
|
51
48
|
var start = state.selection.$from.pos - hyperlinkedText.length;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-hyperlink",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Hyperlink plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^40.8.1",
|
|
36
36
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
37
|
-
"@atlaskit/editor-common": "^88.
|
|
37
|
+
"@atlaskit/editor-common": "^88.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^1.8.0",
|
|
39
39
|
"@atlaskit/editor-plugin-card": "2.13.2",
|
|
40
40
|
"@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
|
|
@@ -93,9 +93,6 @@
|
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
95
|
"platform-feature-flags": {
|
|
96
|
-
"platform.linking-platform.prevent-suspicious-linkification": {
|
|
97
|
-
"type": "boolean"
|
|
98
|
-
},
|
|
99
96
|
"platform.editor.card.inject-settings-button": {
|
|
100
97
|
"type": "boolean"
|
|
101
98
|
},
|