@atlaskit/editor-core 150.0.3 → 151.0.0

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 (195) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/cjs/actions/index.js +5 -23
  3. package/dist/cjs/create-editor/ErrorBoundary.js +113 -79
  4. package/dist/cjs/create-editor/ReactEditorView.js +145 -31
  5. package/dist/cjs/create-editor/create-plugins-list.js +4 -2
  6. package/dist/cjs/editor.js +101 -40
  7. package/dist/cjs/labs/next/presets/cxhtml.js +2 -1
  8. package/dist/cjs/plugins/analytics/types/enums.js +3 -1
  9. package/dist/cjs/plugins/base/index.js +4 -3
  10. package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +66 -36
  11. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
  12. package/dist/cjs/plugins/card/index.js +13 -2
  13. package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -0
  14. package/dist/cjs/plugins/card/pm-plugins/main.js +7 -2
  15. package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +10 -3
  16. package/dist/cjs/plugins/code-block/toolbar.js +1 -1
  17. package/dist/cjs/plugins/emoji/styles.js +1 -1
  18. package/dist/cjs/plugins/extension/pm-plugins/main.js +1 -4
  19. package/dist/cjs/plugins/extension/toolbar.js +28 -23
  20. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +8 -3
  21. package/dist/cjs/plugins/find-replace/ui/Find.js +27 -7
  22. package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +3 -3
  23. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  24. package/dist/cjs/plugins/hyperlink/utils.js +6 -69
  25. package/dist/cjs/plugins/media/index.js +14 -3
  26. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +24 -10
  27. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +179 -0
  28. package/dist/cjs/plugins/media/pm-plugins/main.js +18 -9
  29. package/dist/cjs/plugins/media/toolbar/index.js +49 -17
  30. package/dist/cjs/plugins/media/toolbar/utils.js +20 -2
  31. package/dist/cjs/plugins/media/utils/media-files.js +67 -1
  32. package/dist/cjs/plugins/panel/index.js +2 -3
  33. package/dist/cjs/plugins/panel/message.js +47 -0
  34. package/dist/cjs/plugins/panel/toolbar.js +64 -84
  35. package/dist/cjs/plugins/panel/utils.js +2 -2
  36. package/dist/cjs/plugins/paste/linkify-md-plugin.js +3 -3
  37. package/dist/cjs/plugins/status/styles.js +1 -1
  38. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  39. package/dist/cjs/profiler/render-count.js +82 -0
  40. package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -5
  41. package/dist/cjs/utils/react-hooks/use-component-renderer-tracking/index.js +55 -19
  42. package/dist/cjs/version-wrapper.js +1 -1
  43. package/dist/cjs/version.json +1 -1
  44. package/dist/es2019/actions/index.js +6 -28
  45. package/dist/es2019/create-editor/ErrorBoundary.js +73 -60
  46. package/dist/es2019/create-editor/ReactEditorView.js +130 -23
  47. package/dist/es2019/create-editor/create-plugins-list.js +4 -2
  48. package/dist/es2019/editor.js +74 -35
  49. package/dist/es2019/labs/next/presets/cxhtml.js +2 -1
  50. package/dist/es2019/plugins/analytics/types/enums.js +3 -1
  51. package/dist/es2019/plugins/base/index.js +4 -3
  52. package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +63 -35
  53. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +2 -1
  54. package/dist/es2019/plugins/card/index.js +7 -2
  55. package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -0
  56. package/dist/es2019/plugins/card/pm-plugins/main.js +9 -2
  57. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +12 -5
  58. package/dist/es2019/plugins/code-block/toolbar.js +1 -1
  59. package/dist/es2019/plugins/emoji/styles.js +2 -0
  60. package/dist/es2019/plugins/extension/pm-plugins/main.js +1 -4
  61. package/dist/es2019/plugins/extension/toolbar.js +30 -25
  62. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +8 -4
  63. package/dist/es2019/plugins/find-replace/ui/Find.js +27 -6
  64. package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  65. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  66. package/dist/es2019/plugins/hyperlink/utils.js +3 -59
  67. package/dist/es2019/plugins/media/index.js +13 -4
  68. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +16 -7
  69. package/dist/es2019/plugins/media/nodeviews/mediaInline.js +88 -0
  70. package/dist/es2019/plugins/media/pm-plugins/main.js +20 -11
  71. package/dist/es2019/plugins/media/toolbar/index.js +44 -15
  72. package/dist/es2019/plugins/media/toolbar/utils.js +16 -0
  73. package/dist/es2019/plugins/media/utils/media-files.js +68 -2
  74. package/dist/es2019/plugins/panel/index.js +3 -4
  75. package/dist/es2019/plugins/panel/message.js +38 -0
  76. package/dist/es2019/plugins/panel/toolbar.js +52 -71
  77. package/dist/es2019/plugins/panel/utils.js +2 -2
  78. package/dist/es2019/plugins/paste/linkify-md-plugin.js +2 -2
  79. package/dist/es2019/plugins/status/styles.js +2 -0
  80. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  81. package/dist/es2019/profiler/render-count.js +60 -0
  82. package/dist/es2019/ui/Appearance/Comment/Comment.js +4 -2
  83. package/dist/es2019/utils/react-hooks/use-component-renderer-tracking/index.js +51 -18
  84. package/dist/es2019/version-wrapper.js +1 -1
  85. package/dist/es2019/version.json +1 -1
  86. package/dist/esm/actions/index.js +6 -24
  87. package/dist/esm/create-editor/ErrorBoundary.js +113 -78
  88. package/dist/esm/create-editor/ReactEditorView.js +146 -31
  89. package/dist/esm/create-editor/create-plugins-list.js +4 -2
  90. package/dist/esm/editor.js +100 -40
  91. package/dist/esm/labs/next/presets/cxhtml.js +2 -1
  92. package/dist/esm/plugins/analytics/types/enums.js +3 -1
  93. package/dist/esm/plugins/base/index.js +4 -3
  94. package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +64 -36
  95. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
  96. package/dist/esm/plugins/card/index.js +13 -2
  97. package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -0
  98. package/dist/esm/plugins/card/pm-plugins/main.js +7 -2
  99. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +12 -5
  100. package/dist/esm/plugins/code-block/toolbar.js +1 -1
  101. package/dist/esm/plugins/emoji/styles.js +1 -1
  102. package/dist/esm/plugins/extension/pm-plugins/main.js +1 -4
  103. package/dist/esm/plugins/extension/toolbar.js +28 -23
  104. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +8 -4
  105. package/dist/esm/plugins/find-replace/ui/Find.js +27 -7
  106. package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  107. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  108. package/dist/esm/plugins/hyperlink/utils.js +3 -59
  109. package/dist/esm/plugins/media/index.js +14 -4
  110. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -10
  111. package/dist/esm/plugins/media/nodeviews/mediaInline.js +147 -0
  112. package/dist/esm/plugins/media/pm-plugins/main.js +19 -11
  113. package/dist/esm/plugins/media/toolbar/index.js +47 -19
  114. package/dist/esm/plugins/media/toolbar/utils.js +15 -1
  115. package/dist/esm/plugins/media/utils/media-files.js +60 -2
  116. package/dist/esm/plugins/panel/index.js +3 -4
  117. package/dist/esm/plugins/panel/message.js +38 -0
  118. package/dist/esm/plugins/panel/toolbar.js +57 -77
  119. package/dist/esm/plugins/panel/utils.js +2 -2
  120. package/dist/esm/plugins/paste/linkify-md-plugin.js +2 -2
  121. package/dist/esm/plugins/status/styles.js +1 -1
  122. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  123. package/dist/esm/profiler/render-count.js +57 -0
  124. package/dist/esm/ui/Appearance/Comment/Comment.js +6 -5
  125. package/dist/esm/utils/react-hooks/use-component-renderer-tracking/index.js +53 -20
  126. package/dist/esm/version-wrapper.js +1 -1
  127. package/dist/esm/version.json +1 -1
  128. package/dist/types/create-editor/ErrorBoundary.d.ts +6 -6
  129. package/dist/types/create-editor/ReactEditorView.d.ts +15 -3
  130. package/dist/types/editor.d.ts +2 -0
  131. package/dist/types/plugins/analytics/index.d.ts +1 -1
  132. package/dist/types/plugins/analytics/types/enums.d.ts +4 -2
  133. package/dist/types/plugins/analytics/types/events.d.ts +7 -2
  134. package/dist/types/plugins/analytics/types/general-events.d.ts +4 -1
  135. package/dist/types/plugins/analytics/types/index.d.ts +1 -1
  136. package/dist/types/plugins/analytics/types/insert-events.d.ts +6 -1
  137. package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
  138. package/dist/types/plugins/base/index.d.ts +1 -0
  139. package/dist/types/plugins/base/pm-plugins/frozen-editor.d.ts +3 -2
  140. package/dist/types/plugins/card/pm-plugins/main.d.ts +2 -3
  141. package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
  142. package/dist/types/plugins/card/types.d.ts +6 -0
  143. package/dist/types/plugins/extension/types.d.ts +0 -2
  144. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
  145. package/dist/types/plugins/floating-toolbar/types.d.ts +1 -1
  146. package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -1
  147. package/dist/types/plugins/hyperlink/utils.d.ts +0 -21
  148. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +27 -0
  149. package/dist/types/plugins/media/pm-plugins/main.d.ts +2 -2
  150. package/dist/types/plugins/media/toolbar/utils.d.ts +2 -0
  151. package/dist/types/plugins/media/utils/media-files.d.ts +8 -0
  152. package/dist/types/plugins/panel/message.d.ts +37 -0
  153. package/dist/types/plugins/panel/toolbar.d.ts +4 -37
  154. package/dist/types/plugins/panel/types.d.ts +1 -0
  155. package/dist/types/profiler/render-count.d.ts +14 -0
  156. package/dist/types/types/feature-flags.d.ts +8 -0
  157. package/dist/types/ui/LinkSearch/types.d.ts +1 -0
  158. package/dist/types/utils/react-hooks/use-component-renderer-tracking/index.d.ts +17 -1
  159. package/package.json +19 -16
  160. package/dist/cjs/plugins/caption/nodeviews/index.test.js +0 -135
  161. package/dist/cjs/plugins/caption/pm-plugins/keymap.test.js +0 -203
  162. package/dist/cjs/plugins/caption/pm-plugins/main.test.js +0 -141
  163. package/dist/cjs/plugins/code-block/language-list.test.js +0 -74
  164. package/dist/cjs/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -101
  165. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -98
  166. package/dist/cjs/plugins/media/commands/captions.test.js +0 -149
  167. package/dist/cjs/plugins/media/commands/linking.test.js +0 -296
  168. package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -50
  169. package/dist/cjs/plugins/panel/toolbar.test.js +0 -250
  170. package/dist/cjs/ui/ColorPickerButton/index.test.js +0 -123
  171. package/dist/cjs/ui/PortalProvider/index.test.js +0 -139
  172. package/dist/es2019/plugins/caption/nodeviews/index.test.js +0 -122
  173. package/dist/es2019/plugins/caption/pm-plugins/keymap.test.js +0 -193
  174. package/dist/es2019/plugins/caption/pm-plugins/main.test.js +0 -132
  175. package/dist/es2019/plugins/code-block/language-list.test.js +0 -69
  176. package/dist/es2019/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -83
  177. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  178. package/dist/es2019/plugins/media/commands/captions.test.js +0 -126
  179. package/dist/es2019/plugins/media/commands/linking.test.js +0 -208
  180. package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  181. package/dist/es2019/plugins/panel/toolbar.test.js +0 -200
  182. package/dist/es2019/ui/ColorPickerButton/index.test.js +0 -88
  183. package/dist/es2019/ui/PortalProvider/index.test.js +0 -115
  184. package/dist/esm/plugins/caption/nodeviews/index.test.js +0 -125
  185. package/dist/esm/plugins/caption/pm-plugins/keymap.test.js +0 -195
  186. package/dist/esm/plugins/caption/pm-plugins/main.test.js +0 -124
  187. package/dist/esm/plugins/code-block/language-list.test.js +0 -71
  188. package/dist/esm/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -92
  189. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  190. package/dist/esm/plugins/media/commands/captions.test.js +0 -135
  191. package/dist/esm/plugins/media/commands/linking.test.js +0 -268
  192. package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  193. package/dist/esm/plugins/panel/toolbar.test.js +0 -230
  194. package/dist/esm/ui/ColorPickerButton/index.test.js +0 -107
  195. package/dist/esm/ui/PortalProvider/index.test.js +0 -129
