@atlaskit/editor-core 165.0.0 → 166.0.2

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 (244) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/cjs/actions/index.js +9 -0
  3. package/dist/cjs/create-editor/ReactEditorView.js +14 -6
  4. package/dist/cjs/create-editor/create-plugins-list.js +1 -2
  5. package/dist/cjs/editor.js +13 -0
  6. package/dist/cjs/event-dispatcher/index.js +9 -0
  7. package/dist/cjs/nodeviews/ReactNodeView.js +1 -11
  8. package/dist/cjs/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
  9. package/dist/cjs/plugins/analytics/types/enums.js +1 -0
  10. package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +2 -2
  11. package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +128 -79
  12. package/dist/cjs/plugins/base/utils/input-latency-tracking.js +157 -0
  13. package/dist/cjs/plugins/card/styles.js +3 -1
  14. package/dist/cjs/plugins/code-block/styles.js +6 -4
  15. package/dist/cjs/plugins/collab-edit/index.js +2 -2
  16. package/dist/cjs/plugins/collab-edit/plugin-state.js +23 -5
  17. package/dist/cjs/plugins/collab-edit/provider/channel.js +2 -2
  18. package/dist/cjs/plugins/date/styles.js +3 -1
  19. package/dist/cjs/plugins/emoji/index.js +30 -34
  20. package/dist/cjs/plugins/emoji/nodeviews/emoji.js +12 -66
  21. package/dist/cjs/plugins/emoji/styles.js +3 -17
  22. package/dist/cjs/plugins/expand/ui/styles.js +2 -2
  23. package/dist/cjs/plugins/extension/context-panel.js +2 -2
  24. package/dist/cjs/plugins/extension/pm-plugins/main.js +2 -2
  25. package/dist/cjs/plugins/extension/ui/styles.js +3 -1
  26. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
  27. package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +2 -2
  28. package/dist/cjs/plugins/hyperlink/pm-plugins/input-rule.js +1 -9
  29. package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +1 -9
  30. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
  31. package/dist/cjs/plugins/layout/styles.js +3 -1
  32. package/dist/cjs/plugins/list/commands/indent-list.js +5 -1
  33. package/dist/cjs/plugins/list/commands/outdent-list.js +5 -1
  34. package/dist/cjs/plugins/list/transforms.js +11 -3
  35. package/dist/cjs/plugins/macro/actions.js +2 -2
  36. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +2 -2
  37. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
  38. package/dist/cjs/plugins/media/styles.js +3 -1
  39. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
  40. package/dist/cjs/plugins/mentions/index.js +10 -14
  41. package/dist/cjs/plugins/mentions/nodeviews/mention.js +15 -67
  42. package/dist/cjs/plugins/mentions/pm-plugins/main.js +19 -10
  43. package/dist/cjs/plugins/mentions/type-ahead/index.js +7 -2
  44. package/dist/cjs/plugins/panel/styles.js +3 -1
  45. package/dist/cjs/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
  46. package/dist/cjs/plugins/rule/styles.js +3 -1
  47. package/dist/cjs/plugins/selection/utils.js +39 -23
  48. package/dist/cjs/plugins/table/event-handlers.js +3 -3
  49. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +24 -0
  50. package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
  51. package/dist/cjs/plugins/table/ui/consts.js +6 -4
  52. package/dist/cjs/plugins/tasks-and-decisions/styles.js +3 -1
  53. package/dist/cjs/plugins/text-formatting/utils.js +1 -1
  54. package/dist/cjs/plugins/type-ahead/index.js +6 -2
  55. package/dist/cjs/plugins/unsupported-content/index.js +22 -10
  56. package/dist/cjs/plugins/unsupported-content/styles.js +4 -2
  57. package/dist/cjs/plugins/unsupported-content/unsupported-inline-node-view.js +21 -0
  58. package/dist/cjs/ui/Appearance/Chromeless.js +6 -3
  59. package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -4
  60. package/dist/cjs/ui/ChromeCollapsed/styles.js +3 -1
  61. package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +2 -2
  62. package/dist/cjs/ui/ConfigPanel/Fields/CustomSelect.js +2 -2
  63. package/dist/cjs/ui/ConfigPanel/Fields/UserSelect.js +2 -2
  64. package/dist/cjs/ui/ConfigPanel/transformers.js +2 -2
  65. package/dist/cjs/ui/ContentStyles/index.js +2 -2
  66. package/dist/cjs/version-wrapper.js +1 -1
  67. package/dist/cjs/version.json +1 -1
  68. package/dist/es2019/actions/index.js +12 -1
  69. package/dist/es2019/create-editor/ReactEditorView.js +14 -6
  70. package/dist/es2019/create-editor/create-plugins-list.js +1 -2
  71. package/dist/es2019/editor.js +14 -0
  72. package/dist/es2019/event-dispatcher/index.js +8 -0
  73. package/dist/es2019/nodeviews/ReactNodeView.js +1 -10
  74. package/dist/es2019/nodeviews/getInlineNodeViewProducer.styles.js +9 -0
  75. package/dist/es2019/plugins/analytics/types/enums.js +1 -0
  76. package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +138 -80
  77. package/dist/es2019/plugins/base/utils/input-latency-tracking.js +128 -0
  78. package/dist/es2019/plugins/card/styles.js +9 -5
  79. package/dist/es2019/plugins/code-block/styles.js +11 -8
  80. package/dist/es2019/plugins/collab-edit/plugin-state.js +23 -8
  81. package/dist/es2019/plugins/date/styles.js +3 -1
  82. package/dist/es2019/plugins/emoji/index.js +16 -21
  83. package/dist/es2019/plugins/emoji/nodeviews/emoji.js +12 -31
  84. package/dist/es2019/plugins/emoji/styles.js +1 -82
  85. package/dist/es2019/plugins/expand/ui/styles.js +2 -2
  86. package/dist/es2019/plugins/extension/ui/styles.js +4 -2
  87. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
  88. package/dist/es2019/plugins/hyperlink/pm-plugins/input-rule.js +1 -8
  89. package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -8
  90. package/dist/es2019/plugins/layout/styles.js +3 -2
  91. package/dist/es2019/plugins/list/commands/indent-list.js +4 -1
  92. package/dist/es2019/plugins/list/commands/outdent-list.js +4 -1
  93. package/dist/es2019/plugins/list/transforms.js +9 -4
  94. package/dist/es2019/plugins/media/styles.js +9 -7
  95. package/dist/es2019/plugins/mentions/index.js +1 -6
  96. package/dist/es2019/plugins/mentions/nodeviews/mention.js +16 -35
  97. package/dist/es2019/plugins/mentions/pm-plugins/main.js +18 -10
  98. package/dist/es2019/plugins/mentions/type-ahead/index.js +7 -2
  99. package/dist/es2019/plugins/panel/styles.js +5 -4
  100. package/dist/es2019/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
  101. package/dist/es2019/plugins/rule/styles.js +2 -1
  102. package/dist/es2019/plugins/selection/utils.js +35 -20
  103. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +22 -0
  104. package/dist/es2019/plugins/table/ui/common-styles.js +4 -0
  105. package/dist/es2019/plugins/table/ui/consts.js +5 -4
  106. package/dist/es2019/plugins/tasks-and-decisions/styles.js +4 -2
  107. package/dist/es2019/plugins/text-formatting/utils.js +1 -1
  108. package/dist/es2019/plugins/type-ahead/index.js +5 -1
  109. package/dist/es2019/plugins/unsupported-content/index.js +23 -12
  110. package/dist/es2019/plugins/unsupported-content/styles.js +5 -3
  111. package/dist/es2019/plugins/unsupported-content/unsupported-inline-node-view.js +7 -0
  112. package/dist/es2019/ui/Appearance/Chromeless.js +5 -2
  113. package/dist/es2019/ui/Appearance/Comment/Comment.js +5 -2
  114. package/dist/es2019/ui/ChromeCollapsed/styles.js +2 -1
  115. package/dist/es2019/ui/ContentStyles/index.js +3 -3
  116. package/dist/es2019/version-wrapper.js +1 -1
  117. package/dist/es2019/version.json +1 -1
  118. package/dist/esm/actions/index.js +9 -1
  119. package/dist/esm/create-editor/ErrorBoundary.js +1 -1
  120. package/dist/esm/create-editor/ReactEditorView.js +14 -6
  121. package/dist/esm/create-editor/create-plugins-list.js +1 -2
  122. package/dist/esm/editor.js +16 -1
  123. package/dist/esm/event-dispatcher/index.js +9 -0
  124. package/dist/esm/nodeviews/ReactNodeView.js +1 -10
  125. package/dist/esm/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
  126. package/dist/esm/plugins/analytics/types/enums.js +1 -0
  127. package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +1 -1
  128. package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +128 -79
  129. package/dist/esm/plugins/base/utils/input-latency-tracking.js +149 -0
  130. package/dist/esm/plugins/card/styles.js +2 -1
  131. package/dist/esm/plugins/code-block/styles.js +5 -4
  132. package/dist/esm/plugins/collab-edit/index.js +1 -1
  133. package/dist/esm/plugins/collab-edit/plugin-state.js +21 -6
  134. package/dist/esm/plugins/collab-edit/provider/channel.js +1 -1
  135. package/dist/esm/plugins/custom-autoformat/doc.js +1 -1
  136. package/dist/esm/plugins/custom-autoformat/index.js +1 -1
  137. package/dist/esm/plugins/date/styles.js +2 -1
  138. package/dist/esm/plugins/emoji/index.js +26 -29
  139. package/dist/esm/plugins/emoji/nodeviews/emoji.js +11 -56
  140. package/dist/esm/plugins/emoji/styles.js +3 -14
  141. package/dist/esm/plugins/expand/ui/styles.js +2 -2
  142. package/dist/esm/plugins/extension/actions.js +1 -1
  143. package/dist/esm/plugins/extension/context-panel.js +1 -1
  144. package/dist/esm/plugins/extension/pm-plugins/main.js +1 -1
  145. package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +1 -1
  146. package/dist/esm/plugins/extension/ui/styles.js +2 -1
  147. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
  148. package/dist/esm/plugins/feedback-dialog/index.js +1 -1
  149. package/dist/esm/plugins/feedback-dialog/loadJiraCollectorDialogScript.js +1 -1
  150. package/dist/esm/plugins/find-replace/utils/batch-decorations.js +1 -1
  151. package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -1
  152. package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -1
  153. package/dist/esm/plugins/hyperlink/pm-plugins/input-rule.js +1 -8
  154. package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -8
  155. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -1
  156. package/dist/esm/plugins/image-upload/pm-plugins/main.js +1 -1
  157. package/dist/esm/plugins/layout/styles.js +2 -1
  158. package/dist/esm/plugins/list/commands/indent-list.js +4 -1
  159. package/dist/esm/plugins/list/commands/outdent-list.js +4 -1
  160. package/dist/esm/plugins/list/transforms.js +9 -4
  161. package/dist/esm/plugins/macro/actions.js +1 -1
  162. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +1 -1
  163. package/dist/esm/plugins/media/nodeviews/mediaInline.js +2 -1
  164. package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
  165. package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +1 -1
  166. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
  167. package/dist/esm/plugins/media/picker-facade.js +1 -1
  168. package/dist/esm/plugins/media/pm-plugins/main.js +1 -1
  169. package/dist/esm/plugins/media/styles.js +2 -1
  170. package/dist/esm/plugins/media/toolbar/utils.js +1 -1
  171. package/dist/esm/plugins/media/ui/MediaPicker/PickerFacadeProvider.js +1 -1
  172. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +1 -1
  173. package/dist/esm/plugins/media/utils/check-media-type.js +1 -1
  174. package/dist/esm/plugins/mentions/index.js +10 -14
  175. package/dist/esm/plugins/mentions/nodeviews/mention.js +13 -58
  176. package/dist/esm/plugins/mentions/pm-plugins/main.js +18 -10
  177. package/dist/esm/plugins/mentions/type-ahead/index.js +7 -2
  178. package/dist/esm/plugins/panel/styles.js +2 -1
  179. package/dist/esm/plugins/paste/handlers.js +1 -1
  180. package/dist/esm/plugins/paste/pm-plugins/main.js +1 -1
  181. package/dist/esm/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
  182. package/dist/esm/plugins/quick-insert/index.js +1 -1
  183. package/dist/esm/plugins/rule/styles.js +2 -1
  184. package/dist/esm/plugins/selection/utils.js +35 -20
  185. package/dist/esm/plugins/table/event-handlers.js +3 -3
  186. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +23 -0
  187. package/dist/esm/plugins/table/ui/common-styles.js +1 -1
  188. package/dist/esm/plugins/table/ui/consts.js +5 -4
  189. package/dist/esm/plugins/tasks-and-decisions/styles.js +2 -1
  190. package/dist/esm/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.js +1 -1
  191. package/dist/esm/plugins/text-formatting/utils.js +1 -1
  192. package/dist/esm/plugins/type-ahead/index.js +6 -2
  193. package/dist/esm/plugins/unsupported-content/index.js +21 -11
  194. package/dist/esm/plugins/unsupported-content/styles.js +3 -2
  195. package/dist/esm/plugins/unsupported-content/unsupported-inline-node-view.js +7 -0
  196. package/dist/esm/ui/Appearance/Chromeless.js +6 -3
  197. package/dist/esm/ui/Appearance/Comment/Comment.js +6 -4
  198. package/dist/esm/ui/ChromeCollapsed/styles.js +2 -1
  199. package/dist/esm/ui/ConfigPanel/ConfigPanel.js +1 -1
  200. package/dist/esm/ui/ConfigPanel/Fields/CustomSelect.js +1 -1
  201. package/dist/esm/ui/ConfigPanel/Fields/UserSelect.js +1 -1
  202. package/dist/esm/ui/ConfigPanel/FormErrorBoundary.js +1 -1
  203. package/dist/esm/ui/ConfigPanel/transformers.js +1 -1
  204. package/dist/esm/ui/ContentStyles/index.js +3 -3
  205. package/dist/esm/ui/LinkSearch/index.js +1 -1
  206. package/dist/esm/ui/ToolbarFeedback/index.js +1 -1
  207. package/dist/esm/utils/action.js +1 -1
  208. package/dist/esm/utils/clipboard.js +1 -1
  209. package/dist/esm/utils/extensions.js +1 -1
  210. package/dist/esm/version-wrapper.js +1 -1
  211. package/dist/esm/version.json +1 -1
  212. package/dist/types/actions/index.d.ts +3 -1
  213. package/dist/types/editor.d.ts +3 -0
  214. package/dist/types/event-dispatcher/index.d.ts +1 -0
  215. package/dist/types/nodeviews/ReactNodeView.d.ts +1 -5
  216. package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
  217. package/dist/types/plugins/analytics/types/events.d.ts +2 -2
  218. package/dist/types/plugins/analytics/types/general-events.d.ts +10 -1
  219. package/dist/types/plugins/base/utils/input-latency-tracking.d.ts +44 -0
  220. package/dist/types/plugins/collab-edit/plugin-state.d.ts +4 -0
  221. package/dist/types/plugins/emoji/index.d.ts +2 -6
  222. package/dist/types/plugins/emoji/nodeviews/emoji.d.ts +4 -14
  223. package/dist/types/plugins/emoji/styles.d.ts +0 -1
  224. package/dist/types/plugins/emoji/types.d.ts +0 -1
  225. package/dist/types/plugins/list/transforms.d.ts +10 -1
  226. package/dist/types/plugins/mentions/nodeviews/mention.d.ts +6 -14
  227. package/dist/types/plugins/mentions/pm-plugins/main.d.ts +2 -5
  228. package/dist/types/plugins/selection/utils.d.ts +7 -15
  229. package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +3 -0
  230. package/dist/types/plugins/table/ui/consts.d.ts +2 -2
  231. package/dist/types/plugins/type-ahead/types.d.ts +1 -0
  232. package/dist/types/plugins/unsupported-content/unsupported-inline-node-view.d.ts +11 -0
  233. package/dist/types/types/editor-appearance-component.d.ts +1 -0
  234. package/dist/types/types/editor-props.d.ts +1 -0
  235. package/dist/types/types/feature-flags.d.ts +0 -14
  236. package/dist/types/ui/Appearance/Chromeless.d.ts +1 -0
  237. package/dist/types/ui/Appearance/Comment/Comment.d.ts +1 -0
  238. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +4 -4
  239. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  240. package/package.json +23 -23
  241. package/dist/cjs/plugins/emoji/nodeviews/emoji-next.js +0 -250
  242. package/dist/es2019/plugins/emoji/nodeviews/emoji-next.js +0 -177
  243. package/dist/esm/plugins/emoji/nodeviews/emoji-next.js +0 -234
  244. package/dist/types/plugins/emoji/nodeviews/emoji-next.d.ts +0 -31
