@atlaskit/editor-plugin-text-formatting 1.16.5 → 1.16.7

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/editor-commands/clear-formatting.js +5 -0
  3. package/dist/cjs/editor-commands/transform-to-code.js +13 -1
  4. package/dist/cjs/editor-commands/utils/cell-selection.js +4 -1
  5. package/dist/cjs/pm-plugins/clear-formatting-keymap.js +4 -1
  6. package/dist/cjs/pm-plugins/clear-formatting.js +2 -0
  7. package/dist/cjs/pm-plugins/cursor.js +6 -1
  8. package/dist/cjs/pm-plugins/input-rule.js +13 -1
  9. package/dist/cjs/pm-plugins/keymap.js +28 -7
  10. package/dist/cjs/pm-plugins/main.js +7 -0
  11. package/dist/cjs/pm-plugins/smart-input-rule.js +30 -0
  12. package/dist/cjs/ui/FloatingToolbarComponent.js +8 -4
  13. package/dist/cjs/ui/Toolbar/bold-button.js +5 -2
  14. package/dist/cjs/ui/Toolbar/dropdown-menu.js +4 -6
  15. package/dist/cjs/ui/Toolbar/index.js +8 -2
  16. package/dist/es2019/editor-commands/clear-formatting.js +7 -2
  17. package/dist/es2019/editor-commands/transform-to-code.js +13 -1
  18. package/dist/es2019/editor-commands/utils/cell-selection.js +4 -1
  19. package/dist/es2019/editor-commands/utils.js +1 -1
  20. package/dist/es2019/pm-plugins/clear-formatting-keymap.js +4 -1
  21. package/dist/es2019/pm-plugins/clear-formatting.js +2 -0
  22. package/dist/es2019/pm-plugins/cursor.js +6 -1
  23. package/dist/es2019/pm-plugins/input-rule.js +13 -1
  24. package/dist/es2019/pm-plugins/keymap.js +29 -8
  25. package/dist/es2019/pm-plugins/main.js +6 -0
  26. package/dist/es2019/pm-plugins/smart-input-rule.js +31 -1
  27. package/dist/es2019/ui/FloatingToolbarComponent.js +8 -2
  28. package/dist/es2019/ui/Toolbar/bold-button.js +6 -3
  29. package/dist/es2019/ui/Toolbar/dropdown-menu.js +5 -5
  30. package/dist/es2019/ui/Toolbar/index.js +8 -2
  31. package/dist/esm/editor-commands/clear-formatting.js +5 -0
  32. package/dist/esm/editor-commands/transform-to-code.js +13 -1
  33. package/dist/esm/editor-commands/utils/cell-selection.js +4 -1
  34. package/dist/esm/pm-plugins/clear-formatting-keymap.js +4 -1
  35. package/dist/esm/pm-plugins/clear-formatting.js +2 -0
  36. package/dist/esm/pm-plugins/cursor.js +6 -1
  37. package/dist/esm/pm-plugins/input-rule.js +13 -1
  38. package/dist/esm/pm-plugins/keymap.js +28 -7
  39. package/dist/esm/pm-plugins/main.js +6 -0
  40. package/dist/esm/pm-plugins/smart-input-rule.js +30 -0
  41. package/dist/esm/ui/FloatingToolbarComponent.js +8 -3
  42. package/dist/esm/ui/Toolbar/bold-button.js +6 -3
  43. package/dist/esm/ui/Toolbar/dropdown-menu.js +5 -7
  44. package/dist/esm/ui/Toolbar/index.js +8 -2
  45. package/dist/types/ui/Toolbar/dropdown-menu.d.ts +3 -1
  46. package/dist/types-ts4.5/ui/Toolbar/dropdown-menu.d.ts +3 -1
  47. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-text-formatting
2
2
 
3
+ ## 1.16.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#99080](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99080)
8
+ [`8b2f0af25c400`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8b2f0af25c400) -
9
+ [ux] ED-26062: Removed icon blue borders when selected
10
+
11
+ ## 1.16.6
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 1.16.5
4
18
 
5
19
  ### Patch Changes