@@ -94,6 +94,7 @@ export var ACTION;
94
94
  ACTION["ON_EDITOR_READY_CALLBACK"] = "onEditorReadyCallback";
95
95
  ACTION["ON_CHANGE_CALLBACK"] = "onChangeCalled";
96
96
  ACTION["REMOVE_ICON"] = "removedIcon";
97
+ ACTION["UFO_SESSION_COMPLETE"] = "ufoSessionComplete";
97
98
  })(ACTION || (ACTION = {}));
98
99
 
99
100
  export var INPUT_METHOD;
@@ -234,8 +235,9 @@ export var ACTION_SUBJECT_ID;
234
235
  ACTION_SUBJECT_ID["LINK"] = "link";
235
236
  ACTION_SUBJECT_ID["LINK_PREVIEW"] = "linkPreview";
236
237
  ACTION_SUBJECT_ID["MEDIA"] = "media";
237
- ACTION_SUBJECT_ID["MEDIA_SINGLE"] = "mediaSingle";
238
238
  ACTION_SUBJECT_ID["MEDIA_GROUP"] = "mediaGroup";
239
+ ACTION_SUBJECT_ID["MEDIA_INLINE"] = "mediaInline";
240
+ ACTION_SUBJECT_ID["MEDIA_SINGLE"] = "mediaSingle";
239
241
  ACTION_SUBJECT_ID["MEDIA_LINK"] = "mediaLink";
