@atlaskit/editor-core 149.0.2 → 150.0.3

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 (247) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/cjs/create-editor/create-plugins-list.js +2 -1
  3. package/dist/cjs/i18n/cs.js +18 -2
  4. package/dist/cjs/i18n/da.js +18 -2
  5. package/dist/cjs/i18n/de.js +18 -2
  6. package/dist/cjs/i18n/es.js +13 -2
  7. package/dist/cjs/i18n/et.js +0 -1
  8. package/dist/cjs/i18n/fi.js +13 -2
  9. package/dist/cjs/i18n/fr.js +13 -2
  10. package/dist/cjs/i18n/hu.js +14 -3
  11. package/dist/cjs/i18n/it.js +18 -2
  12. package/dist/cjs/i18n/ja.js +13 -2
  13. package/dist/cjs/i18n/ko.js +13 -2
  14. package/dist/cjs/i18n/nb.js +13 -2
  15. package/dist/cjs/i18n/nl.js +18 -2
  16. package/dist/cjs/i18n/pl.js +16 -2
  17. package/dist/cjs/i18n/pt_BR.js +14 -3
  18. package/dist/cjs/i18n/pt_PT.js +0 -1
  19. package/dist/cjs/i18n/ru.js +13 -2
  20. package/dist/cjs/i18n/sk.js +0 -1
  21. package/dist/cjs/i18n/sv.js +18 -2
  22. package/dist/cjs/i18n/th.js +18 -2
  23. package/dist/cjs/i18n/tr.js +16 -2
  24. package/dist/cjs/i18n/uk.js +18 -2
  25. package/dist/cjs/i18n/vi.js +13 -2
  26. package/dist/cjs/i18n/zh.js +18 -2
  27. package/dist/cjs/i18n/zh_TW.js +18 -2
  28. package/dist/cjs/messages.js +4 -4
  29. package/dist/cjs/plugins/analytics/types/enums.js +0 -1
  30. package/dist/cjs/plugins/analytics/types/node-events.js +1 -0
  31. package/dist/cjs/plugins/collab-edit/ui/to-avatar.js +4 -8
  32. package/dist/cjs/plugins/floating-toolbar/ui/{EditorHideEmojiIcon.js → EditorRemoveEmojiIcon.js} +2 -2
  33. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +5 -2
  34. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +14 -0
  35. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +19 -22
  36. package/dist/cjs/plugins/layout/actions.js +70 -16
  37. package/dist/cjs/plugins/layout/index.js +3 -2
  38. package/dist/cjs/plugins/layout/pm-plugins/main.js +3 -1
  39. package/dist/cjs/plugins/layout/toolbar-messages.js +5 -0
  40. package/dist/cjs/plugins/layout/toolbar.js +11 -2
  41. package/dist/cjs/plugins/list/pm-plugins/main.js +0 -38
  42. package/dist/cjs/plugins/mentions/analytics.js +2 -3
  43. package/dist/cjs/plugins/mentions/type-ahead/index.js +46 -15
  44. package/dist/cjs/plugins/panel/nodeviews/panel.js +7 -3
  45. package/dist/cjs/plugins/panel/toolbar.js +8 -6
  46. package/dist/cjs/plugins/panel/toolbar.test.js +25 -11
  47. package/dist/cjs/plugins/table/commands/insert.js +25 -10
  48. package/dist/cjs/plugins/table/commands/misc.js +3 -3
  49. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +5 -4
  50. package/dist/cjs/plugins/table/nodeviews/tableCell.js +20 -6
  51. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +3 -1
  52. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +1 -0
  53. package/dist/cjs/plugins/table/toolbar.js +4 -4
  54. package/dist/cjs/plugins/table/transforms/column-width.js +72 -12
  55. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
  56. package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +1 -1
  57. package/dist/cjs/plugins/table/utils/table.js +17 -2
  58. package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
  59. package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +1 -3
  60. package/dist/cjs/ui/ColorPickerButton/index.js +5 -2
  61. package/dist/cjs/ui/ColorPickerButton/index.test.js +16 -0
  62. package/dist/cjs/ui/ConfigPanel/Fields/Expand.js +2 -4
  63. package/dist/cjs/ui/ConfigPanel/Fields/Fieldset.js +1 -3
  64. package/dist/cjs/ui/ConfigPanel/NestedForms/RemovableField.js +1 -3
  65. package/dist/cjs/version-wrapper.js +1 -1
  66. package/dist/cjs/version.json +1 -1
  67. package/dist/es2019/create-editor/create-plugins-list.js +2 -1
  68. package/dist/es2019/i18n/cs.js +18 -2
  69. package/dist/es2019/i18n/da.js +18 -2
  70. package/dist/es2019/i18n/de.js +18 -2
  71. package/dist/es2019/i18n/es.js +13 -2
  72. package/dist/es2019/i18n/et.js +0 -1
  73. package/dist/es2019/i18n/fi.js +13 -2
  74. package/dist/es2019/i18n/fr.js +13 -2
  75. package/dist/es2019/i18n/hu.js +14 -3
  76. package/dist/es2019/i18n/it.js +18 -2
  77. package/dist/es2019/i18n/ja.js +13 -2
  78. package/dist/es2019/i18n/ko.js +13 -2
  79. package/dist/es2019/i18n/nb.js +13 -2
  80. package/dist/es2019/i18n/nl.js +18 -2
  81. package/dist/es2019/i18n/pl.js +16 -2
  82. package/dist/es2019/i18n/pt_BR.js +14 -3
  83. package/dist/es2019/i18n/pt_PT.js +0 -1
  84. package/dist/es2019/i18n/ru.js +13 -2
  85. package/dist/es2019/i18n/sk.js +0 -1
  86. package/dist/es2019/i18n/sv.js +18 -2
  87. package/dist/es2019/i18n/th.js +18 -2
  88. package/dist/es2019/i18n/tr.js +16 -2
  89. package/dist/es2019/i18n/uk.js +18 -2
  90. package/dist/es2019/i18n/vi.js +13 -2
  91. package/dist/es2019/i18n/zh.js +18 -2
  92. package/dist/es2019/i18n/zh_TW.js +18 -2
  93. package/dist/es2019/messages.js +4 -4
  94. package/dist/es2019/plugins/analytics/types/enums.js +0 -1
  95. package/dist/es2019/plugins/analytics/types/node-events.js +1 -0
  96. package/dist/es2019/plugins/collab-edit/ui/to-avatar.js +2 -6
  97. package/dist/es2019/plugins/floating-toolbar/ui/{EditorHideEmojiIcon.js → EditorRemoveEmojiIcon.js} +1 -1
  98. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +5 -3
  99. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +14 -0
  100. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +20 -23
  101. package/dist/es2019/plugins/layout/actions.js +64 -13
  102. package/dist/es2019/plugins/layout/index.js +3 -2
  103. package/dist/es2019/plugins/layout/pm-plugins/main.js +3 -1
  104. package/dist/es2019/plugins/layout/toolbar-messages.js +5 -0
  105. package/dist/es2019/plugins/layout/toolbar.js +10 -2
  106. package/dist/es2019/plugins/list/pm-plugins/main.js +1 -41
  107. package/dist/es2019/plugins/mentions/analytics.js +2 -3
  108. package/dist/es2019/plugins/mentions/type-ahead/index.js +30 -17
  109. package/dist/es2019/plugins/panel/nodeviews/panel.js +5 -3
  110. package/dist/es2019/plugins/panel/toolbar.js +8 -6
  111. package/dist/es2019/plugins/panel/toolbar.test.js +18 -8
  112. package/dist/es2019/plugins/table/commands/insert.js +27 -12
  113. package/dist/es2019/plugins/table/commands/misc.js +3 -3
  114. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +5 -4
  115. package/dist/es2019/plugins/table/nodeviews/tableCell.js +19 -6
  116. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +1 -2
  117. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +1 -1
  118. package/dist/es2019/plugins/table/toolbar.js +4 -4
  119. package/dist/es2019/plugins/table/transforms/column-width.js +62 -11
  120. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
  121. package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +1 -1
  122. package/dist/es2019/plugins/table/utils/table.js +7 -1
  123. package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
  124. package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +1 -2
  125. package/dist/es2019/ui/ColorPickerButton/index.js +6 -3
  126. package/dist/es2019/ui/ColorPickerButton/index.test.js +15 -0
  127. package/dist/es2019/ui/ConfigPanel/Fields/Expand.js +3 -4
  128. package/dist/es2019/ui/ConfigPanel/Fields/Fieldset.js +2 -3
  129. package/dist/es2019/ui/ConfigPanel/NestedForms/RemovableField.js +1 -2
  130. package/dist/es2019/version-wrapper.js +1 -1
  131. package/dist/es2019/version.json +1 -1
  132. package/dist/esm/create-editor/create-plugins-list.js +2 -1
  133. package/dist/esm/i18n/cs.js +18 -2
  134. package/dist/esm/i18n/da.js +18 -2
  135. package/dist/esm/i18n/de.js +18 -2
  136. package/dist/esm/i18n/es.js +13 -2
  137. package/dist/esm/i18n/et.js +0 -1
  138. package/dist/esm/i18n/fi.js +13 -2
  139. package/dist/esm/i18n/fr.js +13 -2
  140. package/dist/esm/i18n/hu.js +14 -3
  141. package/dist/esm/i18n/it.js +18 -2
  142. package/dist/esm/i18n/ja.js +13 -2
  143. package/dist/esm/i18n/ko.js +13 -2
  144. package/dist/esm/i18n/nb.js +13 -2
  145. package/dist/esm/i18n/nl.js +18 -2
  146. package/dist/esm/i18n/pl.js +16 -2
  147. package/dist/esm/i18n/pt_BR.js +14 -3
  148. package/dist/esm/i18n/pt_PT.js +0 -1
  149. package/dist/esm/i18n/ru.js +13 -2
  150. package/dist/esm/i18n/sk.js +0 -1
  151. package/dist/esm/i18n/sv.js +18 -2
  152. package/dist/esm/i18n/th.js +18 -2
  153. package/dist/esm/i18n/tr.js +16 -2
  154. package/dist/esm/i18n/uk.js +18 -2
  155. package/dist/esm/i18n/vi.js +13 -2
  156. package/dist/esm/i18n/zh.js +18 -2
  157. package/dist/esm/i18n/zh_TW.js +18 -2
  158. package/dist/esm/messages.js +4 -4
  159. package/dist/esm/plugins/analytics/types/enums.js +0 -1
  160. package/dist/esm/plugins/analytics/types/node-events.js +1 -0
  161. package/dist/esm/plugins/collab-edit/ui/to-avatar.js +4 -8
  162. package/dist/esm/plugins/floating-toolbar/ui/{EditorHideEmojiIcon.js → EditorRemoveEmojiIcon.js} +1 -1
  163. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +6 -3
  164. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +14 -0
  165. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +20 -23
  166. package/dist/esm/plugins/layout/actions.js +66 -13
  167. package/dist/esm/plugins/layout/index.js +3 -2
  168. package/dist/esm/plugins/layout/pm-plugins/main.js +3 -1
  169. package/dist/esm/plugins/layout/toolbar-messages.js +5 -0
  170. package/dist/esm/plugins/layout/toolbar.js +10 -2
  171. package/dist/esm/plugins/list/pm-plugins/main.js +1 -37
  172. package/dist/esm/plugins/mentions/analytics.js +2 -3
  173. package/dist/esm/plugins/mentions/type-ahead/index.js +46 -15
  174. package/dist/esm/plugins/panel/nodeviews/panel.js +5 -3
  175. package/dist/esm/plugins/panel/toolbar.js +8 -6
  176. package/dist/esm/plugins/panel/toolbar.test.js +25 -11
  177. package/dist/esm/plugins/table/commands/insert.js +26 -11
  178. package/dist/esm/plugins/table/commands/misc.js +3 -3
  179. package/dist/esm/plugins/table/nodeviews/TableComponent.js +5 -4
  180. package/dist/esm/plugins/table/nodeviews/tableCell.js +21 -7
  181. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +1 -2
  182. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +1 -1
  183. package/dist/esm/plugins/table/toolbar.js +4 -4
  184. package/dist/esm/plugins/table/transforms/column-width.js +62 -10
  185. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
  186. package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +1 -1
  187. package/dist/esm/plugins/table/utils/table.js +9 -0
  188. package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
  189. package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +1 -2
  190. package/dist/esm/ui/ColorPickerButton/index.js +6 -3
  191. package/dist/esm/ui/ColorPickerButton/index.test.js +15 -0
  192. package/dist/esm/ui/ConfigPanel/Fields/Expand.js +2 -3
  193. package/dist/esm/ui/ConfigPanel/Fields/Fieldset.js +1 -2
  194. package/dist/esm/ui/ConfigPanel/NestedForms/RemovableField.js +1 -2
  195. package/dist/esm/version-wrapper.js +1 -1
  196. package/dist/esm/version.json +1 -1
  197. package/dist/types/editor.d.ts +1 -1
  198. package/dist/types/i18n/cs.d.ts +16 -0
  199. package/dist/types/i18n/da.d.ts +16 -0
  200. package/dist/types/i18n/de.d.ts +16 -0
  201. package/dist/types/i18n/es.d.ts +11 -0
  202. package/dist/types/i18n/et.d.ts +0 -1
  203. package/dist/types/i18n/fi.d.ts +11 -0
  204. package/dist/types/i18n/fr.d.ts +11 -0
  205. package/dist/types/i18n/hu.d.ts +11 -0
  206. package/dist/types/i18n/it.d.ts +16 -0
  207. package/dist/types/i18n/ja.d.ts +11 -0
  208. package/dist/types/i18n/ko.d.ts +11 -0
  209. package/dist/types/i18n/nb.d.ts +11 -0
  210. package/dist/types/i18n/nl.d.ts +16 -0
  211. package/dist/types/i18n/pl.d.ts +14 -0
  212. package/dist/types/i18n/pt_BR.d.ts +11 -0
  213. package/dist/types/i18n/pt_PT.d.ts +0 -1
  214. package/dist/types/i18n/ru.d.ts +11 -0
  215. package/dist/types/i18n/sk.d.ts +0 -1
  216. package/dist/types/i18n/sv.d.ts +16 -0
  217. package/dist/types/i18n/th.d.ts +16 -0
  218. package/dist/types/i18n/tr.d.ts +14 -0
  219. package/dist/types/i18n/uk.d.ts +16 -0
  220. package/dist/types/i18n/vi.d.ts +11 -0
  221. package/dist/types/i18n/zh.d.ts +16 -0
  222. package/dist/types/i18n/zh_TW.d.ts +16 -0
  223. package/dist/types/messages.d.ts +1 -1
  224. package/dist/types/plugins/analytics/analytics-queue.d.ts +1 -1
  225. package/dist/types/plugins/analytics/types/enums.d.ts +0 -1
  226. package/dist/types/plugins/analytics/types/general-events.d.ts +1 -1
  227. package/dist/types/plugins/analytics/types/list-events.d.ts +1 -5
  228. package/dist/types/plugins/analytics/types/node-events.d.ts +1 -0
  229. package/dist/types/plugins/collab-edit/ui/to-avatar.d.ts +1 -1
  230. package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -2
  231. package/dist/types/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.d.ts +1 -0
  232. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +1 -1
  233. package/dist/types/plugins/layout/actions.d.ts +1 -0
  234. package/dist/types/plugins/layout/pm-plugins/types.d.ts +1 -0
  235. package/dist/types/plugins/layout/toolbar-messages.d.ts +5 -0
  236. package/dist/types/plugins/layout/toolbar.d.ts +1 -1
  237. package/dist/types/plugins/layout/types.d.ts +2 -1
  238. package/dist/types/plugins/mentions/analytics.d.ts +1 -1
  239. package/dist/types/plugins/quick-insert/index.d.ts +1 -1
  240. package/dist/types/plugins/table/nodeviews/tableCell.d.ts +1 -1
  241. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +2 -0
  242. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -0
  243. package/dist/types/plugins/table/transforms/column-width.d.ts +10 -0
  244. package/dist/types/plugins/table/utils/table.d.ts +2 -0
  245. package/dist/types/ui/ConfigPanel/Fields/Expand.d.ts +1 -1
  246. package/package.json +22 -22
  247. package/dist/types/plugins/floating-toolbar/ui/EditorHideEmojiIcon.d.ts +0 -1
