@atlaskit/editor-core 150.0.3 → 151.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) 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/emoji/styles.js +1 -1
  27. package/dist/cjs/plugins/extension/pm-plugins/main.js +1 -4
  28. package/dist/cjs/plugins/extension/toolbar.js +28 -23
  29. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +9 -3
  30. package/dist/cjs/plugins/find-replace/ui/Find.js +27 -7
  31. package/dist/cjs/plugins/hyperlink/HyperlinkToolbarAppearance.js +2 -2
  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/panel/index.js +2 -3
  44. package/dist/cjs/plugins/panel/message.js +47 -0
  45. package/dist/cjs/plugins/panel/toolbar.js +64 -84
  46. package/dist/cjs/plugins/panel/utils.js +2 -2
  47. package/dist/cjs/plugins/paste/linkify-md-plugin.js +3 -3
  48. package/dist/cjs/plugins/rank.js +1 -1
  49. package/dist/cjs/plugins/status/styles.js +1 -1
  50. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  51. package/dist/cjs/profiler/render-count.js +82 -0
  52. package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -5
  53. package/dist/cjs/utils/react-hooks/use-component-renderer-tracking/index.js +55 -19
  54. package/dist/cjs/version-wrapper.js +1 -1
  55. package/dist/cjs/version.json +1 -1
  56. package/dist/es2019/actions/index.js +6 -28
  57. package/dist/es2019/create-editor/ErrorBoundary.js +73 -60
  58. package/dist/es2019/create-editor/ReactEditorView.js +130 -23
  59. package/dist/es2019/create-editor/create-plugins-list.js +9 -3
  60. package/dist/es2019/editor.js +74 -35
  61. package/dist/es2019/labs/next/presets/cxhtml.js +2 -1
  62. package/dist/es2019/plugins/analytics/types/enums.js +3 -1
  63. package/dist/es2019/plugins/base/index.js +4 -3
  64. package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +63 -35
  65. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +2 -1
  66. package/dist/es2019/plugins/card/index.js +7 -2
  67. package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -0
  68. package/dist/es2019/plugins/card/pm-plugins/main.js +9 -2
  69. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +12 -5
  70. package/dist/es2019/plugins/code-bidi-warning/index.js +15 -0
  71. package/dist/es2019/plugins/code-bidi-warning/plugin-key.js +2 -0
  72. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/main.js +31 -0
  73. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +88 -0
  74. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
  75. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
  76. package/dist/es2019/plugins/code-block/index.js +6 -1
  77. package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +16 -4
  78. package/dist/es2019/plugins/code-block/pm-plugins/main.js +50 -39
  79. package/dist/es2019/plugins/code-block/toolbar.js +1 -1
  80. package/dist/es2019/plugins/emoji/styles.js +2 -0
  81. package/dist/es2019/plugins/extension/pm-plugins/main.js +1 -4
  82. package/dist/es2019/plugins/extension/toolbar.js +30 -25
  83. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +9 -4
  84. package/dist/es2019/plugins/find-replace/ui/Find.js +27 -6
  85. package/dist/es2019/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -1
  86. package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  87. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  88. package/dist/es2019/plugins/hyperlink/utils.js +3 -59
  89. package/dist/es2019/plugins/index.js +2 -1
  90. package/dist/es2019/plugins/media/index.js +13 -4
  91. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +16 -7
  92. package/dist/es2019/plugins/media/nodeviews/mediaInline.js +88 -0
  93. package/dist/es2019/plugins/media/pm-plugins/main.js +20 -11
  94. package/dist/es2019/plugins/media/toolbar/index.js +44 -15
  95. package/dist/es2019/plugins/media/toolbar/utils.js +16 -0
  96. package/dist/es2019/plugins/media/utils/media-files.js +68 -2
  97. package/dist/es2019/plugins/panel/index.js +3 -4
  98. package/dist/es2019/plugins/panel/message.js +38 -0
  99. package/dist/es2019/plugins/panel/toolbar.js +52 -71
  100. package/dist/es2019/plugins/panel/utils.js +2 -2
  101. package/dist/es2019/plugins/paste/linkify-md-plugin.js +2 -2
  102. package/dist/es2019/plugins/rank.js +1 -1
  103. package/dist/es2019/plugins/status/styles.js +5 -0
  104. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  105. package/dist/es2019/profiler/render-count.js +60 -0
  106. package/dist/es2019/ui/Appearance/Comment/Comment.js +4 -2
  107. package/dist/es2019/utils/react-hooks/use-component-renderer-tracking/index.js +51 -18
  108. package/dist/es2019/version-wrapper.js +1 -1
  109. package/dist/es2019/version.json +1 -1
  110. package/dist/esm/actions/index.js +6 -24
  111. package/dist/esm/create-editor/ErrorBoundary.js +113 -78
  112. package/dist/esm/create-editor/ReactEditorView.js +146 -31
  113. package/dist/esm/create-editor/create-plugins-list.js +9 -3
  114. package/dist/esm/editor.js +100 -40
  115. package/dist/esm/labs/next/presets/cxhtml.js +2 -1
  116. package/dist/esm/plugins/analytics/types/enums.js +3 -1
  117. package/dist/esm/plugins/base/index.js +4 -3
  118. package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +64 -36
  119. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
  120. package/dist/esm/plugins/card/index.js +13 -2
  121. package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -0
  122. package/dist/esm/plugins/card/pm-plugins/main.js +7 -2
  123. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +12 -5
  124. package/dist/esm/plugins/code-bidi-warning/index.js +17 -0
  125. package/dist/esm/plugins/code-bidi-warning/plugin-key.js +2 -0
  126. package/dist/esm/plugins/code-bidi-warning/pm-plugins/main.js +30 -0
  127. package/dist/esm/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +96 -0
  128. package/dist/esm/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
  129. package/dist/esm/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
  130. package/dist/esm/plugins/code-block/index.js +10 -6
  131. package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +16 -5
  132. package/dist/esm/plugins/code-block/pm-plugins/main.js +11 -3
  133. package/dist/esm/plugins/code-block/toolbar.js +1 -1
  134. package/dist/esm/plugins/emoji/styles.js +1 -1
  135. package/dist/esm/plugins/extension/pm-plugins/main.js +1 -4
  136. package/dist/esm/plugins/extension/toolbar.js +28 -23
  137. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +9 -4
  138. package/dist/esm/plugins/find-replace/ui/Find.js +27 -7
  139. package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +2 -2
  140. package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  141. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  142. package/dist/esm/plugins/hyperlink/utils.js +3 -59
  143. package/dist/esm/plugins/index.js +2 -1
  144. package/dist/esm/plugins/media/index.js +14 -4
  145. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -10
  146. package/dist/esm/plugins/media/nodeviews/mediaInline.js +147 -0
  147. package/dist/esm/plugins/media/pm-plugins/main.js +19 -11
  148. package/dist/esm/plugins/media/toolbar/index.js +47 -19
  149. package/dist/esm/plugins/media/toolbar/utils.js +15 -1
  150. package/dist/esm/plugins/media/utils/media-files.js +60 -2
  151. package/dist/esm/plugins/panel/index.js +3 -4
  152. package/dist/esm/plugins/panel/message.js +38 -0
  153. package/dist/esm/plugins/panel/toolbar.js +57 -77
  154. package/dist/esm/plugins/panel/utils.js +2 -2
  155. package/dist/esm/plugins/paste/linkify-md-plugin.js +2 -2
  156. package/dist/esm/plugins/rank.js +1 -1
  157. package/dist/esm/plugins/status/styles.js +1 -1
  158. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  159. package/dist/esm/profiler/render-count.js +57 -0
  160. package/dist/esm/ui/Appearance/Comment/Comment.js +6 -5
  161. package/dist/esm/utils/react-hooks/use-component-renderer-tracking/index.js +53 -20
  162. package/dist/esm/version-wrapper.js +1 -1
  163. package/dist/esm/version.json +1 -1
  164. package/dist/types/create-editor/ErrorBoundary.d.ts +6 -6
  165. package/dist/types/create-editor/ReactEditorView.d.ts +15 -3
  166. package/dist/types/editor.d.ts +2 -0
  167. package/dist/types/plugins/analytics/index.d.ts +1 -1
  168. package/dist/types/plugins/analytics/types/enums.d.ts +4 -2
  169. package/dist/types/plugins/analytics/types/events.d.ts +7 -2
  170. package/dist/types/plugins/analytics/types/general-events.d.ts +4 -1
  171. package/dist/types/plugins/analytics/types/index.d.ts +1 -1
  172. package/dist/types/plugins/analytics/types/insert-events.d.ts +6 -1
  173. package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
  174. package/dist/types/plugins/base/index.d.ts +1 -0
  175. package/dist/types/plugins/base/pm-plugins/frozen-editor.d.ts +3 -2
  176. package/dist/types/plugins/card/pm-plugins/main.d.ts +2 -3
  177. package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
  178. package/dist/types/plugins/card/types.d.ts +6 -0
  179. package/dist/types/plugins/code-bidi-warning/index.d.ts +3 -0
  180. package/dist/types/plugins/code-bidi-warning/plugin-key.d.ts +2 -0
  181. package/dist/types/plugins/code-bidi-warning/pm-plugins/main.d.ts +3 -0
  182. package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +7 -0
  183. package/dist/types/plugins/code-bidi-warning/pm-plugins/reducer.d.ts +3 -0
  184. package/dist/types/plugins/code-bidi-warning/pm-plugins/types.d.ts +5 -0
  185. package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +11 -2
  186. package/dist/types/plugins/code-block/pm-plugins/main.d.ts +5 -1
  187. package/dist/types/plugins/extension/types.d.ts +0 -2
  188. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
  189. package/dist/types/plugins/floating-toolbar/types.d.ts +1 -1
  190. package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -1
  191. package/dist/types/plugins/hyperlink/HyperlinkToolbarAppearance.d.ts +1 -1
  192. package/dist/types/plugins/hyperlink/utils.d.ts +0 -21
  193. package/dist/types/plugins/index.d.ts +1 -0
  194. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +27 -0
  195. package/dist/types/plugins/media/pm-plugins/main.d.ts +2 -2
  196. package/dist/types/plugins/media/toolbar/utils.d.ts +2 -0
  197. package/dist/types/plugins/media/utils/media-files.d.ts +8 -0
  198. package/dist/types/plugins/panel/message.d.ts +37 -0
  199. package/dist/types/plugins/panel/toolbar.d.ts +4 -37
  200. package/dist/types/plugins/panel/types.d.ts +1 -0
  201. package/dist/types/profiler/render-count.d.ts +14 -0
  202. package/dist/types/types/feature-flags.d.ts +17 -0
  203. package/dist/types/ui/LinkSearch/types.d.ts +1 -0
  204. package/dist/types/utils/react-hooks/use-component-renderer-tracking/index.d.ts +17 -1
  205. package/package.json +21 -18
  206. package/dist/cjs/plugins/caption/nodeviews/index.test.js +0 -135
  207. package/dist/cjs/plugins/caption/pm-plugins/keymap.test.js +0 -203
  208. package/dist/cjs/plugins/caption/pm-plugins/main.test.js +0 -141
  209. package/dist/cjs/plugins/code-block/language-list.test.js +0 -74
  210. package/dist/cjs/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -101
  211. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -98
  212. package/dist/cjs/plugins/media/commands/captions.test.js +0 -149
  213. package/dist/cjs/plugins/media/commands/linking.test.js +0 -296
  214. package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -50
  215. package/dist/cjs/plugins/panel/toolbar.test.js +0 -250
  216. package/dist/cjs/ui/ColorPickerButton/index.test.js +0 -123
  217. package/dist/cjs/ui/PortalProvider/index.test.js +0 -139
  218. package/dist/es2019/plugins/caption/nodeviews/index.test.js +0 -122
  219. package/dist/es2019/plugins/caption/pm-plugins/keymap.test.js +0 -193
  220. package/dist/es2019/plugins/caption/pm-plugins/main.test.js +0 -132
  221. package/dist/es2019/plugins/code-block/language-list.test.js +0 -69
  222. package/dist/es2019/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -83
  223. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  224. package/dist/es2019/plugins/media/commands/captions.test.js +0 -126
  225. package/dist/es2019/plugins/media/commands/linking.test.js +0 -208
  226. package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  227. package/dist/es2019/plugins/panel/toolbar.test.js +0 -200
  228. package/dist/es2019/ui/ColorPickerButton/index.test.js +0 -88
  229. package/dist/es2019/ui/PortalProvider/index.test.js +0 -115
  230. package/dist/esm/plugins/caption/nodeviews/index.test.js +0 -125
  231. package/dist/esm/plugins/caption/pm-plugins/keymap.test.js +0 -195
  232. package/dist/esm/plugins/caption/pm-plugins/main.test.js +0 -124
  233. package/dist/esm/plugins/code-block/language-list.test.js +0 -71
  234. package/dist/esm/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -92
  235. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  236. package/dist/esm/plugins/media/commands/captions.test.js +0 -135
  237. package/dist/esm/plugins/media/commands/linking.test.js +0 -268
  238. package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  239. package/dist/esm/plugins/panel/toolbar.test.js +0 -230
  240. package/dist/esm/ui/ColorPickerButton/index.test.js +0 -107
  241. package/dist/esm/ui/PortalProvider/index.test.js +0 -129