240
242
  ACTION_SUBJECT_ID["MENTION"] = "mention";
241
243
  ACTION_SUBJECT_ID["NESTED_EXPAND"] = "nestedExpand";
@@ -55,9 +55,10 @@ var basePlugin = function basePlugin(options) {
55
55
  }, {
56
56
  name: 'frozenEditor',
57
57
  plugin: function plugin(_ref3) {
58
- var dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
59
- providerFactory = _ref3.providerFactory;
60
- return options && options.inputTracking && options.inputTracking.enabled ? frozenEditor(dispatchAnalyticsEvent, options.inputTracking, options.browserFreezeTracking) : undefined;
58
+ var _options$inputTrackin;
59
+
60
+ var dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent;
61
+ return options !== null && options !== void 0 && (_options$inputTrackin = options.inputTracking) !== null && _options$inputTrackin !== void 0 && _options$inputTrackin.enabled || options !== null && options !== void 0 && options.ufo ? frozenEditor(dispatchAnalyticsEvent, options.inputTracking, options.browserFreezeTracking, options.ufo) : undefined;
61
62
  }
62
63
  }, {
63
64
  name: 'decorationPlugin',
@@ -4,14 +4,16 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
4
4
 
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
6
 
7
- import { Plugin } from 'prosemirror-state';
7
+ import { Plugin, PluginKey } from 'prosemirror-state';
8
8
  import { isPerformanceObserverAvailable, isPerformanceAPIAvailable, getAnalyticsEventSeverity } from '@atlaskit/editor-common';
9
+ import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
9
10
  import { ACTION, ACTION_SUBJECT, BROWSER_FREEZE_INTERACTION_TYPE, EVENT_TYPE } from '../../analytics';
10
11
  import { getParticipantsCount } from '../../collab-edit/get-participants-count';
11
12
  import { countNodes } from '../../../utils/count-nodes';
12
13
  import { getContextIdentifier } from './context-identifier';
13
14
  import { setInteractionType } from '../utils/frozen-editor';
14
15
  import { getTimeSince } from '../../../utils/performance/get-performance-timing';
16
+ export var frozenEditorPluginKey = new PluginKey('frozenEditor');
15
17
  var DEFAULT_KEYSTROKE_SAMPLING_LIMIT = 100;
16
18
  var DEFAULT_SLOW_THRESHOLD = 300;
17
19
  export var DEFAULT_FREEZE_THRESHOLD = 600;
@@ -42,7 +44,7 @@ var dispatchLongTaskEvent = function dispatchLongTaskEvent(dispatchAnalyticsEven
42
44
  });
43
45
  };
44
46
 
