@atlaskit/editor-core 150.0.0 → 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 (209) hide show
  1. package/CHANGELOG.md +65 -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/collab-edit/ui/to-avatar.js +4 -8
  18. package/dist/cjs/plugins/emoji/styles.js +1 -1
  19. package/dist/cjs/plugins/extension/pm-plugins/main.js +1 -4
  20. package/dist/cjs/plugins/extension/toolbar.js +28 -23
  21. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +8 -3
  22. package/dist/cjs/plugins/find-replace/ui/Find.js +27 -7
  23. package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +3 -3
  24. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  25. package/dist/cjs/plugins/hyperlink/utils.js +6 -69
  26. package/dist/cjs/plugins/media/index.js +14 -3
  27. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +24 -10
  28. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +179 -0
  29. package/dist/cjs/plugins/media/pm-plugins/main.js +18 -9
  30. package/dist/cjs/plugins/media/toolbar/index.js +49 -17
  31. package/dist/cjs/plugins/media/toolbar/utils.js +20 -2
  32. package/dist/cjs/plugins/media/utils/media-files.js +67 -1
  33. package/dist/cjs/plugins/mentions/type-ahead/index.js +39 -3
  34. package/dist/cjs/plugins/panel/index.js +2 -3
  35. package/dist/cjs/plugins/panel/message.js +47 -0
  36. package/dist/cjs/plugins/panel/toolbar.js +64 -84
  37. package/dist/cjs/plugins/panel/utils.js +2 -2
  38. package/dist/cjs/plugins/paste/linkify-md-plugin.js +3 -3
  39. package/dist/cjs/plugins/status/styles.js +1 -1
  40. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  41. package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
  42. package/dist/cjs/profiler/render-count.js +82 -0
  43. package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -5
  44. package/dist/cjs/utils/react-hooks/use-component-renderer-tracking/index.js +55 -19
  45. package/dist/cjs/version-wrapper.js +1 -1
  46. package/dist/cjs/version.json +1 -1
  47. package/dist/es2019/actions/index.js +6 -28
  48. package/dist/es2019/create-editor/ErrorBoundary.js +73 -60
  49. package/dist/es2019/create-editor/ReactEditorView.js +130 -23
  50. package/dist/es2019/create-editor/create-plugins-list.js +4 -2
  51. package/dist/es2019/editor.js +74 -35
  52. package/dist/es2019/labs/next/presets/cxhtml.js +2 -1
  53. package/dist/es2019/plugins/analytics/types/enums.js +3 -1
  54. package/dist/es2019/plugins/base/index.js +4 -3
  55. package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +63 -35
  56. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +2 -1
  57. package/dist/es2019/plugins/card/index.js +7 -2
  58. package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -0
  59. package/dist/es2019/plugins/card/pm-plugins/main.js +9 -2
  60. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +12 -5
  61. package/dist/es2019/plugins/code-block/toolbar.js +1 -1
  62. package/dist/es2019/plugins/collab-edit/ui/to-avatar.js +2 -6
  63. package/dist/es2019/plugins/emoji/styles.js +2 -0
  64. package/dist/es2019/plugins/extension/pm-plugins/main.js +1 -4
  65. package/dist/es2019/plugins/extension/toolbar.js +30 -25
  66. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +8 -4
  67. package/dist/es2019/plugins/find-replace/ui/Find.js +27 -6
  68. package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  69. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  70. package/dist/es2019/plugins/hyperlink/utils.js +3 -59
  71. package/dist/es2019/plugins/media/index.js +13 -4
  72. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +16 -7
  73. package/dist/es2019/plugins/media/nodeviews/mediaInline.js +88 -0
  74. package/dist/es2019/plugins/media/pm-plugins/main.js +20 -11
  75. package/dist/es2019/plugins/media/toolbar/index.js +44 -15
  76. package/dist/es2019/plugins/media/toolbar/utils.js +16 -0
  77. package/dist/es2019/plugins/media/utils/media-files.js +68 -2
  78. package/dist/es2019/plugins/mentions/type-ahead/index.js +21 -2
  79. package/dist/es2019/plugins/panel/index.js +3 -4
  80. package/dist/es2019/plugins/panel/message.js +38 -0
  81. package/dist/es2019/plugins/panel/toolbar.js +52 -71
  82. package/dist/es2019/plugins/panel/utils.js +2 -2
  83. package/dist/es2019/plugins/paste/linkify-md-plugin.js +2 -2
  84. package/dist/es2019/plugins/status/styles.js +2 -0
  85. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  86. package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
  87. package/dist/es2019/profiler/render-count.js +60 -0
  88. package/dist/es2019/ui/Appearance/Comment/Comment.js +4 -2
  89. package/dist/es2019/utils/react-hooks/use-component-renderer-tracking/index.js +51 -18
  90. package/dist/es2019/version-wrapper.js +1 -1
  91. package/dist/es2019/version.json +1 -1
  92. package/dist/esm/actions/index.js +6 -24
  93. package/dist/esm/create-editor/ErrorBoundary.js +113 -78
  94. package/dist/esm/create-editor/ReactEditorView.js +146 -31
  95. package/dist/esm/create-editor/create-plugins-list.js +4 -2
  96. package/dist/esm/editor.js +100 -40
  97. package/dist/esm/labs/next/presets/cxhtml.js +2 -1
  98. package/dist/esm/plugins/analytics/types/enums.js +3 -1
  99. package/dist/esm/plugins/base/index.js +4 -3
  100. package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +64 -36
  101. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
  102. package/dist/esm/plugins/card/index.js +13 -2
  103. package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -0
  104. package/dist/esm/plugins/card/pm-plugins/main.js +7 -2
  105. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +12 -5
  106. package/dist/esm/plugins/code-block/toolbar.js +1 -1
  107. package/dist/esm/plugins/collab-edit/ui/to-avatar.js +4 -8
  108. package/dist/esm/plugins/emoji/styles.js +1 -1
  109. package/dist/esm/plugins/extension/pm-plugins/main.js +1 -4
  110. package/dist/esm/plugins/extension/toolbar.js +28 -23
  111. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +8 -4
  112. package/dist/esm/plugins/find-replace/ui/Find.js +27 -7
  113. package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  114. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  115. package/dist/esm/plugins/hyperlink/utils.js +3 -59
  116. package/dist/esm/plugins/media/index.js +14 -4
  117. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -10
  118. package/dist/esm/plugins/media/nodeviews/mediaInline.js +147 -0
  119. package/dist/esm/plugins/media/pm-plugins/main.js +19 -11
  120. package/dist/esm/plugins/media/toolbar/index.js +47 -19
  121. package/dist/esm/plugins/media/toolbar/utils.js +15 -1
  122. package/dist/esm/plugins/media/utils/media-files.js +60 -2
  123. package/dist/esm/plugins/mentions/type-ahead/index.js +39 -3
  124. package/dist/esm/plugins/panel/index.js +3 -4
  125. package/dist/esm/plugins/panel/message.js +38 -0
  126. package/dist/esm/plugins/panel/toolbar.js +57 -77
  127. package/dist/esm/plugins/panel/utils.js +2 -2
  128. package/dist/esm/plugins/paste/linkify-md-plugin.js +2 -2
  129. package/dist/esm/plugins/status/styles.js +1 -1
  130. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  131. package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
  132. package/dist/esm/profiler/render-count.js +57 -0
  133. package/dist/esm/ui/Appearance/Comment/Comment.js +6 -5
  134. package/dist/esm/utils/react-hooks/use-component-renderer-tracking/index.js +53 -20
  135. package/dist/esm/version-wrapper.js +1 -1
  136. package/dist/esm/version.json +1 -1
  137. package/dist/types/create-editor/ErrorBoundary.d.ts +6 -6
  138. package/dist/types/create-editor/ReactEditorView.d.ts +15 -3
  139. package/dist/types/editor.d.ts +3 -1
  140. package/dist/types/plugins/analytics/analytics-queue.d.ts +1 -1
  141. package/dist/types/plugins/analytics/index.d.ts +1 -1
  142. package/dist/types/plugins/analytics/types/enums.d.ts +4 -2
  143. package/dist/types/plugins/analytics/types/events.d.ts +7 -2
  144. package/dist/types/plugins/analytics/types/general-events.d.ts +4 -1
  145. package/dist/types/plugins/analytics/types/index.d.ts +1 -1
  146. package/dist/types/plugins/analytics/types/insert-events.d.ts +6 -1
  147. package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
  148. package/dist/types/plugins/base/index.d.ts +1 -0
  149. package/dist/types/plugins/base/pm-plugins/frozen-editor.d.ts +3 -2
  150. package/dist/types/plugins/card/pm-plugins/main.d.ts +2 -3
  151. package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
  152. package/dist/types/plugins/card/types.d.ts +6 -0
  153. package/dist/types/plugins/collab-edit/ui/to-avatar.d.ts +1 -1
  154. package/dist/types/plugins/extension/types.d.ts +0 -2
  155. package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -2
  156. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
  157. package/dist/types/plugins/floating-toolbar/types.d.ts +1 -1
  158. package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -1
  159. package/dist/types/plugins/hyperlink/utils.d.ts +0 -21
  160. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
  161. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +27 -0
  162. package/dist/types/plugins/media/pm-plugins/main.d.ts +2 -2
  163. package/dist/types/plugins/media/toolbar/utils.d.ts +2 -0
  164. package/dist/types/plugins/media/utils/media-files.d.ts +8 -0
  165. package/dist/types/plugins/panel/message.d.ts +37 -0
  166. package/dist/types/plugins/panel/toolbar.d.ts +4 -37
  167. package/dist/types/plugins/panel/types.d.ts +1 -0
  168. package/dist/types/plugins/quick-insert/index.d.ts +1 -1
  169. package/dist/types/profiler/render-count.d.ts +14 -0
  170. package/dist/types/types/feature-flags.d.ts +8 -0
  171. package/dist/types/ui/LinkSearch/types.d.ts +1 -0
  172. package/dist/types/utils/react-hooks/use-component-renderer-tracking/index.d.ts +17 -1
  173. package/package.json +20 -17
  174. package/dist/cjs/plugins/caption/nodeviews/index.test.js +0 -135
  175. package/dist/cjs/plugins/caption/pm-plugins/keymap.test.js +0 -203
  176. package/dist/cjs/plugins/caption/pm-plugins/main.test.js +0 -141
  177. package/dist/cjs/plugins/code-block/language-list.test.js +0 -74
  178. package/dist/cjs/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -101
  179. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -98
  180. package/dist/cjs/plugins/media/commands/captions.test.js +0 -149
  181. package/dist/cjs/plugins/media/commands/linking.test.js +0 -296
  182. package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -50
  183. package/dist/cjs/plugins/panel/toolbar.test.js +0 -250
  184. package/dist/cjs/ui/ColorPickerButton/index.test.js +0 -123
  185. package/dist/cjs/ui/PortalProvider/index.test.js +0 -139
  186. package/dist/es2019/plugins/caption/nodeviews/index.test.js +0 -122
  187. package/dist/es2019/plugins/caption/pm-plugins/keymap.test.js +0 -193
  188. package/dist/es2019/plugins/caption/pm-plugins/main.test.js +0 -132
  189. package/dist/es2019/plugins/code-block/language-list.test.js +0 -69
  190. package/dist/es2019/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -83
  191. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  192. package/dist/es2019/plugins/media/commands/captions.test.js +0 -126
  193. package/dist/es2019/plugins/media/commands/linking.test.js +0 -208
  194. package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  195. package/dist/es2019/plugins/panel/toolbar.test.js +0 -200
  196. package/dist/es2019/ui/ColorPickerButton/index.test.js +0 -88
  197. package/dist/es2019/ui/PortalProvider/index.test.js +0 -115
  198. package/dist/esm/plugins/caption/nodeviews/index.test.js +0 -125
  199. package/dist/esm/plugins/caption/pm-plugins/keymap.test.js +0 -195
  200. package/dist/esm/plugins/caption/pm-plugins/main.test.js +0 -124
  201. package/dist/esm/plugins/code-block/language-list.test.js +0 -71
  202. package/dist/esm/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -92
  203. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  204. package/dist/esm/plugins/media/commands/captions.test.js +0 -135
  205. package/dist/esm/plugins/media/commands/linking.test.js +0 -268
  206. package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  207. package/dist/esm/plugins/panel/toolbar.test.js +0 -230
  208. package/dist/esm/ui/ColorPickerButton/index.test.js +0 -107
  209. package/dist/esm/ui/PortalProvider/index.test.js +0 -129