@@ -5,9 +5,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.getToolbarConfig = exports.getToolbarItems = exports.messages = void 0;
8
+ exports.getToolbarConfig = exports.getToolbarItems = exports.panelIconMap = void 0;
9
9
 
10
- var _reactIntl = require("react-intl");
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
12
  var _success = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/success"));
13
13
 
@@ -43,81 +43,53 @@ var _adfSchema = require("@atlaskit/adf-schema");
43
43
 
44
44
  var _analytics = require("../analytics");
45
45
 
46
- var messages = (0, _reactIntl.defineMessages)({
47
- info: {
48
- id: 'fabric.editor.info',
49
- defaultMessage: 'Info',
50
- description: 'Panels provide a way to highlight text. The info panel has a blue background.'
51
- },
52
- note: {
53
- id: 'fabric.editor.note',
54
- defaultMessage: 'Note',
55
- description: 'Panels provide a way to highlight text. The note panel has a purple background.'
56
- },
57
- success: {
58
- id: 'fabric.editor.success',
59
- defaultMessage: 'Success',
60
- description: 'Panels provide a way to highlight text. The success panel has a green background.'
61
- },
62
- warning: {
63
- id: 'fabric.editor.warning',
64
- defaultMessage: 'Warning',
65
- description: 'Panels provide a way to highlight text. The warning panel has a yellow background.'
66
- },
67
- error: {
68
- id: 'fabric.editor.error',
69
- defaultMessage: 'Error',
70
- description: 'Panels provide a way to highlight text. The error panel has a red background.'
71
- },
72
- emoji: {
73
- id: 'fabric.editor.panel.emoji',
74
- defaultMessage: 'Add emoji',
75
- description: 'Select the panel icon'
76
- },
77
- backgroundColor: {
78
- id: 'fabric.editor.panel.backgroundColor',
79
- defaultMessage: 'Background color',
80
- description: 'Select the panel background color.'
81
- }
82
- });
83
- exports.messages = messages;
46
+ var _message = require("./message");
47
+
48
+ var _panelIconMap;
49
+
50
+ 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; }
51
+
52
+ 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) { (0, _defineProperty2.default)(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; }
84
53
 
85
- var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, providerFactory, activePanelType, activePanelColor, activePanelIcon) {
54
+ var panelIconMap = (_panelIconMap = {}, (0, _defineProperty2.default)(_panelIconMap, _adfSchema.PanelType.INFO, ':info:'), (0, _defineProperty2.default)(_panelIconMap, _adfSchema.PanelType.NOTE, ':note:'), (0, _defineProperty2.default)(_panelIconMap, _adfSchema.PanelType.WARNING, ':warning:'), (0, _defineProperty2.default)(_panelIconMap, _adfSchema.PanelType.ERROR, ':error:'), (0, _defineProperty2.default)(_panelIconMap, _adfSchema.PanelType.SUCCESS, ':success:'), (0, _defineProperty2.default)(_panelIconMap, _adfSchema.PanelType.TIP, ':tip:'), _panelIconMap);
55
+ exports.panelIconMap = panelIconMap;
56
+
57
+ var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, activePanelType, activePanelColor, activePanelIcon) {
86
58
  var items = [{
87
59
  id: 'editor.panel.info',
88
60
  type: 'button',
89
61
  icon: _info.default,
90
62
  onClick: (0, _actions.changePanelType)(_adfSchema.PanelType.INFO),
91
63
  selected: activePanelType === _adfSchema.PanelType.INFO,
92
- title: formatMessage(messages.info)
64
+ title: formatMessage(_message.messages.info)
93
65
  }, {
94
66
  id: 'editor.panel.note',
95
67
  type: 'button',
96
68
  icon: _note.default,
97
69
  onClick: (0, _actions.changePanelType)(_adfSchema.PanelType.NOTE),
98
70
  selected: activePanelType === _adfSchema.PanelType.NOTE,
99
- title: formatMessage(messages.note)
71
+ title: formatMessage(_message.messages.note)
100
72
  }, {
101
73
  id: 'editor.panel.success',
102
74
  type: 'button',
103
75
  icon: _success.default,
104
76
  onClick: (0, _actions.changePanelType)(_adfSchema.PanelType.SUCCESS),
105
77
  selected: activePanelType === _adfSchema.PanelType.SUCCESS,
106
- title: formatMessage(messages.success)
78
+ title: formatMessage(_message.messages.success)
107
79
  }, {
108
80
  id: 'editor.panel.warning',
109
81
  type: 'button',
110
82
  icon: _warning.default,
111
83
  onClick: (0, _actions.changePanelType)(_adfSchema.PanelType.WARNING),
112
84
  selected: activePanelType === _adfSchema.PanelType.WARNING,
113
- title: formatMessage(messages.warning)
85
+ title: formatMessage(_message.messages.warning)
114
86
  }, {
115
87
  id: 'editor.panel.error',
116
88
  type: 'button',
117
89
  icon: _error.default,
118
90
  onClick: (0, _actions.changePanelType)(_adfSchema.PanelType.ERROR),
119
91
  selected: activePanelType === _adfSchema.PanelType.ERROR,
120
- title: formatMessage(messages.error)
92
+ title: formatMessage(_message.messages.error)
121
93
  }];
122
94
 
123
95
  if (isCustomPanelEnabled) {
@@ -130,11 +102,16 @@ var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isC
130
102
  }
131
103
 
132
104
  var previousColor = panelNode.node.attrs.panelColor || (0, _editorCommon.getPanelTypeBackground)(panelNode.node.attrs.panelType);
105
+ var emojiInfo = panelNode.node.attrs.panelType;
106
+ var panelInfo = panelIconMap[emojiInfo];
107
+ var previousEmoji = panelInfo ? {
108
+ emoji: panelInfo
109
+ } : {};
133
110
 
134
111
  if (previousColor === color) {
135
- (0, _actions.changePanelType)(_adfSchema.PanelType.CUSTOM, {
112
+ (0, _actions.changePanelType)(_adfSchema.PanelType.CUSTOM, _objectSpread({
136
113
  color: color
137
- }, isCustomPanelEnabled)(state, dispatch);
114
+ }, previousEmoji), isCustomPanelEnabled)(state, dispatch);
138
115
  return false;
139
116
  }
140
117
 
@@ -148,9 +125,9 @@ var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isC
148
125
  },
