@atlaskit/editor-core 187.8.7 → 187.8.11

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 (157) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/index.js +0 -6
  3. package/dist/cjs/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
  4. package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +4 -4
  5. package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +5 -5
  6. package/dist/cjs/plugins/layout/pm-plugins/main.js +1 -1
  7. package/dist/cjs/plugins/list/actions/conversions.js +5 -5
  8. package/dist/cjs/plugins/list/actions/indent-list-items-selected.js +11 -11
  9. package/dist/cjs/plugins/list/actions/join-list-items-forward.js +6 -6
  10. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +6 -7
  11. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +3 -4
  12. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +3 -4
  13. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +2 -2
  14. package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +2 -2
  15. package/dist/cjs/plugins/list/actions/merge-lists.js +3 -3
  16. package/dist/cjs/plugins/list/actions/outdent-list-items-selected.js +11 -11
  17. package/dist/cjs/plugins/list/actions/wrap-and-join-lists.js +2 -2
  18. package/dist/cjs/plugins/list/commands/indent-list.js +6 -7
  19. package/dist/cjs/plugins/list/commands/index.js +8 -10
  20. package/dist/cjs/plugins/list/commands/join-list-item-forward.js +5 -5
  21. package/dist/cjs/plugins/list/commands/listBackspace.js +13 -14
  22. package/dist/cjs/plugins/list/commands/outdent-list.js +4 -3
  23. package/dist/cjs/plugins/list/pm-plugins/main.js +5 -6
  24. package/dist/cjs/plugins/list/utils/analytics.js +1 -35
  25. package/dist/cjs/plugins/list/utils/indentation.js +2 -20
  26. package/dist/cjs/plugins/list/utils/node.js +2 -106
  27. package/dist/cjs/plugins/list/utils/selection.js +3 -54
  28. package/dist/cjs/plugins/tasks-and-decisions/commands.js +2 -2
  29. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +17 -18
  30. package/dist/cjs/plugins/text-formatting/index.js +23 -21
  31. package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +48 -54
  32. package/dist/cjs/plugins/text-formatting/pm-plugins/smart-input-rule.js +28 -33
  33. package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
  34. package/dist/cjs/utils/commands.js +3 -109
  35. package/dist/cjs/utils/document.js +1 -26
  36. package/dist/cjs/utils/index.js +0 -6
  37. package/dist/cjs/version-wrapper.js +1 -1
  38. package/dist/cjs/version.json +1 -1
  39. package/dist/es2019/index.js +1 -1
  40. package/dist/es2019/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
  41. package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +1 -1
  42. package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +1 -1
  43. package/dist/es2019/plugins/layout/pm-plugins/main.js +1 -1
  44. package/dist/es2019/plugins/list/actions/conversions.js +2 -2
  45. package/dist/es2019/plugins/list/actions/indent-list-items-selected.js +2 -2
  46. package/dist/es2019/plugins/list/actions/join-list-items-forward.js +1 -1
  47. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
  48. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -2
  49. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -2
  50. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +1 -1
  51. package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +1 -1
  52. package/dist/es2019/plugins/list/actions/merge-lists.js +1 -1
  53. package/dist/es2019/plugins/list/actions/outdent-list-items-selected.js +3 -3
  54. package/dist/es2019/plugins/list/actions/wrap-and-join-lists.js +1 -1
  55. package/dist/es2019/plugins/list/commands/indent-list.js +3 -4
  56. package/dist/es2019/plugins/list/commands/index.js +4 -5
  57. package/dist/es2019/plugins/list/commands/join-list-item-forward.js +1 -1
  58. package/dist/es2019/plugins/list/commands/listBackspace.js +1 -2
  59. package/dist/es2019/plugins/list/commands/outdent-list.js +3 -2
  60. package/dist/es2019/plugins/list/pm-plugins/main.js +1 -1
  61. package/dist/es2019/plugins/list/utils/analytics.js +0 -36
  62. package/dist/es2019/plugins/list/utils/indentation.js +0 -18
  63. package/dist/es2019/plugins/list/utils/node.js +3 -89
  64. package/dist/es2019/plugins/list/utils/selection.js +1 -52
  65. package/dist/es2019/plugins/tasks-and-decisions/commands.js +1 -1
  66. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
  67. package/dist/es2019/plugins/text-formatting/index.js +15 -10
  68. package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +20 -18
  69. package/dist/es2019/plugins/text-formatting/pm-plugins/smart-input-rule.js +11 -12
  70. package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
  71. package/dist/es2019/utils/commands.js +2 -102
  72. package/dist/es2019/utils/document.js +1 -26
  73. package/dist/es2019/utils/index.js +1 -1
  74. package/dist/es2019/version-wrapper.js +1 -1
  75. package/dist/es2019/version.json +1 -1
  76. package/dist/esm/index.js +1 -1
  77. package/dist/esm/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
  78. package/dist/esm/plugins/block-type/pm-plugins/keymap.js +1 -1
  79. package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +1 -1
  80. package/dist/esm/plugins/layout/pm-plugins/main.js +1 -1
  81. package/dist/esm/plugins/list/actions/conversions.js +2 -2
  82. package/dist/esm/plugins/list/actions/indent-list-items-selected.js +2 -2
  83. package/dist/esm/plugins/list/actions/join-list-items-forward.js +1 -1
  84. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
  85. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -2
  86. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -2
  87. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +1 -1
  88. package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +1 -1
  89. package/dist/esm/plugins/list/actions/merge-lists.js +1 -1
  90. package/dist/esm/plugins/list/actions/outdent-list-items-selected.js +3 -3
  91. package/dist/esm/plugins/list/actions/wrap-and-join-lists.js +1 -1
  92. package/dist/esm/plugins/list/commands/indent-list.js +3 -4
  93. package/dist/esm/plugins/list/commands/index.js +4 -5
  94. package/dist/esm/plugins/list/commands/join-list-item-forward.js +1 -1
  95. package/dist/esm/plugins/list/commands/listBackspace.js +1 -2
  96. package/dist/esm/plugins/list/commands/outdent-list.js +3 -2
  97. package/dist/esm/plugins/list/pm-plugins/main.js +1 -1
  98. package/dist/esm/plugins/list/utils/analytics.js +0 -32
  99. package/dist/esm/plugins/list/utils/indentation.js +0 -17
  100. package/dist/esm/plugins/list/utils/node.js +3 -81
  101. package/dist/esm/plugins/list/utils/selection.js +3 -51
  102. package/dist/esm/plugins/tasks-and-decisions/commands.js +1 -1
  103. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
  104. package/dist/esm/plugins/text-formatting/index.js +23 -21
  105. package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +48 -54
  106. package/dist/esm/plugins/text-formatting/pm-plugins/smart-input-rule.js +26 -31
  107. package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
  108. package/dist/esm/utils/commands.js +2 -100
  109. package/dist/esm/utils/document.js +1 -26
  110. package/dist/esm/utils/index.js +1 -1
  111. package/dist/esm/version-wrapper.js +1 -1
  112. package/dist/esm/version.json +1 -1
  113. package/dist/types/index.d.ts +1 -1
  114. package/dist/types/plugins/list/actions/join-list-items-forward.d.ts +1 -1
  115. package/dist/types/plugins/list/commands/indent-list.d.ts +2 -1
  116. package/dist/types/plugins/list/commands/index.d.ts +2 -1
  117. package/dist/types/plugins/list/commands/join-list-item-forward.d.ts +1 -1
  118. package/dist/types/plugins/list/commands/listBackspace.d.ts +1 -1
  119. package/dist/types/plugins/list/commands/outdent-list.d.ts +2 -1
  120. package/dist/types/plugins/list/utils/analytics.d.ts +2 -4
  121. package/dist/types/plugins/list/utils/indentation.d.ts +0 -5
  122. package/dist/types/plugins/list/utils/node.d.ts +2 -17
  123. package/dist/types/plugins/list/utils/selection.d.ts +1 -12
  124. package/dist/types/plugins/text-formatting/pm-plugins/input-rule.d.ts +2 -1
  125. package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +2 -2
  126. package/dist/types/utils/commands.d.ts +3 -32
  127. package/dist/types/utils/document.d.ts +0 -4
  128. package/dist/types/utils/index.d.ts +1 -1
  129. package/dist/types-ts4.5/index.d.ts +1 -1
  130. package/dist/types-ts4.5/plugins/list/actions/join-list-items-forward.d.ts +1 -1
  131. package/dist/types-ts4.5/plugins/list/commands/indent-list.d.ts +2 -1
  132. package/dist/types-ts4.5/plugins/list/commands/index.d.ts +2 -1
  133. package/dist/types-ts4.5/plugins/list/commands/join-list-item-forward.d.ts +1 -1
  134. package/dist/types-ts4.5/plugins/list/commands/listBackspace.d.ts +1 -1
  135. package/dist/types-ts4.5/plugins/list/commands/outdent-list.d.ts +2 -1
  136. package/dist/types-ts4.5/plugins/list/utils/analytics.d.ts +2 -4
  137. package/dist/types-ts4.5/plugins/list/utils/indentation.d.ts +0 -5
  138. package/dist/types-ts4.5/plugins/list/utils/node.d.ts +2 -17
  139. package/dist/types-ts4.5/plugins/list/utils/selection.d.ts +1 -12
  140. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/input-rule.d.ts +2 -1
  141. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +2 -2
  142. package/dist/types-ts4.5/utils/commands.d.ts +3 -38
  143. package/dist/types-ts4.5/utils/document.d.ts +0 -4
  144. package/dist/types-ts4.5/utils/index.d.ts +1 -1
  145. package/package.json +2 -2
  146. package/report.api.md +0 -3
  147. package/tmp/api-report-tmp.d.ts +0 -3
  148. package/dist/cjs/plugins/list/utils/replace-content.js +0 -24
  149. package/dist/cjs/utils/prosemirror/autojoin.js +0 -68
  150. package/dist/es2019/plugins/list/utils/replace-content.js +0 -18
  151. package/dist/es2019/utils/prosemirror/autojoin.js +0 -57
  152. package/dist/esm/plugins/list/utils/replace-content.js +0 -17
  153. package/dist/esm/utils/prosemirror/autojoin.js +0 -63
  154. package/dist/types/plugins/list/utils/replace-content.d.ts +0 -8
  155. package/dist/types/utils/prosemirror/autojoin.d.ts +0 -13
  156. package/dist/types-ts4.5/plugins/list/utils/replace-content.d.ts +0 -8
  157. package/dist/types-ts4.5/utils/prosemirror/autojoin.d.ts +0 -13
