@atlaskit/editor-plugin-paste 2.0.11 → 2.0.13

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 2.0.13
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 2.0.12
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 2.0.11
4
16
 
5
17
  ### Patch Changes
@@ -43,7 +43,11 @@ var stopTrackingPastedMacroPositions = exports.stopTrackingPastedMacroPositions
43
43
  };
44
44
 
45
45
  // matchers for text lists
46
+ // Ignored via go/ees005
47
+ // eslint-disable-next-line require-unicode-regexp
46
48
  var bullets = /^\s*[\*\-\u2022](\s+|\s+$)/;
49
+ // Ignored via go/ees005
50
+ // eslint-disable-next-line require-unicode-regexp
47
51
  var numbers = /^\s*\d[\.\)](\s+|$)/;
48
52
  var isListItem = function isListItem(node, schema) {
49
53
  return Boolean(node && node.type === schema.nodes.listItem);
@@ -65,6 +69,9 @@ var getListType = function getListType(node, schema) {
65
69
  if (lastMatch) {
66
70
  return lastMatch;
67
71
  }
72
+
73
+ // Ignored via go/ees005
74
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
68
75
  var match = node.text.match(listType.matcher);
69
76
  return match ? [listType.node, match[0].length] : lastMatch;
70
77
  }, null);
@@ -106,6 +113,9 @@ var extractListFromParagraph = exports.extractListFromParagraph = function extra
106
113
  orderedList = _schema$nodes2.orderedList;
107
114
  var splitListsAndParagraphs = [];
108
115
  var paragraphParts = [];
116
+
117
+ // Ignored via go/ees005
118
+ // eslint-disable-next-line no-var
109
119
  for (var index = 0; index < linesSplitByHardbreaks.length; index = index + 1) {
110
120
  var _firstNonHardBreakNod;
111
121
  var line = linesSplitByHardbreaks[index];
@@ -159,6 +169,10 @@ var extractListFromParagraph = exports.extractListFromParagraph = function extra
159
169
  continue;
160
170
  }
161
171
  var attrs = nodeType === orderedList ? {
172
+ // Ignored via go/ees005
173
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
174
+ // Ignored via go/ees005
175
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
162
176
  order: parseInt(firstNonHardBreakNode.text.split('.')[0])
163
177
  } : undefined;
164
178
  var newList = nodeType.createChecked(attrs, [listItemNode]);
@@ -292,5 +306,8 @@ var splitIntoParagraphs = exports.splitIntoParagraphs = function splitIntoParagr
292
306
  if (curChildren.length) {
293
307
  paragraphs.push(paragraph.createChecked(undefined, curChildren, (0, _toConsumableArray2.default)(blockMarks)));
294
308
  }
295
- return _model.Fragment.from(paragraphs.length ? paragraphs : [paragraph.createAndFill(undefined, undefined, (0, _toConsumableArray2.default)(blockMarks))]);
309
+ return _model.Fragment.from(paragraphs.length ? paragraphs :
310
+ // Ignored via go/ees005
311
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
312
+ [paragraph.createAndFill(undefined, undefined, (0, _toConsumableArray2.default)(blockMarks))]);
296
313
  };
@@ -156,6 +156,9 @@ function createPastePayload(actionSubjectId, attributes, linkDomain) {
156
156
  }
157
157
  } : {});
158
158
  }
159
+
160
+ // Ignored via go/ees005
161
+ // eslint-disable-next-line @typescript-eslint/max-params
159
162
  function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, pluginInjectionApi) {
160
163
  return function (selection) {
161
164
  var _pluginInjectionApi$m;
@@ -252,6 +255,9 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
252
255
  }, linkDomains);
253
256
  };
254
257
  }
258
+
259
+ // Ignored via go/ees005
260
+ // eslint-disable-next-line @typescript-eslint/max-params
255
261
  function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
256
262
  return createPasteAnalyticsPayloadBySelection(event, slice, pasteContext)(view.state.selection);
257
263
  }
@@ -260,12 +266,16 @@ function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
260
266
  // However, handlers like handleMacroAutoConvert dispatch multiple time,
261
267
  // so pasteCommandWithAnalytics is useless in this case.
262
268
  var sendPasteAnalyticsEvent = exports.sendPasteAnalyticsEvent = function sendPasteAnalyticsEvent(editorAnalyticsAPI) {
263
- return function (view, event, slice, pasteContext) {
264
- var tr = view.state.tr;
265
- var payload = createPasteAnalyticsPayload(view, event, slice, pasteContext);
266
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
267
- view.dispatch(tr);
268
- };
269
+ return (
270
+ // Ignored via go/ees005
271
+ // eslint-disable-next-line @typescript-eslint/max-params
272
+ function (view, event, slice, pasteContext) {
273
+ var tr = view.state.tr;
274
+ var payload = createPasteAnalyticsPayload(view, event, slice, pasteContext);
275
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
276
+ view.dispatch(tr);
277
+ }
278
+ );
269
279
  };