149
126
  eventType: _analytics.EVENT_TYPE.TRACK
150
127
  };
151
- (0, _analytics.withAnalytics)(payload)((0, _actions.changePanelType)(_adfSchema.PanelType.CUSTOM, {
128
+ (0, _analytics.withAnalytics)(payload)((0, _actions.changePanelType)(_adfSchema.PanelType.CUSTOM, _objectSpread({
152
129
  color: color
153
- }, isCustomPanelEnabled))(state, dispatch);
130
+ }, previousEmoji), isCustomPanelEnabled))(state, dispatch);
154
131
  return false;
155
132
  };
156
133
  };
@@ -225,39 +202,42 @@ var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isC
225
202
  value: panelColor,
226
203
  border: _Palettes.DEFAULT_BORDER_COLOR
227
204
  };
228
- var colorPicker = {
229
- id: 'editor.panel.colorPicker',
230
- title: formatMessage(messages.backgroundColor),
231
- type: 'select',
232
- selectType: 'color',
233
- defaultValue: defaultPalette,
234
- options: _panelBackgroundPalette.panelBackgroundPalette,
235
- onChange: function onChange(option) {
236
- return changeColor(option.value);
237
- }
238
- };
239
- var emojiPicker = {
240
- id: 'editor.panel.emojiPicker',
241
- title: formatMessage(messages.emoji),
242
- type: 'select',
243
- selectType: 'emoji',
244
- options: [],
245
- selected: activePanelType === _adfSchema.PanelType.CUSTOM && !!activePanelIcon,
246
- onChange: function onChange(emojiShortName) {
247
- return changeEmoji(emojiShortName);
248
- }
249
- };
250
- var removeEmojiButton = {
251
- id: 'editor.panel.removeEmoji',
252
- type: 'button',
253
- icon: _EditorRemoveEmojiIcon.default,
254
- onClick: removeEmoji(),
255
- title: formatMessage(_messages.default.removeEmoji),
256
- disabled: activePanelIcon ? false : true
257
- };
258
- items.push(emojiPicker, removeEmojiButton, {
259
- type: 'separator'
260
- }, colorPicker);
205
+
206
+ if (isCustomPanelEditable) {
207
+ var colorPicker = {
208
+ id: 'editor.panel.colorPicker',
209
+ title: formatMessage(_message.messages.backgroundColor),
210
+ type: 'select',
211
+ selectType: 'color',
212
+ defaultValue: defaultPalette,
213
+ options: _panelBackgroundPalette.panelBackgroundPalette,
214
+ onChange: function onChange(option) {
215
+ return changeColor(option.value);
216
+ }
217
+ };
218
+ var emojiPicker = {
219
+ id: 'editor.panel.emojiPicker',
220
+ title: formatMessage(_message.messages.emoji),
221
+ type: 'select',
222
+ selectType: 'emoji',
223
+ options: [],
224
+ selected: activePanelType === _adfSchema.PanelType.CUSTOM && !!activePanelIcon,
225
+ onChange: function onChange(emojiShortName) {
226
+ return changeEmoji(emojiShortName);
227
+ }
228
+ };
229
+ var removeEmojiButton = {
230
+ id: 'editor.panel.removeEmoji',
231
+ type: 'button',
232
+ icon: _EditorRemoveEmojiIcon.default,
233
+ onClick: removeEmoji(),
234
+ title: formatMessage(_messages.default.removeEmoji),
235
+ disabled: activePanelIcon ? false : true
236
+ };
237
+ items.push(emojiPicker, removeEmojiButton, {
238
+ type: 'separator'
239
+ }, colorPicker);
240
+ }
261
241
  }
