@atlaskit/editor-plugin-hyperlink 3.2.33 → 3.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 +20 -0
- package/dist/cjs/editor-commands/commands.js +1 -17
- package/dist/cjs/hyperlinkPlugin.js +2 -2
- package/dist/cjs/pm-plugins/fake-cursor-for-toolbar.js +0 -2
- package/dist/cjs/pm-plugins/input-rule.js +1 -4
- package/dist/cjs/pm-plugins/main.js +1 -6
- package/dist/cjs/ui/toolbar/Toolbar.js +2 -8
- package/dist/es2019/editor-commands/commands.js +1 -18
- package/dist/es2019/hyperlinkPlugin.js +2 -2
- package/dist/es2019/pm-plugins/fake-cursor-for-toolbar.js +0 -2
- package/dist/es2019/pm-plugins/input-rule.js +1 -4
- package/dist/es2019/pm-plugins/main.js +1 -6
- package/dist/es2019/ui/toolbar/Toolbar.js +2 -8
- package/dist/esm/editor-commands/commands.js +1 -18
- package/dist/esm/hyperlinkPlugin.js +2 -2
- package/dist/esm/pm-plugins/fake-cursor-for-toolbar.js +0 -2
- package/dist/esm/pm-plugins/input-rule.js +1 -4
- package/dist/esm/pm-plugins/main.js +1 -6
- package/dist/esm/ui/toolbar/Toolbar.js +2 -8
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-hyperlink
|
|
2
2
|
|
|
3
|
+
## 3.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#109060](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109060)
|
|
8
|
+
[`4660ec858a305`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4660ec858a305) -
|
|
9
|
+
Update `React` from v16 to v18
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 3.2.34
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#107473](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107473)
|
|
20
|
+
[`962b3297548df`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/962b3297548df) -
|
|
21
|
+
[ux] Implement variation 2 for editor contextual toolbar formatting experiment
|
|
22
|
+
|
|
3
23
|
## 3.2.33
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -26,8 +26,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
26
26
|
var _main = require("../pm-plugins/main");
|
|
27
27
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
28
|
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) { (0, _defineProperty2.default)(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; }
|
|
29
|
-
// Ignored via go/ees005
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
31
29
|
function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
32
30
|
return function (_ref) {
|
|
33
31
|
var tr = _ref.tr;
|
|
@@ -61,14 +59,9 @@ function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPresse
|
|
|
61
59
|
return tr;
|
|
62
60
|
};
|
|
63
61
|
}
|
|
64
|
-
|
|
65
|
-
// Ignored via go/ees005
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
67
62
|
function setLinkHref(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
68
63
|
return (0, _preset.editorCommandToPMCommand)(setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed));
|
|
69
64
|
}
|
|
70
|
-
// Ignored via go/ees005
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
72
65
|
function updateLinkEditorCommand(href, text, pos, to) {
|
|
73
66
|
return function (_ref2) {
|
|
74
67
|
var tr = _ref2.tr;
|
|
@@ -100,15 +93,9 @@ function updateLinkEditorCommand(href, text, pos, to) {
|
|
|
100
93
|
return tr;
|
|
101
94
|
};
|
|
102
95
|
}
|
|
103
|
-
|
|
104
|
-
// Ignored via go/ees005
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
106
96
|
function updateLink(href, text, pos, to) {
|
|
107
97
|
return (0, _preset.editorCommandToPMCommand)(updateLinkEditorCommand(href, text, pos, to));
|
|
108
98
|
}
|
|
109
|
-
|
|
110
|
-
// Ignored via go/ees005
|
|
111
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
112
99
|
function insertLink(from, to, incomingHref, incomingTitle, displayText, source, sourceEvent) {
|
|
113
100
|
var appearance = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 'inline';
|
|
114
101
|
var cardApiActions = arguments.length > 8 ? arguments[8] : undefined;
|
|
@@ -179,10 +166,7 @@ function insertLink(from, to, incomingHref, incomingTitle, displayText, source,
|
|
|
179
166
|
var insertLinkWithAnalytics = exports.insertLinkWithAnalytics = function insertLinkWithAnalytics(inputMethod, from, to, href, cardActions, editorAnalyticsApi, title, displayText) {
|
|
180
167
|
var cardsAvailable = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
181
168
|
var sourceEvent = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : undefined;
|
|
182
|
-
var appearance
|
|
183
|
-
// Ignored via go/ees005
|
|
184
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
185
|
-
= arguments.length > 10 ? arguments[10] : undefined;
|
|
169
|
+
var appearance = arguments.length > 10 ? arguments[10] : undefined;
|
|
186
170
|
// If smart cards are available, we send analytics for hyperlinks when a smart link is rejected.
|
|
187
171
|
if (cardsAvailable && !title && !displayText) {
|
|
188
172
|
return insertLink(from, to, href, title, displayText, inputMethod, sourceEvent, appearance, cardActions);
|
|
@@ -84,8 +84,6 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
84
84
|
},
|
|
85
85
|
actions: {
|
|
86
86
|
hideLinkToolbar: _commands.hideLinkToolbarSetMeta,
|
|
87
|
-
// Ignored via go/ees005
|
|
88
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
89
87
|
insertLink: function insertLink(inputMethod, from, to, href, title, displayText) {
|
|
90
88
|
var _api$card, _api$analytics3;
|
|
91
89
|
var cardsAvailable = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
@@ -178,6 +176,8 @@ var hyperlinkPlugin = exports.hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
178
176
|
var formatMessage = _ref5.formatMessage;
|
|
179
177
|
if ((0, _experiments.editorExperiment)('contextual_formatting_toolbar', true, {
|
|
180
178
|
exposure: true
|
|
179
|
+
}) || (0, _experiments.editorExperiment)('platform_editor_contextual_formatting_toolbar_v2', 'variant1', {
|
|
180
|
+
exposure: true
|
|
181
181
|
}) || (0, _experiments.editorExperiment)('platform_editor_contextual_formatting_toolbar_v2', 'variant2', {
|
|
182
182
|
exposure: true
|
|
183
183
|
})) {
|
|
@@ -36,8 +36,6 @@ var fakeCursorToolbarPlugin = new _safePlugin.SafePlugin({
|
|
|
36
36
|
init: function init() {
|
|
37
37
|
return _view.DecorationSet.empty;
|
|
38
38
|
},
|
|
39
|
-
// Ignored via go/ees005
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
41
39
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
42
40
|
var oldInsertToolbarState = getInsertLinkToolbarState(oldState);
|
|
43
41
|
var insertToolbarState = getInsertLinkToolbarState(newState);
|
|
@@ -19,8 +19,6 @@ var _toolbarButtons = require("./toolbar-buttons");
|
|
|
19
19
|
*/
|
|
20
20
|
function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
21
21
|
// Plain typed text (eg, typing 'www.google.com') should convert to a hyperlink
|
|
22
|
-
// Ignored via go/ees005
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
24
22
|
return (0, _utils.createRule)(regexp, function (state, match, start, end) {
|
|
25
23
|
var _toolbarKey$getState$, _toolbarKey$getState;
|
|
26
24
|
var schema = state.schema;
|
|
@@ -88,8 +86,7 @@ function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
88
86
|
var urlWithASpaceRule = createLinkInputRule(_utils.LinkMatcher.create(), editorAnalyticsApi);
|
|
89
87
|
|
|
90
88
|
// [something](link) should convert to a hyperlink
|
|
91
|
-
//
|
|
92
|
-
// eslint-disable-next-line require-unicode-regexp, @typescript-eslint/max-params
|
|
89
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
93
90
|
var markdownLinkRule = (0, _utils.createRule)(/(^|[^!])\[(.*?)\]\((\S+)\)$/, function (state, match, start, end) {
|
|
94
91
|
var _toolbarKey$getState$2, _toolbarKey$getState2;
|
|
95
92
|
var schema = state.schema;
|
|
@@ -158,10 +158,7 @@ var getActiveText = function getActiveText(selection) {
|
|
|
158
158
|
return;
|
|
159
159
|
};
|
|
160
160
|
var stateKey = exports.stateKey = new _state.PluginKey('hyperlinkPlugin');
|
|
161
|
-
var plugin = exports.plugin = function plugin(dispatch, intl, editorAppearance, pluginInjectionApi, onClickCallback, __livePage
|
|
162
|
-
// Ignored via go/ees005
|
|
163
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
164
|
-
) {
|
|
161
|
+
var plugin = exports.plugin = function plugin(dispatch, intl, editorAppearance, pluginInjectionApi, onClickCallback, __livePage) {
|
|
165
162
|
return new _safePlugin.SafePlugin({
|
|
166
163
|
state: {
|
|
167
164
|
init: function init(_, state) {
|
|
@@ -174,8 +171,6 @@ var plugin = exports.plugin = function plugin(dispatch, intl, editorAppearance,
|
|
|
174
171
|
editorAppearance: editorAppearance
|
|
175
172
|
};
|
|
176
173
|
},
|
|
177
|
-
// Ignored via go/ees005
|
|
178
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
179
174
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
180
175
|
var state = pluginState;
|
|
181
176
|
var action = tr.getMeta(stateKey) && tr.getMeta(stateKey).type;
|
|
@@ -31,10 +31,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
31
31
|
function isEditLink(linkMark) {
|
|
32
32
|
return linkMark.pos !== undefined;
|
|
33
33
|
}
|
|
34
|
-
var dispatchAnalytics = function dispatchAnalytics(dispatch, state, analyticsBuilder, editorAnalyticsApi
|
|
35
|
-
// Ignored via go/ees005
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
37
|
-
) {
|
|
34
|
+
var dispatchAnalytics = function dispatchAnalytics(dispatch, state, analyticsBuilder, editorAnalyticsApi) {
|
|
38
35
|
if (dispatch) {
|
|
39
36
|
var tr = state.tr;
|
|
40
37
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(analyticsBuilder(_analytics.ACTION_SUBJECT_ID.HYPERLINK))(tr);
|
|
@@ -234,10 +231,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
|
|
|
234
231
|
return view.focus();
|
|
235
232
|
},
|
|
236
233
|
onEscapeCallback: (0, _commands.onEscapeCallback)(editorCardActions),
|
|
237
|
-
onClickAwayCallback: _commands.onClickAwayCallback
|
|
238
|
-
// Ignored via go/ees005
|
|
239
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
240
|
-
,
|
|
234
|
+
onClickAwayCallback: _commands.onClickAwayCallback,
|
|
241
235
|
onSubmit: function onSubmit(href) {
|
|
242
236
|
var _toolbarKey$getState$, _toolbarKey$getState;
|
|
243
237
|
var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
@@ -6,9 +6,6 @@ import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
|
6
6
|
import { getLinkCreationAnalyticsEvent, normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { stateKey } from '../pm-plugins/main';
|
|
9
|
-
|
|
10
|
-
// Ignored via go/ees005
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
12
9
|
function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
13
10
|
return ({
|
|
14
11
|
tr
|
|
@@ -44,14 +41,9 @@ function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPresse
|
|
|
44
41
|
return tr;
|
|
45
42
|
};
|
|
46
43
|
}
|
|
47
|
-
|
|
48
|
-
// Ignored via go/ees005
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
50
44
|
export function setLinkHref(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
51
45
|
return editorCommandToPMCommand(setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed));
|
|
52
46
|
}
|
|
53
|
-
// Ignored via go/ees005
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
55
47
|
export function updateLinkEditorCommand(href, text, pos, to) {
|
|
56
48
|
return ({
|
|
57
49
|
tr
|
|
@@ -85,15 +77,9 @@ export function updateLinkEditorCommand(href, text, pos, to) {
|
|
|
85
77
|
return tr;
|
|
86
78
|
};
|
|
87
79
|
}
|
|
88
|
-
|
|
89
|
-
// Ignored via go/ees005
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
91
80
|
export function updateLink(href, text, pos, to) {
|
|
92
81
|
return editorCommandToPMCommand(updateLinkEditorCommand(href, text, pos, to));
|
|
93
82
|
}
|
|
94
|
-
|
|
95
|
-
// Ignored via go/ees005
|
|
96
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
97
83
|
export function insertLink(from, to, incomingHref, incomingTitle, displayText, source, sourceEvent, appearance = 'inline', cardApiActions) {
|
|
98
84
|
return (state, dispatch) => {
|
|
99
85
|
const link = state.schema.marks.link;
|
|
@@ -161,10 +147,7 @@ export function insertLink(from, to, incomingHref, incomingTitle, displayText, s
|
|
|
161
147
|
return false;
|
|
162
148
|
};
|
|
163
149
|
}
|
|
164
|
-
export const insertLinkWithAnalytics = (inputMethod, from, to, href, cardActions, editorAnalyticsApi, title, displayText, cardsAvailable = false, sourceEvent = undefined, appearance
|
|
165
|
-
// Ignored via go/ees005
|
|
166
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
167
|
-
) => {
|
|
150
|
+
export const insertLinkWithAnalytics = (inputMethod, from, to, href, cardActions, editorAnalyticsApi, title, displayText, cardsAvailable = false, sourceEvent = undefined, appearance) => {
|
|
168
151
|
// If smart cards are available, we send analytics for hyperlinks when a smart link is rejected.
|
|
169
152
|
if (cardsAvailable && !title && !displayText) {
|
|
170
153
|
return insertLink(from, to, href, title, displayText, inputMethod, sourceEvent, appearance, cardActions);
|
|
@@ -72,8 +72,6 @@ export const hyperlinkPlugin = ({
|
|
|
72
72
|
},
|
|
73
73
|
actions: {
|
|
74
74
|
hideLinkToolbar: hideLinkToolbarSetMeta,
|
|
75
|
-
// Ignored via go/ees005
|
|
76
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
77
75
|
insertLink: (inputMethod, from, to, href, title, displayText, cardsAvailable = false, sourceEvent = undefined, appearance) => {
|
|
78
76
|
var _api$card, _api$analytics3;
|
|
79
77
|
return insertLinkWithAnalytics(inputMethod, from, to, href, api === null || api === void 0 ? void 0 : (_api$card = api.card) === null || _api$card === void 0 ? void 0 : _api$card.actions, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, title, displayText, cardsAvailable, sourceEvent, appearance);
|
|
@@ -159,6 +157,8 @@ export const hyperlinkPlugin = ({
|
|
|
159
157
|
}) => {
|
|
160
158
|
if (editorExperiment('contextual_formatting_toolbar', true, {
|
|
161
159
|
exposure: true
|
|
160
|
+
}) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant1', {
|
|
161
|
+
exposure: true
|
|
162
162
|
}) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant2', {
|
|
163
163
|
exposure: true
|
|
164
164
|
})) {
|
|
@@ -28,8 +28,6 @@ const fakeCursorToolbarPlugin = new SafePlugin({
|
|
|
28
28
|
init() {
|
|
29
29
|
return DecorationSet.empty;
|
|
30
30
|
},
|
|
31
|
-
// Ignored via go/ees005
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
33
31
|
apply(tr, pluginState, oldState, newState) {
|
|
34
32
|
const oldInsertToolbarState = getInsertLinkToolbarState(oldState);
|
|
35
33
|
const insertToolbarState = getInsertLinkToolbarState(newState);
|
|
@@ -10,8 +10,6 @@ import { toolbarKey } from './toolbar-buttons';
|
|
|
10
10
|
*/
|
|
11
11
|
export function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
12
12
|
// Plain typed text (eg, typing 'www.google.com') should convert to a hyperlink
|
|
13
|
-
// Ignored via go/ees005
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
15
13
|
return createRule(regexp, (state, match, start, end) => {
|
|
16
14
|
var _toolbarKey$getState$, _toolbarKey$getState;
|
|
17
15
|
const {
|
|
@@ -81,8 +79,7 @@ export function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
81
79
|
const urlWithASpaceRule = createLinkInputRule(LinkMatcher.create(), editorAnalyticsApi);
|
|
82
80
|
|
|
83
81
|
// [something](link) should convert to a hyperlink
|
|
84
|
-
//
|
|
85
|
-
// eslint-disable-next-line require-unicode-regexp, @typescript-eslint/max-params
|
|
82
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
86
83
|
const markdownLinkRule = createRule(/(^|[^!])\[(.*?)\]\((\S+)\)$/, (state, match, start, end) => {
|
|
87
84
|
var _toolbarKey$getState$2, _toolbarKey$getState2;
|
|
88
85
|
const {
|
|
@@ -159,10 +159,7 @@ const getActiveText = selection => {
|
|
|
159
159
|
return;
|
|
160
160
|
};
|
|
161
161
|
export const stateKey = new PluginKey('hyperlinkPlugin');
|
|
162
|
-
export const plugin = (dispatch, intl, editorAppearance, pluginInjectionApi, onClickCallback, __livePage
|
|
163
|
-
// Ignored via go/ees005
|
|
164
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
165
|
-
) => new SafePlugin({
|
|
162
|
+
export const plugin = (dispatch, intl, editorAppearance, pluginInjectionApi, onClickCallback, __livePage) => new SafePlugin({
|
|
166
163
|
state: {
|
|
167
164
|
init(_, state) {
|
|
168
165
|
const canInsertLink = canLinkBeCreatedInRange(state.selection.from, state.selection.to)(state);
|
|
@@ -174,8 +171,6 @@ export const plugin = (dispatch, intl, editorAppearance, pluginInjectionApi, onC
|
|
|
174
171
|
editorAppearance
|
|
175
172
|
};
|
|
176
173
|
},
|
|
177
|
-
// Ignored via go/ees005
|
|
178
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
179
174
|
apply(tr, pluginState, oldState, newState) {
|
|
180
175
|
let state = pluginState;
|
|
181
176
|
const action = tr.getMeta(stateKey) && tr.getMeta(stateKey).type;
|
|
@@ -20,10 +20,7 @@ import { toolbarKey } from '../../pm-plugins/toolbar-buttons';
|
|
|
20
20
|
function isEditLink(linkMark) {
|
|
21
21
|
return linkMark.pos !== undefined;
|
|
22
22
|
}
|
|
23
|
-
const dispatchAnalytics = (dispatch, state, analyticsBuilder, editorAnalyticsApi
|
|
24
|
-
// Ignored via go/ees005
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
26
|
-
) => {
|
|
23
|
+
const dispatchAnalytics = (dispatch, state, analyticsBuilder, editorAnalyticsApi) => {
|
|
27
24
|
if (dispatch) {
|
|
28
25
|
const {
|
|
29
26
|
tr
|
|
@@ -223,10 +220,7 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
|
|
|
223
220
|
providerFactory: providerFactory,
|
|
224
221
|
onCancel: () => view.focus(),
|
|
225
222
|
onEscapeCallback: onEscapeCallback(editorCardActions),
|
|
226
|
-
onClickAwayCallback: onClickAwayCallback
|
|
227
|
-
// Ignored via go/ees005
|
|
228
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
229
|
-
,
|
|
223
|
+
onClickAwayCallback: onClickAwayCallback,
|
|
230
224
|
onSubmit: (href, title = '', displayText, inputMethod, analytic) => {
|
|
231
225
|
var _toolbarKey$getState$, _toolbarKey$getState;
|
|
232
226
|
const isEdit = isEditLink(activeLinkMark);
|
|
@@ -9,9 +9,6 @@ import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
|
9
9
|
import { getLinkCreationAnalyticsEvent, normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
11
11
|
import { stateKey } from '../pm-plugins/main';
|
|
12
|
-
|
|
13
|
-
// Ignored via go/ees005
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
15
12
|
function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
16
13
|
return function (_ref) {
|
|
17
14
|
var tr = _ref.tr;
|
|
@@ -45,14 +42,9 @@ function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPresse
|
|
|
45
42
|
return tr;
|
|
46
43
|
};
|
|
47
44
|
}
|
|
48
|
-
|
|
49
|
-
// Ignored via go/ees005
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
51
45
|
export function setLinkHref(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
52
46
|
return editorCommandToPMCommand(setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed));
|
|
53
47
|
}
|
|
54
|
-
// Ignored via go/ees005
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
56
48
|
export function updateLinkEditorCommand(href, text, pos, to) {
|
|
57
49
|
return function (_ref2) {
|
|
58
50
|
var tr = _ref2.tr;
|
|
@@ -84,15 +76,9 @@ export function updateLinkEditorCommand(href, text, pos, to) {
|
|
|
84
76
|
return tr;
|
|
85
77
|
};
|
|
86
78
|
}
|
|
87
|
-
|
|
88
|
-
// Ignored via go/ees005
|
|
89
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
90
79
|
export function updateLink(href, text, pos, to) {
|
|
91
80
|
return editorCommandToPMCommand(updateLinkEditorCommand(href, text, pos, to));
|
|
92
81
|
}
|
|
93
|
-
|
|
94
|
-
// Ignored via go/ees005
|
|
95
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
96
82
|
export function insertLink(from, to, incomingHref, incomingTitle, displayText, source, sourceEvent) {
|
|
97
83
|
var appearance = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 'inline';
|
|
98
84
|
var cardApiActions = arguments.length > 8 ? arguments[8] : undefined;
|
|
@@ -163,10 +149,7 @@ export function insertLink(from, to, incomingHref, incomingTitle, displayText, s
|
|
|
163
149
|
export var insertLinkWithAnalytics = function insertLinkWithAnalytics(inputMethod, from, to, href, cardActions, editorAnalyticsApi, title, displayText) {
|
|
164
150
|
var cardsAvailable = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
165
151
|
var sourceEvent = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : undefined;
|
|
166
|
-
var appearance
|
|
167
|
-
// Ignored via go/ees005
|
|
168
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
169
|
-
= arguments.length > 10 ? arguments[10] : undefined;
|
|
152
|
+
var appearance = arguments.length > 10 ? arguments[10] : undefined;
|
|
170
153
|
// If smart cards are available, we send analytics for hyperlinks when a smart link is rejected.
|
|
171
154
|
if (cardsAvailable && !title && !displayText) {
|
|
172
155
|
return insertLink(from, to, href, title, displayText, inputMethod, sourceEvent, appearance, cardActions);
|
|
@@ -77,8 +77,6 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
77
77
|
},
|
|
78
78
|
actions: {
|
|
79
79
|
hideLinkToolbar: hideLinkToolbarSetMeta,
|
|
80
|
-
// Ignored via go/ees005
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
82
80
|
insertLink: function insertLink(inputMethod, from, to, href, title, displayText) {
|
|
83
81
|
var _api$card, _api$analytics3;
|
|
84
82
|
var cardsAvailable = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
@@ -171,6 +169,8 @@ export var hyperlinkPlugin = function hyperlinkPlugin(_ref) {
|
|
|
171
169
|
var formatMessage = _ref5.formatMessage;
|
|
172
170
|
if (editorExperiment('contextual_formatting_toolbar', true, {
|
|
173
171
|
exposure: true
|
|
172
|
+
}) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant1', {
|
|
173
|
+
exposure: true
|
|
174
174
|
}) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant2', {
|
|
175
175
|
exposure: true
|
|
176
176
|
})) {
|
|
@@ -30,8 +30,6 @@ var fakeCursorToolbarPlugin = new SafePlugin({
|
|
|
30
30
|
init: function init() {
|
|
31
31
|
return DecorationSet.empty;
|
|
32
32
|
},
|
|
33
|
-
// Ignored via go/ees005
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
35
33
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
36
34
|
var oldInsertToolbarState = getInsertLinkToolbarState(oldState);
|
|
37
35
|
var insertToolbarState = getInsertLinkToolbarState(newState);
|
|
@@ -11,8 +11,6 @@ import { toolbarKey } from './toolbar-buttons';
|
|
|
11
11
|
*/
|
|
12
12
|
export function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
13
13
|
// Plain typed text (eg, typing 'www.google.com') should convert to a hyperlink
|
|
14
|
-
// Ignored via go/ees005
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
16
14
|
return createRule(regexp, function (state, match, start, end) {
|
|
17
15
|
var _toolbarKey$getState$, _toolbarKey$getState;
|
|
18
16
|
var schema = state.schema;
|
|
@@ -80,8 +78,7 @@ export function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
80
78
|
var urlWithASpaceRule = createLinkInputRule(LinkMatcher.create(), editorAnalyticsApi);
|
|
81
79
|
|
|
82
80
|
// [something](link) should convert to a hyperlink
|
|
83
|
-
//
|
|
84
|
-
// eslint-disable-next-line require-unicode-regexp, @typescript-eslint/max-params
|
|
81
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
85
82
|
var markdownLinkRule = createRule(/(^|[^!])\[(.*?)\]\((\S+)\)$/, function (state, match, start, end) {
|
|
86
83
|
var _toolbarKey$getState$2, _toolbarKey$getState2;
|
|
87
84
|
var schema = state.schema;
|
|
@@ -151,10 +151,7 @@ var getActiveText = function getActiveText(selection) {
|
|
|
151
151
|
return;
|
|
152
152
|
};
|
|
153
153
|
export var stateKey = new PluginKey('hyperlinkPlugin');
|
|
154
|
-
export var plugin = function plugin(dispatch, intl, editorAppearance, pluginInjectionApi, onClickCallback, __livePage
|
|
155
|
-
// Ignored via go/ees005
|
|
156
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
157
|
-
) {
|
|
154
|
+
export var plugin = function plugin(dispatch, intl, editorAppearance, pluginInjectionApi, onClickCallback, __livePage) {
|
|
158
155
|
return new SafePlugin({
|
|
159
156
|
state: {
|
|
160
157
|
init: function init(_, state) {
|
|
@@ -167,8 +164,6 @@ export var plugin = function plugin(dispatch, intl, editorAppearance, pluginInje
|
|
|
167
164
|
editorAppearance: editorAppearance
|
|
168
165
|
};
|
|
169
166
|
},
|
|
170
|
-
// Ignored via go/ees005
|
|
171
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
172
167
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
173
168
|
var state = pluginState;
|
|
174
169
|
var action = tr.getMeta(stateKey) && tr.getMeta(stateKey).type;
|
|
@@ -24,10 +24,7 @@ import { toolbarKey } from '../../pm-plugins/toolbar-buttons';
|
|
|
24
24
|
function isEditLink(linkMark) {
|
|
25
25
|
return linkMark.pos !== undefined;
|
|
26
26
|
}
|
|
27
|
-
var dispatchAnalytics = function dispatchAnalytics(dispatch, state, analyticsBuilder, editorAnalyticsApi
|
|
28
|
-
// Ignored via go/ees005
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
30
|
-
) {
|
|
27
|
+
var dispatchAnalytics = function dispatchAnalytics(dispatch, state, analyticsBuilder, editorAnalyticsApi) {
|
|
31
28
|
if (dispatch) {
|
|
32
29
|
var tr = state.tr;
|
|
33
30
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(analyticsBuilder(ACTION_SUBJECT_ID.HYPERLINK))(tr);
|
|
@@ -227,10 +224,7 @@ export var getToolbarConfig = function getToolbarConfig(options, pluginInjection
|
|
|
227
224
|
return view.focus();
|
|
228
225
|
},
|
|
229
226
|
onEscapeCallback: onEscapeCallback(editorCardActions),
|
|
230
|
-
onClickAwayCallback: onClickAwayCallback
|
|
231
|
-
// Ignored via go/ees005
|
|
232
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
233
|
-
,
|
|
227
|
+
onClickAwayCallback: onClickAwayCallback,
|
|
234
228
|
onSubmit: function onSubmit(href) {
|
|
235
229
|
var _toolbarKey$getState$, _toolbarKey$getState;
|
|
236
230
|
var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-hyperlink",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Hyperlink plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
35
|
-
"@atlaskit/analytics-next": "^10.
|
|
36
|
-
"@atlaskit/editor-common": "^99.
|
|
35
|
+
"@atlaskit/analytics-next": "^10.3.0",
|
|
36
|
+
"@atlaskit/editor-common": "^99.6.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.11.0",
|
|
38
|
-
"@atlaskit/editor-plugin-card": "4.5.
|
|
38
|
+
"@atlaskit/editor-plugin-card": "4.5.17",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
41
|
-
"@atlaskit/icon": "^23.
|
|
41
|
+
"@atlaskit/icon": "^23.5.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
43
43
|
"@atlaskit/prosemirror-input-rules": "^3.2.0",
|
|
44
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
44
|
+
"@atlaskit/tmp-editor-statsig": "^2.41.0",
|
|
45
45
|
"@babel/runtime": "^7.0.0",
|
|
46
46
|
"uuid": "^3.1.0"
|
|
47
47
|
},
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@atlaskit/activity-provider": "^2.5.0",
|
|
55
|
-
"@atlaskit/link-test-helpers": "^7.
|
|
56
|
-
"@atlaskit/media-test-helpers": "^34.
|
|
55
|
+
"@atlaskit/link-test-helpers": "^7.6.0",
|
|
56
|
+
"@atlaskit/media-test-helpers": "^34.8.0",
|
|
57
57
|
"@atlaskit/ssr": "*",
|
|
58
|
-
"@atlaskit/util-data-test": "^
|
|
58
|
+
"@atlaskit/util-data-test": "^18.0.0",
|
|
59
59
|
"@atlaskit/visual-regression": "*",
|
|
60
|
-
"@testing-library/react": "^
|
|
60
|
+
"@testing-library/react": "^13.4.0",
|
|
61
61
|
"raf-stub": "^2.0.1",
|
|
62
62
|
"typescript": "~5.4.2",
|
|
63
63
|
"wait-for-expect": "^1.2.0"
|