270
280
  var handlePasteAsPlainTextWithAnalytics = exports.handlePasteAsPlainTextWithAnalytics = function handlePasteAsPlainTextWithAnalytics(editorAnalyticsAPI) {
271
281
  return function (view, event, slice) {
@@ -275,46 +285,69 @@ var handlePasteAsPlainTextWithAnalytics = exports.handlePasteAsPlainTextWithAnal
275
285
  }))((0, _handlers.handlePasteAsPlainText)(slice, event, editorAnalyticsAPI));
276
286
  };
277
287
  };
278
- var handlePasteIntoTaskAndDecisionWithAnalytics = exports.handlePasteIntoTaskAndDecisionWithAnalytics = function handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, type, pluginInjectionApi) {
288
+ var handlePasteIntoTaskAndDecisionWithAnalytics = exports.handlePasteIntoTaskAndDecisionWithAnalytics = function handlePasteIntoTaskAndDecisionWithAnalytics(view, event, slice, type, pluginInjectionApi
289
+ // Ignored via go/ees005
290
+ // eslint-disable-next-line @typescript-eslint/max-params
291
+ ) {
279
292
  var _pluginInjectionApi$a, _pluginInjectionApi$c;
280
293
  return injectAnalyticsPayloadBeforeCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(createPasteAnalyticsPayloadBySelection(event, slice, {
281
294
  type: type
282
295
  }))((0, _handlers.handlePasteIntoTaskOrDecisionOrPanel)(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 || (_pluginInjectionApi$c = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.queueCardsFromChangedTr));
283
296
  };
284
297
  var handlePasteIntoCaptionWithAnalytics = exports.handlePasteIntoCaptionWithAnalytics = function handlePasteIntoCaptionWithAnalytics(editorAnalyticsAPI) {
285
- return function (view, event, slice, type) {
286
- return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
287
- type: type
288
- }))((0, _handlers.handlePasteIntoCaption)(slice));
289
- };
298
+ return (
299
+ // Ignored via go/ees005
300
+ // eslint-disable-next-line @typescript-eslint/max-params
301
+ function (view, event, slice, type) {
302
+ return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
303
+ type: type
304
+ }))((0, _handlers.handlePasteIntoCaption)(slice));
305
+ }
306
+ );
290
307
  };
291
308
  var handleCodeBlockWithAnalytics = exports.handleCodeBlockWithAnalytics = function handleCodeBlockWithAnalytics(editorAnalyticsAPI) {
292
- return function (view, event, slice, text) {
293
- return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
294
- type: _analytics.PasteTypes.plain
295
- }))((0, _handlers.handleCodeBlock)(text));
296
- };
309
+ return (
310
+ // Ignored via go/ees005
311
+ // eslint-disable-next-line @typescript-eslint/max-params
312
+ function (view, event, slice, text) {
313
+ return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
314
+ type: _analytics.PasteTypes.plain
315
+ }))((0, _handlers.handleCodeBlock)(text));
316
+ }
317
+ );
297
318
  };
298
319
  var handleMediaSingleWithAnalytics = exports.handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalytics(editorAnalyticsAPI) {
299
- return function (view, event, slice, type, insertMediaAsMediaSingle) {
320
+ return function (view, event, slice, type, insertMediaAsMediaSingle
321
+ // Ignored via go/ees005
322
+ // eslint-disable-next-line @typescript-eslint/max-params
323
+ ) {
300
324
  return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
301
325
  type: type
302
326
  }))((0, _handlers.handleMediaSingle)(_analytics.INPUT_METHOD.CLIPBOARD, insertMediaAsMediaSingle)(slice));
303
327
  };
304
328
  };
305
- var handlePastePreservingMarksWithAnalytics = exports.handlePastePreservingMarksWithAnalytics = function handlePastePreservingMarksWithAnalytics(view, event, slice, type, pluginInjectionApi) {
329
+ var handlePastePreservingMarksWithAnalytics = exports.handlePastePreservingMarksWithAnalytics = function handlePastePreservingMarksWithAnalytics(view, event, slice, type, pluginInjectionApi
330
+ // Ignored via go/ees005
331
+ // eslint-disable-next-line @typescript-eslint/max-params
332
+ ) {
306
333
  var _pluginInjectionApi$a2, _pluginInjectionApi$c2;
307
334
  return injectAnalyticsPayloadBeforeCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(createPasteAnalyticsPayloadBySelection(event, slice, {
308
335
  type: type
309
336
  }))((0, _handlers.handlePastePreservingMarks)(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.card) === null || _pluginInjectionApi$c2 === void 0 || (_pluginInjectionApi$c2 = _pluginInjectionApi$c2.actions) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.queueCardsFromChangedTr));
310
337
  };
