@atlaskit/editor-core 150.0.1 → 151.1.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 (248) hide show
  1. package/CHANGELOG.md +69 -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 +8 -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-bidi-warning/index.js +25 -0
  17. package/dist/cjs/plugins/code-bidi-warning/plugin-key.js +11 -0
  18. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/main.js +43 -0
  19. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +118 -0
  20. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/reducer.js +12 -0
  21. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/types.js +5 -0
  22. package/dist/cjs/plugins/code-block/index.js +10 -6
  23. package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +16 -5
  24. package/dist/cjs/plugins/code-block/pm-plugins/main.js +12 -3
  25. package/dist/cjs/plugins/code-block/toolbar.js +1 -1
  26. package/dist/cjs/plugins/collab-edit/ui/to-avatar.js +4 -8
  27. package/dist/cjs/plugins/emoji/styles.js +1 -1
  28. package/dist/cjs/plugins/extension/pm-plugins/main.js +1 -4
  29. package/dist/cjs/plugins/extension/toolbar.js +28 -23
  30. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +9 -3
  31. package/dist/cjs/plugins/find-replace/ui/Find.js +27 -7
  32. package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +3 -3
  33. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  34. package/dist/cjs/plugins/hyperlink/utils.js +6 -69
  35. package/dist/cjs/plugins/index.js +8 -0
  36. package/dist/cjs/plugins/media/index.js +14 -3
  37. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +24 -10
  38. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +179 -0
  39. package/dist/cjs/plugins/media/pm-plugins/main.js +18 -9
  40. package/dist/cjs/plugins/media/toolbar/index.js +49 -17
  41. package/dist/cjs/plugins/media/toolbar/utils.js +20 -2
  42. package/dist/cjs/plugins/media/utils/media-files.js +67 -1
  43. package/dist/cjs/plugins/mentions/type-ahead/index.js +39 -3
  44. package/dist/cjs/plugins/panel/index.js +2 -3
  45. package/dist/cjs/plugins/panel/message.js +47 -0
  46. package/dist/cjs/plugins/panel/toolbar.js +64 -84
  47. package/dist/cjs/plugins/panel/utils.js +2 -2
  48. package/dist/cjs/plugins/paste/linkify-md-plugin.js +3 -3
  49. package/dist/cjs/plugins/rank.js +1 -1
  50. package/dist/cjs/plugins/status/styles.js +1 -1
  51. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  52. package/dist/cjs/profiler/render-count.js +82 -0
  53. package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -5
  54. package/dist/cjs/utils/react-hooks/use-component-renderer-tracking/index.js +55 -19
  55. package/dist/cjs/version-wrapper.js +1 -1
  56. package/dist/cjs/version.json +1 -1
  57. package/dist/es2019/actions/index.js +6 -28
  58. package/dist/es2019/create-editor/ErrorBoundary.js +73 -60
  59. package/dist/es2019/create-editor/ReactEditorView.js +130 -23
  60. package/dist/es2019/create-editor/create-plugins-list.js +9 -3
  61. package/dist/es2019/editor.js +74 -35
  62. package/dist/es2019/labs/next/presets/cxhtml.js +2 -1
  63. package/dist/es2019/plugins/analytics/types/enums.js +3 -1
  64. package/dist/es2019/plugins/base/index.js +4 -3
  65. package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +63 -35
  66. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +2 -1
  67. package/dist/es2019/plugins/card/index.js +7 -2
  68. package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -0
  69. package/dist/es2019/plugins/card/pm-plugins/main.js +9 -2
  70. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +12 -5
  71. package/dist/es2019/plugins/code-bidi-warning/index.js +15 -0
  72. package/dist/es2019/plugins/code-bidi-warning/plugin-key.js +2 -0
  73. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/main.js +31 -0
  74. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +88 -0
  75. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
  76. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
  77. package/dist/es2019/plugins/code-block/index.js +6 -1
  78. package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +16 -4
  79. package/dist/es2019/plugins/code-block/pm-plugins/main.js +50 -39
  80. package/dist/es2019/plugins/code-block/toolbar.js +1 -1
  81. package/dist/es2019/plugins/collab-edit/ui/to-avatar.js +2 -6
  82. package/dist/es2019/plugins/emoji/styles.js +2 -0
  83. package/dist/es2019/plugins/extension/pm-plugins/main.js +1 -4
  84. package/dist/es2019/plugins/extension/toolbar.js +30 -25
  85. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +9 -4
  86. package/dist/es2019/plugins/find-replace/ui/Find.js +27 -6
  87. package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  88. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  89. package/dist/es2019/plugins/hyperlink/utils.js +3 -59
  90. package/dist/es2019/plugins/index.js +2 -1
  91. package/dist/es2019/plugins/media/index.js +13 -4
  92. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +16 -7
  93. package/dist/es2019/plugins/media/nodeviews/mediaInline.js +88 -0
  94. package/dist/es2019/plugins/media/pm-plugins/main.js +20 -11
  95. package/dist/es2019/plugins/media/toolbar/index.js +44 -15
  96. package/dist/es2019/plugins/media/toolbar/utils.js +16 -0
  97. package/dist/es2019/plugins/media/utils/media-files.js +68 -2
  98. package/dist/es2019/plugins/mentions/type-ahead/index.js +21 -2
  99. package/dist/es2019/plugins/panel/index.js +3 -4
  100. package/dist/es2019/plugins/panel/message.js +38 -0
  101. package/dist/es2019/plugins/panel/toolbar.js +52 -71
  102. package/dist/es2019/plugins/panel/utils.js +2 -2
  103. package/dist/es2019/plugins/paste/linkify-md-plugin.js +2 -2
  104. package/dist/es2019/plugins/rank.js +1 -1
  105. package/dist/es2019/plugins/status/styles.js +2 -0
  106. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  107. package/dist/es2019/profiler/render-count.js +60 -0
  108. package/dist/es2019/ui/Appearance/Comment/Comment.js +4 -2
  109. package/dist/es2019/utils/react-hooks/use-component-renderer-tracking/index.js +51 -18
  110. package/dist/es2019/version-wrapper.js +1 -1
  111. package/dist/es2019/version.json +1 -1
  112. package/dist/esm/actions/index.js +6 -24
  113. package/dist/esm/create-editor/ErrorBoundary.js +113 -78
  114. package/dist/esm/create-editor/ReactEditorView.js +146 -31
  115. package/dist/esm/create-editor/create-plugins-list.js +9 -3
  116. package/dist/esm/editor.js +100 -40
  117. package/dist/esm/labs/next/presets/cxhtml.js +2 -1
  118. package/dist/esm/plugins/analytics/types/enums.js +3 -1
  119. package/dist/esm/plugins/base/index.js +4 -3
  120. package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +64 -36
  121. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
  122. package/dist/esm/plugins/card/index.js +13 -2
  123. package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -0
  124. package/dist/esm/plugins/card/pm-plugins/main.js +7 -2
  125. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +12 -5
  126. package/dist/esm/plugins/code-bidi-warning/index.js +17 -0
  127. package/dist/esm/plugins/code-bidi-warning/plugin-key.js +2 -0
  128. package/dist/esm/plugins/code-bidi-warning/pm-plugins/main.js +30 -0
  129. package/dist/esm/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +96 -0
  130. package/dist/esm/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
  131. package/dist/esm/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
  132. package/dist/esm/plugins/code-block/index.js +10 -6
  133. package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +16 -5
  134. package/dist/esm/plugins/code-block/pm-plugins/main.js +11 -3
  135. package/dist/esm/plugins/code-block/toolbar.js +1 -1
  136. package/dist/esm/plugins/collab-edit/ui/to-avatar.js +4 -8
  137. package/dist/esm/plugins/emoji/styles.js +1 -1
  138. package/dist/esm/plugins/extension/pm-plugins/main.js +1 -4
  139. package/dist/esm/plugins/extension/toolbar.js +28 -23
  140. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +9 -4
  141. package/dist/esm/plugins/find-replace/ui/Find.js +27 -7
  142. package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  143. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  144. package/dist/esm/plugins/hyperlink/utils.js +3 -59
  145. package/dist/esm/plugins/index.js +2 -1
  146. package/dist/esm/plugins/media/index.js +14 -4
  147. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -10
  148. package/dist/esm/plugins/media/nodeviews/mediaInline.js +147 -0
  149. package/dist/esm/plugins/media/pm-plugins/main.js +19 -11
  150. package/dist/esm/plugins/media/toolbar/index.js +47 -19
  151. package/dist/esm/plugins/media/toolbar/utils.js +15 -1
  152. package/dist/esm/plugins/media/utils/media-files.js +60 -2
  153. package/dist/esm/plugins/mentions/type-ahead/index.js +39 -3
  154. package/dist/esm/plugins/panel/index.js +3 -4
  155. package/dist/esm/plugins/panel/message.js +38 -0
  156. package/dist/esm/plugins/panel/toolbar.js +57 -77
  157. package/dist/esm/plugins/panel/utils.js +2 -2
  158. package/dist/esm/plugins/paste/linkify-md-plugin.js +2 -2
  159. package/dist/esm/plugins/rank.js +1 -1
  160. package/dist/esm/plugins/status/styles.js +1 -1
  161. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  162. package/dist/esm/profiler/render-count.js +57 -0
  163. package/dist/esm/ui/Appearance/Comment/Comment.js +6 -5
  164. package/dist/esm/utils/react-hooks/use-component-renderer-tracking/index.js +53 -20
  165. package/dist/esm/version-wrapper.js +1 -1
  166. package/dist/esm/version.json +1 -1
  167. package/dist/types/create-editor/ErrorBoundary.d.ts +6 -6
  168. package/dist/types/create-editor/ReactEditorView.d.ts +15 -3
  169. package/dist/types/editor.d.ts +3 -1
  170. package/dist/types/plugins/analytics/analytics-queue.d.ts +1 -1
  171. package/dist/types/plugins/analytics/index.d.ts +1 -1
  172. package/dist/types/plugins/analytics/types/enums.d.ts +4 -2
  173. package/dist/types/plugins/analytics/types/events.d.ts +7 -2
  174. package/dist/types/plugins/analytics/types/general-events.d.ts +4 -1
  175. package/dist/types/plugins/analytics/types/index.d.ts +1 -1
  176. package/dist/types/plugins/analytics/types/insert-events.d.ts +6 -1
  177. package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
  178. package/dist/types/plugins/base/index.d.ts +1 -0
  179. package/dist/types/plugins/base/pm-plugins/frozen-editor.d.ts +3 -2
  180. package/dist/types/plugins/card/pm-plugins/main.d.ts +2 -3
  181. package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
  182. package/dist/types/plugins/card/types.d.ts +6 -0
  183. package/dist/types/plugins/code-bidi-warning/index.d.ts +3 -0
  184. package/dist/types/plugins/code-bidi-warning/plugin-key.d.ts +2 -0
  185. package/dist/types/plugins/code-bidi-warning/pm-plugins/main.d.ts +3 -0
  186. package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +7 -0
  187. package/dist/types/plugins/code-bidi-warning/pm-plugins/reducer.d.ts +3 -0
  188. package/dist/types/plugins/code-bidi-warning/pm-plugins/types.d.ts +5 -0
  189. package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +11 -2
  190. package/dist/types/plugins/code-block/pm-plugins/main.d.ts +5 -1
  191. package/dist/types/plugins/collab-edit/ui/to-avatar.d.ts +1 -1
  192. package/dist/types/plugins/extension/types.d.ts +0 -2
  193. package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -2
  194. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
  195. package/dist/types/plugins/floating-toolbar/types.d.ts +1 -1
  196. package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -1
  197. package/dist/types/plugins/hyperlink/utils.d.ts +0 -21
  198. package/dist/types/plugins/index.d.ts +1 -0
  199. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
  200. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +27 -0
  201. package/dist/types/plugins/media/pm-plugins/main.d.ts +2 -2
  202. package/dist/types/plugins/media/toolbar/utils.d.ts +2 -0
  203. package/dist/types/plugins/media/utils/media-files.d.ts +8 -0
  204. package/dist/types/plugins/panel/message.d.ts +37 -0
  205. package/dist/types/plugins/panel/toolbar.d.ts +4 -37
  206. package/dist/types/plugins/panel/types.d.ts +1 -0
  207. package/dist/types/plugins/quick-insert/index.d.ts +1 -1
  208. package/dist/types/profiler/render-count.d.ts +14 -0
  209. package/dist/types/types/feature-flags.d.ts +17 -0
  210. package/dist/types/ui/LinkSearch/types.d.ts +1 -0
  211. package/dist/types/utils/react-hooks/use-component-renderer-tracking/index.d.ts +17 -1
  212. package/package.json +22 -19
  213. package/dist/cjs/plugins/caption/nodeviews/index.test.js +0 -135
  214. package/dist/cjs/plugins/caption/pm-plugins/keymap.test.js +0 -203
  215. package/dist/cjs/plugins/caption/pm-plugins/main.test.js +0 -141
  216. package/dist/cjs/plugins/code-block/language-list.test.js +0 -74
  217. package/dist/cjs/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -101
  218. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -98
  219. package/dist/cjs/plugins/media/commands/captions.test.js +0 -149
  220. package/dist/cjs/plugins/media/commands/linking.test.js +0 -296
  221. package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -50
  222. package/dist/cjs/plugins/panel/toolbar.test.js +0 -250
  223. package/dist/cjs/ui/ColorPickerButton/index.test.js +0 -123
  224. package/dist/cjs/ui/PortalProvider/index.test.js +0 -139
  225. package/dist/es2019/plugins/caption/nodeviews/index.test.js +0 -122
  226. package/dist/es2019/plugins/caption/pm-plugins/keymap.test.js +0 -193
  227. package/dist/es2019/plugins/caption/pm-plugins/main.test.js +0 -132
  228. package/dist/es2019/plugins/code-block/language-list.test.js +0 -69
  229. package/dist/es2019/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -83
  230. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  231. package/dist/es2019/plugins/media/commands/captions.test.js +0 -126
  232. package/dist/es2019/plugins/media/commands/linking.test.js +0 -208
  233. package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  234. package/dist/es2019/plugins/panel/toolbar.test.js +0 -200
  235. package/dist/es2019/ui/ColorPickerButton/index.test.js +0 -88
  236. package/dist/es2019/ui/PortalProvider/index.test.js +0 -115
  237. package/dist/esm/plugins/caption/nodeviews/index.test.js +0 -125
  238. package/dist/esm/plugins/caption/pm-plugins/keymap.test.js +0 -195
  239. package/dist/esm/plugins/caption/pm-plugins/main.test.js +0 -124
  240. package/dist/esm/plugins/code-block/language-list.test.js +0 -71
  241. package/dist/esm/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -92
  242. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  243. package/dist/esm/plugins/media/commands/captions.test.js +0 -135
  244. package/dist/esm/plugins/media/commands/linking.test.js +0 -268
  245. package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  246. package/dist/esm/plugins/panel/toolbar.test.js +0 -230
  247. package/dist/esm/ui/ColorPickerButton/index.test.js +0 -107
  248. package/dist/esm/ui/PortalProvider/index.test.js +0 -129