@@ -17,7 +17,9 @@ var _constants = require("@atlaskit/theme/constants");
17
17
 
18
18
  var _colors = require("@atlaskit/theme/colors");
19
19
 
20
+ var _tokens = require("@atlaskit/tokens");
21
+
20
22
  var _templateObject;
21
23
 
22
- var inputStyle = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* Normal .className gets overridden by input[type=text] hence this hack to produce input.className */\n input& {\n background-color: white;\n border: 1px solid ", ";\n border-radius: ", "px;\n box-sizing: border-box;\n height: 40px;\n padding-left: 20px;\n padding-top: 12px;\n padding-bottom: 12px;\n font-size: ", ";\n width: 100%;\n font-weight: 400;\n line-height: 1.42857142857143;\n letter-spacing: -0.005em;\n color: ", ";\n\n &:hover {\n border-color: ", ";\n cursor: text;\n }\n }\n"])), _editorSharedStyles.akEditorSubtleAccent, (0, _constants.borderRadius)(), (0, _editorSharedStyles.relativeFontSizeToBase16)(14), _colors.N300, _colors.N50);
24
+ var inputStyle = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* Normal .className gets overridden by input[type=text] hence this hack to produce input.className */\n input& {\n background-color: white;\n border: 1px solid ", ";\n border-radius: ", "px;\n box-sizing: border-box;\n height: 40px;\n padding-left: 20px;\n padding-top: 12px;\n padding-bottom: 12px;\n font-size: ", ";\n width: 100%;\n font-weight: 400;\n line-height: 1.42857142857143;\n letter-spacing: -0.005em;\n color: ", ";\n\n &:hover {\n border-color: ", ";\n cursor: text;\n }\n }\n"])), (0, _tokens.token)('color.border.input', _editorSharedStyles.akEditorSubtleAccent), (0, _constants.borderRadius)(), (0, _editorSharedStyles.relativeFontSizeToBase16)(14), _colors.N300, _colors.N50);
23
25
  exports.inputStyle = inputStyle;
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports.default = void 0;
11
11
 
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
-
14
12
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
15
13
 