45
- export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTracking) {
47
+ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, ufo) {
46
48
  var keystrokeCount = 0;
47
49
  var interactionType;
48
50
 
@@ -58,6 +60,7 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
58
60
  var severityThresholdNormal = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityNormalThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL;
59
61
  var severityThresholdDegraded = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityDegradedThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED;
60
62
  return new Plugin({
63
+ key: frozenEditorPluginKey,
61
64
  props: isPerformanceAPIAvailable() ? {
62
65
  handleTextInput: function handleTextInput(view) {
63
66
  var state = view.state;
@@ -67,51 +70,76 @@ export default (function (dispatchAnalyticsEvent, inputTracking, browserFreezeTr
67
70
  interactionType = BROWSER_FREEZE_INTERACTION_TYPE.TYPING;
68
71
  }
69
72
 
73
+ var experienceStore = ufo ? ExperienceStore.getInstance(view) : undefined;
74
+ var trackTyping = samplingRate && ++keystrokeCount === samplingRate;
75
+
76
+ if (trackTyping) {
77
+ experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.start(EditorExperience.typing);
78
+ }
79
+
70
80
  requestAnimationFrame(function () {
71
81
  var diff = getTimeSince(now);
72
82
 
73
- if (samplingRate && ++keystrokeCount === samplingRate) {
74
- var _getContextIdentifier2;
75
-
83
+ if (diff > slowThreshold) {
76
84
  var nodesCount = allowCountNodes ? countNodes(view.state) : {};
77
- keystrokeCount = 0;
78
- var payload = {
79
- action: ACTION.INPUT_PERF_SAMPLING,
80
- actionSubject: ACTION_SUBJECT.EDITOR,
81
- attributes: _objectSpread(_objectSpread({
82
- time: diff,
83
- nodeSize: state.doc.nodeSize
84
- }, nodesCount), {}, {
85
- participants: getParticipantsCount(state),
86
- objectId: (_getContextIdentifier2 = getContextIdentifier(state)) === null || _getContextIdentifier2 === void 0 ? void 0 : _getContextIdentifier2.objectId
87
- }),
88
- eventType: EVENT_TYPE.OPERATIONAL
89
- };
90
-
91
- if (shouldTrackSeverity) {
92
- payload.attributes.severity = getAnalyticsEventSeverity(diff, severityThresholdNormal, severityThresholdDegraded);
85
+
86
+ if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
87
+ var _getContextIdentifier2;
88
+
89
+ dispatchAnalyticsEvent({
90
+ action: ACTION.SLOW_INPUT,
91
+ actionSubject: ACTION_SUBJECT.EDITOR,
92
+ attributes: _objectSpread(_objectSpread({
93
+ time: diff,
94
+ nodeSize: state.doc.nodeSize
95
+ }, nodesCount), {}, {
96
+ participants: getParticipantsCount(state),
97
+ objectId: (_getContextIdentifier2 = getContextIdentifier(state)) === null || _getContextIdentifier2 === void 0 ? void 0 : _getContextIdentifier2.objectId
98
+ }),
99
+ eventType: EVENT_TYPE.OPERATIONAL
100
+ });
93
101
  }
94
102
 
95
- dispatchAnalyticsEvent(payload);
103
+ experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.addMetadata(EditorExperience.typing, {
104
+ slowInput: true
105
+ });
96
106
  }
97
107
 
98
- if (diff > slowThreshold) {
99
- var _getContextIdentifier3;
108
+ if (trackTyping) {
109
+ var _getContextIdentifier4;
100
110
 
101
111
  var _nodesCount = allowCountNodes ? countNodes(view.state) : {};
102
112
 
103
- dispatchAnalyticsEvent({
104
- action: ACTION.SLOW_INPUT,
105
- actionSubject: ACTION_SUBJECT.EDITOR,
106
- attributes: _objectSpread(_objectSpread({
107
- time: diff,
108
- nodeSize: state.doc.nodeSize
109
- }, _nodesCount), {}, {
110
- participants: getParticipantsCount(state),
111
- objectId: (_getContextIdentifier3 = getContextIdentifier(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId
112
- }),
113
- eventType: EVENT_TYPE.OPERATIONAL
114
- });
113
+ keystrokeCount = 0;
114
+ var severity = shouldTrackSeverity ? getAnalyticsEventSeverity(diff, severityThresholdNormal, severityThresholdDegraded) : undefined;
115
+
116
+ if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
117
+ var _getContextIdentifier3;
118
+
119
+ var payload = {
120
+ action: ACTION.INPUT_PERF_SAMPLING,
121
+ actionSubject: ACTION_SUBJECT.EDITOR,
122
+ attributes: _objectSpread(_objectSpread({
123
+ time: diff,
124
+ nodeSize: state.doc.nodeSize
125
+ }, _nodesCount), {}, {
126
+ participants: getParticipantsCount(state),
127
+ objectId: (_getContextIdentifier3 = getContextIdentifier(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId,
128
+ severity: severity
129
+ }),
130
+ eventType: EVENT_TYPE.OPERATIONAL
131
+ };
132
+ dispatchAnalyticsEvent(payload);
133
+ }
134
+
135
+ experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.success(EditorExperience.typing, _objectSpread(_objectSpread({
136
+ nodeSize: state.doc.nodeSize
137
+ }, _nodesCount), {}, {
138
+ participants: getParticipantsCount(state),
139
+ objectId: (_getContextIdentifier4 = getContextIdentifier(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId,
140
+ time: diff,
141
+ severity: severity
142
+ }));
115
143
  }
116
144
  });
117
145
  return false;
@@ -7,7 +7,9 @@ import styled from 'styled-components';
7
7
  import { headingsSharedStyles } from '@atlaskit/editor-common';
8
8
  import { Shortcut } from '../../../../ui/styles';
9
9
  export var BlockTypeMenuItem = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", ";\n > {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-top: 0;\n }\n }\n ", ";\n"])), headingsSharedStyles, function (props) {
10
- return props.selected ? "".concat(props.tagName, " { color: white }") : '';
10
+ return (// TEMP FIX: See https://product-fabric.atlassian.net/browse/ED-13878
11
+ props.selected ? "".concat(props.tagName, " { color: white !important; }") : ''
12
+ );
11
13
  });
12
14
  export var KeyboardShortcut = styled(Shortcut)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n margin-left: 16px;\n"])), function (props) {
13
15
  return props.selected ? "color: ".concat(N400, ";") : '';
@@ -1,3 +1,9 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4
+
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
+
1
7
  import React from 'react';
2
8
  import { inlineCard, blockCard, embedCard } from '@atlaskit/adf-schema';
3
9
  import { createPlugin } from './pm-plugins/main';
@@ -26,13 +32,18 @@ var cardPlugin = function cardPlugin(options) {
26
32
  return nodes;
27
33
  },
28
34
  pmPlugins: function pmPlugins() {
29
- var _options$allowResizin, _options$useAlternati;
35
+ var _options$allowBlockCa, _options$allowResizin, _options$useAlternati;
30
36
 
37
+ var allowBlockCards = (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true;
31
38
  var allowResizing = (_options$allowResizin = options.allowResizing) !== null && _options$allowResizin !== void 0 ? _options$allowResizin : true;
32
39
  var useAlternativePreloader = (_options$useAlternati = options.useAlternativePreloader) !== null && _options$useAlternati !== void 0 ? _options$useAlternati : true;
33
40
  return [{
34
41
  name: 'card',
35
- plugin: createPlugin(options.platform, allowResizing, useAlternativePreloader, options.fullWidthMode, options.createAnalyticsEvent)
42
+ plugin: createPlugin(_objectSpread(_objectSpread({}, options), {}, {
43
+ allowBlockCards: allowBlockCards,
44
+ allowResizing: allowResizing,
45
+ useAlternativePreloader: useAlternativePreloader
46
+ }))
36
47
  }];
37
48
  },
38
49
  contentComponent: function contentComponent(_ref) {
@@ -258,6 +258,7 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
258
258
 
259
259
  var containerWidth = isRichMediaInsideOfBlockNode(view, pos) ? lineLength : widthStateWidth;
260
260
  var smartCard = /*#__PURE__*/React.createElement(SmartCard, {
261
+ key: url,
261
262
  url: url,
262
263
  appearance: "embed",
263
264
  onClick: _this2.onClick,
@@ -8,12 +8,17 @@ import { EmbedCard } from '../nodeviews/embedCard';
8
8
  import { BlockCard } from '../nodeviews/blockCard';
9
9
  import { InlineCard } from '../nodeviews/inlineCard';
10
10
  export { pluginKey } from './plugin-key';
11
- export var createPlugin = function createPlugin(platform, allowResizing, useAlternativePreloader, fullWidthMode, createAnalyticsEvent) {
11
+ export var createPlugin = function createPlugin(options) {
12
12
  return function (_ref) {
13
13
  var portalProviderAPI = _ref.portalProviderAPI,
14
14
  eventDispatcher = _ref.eventDispatcher,
15
15
  providerFactory = _ref.providerFactory,
16
16
  dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
17
+ var platform = options.platform,
18
+ allowResizing = options.allowResizing,
19
+ useAlternativePreloader = options.useAlternativePreloader,
20
+ fullWidthMode = options.fullWidthMode,
21
+ createAnalyticsEvent = options.createAnalyticsEvent;
17
22
  return new Plugin({
18
23
  state: {
19
24
  init: function init() {
@@ -71,7 +76,7 @@ export var createPlugin = function createPlugin(platform, allowResizing, useAlte
71
76
  * other tasks as per common implementations of the JavaScript event loop in browsers.
72
77
  */
73
78
  var invoke = rafSchedule(function () {
74
- return resolveWithProvider(view, outstandingRequests, provider, request);
79
+ return resolveWithProvider(view, outstandingRequests, provider, request, options);
75
80
  });
76
81
  rafCancellationCallbacks.push(invoke.cancel);
77
82
  invoke();
@@ -1,21 +1,28 @@
1
1
  import { setProvider } from '../actions';
2
- import { replaceQueuedUrlWithCard, handleFallbackWithAnalytics } from '../doc'; // ============================================================================ //
2
+ import { replaceQueuedUrlWithCard, handleFallbackWithAnalytics } from '../doc';
3
+ // ============================================================================ //
3
4
  // ============================== PROVIDER UTILS ============================== //
4
5
  // ============================================================================ //
5
6
  // Used for all interactions with the EditorCardProvider.
6
7
  // ============================================================================ //
7
-
8
- export var resolveWithProvider = function resolveWithProvider(view, outstandingRequests, provider, request) {
8
+ export var resolveWithProvider = function resolveWithProvider(view, outstandingRequests, provider, request, options) {
9
9
  var handleResolve = provider.resolve(request.url, request.appearance).then(function (resolvedCard) {
10
10
  delete outstandingRequests[request.url];
11
11
  return resolvedCard;
12
- }).then(handleResolved(view, request), handleRejected(view, request));
12
+ }).then(handleResolved(view, request, options), handleRejected(view, request));
13
13
  outstandingRequests[request.url] = handleResolve;
14
14
  return handleResolve;
15
15
  };
16
16
 
17
- var handleResolved = function handleResolved(view, request) {
17
+ var updateCardType = function updateCardType(resolvedCard, options) {
18
+ if ((resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'blockCard' && !options.allowBlockCards || (resolvedCard === null || resolvedCard === void 0 ? void 0 : resolvedCard.type) === 'embedCard' && !options.allowEmbeds) {
19
+ resolvedCard.type = 'inlineCard';
20
+ }
21
+ };
22
+
23
+ var handleResolved = function handleResolved(view, request, options) {
18
24
  return function (resolvedCard) {
25
+ updateCardType(resolvedCard, options);
19
26
  replaceQueuedUrlWithCard(request.url, resolvedCard, request.analyticsAction)(view.state, view.dispatch);
20
27
  return resolvedCard;
21
28
  };
@@ -48,7 +48,7 @@ export var getToolbarConfig = function getToolbarConfig() {
48
48
  return option.value === language;
49
49
  }) || options.find(function (option) {
50
50
  return option.alias.includes(language);
51
- }) : undefined;
51
+ }) : null;
52
52
  var languageSelect = {
53
53
  id: 'editor.codeBlock.languageOptions',
54
54
  type: 'select',
@@ -7,7 +7,7 @@ import { N0, N20, N900 } from '@atlaskit/theme/colors';
7
7
  import { borderRadius, fontSizeSmall, gridSize } from '@atlaskit/theme/constants';
8
8
  import { EmojiSharedCssClassName } from '@atlaskit/editor-common';
9
9
  import { SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
10
- export var emojiStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n .", " {\n cursor: pointer;\n\n &.", " > span {\n /** needed for selection style to cover custom emoji image properly */\n display: flex;\n }\n }\n\n &.", " {\n .", ",\n .", "\n > span {\n border-radius: 2px;\n ", "\n }\n }\n }\n"])), EmojiSharedCssClassName.EMOJI_CONTAINER, EmojiSharedCssClassName.EMOJI_NODE, EmojiSharedCssClassName.EMOJI_IMAGE, akEditorSelectedNodeClassName, EmojiSharedCssClassName.EMOJI_SPRITE, EmojiSharedCssClassName.EMOJI_IMAGE, getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.BoxShadow]));
10
+ export var emojiStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n display: inline-block;\n\n .", " {\n cursor: pointer;\n\n &.", " > span {\n /** needed for selection style to cover custom emoji image properly */\n display: flex;\n }\n }\n\n &.", " {\n .", ",\n .", "\n > span {\n border-radius: 2px;\n ", "\n }\n }\n }\n"])), EmojiSharedCssClassName.EMOJI_CONTAINER, EmojiSharedCssClassName.EMOJI_NODE, EmojiSharedCssClassName.EMOJI_IMAGE, akEditorSelectedNodeClassName, EmojiSharedCssClassName.EMOJI_SPRITE, EmojiSharedCssClassName.EMOJI_IMAGE, getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.BoxShadow]));
11
11
  var grid = gridSize() / 2;
12
12
  var fontSize = fontSizeSmall();
13
13
  var lineHeight = 4 * grid / fontSize;
@@ -251,7 +251,6 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
251
251
  var useLongPressSelection = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
252
252
  var options = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
253
253
  var state = createPluginState(dispatch, {
254
- layout: 'default',
255
254
  showEditButton: false,
256
255
  showContextPanel: false
257
256
  });
@@ -304,14 +303,12 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
304
303
  var showEditButton = shouldShowEditButton(extensionHandler, extensionProvider);
305
304
  var updateExtension = getUpdateExtensionPromise(view, extensionHandler, extensionProvider).catch(function () {// do nothing;
306
305
  });
307
- var layout = selectedExtension ? node.attrs.layout : 'default';
308
306
  updateState({
309
307
  localId: node.attrs.localId,
310
308
  showContextPanel: false,
311
309
  element: newElement,
312
310
  showEditButton: showEditButton,
313
- updateExtension: updateExtension,
314
- layout: layout
311
+ updateExtension: updateExtension
315
312
  })(state, dispatch);
316
313
  } // New DOM element doesn't necessarily mean it's a new Node
317
314
  else if (element !== newElement) {
@@ -37,28 +37,33 @@ var isLayoutSupported = function isLayoutSupported(state, selectedExtNode) {
37
37
  return !!((selectedExtNode.node.type === bodiedExtension || selectedExtNode.node.type === extension && !hasParentNodeOfType([bodiedExtension, table, expand].filter(Boolean))(selection)) && !hasParentNodeOfType([layoutSection])(selection));
38
38
  };
39
39
 
40
- var breakoutOptions = function breakoutOptions(state, formatMessage, extensionState, breakoutEnabled) {
41
- var nodeWithPos = getSelectedExtension(state, true);
42
- var layout = extensionState.layout;
43
- return nodeWithPos && breakoutEnabled && isLayoutSupported(state, nodeWithPos) ? [{
44
- type: 'button',
45
- icon: CenterIcon,
46
- onClick: updateExtensionLayout('default'),
47
- selected: layout === 'default',
48
- title: formatMessage(commonMessages.layoutFixedWidth)
49
- }, {
50
- type: 'button',
51
- icon: WideIcon,
52
- onClick: updateExtensionLayout('wide'),
53
- selected: layout === 'wide',
54
- title: formatMessage(commonMessages.layoutWide)
55
- }, {
56
- type: 'button',
57
- icon: FullWidthIcon,
58
- onClick: updateExtensionLayout('full-width'),
59
- selected: layout === 'full-width',
60
- title: formatMessage(commonMessages.layoutFullWidth)
61
- }] : [];
40
+ var breakoutOptions = function breakoutOptions(state, formatMessage, breakoutEnabled) {
41
+ var nodeWithPos = getSelectedExtension(state, true); // we should only return breakout options when breakouts are enabled and the node supports them
42
+
43
+ if (nodeWithPos && breakoutEnabled && isLayoutSupported(state, nodeWithPos)) {
44
+ var layout = nodeWithPos.node.attrs.layout;
45
+ return [{
46
+ type: 'button',
47
+ icon: CenterIcon,
48
+ onClick: updateExtensionLayout('default'),
49
+ selected: layout === 'default',
50
+ title: formatMessage(commonMessages.layoutFixedWidth)
51
+ }, {
52
+ type: 'button',
53
+ icon: WideIcon,
54
+ onClick: updateExtensionLayout('wide'),
55
+ selected: layout === 'wide',
56
+ title: formatMessage(commonMessages.layoutWide)
57
+ }, {
58
+ type: 'button',
59
+ icon: FullWidthIcon,
60
+ onClick: updateExtensionLayout('full-width'),
61
+ selected: layout === 'full-width',
62
+ title: formatMessage(commonMessages.layoutFullWidth)
63
+ }];
64
+ }
65
+
66
+ return [];
62
67
  };
63
68
 
64
69
  var editButton = function editButton(formatMessage, extensionState) {
@@ -94,7 +99,7 @@ export var getToolbarConfig = function getToolbarConfig() {
94
99
  if (extensionState && !extensionState.showContextPanel && extensionState.element) {
95
100
  var nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension];
96
101
  var editButtonArray = editButton(formatMessage, extensionState);
97
- var breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled);
102
+ var breakoutButtonArray = breakoutOptions(state, formatMessage, breakoutEnabled);
98
103
  return {
99
104
  title: 'Extension floating controls',
100
105
  getDomRef: function getDomRef() {
@@ -6,15 +6,17 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7
7
 
8
8
  import { normalizeFeatureFlags } from '@atlaskit/editor-common/normalize-feature-flags';
9
-
9
+ import { browser } from '@atlaskit/editor-common';
10
10
  /**
11
11
  * Transforms EditorProps to an FeatureFlags object,
12
12
  * which is used by both current and archv3 editors.
13
13
  */
14
+
14
15
  export function createFeatureFlagsFromProps(props) {
15
- var _props$allowTextColor, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$featureFlags10, _props$featureFlags11, _props$allowTables5, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25;
16
+ var _props$allowTextColor, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$featureFlags10, _props$featureFlags11, _props$allowTables5, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27;
16
17
 
17
- return _objectSpread(_objectSpread({}, normalizeFeatureFlags(props.featureFlags)), {}, {
18
+ var normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
19
+ return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
18
20
  newInsertionBehaviour: props.allowNewInsertionBehaviour,
19
21
  interactiveExpand: typeof props.allowExpand === 'boolean' ? props.allowExpand : Boolean(props.allowExpand && props.allowExpand.allowInteractiveExpand !== false),
20
22
  placeholderBracketHint: !!props.placeholderBracketHint,
@@ -39,6 +41,8 @@ export function createFeatureFlagsFromProps(props) {
39
41
  errorBoundaryDocStructure: Boolean(typeof ((_props$featureFlags18 = props.featureFlags) === null || _props$featureFlags18 === void 0 ? void 0 : _props$featureFlags18.useErrorBoundaryDocStructure) === 'boolean' ? !!((_props$featureFlags19 = props.featureFlags) !== null && _props$featureFlags19 !== void 0 && _props$featureFlags19.useErrorBoundaryDocStructure) : false),
40
42
  synchronyErrorDocStructure: Boolean(typeof ((_props$featureFlags20 = props.featureFlags) === null || _props$featureFlags20 === void 0 ? void 0 : _props$featureFlags20.synchronyErrorDocStructure) === 'boolean' ? !!((_props$featureFlags21 = props.featureFlags) !== null && _props$featureFlags21 !== void 0 && _props$featureFlags21.synchronyErrorDocStructure) : false),
41
43
  enableViewUpdateSubscription: Boolean(typeof ((_props$featureFlags22 = props.featureFlags) === null || _props$featureFlags22 === void 0 ? void 0 : _props$featureFlags22.enableViewUpdateSubscription) === 'boolean' ? !!((_props$featureFlags23 = props.featureFlags) !== null && _props$featureFlags23 !== void 0 && _props$featureFlags23.enableViewUpdateSubscription) : false),
42
- collabAvatarScroll: Boolean(typeof ((_props$featureFlags24 = props.featureFlags) === null || _props$featureFlags24 === void 0 ? void 0 : _props$featureFlags24.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags25 = props.featureFlags) !== null && _props$featureFlags25 !== void 0 && _props$featureFlags25.collabAvatarScroll) : false)
44
+ collabAvatarScroll: Boolean(typeof ((_props$featureFlags24 = props.featureFlags) === null || _props$featureFlags24 === void 0 ? void 0 : _props$featureFlags24.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags25 = props.featureFlags) !== null && _props$featureFlags25 !== void 0 && _props$featureFlags25.collabAvatarScroll) : false),
45
+ ufo: Boolean(typeof ((_props$featureFlags26 = props.featureFlags) === null || _props$featureFlags26 === void 0 ? void 0 : _props$featureFlags26.ufo) === 'boolean' ? !!((_props$featureFlags27 = props.featureFlags) !== null && _props$featureFlags27 !== void 0 && _props$featureFlags27.ufo) : false),
46
+ codeBlockSyntaxHighlighting: Boolean(typeof normalizedFeatureFlags.codeBlockSyntaxHighlighting === 'boolean' ? !!normalizedFeatureFlags.codeBlockSyntaxHighlighting && !browser.safari : false)
43
47
  });
44
48
  }
@@ -91,13 +91,17 @@ var Find = /*#__PURE__*/function (_React$Component) {
91
91
  });
92
92
 
93
93
  _defineProperty(_assertThisInitialized(_this), "handleFindChange", function (event) {
94
- return _this.skipWhileComposing(function () {
95
- _this.updateFindValue(event.target.value);
96
- });
94
+ _this.updateFindValue(event.target.value);
97
95
  });
98
96
 
99
97
  _defineProperty(_assertThisInitialized(_this), "updateFindValue", function (value) {
100
- _this.props.onFind(value);
98
+ _this.setState({
99
+ localFindText: value
100
+ });
101
+
102
+ _this.skipWhileComposing(function () {
103
+ _this.props.onFind(value);
104
+ });
101
105
  });
102
106
 
103
107
  _defineProperty(_assertThisInitialized(_this), "handleFindKeyDown", function (event) {
@@ -177,7 +181,13 @@ var Find = /*#__PURE__*/function (_React$Component) {
177
181
  });
178
182
  _this.closeIcon = /*#__PURE__*/React.createElement(EditorCloseIcon, {
179
183
  label: _this.closeFindReplaceDialog
180
- });
184
+ }); // We locally manage the value of the input inside this component in order to support compositions.
185
+ // This requires some additional work inside componentDidUpdate to ensure we support changes that
186
+ // occur to this value which do not originate from this component.
187
+
188
+ _this.state = {
189
+ localFindText: _this.props.findText || ''
190
+ };
181
191
  return _this;
182
192
  }
183
193
 
@@ -190,7 +200,17 @@ var Find = /*#__PURE__*/function (_React$Component) {
190
200
  }, {
191
201
  key: "componentDidUpdate",
192
202
  value: function componentDidUpdate() {
193
- this.focusFindTextfield();
203
+ this.focusFindTextfield(); // If the external prop findText changes and we aren't in a composition we should update to the
204
+ // use the external prop value.
205
+ //
206
+ // An example of where this may happen is when a find occurs through the user selecting some text
207
+ // and pressing Mod-f.
208
+
209
+ if (!this.isComposing && this.props.findText !== this.state.localFindText) {
210
+ this.setState({
211
+ localFindText: this.props.findText || ''
212
+ });
213
+ }
194
214
  }
195
215
  }, {
196
216
  key: "render",
@@ -209,7 +229,7 @@ var Find = /*#__PURE__*/function (_React$Component) {
209
229
  name: "find",
210
230
  appearance: "none",
211
231
  placeholder: this.find,
212
- value: findText,
232
+ value: this.state.localFindText,
213
233
  ref: this.findTextfieldRef,
214
234
  autoComplete: "off",
215
235
  onChange: this.handleFindChange,
@@ -1,6 +1,6 @@
1
1
  import { keymap } from 'prosemirror-keymap';
2
+ import { getLinkMatch } from '@atlaskit/adf-schema';
2
3
  import * as keymaps from '../../../keymaps';
3
- import { getLinkMatch } from '../utils';
4
4
  import { stateKey } from '../pm-plugins/main';
5
5
  import { showLinkToolbar, hideLinkToolbar } from '../commands';
6
6
  import { queueCards } from '../../card/pm-plugins/actions';
@@ -89,7 +89,8 @@ var mapActivityProviderResultToLinkSearchItemData = function mapActivityProvider
89
89
  container: container,
90
90
  iconUrl: iconUrl,
91
91
  url: url,
92
- lastViewedDate: viewedTimestamp ? new Date(viewedTimestamp) : undefined
92
+ lastViewedDate: viewedTimestamp ? new Date(viewedTimestamp) : undefined,
93
+ prefetch: true
93
94
  };
94
95
  };
95
96
 
@@ -106,7 +107,8 @@ var mapSearchProviderResultToLinkSearchItemData = function mapSearchProviderResu
106
107
  name: title,
107
108
  url: url,
108
109
  lastUpdatedDate: updatedTimestamp ? new Date(updatedTimestamp) : undefined,
109
- icon: contentType && mapContentTypeToIcon[contentType] || defaultIcon
110
+ icon: contentType && mapContentTypeToIcon[contentType] || defaultIcon,
111
+ prefetch: false
110
112
  };
111
113
  };
112
114
 
@@ -463,7 +465,7 @@ export var HyperlinkLinkAddToolbar = /*#__PURE__*/function (_PureComponent) {
463
465
  }
464
466
 
465
467
  if (interaction === 'click' || _this.isUrlPopulatedWithSelectedItem()) {
466
- var _pluginState$searchSe3;
468
+ var _pluginState$searchSe3, _selectedItem$prefetc;
467
469
 
468
470
  /**
469
471
  * When it's a mouse click even or the selectedItem.url matches displayUrl, we think
@@ -481,7 +483,8 @@ export var HyperlinkLinkAddToolbar = /*#__PURE__*/function (_PureComponent) {
481
483
  trigger: interaction,
482
484
  resultCount: items.length,
483
485
  selectedResultId: selectedItem.objectId,
484
- selectedRelativePosition: selectedIndex
486
+ selectedRelativePosition: selectedIndex,
487
+ prefetch: (_selectedItem$prefetc = selectedItem.prefetch) !== null && _selectedItem$prefetc !== void 0 ? _selectedItem$prefetc : false
485
488
  },
486
489
  eventType: EVENT_TYPE.UI
487
490
  });
@@ -1,28 +1,7 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
- import LinkifyIt from 'linkify-it';
4
3
  import { mapSlice } from '../../utils/slice';
5
- import { isSafeUrl } from '@atlaskit/adf-schema';
6
- export var LINK_REGEXP = /(https?|ftp):\/\/[^\s]+/;
7
- var linkify = LinkifyIt();
8
- linkify.add('sourcetree:', 'http:');
9
- var tlds = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
10
- var tlds2Char = 'a[cdefgilmnoqrtuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrtuvwxyz]|n[acefgilopruz]|om|p[aefghkmnrtw]|qa|r[eosuw]|s[abcdegijklmnrtuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';
11
- tlds.push(tlds2Char);
12
- linkify.tlds(tlds, false);
13
- export function getLinkMatch(str) {
14
- if (!str) {
15
- return null;
16
- }
17
-
18
- var match = linkifyMatch(str);
19
-
20
- if (!match.length) {
21
- match = linkify.match(str);
22
- }
23
-
24
- return match && match[0];
25
- }
4
+ import { isSafeUrl, linkify, normalizeUrl as normaliseLinkHref } from '@atlaskit/adf-schema';
26
5
  /**
27
6
  * Instance of class LinkMatcher are used in autoformatting in place of Regex.
28
7
  * Hence it has been made similar to regex with an exec method.
@@ -99,8 +78,7 @@ export function normalizeUrl(url) {
99
78
  return url;
100
79
  }
101
80
 
102
- var match = getLinkMatch(url);
103
- return match && match.url || '';
81
+ return normaliseLinkHref(url);
104
82
  }
105
83
  export function linkifyContent(schema) {
106
84
  return function (slice) {
@@ -168,38 +146,4 @@ function findLinkMatches(text) {
168
146
  }
169
147
 
170
148
  return matches;
171
- }
172
-
173
- export var linkifyMatch = function linkifyMatch(text) {
174
- var matches = [];
175
-
176
- if (!LINK_REGEXP.test(text)) {
177
- return matches;
178
- }
179
-
180
- var startpos = 0;
181
- var substr;
182
-
183
- while (substr = text.substr(startpos)) {
184
- var link = (substr.match(LINK_REGEXP) || [''])[0];
185
-
186
- if (link) {
187
- var index = substr.search(LINK_REGEXP);
188
- var start = index >= 0 ? index + startpos : index;
189
- var end = start + link.length;
190
- matches.push({
191
- index: start,
192
- lastIndex: end,
193
- raw: link,
194
- url: link,
195
- text: link,
196
- schema: ''
197
- });
198
- startpos += end;
199
- } else {
200
- break;
201
- }
202
- }
203
-
204
- return matches;
205
- };
149
+ }