@@ -5,22 +5,21 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
5
5
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import * as baseCommand from '@atlaskit/editor-prosemirror/commands';
7
7
  import { findPositionOfNodeBefore, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
8
- import { hasVisibleContent } from '../../../utils/document';
9
- import { findCutBefore, isEmptySelectionAtStart, isFirstChildOfParent } from '../../../utils/commands';
10
- import { filterCommands as filter } from '@atlaskit/editor-common/utils';
8
+ import { filterCommand as filter, hasVisibleContent, isEmptySelectionAtStart } from '@atlaskit/editor-common/utils';
9
+ import { isFirstChildOfParent, findCutBefore } from '../../../utils/commands';
11
10
  import { sanitiseMarksInSelection } from '../../../utils';
11
+ import { getCommonListAnalyticsAttributes } from '@atlaskit/editor-common/lists';
12
12
  import { liftFollowingList, liftTextSelectionList, liftNodeSelectionList } from '../transforms';
13
13
  import { GapCursorSelection } from '../../selection/gap-cursor-selection';
14
14
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
15
15
  import { isInsideListItem, canJoinToPreviousListItem, selectionContainsList } from '../utils/selection';
16
- import { getCommonListAnalyticsAttributes } from '../utils/analytics';
17
16
  import { listBackspace } from './listBackspace';
18
17
  import { joinListItemForward } from './join-list-item-forward';
19
18
  import { convertListType } from '../actions/conversions';
20
19
  import { wrapInListAndJoin } from '../actions/wrap-and-join-lists';
21
20
  import { outdentList } from './outdent-list';
22
21
  import { indentList } from './indent-list';
23
- import { moveTargetIntoList } from '../utils/replace-content';
22
+ import { moveTargetIntoList } from '@atlaskit/editor-common/lists';
24
23
  export { outdentList, indentList };
25
24
  export var enterKeyCommand = function enterKeyCommand(editorAnalyticsAPI) {
26
25
  return function (featureFlags) {
@@ -1,5 +1,5 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import { isEmptySelectionAtEnd, walkNextNode } from '../../../utils/commands';
2
+ import { isEmptySelectionAtEnd, walkNextNode } from '@atlaskit/editor-common/utils';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, DELETE_DIRECTION } from '@atlaskit/editor-common/analytics';
4
4
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
5
  import { calcJoinListScenario } from '../actions/join-list-items-forward';
@@ -1,9 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  var _BACKSPACE_COMMANDS;
3
- import { insertContentDeleteRange, isEmptySelectionAtStart, walkPrevNode } from '../../../utils/commands';
3
+ import { insertContentDeleteRange, isEmptySelectionAtStart, walkPrevNode, isListNode, isParagraphNode } from '@atlaskit/editor-common/utils';
4
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, DELETE_DIRECTION, LIST_TEXT_SCENARIOS } from '@atlaskit/editor-common/analytics';
5
5
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
6
- import { isListNode, isParagraphNode } from '@atlaskit/editor-common/utils';
7
6
  import { isPosInsideList, isPosInsideParagraph } from '../utils/selection';
8
7
  //Cases below refer to the cases found in this document: https://product-fabric.atlassian.net/wiki/spaces/E/pages/1146954996/List+Backspace+and+Delete+Behaviour
9
8
  //Case for two adjacent list items of the same indentation
@@ -1,11 +1,12 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ import { getCommonListAnalyticsAttributes } from '@atlaskit/editor-common/lists';
4
5
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, OUTDENT_SCENARIOS } from '@atlaskit/editor-common/analytics';
5
6
  import { isInsideListItem, isInsideTableCell } from '../utils/selection';