311
- var handleMarkdownWithAnalytics = exports.handleMarkdownWithAnalytics = function handleMarkdownWithAnalytics(view, event, slice, pluginInjectionApi) {
338
+ var handleMarkdownWithAnalytics = exports.handleMarkdownWithAnalytics = function handleMarkdownWithAnalytics(view, event, slice, pluginInjectionApi
339
+ // Ignored via go/ees005
340
+ // eslint-disable-next-line @typescript-eslint/max-params
341
+ ) {
312
342
  var _pluginInjectionApi$a3, _pluginInjectionApi$c3;
313
343
  return injectAnalyticsPayloadBeforeCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(createPasteAnalyticsPayloadBySelection(event, slice, {
314
344
  type: _analytics.PasteTypes.markdown
315
345
  }))((0, _handlers.handleMarkdown)(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 || (_pluginInjectionApi$c3 = _pluginInjectionApi$c3.actions) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : _pluginInjectionApi$c3.queueCardsFromChangedTr));
316
346
  };
317
- var handleRichTextWithAnalytics = exports.handleRichTextWithAnalytics = function handleRichTextWithAnalytics(view, event, slice, pluginInjectionApi, isNestingMediaOrCodeblockSupported) {
347
+ var handleRichTextWithAnalytics = exports.handleRichTextWithAnalytics = function handleRichTextWithAnalytics(view, event, slice, pluginInjectionApi, isNestingMediaOrCodeblockSupported
348
+ // Ignored via go/ees005
349
+ // eslint-disable-next-line @typescript-eslint/max-params
350
+ ) {
318
351
  var _pluginInjectionApi$a4, _pluginInjectionApi$c4;
319
352
  return injectAnalyticsPayloadBeforeCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions)(createPasteAnalyticsPayloadBySelection(event, slice, {
320
353
  type: _analytics.PasteTypes.richText
@@ -344,7 +377,10 @@ var injectAnalyticsPayloadBeforeCommand = function injectAnalyticsPayloadBeforeC
344
377
  };
345
378
  };
346
379
  var handlePastePanelOrDecisionIntoListWithAnalytics = exports.handlePastePanelOrDecisionIntoListWithAnalytics = function handlePastePanelOrDecisionIntoListWithAnalytics(editorAnalyticsAPI) {
347
- return function (view, event, slice, findRootParentListNode) {
380
+ return function (view, event, slice, findRootParentListNode
381
+ // Ignored via go/ees005
382
+ // eslint-disable-next-line @typescript-eslint/max-params
383
+ ) {
348
384
  return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
349
385
  type: _analytics.PasteTypes.richText
350
386
  }))((0, _handlers.handlePastePanelOrDecisionContentIntoList)(slice, findRootParentListNode));
@@ -382,12 +418,16 @@ var handleSelectedTableWithAnalytics = exports.handleSelectedTableWithAnalytics
382
418
  };
383
419
  };
384
420
  var handlePasteLinkOnSelectedTextWithAnalytics = exports.handlePasteLinkOnSelectedTextWithAnalytics = function handlePasteLinkOnSelectedTextWithAnalytics(editorAnalyticsAPI) {
385
- return function (view, event, slice, type) {
386
- return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
387
- type: type,
388
- hyperlinkPasteOnText: true
389
- }))((0, _handlers.handlePasteLinkOnSelectedText)(slice));
390
- };
421
+ return (
422
+ // Ignored via go/ees005
423
+ // eslint-disable-next-line @typescript-eslint/max-params
424
+ function (view, event, slice, type) {
425
+ return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
426
+ type: type,
427
+ hyperlinkPasteOnText: true
428
+ }))((0, _handlers.handlePasteLinkOnSelectedText)(slice));
429
+ }
430
+ );
391
431
  };
392
432
  var createPasteMeasurePayload = exports.createPasteMeasurePayload = function createPasteMeasurePayload(_ref3) {
393
433
  var view = _ref3.view,
@@ -37,6 +37,9 @@ var isInsideBlockQuote = exports.isInsideBlockQuote = function isInsideBlockQuot
37
37
  return (0, _utils2.hasParentNodeOfType)(blockquote)(state.selection);
38
38
  };
39
39
  var PASTE = 'Editor Paste Plugin Paste Duration';
