@atlaskit/editor-plugin-hyperlink 5.2.1 → 5.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 +21 -0
- package/dist/cjs/hyperlinkPlugin.js +1 -1
- package/dist/cjs/pm-plugins/input-rule.js +6 -1
- package/dist/es2019/hyperlinkPlugin.js +1 -1
- package/dist/es2019/pm-plugins/input-rule.js +6 -2
- package/dist/esm/hyperlinkPlugin.js +1 -1
- package/dist/esm/pm-plugins/input-rule.js +6 -1
- package/dist/types/pm-plugins/input-rule.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/input-rule.d.ts +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-hyperlink
|
|
2
2
|
|
|
3
|
+
## 5.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#196046](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/196046)
|
|
8
|
+
[`b0dad85aa7c35`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b0dad85aa7c35) -
|
|
9
|
+
[ux] [ED-27974] Allow hyperlink plugin to change text to link on blur
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 5.2.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#195649](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/195649)
|
|
20
|
+
[`231bb33e06dfe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/231bb33e06dfe) -
|
|
21
|
+
EDITOR-1131 Bump adf-schema version to 50.2.0
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 5.2.1
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -121,7 +121,7 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
121
121
|
plugin: function plugin(_ref3) {
|
|
122
122
|
var _api$analytics4;
|
|
123
123
|
var schema = _ref3.schema;
|
|
124
|
-
return (0, _inputRule.createInputRulePlugin)(schema, api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
124
|
+
return (0, _inputRule.createInputRulePlugin)(schema, api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions, options.autoLinkOnBlur);
|
|
125
125
|
}
|
|
126
126
|
}, {
|
|
127
127
|
name: 'hyperlinkKeymap',
|
|
@@ -13,6 +13,7 @@ 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
15
|
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
16
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
17
|
var _toolbarButtons = require("./toolbar-buttons");
|
|
17
18
|
/**
|
|
18
19
|
* Called when space after link, but not on enter
|
|
@@ -80,6 +81,7 @@ function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
84
|
+
var autoLinkOnBlur = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
83
85
|
if (!schema.marks.link) {
|
|
84
86
|
return;
|
|
85
87
|
}
|
|
@@ -113,6 +115,9 @@ function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
113
115
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0, _utils.getLinkCreationAnalyticsEvent)(_analytics.INPUT_METHOD.FORMATTING, url))(tr);
|
|
114
116
|
return tr;
|
|
115
117
|
});
|
|
116
|
-
return new _safePlugin.SafePlugin((0, _prosemirrorInputRules.createPlugin)('hyperlink', [urlWithASpaceRule, markdownLinkRule]))
|
|
118
|
+
return new _safePlugin.SafePlugin((0, _prosemirrorInputRules.createPlugin)('hyperlink', [urlWithASpaceRule, markdownLinkRule], autoLinkOnBlur && (0, _expValEquals.expValEquals)('platform_editor_create_link_on_blur', 'isEnabled', true) ? {
|
|
119
|
+
checkOnBlur: true,
|
|
120
|
+
appendTextOnBlur: ' '
|
|
121
|
+
} : undefined));
|
|
117
122
|
}
|
|
118
123
|
var _default = exports.default = createInputRulePlugin;
|
|
@@ -104,7 +104,7 @@ export const hyperlinkPlugin = ({
|
|
|
104
104
|
schema
|
|
105
105
|
}) => {
|
|
106
106
|
var _api$analytics4;
|
|
107
|
-
return createInputRulePlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
107
|
+
return createInputRulePlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions, options.autoLinkOnBlur);
|
|
108
108
|
}
|
|
109
109
|
}, {
|
|
110
110
|
name: 'hyperlinkKeymap',
|
|
@@ -3,6 +3,7 @@ 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
5
|
import { createPlugin } from '@atlaskit/prosemirror-input-rules';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
7
|
import { toolbarKey } from './toolbar-buttons';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -72,7 +73,7 @@ export function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
|
72
73
|
return tr;
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
|
-
export function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
76
|
+
export function createInputRulePlugin(schema, editorAnalyticsApi, autoLinkOnBlur = false) {
|
|
76
77
|
if (!schema.marks.link) {
|
|
77
78
|
return;
|
|
78
79
|
}
|
|
@@ -105,6 +106,9 @@ export function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
105
106
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(getLinkCreationAnalyticsEvent(INPUT_METHOD.FORMATTING, url))(tr);
|
|
106
107
|
return tr;
|
|
107
108
|
});
|
|
108
|
-
return new SafePlugin(createPlugin('hyperlink', [urlWithASpaceRule, markdownLinkRule])
|
|
109
|
+
return new SafePlugin(createPlugin('hyperlink', [urlWithASpaceRule, markdownLinkRule], autoLinkOnBlur && expValEquals('platform_editor_create_link_on_blur', 'isEnabled', true) ? {
|
|
110
|
+
checkOnBlur: true,
|
|
111
|
+
appendTextOnBlur: ' '
|
|
112
|
+
} : undefined));
|
|
109
113
|
}
|
|
110
114
|
export default createInputRulePlugin;
|
|
@@ -114,7 +114,7 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
114
114
|
plugin: function plugin(_ref3) {
|
|
115
115
|
var _api$analytics4;
|
|
116
116
|
var schema = _ref3.schema;
|
|
117
|
-
return createInputRulePlugin(schema, api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
117
|
+
return createInputRulePlugin(schema, api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions, options.autoLinkOnBlur);
|
|
118
118
|
}
|
|
119
119
|
}, {
|
|
120
120
|
name: 'hyperlinkKeymap',
|
|
@@ -4,6 +4,7 @@ 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
6
|
import { createPlugin } from '@atlaskit/prosemirror-input-rules';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
8
|
import { toolbarKey } from './toolbar-buttons';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -72,6 +73,7 @@ export function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
75
|
export function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
76
|
+
var autoLinkOnBlur = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
75
77
|
if (!schema.marks.link) {
|
|
76
78
|
return;
|
|
77
79
|
}
|
|
@@ -105,6 +107,9 @@ export function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
105
107
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(getLinkCreationAnalyticsEvent(INPUT_METHOD.FORMATTING, url))(tr);
|
|
106
108
|
return tr;
|
|
107
109
|
});
|
|
108
|
-
return new SafePlugin(createPlugin('hyperlink', [urlWithASpaceRule, markdownLinkRule])
|
|
110
|
+
return new SafePlugin(createPlugin('hyperlink', [urlWithASpaceRule, markdownLinkRule], autoLinkOnBlur && expValEquals('platform_editor_create_link_on_blur', 'isEnabled', true) ? {
|
|
111
|
+
checkOnBlur: true,
|
|
112
|
+
appendTextOnBlur: ' '
|
|
113
|
+
} : undefined));
|
|
109
114
|
}
|
|
110
115
|
export default createInputRulePlugin;
|
|
@@ -6,5 +6,5 @@ import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
|
6
6
|
* Called when space after link, but not on enter
|
|
7
7
|
*/
|
|
8
8
|
export declare function createLinkInputRule(regexp: RegExp, editorAnalyticsApi: EditorAnalyticsAPI | undefined): InputRuleWrapper;
|
|
9
|
-
export declare function createInputRulePlugin(schema: Schema, editorAnalyticsApi: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
|
|
9
|
+
export declare function createInputRulePlugin(schema: Schema, editorAnalyticsApi: EditorAnalyticsAPI | undefined, autoLinkOnBlur?: boolean): SafePlugin | undefined;
|
|
10
10
|
export default createInputRulePlugin;
|
|
@@ -6,5 +6,5 @@ import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
|
6
6
|
* Called when space after link, but not on enter
|
|
7
7
|
*/
|
|
8
8
|
export declare function createLinkInputRule(regexp: RegExp, editorAnalyticsApi: EditorAnalyticsAPI | undefined): InputRuleWrapper;
|
|
9
|
-
export declare function createInputRulePlugin(schema: Schema, editorAnalyticsApi: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
|
|
9
|
+
export declare function createInputRulePlugin(schema: Schema, editorAnalyticsApi: EditorAnalyticsAPI | undefined, autoLinkOnBlur?: boolean): SafePlugin | undefined;
|
|
10
10
|
export default createInputRulePlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-hyperlink",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Hyperlink plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
".": "./src/index.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/adf-schema": "^50.0
|
|
35
|
+
"@atlaskit/adf-schema": "^50.2.0",
|
|
36
36
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^3.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-card": "^7.2.0",
|
|
@@ -41,16 +41,16 @@
|
|
|
41
41
|
"@atlaskit/editor-plugin-primary-toolbar": "^4.1.0",
|
|
42
42
|
"@atlaskit/editor-plugin-selection-toolbar": "^4.2.0",
|
|
43
43
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
44
|
-
"@atlaskit/icon": "^27.
|
|
44
|
+
"@atlaskit/icon": "^27.9.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
46
|
-
"@atlaskit/prosemirror-input-rules": "^3.
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^9.
|
|
46
|
+
"@atlaskit/prosemirror-input-rules": "^3.4.0",
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^9.24.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
49
|
"@emotion/react": "^11.7.1",
|
|
50
50
|
"uuid": "^3.1.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@atlaskit/editor-common": "^107.
|
|
53
|
+
"@atlaskit/editor-common": "^107.17.0",
|
|
54
54
|
"react": "^18.2.0",
|
|
55
55
|
"react-dom": "^18.2.0",
|
|
56
56
|
"react-intl-next": "npm:react-intl@^5.18.1"
|