@@ -1,11 +1,13 @@
1
- import { Plugin } from 'prosemirror-state';
1
+ import { Plugin, PluginKey } from 'prosemirror-state';
2
2
  import { isPerformanceObserverAvailable, isPerformanceAPIAvailable, getAnalyticsEventSeverity } from '@atlaskit/editor-common';
3
+ import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
3
4
  import { ACTION, ACTION_SUBJECT, BROWSER_FREEZE_INTERACTION_TYPE, EVENT_TYPE } from '../../analytics';
4
5
  import { getParticipantsCount } from '../../collab-edit/get-participants-count';
5
6
  import { countNodes } from '../../../utils/count-nodes';
6
7
  import { getContextIdentifier } from './context-identifier';
7
8
  import { setInteractionType } from '../utils/frozen-editor';
8
9
  import { getTimeSince } from '../../../utils/performance/get-performance-timing';
10
+ export const frozenEditorPluginKey = new PluginKey('frozenEditor');
9
11
  const DEFAULT_KEYSTROKE_SAMPLING_LIMIT = 100;
10
12
  const DEFAULT_SLOW_THRESHOLD = 300;
11
13
  export const DEFAULT_FREEZE_THRESHOLD = 600;
@@ -38,7 +40,7 @@ const dispatchLongTaskEvent = (dispatchAnalyticsEvent, view, time, allowCountNod
38
40
  });
