@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,30 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
3
+ import { codeBidiWarningPluginKey } from '../plugin-key';
4
+ import { createBidiWarningsDecorationSetFromDoc, createPluginState, getPluginState } from './plugin-factory';
5
+ export var createPlugin = function createPlugin(_ref) {
6
+ var dispatch = _ref.dispatch,
7
+ reactContext = _ref.reactContext;
8
+ var intl = reactContext().intl;
9
+ var codeBidiWarningLabel = intl.formatMessage(codeBidiWarningMessages.label);
10
+ return new Plugin({
11
+ key: codeBidiWarningPluginKey,
12
+ state: createPluginState(dispatch, function (state) {
13
+ return {
14
+ decorationSet: createBidiWarningsDecorationSetFromDoc({
15
+ doc: state.doc,
16
+ codeBidiWarningLabel: codeBidiWarningLabel
17
+ }),
18
+ codeBidiWarningLabel: codeBidiWarningLabel
19
+ };
20
+ }),
21
+ props: {
22
+ decorations: function decorations(state) {
23
+ var _getPluginState = getPluginState(state),
24
+ decorationSet = _getPluginState.decorationSet;
25
+
26
+ return decorationSet;
27
+ }
28
+ }
29
+ });
30
+ };
@@ -0,0 +1,96 @@
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
+
7
+ import React from 'react';
8
+ import ReactDOM from 'react-dom';
9
+ import { Decoration, DecorationSet } from 'prosemirror-view';
10
+ import CodeBidiWarning from '@atlaskit/code/bidi-warning';
11
+ import codeBidiWarningDecorator from '@atlaskit/code/bidi-warning-decorator';
12
+ import { pluginFactory } from '../../../utils/plugin-state-factory';
13
+ import { stepHasSlice } from '../../../utils/step';
14
+ import { codeBidiWarningPluginKey } from '../plugin-key';
15
+ import reducer from './reducer';
16
+
17
+ var _pluginFactory = pluginFactory(codeBidiWarningPluginKey, reducer, {
18
+ onDocChanged: function onDocChanged(tr, pluginState) {
19
+ if (!tr.steps.find(stepHasSlice)) {
20
+ return pluginState;
21
+ }
22
+
23
+ var newBidiWarningsDecorationSet = createBidiWarningsDecorationSetFromDoc({
24
+ doc: tr.doc,
25
+ codeBidiWarningLabel: pluginState.codeBidiWarningLabel
26
+ });
27
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
28
+ decorationSet: newBidiWarningsDecorationSet
29
+ });
30
+ }
31
+ }),
32
+ createPluginState = _pluginFactory.createPluginState,
33
+ getPluginState = _pluginFactory.getPluginState;
34
+
35
+ export { createPluginState, getPluginState };
36
+ export function createBidiWarningsDecorationSetFromDoc(_ref) {
37
+ var doc = _ref.doc,
38
+ codeBidiWarningLabel = _ref.codeBidiWarningLabel;
39
+ var bidiCharactersAndTheirPositions = [];
40
+ doc.descendants(function (node, pos) {
41
+ var isTextWithCodeMark = node.type.name === 'text' && node.marks && node.marks.some(function (mark) {
42
+ return mark.type.name === 'code';
43
+ });
44
+
45
+ if (isTextWithCodeMark) {
46
+ codeBidiWarningDecorator(node.textContent, function (_ref2) {
47
+ var bidiCharacter = _ref2.bidiCharacter,
48
+ index = _ref2.index;
49
+ bidiCharactersAndTheirPositions.push({
50
+ position: pos + index,
51
+ bidiCharacter: bidiCharacter
52
+ });
53
+ });
54
+ return false;
55
+ }
56
+
57
+ var isCodeBlock = node.type.name === 'codeBlock';
58
+
59
+ if (isCodeBlock) {
60
+ codeBidiWarningDecorator(node.textContent, function (_ref3) {
61
+ var bidiCharacter = _ref3.bidiCharacter,
62
+ index = _ref3.index;
63
+ bidiCharactersAndTheirPositions.push({
64
+ position: pos + index + 1,
65
+ bidiCharacter: bidiCharacter
66
+ });
67
+ });
68
+ }
69
+ }); // Bidi characters are not expected to commonly appear in code snippets, so recreating the decoration set
70
+ // for documents rather than reusing existing decorations seems a reasonable performance/complexity tradeoff.
71
+
72
+ if (bidiCharactersAndTheirPositions.length === 0) {
73
+ return DecorationSet.empty;
74
+ }
75
+
76
+ var newBidiWarningsDecorationSet = DecorationSet.create(doc, bidiCharactersAndTheirPositions.map(function (_ref4) {
77
+ var position = _ref4.position,
78
+ bidiCharacter = _ref4.bidiCharacter;
79
+ return Decoration.widget(position, function () {
80
+ return renderDOM(bidiCharacter, codeBidiWarningLabel);
81
+ });
82
+ }));
83
+ return newBidiWarningsDecorationSet;
84
+ }
85
+
86
+ function renderDOM(bidiCharacter, codeBidiWarningLabel) {
87
+ var element = document.createElement('span'); // Note: we use this pattern elsewhere (see highlighting code block, and drop cursor widget decoration)
88
+ // we should investigate if there is a memory leak with such usage.
89
+
90
+ ReactDOM.render( /*#__PURE__*/React.createElement(CodeBidiWarning, {
91
+ bidiCharacter: bidiCharacter,
92
+ skipChildren: true,
93
+ label: codeBidiWarningLabel
94
+ }), element);
95
+ return element;
96
+ }
@@ -0,0 +1,3 @@
1
+ export default (function (pluginState, action) {
2
+ return pluginState;
3
+ });
@@ -22,8 +22,12 @@ var codeBlockPlugin = function codeBlockPlugin() {
22
22
  pmPlugins: function pmPlugins() {
23
23
  return [{
24
24
  name: 'codeBlock',
25
- plugin: function plugin() {
26
- return createPlugin(options.useLongPressSelection);
25
+ plugin: function plugin(_ref) {
26
+ var reactContext = _ref.reactContext;
27
+ return createPlugin({
28
+ useLongPressSelection: options.useLongPressSelection,
29
+ reactContext: reactContext
30
+ });
27
31
  }
28
32
  }, {
29
33
  name: 'codeBlockIDEKeyBindings',
@@ -32,8 +36,8 @@ var codeBlockPlugin = function codeBlockPlugin() {
32
36
  }
33
37
  }, {
34
38
  name: 'codeBlockKeyMap',
35
- plugin: function plugin(_ref) {
36
- var schema = _ref.schema;
39
+ plugin: function plugin(_ref2) {
40
+ var schema = _ref2.schema;
37
41
  return keymap(schema);
38
42
  }
39
43
  }];
@@ -44,8 +48,8 @@ var codeBlockPlugin = function codeBlockPlugin() {
44
48
  refreshBrowserSelectionOnChange(props.originalTransaction, props.newEditorState);
45
49
  },
46
50
  pluginsOptions: {
47
- quickInsert: function quickInsert(_ref2) {
48
- var formatMessage = _ref2.formatMessage;
51
+ quickInsert: function quickInsert(_ref3) {
52
+ var formatMessage = _ref3.formatMessage;
49
53
  return [{
50
54
  id: 'codeblock',
51
55
  title: formatMessage(messages.codeblock),
@@ -32,7 +32,7 @@ var toDOM = function toDOM(node) {
32
32
  };
33
33
 
34
34
  export var CodeBlockView = /*#__PURE__*/function () {
35
- function CodeBlockView(_node, view, getPos) {
35
+ function CodeBlockView(_node, view, getPos, codeBidiWarningOptions) {
36
36
  var _this = this;
37
37
 
38
38
  _classCallCheck(this, CodeBlockView);
@@ -66,6 +66,7 @@ export var CodeBlockView = /*#__PURE__*/function () {
66
66
  dom = _DOMSerializer$render.dom,
67
67
  contentDOM = _DOMSerializer$render.contentDOM;
68
68
 
69
+ this.codeBidiWarningOptions = codeBidiWarningOptions;
69
70
  this.getPos = getPos;
70
71
  this.view = view;
71
72
  this.node = _node;
@@ -118,7 +119,9 @@ export var CodeBlockView = /*#__PURE__*/function () {
118
119
  ReactDOM.render( /*#__PURE__*/React.createElement(CodeBlock, {
119
120
  text: node.textContent,
120
121
  language: node.attrs.language,
121
- showLineNumbers: false
122
+ showLineNumbers: false,
123
+ codeBidiWarnings: this.codeBidiWarningOptions.enabled,
124
+ codeBidiWarningLabel: this.codeBidiWarningOptions.label
122
125
  }), highlighting);
123
126
  this.measure(performance.now() - start);
124
127
  content === null || content === void 0 ? void 0 : content.setAttribute('data-debounce', 'false');
@@ -151,14 +154,22 @@ export var CodeBlockView = /*#__PURE__*/function () {
151
154
  value: function ignoreMutation(record) {
152
155
  var _this$highlighting$co, _this$highlighting;
153
156
 
154
- 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);
157
+ var lineNumberChanges = record.target === this.lineNumberGutter || record.target.parentNode === this.lineNumberGutter;
158
+ var 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;
159
+ var codeBidiWarningDecorationChanges = record.type === 'attributes' && record.attributeName === 'aria-describedby';
160
+ return lineNumberChanges || outsideTheCodeBlockChanges || codeBidiWarningDecorationChanges;
155
161
  }
156
162
  }]);
157
163
 
158
164
  return CodeBlockView;
159
165
  }();
160
- export var highlightingCodeBlockNodeView = function highlightingCodeBlockNodeView() {
166
+ export var highlightingCodeBlockNodeView = function highlightingCodeBlockNodeView(_ref) {
167
+ var codeBidiWarnings = _ref.codeBidiWarnings,
168
+ codeBidiWarningLabel = _ref.codeBidiWarningLabel;
161
169
  return function (node, view, getPos) {
162
- return new CodeBlockView(node, view, getPos);
170
+ return new CodeBlockView(node, view, getPos, {
171
+ enabled: codeBidiWarnings,
172
+ label: codeBidiWarningLabel
173
+ });
163
174
  };
164
175
  };
@@ -5,6 +5,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
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
7
  import { Plugin, NodeSelection } from 'prosemirror-state';
8
+ import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
8
9
  import { codeBlockNodeView } from '../nodeviews/code-block';
9
10
  import { highlightingCodeBlockNodeView } from '../nodeviews/highlighting-code-block';
10
11
  import { createSelectionClickHandler } from '../../selection/utils';
@@ -13,8 +14,12 @@ import { ACTIONS } from './actions';
13
14
  import { findCodeBlock } from '../utils';
14
15
  import { codeBlockClassNames } from '../ui/class-names';
15
16
  import { getFeatureFlags } from '../../feature-flags-context';
16
- export var createPlugin = function createPlugin() {
17
- var useLongPressSelection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
17
+ export var createPlugin = function createPlugin(_ref) {
18
+ var _ref$useLongPressSele = _ref.useLongPressSelection,
19
+ useLongPressSelection = _ref$useLongPressSele === void 0 ? false : _ref$useLongPressSele,
20
+ reactContext = _ref.reactContext;
21
+ var intl = reactContext().intl;
22
+ var codeBidiWarningLabel = intl.formatMessage(codeBidiWarningMessages.label);
18
23
  return new Plugin({
19
24
  state: {
20
25
  init: function init(_, state) {
@@ -53,7 +58,10 @@ export var createPlugin = function createPlugin() {
53
58
  nodeViews: {
54
59
  codeBlock: function codeBlock(node, view, getPos) {
55
60
  var featureFlags = getFeatureFlags(view.state);
56
- var createCodeBlockNodeView = featureFlags !== null && featureFlags !== void 0 && featureFlags.codeBlockSyntaxHighlighting ? highlightingCodeBlockNodeView() : codeBlockNodeView();
61
+ var createCodeBlockNodeView = featureFlags !== null && featureFlags !== void 0 && featureFlags.codeBlockSyntaxHighlighting ? highlightingCodeBlockNodeView({
62
+ codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
63
+ codeBidiWarningLabel: codeBidiWarningLabel
64
+ }) : codeBlockNodeView();
57
65
  return createCodeBlockNodeView(node, view, getPos);
58
66
  }
59
67
  },
@@ -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',
@@ -15,16 +15,12 @@ var toAvatar = function toAvatar(participant) {
15
15
  };
16
16
  };
17
17
 
18
- var participantEquals = function participantEquals(_ref, _ref2) {
18
+ export default memoizeOne(toAvatar, function participantEquals(_ref, _ref2) {
19
19
  var _ref3 = _slicedToArray(_ref, 1),
20
- aRaw = _ref3[0];
20
+ a = _ref3[0];
21
21
 
22
22
  var _ref4 = _slicedToArray(_ref2, 1),
23
- bRaw = _ref4[0];
23
+ b = _ref4[0];
24
24
 
25
- var a = aRaw;
26
- var b = bRaw;
27
25
  return a.name === b.name && a.avatar === b.avatar && a.sessionId === b.sessionId;
28
- };
29
-
30
- export default memoizeOne(toAvatar, participantEquals);
26
+ });
@@ -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, _props$featureFlags28, _props$featureFlags29;
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,9 @@ 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),
47
+ 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)
43
48
  });
44
49
  }
@@ -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
+ }
@@ -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';