14
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
+
16
16
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
17
17
 
18
18
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports.default = void 0;
11
11
 
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
-
14
12
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
15
13
 
14
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
+
16
16
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
17
17
 
18
18
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports.default = UserSelect;
11
11
 
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
-
14
12
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
15
13
 
14
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
+
16
16
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
17
17
 
18
18
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.serialize = exports.findDuplicateFields = exports.deserialize = void 0;
9
9
 
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
13
11
 
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
 
16
16
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -86,11 +86,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
86
86
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
87
87
 
88
88
  var contentStyles = function contentStyles(props) {
89
- var _props$featureFlags, _props$featureFlags2;
89
+ var _props$featureFlags;
90
90
 
91
91
  return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid #8cf;\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap,\n .pm-table-cell-content-wrap div.fabric-editor-block-mark {\n p:first-child {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), (0, _editorSharedStyles.editorFontSize)({
92
92
  theme: props.theme
93
- }), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, _styles17.placeholderTextStyles, _styles5.placeholderStyles, (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.codeBlockSyntaxHighlighting ? (0, _styles7.highlightingCodeBlockStyles)(props) : (0, _styles7.codeBlockStyles)(props), (0, _styles6.blocktypeStyles)(props), (0, _styles16.textFormattingStyles)(props), _styles.textColorStyles, _styles8.listsStyles, (0, _styles9.ruleStyles)(props), _styles10.mediaStyles, _styles11.layoutStyles, _styles3.telepointerStyle, _styles4.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles12.panelStyles)(props), _styles13.fakeCursorStyles, _styles14.mentionsStyles, (_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.nextEmojiNodeView ? _styles15.emojiStylesNext : _styles15.emojiStyles, _styles.tasksAndDecisionsStyles, _styles18.gridStyles, _styles19.linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles20.extensionStyles, (0, _styles21.expandStyles)(props), _styles22.findReplaceStyles, _styles23.taskDecisionStyles, _styles24.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles25.smartCardStyles, _styles.smartCardSharedStyles, _styles26.dateStyles, _styled.embedCardStyles, _styles2.unsupportedStyles, _style.ClassNames.FLOATING_TOOLBAR_COMPONENT);
93
+ }), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, _styles17.placeholderTextStyles, _styles5.placeholderStyles, (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.codeBlockSyntaxHighlighting ? (0, _styles7.highlightingCodeBlockStyles)(props) : (0, _styles7.codeBlockStyles)(props), (0, _styles6.blocktypeStyles)(props), (0, _styles16.textFormattingStyles)(props), _styles.textColorStyles, _styles8.listsStyles, (0, _styles9.ruleStyles)(props), _styles10.mediaStyles, _styles11.layoutStyles, _styles3.telepointerStyle, _styles4.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles12.panelStyles)(props), _styles13.fakeCursorStyles, _styles14.mentionsStyles, _styles15.emojiStyles, _styles.tasksAndDecisionsStyles, _styles18.gridStyles, _styles19.linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles20.extensionStyles, (0, _styles21.expandStyles)(props), _styles22.findReplaceStyles, _styles23.taskDecisionStyles, _styles24.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles25.smartCardStyles, _styles.smartCardSharedStyles, _styles26.dateStyles, _styled.embedCardStyles, _styles2.unsupportedStyles, _style.ClassNames.FLOATING_TOOLBAR_COMPONENT);
94
94
  };