@@ -0,0 +1,88 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import { Decoration, DecorationSet } from 'prosemirror-view';
4
+ import CodeBidiWarning from '@atlaskit/code/bidi-warning';
5
+ import codeBidiWarningDecorator from '@atlaskit/code/bidi-warning-decorator';
6
+ import { pluginFactory } from '../../../utils/plugin-state-factory';
7
+ import { stepHasSlice } from '../../../utils/step';
8
+ import { codeBidiWarningPluginKey } from '../plugin-key';
9
+ import reducer from './reducer';
10
+ export const {
11
+ createPluginState,
12
+ getPluginState
13
+ } = pluginFactory(codeBidiWarningPluginKey, reducer, {
14
+ onDocChanged: (tr, pluginState) => {
15
+ if (!tr.steps.find(stepHasSlice)) {
16
+ return pluginState;
17
+ }
18
+
19
+ const newBidiWarningsDecorationSet = createBidiWarningsDecorationSetFromDoc({
20
+ doc: tr.doc,
21
+ codeBidiWarningLabel: pluginState.codeBidiWarningLabel
22
+ });
23
+ return { ...pluginState,
24
+ decorationSet: newBidiWarningsDecorationSet
25
+ };
26
+ }
27
+ });
28
+ export function createBidiWarningsDecorationSetFromDoc({
29
+ doc,
30
+ codeBidiWarningLabel
31
+ }) {
32
+ const bidiCharactersAndTheirPositions = [];
33
+ doc.descendants((node, pos) => {
34
+ const isTextWithCodeMark = node.type.name === 'text' && node.marks && node.marks.some(mark => mark.type.name === 'code');
35
+
36
+ if (isTextWithCodeMark) {
37
+ codeBidiWarningDecorator(node.textContent, ({
38
+ bidiCharacter,
39
+ index
40
+ }) => {
41
+ bidiCharactersAndTheirPositions.push({
42
+ position: pos + index,
43
+ bidiCharacter
44
+ });
45
+ });
46
+ return false;
47
+ }
48
+
49
+ const isCodeBlock = node.type.name === 'codeBlock';
50
+
51
+ if (isCodeBlock) {
52
+ codeBidiWarningDecorator(node.textContent, ({
53
+ bidiCharacter,
54
+ index
55
+ }) => {
56
+ bidiCharactersAndTheirPositions.push({
57
+ position: pos + index + 1,
58
+ bidiCharacter
59
+ });
60
+ });
61
+ }
62
+ }); // Bidi characters are not expected to commonly appear in code snippets, so recreating the decoration set
63
+ // for documents rather than reusing existing decorations seems a reasonable performance/complexity tradeoff.
64
+
65
+ if (bidiCharactersAndTheirPositions.length === 0) {
66
+ return DecorationSet.empty;
67
+ }
68
+
69
+ const newBidiWarningsDecorationSet = DecorationSet.create(doc, bidiCharactersAndTheirPositions.map(({
70
+ position,
71
+ bidiCharacter
72
+ }) => {
73
+ return Decoration.widget(position, () => renderDOM(bidiCharacter, codeBidiWarningLabel));
74
+ }));
75
+ return newBidiWarningsDecorationSet;
76
+ }
77
+
78
+ function renderDOM(bidiCharacter, codeBidiWarningLabel) {
79
+ const element = document.createElement('span'); // Note: we use this pattern elsewhere (see highlighting code block, and drop cursor widget decoration)
80
+ // we should investigate if there is a memory leak with such usage.
81
+
82
+ ReactDOM.render( /*#__PURE__*/React.createElement(CodeBidiWarning, {
83
+ bidiCharacter: bidiCharacter,
84
+ skipChildren: true,
85
+ label: codeBidiWarningLabel
86
+ }), element);
87
+ return element;
88
+ }
@@ -0,0 +1,3 @@
1
+ export default ((pluginState, action) => {
2
+ return pluginState;
3
+ });
@@ -22,7 +22,12 @@ const codeBlockPlugin = (options = {}) => ({
22
22
  pmPlugins() {
23
23
  return [{
24
24
  name: 'codeBlock',
25
- plugin: () => createPlugin(options.useLongPressSelection)
25
+ plugin: ({
26
+ reactContext
27
+ }) => createPlugin({
28
+ useLongPressSelection: options.useLongPressSelection,
29
+ reactContext
30
+ })
26
31
  }, {
27
32
  name: 'codeBlockIDEKeyBindings',
28
33
  plugin: () => ideUX
@@ -28,7 +28,7 @@ const toDOM = node => ['div', {
28
28
  }]]];
29
29
 
30
30
  export class CodeBlockView {
31
- constructor(_node, view, getPos) {
31
+ constructor(_node, view, getPos, codeBidiWarningOptions) {
32
32
  _defineProperty(this, "highlighting", null);
33
33
 
34
34
  _defineProperty(this, "highlighter", null);
@@ -57,6 +57,7 @@ export class CodeBlockView {
57
57
  dom,
58
58
  contentDOM
59
59
  } = DOMSerializer.renderSpec(document, toDOM(_node));
60
+ this.codeBidiWarningOptions = codeBidiWarningOptions;
60
61
  this.getPos = getPos;
61
62
  this.view = view;
62
63
  this.node = _node;
@@ -99,7 +100,9 @@ export class CodeBlockView {
99
100
  ReactDOM.render( /*#__PURE__*/React.createElement(CodeBlock, {
100
101
  text: node.textContent,
101
102
  language: node.attrs.language,
102
- showLineNumbers: false
103
+ showLineNumbers: false,
104
+ codeBidiWarnings: this.codeBidiWarningOptions.enabled,
105
+ codeBidiWarningLabel: this.codeBidiWarningOptions.label
103
106
  }), highlighting);
104
107
  this.measure(performance.now() - start);
105
108
  content === null || content === void 0 ? void 0 : content.setAttribute('data-debounce', 'false');
@@ -130,8 +133,17 @@ export class CodeBlockView {
130
133
  ignoreMutation(record) {
131
134
  var _this$highlighting$co, _this$highlighting;
132
135
 
133
- return record.target === this.lineNumberGutter || record.target.parentNode === this.lineNumberGutter || ((_this$highlighting$co = (_this$highlighting = this.highlighting) === null || _this$highlighting === void 0 ? void 0 : _this$highlighting.contains(record.target)) !== null && _this$highlighting$co !== void 0 ? _this$highlighting$co : false);
136
+ const lineNumberChanges = record.target === this.lineNumberGutter || record.target.parentNode === this.lineNumberGutter;
137
+ const outsideTheCodeBlockChanges = (_this$highlighting$co = (_this$highlighting = this.highlighting) === null || _this$highlighting === void 0 ? void 0 : _this$highlighting.contains(record.target)) !== null && _this$highlighting$co !== void 0 ? _this$highlighting$co : false;
138
+ const codeBidiWarningDecorationChanges = record.type === 'attributes' && record.attributeName === 'aria-describedby';
139
+ return lineNumberChanges || outsideTheCodeBlockChanges || codeBidiWarningDecorationChanges;
134
140
  }
135
141
 
136
142
  }
137
- export const highlightingCodeBlockNodeView = () => (node, view, getPos) => new CodeBlockView(node, view, getPos);
143
+ export const highlightingCodeBlockNodeView = ({
144
+ codeBidiWarnings,
145
+ codeBidiWarningLabel
146
+ }) => (node, view, getPos) => new CodeBlockView(node, view, getPos, {
147
+ enabled: codeBidiWarnings,
148
+ label: codeBidiWarningLabel
149
+ });
@@ -1,4 +1,5 @@
1
1
  import { Plugin, NodeSelection } from 'prosemirror-state';
2
+ import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
2
3
  import { codeBlockNodeView } from '../nodeviews/code-block';
3
4
  import { highlightingCodeBlockNodeView } from '../nodeviews/highlighting-code-block';
4
5
  import { createSelectionClickHandler } from '../../selection/utils';
@@ -7,51 +8,61 @@ import { ACTIONS } from './actions';
7
8
  import { findCodeBlock } from '../utils';
8
9
  import { codeBlockClassNames } from '../ui/class-names';
9
10
  import { getFeatureFlags } from '../../feature-flags-context';
10
- export const createPlugin = (useLongPressSelection = false) => new Plugin({
11
- state: {
12
- init(_, state) {
13
- const node = findCodeBlock(state, state.selection);
14
- return {
15
- pos: node ? node.pos : null,
16
- contentCopied: false,
17
- isNodeSelected: false
18
- };
19
- },
20
-
21
- apply(tr, pluginState, _oldState, newState) {
22
- if (tr.docChanged || tr.selectionSet) {
23
- const node = findCodeBlock(newState, tr.selection);
24
- const newPluginState = { ...pluginState,
11
+ export const createPlugin = ({
12
+ useLongPressSelection = false,
13
+ reactContext
14
+ }) => {
15
+ const intl = reactContext().intl;
16
+ const codeBidiWarningLabel = intl.formatMessage(codeBidiWarningMessages.label);
17
+ return new Plugin({
18
+ state: {
19
+ init(_, state) {
20
+ const node = findCodeBlock(state, state.selection);
21
+ return {
25
22
  pos: node ? node.pos : null,
26
- isNodeSelected: tr.selection instanceof NodeSelection
23
+ contentCopied: false,
24
+ isNodeSelected: false
27
25
  };
28
- return newPluginState;
29
- }
26
+ },
30
27
 
31
- const meta = tr.getMeta(pluginKey);
28
+ apply(tr, pluginState, _oldState, newState) {
29
+ if (tr.docChanged || tr.selectionSet) {
30
+ const node = findCodeBlock(newState, tr.selection);
31
+ const newPluginState = { ...pluginState,
32
+ pos: node ? node.pos : null,
33
+ isNodeSelected: tr.selection instanceof NodeSelection
34
+ };
35
+ return newPluginState;
36
+ }
32
37
 
33
- if ((meta === null || meta === void 0 ? void 0 : meta.type) === ACTIONS.SET_COPIED_TO_CLIPBOARD) {
34
- return { ...pluginState,
35
- contentCopied: meta.data
36
- };
37
- }
38
+ const meta = tr.getMeta(pluginKey);
38
39
 
39
- return pluginState;
40
- }
40
+ if ((meta === null || meta === void 0 ? void 0 : meta.type) === ACTIONS.SET_COPIED_TO_CLIPBOARD) {
41
+ return { ...pluginState,
42
+ contentCopied: meta.data
43
+ };
44
+ }
41
45
 
42
- },
43
- key: pluginKey,
44
- props: {
45
- nodeViews: {
46
- codeBlock(node, view, getPos) {
47
- const featureFlags = getFeatureFlags(view.state);
48
- const createCodeBlockNodeView = featureFlags !== null && featureFlags !== void 0 && featureFlags.codeBlockSyntaxHighlighting ? highlightingCodeBlockNodeView() : codeBlockNodeView();
49
- return createCodeBlockNodeView(node, view, getPos);
46
+ return pluginState;
50
47
  }
51
48
 
52
49
  },
53
- handleClickOn: createSelectionClickHandler(['codeBlock'], target => !!(target.closest(`.${codeBlockClassNames.gutter}`) || target.classList.contains(codeBlockClassNames.content)), {
54
- useLongPressSelection
55
- })
56
- }
57
- });
50
+ key: pluginKey,
51
+ props: {
52
+ nodeViews: {
53
+ codeBlock(node, view, getPos) {
54
+ const featureFlags = getFeatureFlags(view.state);
55
+ const createCodeBlockNodeView = featureFlags !== null && featureFlags !== void 0 && featureFlags.codeBlockSyntaxHighlighting ? highlightingCodeBlockNodeView({
56
+ codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
57
+ codeBidiWarningLabel
58
+ }) : codeBlockNodeView();
59
+ return createCodeBlockNodeView(node, view, getPos);
60
+ }
61
+
62
+ },
63
+ handleClickOn: createSelectionClickHandler(['codeBlock'], target => !!(target.closest(`.${codeBlockClassNames.gutter}`) || target.classList.contains(codeBlockClassNames.content)), {
64
+ useLongPressSelection
65
+ })
66
+ }
67
+ });
68
+ };
@@ -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, _props$featureFlags28, _props$featureFlags29;
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,9 @@ 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),
40
+ codeBidiWarnings: Boolean(typeof ((_props$featureFlags28 = props.featureFlags) === null || _props$featureFlags28 === void 0 ? void 0 : _props$featureFlags28.codeBidiWarnings) === 'boolean' ? !!((_props$featureFlags29 = props.featureFlags) !== null && _props$featureFlags29 !== void 0 && _props$featureFlags29.codeBidiWarnings) : true)
36
41
  };
37
42
  }
@@ -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
+ }
@@ -60,4 +60,5 @@ export { default as mobileSelectionPlugin } from './mobile-selection';
60
60
  export { default as clipboardPlugin } from './clipboard';
61
61
  export { default as undoRedoPlugin } from './undo-redo';
62
62
  export { default as avatarGroupPlugin } from './avatar-group';
63
- export { default as viewUpdateSubscriptionPlugin } from './view-update-subscription';
63
+ export { default as viewUpdateSubscriptionPlugin } from './view-update-subscription';
64
+ export { default as codeBidiWarningPlugin } from './code-bidi-warning';