6
- import { isBulletList } from '../utils/node';
7
+ import { isBulletList } from '@atlaskit/editor-common/utils';
7
8
  import { findFirstParentListNode } from '../utils/find';
8
- import { getCommonListAnalyticsAttributes, getRestartListsAttributes } from '../utils/analytics';
9
+ import { getRestartListsAttributes } from '../utils/analytics';
9
10
  import { outdentListItemsSelected as outdentListAction } from '../actions/outdent-list-items-selected';
10
11
  import { closeHistory } from '@atlaskit/editor-prosemirror/history';
11
12
  export var outdentList = function outdentList(editorAnalyticsAPI) {
@@ -6,7 +6,7 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
7
7
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
8
8
  import { isWrappingPossible } from '../utils/selection';
9
- import { isListNode } from '../utils/node';
9
+ import { isListNode } from '@atlaskit/editor-common/utils';
10
10
  import { pluginFactory } from '../../../utils/plugin-state-factory';
11
11
  import { setGapCursorSelection } from '../../../utils';
12
12
  import { Side } from '@atlaskit/editor-common/selection';
@@ -1,38 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- import { isListItemNode, isListNode } from '@atlaskit/editor-common/utils';
5
- import { getListItemAttributes } from './selection';
6
- export var getCommonListAnalyticsAttributes = function getCommonListAnalyticsAttributes(state) {
7
- var _state$selection = state.selection,
8
- $from = _state$selection.$from,
9
- $to = _state$selection.$to;
10
- var fromAttrs = getListItemAttributes($from);
11
- var toAttrs = getListItemAttributes($to);
12
- return {
13
- itemIndexAtSelectionStart: fromAttrs.itemIndex,
14
- itemIndexAtSelectionEnd: toAttrs.itemIndex,
15
- indentLevelAtSelectionStart: fromAttrs.indentLevel,
16
- indentLevelAtSelectionEnd: toAttrs.indentLevel,
17
- itemsInSelection: countListItemsInSelection(state)
18
- };
19
- };
20
- export var countListItemsInSelection = function countListItemsInSelection(state) {
21
- var _state$selection2 = state.selection,
22
- from = _state$selection2.from,
23
- to = _state$selection2.to;
24
- if (from === to) {
25
- return 1;
26
- }
27
- var count = 0;
28
- var listSlice = state.doc.cut(from, to);
29
- listSlice.content.nodesBetween(0, listSlice.content.size, function (node, pos, parent, index) {
30
- if (parent && isListItemNode(parent) && !isListNode(node) && index === 0) {
31
- count++;
32
- }
33
- });
34
- return count;
35
- };
36
4
  export var RESTART_LISTS_ANALYTICS_KEY = 'restartListsAnalytics';
37
5
  export var getRestartListsAttributes = function getRestartListsAttributes(tr) {
38
6
  var _tr$getMeta;
@@ -1,4 +1,3 @@
1
- import { numberNestedLists } from './selection';
2
1
  import { isListItemNode, isListNode } from '@atlaskit/editor-common/utils';
3
2
 
4
3
  // This will return (depth - 1) for root list parent of a list.
@@ -14,20 +13,4 @@ export var getListLiftTarget = function getListLiftTarget(resPos) {
14
13
  }
15
14
  }
16
15
  return target - 1;
17
- };
18
- export var hasValidListIndentationLevel = function hasValidListIndentationLevel(_ref) {
19
- var tr = _ref.tr,
20
- maxIndentation = _ref.maxIndentation;
21
- var initialIndentationLevel = numberNestedLists(tr.selection.$from);
22
- var currentIndentationLevel;
23
- var currentPos = tr.selection.$to.pos;
24
- do {
25
- var resolvedPos = tr.doc.resolve(currentPos);
26
- currentIndentationLevel = numberNestedLists(resolvedPos);
27
- if (currentIndentationLevel > maxIndentation) {
28
- return false;
29
- }
30
- currentPos++;
31
- } while (currentIndentationLevel >= initialIndentationLevel);
32
- return true;
33
16
  };