39
41
  };
40
42
 
41
- export default ((dispatchAnalyticsEvent, inputTracking, browserFreezeTracking) => {
43
+ export default ((dispatchAnalyticsEvent, inputTracking, browserFreezeTracking, ufo) => {
42
44
  let keystrokeCount = 0;
43
45
  let interactionType;
44
46
 
@@ -54,6 +56,7 @@ export default ((dispatchAnalyticsEvent, inputTracking, browserFreezeTracking) =
54
56
  const severityThresholdNormal = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityNormalThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_NORMAL;
55
57
  const severityThresholdDegraded = (inputTracking === null || inputTracking === void 0 ? void 0 : inputTracking.severityDegradedThreshold) || DEFAULT_TRACK_SEVERITY_THRESHOLD_DEGRADED;
56
58
  return new Plugin({
59
+ key: frozenEditorPluginKey,
57
60
  props: isPerformanceAPIAvailable() ? {
58
61
  handleTextInput(view) {
59
62
  const {
@@ -65,49 +68,74 @@ export default ((dispatchAnalyticsEvent, inputTracking, browserFreezeTracking) =
65
68
  interactionType = BROWSER_FREEZE_INTERACTION_TYPE.TYPING;
66
69
  }
67
70
 
71
+ const experienceStore = ufo ? ExperienceStore.getInstance(view) : undefined;
72
+ const trackTyping = samplingRate && ++keystrokeCount === samplingRate;
73
+
74
+ if (trackTyping) {
75
+ experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.start(EditorExperience.typing);
76
+ }
77
+
68
78
  requestAnimationFrame(() => {
69
79
  const diff = getTimeSince(now);
70
80
 
71
- if (samplingRate && ++keystrokeCount === samplingRate) {
72
- var _getContextIdentifier2;
73
-
81
+ if (diff > slowThreshold) {
74
82
  const nodesCount = allowCountNodes ? countNodes(view.state) : {};
75
- keystrokeCount = 0;
76
- const payload = {
77
- action: ACTION.INPUT_PERF_SAMPLING,
78
- actionSubject: ACTION_SUBJECT.EDITOR,
79
- attributes: {
80
- time: diff,
81
- nodeSize: state.doc.nodeSize,
82
- ...nodesCount,
83
- participants: getParticipantsCount(state),
84
- objectId: (_getContextIdentifier2 = getContextIdentifier(state)) === null || _getContextIdentifier2 === void 0 ? void 0 : _getContextIdentifier2.objectId
85
- },
86
- eventType: EVENT_TYPE.OPERATIONAL
87
- };
88
-
89
- if (shouldTrackSeverity) {
90
- payload.attributes.severity = getAnalyticsEventSeverity(diff, severityThresholdNormal, severityThresholdDegraded);
83
+
84
+ if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
85
+ var _getContextIdentifier2;
86
+
87
+ dispatchAnalyticsEvent({
88
+ action: ACTION.SLOW_INPUT,
89
+ actionSubject: ACTION_SUBJECT.EDITOR,
90
+ attributes: {
91
+ time: diff,
92
+ nodeSize: state.doc.nodeSize,
93
+ ...nodesCount,
94
+ participants: getParticipantsCount(state),
95
+ objectId: (_getContextIdentifier2 = getContextIdentifier(state)) === null || _getContextIdentifier2 === void 0 ? void 0 : _getContextIdentifier2.objectId
96
+ },
97
+ eventType: EVENT_TYPE.OPERATIONAL
98
+ });
91
99
  }
92
100
 
93
- dispatchAnalyticsEvent(payload);
101
+ experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.addMetadata(EditorExperience.typing, {
102
+ slowInput: true
103
+ });
94
104
  }
95
105
 
96
- if (diff > slowThreshold) {
97
- var _getContextIdentifier3;
106
+ if (trackTyping) {
107
+ var _getContextIdentifier4;
98
108
 
99
109
  const nodesCount = allowCountNodes ? countNodes(view.state) : {};
100
- dispatchAnalyticsEvent({
101
- action: ACTION.SLOW_INPUT,
102
- actionSubject: ACTION_SUBJECT.EDITOR,
103
- attributes: {
104
- time: diff,
105
- nodeSize: state.doc.nodeSize,
106
- ...nodesCount,
107
- participants: getParticipantsCount(state),
108
- objectId: (_getContextIdentifier3 = getContextIdentifier(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId
109
- },
110
- eventType: EVENT_TYPE.OPERATIONAL
110
+ keystrokeCount = 0;
111
+ const severity = shouldTrackSeverity ? getAnalyticsEventSeverity(diff, severityThresholdNormal, severityThresholdDegraded) : undefined;
112
+
113
+ if (inputTracking !== null && inputTracking !== void 0 && inputTracking.enabled) {
114
+ var _getContextIdentifier3;
115
+
116
+ const payload = {
117
+ action: ACTION.INPUT_PERF_SAMPLING,
118
+ actionSubject: ACTION_SUBJECT.EDITOR,
119
+ attributes: {
120
+ time: diff,
121
+ nodeSize: state.doc.nodeSize,
122
+ ...nodesCount,
123
+ participants: getParticipantsCount(state),
124
+ objectId: (_getContextIdentifier3 = getContextIdentifier(state)) === null || _getContextIdentifier3 === void 0 ? void 0 : _getContextIdentifier3.objectId,
125
+ severity
126
+ },
127
+ eventType: EVENT_TYPE.OPERATIONAL
128
+ };
129
+ dispatchAnalyticsEvent(payload);
130
+ }
131
+
132
+ experienceStore === null || experienceStore === void 0 ? void 0 : experienceStore.success(EditorExperience.typing, {
133
+ nodeSize: state.doc.nodeSize,
134
+ ...nodesCount,
135
+ participants: getParticipantsCount(state),
136
+ objectId: (_getContextIdentifier4 = getContextIdentifier(state)) === null || _getContextIdentifier4 === void 0 ? void 0 : _getContextIdentifier4.objectId,
137
+ time: diff,
138
+ severity
111
139
  });
112
140
  }
113
141
  });
@@ -14,7 +14,8 @@ export const BlockTypeMenuItem = styled.div`
14
14
  margin-top: 0;
15
15
  }
16
16
  }
17
- ${props => props.selected ? `${props.tagName} { color: white }` : ''};
17
+ ${props => // TEMP FIX: See https://product-fabric.atlassian.net/browse/ED-13878
18
+ props.selected ? `${props.tagName} { color: white !important; }` : ''};
18
19
  `;
19
20
  export const KeyboardShortcut = styled(Shortcut)`
20
21
  ${props => props.selected ? `color: ${N400};` : ''}
@@ -28,13 +28,18 @@ const cardPlugin = options => {
28
28
  },
29
29
 
30
30
  pmPlugins() {
31
- var _options$allowResizin, _options$useAlternati;
31
+ var _options$allowBlockCa, _options$allowResizin, _options$useAlternati;
32
32
 
33
+ const allowBlockCards = (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true;
33
34
  const allowResizing = (_options$allowResizin = options.allowResizing) !== null && _options$allowResizin !== void 0 ? _options$allowResizin : true;
34
35
  const useAlternativePreloader = (_options$useAlternati = options.useAlternativePreloader) !== null && _options$useAlternati !== void 0 ? _options$useAlternati : true;
35
36
  return [{
36
37
  name: 'card',
37
- plugin: createPlugin(options.platform, allowResizing, useAlternativePreloader, options.fullWidthMode, options.createAnalyticsEvent)
38
+ plugin: createPlugin({ ...options,
39
+ allowBlockCards,
40
+ allowResizing,
41
+ useAlternativePreloader
42
+ })
38
43
  }];
39
44
  },
40
45
 
@@ -234,6 +234,7 @@ export class EmbedCardComponent extends React.PureComponent {
234
234
  const lineLength = this.getLineLength(view, pos, widthStateLineLength);
235
235
  const containerWidth = isRichMediaInsideOfBlockNode(view, pos) ? lineLength : widthStateWidth;
236
236
  const smartCard = /*#__PURE__*/React.createElement(SmartCard, {
237
+ key: url,
237
238
  url: url,
238
239
  appearance: "embed",
239
240
  onClick: this.onClick,
@@ -8,12 +8,19 @@ 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 const createPlugin = (platform, allowResizing, useAlternativePreloader, fullWidthMode, createAnalyticsEvent) => ({
11
+ export const createPlugin = options => ({
12
12
  portalProviderAPI,
13
13
  eventDispatcher,
14
14
  providerFactory,
15
15
  dispatchAnalyticsEvent
16
16
  }) => {
17
+ const {
18
+ platform,
19
+ allowResizing,
20
+ useAlternativePreloader,
21
+ fullWidthMode,
22
+ createAnalyticsEvent
23
+ } = options;
17
24
  return new Plugin({
18
25
  state: {
19
26
  init() {
@@ -73,7 +80,7 @@ export const createPlugin = (platform, allowResizing, useAlternativePreloader, f
73
80
  * By using this approach, the browser is free to schedule the resolution of the promises below in between rendering/network/
74
81
  * other tasks as per common implementations of the JavaScript event loop in browsers.
75
82
  */
76
- const invoke = rafSchedule(() => resolveWithProvider(view, outstandingRequests, provider, request));
83
+ const invoke = rafSchedule(() => resolveWithProvider(view, outstandingRequests, provider, request, options));
77
84
  rafCancellationCallbacks.push(invoke.cancel);
78
85
  invoke();
79
86
  });
@@ -1,20 +1,27 @@
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 const resolveWithProvider = (view, outstandingRequests, provider, request) => {
8
+ export const resolveWithProvider = (view, outstandingRequests, provider, request, options) => {
9
9
  const handleResolve = provider.resolve(request.url, request.appearance).then(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
- const handleResolved = (view, request) => resolvedCard => {
17
+ const 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
+ const handleResolved = (view, request, options) => resolvedCard => {
24
+ updateCardType(resolvedCard, options);
18
25
  replaceQueuedUrlWithCard(request.url, resolvedCard, request.analyticsAction)(view.state, view.dispatch);
19
26
  return resolvedCard;
20
27
  };
@@ -41,7 +41,7 @@ export const getToolbarConfig = (allowCopyToClipboard = false) => (state, {
41
41
  alias: lang.alias
42
42
  })); // If language is not undefined search for it in the value and then search in the aliases
43
43
 
44
- const defaultValue = language ? options.find(option => option.value === language) || options.find(option => option.alias.includes(language)) : undefined;
44
+ const defaultValue = language ? options.find(option => option.value === language) || options.find(option => option.alias.includes(language)) : null;
45
45
  const languageSelect = {
46
46
  id: 'editor.codeBlock.languageOptions',
47
47
  type: 'select',
@@ -12,10 +12,6 @@ const toAvatar = participant => ({
12
12
  })
13
13
  });
14
14
 
15
- const participantEquals = ([aRaw], [bRaw]) => {
16
- const a = aRaw;
17
- const b = bRaw;
15
+ export default memoizeOne(toAvatar, function participantEquals([a], [b]) {
18
16
  return a.name === b.name && a.avatar === b.avatar && a.sessionId === b.sessionId;
19
- };
20
-
21
- export default memoizeOne(toAvatar, participantEquals);
17
+ });
@@ -5,6 +5,8 @@ import { EmojiSharedCssClassName } from '@atlaskit/editor-common';
5
5
  import { SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
6
6
  export const emojiStyles = css`
7
7
  .${EmojiSharedCssClassName.EMOJI_CONTAINER} {
8
+ display: inline-block;
9
+
8
10
  .${EmojiSharedCssClassName.EMOJI_NODE} {
9
11
  cursor: pointer;
10
12
 
@@ -97,7 +97,6 @@ export const createContextIdentifierProviderHandler = view => async (name, provi
97
97
 
98
98
  const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, useLongPressSelection = false, options = {}) => {
99
99
  const state = createPluginState(dispatch, {
100
- layout: 'default',
101
100
  showEditButton: false,
102
101
  showContextPanel: false
103
102
  });
@@ -155,14 +154,12 @@ const createPlugin = (dispatch, providerFactory, extensionHandlers, portalProvid
155
154
  const showEditButton = shouldShowEditButton(extensionHandler, extensionProvider);
156
155
  const updateExtension = getUpdateExtensionPromise(view, extensionHandler, extensionProvider).catch(() => {// do nothing;
157
156
  });
158
- const layout = selectedExtension ? node.attrs.layout : 'default';
159
157
  updateState({
160
158
  localId: node.attrs.localId,
161
159
  showContextPanel: false,
162
160
  element: newElement,
163
161
  showEditButton,
164
- updateExtension,
165
- layout
162
+ updateExtension
166
163
  })(state, dispatch);
167
164
  } // New DOM element doesn't necessarily mean it's a new Node
168
165
  else if (element !== newElement) {
@@ -41,30 +41,35 @@ const isLayoutSupported = (state, selectedExtNode) => {
41
41
  return !!((selectedExtNode.node.type === bodiedExtension || selectedExtNode.node.type === extension && !hasParentNodeOfType([bodiedExtension, table, expand].filter(Boolean))(selection)) && !hasParentNodeOfType([layoutSection])(selection));
42
42
  };
43
43
 
44
- const breakoutOptions = (state, formatMessage, extensionState, breakoutEnabled) => {
45
- const nodeWithPos = getSelectedExtension(state, true);
46
- const {
47
- layout
48
- } = extensionState;
49
- return nodeWithPos && breakoutEnabled && isLayoutSupported(state, nodeWithPos) ? [{
50
- type: 'button',
51
- icon: CenterIcon,
52
- onClick: updateExtensionLayout('default'),
53
- selected: layout === 'default',
54
- title: formatMessage(commonMessages.layoutFixedWidth)
55
- }, {
56
- type: 'button',
57
- icon: WideIcon,
58
- onClick: updateExtensionLayout('wide'),
59
- selected: layout === 'wide',
60
- title: formatMessage(commonMessages.layoutWide)
61
- }, {
62
- type: 'button',
63
- icon: FullWidthIcon,
64
- onClick: updateExtensionLayout('full-width'),
65
- selected: layout === 'full-width',
66
- title: formatMessage(commonMessages.layoutFullWidth)
67
- }] : [];
44
+ const breakoutOptions = (state, formatMessage, breakoutEnabled) => {
45
+ const nodeWithPos = getSelectedExtension(state, true); // we should only return breakout options when breakouts are enabled and the node supports them
46
+
47
+ if (nodeWithPos && breakoutEnabled && isLayoutSupported(state, nodeWithPos)) {
48
+ const {
49
+ layout
50
+ } = nodeWithPos.node.attrs;
51
+ return [{
52
+ type: 'button',
53
+ icon: CenterIcon,
54
+ onClick: updateExtensionLayout('default'),
55
+ selected: layout === 'default',
56
+ title: formatMessage(commonMessages.layoutFixedWidth)
57
+ }, {
58
+ type: 'button',
59
+ icon: WideIcon,
60
+ onClick: updateExtensionLayout('wide'),
61
+ selected: layout === 'wide',
62
+ title: formatMessage(commonMessages.layoutWide)
63
+ }, {
64
+ type: 'button',
65
+ icon: FullWidthIcon,
66
+ onClick: updateExtensionLayout('full-width'),
67
+ selected: layout === 'full-width',
68
+ title: formatMessage(commonMessages.layoutFullWidth)
69
+ }];
70
+ }
71
+
72
+ return [];
68
73
  };
69
74
 
70
75
  const editButton = (formatMessage, extensionState) => {
@@ -99,7 +104,7 @@ export const getToolbarConfig = (breakoutEnabled = true) => (state, intl) => {
99
104
  if (extensionState && !extensionState.showContextPanel && extensionState.element) {
100
105
  const nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension];
101
106
  const editButtonArray = editButton(formatMessage, extensionState);
102
- const breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled);
107
+ const breakoutButtonArray = breakoutOptions(state, formatMessage, breakoutEnabled);
103
108
  return {
104
109
  title: 'Extension floating controls',
105
110
  getDomRef: () => extensionState.element.parentElement || undefined,
@@ -1,13 +1,15 @@
1
1
  import { normalizeFeatureFlags } from '@atlaskit/editor-common/normalize-feature-flags';
2
-
2
+ import { browser } from '@atlaskit/editor-common';
3
3
  /**
4
4
  * Transforms EditorProps to an FeatureFlags object,
5
5
  * which is used by both current and archv3 editors.
6
6
  */
7
+
7
8
  export function createFeatureFlagsFromProps(props) {
8
- 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;
9
+ 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;
9
10
 
10
- return { ...normalizeFeatureFlags(props.featureFlags),
11
+ const normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
12
+ return { ...normalizedFeatureFlags,
11
13
  newInsertionBehaviour: props.allowNewInsertionBehaviour,
12
14
  interactiveExpand: typeof props.allowExpand === 'boolean' ? props.allowExpand : Boolean(props.allowExpand && props.allowExpand.allowInteractiveExpand !== false),
13
15
  placeholderBracketHint: !!props.placeholderBracketHint,
@@ -32,6 +34,8 @@ export function createFeatureFlagsFromProps(props) {
32
34
  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),
33
35
  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),
34
36
  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),
35
- 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)
37
+ 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),
38
+ 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),
39
+ codeBlockSyntaxHighlighting: Boolean(typeof normalizedFeatureFlags.codeBlockSyntaxHighlighting === 'boolean' ? !!normalizedFeatureFlags.codeBlockSyntaxHighlighting && !browser.safari : false)
36
40
  };
37
41
  }
@@ -71,12 +71,17 @@ class Find extends React.Component {
71
71
  }
72
72
  });
73
73
 
74
- _defineProperty(this, "handleFindChange", event => this.skipWhileComposing(() => {
74
+ _defineProperty(this, "handleFindChange", event => {
75
75
  this.updateFindValue(event.target.value);
76
- }));
76
+ });
77
77
 
78
78
  _defineProperty(this, "updateFindValue", value => {
79
- this.props.onFind(value);
79
+ this.setState({
80
+ localFindText: value
81
+ });
82
+ this.skipWhileComposing(() => {
83
+ this.props.onFind(value);
84
+ });
80
85
  });
81
86
 
82
87
  _defineProperty(this, "handleFindKeyDown", event => this.skipWhileComposing(() => {
@@ -153,7 +158,13 @@ class Find extends React.Component {
153
158
  });
154
159
  this.closeIcon = /*#__PURE__*/React.createElement(EditorCloseIcon, {
155
160
  label: this.closeFindReplaceDialog
156
- });
161
+ }); // We locally manage the value of the input inside this component in order to support compositions.
162
+ // This requires some additional work inside componentDidUpdate to ensure we support changes that
163
+ // occur to this value which do not originate from this component.
164
+
165
+ this.state = {
166
+ localFindText: this.props.findText || ''
167
+ };
157
168
  }
158
169
 
159
170
  componentDidMount() {
@@ -162,7 +173,17 @@ class Find extends React.Component {
162
173
  }
163
174
 
164
175
  componentDidUpdate() {
165
- this.focusFindTextfield();
176
+ this.focusFindTextfield(); // If the external prop findText changes and we aren't in a composition we should update to the
177
+ // use the external prop value.
178
+ //
179
+ // An example of where this may happen is when a find occurs through the user selecting some text
180
+ // and pressing Mod-f.
181
+
182
+ if (!this.isComposing && this.props.findText !== this.state.localFindText) {
183
+ this.setState({
184
+ localFindText: this.props.findText || ''
185
+ });
186
+ }
166
187
  }
167
188
 
168
189
  render() {
@@ -183,7 +204,7 @@ class Find extends React.Component {
183
204
  name: "find",
184
205
  appearance: "none",
185
206
  placeholder: this.find,
186
- value: findText,
207
+ value: this.state.localFindText,
187
208
  ref: this.findTextfieldRef,
188
209
  autoComplete: "off",
189
210
  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';
@@ -83,7 +83,8 @@ const mapActivityProviderResultToLinkSearchItemData = ({
83
83
  container,
84
84
  iconUrl,
85
85
  url,
86
- lastViewedDate: viewedTimestamp ? new Date(viewedTimestamp) : undefined
86
+ lastViewedDate: viewedTimestamp ? new Date(viewedTimestamp) : undefined,
87
+ prefetch: true
87
88
  });
88
89
 
89
90
  const mapSearchProviderResultToLinkSearchItemData = ({
@@ -99,7 +100,8 @@ const mapSearchProviderResultToLinkSearchItemData = ({
99
100
  name: title,
100
101
  url,
101
102
  lastUpdatedDate: updatedTimestamp ? new Date(updatedTimestamp) : undefined,
102
- icon: contentType && mapContentTypeToIcon[contentType] || defaultIcon
103
+ icon: contentType && mapContentTypeToIcon[contentType] || defaultIcon,
104
+ prefetch: false
103
105
  });
104
106
 
105
107
  export class HyperlinkLinkAddToolbar extends PureComponent {
@@ -344,7 +346,7 @@ export class HyperlinkLinkAddToolbar extends PureComponent {
344
346
  }
345
347
 
346
348
  if (interaction === 'click' || this.isUrlPopulatedWithSelectedItem()) {
347
- var _pluginState$searchSe3;
349
+ var _pluginState$searchSe3, _selectedItem$prefetc;
348
350
 
349
351
  /**
350
352
  * When it's a mouse click even or the selectedItem.url matches displayUrl, we think
@@ -361,7 +363,8 @@ export class HyperlinkLinkAddToolbar extends PureComponent {
361
363
  trigger: interaction,
362
364
  resultCount: items.length,
363
365
  selectedResultId: selectedItem.objectId,
364
- selectedRelativePosition: selectedIndex
366
+ selectedRelativePosition: selectedIndex,
367
+ prefetch: (_selectedItem$prefetc = selectedItem.prefetch) !== null && _selectedItem$prefetc !== void 0 ? _selectedItem$prefetc : false
365
368
  },
366
369
  eventType: EVENT_TYPE.UI
367
370
  });
@@ -1,26 +1,5 @@
1
- import LinkifyIt from 'linkify-it';
2
1
  import { mapSlice } from '../../utils/slice';
3
- import { isSafeUrl } from '@atlaskit/adf-schema';
4
- export const LINK_REGEXP = /(https?|ftp):\/\/[^\s]+/;
5
- const linkify = LinkifyIt();
6
- linkify.add('sourcetree:', 'http:');
7
- const tlds = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
8
- const 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]';
9
- tlds.push(tlds2Char);
10
- linkify.tlds(tlds, false);
11
- export function getLinkMatch(str) {
12
- if (!str) {
13
- return null;
14
- }
15
-
16
- let match = linkifyMatch(str);
17
-
18
- if (!match.length) {
19
- match = linkify.match(str);
20
- }
21
-
22
- return match && match[0];
23
- }
2
+ import { isSafeUrl, linkify, normalizeUrl as normaliseLinkHref } from '@atlaskit/adf-schema';
24
3
  /**
25
4
  * Instance of class LinkMatcher are used in autoformatting in place of Regex.
26
5
  * Hence it has been made similar to regex with an exec method.
@@ -81,8 +60,7 @@ export function normalizeUrl(url) {
81
60
  return url;
82
61
  }
83
62
 
84
- const match = getLinkMatch(url);
85
- return match && match.url || '';
63
+ return normaliseLinkHref(url);
86
64
  }
87
65
  export function linkifyContent(schema) {
88
66
  return slice => mapSlice(slice, (node, parent) => {
@@ -148,38 +126,4 @@ function findLinkMatches(text) {
148
126
  }
149
127
 
150
128
  return matches;
151
- }
152
-
153
- export const linkifyMatch = text => {
154
- const matches = [];
155
-
156
- if (!LINK_REGEXP.test(text)) {
157
- return matches;
158
- }
159
-
160
- let startpos = 0;
161
- let substr;
162
-
163
- while (substr = text.substr(startpos)) {
164
- const link = (substr.match(LINK_REGEXP) || [''])[0];
165
-
166
- if (link) {
167
- const index = substr.search(LINK_REGEXP);
168
- const start = index >= 0 ? index + startpos : index;
169
- const end = start + link.length;
170
- matches.push({
171
- index: start,
172
- lastIndex: end,
173
- raw: link,
174
- url: link,
175
- text: link,
176
- schema: ''
177
- });
178
- startpos += end;
179
- } else {
180
- break;
181
- }
182
- }
183
-
184
- return matches;
185
- };
129
+ }