@@ -89,10 +89,10 @@ export default defineMessages({
89
89
  defaultMessage: 'Remove',
90
90
  description: 'Delete the element (image, panel, table, etc.) from your document'
91
91
  },
92
- hideEmoji: {
93
- id: 'fabric.editor.hideEmoji',
94
- defaultMessage: 'Hide emoji',
95
- description: 'Hide the emoji panel icon from custom panel'
92
+ removeEmoji: {
93
+ id: 'fabric.editor.removeEmoji',
94
+ defaultMessage: 'Remove emoji',
95
+ description: 'Remove the emoji panel icon from custom panel'
96
96
  },
97
97
  visit: {
98
98
  id: 'fabric.editor.visit',
@@ -90,7 +90,6 @@ export var ACTION;
90
90
  ACTION["VIEWED"] = "viewed";
91
91
  ACTION["VISITED"] = "visited";
92
92
  ACTION["WITH_PLUGIN_STATE_CALLED"] = "withPluginStateCalled";
93
- ACTION["FIXED"] = "fixed";
94
93
  ACTION["RENDERED"] = "rendered";
95
94
  ACTION["ON_EDITOR_READY_CALLBACK"] = "onEditorReadyCallback";
96
95
  ACTION["ON_CHANGE_CALLBACK"] = "onChangeCalled";
@@ -1,6 +1,7 @@
1
1
  export var LAYOUT_TYPE;
2
2
 
3
3
  (function (LAYOUT_TYPE) {
4
+ LAYOUT_TYPE["SINGLE_COL"] = "singleColumn";
4
5
  LAYOUT_TYPE["TWO_COLS_EQUAL"] = "twoColumnsEqual";
5
6
  LAYOUT_TYPE["THREE_COLS_EQUAL"] = "threeColumnsEqual";
6
7
  LAYOUT_TYPE["LEFT_SIDEBAR"] = "twoColumnsLeftSidebar";
@@ -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
+ });
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export default function EditorHideEmojiIcon() {
2
+ export default function EditorRemoveEmojiIcon() {
3
3
  return /*#__PURE__*/React.createElement("svg", {
4
4
  width: "24",
5
5
  height: "24",
@@ -6,7 +6,7 @@ var _templateObject;
6
6
  import React from 'react';
7
7
  import styled from 'styled-components';
8
8
  import Button from '@atlaskit/button';
9
- import { Popup, WithProviders } from '@atlaskit/editor-common';
9
+ import { Popup, withOuterListeners, WithProviders } from '@atlaskit/editor-common';
10
10
  import { EmojiPicker } from '@atlaskit/emoji';
11
11
  import Tooltip from '@atlaskit/tooltip';
12
12
  import EditorEmojiAddIcon from './EditorEmojiAddIcon'; // helps adjusts position of popup
@@ -20,6 +20,8 @@ export var EmojiPickerButton = function EmojiPickerButton(props) {
20
20
  isPopupOpen = _React$useState2[0],
21
21
  setIsPopupOpen = _React$useState2[1];
22
22
 
23
+ var EmojiPickerWithListener = withOuterListeners(EmojiPicker);
24
+
23
25
  var togglePopup = function togglePopup() {
24
26
  setIsPopupOpen(!isPopupOpen);
25
27
  };
@@ -34,10 +36,11 @@ export var EmojiPickerButton = function EmojiPickerButton(props) {
34
36
  return null;
35
37
  }
36
38
 
37
- return /*#__PURE__*/React.createElement(EmojiPicker, {
39
+ return /*#__PURE__*/React.createElement(EmojiPickerWithListener, {
38
40
  emojiProvider: providers.emojiProvider,
39
41
  onSelection: updateEmoji,
40
- onPickerRef: function onPickerRef() {}
42
+ onPickerRef: function onPickerRef() {},
43
+ handleClickOutside: togglePopup
41
44
  });
42
45
  };
43
46
 
@@ -48,6 +48,20 @@ describe('emoji-picker-button', function () {
48
48
 
49
49
  expect(wrapper.find('Popup')).toHaveLength(1);
50
50
  });
51
+ it('should close EmojiPicker popup after clicking outside', function () {
52
+ // clicking on the button to open the popup
53
+ wrapper.find('button').simulate('click'); // make sure the popup and picker are shown
54
+
55
+ expect(wrapper.find('Popup')).toHaveLength(1);
56
+ var emojiPicker = wrapper.find('EmojiPickerInternal').instance(); // calling click outside
57
+
58
+ act(function () {
59
+ emojiPicker.props.handleClickOutside();
60
+ });
61
+ wrapper.update(); // make sure popup is hidden
62
+
63
+ expect(wrapper.find('Popup')).toHaveLength(0);
64
+ });
51
65
  it('should hide popup and call onChange after selecting an emoji', function () {
52
66
  // click the button
53
67
  wrapper.find('button').simulate('click'); // make sure the popup and picker are shown
@@ -38,6 +38,7 @@ import { messages } from './messages';
38
38
  import { createItems } from './create-items';
39
39
  import { BlockInsertMenu } from './block-insert-menu';
40
40
  import { insertHorizontalRule } from '../../../rule/commands';
41
+ import withOuterListeners from '../../../../ui/with-outer-listeners';
41
42
  /**
42
43
  * Checks if an element is detached (i.e. not in the current document)
43
44
  */
@@ -48,6 +49,8 @@ var isDetachedElement = function isDetachedElement(el) {
48
49
 
49
50
  var noop = function noop() {};
50
51
 
52
+ var EmojiPickerWithListeners = withOuterListeners(AkEmojiPicker);
53
+
51
54
  var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
52
55
  _inherits(ToolbarInsertBlock, _React$PureComponent);
53
56
 
@@ -140,6 +143,20 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
140
143
  });
141
144
  });
142
145
 
146
+ _defineProperty(_assertThisInitialized(_this), "handleEmojiPressEscape", function () {
147
+ _this.toggleEmojiPicker(INPUT_METHOD.KEYBOARD);
148
+ });
149
+
150
+ _defineProperty(_assertThisInitialized(_this), "handleEmojiClickOutside", function (e) {
151
+ // Ignore click events for detached elements.
152
+ // Workaround for FS-1322 - where two onClicks fire - one when the upload button is
153
+ // still in the document, and one once it's detached. Does not always occur, and
154
+ // may be a side effect of a react render optimisation
155
+ if (e.target && !isDetachedElement(e.target)) {
156
+ _this.toggleEmojiPicker(INPUT_METHOD.TOOLBAR);
157
+ }
158
+ });
159
+
143
160
  _defineProperty(_assertThisInitialized(_this), "handleEmojiButtonRef", function (button) {
144
161
  var ref = ReactDOM.findDOMNode(button);
145
162
 
@@ -164,27 +181,6 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
164
181
  }
165
182
  });
166
183
 
167
- _defineProperty(_assertThisInitialized(_this), "onPickerRef", function (ref) {
168
- if (ref) {
169
- document.addEventListener('click', _this.handleClickOutside);
170
- } else {
171
- document.removeEventListener('click', _this.handleClickOutside);
172
- }
173
-
174
- _this.pickerRef = ref;
175
- });
176
-
177
- _defineProperty(_assertThisInitialized(_this), "handleClickOutside", function (e) {
178
- var picker = _this.pickerRef && ReactDOM.findDOMNode(_this.pickerRef); // Ignore click events for detached elements.
179
- // Workaround for FS-1322 - where two onClicks fire - one when the upload button is
180
- // still in the document, and one once it's detached. Does not always occur, and
181
- // may be a side effect of a react render optimisation
182
-
183
- if (!picker || e.target && !isDetachedElement(e.target) && !picker.contains(e.target)) {
184
- _this.toggleEmojiPicker();
185
- }
186
- });
187
-
188
184
  _defineProperty(_assertThisInitialized(_this), "toggleLinkPanel", function (inputMethod) {
189
185
  var editorView = _this.props.editorView;
190
186
  showLinkToolbar(inputMethod)(editorView.state, editorView.dispatch);
@@ -489,10 +485,11 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
489
485
  mountTo: popupsMountPoint,
490
486
  boundariesElement: popupsBoundariesElement,
491
487
  scrollableElement: popupsScrollableElement
492
- }, /*#__PURE__*/React.createElement(AkEmojiPicker, {
488
+ }, /*#__PURE__*/React.createElement(EmojiPickerWithListeners, {
493
489
  emojiProvider: emojiProvider,
494
490
  onSelection: this.handleSelectedEmoji,
495
- onPickerRef: this.onPickerRef
491
+ handleClickOutside: this.handleEmojiClickOutside,
492
+ handleEscapeKeydown: this.handleEmojiPressEscape
496
493
  }));
497
494
  }
498
495
  }, {
@@ -13,11 +13,15 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analyt
13
13
  import { addAnalytics, withAnalytics } from '../analytics/utils';
14
14
  import { LAYOUT_TYPE } from '../analytics/types/node-events';
15
15
  import { pluginKey } from './pm-plugins/plugin-key';
16
+ export var ONE_COL_LAYOUTS = ['single'];
16
17
  export var TWO_COL_LAYOUTS = ['two_equal', 'two_left_sidebar', 'two_right_sidebar'];
17
18
  export var THREE_COL_LAYOUTS = ['three_equal', 'three_with_sidebars'];
18
19
 
19
20
  var getWidthsForPreset = function getWidthsForPreset(presetLayout) {
20
21
  switch (presetLayout) {
22
+ case 'single':
23
+ return [100];
24
+
21
25
  case 'two_equal':
22
26
  return [50, 50];
23
27
 
@@ -46,6 +50,9 @@ export var getPresetLayout = function getPresetLayout(section) {
46
50
  }).join(',');
47
51
 
48
52
  switch (widths) {
53
+ case '100':
54
+ return 'single';
55
+
49
56
  case '33.33,33.33,33.33':
50
57
  return 'three_equal';
51
58
 
@@ -101,6 +108,44 @@ export var insertLayoutColumnsWithAnalytics = function insertLayoutColumnsWithAn
101
108
  eventType: EVENT_TYPE.TRACK
102
109
  })(insertLayoutColumns);
103
110
  };
111
+ /**
112
+ * Add a column to the right of existing layout
113
+ */
114
+
115
+ function addColumn(schema, pos) {
116
+ return function (tr) {
117
+ tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos), schema.nodes.layoutColumn.createAndFill());
118
+ };
119
+ }
120
+
121
+ function removeLastColumnInLayout(column, columnPos, insideRightEdgePos) {
122
+ return function (tr) {
123
+ if (isEmptyDocument(column)) {
124
+ tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(insideRightEdgePos), Slice.empty);
125
+ } else {
126
+ tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(columnPos + 1), Slice.empty);
127
+ }
128
+ };
129
+ }
130
+
131
+ var fromTwoColsToThree = addColumn;
132
+ var fromOneColToTwo = addColumn;
133
+ var fromTwoColsToOne = removeLastColumnInLayout;
134
+ var fromThreeColsToTwo = removeLastColumnInLayout;
135
+
136
+ var fromOneColToThree = function fromOneColToThree(schema, pos) {
137
+ return function (tr) {
138
+ addColumn(schema, pos)(tr);
139
+ addColumn(schema, pos)(tr);
140
+ };
141
+ };
142
+
143
+ var fromThreeColstoOne = function fromThreeColstoOne(node, tr, insideRightEdgePos) {
144
+ var thirdColumn = node.content.child(2);
145
+ fromThreeColsToTwo(thirdColumn, insideRightEdgePos - thirdColumn.nodeSize, insideRightEdgePos)(tr);
146
+ var secondColumn = node.content.child(1);
147
+ fromTwoColsToOne(secondColumn, insideRightEdgePos - thirdColumn.nodeSize - secondColumn.nodeSize, insideRightEdgePos)(tr);
148
+ };
104
149
  /**
105
150
  * Handles switching from 2 -> 3 cols, or 3 -> 2 cols
106
151
  * Switching from 2 -> 3 just adds a new one at the end
@@ -108,25 +153,30 @@ export var insertLayoutColumnsWithAnalytics = function insertLayoutColumnsWithAn
108
153
  * removing it
109
154
  */
110
155
 
156
+
111
157
  function forceColumnStructure(state, node, pos, presetLayout) {
112
158
  var tr = state.tr;
113
159
  var insideRightEdgeOfLayoutSection = pos + node.nodeSize - 1;
114
- var numCols = node.childCount;
160
+ var numCols = node.childCount; // 3 columns -> 2 columns
115
161
 
116
162
  if (TWO_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 3) {
117
163
  var thirdColumn = node.content.child(2);
118
- var thirdColumnPos = insideRightEdgeOfLayoutSection - thirdColumn.nodeSize;
119
-
120
- if (isEmptyDocument(thirdColumn)) {
121
- tr.replaceRange( // end pos of second column
122
- tr.mapping.map(thirdColumnPos - 1), tr.mapping.map(insideRightEdgeOfLayoutSection), Slice.empty);
123
- } else {
124
- tr.replaceRange( // end pos of second column
125
- tr.mapping.map(thirdColumnPos - 1), // start pos of third column
126
- tr.mapping.map(thirdColumnPos + 1), Slice.empty);
127
- }
164
+ var columnPos = insideRightEdgeOfLayoutSection - thirdColumn.nodeSize;
165
+ fromThreeColsToTwo(thirdColumn, columnPos, insideRightEdgeOfLayoutSection)(tr); // 2 columns -> 3 columns
128
166
  } else if (THREE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
129
- tr.replaceWith(tr.mapping.map(insideRightEdgeOfLayoutSection), tr.mapping.map(insideRightEdgeOfLayoutSection), state.schema.nodes.layoutColumn.createAndFill());
167
+ fromTwoColsToThree(state.schema, insideRightEdgeOfLayoutSection)(tr); // 2 columns -> 1 column
168
+ } else if (ONE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
169
+ var secondColumn = node.content.child(1);
170
+
171
+ var _columnPos = insideRightEdgeOfLayoutSection - secondColumn.nodeSize;
172
+
173
+ fromTwoColsToOne(secondColumn, _columnPos, insideRightEdgeOfLayoutSection)(tr); // 3 columns -> 1 column
174
+ } else if (ONE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 3) {
175
+ fromThreeColstoOne(node, tr, insideRightEdgeOfLayoutSection); // 1 column -> 2 columns
176
+ } else if (TWO_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 1) {
177
+ fromOneColToTwo(state.schema, insideRightEdgeOfLayoutSection)(tr); // 1 column -> 3 columns
178
+ } else if (THREE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 1) {
179
+ fromOneColToThree(state.schema, insideRightEdgeOfLayoutSection)(tr);
130
180
  }
131
181
 
132
182
  return tr;
@@ -219,7 +269,7 @@ function getLayoutChange(node, pos, schema) {
219
269
  return;
220
270
  }
221
271
 
222
- var presetLayout = node.childCount === 2 ? 'two_equal' : 'three_equal';
272
+ var presetLayout = node.childCount === 2 ? 'two_equal' : node.childCount === 3 ? 'three_equal' : 'single';
223
273
  var fixedColumns = columnWidth(node, schema, getWidthsForPreset(presetLayout));
224
274
  return {
225
275
  from: pos + 1,
@@ -312,6 +362,9 @@ export var deleteActiveLayoutNode = function deleteActiveLayoutNode(state, dispa
312
362
 
313
363
  var formatLayoutName = function formatLayoutName(layout) {
314
364
  switch (layout) {
365
+ case 'single':
366
+ return LAYOUT_TYPE.SINGLE_COL;
367
+
315
368
  case 'two_equal':
316
369
  return LAYOUT_TYPE.TWO_COLS_EQUAL;
317
370
 
@@ -35,10 +35,11 @@ var layoutPlugin = function layoutPlugin() {
35
35
  var _ref = pluginKey.getState(state),
36
36
  pos = _ref.pos,
37
37
  allowBreakout = _ref.allowBreakout,
38
- addSidebarLayouts = _ref.addSidebarLayouts;
38
+ addSidebarLayouts = _ref.addSidebarLayouts,
39
+ allowSingleColumnLayout = _ref.allowSingleColumnLayout;
39
40
 
40
41
  if (pos !== null) {
41
- return buildToolbar(state, intl, pos, allowBreakout, addSidebarLayouts);
42
+ return buildToolbar(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout);
42
43
  }
43
44
 
44
45
  return undefined;
@@ -57,13 +57,15 @@ var getInitialPluginState = function getInitialPluginState(options, state) {
57
57
  var maybeLayoutSection = findParentNodeOfType(state.schema.nodes.layoutSection)(state.selection);
58
58
  var allowBreakout = options.allowBreakout || false;
59
59
  var addSidebarLayouts = options.UNSAFE_addSidebarLayouts || false;
60
+ var allowSingleColumnLayout = options.UNSAFE_allowSingleColumnLayout || false;
60
61
  var pos = maybeLayoutSection ? maybeLayoutSection.pos : null;
61
62
  var selectedLayout = getSelectedLayout(maybeLayoutSection && maybeLayoutSection.node, DEFAULT_LAYOUT);
62
63
  return {
63
64
  pos: pos,
64
65
  allowBreakout: allowBreakout,
65
66
  addSidebarLayouts: addSidebarLayouts,
66
- selectedLayout: selectedLayout
67
+ selectedLayout: selectedLayout,
68
+ allowSingleColumnLayout: allowSingleColumnLayout
67
69
  };
68
70
  };
69
71
 
@@ -1,5 +1,10 @@
1
1
  import { defineMessages } from 'react-intl';
2
2
  export var toolbarMessages = defineMessages({
3
+ singleColumn: {
4
+ id: 'fabric.editor.single',
5
+ defaultMessage: 'Single column',
6
+ description: 'Layout with one single column'
7
+ },
3
8
  twoColumns: {
4
9
  id: 'fabric.editor.twoColumns',
5
10
  defaultMessage: 'Two columns',
@@ -1,5 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { findDomRefAtPos } from 'prosemirror-utils';
3
+ import EditorLayoutSingleIcon from '@atlaskit/icon/glyph/editor/layout-single';
3
4
  import LayoutTwoEqualIcon from '@atlaskit/icon/glyph/editor/layout-two-equal';
4
5
  import LayoutThreeEqualIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
5
6
  import LayoutTwoLeftSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-left-sidebar';
@@ -21,6 +22,12 @@ var LAYOUT_TYPES = [{
21
22
  title: toolbarMessages.threeColumns,
22
23
  icon: LayoutThreeEqualIcon
23
24
  }];
25
+ var LAYOUT_TYPES_WITH_SINGLE_COL = [{
26
+ id: 'editor.layout.singeLayout',
27
+ type: 'single',
28
+ title: toolbarMessages.singleColumn,
29
+ icon: EditorLayoutSingleIcon
30
+ }].concat(LAYOUT_TYPES);
24
31
  var SIDEBAR_LAYOUT_TYPES = [{
25
32
  id: 'editor.layout.twoRightSidebar',
26
33
  type: 'two_right_sidebar',
@@ -51,7 +58,7 @@ var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout) {
51
58
  };
52
59
 
53
60
  export var layoutToolbarTitle = 'Layout floating controls';
54
- export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts) {
61
+ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout) {
55
62
  var node = state.doc.nodeAt(pos);
56
63
 
57
64
  if (node) {
@@ -73,13 +80,14 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
73
80
  onFocus: hoverDecoration(nodeType, true),
74
81
  onBlur: hoverDecoration(nodeType, false)
75
82
  };
83
+ var layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
76
84
  return {
77
85
  title: layoutToolbarTitle,
78
86
  getDomRef: function getDomRef(view) {
79
87
  return findDomRefAtPos(pos, view.domAtPos.bind(view));
80
88
  },
81
89
  nodeType: nodeType,
82
- items: [].concat(_toConsumableArray(LAYOUT_TYPES.map(function (i) {
90
+ items: [].concat(_toConsumableArray(layoutTypes.map(function (i) {
83
91
  return buildLayoutButton(intl, i, currentLayout);
84
92
  })), _toConsumableArray(addSidebarLayouts ? SIDEBAR_LAYOUT_TYPES.map(function (i) {
85
93
  return buildLayoutButton(intl, i, currentLayout);
@@ -7,11 +7,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
7
7
  import { Plugin, PluginKey } from 'prosemirror-state';
8
8
  import { DecorationSet, Decoration } from 'prosemirror-view';
9
9
  import { findParentNodeOfType } from 'prosemirror-utils';
10
- import { addAnalytics, ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics';
11
10
  import { isWrappingPossible } from '../utils/selection';
12
- import { isListNode, JoinDirection, joinSiblingLists } from '../utils/node';
11
+ import { isListNode } from '../utils/node';
13
12
  import { pluginFactory } from '../../../utils/plugin-state-factory';
14
- import { findRootParentListNode } from '../utils/find';
15
13
  var listPluginKey = new PluginKey('listPlugin');
16
14
  export var pluginKey = listPluginKey;
17
15
  var initialState = {
@@ -112,40 +110,6 @@ export var createPlugin = function createPlugin(eventDispatch) {
112
110
  return new Plugin({
113
111
  state: createPluginState(eventDispatch, createInitialState),
114
112
  key: listPluginKey,
115
- appendTransaction: function appendTransaction(transactions, _oldState, newState) {
116
- var lastTransaction = transactions[transactions.length - 1];
117
-
118
- if (!lastTransaction.docChanged || !lastTransaction.selectionSet) {
119
- return;
120
- }
121
-
122
- var tr = newState.tr;
123
- var rootList = findRootParentListNode(tr.selection.$from);
124
-
125
- if (!rootList) {
126
- return;
127
- }
128
-
129
- var listsJoined = joinSiblingLists({
130
- tr: tr,
131
- direction: JoinDirection.RIGHT
132
- });
133
-
134
- if (tr.docChanged) {
135
- var orderedListsJoined = listsJoined.orderedList,
136
- bulletListsJoined = listsJoined.bulletList;
137
- addAnalytics(newState, tr, {
138
- action: ACTION.FIXED,
139
- actionSubject: ACTION_SUBJECT.LIST,
140
- eventType: EVENT_TYPE.TRACK,
141
- attributes: {
142
- orderedListsJoined: orderedListsJoined,
143
- bulletListsJoined: bulletListsJoined
144
- }
145
- });
146
- return tr;
147
- }
148
- },
149
113
  props: {
150
114
  decorations: function decorations(state) {
151
115
  var _getPluginState = getPluginState(state),
@@ -81,7 +81,7 @@ export var buildTypeAheadInviteItemViewedPayload = function buildTypeAheadInvite
81
81
  userRole: userRole
82
82
  });
83
83
  };
84
- export var buildTypeAheadInviteExposurePayload = function buildTypeAheadInviteExposurePayload(shouldEnableInvite, sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole) {
84
+ export var buildTypeAheadInviteExposurePayload = function buildTypeAheadInviteExposurePayload(sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole) {
85
85
  var _ref2 = contextIdentifierProvider || {},
86
86
  containerId = _ref2.containerId,
87
87
  objectId = _ref2.objectId,
@@ -89,8 +89,7 @@ export var buildTypeAheadInviteExposurePayload = function buildTypeAheadInviteEx
89
89
 
90
90
  return buildAnalyticsPayload('feature', 'exposed', OPERATIONAL_EVENT_TYPE, sessionId, {
91
91
  flagKey: 'confluence.frontend.invite.from.mention',
92
- value: shouldEnableInvite,
93
- cohort: inviteExperimentCohort,
92
+ value: inviteExperimentCohort || 'not-enrolled',
94
93
  containerId: containerId,
95
94
  objectId: objectId,
96
95
  childObjectId: childObjectId,
@@ -1,6 +1,12 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
 
4
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
5
+
6
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7
+
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
9
+
4
10
  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; }
5
11
 
6
12
  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; }
@@ -201,6 +207,7 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
201
207
  HighlightComponent = _ref6.HighlightComponent;
202
208
  var sessionId = uuid();
203
209
  var firstQueryWithoutResults = null;
210
+ var subscriptionKeys = new Set();
204
211
  var typeAhead = {
205
212
  id: TypeAheadAvailableNodes.MENTION,
206
213
  trigger: '@',
@@ -247,9 +254,15 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
247
254
  var key = "loadingMentionsForTypeAhead_".concat(uuid());
248
255
 
249
256
  var mentionsSubscribeCallback = function mentionsSubscribeCallback(mentions) {
250
- var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
257
+ var resultQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
251
258
  var stats = arguments.length > 2 ? arguments[2] : undefined;
259
+
260
+ if (query !== resultQuery) {
261
+ return;
262
+ }
263
+
252
264
  mentionProvider.unsubscribe(key);
265
+ subscriptionKeys.delete(key);
253
266
  var mentionItems = mentions.map(function (mention) {
254
267
  return memoizedToItem.call(mention);
255
268
  });
@@ -261,6 +274,13 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
261
274
 
262
275
  if (mentions.length === 0 && firstQueryWithoutResults === null) {
263
276
  firstQueryWithoutResults = query;
277
+ } // Growth (El-dorado) experiment design hard requirement
278
+
279
+
280
+ if (mentionItems.length <= 2) {
281
+ var inviteExperimentCohort = mentionProvider.inviteExperimentCohort,
282
+ userRole = mentionProvider.userRole;
283
+ fireEvent(buildTypeAheadInviteExposurePayload(sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole));
264
284
  }
265
285
 
266
286
  if (!mentionProvider.shouldEnableInvite || mentionItems.length > 2) {
@@ -278,26 +298,15 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
278
298
  }
279
299
  };
280
300
 
301
+ subscriptionKeys.add(key);
281
302
  mentionProvider.subscribe(key, mentionsSubscribeCallback);
282
303
  mentionProvider.filter(query || '', _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
283
304
  sessionId: sessionId
284
305
  }));
285
306
  });
286
307
  },
287
- onOpen: function onOpen(editorState) {
308
+ onOpen: function onOpen() {
288
309
  firstQueryWithoutResults = null;
289
- var pluginState = getMentionPluginState(editorState);
290
-
291
- if (!pluginState || !pluginState.mentionProvider) {
292
- return null;
293
- }
294
-
295
- var contextIdentifierProvider = pluginState.contextIdentifierProvider,
296
- _pluginState$mentionP = pluginState.mentionProvider,
297
- shouldEnableInvite = _pluginState$mentionP.shouldEnableInvite,
298
- inviteExperimentCohort = _pluginState$mentionP.inviteExperimentCohort,
299
- userRole = _pluginState$mentionP.userRole;
300
- fireEvent(buildTypeAheadInviteExposurePayload(!!shouldEnableInvite, sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole));
301
310
  },
302
311
  selectItem: function selectItem(state, item, insert, _ref8) {
303
312
  var mode = _ref8.mode,
@@ -367,11 +376,33 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
367
376
  return insert(Fragment.from([mentionNode, space]));
368
377
  },
369
378
  dismiss: function dismiss(_ref9) {
370
- var query = _ref9.query,
379
+ var editorState = _ref9.editorState,
380
+ query = _ref9.query,
371
381
  stats = _ref9.stats;
372
382
  firstQueryWithoutResults = null;
373
383
  var pickerElapsedTime = stats.startedAt ? Date.now() - stats.startedAt : 0;
374
384
  fireEvent(buildTypeAheadCancelPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''));
385
+ var pluginState = getMentionPluginState(editorState);
386
+
387
+ if (pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider) {
388
+ var mentionProvider = pluginState.mentionProvider;
389
+
390
+ var _iterator = _createForOfIteratorHelper(subscriptionKeys),
391
+ _step;
392
+
393
+ try {
394
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
395
+ var key = _step.value;
396
+ mentionProvider.unsubscribe(key);
397
+ }
398
+ } catch (err) {
399
+ _iterator.e(err);
400
+ } finally {
401
+ _iterator.f();
402
+ }
403
+ }
404
+
405
+ subscriptionKeys.clear();
375
406
  sessionId = uuid();
376
407
  }
377
408
  };
@@ -13,7 +13,7 @@ import { PanelType } from '@atlaskit/adf-schema';
13
13
  import { PanelSharedCssClassName } from '@atlaskit/editor-common';
14
14
  import { Emoji } from '@atlaskit/editor-common';
15
15
  import { panelAttrsToDom } from '../utils';
16
- var fitToHeight = 20;
16
+ import { akEditorCustomIconSize } from '@atlaskit/editor-shared-styles/consts';
17
17
  export var panelIcons = {
18
18
  info: InfoIcon,
19
19
  success: SuccessIcon,
@@ -36,7 +36,7 @@ export var PanelIcon = function PanelIcon(props) {
36
36
  shortName: panelIcon,
37
37
  showTooltip: false,
38
38
  allowTextFallback: false,
39
- fitToHeight: fitToHeight
39
+ fitToHeight: akEditorCustomIconSize
40
40
  });
41
41
  }
42
42
 
@@ -66,8 +66,10 @@ var PanelNodeView = /*#__PURE__*/function () {
66
66
 
67
67
  if (!this.icon) {
68
68
  return;
69
- }
69
+ } // set contentEditable as false to be able to select the custom panels with keyboard
70
+
70
71
 
72
+ this.icon.contentEditable = 'false';
71
73
  ReactDOM.render( /*#__PURE__*/React.createElement(PanelIcon, {
72
74
  allowCustomPanel: pluginOptions.UNSAFE_allowCustomPanel,
73
75
  panelAttributes: node.attrs,