40
+
41
+ // Ignored via go/ees005
42
+ // eslint-disable-next-line @typescript-eslint/max-params
40
43
  function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, cardOptions, sanitizePrivateContent, providerFactory) {
41
44
  var _pluginInjectionApi$a;
42
45
  var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
@@ -52,6 +55,8 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
52
55
  function escapeBackslashExceptCodeblock(textInput) {
53
56
  var codeToken = '```';
54
57
  if (!textInput.includes(codeToken)) {
58
+ // Ignored via go/ees005
59
+ // eslint-disable-next-line require-unicode-regexp
55
60
  return textInput.replace(/\\/g, '\\\\');
56
61
  }
57
62
  var isInsideCodeblock = false;
@@ -66,6 +71,8 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
66
71
  }
67
72
  if (!isInsideCodeblock) {
68
73
  // only escape text which is not inside a codeblock
74
+ // Ignored via go/ees005
75
+ // eslint-disable-next-line require-unicode-regexp
69
76
  text = text.replace(/\\/g, '\\\\');
70
77
  }
71
78
  return text;
@@ -145,6 +152,8 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
145
152
  slice = new _model.Slice(_model.Fragment.from(schema.text(text)), 1, 1);
146
153
  }
147
154
  if ((_text = text) !== null && _text !== void 0 && _text.includes('\r')) {
155
+ // Ignored via go/ees005
156
+ // eslint-disable-next-line require-unicode-regexp
148
157
  text = text.replace(/\r/g, '');
149
158
  }
150
159
  var isPastedFile = (0, _paste.isPastedFile)(event);
@@ -472,6 +481,9 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
472
481
  // splitting linebreaks into paragraphs must happen before upgrading text to lists
473
482
  slice = (0, _commands.splitParagraphs)(slice, schema);
474
483
  slice = (0, _commands.upgradeTextToLists)(slice, schema);
484
+
485
+ // Ignored via go/ees005
486
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
475
487
  if (slice.content.childCount && slice.content.lastChild.type === schema.nodes.codeBlock) {
476
488
  slice = new _model.Slice(slice.content, 0, 0);
477
489
  }
@@ -484,7 +496,11 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
484
496
  // Fix for issue ED-4438
485
497
  // text from google docs should not be pasted as inline code
486
498
  if (html.indexOf('id="docs-internal-guid-') >= 0) {
499
+ // Ignored via go/ees005
500
+ // eslint-disable-next-line require-unicode-regexp
487
501
  html = html.replace(/white-space:pre/g, '');
502
+ // Ignored via go/ees005
503
+ // eslint-disable-next-line require-unicode-regexp
488
504
  html = html.replace(/white-space:pre-wrap/g, '');
489
505
  }
490
506
 
@@ -106,6 +106,9 @@ function insertSliceInsideOfPanelNodeSelected(panelNode) {
106
106
  tr.setSelection(_state.TextSelection.near(tr.doc.resolve(insertPosition + slice.content.size - slice.openStart - slice.openEnd + 1)));
107
107
  return;
108
108
  }
109
+
110
+ // Ignored via go/ees005
111
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
109
112
  var temporaryDoc = new _transform.Transform(tr.doc.type.createAndFill());
110
113
  temporaryDoc.replaceRange(0, temporaryDoc.doc.content.size, slice);
111
114
  var sliceWithoutInvalidListSurrounding = temporaryDoc.doc.slice(0);
@@ -522,7 +522,8 @@ function handlePastePreservingMarks(slice, queueCardsFromChangedTr) {
522
522
  }