95
95
 
96
96
  var createEditorContentStyle = function createEditorContentStyle(styles) {
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "165.0.0";
9
+ var version = "166.0.2";
10
10
  exports.version = version;
11
11
 
12
12
  var nextMajorVersion = function nextMajorVersion() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "165.0.0",
3
+ "version": "166.0.2",
4
4
  "sideEffects": false
5
5
  }
@@ -10,6 +10,7 @@ import { analyticsEventKey } from '@atlaskit/editor-common/utils';
10
10
  import { findNodePosWithLocalId } from '../plugins/extension/utils';
11
11
  import { getFeatureFlags } from '../plugins/feature-flags-context/get-feature-flags';
12
12
  import { getCollabProvider } from '../plugins/collab-edit/native-collab-provider-plugin';
13
+ import deprecationWarnings from '../utils/deprecation-warnings';
13
14
  export default class EditorActions {
14
15
  constructor() {
15
16
  _defineProperty(this, "listeners", []);
@@ -196,7 +197,17 @@ export default class EditorActions {
196
197
  return isEmptyDocument(this.editorView.state.doc);
197
198
  }
198
199
 
199
- replaceDocument(rawValue, shouldScrollToBottom = true, shouldAddToHistory = true) {
200
+ replaceDocument(rawValue, shouldScrollToBottom = true,
201
+ /** @deprecated [ED-14158] shouldAddToHistory is not being used in this function */
202
+ shouldAddToHistory = true) {
203
+ deprecationWarnings('EditorActions.replaceDocument', {
204
+ shouldAddToHistory
205
+ }, [{
206
+ property: 'shouldAddToHistory',
207
+ description: '[ED-14158] EditorActions.replaceDocument does not use the shouldAddToHistory arg',
208
+ type: 'removed'
209
+ }]);
210
+
200
211
  if (!this.editorView || rawValue === undefined || rawValue === null) {
201
212
  return false;
202
213
  }
@@ -534,9 +534,20 @@ export class ReactEditorView extends React.Component {
534
534
  config: this.config,
535
535
  eventDispatcher: this.eventDispatcher,
536
536
  transformer: this.contentTransformer
537
- });
537
+ }); // Allows us to dispatch analytics within the plugin view.destory methods
538
+
539
+ const analyticsConnected = this.eventDispatcher.has(analyticsEventKey, this.handleAnalyticsEvent);
540
+
541
+ if (!analyticsConnected) {
542
+ this.eventDispatcher.on(analyticsEventKey, this.handleAnalyticsEvent);
543
+ }
544
+
538
545
  this.view.destroy(); // Destroys the dom node & all node views
539
546
 
547
+ if (!analyticsConnected) {
548
+ this.eventDispatcher.off(analyticsEventKey, this.handleAnalyticsEvent);
549
+ }
550
+
540
551
  this.view = undefined;
541
552
  }