262
242
 
263
243
  items.push({
@@ -292,7 +272,7 @@ var getToolbarConfig = function getToolbarConfig(state, intl) {
292
272
  panelColor = _panelObject$node$att.panelColor,
293
273
  panelIcon = _panelObject$node$att.panelIcon; // force toolbar to be turned on
294
274
 
295
- var items = getToolbarItems(formatMessage, nodeType, options.UNSAFE_allowCustomPanel || false, providerFactory, panelType, options.UNSAFE_allowCustomPanel ? panelColor : undefined, options.UNSAFE_allowCustomPanel ? panelIcon : undefined);
275
+ var items = getToolbarItems(formatMessage, nodeType, options.UNSAFE_allowCustomPanel || false, options.UNSAFE_allowCustomPanel && options.UNSAFE_allowCustomPanelEdit || false, providerFactory, panelType, options.UNSAFE_allowCustomPanel ? panelColor : undefined, options.UNSAFE_allowCustomPanel ? panelIcon : undefined);
296
276
 
297
277
  var getDomRef = function getDomRef(editorView) {
298
278
  var domAtPos = editorView.domAtPos.bind(editorView);
@@ -30,7 +30,7 @@ var panelAttrsToDom = function panelAttrsToDom(attrs, allowCustomPanel) {
30
30
  'data-panel-type': panelType || _adfSchema.PanelType.INFO,
31
31
  style: style
32
32
  };
33
- var iconSpan = ['span', {
33
+ var iconDiv = ['div', {
34
34
  class: _editorCommon.PanelSharedCssClassName.icon
35
35
  }];
36
36
  var contentDiv = ['div', {
@@ -38,7 +38,7 @@ var panelAttrsToDom = function panelAttrsToDom(attrs, allowCustomPanel) {
38
38
  }, 0];
39
39
 
40
40
  if (hasIcon) {
41
- return ['div', panelAttrs, iconSpan, contentDiv];
41
+ return ['div', panelAttrs, iconDiv, contentDiv];
42
42
  } else {
43
43
  return ['div', panelAttrs, contentDiv];
44
44
  }
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
- var _linkifyIt = _interopRequireDefault(require("linkify-it"));
10
+ var _adfSchema = require("@atlaskit/adf-schema");
11
11
 
12
- var _utils = require("../hyperlink/utils");
12
+ var _linkifyIt = _interopRequireDefault(require("linkify-it"));
13
13
 
14
14
  // modified version of the original Linkify plugin
15
15
  // https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js
@@ -68,7 +68,7 @@ var linkify = function linkify(state) {
68
68
 
69
69
  if (currentToken.type === 'text' && linkify.test(currentToken.content)) {
70
70
  var text = currentToken.content;
71
- var links = (0, _utils.linkifyMatch)(text);
71
+ var links = (0, _adfSchema.linkifyMatch)(text);
72
72
 
73
73
  if (!links.length) {
74
74
  links = linkify.match(text) || [];
@@ -12,7 +12,7 @@ var _default = {
12
12
  // https://product-fabric.atlassian.net/wiki/spaces/E/pages/1113098008/Selection+Guide#Special-Cases
13
13
  'expandKeymap', 'tableSelectionKeymap', 'tableKeymap', 'captionKeymap', // selection keymap needs to be above gap cursor keymap so it can set node selections from
14
14
  // left/right arrows
15
- 'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaKeymap', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription'],
15
+ 'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaKeymap', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'inlineCode'],
16
16
  nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'rule', 'panel', 'mention', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'unsupportedBlock', 'unsupportedInline', 'confluenceJiraIssue', 'hardBreak', 'emoji', 'placeholder', 'mediaSingle', 'mediaGroup', 'table', 'expand', 'nestedExpand', 'media', 'tableHeader', 'decisionList', 'tableRow', 'decisionItem', 'tableCell', 'taskList', 'taskItem', 'extension', 'bodiedExtension', 'inlineExtension', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard'],
17
17
  marks: [// Inline marks
18
18
  'link', 'em', 'strong', 'textColor', 'strike', 'subsup', 'underline', 'code', 'typeAheadQuery', // Block marks
@@ -17,5 +17,5 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
17
17
 
18
18
  var _templateObject;
19
19
 
20
- var statusStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n > span {\n display: inline-block;\n cursor: pointer;\n line-height: 0; /* Prevent responsive layouts increasing height of container. */\n }\n\n &.", "\n .", "\n > span {\n ", "\n }\n }\n\n .danger {\n .", " > span {\n background-color: ", ";\n }\n\n .", ".", "\n .", "\n > span {\n box-shadow: 0 0 0 ", "px ", ";\n }\n }\n"])), _editorCommon.StatusSharedCssClassName.STATUS_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, _editorCommon.StatusSharedCssClassName.STATUS_LOZENGE, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorCommon.StatusSharedCssClassName.STATUS_LOZENGE, _editorSharedStyles.akEditorDeleteBackgroundWithOpacity, _editorCommon.StatusSharedCssClassName.STATUS_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, _editorCommon.StatusSharedCssClassName.STATUS_LOZENGE, _editorSharedStyles.akEditorSelectedBorderSize, _editorSharedStyles.akEditorDeleteBorder);
20
+ var statusStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n // these two styles can be removed when displayInlineBlockForInlineNodes is enabled by default\n // as it will make all inline nodes inline-block by default\n display: inline-block;\n user-select: all;\n\n > span {\n display: inline-block;\n cursor: pointer;\n line-height: 0; /* Prevent responsive layouts increasing height of container. */\n }\n\n &.", "\n .", "\n > span {\n ", "\n }\n }\n\n .danger {\n .", " > span {\n background-color: ", ";\n }\n\n .", ".", "\n .", "\n > span {\n box-shadow: 0 0 0 ", "px ", ";\n }\n }\n"])), _editorCommon.StatusSharedCssClassName.STATUS_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, _editorCommon.StatusSharedCssClassName.STATUS_LOZENGE, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorCommon.StatusSharedCssClassName.STATUS_LOZENGE, _editorSharedStyles.akEditorDeleteBackgroundWithOpacity, _editorCommon.StatusSharedCssClassName.STATUS_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, _editorCommon.StatusSharedCssClassName.STATUS_LOZENGE, _editorSharedStyles.akEditorSelectedBorderSize, _editorSharedStyles.akEditorDeleteBorder);
21
21
  exports.statusStyles = statusStyles;
@@ -498,10 +498,26 @@ var TableRowNodeView = /*#__PURE__*/function () {
498
498
  * so it should be safe to ignore mutations that we cause
499
499
  * by updating styles and classnames on this DOM element
500
500
  *
501
- * Update: should allow mutations for row selection to avoid known issue with table selection highlight in firefox
501
+ * Update: should not ignore mutations for row selection to avoid known issue with table selection highlight in firefox
502
502
  * Related bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1289673
503
503
  * */
504
- return !(mutationRecord.type === 'selection' && mutationRecord.target.tagName === 'TR');
504
+ var isTableSelection = mutationRecord.type === 'selection' && mutationRecord.target.nodeName === 'TR';
505
+ /**
506
+ * Update: should not ignore mutations when an node is added, as this interferes with
507
+ * prosemirrors handling of some language inputs in Safari (ie. Pinyin, Hiragana).
508
+ *
509
+ * In paticular, when a composition occurs at the start of the first node inside a table cell, if the resulting mutation
510
+ * from the composition end is ignored than prosemirror will end up with; invalid table markup nesting and a misplaced
511
+ * selection and insertion.
512
+ */
513
+
514
+ var isNodeInsertion = mutationRecord.type === 'childList' && mutationRecord.target.nodeName === 'TR' && mutationRecord.addedNodes.length;
515
+
516
+ if (isTableSelection || isNodeInsertion) {
517
+ return false;
518
+ }
519
+
520
+ return true;
505
521
  }
506
522
  /* receive external events */
507
523
 
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.RenderCountProfiler = exports.ProfiledComponentIds = void 0;
11
+
12
+ var _react = _interopRequireWildcard(require("react"));
13
+
14
+ var _uuid = _interopRequireDefault(require("uuid"));
15
+
16
+ var _useComponentRendererTracking = require("../utils/react-hooks/use-component-renderer-tracking");
17
+
18
+ var _editorCommon = require("@atlaskit/editor-common");
19
+
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+
22
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+
24
+ var ProfiledComponentIds;
25
+ exports.ProfiledComponentIds = ProfiledComponentIds;
26
+
27
+ (function (ProfiledComponentIds) {
28
+ ProfiledComponentIds["editor"] = "Editor";
29
+ ProfiledComponentIds["appearance"] = "FullPageEditor";
30
+ ProfiledComponentIds["reactEditorView"] = "ReactEditorView";
31
+ ProfiledComponentIds["contentArea"] = "FullPageContentArea";
32
+ ProfiledComponentIds["toolbar"] = "FullPageToolbar";
33
+ ProfiledComponentIds["mention"] = "MentionNodeView";
34
+ })(ProfiledComponentIds || (exports.ProfiledComponentIds = ProfiledComponentIds = {}));
35
+
36
+ var CoreRenderCountProfiler = function CoreRenderCountProfiler(_ref) {
37
+ var componentId = _ref.componentId;
38
+
39
+ var _useRef = (0, _react.useRef)((0, _uuid.default)()),
40
+ instanceId = _useRef.current;
41
+
42
+ var onRender = function onRender(_ref2) {
43
+ var renderCount = _ref2.renderCount;
44
+
45
+ var profiler = _editorCommon.RenderCountProfiler.getInstance({
46
+ store: window
47
+ });
48
+
49
+ profiler.setRenderCount({
50
+ componentId: componentId,
51
+ instanceId: instanceId,
52
+ renderCount: renderCount
53
+ });
54
+ };
55
+
56
+ (0, _useComponentRendererTracking.useComponentRenderTracking)({
57
+ onRender: onRender,
58
+ propsDiffingOptions: {
59
+ enabled: false
60
+ },
61
+ zeroBasedCount: false
62
+ });
63
+ return null;
64
+ };
65
+
66
+ var RenderCountProfiler = function RenderCountProfiler(_ref3) {
67
+ var componentId = _ref3.componentId;
68
+
69
+ var profiler = _editorCommon.RenderCountProfiler.getInstance({
70
+ store: window
71
+ });
72
+
73
+ if (profiler.isEnabled()) {
74
+ return /*#__PURE__*/_react.default.createElement(CoreRenderCountProfiler, {
75
+ componentId: componentId
76
+ });
77
+ }
78
+
79
+ return null;
80
+ };
81
+
82
+ exports.RenderCountProfiler = RenderCountProfiler;
@@ -78,12 +78,12 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
78
78
  var CommentEditorMargin = 14;
79
79
  var CommentEditorSmallerMargin = 8;
80
80
 
81
- var CommentEditor = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n\n .less-margin .ProseMirror {\n margin: 12px ", "px ", "px;\n }\n\n min-width: 272px;\n /* Border + Toolbar + Footer + (Paragraph + ((Parahraph + Margin) * (DefaultLines - 1)) */\n /* calc(2px + 40px + 24px + ( 20px + (32px * 2))) */\n min-height: 150px;\n height: auto;\n ", " background-color: white;\n border: 1px solid ", ";\n box-sizing: border-box;\n border-radius: ", "px;\n\n max-width: inherit;\n word-wrap: break-word;\n"])), CommentEditorSmallerMargin, CommentEditorSmallerMargin, function (props) {
82
- return props.maxHeight ? 'max-height: ' + props.maxHeight + 'px;' : '';
83
- }, _colors.N40, (0, _constants.borderRadius)());
81
+ var CommentEditor = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n\n .less-margin .ProseMirror {\n margin: 12px ", "px ", "px;\n }\n\n min-width: 272px;\n /* Border + Toolbar + Footer + (Paragraph + ((Parahraph + Margin) * (DefaultLines - 1)) */\n /* calc(2px + 40px + 24px + ( 20px + (32px * 2))) */\n min-height: 150px;\n height: auto;\n background-color: white;\n border: 1px solid ", ";\n box-sizing: border-box;\n border-radius: ", "px;\n\n max-width: inherit;\n word-wrap: break-word;\n"])), CommentEditorSmallerMargin, CommentEditorSmallerMargin, _colors.N40, (0, _constants.borderRadius)());
84
82
 
85
83
  CommentEditor.displayName = 'CommentEditor';
86
- var ContentArea = (0, _styledComponents.default)(_ContentStyles.default)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n flex-grow: 1;\n overflow-x: hidden;\n overflow-y: auto;\n line-height: 24px;\n\n /** Hack for Bitbucket to ensure entire editorView gets drop event; see ED-3294 **/\n /** Hack for tables controlls. Otherwise marging collapse and controlls are misplaced. **/\n .ProseMirror {\n margin: 12px ", "px ", "px;\n }\n\n .gridParent {\n margin-left: ", "px;\n margin-right: ", "px;\n width: calc(100% + ", "px);\n }\n\n padding: ", "px;\n\n ", ";\n"])), CommentEditorMargin, CommentEditorMargin, CommentEditorMargin - _grid.GRID_GUTTER, CommentEditorMargin - _grid.GRID_GUTTER, CommentEditorMargin - _grid.GRID_GUTTER, _Toolbar2.TableControlsPadding, _commonStyles.tableCommentEditorStyles);
84
+ var ContentArea = (0, _styledComponents.default)(_ContentStyles.default)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n flex-grow: 1;\n overflow-x: hidden;\n overflow-y: auto;\n line-height: 24px;\n ", ";\n\n /** Hack for Bitbucket to ensure entire editorView gets drop event; see ED-3294 **/\n /** Hack for tables controlls. Otherwise marging collapse and controlls are misplaced. **/\n .ProseMirror {\n margin: 12px ", "px ", "px;\n }\n\n .gridParent {\n margin-left: ", "px;\n margin-right: ", "px;\n width: calc(100% + ", "px);\n }\n\n padding: ", "px;\n\n ", ";\n"])), function (props) {
85
+ return props.maxHeight ? 'max-height: ' + props.maxHeight + 'px;' : '';
86
+ }, CommentEditorMargin, CommentEditorMargin, CommentEditorMargin - _grid.GRID_GUTTER, CommentEditorMargin - _grid.GRID_GUTTER, CommentEditorMargin - _grid.GRID_GUTTER, _Toolbar2.TableControlsPadding, _commonStyles.tableCommentEditorStyles);
87
87
  ContentArea.displayName = 'ContentArea';
88
88
 
89
89
  var SecondaryToolbar = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n box-sizing: border-box;\n justify-content: flex-end;\n align-items: center;\n display: flex;\n padding: 12px 1px;\n"])));
@@ -173,7 +173,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
173
173
  },
174
174
  className: (0, _classnames.default)('ak-editor-content-area', {
175
175
  'less-margin': width < _editorSharedStyles.akEditorMobileBreakoutPoint
176
- })
176
+ }),
177
+ maxHeight: maxHeight
177
178
  }, customContentComponents, /*#__PURE__*/_react.default.createElement(_PluginSlot.default, {
178
179
  editorView: editorView,
179
180
  editorActions: editorActions,
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -8,40 +10,74 @@ exports.RenderTracking = RenderTracking;
8
10
 
9
11
  var _react = require("react");
10
12
 
13
+ var _debounce = _interopRequireDefault(require("lodash/debounce"));
14
+
11
15
  var _compare = require("../../compare");
12
16
 
13
17
  var _analytics = require("../../../plugins/analytics");
14
18
 
15
- function useComponentRenderTracking(props, action, actionSubject, handleAnalyticsEvent) {
16
- var propsToIgnore = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
17
- var useShallow = arguments.length > 5 ? arguments[5] : undefined;
19
+ function useComponentRenderTracking(_ref) {
20
+ var onRender = _ref.onRender,
21
+ propsDiffingOptions = _ref.propsDiffingOptions,
22
+ _ref$zeroBasedCount = _ref.zeroBasedCount,
23
+ zeroBasedCount = _ref$zeroBasedCount === void 0 ? true : _ref$zeroBasedCount;
18
24
  var propsRef = (0, _react.useRef)();
19
- var renderCountRef = (0, _react.useRef)(0);
25
+ var renderCountRef = (0, _react.useRef)(zeroBasedCount ? 0 : 1);
20
26
  (0, _react.useEffect)(function () {
21
27
  var lastProps = propsRef.current;
22
28
  var renderCount = renderCountRef.current;
29
+ var propsDifference;
23
30
 
24
- if (lastProps) {
25
- var difference = useShallow ? (0, _compare.getShallowPropsDifference)(lastProps, props) : (0, _compare.getPropsDifference)(lastProps, props, 0, 2, propsToIgnore);
26
- handleAnalyticsEvent({
27
- payload: {
28
- action: action,
29
- actionSubject: actionSubject,
30
- attributes: {
31
- propsDifference: difference,
32
- count: renderCount
33
- },
34
- eventType: _analytics.EVENT_TYPE.OPERATIONAL
35
- }
36
- });
31
+ if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled && lastProps) {
32
+ propsDifference = propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.useShallow ? (0, _compare.getShallowPropsDifference)(lastProps, propsDiffingOptions.props) : (0, _compare.getPropsDifference)(lastProps, propsDiffingOptions.props, 0, 2, propsDiffingOptions === null || propsDiffingOptions === void 0 ? void 0 : propsDiffingOptions.propsToIgnore);
33
+ }
34
+
35
+ var result = {
36
+ renderCount: renderCount,
37
+ propsDifference: propsDifference
38
+ };
39
+ onRender(result);
40
+
41
+ if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled) {
42
+ propsRef.current = propsDiffingOptions.props;
37
43
  }
38
44
 
39
- propsRef.current = props;
40
45
  renderCountRef.current = renderCountRef.current + 1;
41
46
  }); // No dependencies run on each render
42
47
  }
43
48
 
44
49
  function RenderTracking(props) {
45
- useComponentRenderTracking(props.componentProps, props.action, props.actionSubject, props.handleAnalyticsEvent, props.propsToIgnore, props.useShallow);
50
+ var debouncedHandleAnalyticsEvent = (0, _react.useMemo)(function () {
51
+ return (0, _debounce.default)(props.handleAnalyticsEvent, 500);
52
+ }, [props.handleAnalyticsEvent]);
53
+ useComponentRenderTracking({
54
+ onRender: function onRender(_ref2) {
55
+ var renderCount = _ref2.renderCount,
56
+ propsDifference = _ref2.propsDifference;
57
+
58
+ if (!renderCount) {
59
+ return;
60
+ }
61
+
62
+ debouncedHandleAnalyticsEvent({
63
+ payload: {
64
+ action: props.action,
65
+ actionSubject: props.actionSubject,
66
+ attributes: {
67
+ count: renderCount,
68
+ propsDifference: propsDifference
69
+ },
70
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL
71
+ }
72
+ });
73
+ },
74
+ propsDiffingOptions: {
75
+ enabled: true,
76
+ props: props.componentProps,
77
+ propsToIgnore: props.propsToIgnore,
78
+ useShallow: props.useShallow
79
+ },
80
+ zeroBasedCount: true
81
+ });
46
82
  return null;
47
83
  }
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.nextMajorVersion = exports.version = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "150.0.3";
9
+ var version = "151.1.2";
10
10
  exports.version = version;
11
11
 
12
12
  var nextMajorVersion = function nextMajorVersion() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "150.0.3",
3
+ "version": "151.1.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { Node } from 'prosemirror-model';
3
- import { TextSelection, Selection } from 'prosemirror-state';
3
+ import { TextSelection } from 'prosemirror-state';
4
4
  import { toJSON } from '../utils';
5
5
  import { processRawValue, isEmptyDocument } from '../utils/document';
6
6
  import { getEditorValueWithMedia, __temporaryFixForConfigPanel } from '../utils/action';
@@ -171,35 +171,13 @@ export default class EditorActions {
171
171
  return false;
172
172
  }
173
173
 
174
- const {
175
- state
176
- } = this.editorView;
177
- const {
178
- schema
179
- } = state;
180
- const content = processRawValue(schema, rawValue, undefined, undefined, this.contentTransformer, this.dispatchAnalyticsEvent);
181
-
182
- if (!content) {
183
- return false;
184
- } // In case of replacing a whole document, we only need a content of a top level node e.g. document.
185
-
186
-
187
- let tr = state.tr.replaceWith(0, state.doc.nodeSize - 2, content.content);
188
-
189
- if (!shouldScrollToBottom && !tr.selectionSet) {
190
- // Restore selection at start of document instead of the end.
191
- tr.setSelection(Selection.atStart(tr.doc));
192
- }
193
-
194
- if (shouldScrollToBottom) {
195
- tr = tr.scrollIntoView();
196
- }
197
-
198
- if (!shouldAddToHistory) {
199
- tr.setMeta('addToHistory', false);
174
+ if (this.eventDispatcher) {
175
+ this.eventDispatcher.emit('resetEditorState', {
176
+ doc: rawValue,
177
+ shouldScrollToBottom
178
+ });
200
179
  }
201
180
 
202
- this.editorView.dispatch(tr);
203
181
  return true;
204
182
  }
205
183