@atlaskit/editor-plugin-hyperlink 3.2.26 → 3.2.28
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/editor-commands/commands.js +21 -2
- package/dist/cjs/hyperlinkPlugin.js +2 -0
- package/dist/cjs/pm-plugins/fake-cursor-for-toolbar.js +2 -0
- package/dist/cjs/pm-plugins/input-rule.js +5 -2
- package/dist/cjs/pm-plugins/keymap.js +18 -3
- package/dist/cjs/pm-plugins/main.js +10 -1
- package/dist/cjs/ui/toolbar/Toolbar.js +8 -2
- package/dist/es2019/editor-commands/commands.js +22 -2
- package/dist/es2019/hyperlinkPlugin.js +2 -0
- package/dist/es2019/pm-plugins/fake-cursor-for-toolbar.js +2 -0
- package/dist/es2019/pm-plugins/input-rule.js +5 -2
- package/dist/es2019/pm-plugins/keymap.js +18 -3
- package/dist/es2019/pm-plugins/main.js +10 -1
- package/dist/es2019/ui/toolbar/Toolbar.js +11 -3
- package/dist/esm/editor-commands/commands.js +22 -2
- package/dist/esm/hyperlinkPlugin.js +2 -0
- package/dist/esm/pm-plugins/fake-cursor-for-toolbar.js +2 -0
- package/dist/esm/pm-plugins/input-rule.js +5 -2
- package/dist/esm/pm-plugins/keymap.js +18 -3
- package/dist/esm/pm-plugins/main.js +10 -1
- package/dist/esm/ui/toolbar/Toolbar.js +8 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -26,6 +26,8 @@ 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
|
|
29
31
|
function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
30
32
|
return function (_ref) {
|
|
31
33
|
var tr = _ref.tr;
|
|
@@ -59,9 +61,14 @@ function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPresse
|
|
|
59
61
|
return tr;
|
|
60
62
|
};
|
|
61
63
|
}
|
|
64
|
+
|
|
65
|
+
// Ignored via go/ees005
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
62
67
|
function setLinkHref(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
63
68
|
return (0, _preset.editorCommandToPMCommand)(setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed));
|
|
64
69
|
}
|
|
70
|
+
// Ignored via go/ees005
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
65
72
|
function updateLinkEditorCommand(href, text, pos, to) {
|
|
66
73
|
return function (_ref2) {
|
|
67
74
|
var tr = _ref2.tr;
|
|
@@ -93,9 +100,15 @@ function updateLinkEditorCommand(href, text, pos, to) {
|
|
|
93
100
|
return tr;
|
|
94
101
|
};
|
|
95
102
|
}
|
|
103
|
+
|
|
104
|
+
// Ignored via go/ees005
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
96
106
|
function updateLink(href, text, pos, to) {
|
|
97
107
|
return (0, _preset.editorCommandToPMCommand)(updateLinkEditorCommand(href, text, pos, to));
|
|
98
108
|
}
|
|
109
|
+
|
|
110
|
+
// Ignored via go/ees005
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
99
112
|
function insertLink(from, to, incomingHref, incomingTitle, displayText, source, sourceEvent) {
|
|
100
113
|
var appearance = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 'inline';
|
|
101
114
|
var cardApiActions = arguments.length > 8 ? arguments[8] : undefined;
|
|
@@ -125,7 +138,10 @@ function insertLink(from, to, incomingHref, incomingTitle, displayText, source,
|
|
|
125
138
|
if (!displayText || displayText === incomingHref) {
|
|
126
139
|
var queueCardsFromChangedTr = cardApiActions === null || cardApiActions === void 0 ? void 0 : cardApiActions.queueCardsFromChangedTr;
|
|
127
140
|
if (queueCardsFromChangedTr) {
|
|
128
|
-
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr,
|
|
141
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr,
|
|
142
|
+
// Ignored via go/ees005
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
144
|
+
source, _analytics.ACTION.INSERTED, false, sourceEvent, appearance);
|
|
129
145
|
} else {
|
|
130
146
|
(0, _card.addLinkMetadata)(state.selection, tr, {
|
|
131
147
|
action: _analytics.ACTION.INSERTED,
|
|
@@ -163,7 +179,10 @@ function insertLink(from, to, incomingHref, incomingTitle, displayText, source,
|
|
|
163
179
|
var insertLinkWithAnalytics = exports.insertLinkWithAnalytics = function insertLinkWithAnalytics(inputMethod, from, to, href, cardActions, editorAnalyticsApi, title, displayText) {
|
|
164
180
|
var cardsAvailable = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
165
181
|
var sourceEvent = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : undefined;
|
|
166
|
-
var appearance
|
|
182
|
+
var appearance
|
|
183
|
+
// Ignored via go/ees005
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
185
|
+
= arguments.length > 10 ? arguments[10] : undefined;
|
|
167
186
|
// If smart cards are available, we send analytics for hyperlinks when a smart link is rejected.
|
|
168
187
|
if (cardsAvailable && !title && !displayText) {
|
|
169
188
|
return insertLink(from, to, href, title, displayText, inputMethod, sourceEvent, appearance, cardActions);
|
|
@@ -84,6 +84,8 @@ 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
|
|
87
89
|
insertLink: function insertLink(inputMethod, from, to, href, title, displayText) {
|
|
88
90
|
var _api$card, _api$analytics3;
|
|
89
91
|
var cardsAvailable = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
@@ -36,6 +36,8 @@ 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
|
|
39
41
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
40
42
|
var oldInsertToolbarState = getInsertLinkToolbarState(oldState);
|
|
41
43
|
var insertToolbarState = getInsertLinkToolbarState(newState);
|
|
@@ -19,6 +19,8 @@ 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
|
|
22
24
|
return (0, _utils.createRule)(regexp, function (state, match, start, end) {
|
|
23
25
|
var _toolbarKey$getState$, _toolbarKey$getState;
|
|
24
26
|
var schema = state.schema;
|
|
@@ -26,7 +28,6 @@ function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
|
26
28
|
return null;
|
|
27
29
|
}
|
|
28
30
|
var link = match;
|
|
29
|
-
var url;
|
|
30
31
|
|
|
31
32
|
// Property 'url' does not exist on type 'RegExpExecArray', the type of `match`.
|
|
32
33
|
// This check is in case the match is not a Linkify match, which has a url property.
|
|
@@ -36,7 +37,7 @@ function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
|
36
37
|
if (!(0, _utils.shouldAutoLinkifyMatch)(link)) {
|
|
37
38
|
return null;
|
|
38
39
|
}
|
|
39
|
-
url = (0, _utils.normalizeUrl)(link.url);
|
|
40
|
+
var url = (0, _utils.normalizeUrl)(link.url);
|
|
40
41
|
|
|
41
42
|
// Not previously handled; don't create a link if the URL is empty.
|
|
42
43
|
// This will only happen if the `regexp` matches more links than the normalizeUrl validation;
|
|
@@ -87,6 +88,8 @@ function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
87
88
|
var urlWithASpaceRule = createLinkInputRule(_utils.LinkMatcher.create(), editorAnalyticsApi);
|
|
88
89
|
|
|
89
90
|
// [something](link) should convert to a hyperlink
|
|
91
|
+
// Ignored via go/ees005
|
|
92
|
+
// eslint-disable-next-line require-unicode-regexp, @typescript-eslint/max-params
|
|
90
93
|
var markdownLinkRule = (0, _utils.createRule)(/(^|[^!])\[(.*?)\]\((\S+)\)$/, function (state, match, start, end) {
|
|
91
94
|
var _toolbarKey$getState$2, _toolbarKey$getState2;
|
|
92
95
|
var schema = state.schema;
|
|
@@ -16,10 +16,22 @@ var _main = require("../pm-plugins/main");
|
|
|
16
16
|
var _toolbarButtons = require("./toolbar-buttons");
|
|
17
17
|
function createKeymapPlugin(editorAnalyticsApi) {
|
|
18
18
|
var list = {};
|
|
19
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
19
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
20
|
+
// Ignored via go/ees005
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
22
|
+
_keymaps.addLink.common, (0, _commands.showLinkToolbar)(_analytics.INPUT_METHOD.SHORTCUT, editorAnalyticsApi), list);
|
|
23
|
+
|
|
24
|
+
// Ignored via go/ees005
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
26
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.enter.common, mayConvertLastWordToHyperlink(editorAnalyticsApi), list);
|
|
21
|
-
(0, _keymaps.bindKeymapWithCommand)(
|
|
22
|
-
|
|
27
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
28
|
+
// Ignored via go/ees005
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
30
|
+
_keymaps.insertNewLine.common, mayConvertLastWordToHyperlink(editorAnalyticsApi), list);
|
|
31
|
+
(0, _keymaps.bindKeymapWithCommand)(
|
|
32
|
+
// Ignored via go/ees005
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
34
|
+
_keymaps.escape.common, function (state, dispatch, view) {
|
|
23
35
|
var hyperlinkPlugin = _main.stateKey.getState(state);
|
|
24
36
|
if (hyperlinkPlugin.activeLinkMark) {
|
|
25
37
|
(0, _commands.hideLinkToolbar)()(state, dispatch);
|
|
@@ -44,6 +56,9 @@ var mayConvertLastWordToHyperlink = function mayConvertLastWordToHyperlink(edito
|
|
|
44
56
|
if (!nodeBefore || !nodeBefore.isText || !nodeBefore.text) {
|
|
45
57
|
return false;
|
|
46
58
|
}
|
|
59
|
+
|
|
60
|
+
// Ignored via go/ees005
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
47
62
|
var words = nodeBefore.text.split(' ');
|
|
48
63
|
var lastWord = words[words.length - 1];
|
|
49
64
|
var match = (0, _adfSchema.getLinkMatch)(lastWord);
|
|
@@ -158,7 +158,10 @@ 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
|
|
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
|
+
) {
|
|
162
165
|
return new _safePlugin.SafePlugin({
|
|
163
166
|
state: {
|
|
164
167
|
init: function init(_, state) {
|
|
@@ -171,6 +174,8 @@ var plugin = exports.plugin = function plugin(dispatch, intl, editorAppearance,
|
|
|
171
174
|
editorAppearance: editorAppearance
|
|
172
175
|
};
|
|
173
176
|
},
|
|
177
|
+
// Ignored via go/ees005
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
174
179
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
175
180
|
var state = pluginState;
|
|
176
181
|
var action = tr.getMeta(stateKey) && tr.getMeta(stateKey).type;
|
|
@@ -294,6 +299,8 @@ var plugin = exports.plugin = function plugin(dispatch, intl, editorAppearance,
|
|
|
294
299
|
}
|
|
295
300
|
},
|
|
296
301
|
handleDOMEvents: {
|
|
302
|
+
// Ignored via go/ees005
|
|
303
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
297
304
|
mouseup: function mouseup(_, event) {
|
|
298
305
|
// this prevents redundant selection transaction when clicking on link
|
|
299
306
|
// link state will be update on slection change which happens on mousedown
|
|
@@ -303,6 +310,8 @@ var plugin = exports.plugin = function plugin(dispatch, intl, editorAppearance,
|
|
|
303
310
|
}
|
|
304
311
|
return false;
|
|
305
312
|
},
|
|
313
|
+
// Ignored via go/ees005
|
|
314
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
306
315
|
mousedown: function mousedown(view, event) {
|
|
307
316
|
// since link clicks are disallowed by browsers inside contenteditable
|
|
308
317
|
// so we need to handle shift+click selection ourselves in this case
|
|
@@ -31,7 +31,10 @@ 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
|
|
34
|
+
var dispatchAnalytics = function dispatchAnalytics(dispatch, state, analyticsBuilder, editorAnalyticsApi
|
|
35
|
+
// Ignored via go/ees005
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
37
|
+
) {
|
|
35
38
|
if (dispatch) {
|
|
36
39
|
var tr = state.tr;
|
|
37
40
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(analyticsBuilder(_analytics.ACTION_SUBJECT_ID.HYPERLINK))(tr);
|
|
@@ -231,7 +234,10 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(opti
|
|
|
231
234
|
return view.focus();
|
|
232
235
|
},
|
|
233
236
|
onEscapeCallback: (0, _commands.onEscapeCallback)(editorCardActions),
|
|
234
|
-
onClickAwayCallback: _commands.onClickAwayCallback
|
|
237
|
+
onClickAwayCallback: _commands.onClickAwayCallback
|
|
238
|
+
// Ignored via go/ees005
|
|
239
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
240
|
+
,
|
|
235
241
|
onSubmit: function onSubmit(href) {
|
|
236
242
|
var _toolbarKey$getState$, _toolbarKey$getState;
|
|
237
243
|
var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
@@ -6,6 +6,9 @@ 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
|
|
9
12
|
function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
10
13
|
return ({
|
|
11
14
|
tr
|
|
@@ -41,9 +44,14 @@ function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPresse
|
|
|
41
44
|
return tr;
|
|
42
45
|
};
|
|
43
46
|
}
|
|
47
|
+
|
|
48
|
+
// Ignored via go/ees005
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
44
50
|
export function setLinkHref(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
45
51
|
return editorCommandToPMCommand(setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed));
|
|
46
52
|
}
|
|
53
|
+
// Ignored via go/ees005
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
47
55
|
export function updateLinkEditorCommand(href, text, pos, to) {
|
|
48
56
|
return ({
|
|
49
57
|
tr
|
|
@@ -77,9 +85,15 @@ export function updateLinkEditorCommand(href, text, pos, to) {
|
|
|
77
85
|
return tr;
|
|
78
86
|
};
|
|
79
87
|
}
|
|
88
|
+
|
|
89
|
+
// Ignored via go/ees005
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
80
91
|
export function updateLink(href, text, pos, to) {
|
|
81
92
|
return editorCommandToPMCommand(updateLinkEditorCommand(href, text, pos, to));
|
|
82
93
|
}
|
|
94
|
+
|
|
95
|
+
// Ignored via go/ees005
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
83
97
|
export function insertLink(from, to, incomingHref, incomingTitle, displayText, source, sourceEvent, appearance = 'inline', cardApiActions) {
|
|
84
98
|
return (state, dispatch) => {
|
|
85
99
|
const link = state.schema.marks.link;
|
|
@@ -109,7 +123,10 @@ export function insertLink(from, to, incomingHref, incomingTitle, displayText, s
|
|
|
109
123
|
if (!displayText || displayText === incomingHref) {
|
|
110
124
|
const queueCardsFromChangedTr = cardApiActions === null || cardApiActions === void 0 ? void 0 : cardApiActions.queueCardsFromChangedTr;
|
|
111
125
|
if (queueCardsFromChangedTr) {
|
|
112
|
-
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, tr,
|
|
126
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 ? void 0 : queueCardsFromChangedTr(state, tr,
|
|
127
|
+
// Ignored via go/ees005
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
129
|
+
source, ACTION.INSERTED, false, sourceEvent, appearance);
|
|
113
130
|
} else {
|
|
114
131
|
addLinkMetadata(state.selection, tr, {
|
|
115
132
|
action: ACTION.INSERTED,
|
|
@@ -144,7 +161,10 @@ export function insertLink(from, to, incomingHref, incomingTitle, displayText, s
|
|
|
144
161
|
return false;
|
|
145
162
|
};
|
|
146
163
|
}
|
|
147
|
-
export const insertLinkWithAnalytics = (inputMethod, from, to, href, cardActions, editorAnalyticsApi, title, displayText, cardsAvailable = false, sourceEvent = undefined, appearance
|
|
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
|
+
) => {
|
|
148
168
|
// If smart cards are available, we send analytics for hyperlinks when a smart link is rejected.
|
|
149
169
|
if (cardsAvailable && !title && !displayText) {
|
|
150
170
|
return insertLink(from, to, href, title, displayText, inputMethod, sourceEvent, appearance, cardActions);
|
|
@@ -72,6 +72,8 @@ 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
|
|
75
77
|
insertLink: (inputMethod, from, to, href, title, displayText, cardsAvailable = false, sourceEvent = undefined, appearance) => {
|
|
76
78
|
var _api$card, _api$analytics3;
|
|
77
79
|
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);
|
|
@@ -28,6 +28,8 @@ 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
|
|
31
33
|
apply(tr, pluginState, oldState, newState) {
|
|
32
34
|
const oldInsertToolbarState = getInsertLinkToolbarState(oldState);
|
|
33
35
|
const insertToolbarState = getInsertLinkToolbarState(newState);
|
|
@@ -10,6 +10,8 @@ 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
|
|
13
15
|
return createRule(regexp, (state, match, start, end) => {
|
|
14
16
|
var _toolbarKey$getState$, _toolbarKey$getState;
|
|
15
17
|
const {
|
|
@@ -19,7 +21,6 @@ export function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
|
19
21
|
return null;
|
|
20
22
|
}
|
|
21
23
|
const link = match;
|
|
22
|
-
let url;
|
|
23
24
|
|
|
24
25
|
// Property 'url' does not exist on type 'RegExpExecArray', the type of `match`.
|
|
25
26
|
// This check is in case the match is not a Linkify match, which has a url property.
|
|
@@ -29,7 +30,7 @@ export function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
|
29
30
|
if (!shouldAutoLinkifyMatch(link)) {
|
|
30
31
|
return null;
|
|
31
32
|
}
|
|
32
|
-
url = normalizeUrl(link.url);
|
|
33
|
+
const url = normalizeUrl(link.url);
|
|
33
34
|
|
|
34
35
|
// Not previously handled; don't create a link if the URL is empty.
|
|
35
36
|
// This will only happen if the `regexp` matches more links than the normalizeUrl validation;
|
|
@@ -80,6 +81,8 @@ export function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
80
81
|
const urlWithASpaceRule = createLinkInputRule(LinkMatcher.create(), editorAnalyticsApi);
|
|
81
82
|
|
|
82
83
|
// [something](link) should convert to a hyperlink
|
|
84
|
+
// Ignored via go/ees005
|
|
85
|
+
// eslint-disable-next-line require-unicode-regexp, @typescript-eslint/max-params
|
|
83
86
|
const markdownLinkRule = createRule(/(^|[^!])\[(.*?)\]\((\S+)\)$/, (state, match, start, end) => {
|
|
84
87
|
var _toolbarKey$getState$2, _toolbarKey$getState2;
|
|
85
88
|
const {
|
|
@@ -9,10 +9,22 @@ import { stateKey } from '../pm-plugins/main';
|
|
|
9
9
|
import { toolbarKey } from './toolbar-buttons';
|
|
10
10
|
export function createKeymapPlugin(editorAnalyticsApi) {
|
|
11
11
|
const list = {};
|
|
12
|
-
bindKeymapWithEditorCommand(
|
|
12
|
+
bindKeymapWithEditorCommand(
|
|
13
|
+
// Ignored via go/ees005
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
15
|
+
addLink.common, showLinkToolbar(INPUT_METHOD.SHORTCUT, editorAnalyticsApi), list);
|
|
16
|
+
|
|
17
|
+
// Ignored via go/ees005
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
13
19
|
bindKeymapWithCommand(enter.common, mayConvertLastWordToHyperlink(editorAnalyticsApi), list);
|
|
14
|
-
bindKeymapWithCommand(
|
|
15
|
-
|
|
20
|
+
bindKeymapWithCommand(
|
|
21
|
+
// Ignored via go/ees005
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
23
|
+
insertNewLine.common, mayConvertLastWordToHyperlink(editorAnalyticsApi), list);
|
|
24
|
+
bindKeymapWithCommand(
|
|
25
|
+
// Ignored via go/ees005
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
27
|
+
escape.common, (state, dispatch, view) => {
|
|
16
28
|
const hyperlinkPlugin = stateKey.getState(state);
|
|
17
29
|
if (hyperlinkPlugin.activeLinkMark) {
|
|
18
30
|
hideLinkToolbar()(state, dispatch);
|
|
@@ -37,6 +49,9 @@ const mayConvertLastWordToHyperlink = editorAnalyticsApi => {
|
|
|
37
49
|
if (!nodeBefore || !nodeBefore.isText || !nodeBefore.text) {
|
|
38
50
|
return false;
|
|
39
51
|
}
|
|
52
|
+
|
|
53
|
+
// Ignored via go/ees005
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
40
55
|
const words = nodeBefore.text.split(' ');
|
|
41
56
|
const lastWord = words[words.length - 1];
|
|
42
57
|
const match = getLinkMatch(lastWord);
|
|
@@ -159,7 +159,10 @@ 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
|
|
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({
|
|
163
166
|
state: {
|
|
164
167
|
init(_, state) {
|
|
165
168
|
const canInsertLink = canLinkBeCreatedInRange(state.selection.from, state.selection.to)(state);
|
|
@@ -171,6 +174,8 @@ export const plugin = (dispatch, intl, editorAppearance, pluginInjectionApi, onC
|
|
|
171
174
|
editorAppearance
|
|
172
175
|
};
|
|
173
176
|
},
|
|
177
|
+
// Ignored via go/ees005
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
174
179
|
apply(tr, pluginState, oldState, newState) {
|
|
175
180
|
let state = pluginState;
|
|
176
181
|
const action = tr.getMeta(stateKey) && tr.getMeta(stateKey).type;
|
|
@@ -298,6 +303,8 @@ export const plugin = (dispatch, intl, editorAppearance, pluginInjectionApi, onC
|
|
|
298
303
|
}
|
|
299
304
|
},
|
|
300
305
|
handleDOMEvents: {
|
|
306
|
+
// Ignored via go/ees005
|
|
307
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
301
308
|
mouseup: (_, event) => {
|
|
302
309
|
// this prevents redundant selection transaction when clicking on link
|
|
303
310
|
// link state will be update on slection change which happens on mousedown
|
|
@@ -307,6 +314,8 @@ export const plugin = (dispatch, intl, editorAppearance, pluginInjectionApi, onC
|
|
|
307
314
|
}
|
|
308
315
|
return false;
|
|
309
316
|
},
|
|
317
|
+
// Ignored via go/ees005
|
|
318
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
310
319
|
mousedown: (view, event) => {
|
|
311
320
|
// since link clicks are disallowed by browsers inside contenteditable
|
|
312
321
|
// so we need to handle shift+click selection ourselves in this case
|
|
@@ -20,7 +20,10 @@ 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
|
|
23
|
+
const dispatchAnalytics = (dispatch, state, analyticsBuilder, editorAnalyticsApi
|
|
24
|
+
// Ignored via go/ees005
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
26
|
+
) => {
|
|
24
27
|
if (dispatch) {
|
|
25
28
|
const {
|
|
26
29
|
tr
|
|
@@ -59,6 +62,8 @@ export function HyperlinkAddToolbarWithState({
|
|
|
59
62
|
onEscapeCallback,
|
|
60
63
|
onClickAwayCallback,
|
|
61
64
|
pluginInjectionApi
|
|
65
|
+
// Ignored via go/ees005
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
67
|
}) {
|
|
63
68
|
const {
|
|
64
69
|
hyperlinkState
|
|
@@ -119,7 +124,7 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
|
|
|
119
124
|
// TODO: ED-14403 investigate why these are not translating?
|
|
120
125
|
const labelUnlink = formatMessage(linkToolbarCommonMessages.unlink);
|
|
121
126
|
const editLink = formatMessage(linkToolbarCommonMessages.editLink);
|
|
122
|
-
|
|
127
|
+
const metadata = {
|
|
123
128
|
url: link,
|
|
124
129
|
title: ''
|
|
125
130
|
};
|
|
@@ -218,7 +223,10 @@ export const getToolbarConfig = (options, pluginInjectionApi) => (state, intl, p
|
|
|
218
223
|
providerFactory: providerFactory,
|
|
219
224
|
onCancel: () => view.focus(),
|
|
220
225
|
onEscapeCallback: onEscapeCallback(editorCardActions),
|
|
221
|
-
onClickAwayCallback: onClickAwayCallback
|
|
226
|
+
onClickAwayCallback: onClickAwayCallback
|
|
227
|
+
// Ignored via go/ees005
|
|
228
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
229
|
+
,
|
|
222
230
|
onSubmit: (href, title = '', displayText, inputMethod, analytic) => {
|
|
223
231
|
var _toolbarKey$getState$, _toolbarKey$getState;
|
|
224
232
|
const isEdit = isEditLink(activeLinkMark);
|
|
@@ -9,6 +9,9 @@ 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
|
|
12
15
|
function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
13
16
|
return function (_ref) {
|
|
14
17
|
var tr = _ref.tr;
|
|
@@ -42,9 +45,14 @@ function setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPresse
|
|
|
42
45
|
return tr;
|
|
43
46
|
};
|
|
44
47
|
}
|
|
48
|
+
|
|
49
|
+
// Ignored via go/ees005
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
45
51
|
export function setLinkHref(href, pos, editorAnalyticsApi, to, isTabPressed) {
|
|
46
52
|
return editorCommandToPMCommand(setLinkHrefEditorCommand(href, pos, editorAnalyticsApi, to, isTabPressed));
|
|
47
53
|
}
|
|
54
|
+
// Ignored via go/ees005
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
48
56
|
export function updateLinkEditorCommand(href, text, pos, to) {
|
|
49
57
|
return function (_ref2) {
|
|
50
58
|
var tr = _ref2.tr;
|
|
@@ -76,9 +84,15 @@ export function updateLinkEditorCommand(href, text, pos, to) {
|
|
|
76
84
|
return tr;
|
|
77
85
|
};
|
|
78
86
|
}
|
|
87
|
+
|
|
88
|
+
// Ignored via go/ees005
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
79
90
|
export function updateLink(href, text, pos, to) {
|
|
80
91
|
return editorCommandToPMCommand(updateLinkEditorCommand(href, text, pos, to));
|
|
81
92
|
}
|
|
93
|
+
|
|
94
|
+
// Ignored via go/ees005
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
82
96
|
export function insertLink(from, to, incomingHref, incomingTitle, displayText, source, sourceEvent) {
|
|
83
97
|
var appearance = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 'inline';
|
|
84
98
|
var cardApiActions = arguments.length > 8 ? arguments[8] : undefined;
|
|
@@ -108,7 +122,10 @@ export function insertLink(from, to, incomingHref, incomingTitle, displayText, s
|
|
|
108
122
|
if (!displayText || displayText === incomingHref) {
|
|
109
123
|
var queueCardsFromChangedTr = cardApiActions === null || cardApiActions === void 0 ? void 0 : cardApiActions.queueCardsFromChangedTr;
|
|
110
124
|
if (queueCardsFromChangedTr) {
|
|
111
|
-
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr,
|
|
125
|
+
queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr,
|
|
126
|
+
// Ignored via go/ees005
|
|
127
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
128
|
+
source, ACTION.INSERTED, false, sourceEvent, appearance);
|
|
112
129
|
} else {
|
|
113
130
|
addLinkMetadata(state.selection, tr, {
|
|
114
131
|
action: ACTION.INSERTED,
|
|
@@ -146,7 +163,10 @@ export function insertLink(from, to, incomingHref, incomingTitle, displayText, s
|
|
|
146
163
|
export var insertLinkWithAnalytics = function insertLinkWithAnalytics(inputMethod, from, to, href, cardActions, editorAnalyticsApi, title, displayText) {
|
|
147
164
|
var cardsAvailable = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
148
165
|
var sourceEvent = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : undefined;
|
|
149
|
-
var appearance
|
|
166
|
+
var appearance
|
|
167
|
+
// Ignored via go/ees005
|
|
168
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
169
|
+
= arguments.length > 10 ? arguments[10] : undefined;
|
|
150
170
|
// If smart cards are available, we send analytics for hyperlinks when a smart link is rejected.
|
|
151
171
|
if (cardsAvailable && !title && !displayText) {
|
|
152
172
|
return insertLink(from, to, href, title, displayText, inputMethod, sourceEvent, appearance, cardActions);
|
|
@@ -77,6 +77,8 @@ 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
|
|
80
82
|
insertLink: function insertLink(inputMethod, from, to, href, title, displayText) {
|
|
81
83
|
var _api$card, _api$analytics3;
|
|
82
84
|
var cardsAvailable = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
@@ -30,6 +30,8 @@ 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
|
|
33
35
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
34
36
|
var oldInsertToolbarState = getInsertLinkToolbarState(oldState);
|
|
35
37
|
var insertToolbarState = getInsertLinkToolbarState(newState);
|
|
@@ -11,6 +11,8 @@ 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
|
|
14
16
|
return createRule(regexp, function (state, match, start, end) {
|
|
15
17
|
var _toolbarKey$getState$, _toolbarKey$getState;
|
|
16
18
|
var schema = state.schema;
|
|
@@ -18,7 +20,6 @@ export function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
|
18
20
|
return null;
|
|
19
21
|
}
|
|
20
22
|
var link = match;
|
|
21
|
-
var url;
|
|
22
23
|
|
|
23
24
|
// Property 'url' does not exist on type 'RegExpExecArray', the type of `match`.
|
|
24
25
|
// This check is in case the match is not a Linkify match, which has a url property.
|
|
@@ -28,7 +29,7 @@ export function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
|
28
29
|
if (!shouldAutoLinkifyMatch(link)) {
|
|
29
30
|
return null;
|
|
30
31
|
}
|
|
31
|
-
url = normalizeUrl(link.url);
|
|
32
|
+
var url = normalizeUrl(link.url);
|
|
32
33
|
|
|
33
34
|
// Not previously handled; don't create a link if the URL is empty.
|
|
34
35
|
// This will only happen if the `regexp` matches more links than the normalizeUrl validation;
|
|
@@ -79,6 +80,8 @@ export function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
79
80
|
var urlWithASpaceRule = createLinkInputRule(LinkMatcher.create(), editorAnalyticsApi);
|
|
80
81
|
|
|
81
82
|
// [something](link) should convert to a hyperlink
|
|
83
|
+
// Ignored via go/ees005
|
|
84
|
+
// eslint-disable-next-line require-unicode-regexp, @typescript-eslint/max-params
|
|
82
85
|
var markdownLinkRule = createRule(/(^|[^!])\[(.*?)\]\((\S+)\)$/, function (state, match, start, end) {
|
|
83
86
|
var _toolbarKey$getState$2, _toolbarKey$getState2;
|
|
84
87
|
var schema = state.schema;
|
|
@@ -9,10 +9,22 @@ import { stateKey } from '../pm-plugins/main';
|
|
|
9
9
|
import { toolbarKey } from './toolbar-buttons';
|
|
10
10
|
export function createKeymapPlugin(editorAnalyticsApi) {
|
|
11
11
|
var list = {};
|
|
12
|
-
bindKeymapWithEditorCommand(
|
|
12
|
+
bindKeymapWithEditorCommand(
|
|
13
|
+
// Ignored via go/ees005
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
15
|
+
addLink.common, showLinkToolbar(INPUT_METHOD.SHORTCUT, editorAnalyticsApi), list);
|
|
16
|
+
|
|
17
|
+
// Ignored via go/ees005
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
13
19
|
bindKeymapWithCommand(enter.common, mayConvertLastWordToHyperlink(editorAnalyticsApi), list);
|
|
14
|
-
bindKeymapWithCommand(
|
|
15
|
-
|
|
20
|
+
bindKeymapWithCommand(
|
|
21
|
+
// Ignored via go/ees005
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
23
|
+
insertNewLine.common, mayConvertLastWordToHyperlink(editorAnalyticsApi), list);
|
|
24
|
+
bindKeymapWithCommand(
|
|
25
|
+
// Ignored via go/ees005
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
27
|
+
escape.common, function (state, dispatch, view) {
|
|
16
28
|
var hyperlinkPlugin = stateKey.getState(state);
|
|
17
29
|
if (hyperlinkPlugin.activeLinkMark) {
|
|
18
30
|
hideLinkToolbar()(state, dispatch);
|
|
@@ -37,6 +49,9 @@ var mayConvertLastWordToHyperlink = function mayConvertLastWordToHyperlink(edito
|
|
|
37
49
|
if (!nodeBefore || !nodeBefore.isText || !nodeBefore.text) {
|
|
38
50
|
return false;
|
|
39
51
|
}
|
|
52
|
+
|
|
53
|
+
// Ignored via go/ees005
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
40
55
|
var words = nodeBefore.text.split(' ');
|
|
41
56
|
var lastWord = words[words.length - 1];
|
|
42
57
|
var match = getLinkMatch(lastWord);
|
|
@@ -151,7 +151,10 @@ 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
|
|
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
|
+
) {
|
|
155
158
|
return new SafePlugin({
|
|
156
159
|
state: {
|
|
157
160
|
init: function init(_, state) {
|
|
@@ -164,6 +167,8 @@ export var plugin = function plugin(dispatch, intl, editorAppearance, pluginInje
|
|
|
164
167
|
editorAppearance: editorAppearance
|
|
165
168
|
};
|
|
166
169
|
},
|
|
170
|
+
// Ignored via go/ees005
|
|
171
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
167
172
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
168
173
|
var state = pluginState;
|
|
169
174
|
var action = tr.getMeta(stateKey) && tr.getMeta(stateKey).type;
|
|
@@ -287,6 +292,8 @@ export var plugin = function plugin(dispatch, intl, editorAppearance, pluginInje
|
|
|
287
292
|
}
|
|
288
293
|
},
|
|
289
294
|
handleDOMEvents: {
|
|
295
|
+
// Ignored via go/ees005
|
|
296
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
290
297
|
mouseup: function mouseup(_, event) {
|
|
291
298
|
// this prevents redundant selection transaction when clicking on link
|
|
292
299
|
// link state will be update on slection change which happens on mousedown
|
|
@@ -296,6 +303,8 @@ export var plugin = function plugin(dispatch, intl, editorAppearance, pluginInje
|
|
|
296
303
|
}
|
|
297
304
|
return false;
|
|
298
305
|
},
|
|
306
|
+
// Ignored via go/ees005
|
|
307
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
299
308
|
mousedown: function mousedown(view, event) {
|
|
300
309
|
// since link clicks are disallowed by browsers inside contenteditable
|
|
301
310
|
// so we need to handle shift+click selection ourselves in this case
|
|
@@ -24,7 +24,10 @@ 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
|
|
27
|
+
var dispatchAnalytics = function dispatchAnalytics(dispatch, state, analyticsBuilder, editorAnalyticsApi
|
|
28
|
+
// Ignored via go/ees005
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
30
|
+
) {
|
|
28
31
|
if (dispatch) {
|
|
29
32
|
var tr = state.tr;
|
|
30
33
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(analyticsBuilder(ACTION_SUBJECT_ID.HYPERLINK))(tr);
|
|
@@ -224,7 +227,10 @@ export var getToolbarConfig = function getToolbarConfig(options, pluginInjection
|
|
|
224
227
|
return view.focus();
|
|
225
228
|
},
|
|
226
229
|
onEscapeCallback: onEscapeCallback(editorCardActions),
|
|
227
|
-
onClickAwayCallback: onClickAwayCallback
|
|
230
|
+
onClickAwayCallback: onClickAwayCallback
|
|
231
|
+
// Ignored via go/ees005
|
|
232
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
233
|
+
,
|
|
228
234
|
onSubmit: function onSubmit(href) {
|
|
229
235
|
var _toolbarKey$getState$, _toolbarKey$getState;
|
|
230
236
|
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.2.
|
|
3
|
+
"version": "3.2.28",
|
|
4
4
|
"description": "Hyperlink plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
35
35
|
"@atlaskit/analytics-next": "^10.2.0",
|
|
36
|
-
"@atlaskit/editor-common": "^
|
|
36
|
+
"@atlaskit/editor-common": "^98.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
38
|
-
"@atlaskit/editor-plugin-card": "4.5.
|
|
38
|
+
"@atlaskit/editor-plugin-card": "4.5.11",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
41
41
|
"@atlaskit/icon": "^23.1.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.31.0",
|
|
45
45
|
"@babel/runtime": "^7.0.0",
|
|
46
46
|
"uuid": "^3.1.0"
|
|
47
47
|
},
|