@@ -1,88 +1,10 @@
1
1
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
- export { isListNode, isListItemNode, isBulletList, isParagraphNode } from '@atlaskit/editor-common/utils';
3
- import { isListNode, isListItemNode } from '@atlaskit/editor-common/utils';
4
- function isListNodeValidContent(node) {
2
+ import { isListItemNode } from '@atlaskit/editor-common/utils';
3
+ export function isListNodeValidContent(node) {
5
4
  var bulletList = node.type.schema.nodes.bulletList;
6
5
  if (!bulletList) {
7
6
  return false;
8
7
  }
9
8
  var listFragment = Fragment.from(bulletList.createAndFill());
10
9
  return !isListItemNode(node) && node.type.validContent(listFragment);
11
- }
12
- export var JoinDirection = /*#__PURE__*/function (JoinDirection) {
13
- JoinDirection[JoinDirection["LEFT"] = 1] = "LEFT";
14
- JoinDirection[JoinDirection["RIGHT"] = -1] = "RIGHT";
15
- return JoinDirection;
16
- }({});
17
- export var joinSiblingLists = function joinSiblingLists(_ref) {
18
- var tr = _ref.tr,
19
- direction = _ref.direction,
20
- forceListType = _ref.forceListType;
21
- var result = {
22
- orderedList: 0,
23
- bulletList: 0
24
- };
25
- var doc = tr.doc,
26
- _tr$selection = tr.selection,
27
- $from = _tr$selection.$from,
28
- $to = _tr$selection.$to,
29
- selection = tr.selection;
30
- var range = $from.blockRange($to, isListNodeValidContent);
31
- if (!range) {
32
- return result;
33
- }
34
- var rootListNode = doc.nodeAt(range.start);
35
- var from = isListNode(rootListNode) ? range.start : 0;
36
- var to = isListNode(rootListNode) ? range.end : tr.doc.content.size;
37
- var joins = [];
38
- doc.nodesBetween(from, to, function (node, pos, parent) {
39
- var resolvedPos = doc.resolve(pos);
40
- var nodeBefore = resolvedPos.nodeBefore,
41
- nodeAfter = resolvedPos.nodeAfter;
42
- if (!nodeBefore || !nodeAfter || !isListNode(nodeBefore) || !isListNode(nodeAfter)) {
43
- return;
44
- }
45
- var isNestedList = isListItemNode(parent);
46
- if (!isNestedList && nodeBefore.type !== nodeAfter.type && !forceListType) {
47
- return;
48
- }
49
- var index = resolvedPos.index();
50
- var positionPreviousNode = resolvedPos.posAtIndex(index - 1);
51
- var positionCurrentNode = resolvedPos.posAtIndex(index);
52
-
53
- // If the previous node is part of the selection, OR
54
- // If the previous node is not part of the selection and the previous node has the same list type that we’re converting to
55
- var joinBefore = positionPreviousNode >= from || nodeBefore.type === forceListType;
56
- if (forceListType) {
57
- if (joinBefore) {
58
- tr.setNodeMarkup(positionPreviousNode, forceListType);
59
- }
60
- tr.setNodeMarkup(positionCurrentNode, forceListType);
61
- }
62
- if (isNestedList && nodeBefore.type !== nodeAfter.type) {
63
- var nodeType = direction === JoinDirection.RIGHT ? nodeAfter.type : nodeBefore.type;
64
- tr.setNodeMarkup(positionPreviousNode, nodeType);
65
- }
66
- if (joinBefore) {
67
- joins.push(pos);
68
- }
69
- });
70
- if (selection.empty && rootListNode && isListNode(rootListNode)) {
71
- var resolvedPos = doc.resolve(range.start + rootListNode.nodeSize);
72
- var nodeBefore = resolvedPos.nodeBefore,
73
- nodeAfter = resolvedPos.nodeAfter;
74
- if (nodeBefore && nodeAfter && isListNode(nodeBefore) && isListNode(nodeAfter) && nodeAfter.type === nodeBefore.type) {
75
- joins.push(resolvedPos.pos);
76
- }
77
- }
78
- for (var i = joins.length - 1; i >= 0; i--) {
79
- var listNode = tr.doc.nodeAt(joins[i]);
80
- var listName = listNode === null || listNode === void 0 ? void 0 : listNode.type.name;
81
- if (listName && (listName === 'orderedList' || listName === 'bulletList')) {
82
- var amount = result[listName] || 0;
83
- result[listName] = amount + 1;
84
- }
85
- tr.join(joins[i]);
86
- }
87
- return result;
88
- };
10
+ }
@@ -1,6 +1,5 @@
1
1
  import { findWrapping } from '@atlaskit/editor-prosemirror/transform';