542
553
  });
@@ -667,7 +678,6 @@ export class ReactEditorView extends React.Component {
667
678
  // This serves to avoid potential runtime exceptions which could arise
668
679
  // from an async dispatched transaction after it's unmounted.
669
680
  this.canDispatchTransactions = false;
670
- this.eventDispatcher.destroy();
671
681
  clearTimeout(this.focusTimeoutId);
672
682
 
673
683
  if (this.reliabilityInterval) {
@@ -686,11 +696,9 @@ export class ReactEditorView extends React.Component {
686
696
  state.destroy();
687
697
  }
688
698
  });
689
- } // this.view will be destroyed when React unmounts in handleEditorViewRef
690
-
699
+ }
691
700
 
692
- this.eventDispatcher.off(analyticsEventKey, this.handleAnalyticsEvent);
693
- this.eventDispatcher.off('resetEditorState', this.resetEditorState);
701
+ this.eventDispatcher.destroy(); // this.view will be destroyed when React unmounts in handleEditorViewRef
694
702
  } // Helper to allow tests to inject plugins directly
695
703
 
696
704
 
@@ -192,8 +192,7 @@ export default function createPluginsList(props, prevProps, createAnalyticsEvent
192
192
 
193
193
  if (props.emojiProvider) {
194
194
  preset.add([emojiPlugin, {
195
- createAnalyticsEvent,
196
- allowZeroWidthSpaceAfter: !isMobile
195
+ createAnalyticsEvent
197
196
  }]);
198
197
  }
199
198
 
@@ -497,6 +497,7 @@ export default class Editor extends React.Component {
497
497
  eventDispatcher: eventDispatcher,
498
498
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
499
499
  maxHeight: this.props.maxHeight,
500
+ minHeight: this.props.minHeight,
500
501
  onSave: this.props.onSave ? this.handleSave : undefined,
501
502
  onCancel: this.props.onCancel,
502
503
  popupsMountPoint: this.props.popupsMountPoint,
@@ -536,6 +537,19 @@ _defineProperty(Editor, "defaultProps", {
536
537
  quickInsert: true
537
538
  });
538
539
 
540
+ _defineProperty(Editor, "propTypes", {
541
+ minHeight: ({
542
+ appearance,
543
+ minHeight
544
+ }) => {
545
+ if (minHeight && appearance && !['comment', 'chromeless'].includes(appearance)) {
546
+ return new Error('minHeight only supports editor appearance chromeless and comment');
547
+ }
548
+
549
+ return null;
550
+ }
551
+ });
552
+
539
553
  _defineProperty(Editor, "contextTypes", {
540
554
  editorActions: PropTypes.object
541
555
  });
@@ -12,6 +12,14 @@ export class EventDispatcher {
12
12
  this.listeners[event].add(cb);
13
13
  }
14
14
 
15
+ has(event, cb) {
16
+ if (!this.listeners[event]) {
17
+ return false;
18
+ }
19
+
20
+ return this.listeners[event].has(cb);
21
+ }
22
+
15
23
  off(event, cb) {
16
24
  if (!this.listeners[event]) {
17
25
  return;
@@ -4,7 +4,6 @@ import React from 'react';
4
4
  import { createDispatch } from '../event-dispatcher';
5
5
  import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../plugins/analytics';
6
6
  import { analyticsEventKey } from '../plugins/analytics/consts';
7
- import { getFeatureFlags } from '../plugins/feature-flags-context';
8
7
  import { ErrorBoundary } from '../ui/ErrorBoundary';
9
8
  import { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from './getPerformanceOptions';
10
9
  export default class ReactNodeView {
@@ -101,20 +100,12 @@ export default class ReactNodeView {
101
100
  this.portalProviderAPI.render(componentWithErrorBoundary, this.domRef, this.hasAnalyticsContext, this.hasIntlContext);
102
101
  }
103
102
 
104
- createDomRef(options) {
103
+ createDomRef() {
105
104
  if (!this.node.isInline) {
106
105
  return document.createElement('div');
107
106
  }
108
107
 
109
108
  const htmlElement = document.createElement('span');
110
- const state = this.view.state;
111
- const featureFlags = getFeatureFlags(state);
112
-
113
- if (featureFlags && featureFlags.displayInlineBlockForInlineNodes && (options === null || options === void 0 ? void 0 : options.displayInlineBlockForInlineNodes) !== false) {
114
- htmlElement.style.display = 'inline-block';
115
- htmlElement.style.userSelect = 'all';
116
- }
117
-
118
109
  return htmlElement;
119
110
  }
120
111
 
@@ -6,6 +6,15 @@ export const InlineNodeViewSharedStyles = css`
6
6
  .inlineNodeView {
7
7
  display: inline;
8
8
  user-select: all;
9
+ /* Collapses zero width spaces inside the inline node view
10
+ to prevent the node from line breaking too early.
11
+ */
12
+ white-space: nowrap;
13
+ /* Then reset to the Editor default so we don't interfere
14
+ with any component styling. */
15
+ & > * {
16
+ white-space: pre-wrap;
17
+ }
9
18
  }
10
19
 
11
20
  &.ua-chrome .inlineNodeView > span {
@@ -55,6 +55,7 @@ export let ACTION;
55
55
  ACTION["INDENTED"] = "indented";
56
56
  ACTION["INITIALISED"] = "initialised";
57
57
  ACTION["INPUT_PERF_SAMPLING"] = "inputPerfSampling";
58
+ ACTION["INPUT_PERF_SAMPLING_AVG"] = "inputPerfSamplingAvg";
58
59
  ACTION["INSERTED"] = "inserted";
59
60
  ACTION["INVALID_DOCUMENT_ENCOUNTERED"] = "invalidDocumentEncountered";
60
61
  ACTION["INVOKED"] = "invoked";
@@ -7,7 +7,7 @@ import { getParticipantsCount } from '../../collab-edit/get-participants-count';
7
7
  import { countNodes } from '../../../utils/count-nodes';
8
8
  import { getContextIdentifier } from './context-identifier';
9
9
  import { setInteractionType } from '../utils/frozen-editor';
10
- import { getTimeSince } from '../../../utils/performance/get-performance-timing';
10
+ import InputLatencyTracker from '../utils/input-latency-tracking';
11
11
  export const frozenEditorPluginKey = new PluginKey('frozenEditor');
12
12
  const DEFAULT_KEYSTROKE_SAMPLING_LIMIT = 100;
13
13
  const DEFAULT_SLOW_THRESHOLD = 300;
@@ -18,13 +18,13 @@ const DEFAULT_TRACK_SEVERITY_ENABLED = false;
18
18
  export const DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL = 100;
19
19
  export const DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED = 500;
20
20
 
21
- const dispatchLongTaskEvent = (dispatchAnalyticsEvent, view, time, allowCountNodes, interactionType, severity) => {
21
+ const dispatchLongTaskEvent = (dispatchAnalyticsEvent, view, time, getNodeCount, interactionType, severity) => {
22
22
  var _getContextIdentifier;
23
23
 
24
24
  const {
25
25
  state
26
26
  } = view;
27
- const nodesCount = allowCountNodes ? countNodes(view.state) : {};
27
+ const nodesCount = getNodeCount(state);
28
28
  return dispatchAnalyticsEvent({
29
29
  action: ACTION.BROWSER_FREEZE,
30
30
  actionSubject: ACTION_SUBJECT.EDITOR,
@@ -42,8 +42,8 @@ const dispatchLongTaskEvent = (dispatchAnalyticsEvent, view, time, allowCountNod
42
42
  };
43
43
 
44
44
  export default ((dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, ufo) => {
45
- let keystrokeCount = 0;
46
45
  let interactionType;
46
+ let inputLatencyTracker = null;
47
47
 
48
48
  if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
49
49
  interactionType = setInteractionType(BROWSER_FREEZE_INTERACTION_TYPE.LOADING);
@@ -53,6 +53,20 @@ export default ((dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, u
53
53
  const slowThreshold = inputTracking && typeof inputTracking.slowThreshold === 'number' ? inputTracking.slowThreshold : DEFAULT_SLOW_THRESHOLD;
54
54
  const freezeThreshold = inputTracking && typeof inputTracking.freezeThreshold === 'number' ? inputTracking.freezeThreshold : DEFAULT_FREEZE_THRESHOLD;
55
55
  const allowCountNodes = inputTracking && inputTracking.countNodes;
56
+ let prevNodeCountState = null;
57
+ let prevNodeCount = {}; // Cache the result as we were calling this multiple times
58
+ // and has potential to be expensive
59
+
60
+ const getNodeCount = state => {
61
+ if (state === prevNodeCountState) {
62
+ return prevNodeCount;
63
+ }
64
+
65
+ prevNodeCount = allowCountNodes ? countNodes(state) : {};
66
+ prevNodeCountState = state;
67
+ return prevNodeCount;
68
+ };
69
+
56
70
  const shouldTrackSeverity = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.trackSeverity) || DEFAULT_TRACK_SEVERITY_ENABLED;
57
71
  const severityThresholdNormal = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityNormalThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL;
58
72
  const severityThresholdDegraded = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityDegradedThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED;
@@ -60,85 +74,18 @@ export default ((dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, u
60
74
  key: frozenEditorPluginKey,
61
75
  props: isPerformanceAPIAvailable() ? {
62
76
  handleTextInput(view) {
63
- const {
64
- state
65
- } = view;
66
- const now = performance.now();
77
+ var _inputLatencyTracker;
78
+
79
+ (_inputLatencyTracker = inputLatencyTracker) === null || _inputLatencyTracker === void 0 ? void 0 : _inputLatencyTracker.start();
67
80
 
68
81
  if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
69
82
  interactionType = BROWSER_FREEZE_INTERACTION_TYPE.TYPING;
70
83
  }
71
84
 
72
- const experienceStore = ufo ? ExperienceStore.getInstance(view) : undefined;
73
- const trackTyping = samplingRate && ++keystrokeCount === samplingRate;
74
-
75
- if (trackTyping) {
76
- experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.start(EditorExperience.typing);
77
- }
78
-
79
85
  requestAnimationFrame(() => {
80
- const diff = getTimeSince(now);
81
-
82
- if (diff > slowThreshold) {
83
- const nodesCount = allowCountNodes ? countNodes(view.state) : {};
84
-
85
- if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
86
- var _getContextIdentifier2;
87
-
88
- dispatchAnalyticsEvent({
89
- action: ACTION.SLOW_INPUT,
90
- actionSubject: ACTION_SUBJECT.EDITOR,
91
- attributes: {
92
- time: diff,
93
- nodeSize: state.doc.nodeSize,
94
- ...nodesCount,
95
- participants: getParticipantsCount(state),
96
- objectId: (_getContextIdentifier2 = getContextIdentifier(state)) === null || _getContextIdentifier2 === void 0 ? void 0 : _getContextIdentifier2.objectId
97
- },
98
- eventType: EVENT_TYPE.OPERATIONAL
99
- });
100
- }
101
-
102
- experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.addMetadata(EditorExperience.typing, {
103
- slowInput: true
104
- });
105
- }
106
-
107
- if (trackTyping) {
108
- var _getContextIdentifier4;
86
+ var _inputLatencyTracker2;
109
87
 
110
- const nodesCount = allowCountNodes ? countNodes(view.state) : {};
111
- keystrokeCount = 0;
112
- const severity = shouldTrackSeverity ? getAnalyticsEventSeverity(diff, severityThresholdNormal, severityThresholdDegraded) : undefined;
113
-
114
- if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
115
- var _getContextIdentifier3;
116
-
117
- const payload = {
118
- action: ACTION.INPUT_PERF_SAMPLING,
119
- actionSubject: ACTION_SUBJECT.EDITOR,
120
- attributes: {
121
- time: diff,
122
- nodeSize: state.doc.nodeSize,
123
- ...nodesCount,
124
- participants: getParticipantsCount(state),
125
- objectId: (_getContextIdentifier3 = getContextIdentifier(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId,
126
- severity
127
- },
128
- eventType: EVENT_TYPE.OPERATIONAL
129
- };
130
- dispatchAnalyticsEvent(payload);
131
- }
132
-
133
- experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.success(EditorExperience.typing, {
134
- nodeSize: state.doc.nodeSize,
135
- ...nodesCount,
136
- participants: getParticipantsCount(state),
137
- objectId: (_getContextIdentifier4 = getContextIdentifier(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId,
138
- time: diff,
139
- severity
140
- });
141
- }
88
+ (_inputLatencyTracker2 = inputLatencyTracker) === null || _inputLatencyTracker2 === void 0 ? void 0 : _inputLatencyTracker2.end();
142
89
  });
143
90
  return false;
144
91
  },
@@ -160,6 +107,116 @@ export default ((dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, u
160
107
  return {};
161
108
  }
162
109
 
110
+ const experienceStore = ufo ? ExperienceStore.getInstance(view) : undefined;
111
+
112
+ if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
113
+ inputLatencyTracker = new InputLatencyTracker({
114
+ samplingRate,
115
+ slowThreshold,
116
+ normalThreshold: severityThresholdNormal,
117
+ degradedThreshold: severityThresholdDegraded,
118
+ onSampleStart: () => {
119
+ experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.start(EditorExperience.typing);
120
+ },
121
+ onSampleEnd: (time, {
122
+ isSlow,
123
+ severity
124
+ }) => {
125
+ var _getContextIdentifier2;
126
+
127
+ const {
128
+ state
129
+ } = view;
130
+ const nodesCount = getNodeCount(state);
131
+
132
+ if (isSlow) {
133
+ experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.addMetadata(EditorExperience.typing, {
134
+ slowInput: true
135
+ });
136
+ }
137
+
138
+ experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.success(EditorExperience.typing, {
139
+ nodeSize: state.doc.nodeSize,
140
+ ...nodesCount,
141
+ participants: getParticipantsCount(state),
142
+ objectId: (_getContextIdentifier2 = getContextIdentifier(state)) === null || _getContextIdentifier2 === void 0 ? void 0 : _getContextIdentifier2.objectId,
143
+ time,
144
+ severity: shouldTrackSeverity ? severity : undefined
145
+ });
146
+ },
147
+ dispatchSample: (time, severity) => {
148
+ var _getContextIdentifier3;
149
+
150
+ const {
151
+ state
152
+ } = view;
153
+ const nodesCount = getNodeCount(state);
154
+ const samplePayload = {
155
+ action: ACTION.INPUT_PERF_SAMPLING,
156
+ actionSubject: ACTION_SUBJECT.EDITOR,
157
+ attributes: {
158
+ time,
159
+ nodeSize: state.doc.nodeSize,
160
+ ...nodesCount,
161
+ participants: getParticipantsCount(state),
162
+ objectId: (_getContextIdentifier3 = getContextIdentifier(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId,
163
+ severity: shouldTrackSeverity ? severity : undefined
164
+ },
165
+ eventType: EVENT_TYPE.OPERATIONAL
166
+ };
167
+ dispatchAnalyticsEvent(samplePayload);
168
+ },
169
+ dispatchAverage: ({
170
+ mean,
171
+ median,
172
+ sampleSize
173
+ }, severity) => {
174
+ var _getContextIdentifier4;
175
+
176
+ const {
177
+ state
178
+ } = view;
179
+ const nodeCount = getNodeCount(state);
180
+ const averagePayload = {
181
+ action: ACTION.INPUT_PERF_SAMPLING_AVG,
182
+ actionSubject: ACTION_SUBJECT.EDITOR,
183
+ attributes: {
184
+ mean,
185
+ median,
186
+ sampleSize,
187
+ ...nodeCount,
188
+ nodeSize: state.doc.nodeSize,
189
+ severity: shouldTrackSeverity ? severity : undefined,
190
+ participants: getParticipantsCount(state),
191
+ objectId: (_getContextIdentifier4 = getContextIdentifier(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId
192
+ },
193
+ eventType: EVENT_TYPE.OPERATIONAL
194
+ };
195
+ dispatchAnalyticsEvent(averagePayload);
196
+ },
197
+ onSlowInput: time => {
198
+ var _getContextIdentifier5;
199
+
200
+ const {
201
+ state
202
+ } = view;
203
+ const nodesCount = getNodeCount(state);
204
+ dispatchAnalyticsEvent({
205
+ action: ACTION.SLOW_INPUT,
206
+ actionSubject: ACTION_SUBJECT.EDITOR,
207
+ attributes: {
208
+ time,
209
+ nodeSize: state.doc.nodeSize,
210
+ ...nodesCount,
211
+ participants: getParticipantsCount(state),
212
+ objectId: (_getContextIdentifier5 = getContextIdentifier(state)) === null || _getContextIdentifier5 === void 0 ? void 0 : _getContextIdentifier5.objectId
213
+ },
214
+ eventType: EVENT_TYPE.OPERATIONAL
215
+ });
216
+ }
217
+ });
218
+ }
219
+
163
220
  let observer;
164
221
 
165
222
  try {
@@ -172,7 +229,7 @@ export default ((dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, u
172
229
  } = perfEntries[i];
173
230
 
174
231
  if (duration > freezeThreshold) {
175
- dispatchLongTaskEvent(dispatchAnalyticsEvent, view, duration, allowCountNodes, browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType ? interactionType : undefined, browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackSeverity ? getAnalyticsEventSeverity(duration, browserFreezeTracking.severityNormalThreshold || NORMAL_SEVERITY_THRESHOLD, browserFreezeTracking.severityDegradedThreshold || DEGRADED_SEVERITY_THRESHOLD) : undefined);
232
+ dispatchLongTaskEvent(dispatchAnalyticsEvent, view, duration, getNodeCount, browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType ? interactionType : undefined, browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackSeverity ? getAnalyticsEventSeverity(duration, browserFreezeTracking.severityNormalThreshold || NORMAL_SEVERITY_THRESHOLD, browserFreezeTracking.severityDegradedThreshold || DEGRADED_SEVERITY_THRESHOLD) : undefined);
176
233
  }
177
234
  }
178
235
  }); // register observer for long task notifications
@@ -184,9 +241,10 @@ export default ((dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, u
184
241
 
185
242
  return {
186
243
  destroy: () => {
187
- if (observer) {
188
- observer.disconnect();
189
- }
244
+ var _inputLatencyTracker3;
245
+
246
+ (_inputLatencyTracker3 = inputLatencyTracker) === null || _inputLatencyTracker3 === void 0 ? void 0 : _inputLatencyTracker3.flush();
247
+ observer === null || observer === void 0 ? void 0 : observer.disconnect();
190
248
  }
191
249
  };
192
250
  }