@@ -25,6 +25,9 @@ var formatTypes = {
25
25
  function clearFormattingWithAnalytics(inputMethod, editorAnalyticsAPI) {
26
26
  return clearFormatting(inputMethod, editorAnalyticsAPI);
27
27
  }
28
+
29
+ // Ignored via go/ees005
30
+ // eslint-disable-next-line @typescript-eslint/max-params
28
31
  function clearNodeFormattingOnSelection(state, tr, formattedNodeType, nodeName, formattingCleared) {
29
32
  return function (node, pos) {
30
33
  if (node.type === formattedNodeType) {
@@ -41,6 +44,8 @@ function clearNodeFormattingOnSelection(state, tr, formattedNodeType, nodeName,
41
44
  var targetLiftDepth = (0, _transform.liftTarget)(nodeRange);
42
45
  if (targetLiftDepth || targetLiftDepth === 0) {
43
46
  formattingCleared.push(nodeName);
47
+ // Ignored via go/ees005
48
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
44
49
  tr.lift(nodeRange, targetLiftDepth);
45
50
  }
46
51
  }
@@ -15,8 +15,14 @@ var SMART_TO_ASCII = {
15
15
  '‘': "'",
16
16
  '’': "'"
17
17
  };
18
+
19
+ // Ignored via go/ees005
20
+ // eslint-disable-next-line require-unicode-regexp
18
21
  var FIND_SMART_CHAR = new RegExp("[".concat(Object.keys(SMART_TO_ASCII).join(''), "]"), 'g');
19
- var replaceMentionOrEmojiForTextContent = function replaceMentionOrEmojiForTextContent(position, nodeSize, textContent, tr) {
22
+ var replaceMentionOrEmojiForTextContent = function replaceMentionOrEmojiForTextContent(position, nodeSize, textContent, tr
23
+ // Ignored via go/ees005
24
+ // eslint-disable-next-line @typescript-eslint/max-params
25
+ ) {
20
26
  var currentPos = tr.mapping.map(position);
21
27
  var schema = tr.doc.type.schema;
22
28
  tr.replaceWith(currentPos, currentPos + nodeSize, schema.text(textContent));
@@ -24,6 +30,9 @@ var replaceMentionOrEmojiForTextContent = function replaceMentionOrEmojiForTextC
24
30
  var replaceSmartCharsToAscii = function replaceSmartCharsToAscii(position, textContent, tr) {
25
31
  var schema = tr.doc.type.schema;
26
32
  var match;
33
+
34
+ // Ignored via go/ees005
35
+ // eslint-disable-next-line no-cond-assign
27
36
  while (match = FIND_SMART_CHAR.exec(textContent)) {
28
37
  var _match = match,
29
38
  smartChar = _match[0],
@@ -38,6 +47,9 @@ var isNodeTextBlock = function isNodeTextBlock(schema) {
38
47
  mention = _schema$nodes.mention,
39
48
  text = _schema$nodes.text,
40
49
  emoji = _schema$nodes.emoji;
50
+
51
+ // Ignored via go/ees005
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
53
  return function (node, _, parent) {
42
54
  if (node.type === mention || node.type === emoji || node.type === text) {
43
55
  return parent === null || parent === void 0 ? void 0 : parent.isTextblock;
@@ -4,7 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.cellSelectionNodesBetween = void 0;
7
- var cellSelectionNodesBetween = exports.cellSelectionNodesBetween = function cellSelectionNodesBetween(selection, doc, f, startPos) {
7
+ var cellSelectionNodesBetween = exports.cellSelectionNodesBetween = function cellSelectionNodesBetween(selection, doc, f, startPos
8
+ // Ignored via go/ees005
9
+ // eslint-disable-next-line @typescript-eslint/max-params
10
+ ) {
8
11
  selection.forEachCell(function (cell, cellPos) {
9
12
  doc.nodesBetween(cellPos, cellPos + cell.nodeSize, f, startPos);
10
13
  });
@@ -11,7 +11,10 @@ var _keymap = require("@atlaskit/editor-prosemirror/keymap");
11
11
  var _clearFormatting = require("../editor-commands/clear-formatting");
12
12
  function keymapPlugin(editorAnalyticsAPI) {
13
13
  var list = {};
14
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.clearFormatting.common, (0, _clearFormatting.clearFormattingWithAnalytics)(_analytics.INPUT_METHOD.SHORTCUT, editorAnalyticsAPI), list);
14
+ (0, _keymaps.bindKeymapWithCommand)(
15
+ // Ignored via go/ees005
16
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
17
+ _keymaps.clearFormatting.common, (0, _clearFormatting.clearFormattingWithAnalytics)(_analytics.INPUT_METHOD.SHORTCUT, editorAnalyticsAPI), list);
15
18
  return (0, _keymap.keymap)(list);
16
19
  }
17
20
  var _default = exports.default = keymapPlugin;
@@ -16,6 +16,8 @@ var plugin = exports.plugin = function plugin(dispatch) {
16
16
  formattingIsPresent: (0, _utils.checkFormattingIsPresent)(state)
17
17
  };
18
18
  },
19
+ // Ignored via go/ees005
20
+ // eslint-disable-next-line @typescript-eslint/max-params
19
21
  apply: function apply(_tr, pluginState, _oldState, newState) {
20
22
  var formattingIsPresent = (0, _utils.checkFormattingIsPresent)(newState);
21
23
  if (formattingIsPresent !== pluginState.formattingIsPresent) {
@@ -11,6 +11,8 @@ var _default = exports.default = new _safePlugin.SafePlugin({
11
11
  props: {
12
12
  handleClick: function handleClick(view, clickPos, event) {
13
13
  // Don't apply in Edge as per ED-4546
14
+ // Ignored via go/ees005
15
+ // eslint-disable-next-line require-unicode-regexp
14
16
  if (navigator && /Edge\/\d/.test(navigator.userAgent)) {
15
17
  return false;
16
18
  }
@@ -36,7 +38,10 @@ var _default = exports.default = new _safePlugin.SafePlugin({
36
38
  // it was at a directly adjacent non-text node, so we skip this manual
37
39
  // text selection logic to preserve that non-text node's selection
38
40
  clickWasAtTextNode || clickWasAtEndOfAParagraphNode)) {
39
- var clickWasInsideNodeDOM = event.target.parentNode === view.domAtPos(clickedDOMElementPosition).node && code.isInSet(view.state.doc.resolve(clickedDOMElementPosition).nodeAfter.marks);
41
+ var clickWasInsideNodeDOM = event.target.parentNode === view.domAtPos(clickedDOMElementPosition).node &&
42
+ // Ignored via go/ees005
43
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
44
+ code.isInSet(view.state.doc.resolve(clickedDOMElementPosition).nodeAfter.marks);
40
45
  var nodeNextToClick = $click.nodeBefore && code.isInSet($click.nodeBefore.marks) ? $click.nodeAfter : $click.nodeBefore;
41
46
 
42
47
  // Need to set the selection here to allow clicking between [code('text'),{<>},emoji()]
@@ -61,6 +61,8 @@ ValidAutoformatChars.STRONG_MARKDOWN]), ValidAutoformatChars.CODE, [
61
61
  // e.g: loko (`some code`
62
62
  '( ']);
63
63
  function addMark(markType, schema, char) {
64
+ // Ignored via go/ees005
65
+ // eslint-disable-next-line @typescript-eslint/max-params
64
66
  return function (state, match, start, end) {
65
67
  var _schema$marks;
66
68
  var doc = state.doc,
@@ -143,7 +145,11 @@ var ReverseRegexExp = /*#__PURE__*/function (_RegExp) {
143
145
  }]);
144
146
  }( /*#__PURE__*/(0, _wrapNativeSuper2.default)(RegExp));
145
147
  var buildRegex = function buildRegex(char) {
148
+ // Ignored via go/ees005
149
+ // eslint-disable-next-line require-unicode-regexp
146
150
  var escapedChar = char.replace(/(\W)/g, '\\$1');
151
+ // Ignored via go/ees005
152
+ // eslint-disable-next-line require-unicode-regexp
147
153
  var combinations = ValidCombinations[char].map(function (c) {
148
154
  return c.replace(/(\W)/g, '\\$1');
149
155
  }).join('|');
@@ -151,7 +157,13 @@ var buildRegex = function buildRegex(char) {
151
157
  // Single X - https://regex101.com/r/McT3yq/14/
152
158
  // Double X - https://regex101.com/r/pQUgjx/1/
153
159
  var baseRegex = '^X(?=[^X\\s]).*?[^\\sX]X(?=[\\sOBJECT_REPLACEMENT_CHARACTER]COMBINATIONS|$)'.replace('OBJECT_REPLACEMENT_CHARACTER', _prosemirrorInputRules.leafNodeReplacementCharacter).replace('COMBINATIONS', combinations ? "|".concat(combinations) : '');
154
- var replacedRegex = String.prototype.hasOwnProperty('replaceAll') ? baseRegex.replaceAll('X', escapedChar) : baseRegex.replace(/X/g, escapedChar);
160
+ var replacedRegex = String.prototype.hasOwnProperty('replaceAll') ?
161
+ // Ignored via go/ees005
162
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
163
+ baseRegex.replaceAll('X', escapedChar) :
164
+ // Ignored via go/ees005
165
+ // eslint-disable-next-line require-unicode-regexp
166
+ baseRegex.replace(/X/g, escapedChar);
155
167
  return new ReverseRegexExp(replacedRegex);
156
168
  };
157
169
  var strongRegex1 = exports.strongRegex1 = buildRegex(ValidAutoformatChars.STRONG);
@@ -12,25 +12,46 @@ var _commands = require("./commands");
12
12
  function keymapPlugin(schema, editorAnalyticsAPI) {
13
13
  var list = {};
14
14
  if (schema.marks.strong) {
15
- (0, _keymaps.bindKeymapWithEditorCommand)(_keymaps.toggleBold.common, (0, _commands.toggleStrongWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
15
+ (0, _keymaps.bindKeymapWithEditorCommand)(
16
+ // Ignored via go/ees005
17
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
18
+ _keymaps.toggleBold.common, (0, _commands.toggleStrongWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
16
19
  }
17
20
  if (schema.marks.em) {
18
- (0, _keymaps.bindKeymapWithEditorCommand)(_keymaps.toggleItalic.common, (0, _commands.toggleEmWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
21
+ (0, _keymaps.bindKeymapWithEditorCommand)(
22
+ // Ignored via go/ees005
23
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
24
+ _keymaps.toggleItalic.common, (0, _commands.toggleEmWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
19
25
  }
20
26
  if (schema.marks.code) {
21
- (0, _keymaps.bindKeymapWithEditorCommand)(_keymaps.toggleCode.common, (0, _commands.toggleCodeWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
27
+ (0, _keymaps.bindKeymapWithEditorCommand)(
28
+ // Ignored via go/ees005
29
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
30
+ _keymaps.toggleCode.common, (0, _commands.toggleCodeWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
22
31
  }
23
32
  if (schema.marks.strike) {
24
- (0, _keymaps.bindKeymapWithEditorCommand)(_keymaps.toggleStrikethrough.common, (0, _commands.toggleStrikeWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
33
+ (0, _keymaps.bindKeymapWithEditorCommand)(
34
+ // Ignored via go/ees005
35
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
36
+ _keymaps.toggleStrikethrough.common, (0, _commands.toggleStrikeWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
25
37
  }
26
38
  if (schema.marks.subsup) {
27
- (0, _keymaps.bindKeymapWithEditorCommand)(_keymaps.toggleSubscript.common, (0, _commands.toggleSubscriptWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
39
+ (0, _keymaps.bindKeymapWithEditorCommand)(
40
+ // Ignored via go/ees005
41
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
42
+ _keymaps.toggleSubscript.common, (0, _commands.toggleSubscriptWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
28
43
  }
29
44
  if (schema.marks.subsup) {
30
- (0, _keymaps.bindKeymapWithEditorCommand)(_keymaps.toggleSuperscript.common, (0, _commands.toggleSuperscriptWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
45
+ (0, _keymaps.bindKeymapWithEditorCommand)(
46
+ // Ignored via go/ees005
47
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
48
+ _keymaps.toggleSuperscript.common, (0, _commands.toggleSuperscriptWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
31
49
  }
32
50
  if (schema.marks.underline) {
33
- (0, _keymaps.bindKeymapWithEditorCommand)(_keymaps.toggleUnderline.common, (0, _commands.toggleUnderlineWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
51
+ (0, _keymaps.bindKeymapWithEditorCommand)(
52
+ // Ignored via go/ees005
53
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
54
+ _keymaps.toggleUnderline.common, (0, _commands.toggleUnderlineWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
34
55
  }
35
56
  return new _safePlugin.SafePlugin({
36
57
  props: {
@@ -19,6 +19,9 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
19
19
  // TODO: Ideally this should use the custom toggleMark function from @atlaskit/editor-common so we also disable the options when selecting inline nodes but it disables the marks when the selection is empty at this point in time which is undesirable
20
20
  // import { toggleMark } from '@atlaskit/editor-common/mark';
21
21
 
22
+ // Ignored via go/ees005
23
+ // eslint-disable-next-line import/no-namespace
24
+
22
25
  var isSelectionInlineCursor = function isSelectionInlineCursor(selection) {
23
26
  if (selection instanceof _state.NodeSelection) {
24
27
  return true;
@@ -86,6 +89,8 @@ var plugin = exports.plugin = function plugin(dispatch, editorAnalyticsAPI) {
86
89
  init: function init(_config, state) {
87
90
  return getTextFormattingState(state, editorAnalyticsAPI);
88
91
  },
92
+ // Ignored via go/ees005
93
+ // eslint-disable-next-line @typescript-eslint/max-params
89
94
  apply: function apply(_tr, pluginState, _oldState, newState) {
90
95
  var state = getTextFormattingState(newState, editorAnalyticsAPI);
91
96
  if (!(0, _utils.shallowEqual)(pluginState, state)) {
@@ -107,6 +112,8 @@ var plugin = exports.plugin = function plugin(dispatch, editorAnalyticsAPI) {
107
112
  }
108
113
  return false;
109
114
  },
115
+ // Ignored via go/ees005
116
+ // eslint-disable-next-line @typescript-eslint/max-params
110
117
  handleTextInput: function handleTextInput(view, from, to, text) {
111
118
  var state = view.state,
112
119
  dispatch = view.dispatch;
@@ -21,6 +21,8 @@ var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
21
21
  * @param text text to replace with
22
22
  */
23
23
  function replaceTextUsingCaptureGroup(text) {
24
+ // Ignored via go/ees005
25
+ // eslint-disable-next-line @typescript-eslint/max-params
24
26
  return function (state, match, start, end) {
25
27
  var _match = (0, _slicedToArray2.default)(match, 4),
26
28
  prefix = _match[1],
@@ -65,6 +67,8 @@ function createReplacementRules(replMap, replacementRuleWithAnalytics) {
65
67
  function createSingleQuotesRules() {
66
68
  return [
67
69
  // wrapped text
70
+ // Ignored via go/ees005
71
+ // eslint-disable-next-line require-unicode-regexp, @typescript-eslint/max-params
68
72
  (0, _utils.createRule)(/(\s|^)'(\S+.*\S+)'$/, function (state, match, start, end) {
69
73
  var OPEN_SMART_QUOTE_CHAR = '‘';
70
74
  var CLOSED_SMART_QUOTE_CHAR = '’';
@@ -81,6 +85,8 @@ function createSingleQuotesRules() {
81
85
  return state.tr.insertText(CLOSED_SMART_QUOTE_CHAR, positionOfClosedQuote, end).insertText(openQuoteReplacement, start, start + openQuoteReplacement.length);
82
86
  }),
83
87
  // apostrophe
88
+ // Ignored via go/ees005
89
+ // eslint-disable-next-line require-unicode-regexp
84
90
  createReplacementRule('’', /(\w+)(')(\w+)$/)];
85
91
  }
86
92
 
@@ -103,10 +109,20 @@ function getProductRules(editorAnalyticsAPI) {
103
109
  }, editorAnalyticsAPI);
104
110
  };
105
111
  return createReplacementRules({
112
+ // Ignored via go/ees005
113
+ // eslint-disable-next-line require-unicode-regexp
106
114
  Atlassian: /(\s+|^)(atlassian)(\s)$/,
115
+ // Ignored via go/ees005
116
+ // eslint-disable-next-line require-unicode-regexp
107
117
  Jira: /(\s+|^)(jira|JIRA)(\s)$/,
118
+ // Ignored via go/ees005
119
+ // eslint-disable-next-line require-unicode-regexp
108
120
  Bitbucket: /(\s+|^)(bitbucket|BitBucket)(\s)$/,
121
+ // Ignored via go/ees005
122
+ // eslint-disable-next-line require-unicode-regexp
109
123
  Hipchat: /(\s+|^)(hipchat|HipChat)(\s)$/,
124
+ // Ignored via go/ees005
125
+ // eslint-disable-next-line require-unicode-regexp
110
126
  Trello: /(\s+|^)(trello)(\s)$/
111
127
  }, productRuleWithAnalytics);
112
128
  }
@@ -132,8 +148,14 @@ function getSymbolRules(editorAnalyticsAPI) {
132
148
  }, editorAnalyticsAPI);
133
149
  };
134
150
  return createReplacementRules({
151
+ // Ignored via go/ees005
152
+ // eslint-disable-next-line require-unicode-regexp
135
153
  '→': /(\s+|^)(--?>)(\s)$/,
154
+ // Ignored via go/ees005
155
+ // eslint-disable-next-line require-unicode-regexp
136
156
  '←': /(\s+|^)(<--?)(\s)$/,
157
+ // Ignored via go/ees005
158
+ // eslint-disable-next-line require-unicode-regexp
137
159
  '↔︎': /(\s+|^)(<->?)(\s)$/
138
160
  }, symbolRuleWithAnalytics);
139
161
  }
@@ -159,11 +181,19 @@ function getPunctuationRules(editorAnalyticsAPI) {
159
181
  }, editorAnalyticsAPI);
160
182
  };
161
183
  var dashEllipsisRules = createReplacementRules({
184
+ // Ignored via go/ees005
185
+ // eslint-disable-next-line require-unicode-regexp
162
186
  '–': /(\s+|^)(--)(\s)$/,
187
+ // Ignored via go/ees005
188
+ // eslint-disable-next-line require-unicode-regexp
163
189
  '…': /()(\.\.\.)$/
164
190
  }, punctuationRuleWithAnalytics);
165
191
  var doubleQuoteRules = createReplacementRules({
192
+ // Ignored via go/ees005
193
+ // eslint-disable-next-line require-unicode-regexp
166
194
  '“': /((?:^|[\s\{\[\(\<'"\u2018\u201C]))(")$/,
195
+ // Ignored via go/ees005
196
+ // eslint-disable-next-line require-unicode-regexp
167
197
  '”': /"$/
168
198
  }, punctuationRuleWithAnalytics);
169
199
  var singleQuoteRules = createSingleQuotesRules();
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.FloatingToolbarTextFormalWithIntl = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
7
  var _react = require("react");
10
8
  var _react2 = require("@emotion/react");
11
9
  var _reactIntlNext = require("react-intl-next");
@@ -54,9 +52,15 @@ var FloatingToolbarTextFormat = function FloatingToolbarTextFormat(_ref) {
54
52
  });
55
53
  var items = (0, _react.useMemo)(function () {
56
54
  if (!clearIcon) {
57
- return defaultIcons;
55
+ return [{
56
+ items: defaultIcons
57
+ }];
58
58
  }
59
- return [].concat((0, _toConsumableArray2.default)(defaultIcons), [clearIcon]);
59
+ return [{
60
+ items: defaultIcons
61
+ }, {
62
+ items: [clearIcon]
63
+ }];
60
64
  }, [clearIcon, defaultIcons]);
61
65
  return (0, _react2.jsx)(_dropdownMenu.FormattingTextDropdownMenu, {
62
66
  editorView: editorView,
@@ -30,7 +30,10 @@ var BoldToolbarButton = exports.BoldToolbarButton = function BoldToolbarButton(_
30
30
  onKeyDown = _ref.onKeyDown,
31
31
  toolbarType = _ref.toolbarType;
32
32
  var reducedSpacing = toolbarType === _types.ToolbarType.FLOATING ? 'compact' : 'none';
33
- return (0, _react2.jsx)(_uiMenu.ToolbarButton, {
33
+ return (0, _react2.jsx)(_uiMenu.ToolbarButton
34
+ // eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides, @atlaskit/ui-styling-standard/no-imported-style-values
35
+ , {
36
+ css: _styles.disableBlueBorderStyles,
34
37
  testId: 'ak-editor-selection-toolbar-format-text-button',
35
38
  spacing: isReducedSpacing ? reducedSpacing : 'default',
36
39
  disabled: isDisabled,
@@ -43,7 +46,7 @@ var BoldToolbarButton = exports.BoldToolbarButton = function BoldToolbarButton(_
43
46
  onKeyDown: onKeyDown,
44
47
  iconBefore: (0, _react2.jsx)("div", {
45
48
  css:
46
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-registration
49
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
47
50
  (0, _platformFeatureFlags.fg)('platform-visual-refresh-icons') ?
48
51
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values
49
52
  _styles.triggerWrapperStylesWithPadding :
@@ -37,11 +37,6 @@ var FormattingTextDropdownMenu = exports.FormattingTextDropdownMenu = /*#__PURE_
37
37
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
38
38
  isOpenedByKeyboard = _useState2[0],
39
39
  setIsOpenedByKeyboard = _useState2[1];
40
- var group = (0, _react.useMemo)(function () {
41
- return [{
42
- items: items
43
- }];
44
- }, [items]);
45
40
  var onItemActivated = (0, _react.useCallback)(function (_ref2) {
46
41
  var item = _ref2.item,
47
42
  _ref2$shouldCloseMenu = _ref2.shouldCloseMenu,
@@ -60,11 +55,14 @@ var FormattingTextDropdownMenu = exports.FormattingTextDropdownMenu = /*#__PURE_
60
55
  scrollableElement: popupsScrollableElement,
61
56
  onItemActivated: onItemActivated,
62
57
  isOpen: isMenuOpen,
63
- items: group,
58
+ items: items,
64
59
  zIndex: _editorSharedStyles.akEditorMenuZIndex,
65
60
  fitHeight: 188,
66
61
  fitWidth: 136,
67
62
  shouldUseDefaultRole: true,
63
+ section: {
64
+ hasSeparator: true
65
+ },
68
66
  shouldFocusFirstItem: function shouldFocusFirstItem() {
69
67
  if (isOpenedByKeyboard) {
70
68
  setIsOpenedByKeyboard(false);
@@ -119,9 +119,15 @@ var ToolbarFormatting = function ToolbarFormatting(_ref) {
119
119
  }
120
120
  var items = (0, _react.useMemo)(function () {
121
121
  if (!clearIcon) {
122
- return dropdownItems;
122
+ return [{
123
+ items: dropdownItems
124
+ }];
123
125
  }
124
- return [].concat((0, _toConsumableArray2.default)(dropdownItems), [clearIcon]);
126
+ return [{
127
+ items: dropdownItems
128
+ }, {
129
+ items: [clearIcon]
130
+ }];
125
131
  }, [clearIcon, dropdownItems]);
126
132
  var moreFormattingButtonLabel = intl.formatMessage(_messages.toolbarMessages.moreFormatting);
127
133
  var labelTextFormat = intl.formatMessage(_messages.toolbarMessages.textFormatting);
@@ -17,6 +17,9 @@ const formatTypes = {
17
17
  export function clearFormattingWithAnalytics(inputMethod, editorAnalyticsAPI) {
18
18
  return clearFormatting(inputMethod, editorAnalyticsAPI);
19
19
  }
20
+
21
+ // Ignored via go/ees005
22
+ // eslint-disable-next-line @typescript-eslint/max-params
20
23
  function clearNodeFormattingOnSelection(state, tr, formattedNodeType, nodeName, formattingCleared) {
21
24
  return function (node, pos) {
22
25
  if (node.type === formattedNodeType) {
@@ -26,13 +29,15 @@ function clearNodeFormattingOnSelection(state, tr, formattedNodeType, nodeName,
26
29
  return false;
27
30
  } else {
28
31
  // In case of panel or blockquote
29
- let fromPos = tr.doc.resolve(pos + 1);
30
- let toPos = tr.doc.resolve(pos + node.nodeSize - 1);
32
+ const fromPos = tr.doc.resolve(pos + 1);
33
+ const toPos = tr.doc.resolve(pos + node.nodeSize - 1);
31
34
  const nodeRange = fromPos.blockRange(toPos);
32
35
  if (nodeRange) {
33
36
  const targetLiftDepth = liftTarget(nodeRange);
34
37
  if (targetLiftDepth || targetLiftDepth === 0) {
35
38
  formattingCleared.push(nodeName);
39
+ // Ignored via go/ees005
40
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
36
41
  tr.lift(nodeRange, targetLiftDepth);
37
42
  }
38
43
  }
@@ -9,8 +9,14 @@ const SMART_TO_ASCII = {
9
9
  '‘': "'",
10
10
  '’': "'"
11
11
  };
12
+
13
+ // Ignored via go/ees005
14
+ // eslint-disable-next-line require-unicode-regexp
12
15
  const FIND_SMART_CHAR = new RegExp(`[${Object.keys(SMART_TO_ASCII).join('')}]`, 'g');
13
- const replaceMentionOrEmojiForTextContent = (position, nodeSize, textContent, tr) => {
16
+ const replaceMentionOrEmojiForTextContent = (position, nodeSize, textContent, tr
17
+ // Ignored via go/ees005
18
+ // eslint-disable-next-line @typescript-eslint/max-params
19
+ ) => {
14
20
  const currentPos = tr.mapping.map(position);
15
21
  const {
16
22
  schema
@@ -22,6 +28,9 @@ const replaceSmartCharsToAscii = (position, textContent, tr) => {
22
28
  schema
23
29
  } = tr.doc.type;
24
30
  let match;
31
+
32
+ // Ignored via go/ees005
33
+ // eslint-disable-next-line no-cond-assign
25
34
  while (match = FIND_SMART_CHAR.exec(textContent)) {
26
35
  const {
27
36
  0: smartChar,
@@ -38,6 +47,9 @@ const isNodeTextBlock = schema => {
38
47
  text,
39
48
  emoji
40
49
  } = schema.nodes;
50
+
51
+ // Ignored via go/ees005
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
53
  return (node, _, parent) => {
42
54
  if (node.type === mention || node.type === emoji || node.type === text) {
43
55
  return parent === null || parent === void 0 ? void 0 : parent.isTextblock;
@@ -1,4 +1,7 @@
1
- export const cellSelectionNodesBetween = (selection, doc, f, startPos) => {
1
+ export const cellSelectionNodesBetween = (selection, doc, f, startPos
2
+ // Ignored via go/ees005
3
+ // eslint-disable-next-line @typescript-eslint/max-params
4
+ ) => {
2
5
  selection.forEachCell((cell, cellPos) => {
3
6
  doc.nodesBetween(cellPos, cellPos + cell.nodeSize, f, startPos);
4
7
  });
@@ -32,7 +32,7 @@ export const markActive = (state, mark) => {
32
32
  return found;
33
33
  };
34
34
  const blockStylingIsPresent = state => {
35
- let {
35
+ const {
36
36
  from,
37
37
  to
38
38
  } = state.selection;
@@ -4,7 +4,10 @@ import { keymap } from '@atlaskit/editor-prosemirror/keymap';
4
4
  import { clearFormattingWithAnalytics } from '../editor-commands/clear-formatting';
5
5
  export function keymapPlugin(editorAnalyticsAPI) {
6
6
  const list = {};
7
- bindKeymapWithCommand(clearFormatting.common, clearFormattingWithAnalytics(INPUT_METHOD.SHORTCUT, editorAnalyticsAPI), list);
7
+ bindKeymapWithCommand(
8
+ // Ignored via go/ees005
9
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10
+ clearFormatting.common, clearFormattingWithAnalytics(INPUT_METHOD.SHORTCUT, editorAnalyticsAPI), list);
8
11
  return keymap(list);
9
12
  }
10
13
  export default keymapPlugin;
@@ -9,6 +9,8 @@ export const plugin = dispatch => new SafePlugin({
9
9
  formattingIsPresent: checkFormattingIsPresent(state)
10
10
  };
11
11
  },
12
+ // Ignored via go/ees005
13
+ // eslint-disable-next-line @typescript-eslint/max-params
12
14
  apply(_tr, pluginState, _oldState, newState) {
13
15
  const formattingIsPresent = checkFormattingIsPresent(newState);
14
16
  if (formattingIsPresent !== pluginState.formattingIsPresent) {
@@ -5,6 +5,8 @@ export default new SafePlugin({
5
5
  props: {
6
6
  handleClick(view, clickPos, event) {
7
7
  // Don't apply in Edge as per ED-4546
8
+ // Ignored via go/ees005
9
+ // eslint-disable-next-line require-unicode-regexp
8
10
  if (navigator && /Edge\/\d/.test(navigator.userAgent)) {
9
11
  return false;
10
12
  }
@@ -34,7 +36,10 @@ export default new SafePlugin({
34
36
  // it was at a directly adjacent non-text node, so we skip this manual
35
37
  // text selection logic to preserve that non-text node's selection
36
38
  clickWasAtTextNode || clickWasAtEndOfAParagraphNode)) {
37
- const clickWasInsideNodeDOM = event.target.parentNode === view.domAtPos(clickedDOMElementPosition).node && code.isInSet(view.state.doc.resolve(clickedDOMElementPosition).nodeAfter.marks);
39
+ const clickWasInsideNodeDOM = event.target.parentNode === view.domAtPos(clickedDOMElementPosition).node &&
40
+ // Ignored via go/ees005
41
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
42
+ code.isInSet(view.state.doc.resolve(clickedDOMElementPosition).nodeAfter.marks);
38
43
  const nodeNextToClick = $click.nodeBefore && code.isInSet($click.nodeBefore.marks) ? $click.nodeAfter : $click.nodeBefore;
39
44
 
40
45
  // Need to set the selection here to allow clicking between [code('text'),{<>},emoji()]
@@ -47,6 +47,8 @@ export const ValidCombinations = {
47
47
  '( ']
48
48
  };
49
49
  function addMark(markType, schema, char) {
50
+ // Ignored via go/ees005
51
+ // eslint-disable-next-line @typescript-eslint/max-params
50
52
  return (state, match, start, end) => {
51
53
  var _schema$marks, _schema$marks$code;
52
54
  const {
@@ -123,13 +125,23 @@ class ReverseRegexExp extends RegExp {
123
125
  }
124
126
  }
125
127
  const buildRegex = char => {
128
+ // Ignored via go/ees005
129
+ // eslint-disable-next-line require-unicode-regexp
126
130
  const escapedChar = char.replace(/(\W)/g, '\\$1');
131
+ // Ignored via go/ees005
132
+ // eslint-disable-next-line require-unicode-regexp
127
133
  const combinations = ValidCombinations[char].map(c => c.replace(/(\W)/g, '\\$1')).join('|');
128
134
 
129
135
  // Single X - https://regex101.com/r/McT3yq/14/
130
136
  // Double X - https://regex101.com/r/pQUgjx/1/
131
137
  const baseRegex = '^X(?=[^X\\s]).*?[^\\sX]X(?=[\\sOBJECT_REPLACEMENT_CHARACTER]COMBINATIONS|$)'.replace('OBJECT_REPLACEMENT_CHARACTER', leafNodeReplacementCharacter).replace('COMBINATIONS', combinations ? `|${combinations}` : '');
132
- const replacedRegex = String.prototype.hasOwnProperty('replaceAll') ? baseRegex.replaceAll('X', escapedChar) : baseRegex.replace(/X/g, escapedChar);
138
+ const replacedRegex = String.prototype.hasOwnProperty('replaceAll') ?
139
+ // Ignored via go/ees005
140
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
141
+ baseRegex.replaceAll('X', escapedChar) :
142
+ // Ignored via go/ees005
143
+ // eslint-disable-next-line require-unicode-regexp
144
+ baseRegex.replace(/X/g, escapedChar);
133
145
  return new ReverseRegexExp(replacedRegex);
134
146
  };
135
147
  export const strongRegex1 = buildRegex(ValidAutoformatChars.STRONG);