2
- import { Selection, TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
3
- import { findParentNodeClosestToPos, findParentNodeOfType, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
+ import { findParentNodeOfType, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
4
3
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
5
4
  import { isListItemNode, isListNode, isParagraphNode } from '@atlaskit/editor-common/utils';
6
5
  export var isPosInsideParagraph = function isPosInsideParagraph($pos) {
@@ -70,55 +69,8 @@ export var selectionContainsList = function selectionContainsList(tr) {
70
69
  });
71
70
  return foundListNode;
72
71
  };
73
- export var numberNestedLists = function numberNestedLists(resolvedPos) {
74
- var count = 0;
75
- for (var i = resolvedPos.depth - 1; i > 0; i--) {
76
- var node = resolvedPos.node(i);
77
- if (isListNode(node)) {
78
- count += 1;
79
- }
80
- }
81
- return count;
82
- };
83
- export var getListItemAttributes = function getListItemAttributes($pos) {
84
- var indentLevel = numberNestedLists($pos) - 1;
85
- var itemAtPos = findParentNodeClosestToPos($pos, isListItemNode);
86
-
87
- // Get the index of the current item relative to parent (parent is at item depth - 1)
88
- var itemIndex = $pos.index(itemAtPos ? itemAtPos.depth - 1 : undefined);
89
- return {
90
- indentLevel: indentLevel,
91
- itemIndex: itemIndex
92
- };
93
- };
94
- export var normalizeListItemsSelection = function normalizeListItemsSelection(_ref) {
95
- var selection = _ref.selection,
96
- doc = _ref.doc;
97
- if (selection.empty) {
98
- return selection;
99
- }
100
- var $from = selection.$from,
101
- $to = selection.$to;
102
- if (selection instanceof NodeSelection) {
103
- var _head = resolvePositionToStartOfListItem($from);
104
- return new TextSelection(_head, _head);
105
- }
106
- var head = resolvePositionToStartOfListItem($from);
107
- var anchor = resolvePositionToEndOfListItem($to);
108
- return new TextSelection(anchor, head);
109
- };
110
- var resolvePositionToStartOfListItem = function resolvePositionToStartOfListItem($pos) {
111
- var fromRange = $pos.blockRange($pos, isListItemNode);
112
- var fromPosition = fromRange && $pos.textOffset === 0 && fromRange.end - 1 === $pos.pos ? Selection.near($pos.doc.resolve(fromRange.end + 1), 1).$from : $pos;
113
- return fromPosition;
114
- };
115
- var resolvePositionToEndOfListItem = function resolvePositionToEndOfListItem($pos) {
116
- var toRange = $pos.blockRange($pos, isListItemNode);
117
- var toPosition = toRange && $pos.textOffset === 0 && toRange.start + 1 === $pos.pos ? Selection.near($pos.doc.resolve(toRange.start - 1), -1).$to : $pos;
118
- return toPosition;
119
- };
120
- export var createListNodeRange = function createListNodeRange(_ref2) {
121
- var selection = _ref2.selection;
72
+ export var createListNodeRange = function createListNodeRange(_ref) {
73
+ var selection = _ref.selection;
122
74
  var $from = selection.$from,
123
75
  $to = selection.$to;
124
76
  var range = $from.blockRange($to, isListNode);
@@ -6,7 +6,7 @@ import { uuid } from '@atlaskit/adf-schema';
6
6
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD, USER_CONTEXT } from '../analytics';
7
7
  import { GapCursorSelection } from '../selection/gap-cursor-selection';
8
8
  import { stateKey as taskDecisionStateKey } from './pm-plugins/plugin-key';
9
- import { autoJoinTr } from '../../utils/prosemirror/autojoin';
9
+ import { autoJoinTr } from '@atlaskit/editor-common/utils';
10
10
  var getContextData = function getContextData() {
11
11
  var contextProvider = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12
12
  var objectId = contextProvider.objectId,
@@ -7,8 +7,7 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
7
7
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
8
8
  import { findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
9
9
  import { uuid } from '@atlaskit/adf-schema';
10
- import { isEmptySelectionAtStart, deleteEmptyParagraphAndMoveBlockUp, isEmptySelectionAtEnd } from '../../../utils/commands';
11
- import { filterCommands as filter } from '@atlaskit/editor-common/utils';
10
+ import { filterCommand as filter, isEmptySelectionAtStart, deleteEmptyParagraphAndMoveBlockUp, isEmptySelectionAtEnd } from '@atlaskit/editor-common/utils';
12
11
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INDENT_DIRECTION, INDENT_TYPE, INPUT_METHOD, withAnalytics } from '../../analytics';
13
12
  import { insertTaskDecisionWithAnalytics } from '../commands';
14
13
  import { joinAtCut, liftSelection, wrapSelectionInTaskList } from './commands';
@@ -50,52 +50,54 @@ var textFormatting = function textFormatting() {
50
50
  }
51
51
  }, {
52
52
  name: 'textFormattingInputRule',
53
+ // Don't remove the unused featureFlags, this gets used to test if we're properly passing them to the PM plugin
53
54
  plugin: function plugin(_ref2) {
55
+ var _api$dependencies$ana2;
54
56
  var schema = _ref2.schema,
55
57
  featureFlags = _ref2.featureFlags;
56
- return textFormattingInputRulePlugin(schema, featureFlags);
58
+ return textFormattingInputRulePlugin(schema, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions);
57
59
  }
58
60
  }, {
59
61
  name: 'textFormattingSmartRule',
60
- plugin: function plugin(_ref3) {
61
- var featureFlags = _ref3.featureFlags;
62
- return !options.disableSmartTextCompletion ? textFormattingSmartInputRulePlugin(featureFlags) : undefined;
62
+ plugin: function plugin() {
63
+ var _api$dependencies$ana3;
64
+ return !options.disableSmartTextCompletion ? textFormattingSmartInputRulePlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions) : undefined;
63
65
  }
64
66
  }, {
65
67
  name: 'textFormattingClear',
66
- plugin: function plugin(_ref4) {
67
- var dispatch = _ref4.dispatch;
68
+ plugin: function plugin(_ref3) {
69
+ var dispatch = _ref3.dispatch;
68
70
  return clearFormattingPlugin(dispatch);
69
71
  }
70
72
  }, {
71
73
  name: 'textFormattingClearKeymap',
72
74
  plugin: function plugin() {
73
- var _api$dependencies$ana2;
74
- return clearFormattingKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions);
75
+ var _api$dependencies$ana4;
76
+ return clearFormattingKeymapPlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$ana4 = api.dependencies.analytics) === null || _api$dependencies$ana4 === void 0 ? void 0 : _api$dependencies$ana4.actions);
75
77
  }
76
78
  }, {
77
79
  name: 'textFormattingKeymap',
78
- plugin: function plugin(_ref5) {
79
- var _api$dependencies$ana3;
80
- var schema = _ref5.schema;
81
- return keymapPlugin(schema, api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions);
80
+ plugin: function plugin(_ref4) {
81
+ var _api$dependencies$ana5;
82
+ var schema = _ref4.schema;
83
+ return keymapPlugin(schema, api === null || api === void 0 ? void 0 : (_api$dependencies$ana5 = api.dependencies.analytics) === null || _api$dependencies$ana5 === void 0 ? void 0 : _api$dependencies$ana5.actions);
82
84
  }
83
85
  }];
84
86
  },