523
523
  function getSmartLinkAdf(_x, _x2, _x3) {
524
524
  return _getSmartLinkAdf.apply(this, arguments);
525
- }
525
+ } // Ignored via go/ees005
526
+ // eslint-disable-next-line @typescript-eslint/max-params
526
527
  function _getSmartLinkAdf() {
527
528
  _getSmartLinkAdf = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(text, type, cardOptions) {
528
529
  var provider;
@@ -573,6 +574,9 @@ function insertAutoMacro(slice, macro, view, from, to) {
573
574
  }
574
575
  return false;
575
576
  }
577
+
578
+ // Ignored via go/ees005
579
+ // eslint-disable-next-line @typescript-eslint/max-params
576
580
  function handleMacroAutoConvert(text, slice, queueCardsFromChangedTr, runMacroAutoConvert, cardsOptions, extensionAutoConverter) {
577
581
  return function (state, dispatch, view) {
578
582
  var macro = null;
@@ -643,11 +647,17 @@ function handleCodeBlock(text) {
643
647
  }
644
648
  function isOnlyMedia(state, slice) {
645
649
  var media = state.schema.nodes.media;
650
+ // Ignored via go/ees005
651
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
646
652
  return slice.content.childCount === 1 && slice.content.firstChild.type === media;
647
653
  }
648
654
  function isOnlyMediaSingle(state, slice) {
649
655
  var mediaSingle = state.schema.nodes.mediaSingle;
650
- return mediaSingle && slice.content.childCount === 1 && slice.content.firstChild.type === mediaSingle;
656
+ return (
657
+ // Ignored via go/ees005
658
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
659
+ mediaSingle && slice.content.childCount === 1 && slice.content.firstChild.type === mediaSingle
660
+ );
651
661
  }
652
662
  function handleMediaSingle(inputMethod, insertMediaAsMediaSingle) {
653
663
  return function (slice) {
@@ -655,6 +665,8 @@ function handleMediaSingle(inputMethod, insertMediaAsMediaSingle) {
655
665
  if (view) {
656
666
  if (isOnlyMedia(state, slice)) {
657
667
  var _insertMediaAsMediaSi;
668
+ // Ignored via go/ees005
669
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
658
670
  return (_insertMediaAsMediaSi = insertMediaAsMediaSingle === null || insertMediaAsMediaSingle === void 0 ? void 0 : insertMediaAsMediaSingle(view, slice.content.firstChild, inputMethod)) !== null && _insertMediaAsMediaSi !== void 0 ? _insertMediaAsMediaSi : false;
659
671
  }
660
672
  if ((0, _coreUtils.insideTable)(state) && isOnlyMediaSingle(state, slice)) {
@@ -785,6 +797,9 @@ function handleExpandPaste(slice, isNestingExpandsSupported) {
785
797
  return false;
786
798
  };
787
799
  }
800
+
801
+ // Ignored via go/ees005
802
+ // eslint-disable-next-line @typescript-eslint/max-params
788
803
  function handleMarkdown(markdownSlice, queueCardsFromChangedTr, from, to) {
789
804
  return function (state, dispatch) {
790
805
  var tr = (0, _history.closeHistory)(state.tr);
@@ -807,6 +822,8 @@ function removePrecedingBackTick(tr) {
807
822
  var _tr$selection = tr.selection,
808
823
  nodeBefore = _tr$selection.$from.nodeBefore,
809
824
  from = _tr$selection.from;
825
+ // Ignored via go/ees005
826
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
810
827
  if (nodeBefore && nodeBefore.isText && nodeBefore.text.endsWith('`')) {
811
828
  tr.delete(from - 1, from);
812
829
  }
@@ -35,12 +35,18 @@ function isPastedFromExcel(html) {
35
35
  return !!html && html.indexOf('urn:schemas-microsoft-com:office:excel') >= 0;
36
36
  }
37
37
  function isPastedFromDropboxPaper(html) {
38
+ // Ignored via go/ees005
39
+ // eslint-disable-next-line require-unicode-regexp
38
40
  return !!html && !!html.match(/class=\"\s?author-d-.+"/gim);
39
41
  }
40
42
  function isPastedFromGoogleDocs(html) {
43
+ // Ignored via go/ees005
44
+ // eslint-disable-next-line require-unicode-regexp
41
45
  return !!html && !!html.match(/id=\"docs-internal-guid-.+"/gim);
42
46
  }
43
47
  function isPastedFromGoogleSpreadSheets(html) {
48
+ // Ignored via go/ees005
49
+ // eslint-disable-next-line require-unicode-regexp
44
50
  return !!html && !!html.match(/data-sheets-.+=/gim);
45
51
  }
46
52
  function isPastedFromPages(html) {
@@ -53,9 +59,13 @@ var isSingleLine = exports.isSingleLine = function isSingleLine(text) {
53
59
  return !!text && text.trim().split('\n').length === 1;
54
60
  };
55
61
  function htmlContainsSingleFile(html) {
62
+ // Ignored via go/ees005
63
+ // eslint-disable-next-line require-unicode-regexp
56
64
  return !!html.match(/<img .*>/) && !(0, _mediaClient.isMediaBlobUrl)(html);
57
65
  }
58
66
  function getPasteSource(event) {
67
+ // Ignored via go/ees005
68
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
59
69
  var html = event.clipboardData.getData('text/html');
60
70
  if (isPastedFromDropboxPaper(html)) {
61
71
  return 'dropbox-paper';
@@ -91,7 +101,11 @@ function getPasteSource(event) {
91
101
  * check behaviour of double quotes in url strings
92
102
  */
93
103
  function escapeLinks(text) {
104
+ // Ignored via go/ees005
105
+ // eslint-disable-next-line require-unicode-regexp
94
106
  return text.replace(/(\[([^\]]+)\]\()?((https?|ftp|jamfselfservice):\/\/[^\s>"]+)/g, function (str) {
107
+ // Ignored via go/ees005
108
+ // eslint-disable-next-line require-unicode-regexp
95
109
  return str.match(/^(https?|ftp|jamfselfservice):\/\/[^\s>"]+$/) ? "<".concat(str, ">") : str;
96
110
  });
97
111
  }
@@ -181,11 +195,19 @@ var htmlHasInvalidLinkTags = exports.htmlHasInvalidLinkTags = function htmlHasIn
181
195
  // <li><a href="http://www.atlassian.com\"<a> href="http://www.atlassian.com\"http://www.atlassian.com</a></a></li>">
182
196
  var removeDuplicateInvalidLinks = exports.removeDuplicateInvalidLinks = function removeDuplicateInvalidLinks(html) {
183
197
  if (htmlHasInvalidLinkTags(html)) {
198
+ // Ignored via go/ees005
199
+ // eslint-disable-next-line require-unicode-regexp
184
200
  var htmlArray = html.split(/(?=<a)/);
185
201
  var htmlArrayWithoutInvalidLinks = htmlArray.filter(function (item) {
186
202
  return !(item.includes('<a') && item.includes('"></a>')) && !(item.includes('<a') && !item.includes('</a>'));
187
203
  });
188
- var fixedHtml = htmlArrayWithoutInvalidLinks.join('').replace(/<\/a><\/a>/gi, '</a>').replace(/<a>/gi, '<a');
204
+ var fixedHtml = htmlArrayWithoutInvalidLinks.join('')
205
+ // Ignored via go/ees005
206
+ // eslint-disable-next-line require-unicode-regexp
207
+ .replace(/<\/a><\/a>/gi, '</a>')
208
+ // Ignored via go/ees005
209
+ // eslint-disable-next-line require-unicode-regexp
210
+ .replace(/<a>/gi, '<a');
189
211
  return fixedHtml;
190
212
  }
191
213
  return html;
@@ -14,7 +14,10 @@ var isPastedFromTinyMCE = function isPastedFromTinyMCE(pasteEvent) {
14
14
  })) !== null && _pasteEvent$clipboard !== void 0 ? _pasteEvent$clipboard : false;
15
15
  };
16
16
  var isPastedFromTinyMCEConfluence = exports.isPastedFromTinyMCEConfluence = function isPastedFromTinyMCEConfluence(pasteEvent, html) {
17
- return isPastedFromTinyMCE(pasteEvent) && !!html && !!html.match(/class=\"\s?(confluenceTd|confluenceTh|confluenceTable).+"/gim);
17
+ return isPastedFromTinyMCE(pasteEvent) && !!html &&
18
+ // Ignored via go/ees005
19
+ // eslint-disable-next-line require-unicode-regexp
20
+ !!html.match(/class=\"\s?(confluenceTd|confluenceTh|confluenceTable).+"/gim);
18
21
  };
19
22
 
20
23
  /**
@@ -123,6 +126,8 @@ var fillIncompleteRowWithEmptyCells = function fillIncompleteRowWithEmptyCells(d
123
126
  * headers exist.
124
127
  */
125
128
  var tryReconstructTableRows = exports.tryReconstructTableRows = function tryReconstructTableRows(doc) {
129
+ // Ignored via go/ees005
130
+ // eslint-disable-next-line prefer-const
126
131
  var _getTableElementsInfo = getTableElementsInfo(doc),
127
132
  cellCount = _getTableElementsInfo.cellCount,
128
133
  thCount = _getTableElementsInfo.thCount,
@@ -31,7 +31,11 @@ export const stopTrackingPastedMacroPositions = pastedMacroPositionKeys => creat
31
31
  });
32
32
 
33
33
  // matchers for text lists
34
+ // Ignored via go/ees005
35
+ // eslint-disable-next-line require-unicode-regexp
34
36
  const bullets = /^\s*[\*\-\u2022](\s+|\s+$)/;
37
+ // Ignored via go/ees005
38
+ // eslint-disable-next-line require-unicode-regexp
35
39
  const numbers = /^\s*\d[\.\)](\s+|$)/;
36
40
  const isListItem = (node, schema) => {
37
41
  return Boolean(node && node.type === schema.nodes.listItem);
@@ -54,6 +58,9 @@ const getListType = (node, schema) => {
54
58
  if (lastMatch) {
55
59
  return lastMatch;
56
60
  }
61
+
62
+ // Ignored via go/ees005
63
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
57
64
  const match = node.text.match(listType.matcher);
58
65
  return match ? [listType.node, match[0].length] : lastMatch;
59
66
  }, null);
@@ -94,6 +101,9 @@ export const extractListFromParagraph = (node, parent, schema) => {
94
101
  } = schema.nodes;
95
102
  const splitListsAndParagraphs = [];
96
103
  let paragraphParts = [];
104
+
105
+ // Ignored via go/ees005
106
+ // eslint-disable-next-line no-var
97
107
  for (var index = 0; index < linesSplitByHardbreaks.length; index = index + 1) {
98
108
  var _firstNonHardBreakNod;
99
109
  const line = linesSplitByHardbreaks[index];
@@ -141,6 +151,10 @@ export const extractListFromParagraph = (node, parent, schema) => {
141
151
  continue;
142
152
  }
143
153
  const attrs = nodeType === orderedList ? {
154
+ // Ignored via go/ees005
155
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
156
+ // Ignored via go/ees005
157
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
144
158
  order: parseInt(firstNonHardBreakNode.text.split('.')[0])
145
159
  } : undefined;
146
160
  const newList = nodeType.createChecked(attrs, [listItemNode]);
@@ -267,5 +281,8 @@ export const splitIntoParagraphs = ({
267
281
  if (curChildren.length) {
268
282
  paragraphs.push(paragraph.createChecked(undefined, curChildren, [...blockMarks]));
269
283
  }
270
- return Fragment.from(paragraphs.length ? paragraphs : [paragraph.createAndFill(undefined, undefined, [...blockMarks])]);
284
+ return Fragment.from(paragraphs.length ? paragraphs :
285
+ // Ignored via go/ees005
286
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
287
+ [paragraph.createAndFill(undefined, undefined, [...blockMarks])]);
271
288
  };
@@ -153,6 +153,9 @@ function createPastePayload(actionSubjectId, attributes, linkDomain) {
153
153
  } : {})
154
154
  };
155
155
  }
156
+
157
+ // Ignored via go/ees005
158
+ // eslint-disable-next-line @typescript-eslint/max-params
156
159
  function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, pluginInjectionApi) {
157
160
  return selection => {
158
161
  var _pluginInjectionApi$m, _pluginInjectionApi$m2;
@@ -247,6 +250,9 @@ function createPasteAnalyticsPayloadBySelection(event, slice, pasteContext, plug
247
250
  }, linkDomains);
248
251
  };
249
252
  }
253
+
254
+ // Ignored via go/ees005
255
+ // eslint-disable-next-line @typescript-eslint/max-params
250
256
  export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
251
257
  return createPasteAnalyticsPayloadBySelection(event, slice, pasteContext)(view.state.selection);
252
258
  }
@@ -254,7 +260,10 @@ export function createPasteAnalyticsPayload(view, event, slice, pasteContext) {
254
260
  // TODO: ED-6612 We should not dispatch only analytics, it's preferred to wrap each command with his own analytics.
255
261
  // However, handlers like handleMacroAutoConvert dispatch multiple time,
256
262
  // so pasteCommandWithAnalytics is useless in this case.
257
- export const sendPasteAnalyticsEvent = editorAnalyticsAPI => (view, event, slice, pasteContext) => {
263
+ export const sendPasteAnalyticsEvent = editorAnalyticsAPI =>
264
+ // Ignored via go/ees005
265
+ // eslint-disable-next-line @typescript-eslint/max-params
266
+ (view, event, slice, pasteContext) => {
258
267
  const tr = view.state.tr;
259
268
  const payload = createPasteAnalyticsPayload(view, event, slice, pasteContext);
260
269
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(payload)(tr);
@@ -264,34 +273,55 @@ export const handlePasteAsPlainTextWithAnalytics = editorAnalyticsAPI => (view,
264
273
  type: PasteTypes.plain,
265
274
  asPlain: true
266
275
  }))(handlePasteAsPlainText(slice, event, editorAnalyticsAPI));
267
- export const handlePasteIntoTaskAndDecisionWithAnalytics = (view, event, slice, type, pluginInjectionApi) => {
276
+ export const handlePasteIntoTaskAndDecisionWithAnalytics = (view, event, slice, type, pluginInjectionApi
277
+ // Ignored via go/ees005
278
+ // eslint-disable-next-line @typescript-eslint/max-params
279
+ ) => {
268
280
  var _pluginInjectionApi$a, _pluginInjectionApi$c, _pluginInjectionApi$c2;
269
281
  return injectAnalyticsPayloadBeforeCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(createPasteAnalyticsPayloadBySelection(event, slice, {
270
282
  type
271
283
  }))(handlePasteIntoTaskOrDecisionOrPanel(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.queueCardsFromChangedTr));
272
284
  };
273
- export const handlePasteIntoCaptionWithAnalytics = editorAnalyticsAPI => (view, event, slice, type) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
285
+ export const handlePasteIntoCaptionWithAnalytics = editorAnalyticsAPI =>
286
+ // Ignored via go/ees005
287
+ // eslint-disable-next-line @typescript-eslint/max-params
288
+ (view, event, slice, type) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
274
289
  type
275
290
  }))(handlePasteIntoCaption(slice));
276
- export const handleCodeBlockWithAnalytics = editorAnalyticsAPI => (view, event, slice, text) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
291
+ export const handleCodeBlockWithAnalytics = editorAnalyticsAPI =>
292
+ // Ignored via go/ees005
293
+ // eslint-disable-next-line @typescript-eslint/max-params
294
+ (view, event, slice, text) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
277
295
  type: PasteTypes.plain
278
296
  }))(handleCodeBlock(text));
279
- export const handleMediaSingleWithAnalytics = editorAnalyticsAPI => (view, event, slice, type, insertMediaAsMediaSingle) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
297
+ export const handleMediaSingleWithAnalytics = editorAnalyticsAPI => (view, event, slice, type, insertMediaAsMediaSingle
298
+ // Ignored via go/ees005
299
+ // eslint-disable-next-line @typescript-eslint/max-params
300
+ ) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
280
301
  type
281
302
  }))(handleMediaSingle(INPUT_METHOD.CLIPBOARD, insertMediaAsMediaSingle)(slice));
282
- export const handlePastePreservingMarksWithAnalytics = (view, event, slice, type, pluginInjectionApi) => {
303
+ export const handlePastePreservingMarksWithAnalytics = (view, event, slice, type, pluginInjectionApi
304
+ // Ignored via go/ees005
305
+ // eslint-disable-next-line @typescript-eslint/max-params
306
+ ) => {
283
307
  var _pluginInjectionApi$a2, _pluginInjectionApi$c3, _pluginInjectionApi$c4;
284
308
  return injectAnalyticsPayloadBeforeCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(createPasteAnalyticsPayloadBySelection(event, slice, {
285
309
  type
286
310
  }))(handlePastePreservingMarks(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : (_pluginInjectionApi$c4 = _pluginInjectionApi$c3.actions) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.queueCardsFromChangedTr));
287
311
  };
288
- export const handleMarkdownWithAnalytics = (view, event, slice, pluginInjectionApi) => {
312
+ export const handleMarkdownWithAnalytics = (view, event, slice, pluginInjectionApi
313
+ // Ignored via go/ees005
314
+ // eslint-disable-next-line @typescript-eslint/max-params
315
+ ) => {
289
316
  var _pluginInjectionApi$a3, _pluginInjectionApi$c5, _pluginInjectionApi$c6;
290
317
  return injectAnalyticsPayloadBeforeCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(createPasteAnalyticsPayloadBySelection(event, slice, {
291
318
  type: PasteTypes.markdown
292
319
  }))(handleMarkdown(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c5 = pluginInjectionApi.card) === null || _pluginInjectionApi$c5 === void 0 ? void 0 : (_pluginInjectionApi$c6 = _pluginInjectionApi$c5.actions) === null || _pluginInjectionApi$c6 === void 0 ? void 0 : _pluginInjectionApi$c6.queueCardsFromChangedTr));
293
320
  };
294
- export const handleRichTextWithAnalytics = (view, event, slice, pluginInjectionApi, isNestingMediaOrCodeblockSupported) => {
321
+ export const handleRichTextWithAnalytics = (view, event, slice, pluginInjectionApi, isNestingMediaOrCodeblockSupported
322
+ // Ignored via go/ees005
323
+ // eslint-disable-next-line @typescript-eslint/max-params
324
+ ) => {
295
325
  var _pluginInjectionApi$a4, _pluginInjectionApi$c7, _pluginInjectionApi$c8;
296
326
  return injectAnalyticsPayloadBeforeCommand(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions)(createPasteAnalyticsPayloadBySelection(event, slice, {
297
327
  type: PasteTypes.richText
@@ -318,7 +348,10 @@ const injectAnalyticsPayloadBeforeCommand = editorAnalyticsAPI => createPayloadB
318
348
  };
319
349
  };
320
350
  };
321
- export const handlePastePanelOrDecisionIntoListWithAnalytics = editorAnalyticsAPI => (view, event, slice, findRootParentListNode) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
351
+ export const handlePastePanelOrDecisionIntoListWithAnalytics = editorAnalyticsAPI => (view, event, slice, findRootParentListNode
352
+ // Ignored via go/ees005
353
+ // eslint-disable-next-line @typescript-eslint/max-params
354
+ ) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
322
355
  type: PasteTypes.richText
323
356
  }))(handlePastePanelOrDecisionContentIntoList(slice, findRootParentListNode));
324
357
  export const handlePasteNonNestableBlockNodesIntoListWithAnalytics = editorAnalyticsAPI => (view, event, slice) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
@@ -336,7 +369,10 @@ export const handleNestedTablePasteWithAnalytics = (editorAnalyticsAPI, isNestin
336
369
  export const handleSelectedTableWithAnalytics = editorAnalyticsAPI => (view, event, slice) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
337
370
  type: PasteTypes.richText
338
371
  }))(handleSelectedTable(editorAnalyticsAPI)(slice));
339
- export const handlePasteLinkOnSelectedTextWithAnalytics = editorAnalyticsAPI => (view, event, slice, type) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
372
+ export const handlePasteLinkOnSelectedTextWithAnalytics = editorAnalyticsAPI =>
373
+ // Ignored via go/ees005
374
+ // eslint-disable-next-line @typescript-eslint/max-params
375
+ (view, event, slice, type) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
340
376
  type,
341
377
  hyperlinkPasteOnText: true
342
378
  }))(handlePasteLinkOnSelectedText(slice));