85
- primaryToolbarComponent: function primaryToolbarComponent(_ref6) {
86
- var editorView = _ref6.editorView,
87
- popupsMountPoint = _ref6.popupsMountPoint,
88
- popupsScrollableElement = _ref6.popupsScrollableElement,
89
- isToolbarReducedSpacing = _ref6.isToolbarReducedSpacing,
90
- toolbarSize = _ref6.toolbarSize,
91
- disabled = _ref6.disabled;
87
+ primaryToolbarComponent: function primaryToolbarComponent(_ref5) {
88
+ var editorView = _ref5.editorView,
89
+ popupsMountPoint = _ref5.popupsMountPoint,
90
+ popupsScrollableElement = _ref5.popupsScrollableElement,
91
+ isToolbarReducedSpacing = _ref5.isToolbarReducedSpacing,
92
+ toolbarSize = _ref5.toolbarSize,
93
+ disabled = _ref5.disabled;
92
94
  return /*#__PURE__*/React.createElement(WithPluginState, {
93
95
  plugins: {
94
96
  textFormattingState: textFormattingPluginKey,
95
97
  clearFormattingPluginState: clearFormattingPluginKey
96
98
  },
97
99
  render: function render() {
98
- var _api$dependencies$ana4;
100
+ var _api$dependencies$ana6;
99
101
  return /*#__PURE__*/React.createElement(Toolbar, {
100
102
  editorState: editorView.state,
101
103
  popupsMountPoint: popupsMountPoint,
@@ -105,7 +107,7 @@ var textFormatting = function textFormatting() {
105
107
  editorView: editorView,
106
108
  isToolbarDisabled: disabled,
107
109
  shouldUseResponsiveToolbar: Boolean(options.responsiveToolbarMenu),
108
- editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$ana4 = api.dependencies.analytics) === null || _api$dependencies$ana4 === void 0 ? void 0 : _api$dependencies$ana4.actions
110
+ editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$ana6 = api.dependencies.analytics) === null || _api$dependencies$ana6 === void 0 ? void 0 : _api$dependencies$ana6.actions
109
111
  });
110
112
  }
111
113
  });
@@ -10,10 +10,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
10
  var _ValidCombinations;
11
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
- import { ruleWithAnalytics } from '../../../utils/input-rules';
14
13
  import { createRule, createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
15
14
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
16
15
  import { transformSmartCharsMentionsAndEmojis } from '@atlaskit/editor-common/mark';
16
+ import { inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
17
17
  var ValidAutoformatChars = /*#__PURE__*/function (ValidAutoformatChars) {
18
18
  ValidAutoformatChars["STRONG"] = "__";
19
19
  ValidAutoformatChars["STRIKE"] = "~~";
@@ -159,18 +159,16 @@ export var codeRegex = buildRegex(ValidAutoformatChars.CODE);
159
159
  * @param {Schema} schema
160
160
  * @returns {InputRuleWrapper[]}
161
161
  */
162
- function getStrongInputRules(schema) {
163
- var ruleWithStrongAnalytics = ruleWithAnalytics(function () {
164
- return {
165
- action: ACTION.FORMATTED,
166
- actionSubject: ACTION_SUBJECT.TEXT,
167
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRONG,
168
- eventType: EVENT_TYPE.TRACK,
169
- attributes: {
170
- inputMethod: INPUT_METHOD.FORMATTING
171
- }
172
- };
173
- });
162
+ function getStrongInputRules(schema, editorAnalyticsAPI) {
163
+ var ruleWithStrongAnalytics = inputRuleWithAnalytics({
164
+ action: ACTION.FORMATTED,
165
+ actionSubject: ACTION_SUBJECT.TEXT,
166
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRONG,
167
+ eventType: EVENT_TYPE.TRACK,
168
+ attributes: {
169
+ inputMethod: INPUT_METHOD.FORMATTING
170
+ }
171
+ }, editorAnalyticsAPI);
174
172
  // **string** or __strong__ should bold the text
175
173
  var doubleUnderscoreRule = createRule(strongRegex1, addMark(schema.marks.strong, schema, ValidAutoformatChars.STRONG));
176
174
  var doubleAsterixRule = createRule(strongRegex2, addMark(schema.marks.strong, schema, ValidAutoformatChars.STRONG_MARKDOWN));
@@ -183,18 +181,16 @@ function getStrongInputRules(schema) {
183
181
  * @param {Schema} schema
184
182
  * @returns {InputRuleWrapper[]}
185
183
  */
186
- function getItalicInputRules(schema) {
187
- var ruleWithItalicAnalytics = ruleWithAnalytics(function () {
188
- return {
189
- action: ACTION.FORMATTED,
190
- actionSubject: ACTION_SUBJECT.TEXT,
191
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_ITALIC,
192
- eventType: EVENT_TYPE.TRACK,
193
- attributes: {
194
- inputMethod: INPUT_METHOD.FORMATTING
195
- }
196
- };
197
- });
184
+ function getItalicInputRules(schema, editorAnalyticsAPI) {
185
+ var ruleWithItalicAnalytics = inputRuleWithAnalytics({
186
+ action: ACTION.FORMATTED,
187
+ actionSubject: ACTION_SUBJECT.TEXT,
188
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_ITALIC,
189
+ eventType: EVENT_TYPE.TRACK,
190
+ attributes: {
191
+ inputMethod: INPUT_METHOD.FORMATTING
192
+ }
193
+ }, editorAnalyticsAPI);
198
194
  var underscoreRule = createRule(italicRegex1, addMark(schema.marks.em, schema, ValidAutoformatChars.ITALIC));
199
195
  var asterixRule = createRule(italicRegex2, addMark(schema.marks.em, schema, ValidAutoformatChars.ITALIC_MARKDOWN));
200
196
  return [ruleWithItalicAnalytics(underscoreRule), ruleWithItalicAnalytics(asterixRule)];
@@ -206,18 +202,16 @@ function getItalicInputRules(schema) {
206
202
  * @param {Schema} schema
207
203
  * @returns {InputRuleWrapper[]}
208
204
  */
209
- function getStrikeInputRules(schema) {
210
- var ruleWithStrikeAnalytics = ruleWithAnalytics(function () {
211
- return {
212
- action: ACTION.FORMATTED,
213
- actionSubject: ACTION_SUBJECT.TEXT,
214
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRIKE,
215
- eventType: EVENT_TYPE.TRACK,
216
- attributes: {
217
- inputMethod: INPUT_METHOD.FORMATTING
218
- }
219
- };
220
- });
205
+ function getStrikeInputRules(schema, editorAnalyticsAPI) {
206
+ var ruleWithStrikeAnalytics = inputRuleWithAnalytics({
207
+ action: ACTION.FORMATTED,
208
+ actionSubject: ACTION_SUBJECT.TEXT,
209
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRIKE,
210
+ eventType: EVENT_TYPE.TRACK,
211
+ attributes: {
212
+ inputMethod: INPUT_METHOD.FORMATTING
213
+ }
214
+ }, editorAnalyticsAPI);
221
215
  var doubleTildeRule = createRule(strikeRegex, addMark(schema.marks.strike, schema, ValidAutoformatChars.STRIKE));
222
216
  return [ruleWithStrikeAnalytics(doubleTildeRule)];
223
217
  }
@@ -228,34 +222,34 @@ function getStrikeInputRules(schema) {
228
222
  * @param {Schema} schema
229
223
  * @returns {InputRuleWrapper[]}
230
224
  */
231
- function getCodeInputRules(schema) {
232
- var ruleWithCodeAnalytics = ruleWithAnalytics(function () {
233
- return {
234
- action: ACTION.FORMATTED,
235
- actionSubject: ACTION_SUBJECT.TEXT,
236
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CODE,
237
- eventType: EVENT_TYPE.TRACK,
238
- attributes: {
239
- inputMethod: INPUT_METHOD.FORMATTING
240
- }
241
- };
242
- });
225
+ function getCodeInputRules(schema, editorAnalyticsAPI) {
226
+ var ruleWithCodeAnalytics = inputRuleWithAnalytics({
227
+ action: ACTION.FORMATTED,
228
+ actionSubject: ACTION_SUBJECT.TEXT,
229
+ actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CODE,
230
+ eventType: EVENT_TYPE.TRACK,
231
+ attributes: {
232
+ inputMethod: INPUT_METHOD.FORMATTING
233
+ }
234
+ }, editorAnalyticsAPI);
243
235
  var backTickRule = createRule(codeRegex, addMark(schema.marks.code, schema, ValidAutoformatChars.CODE));
244
236
  return [ruleWithCodeAnalytics(backTickRule)];
245
237
  }
246
- export function inputRulePlugin(schema, featureFlags) {
238
+ export function inputRulePlugin(schema,
239
+ // Don't remove the unused featureFlags, this gets used to test if we're properly passing them to the PM plugin
240
+ _featureFlags, editorAnalyticsAPI) {
247
241
  var rules = [];
248
242
  if (schema.marks.strong) {
249
- rules.push.apply(rules, _toConsumableArray(getStrongInputRules(schema)));
243
+ rules.push.apply(rules, _toConsumableArray(getStrongInputRules(schema, editorAnalyticsAPI)));
250
244
  }
251
245
  if (schema.marks.em) {
252
- rules.push.apply(rules, _toConsumableArray(getItalicInputRules(schema)));
246
+ rules.push.apply(rules, _toConsumableArray(getItalicInputRules(schema, editorAnalyticsAPI)));
253
247
  }
254
248
  if (schema.marks.strike) {
255
- rules.push.apply(rules, _toConsumableArray(getStrikeInputRules(schema)));
249
+ rules.push.apply(rules, _toConsumableArray(getStrikeInputRules(schema, editorAnalyticsAPI)));
256
250
  }
257
251
  if (schema.marks.code) {
258
- rules.push.apply(rules, _toConsumableArray(getCodeInputRules(schema)));
252
+ rules.push.apply(rules, _toConsumableArray(getCodeInputRules(schema, editorAnalyticsAPI)));
259
253
  }
260
254
  if (rules.length !== 0) {
261
255
  return createPlugin('text-formatting', rules);