@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
@@ -48,6 +48,20 @@ describe('emoji-picker-button', () => {
48
48
 
49
49
  expect(wrapper.find('Popup')).toHaveLength(1);
50
50
  });
51
+ it('should close EmojiPicker popup after clicking outside', () => {
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
+ const emojiPicker = wrapper.find('EmojiPickerInternal').instance(); // calling click outside
57
+
58
+ act(() => {
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', () => {
52
66
  // click the button
53
67
  wrapper.find('button').simulate('click'); // make sure the popup and picker are shown
@@ -22,6 +22,7 @@ import { messages } from './messages';
22
22
  import { createItems } from './create-items';
23
23
  import { BlockInsertMenu } from './block-insert-menu';
24
24
  import { insertHorizontalRule } from '../../../rule/commands';
25
+ import withOuterListeners from '../../../../ui/with-outer-listeners';
25
26
  /**
26
27
  * Checks if an element is detached (i.e. not in the current document)
27
28
  */
@@ -30,6 +31,8 @@ const isDetachedElement = el => !document.body.contains(el);
30
31
 
31
32
  const noop = () => {};
32
33
 
34
+ const EmojiPickerWithListeners = withOuterListeners(AkEmojiPicker);
35
+
33
36
  class ToolbarInsertBlock extends React.PureComponent {
34
37
  constructor(...args) {
35
38
  super(...args);
@@ -113,6 +116,20 @@ class ToolbarInsertBlock extends React.PureComponent {
113
116
  });
114
117
  });
115
118
 
119
+ _defineProperty(this, "handleEmojiPressEscape", () => {
120
+ this.toggleEmojiPicker(INPUT_METHOD.KEYBOARD);
121
+ });
122
+
123
+ _defineProperty(this, "handleEmojiClickOutside", e => {
124
+ // Ignore click events for detached elements.
125
+ // Workaround for FS-1322 - where two onClicks fire - one when the upload button is
126
+ // still in the document, and one once it's detached. Does not always occur, and
127
+ // may be a side effect of a react render optimisation
128
+ if (e.target && !isDetachedElement(e.target)) {
129
+ this.toggleEmojiPicker(INPUT_METHOD.TOOLBAR);
130
+ }
131
+ });
132
+
116
133
  _defineProperty(this, "handleEmojiButtonRef", button => {
117
134
  const ref = ReactDOM.findDOMNode(button);
118
135
 
@@ -137,27 +154,6 @@ class ToolbarInsertBlock extends React.PureComponent {
137
154
  }
138
155
  });
139
156
 
140
- _defineProperty(this, "onPickerRef", ref => {
141
- if (ref) {
142
- document.addEventListener('click', this.handleClickOutside);
143
- } else {
144
- document.removeEventListener('click', this.handleClickOutside);
145
- }
146
-
147
- this.pickerRef = ref;
148
- });
149
-
150
- _defineProperty(this, "handleClickOutside", e => {
151
- const picker = this.pickerRef && ReactDOM.findDOMNode(this.pickerRef); // 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
-
156
- if (!picker || e.target && !isDetachedElement(e.target) && !picker.contains(e.target)) {
157
- this.toggleEmojiPicker();
158
- }
159
- });
160
-
161
157
  _defineProperty(this, "toggleLinkPanel", inputMethod => {
162
158
  const {
163
159
  editorView
@@ -501,10 +497,11 @@ class ToolbarInsertBlock extends React.PureComponent {
501
497
  mountTo: popupsMountPoint,
502
498
  boundariesElement: popupsBoundariesElement,
503
499
  scrollableElement: popupsScrollableElement
504
- }, /*#__PURE__*/React.createElement(AkEmojiPicker, {
500
+ }, /*#__PURE__*/React.createElement(EmojiPickerWithListeners, {
505
501
  emojiProvider: emojiProvider,
506
502
  onSelection: this.handleSelectedEmoji,
507
- onPickerRef: this.onPickerRef
503
+ handleClickOutside: this.handleEmojiClickOutside,
504
+ handleEscapeKeydown: this.handleEmojiPressEscape
508
505
  }));
509
506
  }
510
507
 
@@ -7,11 +7,15 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../analyt
7
7
  import { addAnalytics, withAnalytics } from '../analytics/utils';
8
8
  import { LAYOUT_TYPE } from '../analytics/types/node-events';
9
9
  import { pluginKey } from './pm-plugins/plugin-key';
10
+ export const ONE_COL_LAYOUTS = ['single'];
10
11
  export const TWO_COL_LAYOUTS = ['two_equal', 'two_left_sidebar', 'two_right_sidebar'];
11
12
  export const THREE_COL_LAYOUTS = ['three_equal', 'three_with_sidebars'];
12
13
 
13
14
  const getWidthsForPreset = presetLayout => {
14
15
  switch (presetLayout) {
16
+ case 'single':
17
+ return [100];
18
+
15
19
  case 'two_equal':
16
20
  return [50, 50];
17
21
 
@@ -38,6 +42,9 @@ export const getPresetLayout = section => {
38
42
  const widths = mapChildren(section, column => column.attrs.width).join(',');
39
43
 
40
44
  switch (widths) {
45
+ case '100':
46
+ return 'single';
47
+
41
48
  case '33.33,33.33,33.33':
42
49
  return 'three_equal';
43
50
 
@@ -92,6 +99,44 @@ export const insertLayoutColumnsWithAnalytics = inputMethod => withAnalytics({
92
99
  },
93
100
  eventType: EVENT_TYPE.TRACK
94
101
  })(insertLayoutColumns);
102
+ /**
103
+ * Add a column to the right of existing layout
104
+ */
105
+
106
+ function addColumn(schema, pos) {
107
+ return tr => {
108
+ tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos), schema.nodes.layoutColumn.createAndFill());
109
+ };
110
+ }
111
+
112
+ function removeLastColumnInLayout(column, columnPos, insideRightEdgePos) {
113
+ return tr => {
114
+ if (isEmptyDocument(column)) {
115
+ tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(insideRightEdgePos), Slice.empty);
116
+ } else {
117
+ tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(columnPos + 1), Slice.empty);
118
+ }
119
+ };
120
+ }
121
+
122
+ const fromTwoColsToThree = addColumn;
123
+ const fromOneColToTwo = addColumn;
124
+ const fromTwoColsToOne = removeLastColumnInLayout;
125
+ const fromThreeColsToTwo = removeLastColumnInLayout;
126
+
127
+ const fromOneColToThree = (schema, pos) => {
128
+ return tr => {
129
+ addColumn(schema, pos)(tr);
130
+ addColumn(schema, pos)(tr);
131
+ };
132
+ };
133
+
134
+ const fromThreeColstoOne = (node, tr, insideRightEdgePos) => {
135
+ const thirdColumn = node.content.child(2);
136
+ fromThreeColsToTwo(thirdColumn, insideRightEdgePos - thirdColumn.nodeSize, insideRightEdgePos)(tr);
137
+ const secondColumn = node.content.child(1);
138
+ fromTwoColsToOne(secondColumn, insideRightEdgePos - thirdColumn.nodeSize - secondColumn.nodeSize, insideRightEdgePos)(tr);
139
+ };
95
140
  /**
96
141
  * Handles switching from 2 -> 3 cols, or 3 -> 2 cols
97
142
  * Switching from 2 -> 3 just adds a new one at the end
@@ -99,25 +144,28 @@ export const insertLayoutColumnsWithAnalytics = inputMethod => withAnalytics({
99
144
  * removing it
100
145
  */
101
146
 
147
+
102
148
  function forceColumnStructure(state, node, pos, presetLayout) {
103
149
  const tr = state.tr;
104
150
  const insideRightEdgeOfLayoutSection = pos + node.nodeSize - 1;
105
- const numCols = node.childCount;
151
+ const numCols = node.childCount; // 3 columns -> 2 columns
106
152
 
107
153
  if (TWO_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 3) {
108
154
  const thirdColumn = node.content.child(2);
109
- const thirdColumnPos = insideRightEdgeOfLayoutSection - thirdColumn.nodeSize;
110
-
111
- if (isEmptyDocument(thirdColumn)) {
112
- tr.replaceRange( // end pos of second column
113
- tr.mapping.map(thirdColumnPos - 1), tr.mapping.map(insideRightEdgeOfLayoutSection), Slice.empty);
114
- } else {
115
- tr.replaceRange( // end pos of second column
116
- tr.mapping.map(thirdColumnPos - 1), // start pos of third column
117
- tr.mapping.map(thirdColumnPos + 1), Slice.empty);
118
- }
155
+ const columnPos = insideRightEdgeOfLayoutSection - thirdColumn.nodeSize;
156
+ fromThreeColsToTwo(thirdColumn, columnPos, insideRightEdgeOfLayoutSection)(tr); // 2 columns -> 3 columns
119
157
  } else if (THREE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
120
- tr.replaceWith(tr.mapping.map(insideRightEdgeOfLayoutSection), tr.mapping.map(insideRightEdgeOfLayoutSection), state.schema.nodes.layoutColumn.createAndFill());
158
+ fromTwoColsToThree(state.schema, insideRightEdgeOfLayoutSection)(tr); // 2 columns -> 1 column
159
+ } else if (ONE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
160
+ const secondColumn = node.content.child(1);
161
+ const columnPos = insideRightEdgeOfLayoutSection - secondColumn.nodeSize;
162
+ fromTwoColsToOne(secondColumn, columnPos, insideRightEdgeOfLayoutSection)(tr); // 3 columns -> 1 column
163
+ } else if (ONE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 3) {
164
+ fromThreeColstoOne(node, tr, insideRightEdgeOfLayoutSection); // 1 column -> 2 columns
165
+ } else if (TWO_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 1) {
166
+ fromOneColToTwo(state.schema, insideRightEdgeOfLayoutSection)(tr); // 1 column -> 3 columns
167
+ } else if (THREE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 1) {
168
+ fromOneColToThree(state.schema, insideRightEdgeOfLayoutSection)(tr);
121
169
  }
122
170
 
123
171
  return tr;
@@ -209,7 +257,7 @@ function getLayoutChange(node, pos, schema) {
209
257
  return;
210
258
  }
211
259
 
212
- const presetLayout = node.childCount === 2 ? 'two_equal' : 'three_equal';
260
+ const presetLayout = node.childCount === 2 ? 'two_equal' : node.childCount === 3 ? 'three_equal' : 'single';
213
261
  const fixedColumns = columnWidth(node, schema, getWidthsForPreset(presetLayout));
214
262
  return {
215
263
  from: pos + 1,
@@ -306,6 +354,9 @@ export const deleteActiveLayoutNode = (state, dispatch) => {
306
354
 
307
355
  const formatLayoutName = layout => {
308
356
  switch (layout) {
357
+ case 'single':
358
+ return LAYOUT_TYPE.SINGLE_COL;
359
+
309
360
  case 'two_equal':
310
361
  return LAYOUT_TYPE.TWO_COLS_EQUAL;
311
362
 
@@ -34,11 +34,12 @@ const layoutPlugin = (options = {}) => ({
34
34
  const {
35
35
  pos,
36
36
  allowBreakout,
37
- addSidebarLayouts
37
+ addSidebarLayouts,
38
+ allowSingleColumnLayout
38
39
  } = pluginKey.getState(state);
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;
@@ -56,13 +56,15 @@ const getInitialPluginState = (options, state) => {
56
56
  const maybeLayoutSection = findParentNodeOfType(state.schema.nodes.layoutSection)(state.selection);
57
57
  const allowBreakout = options.allowBreakout || false;
58
58
  const addSidebarLayouts = options.UNSAFE_addSidebarLayouts || false;
59
+ const allowSingleColumnLayout = options.UNSAFE_allowSingleColumnLayout || false;
59
60
  const pos = maybeLayoutSection ? maybeLayoutSection.pos : null;
60
61
  const selectedLayout = getSelectedLayout(maybeLayoutSection && maybeLayoutSection.node, DEFAULT_LAYOUT);
61
62
  return {
62
63
  pos,
63
64
  allowBreakout,
64
65
  addSidebarLayouts,
65
- selectedLayout
66
+ selectedLayout,
67
+ allowSingleColumnLayout
66
68
  };
67
69
  };
68
70
 
@@ -1,5 +1,10 @@
1
1
  import { defineMessages } from 'react-intl';
2
2
  export const 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,4 +1,5 @@
1
1
  import { findDomRefAtPos } from 'prosemirror-utils';
2
+ import EditorLayoutSingleIcon from '@atlaskit/icon/glyph/editor/layout-single';
2
3
  import LayoutTwoEqualIcon from '@atlaskit/icon/glyph/editor/layout-two-equal';
3
4
  import LayoutThreeEqualIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
4
5
  import LayoutTwoLeftSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-left-sidebar';
@@ -20,6 +21,12 @@ const LAYOUT_TYPES = [{
20
21
  title: toolbarMessages.threeColumns,
21
22
  icon: LayoutThreeEqualIcon
22
23
  }];
24
+ const LAYOUT_TYPES_WITH_SINGLE_COL = [{
25
+ id: 'editor.layout.singeLayout',
26
+ type: 'single',
27
+ title: toolbarMessages.singleColumn,
28
+ icon: EditorLayoutSingleIcon
29
+ }, ...LAYOUT_TYPES];
23
30
  const SIDEBAR_LAYOUT_TYPES = [{
24
31
  id: 'editor.layout.twoRightSidebar',
25
32
  type: 'two_right_sidebar',
@@ -48,7 +55,7 @@ const buildLayoutButton = (intl, item, currentLayout) => ({
48
55
  });
49
56
 
50
57
  export const layoutToolbarTitle = 'Layout floating controls';
51
- export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts) => {
58
+ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout) => {
52
59
  const node = state.doc.nodeAt(pos);
53
60
 
54
61
  if (node) {
@@ -70,11 +77,12 @@ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts
70
77
  onFocus: hoverDecoration(nodeType, true),
71
78
  onBlur: hoverDecoration(nodeType, false)
72
79
  };
80
+ const layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
73
81
  return {
74
82
  title: layoutToolbarTitle,
75
83
  getDomRef: view => findDomRefAtPos(pos, view.domAtPos.bind(view)),
76
84
  nodeType,
77
- items: [...LAYOUT_TYPES.map(i => buildLayoutButton(intl, i, currentLayout)), ...(addSidebarLayouts ? SIDEBAR_LAYOUT_TYPES.map(i => buildLayoutButton(intl, i, currentLayout)) : []), separator, deleteButton]
85
+ items: [...layoutTypes.map(i => buildLayoutButton(intl, i, currentLayout)), ...(addSidebarLayouts ? SIDEBAR_LAYOUT_TYPES.map(i => buildLayoutButton(intl, i, currentLayout)) : []), separator, deleteButton]
78
86
  };
79
87
  }
80
88
 
@@ -1,11 +1,9 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
2
  import { DecorationSet, Decoration } from 'prosemirror-view';
3
3
  import { findParentNodeOfType } from 'prosemirror-utils';
4
- import { addAnalytics, ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics';
5
4
  import { isWrappingPossible } from '../utils/selection';
6
- import { isListNode, JoinDirection, joinSiblingLists } from '../utils/node';
5
+ import { isListNode } from '../utils/node';
7
6
  import { pluginFactory } from '../../../utils/plugin-state-factory';
8
- import { findRootParentListNode } from '../utils/find';
9
7
  const listPluginKey = new PluginKey('listPlugin');
10
8
  export const pluginKey = listPluginKey;
11
9
  const initialState = {
@@ -104,44 +102,6 @@ const createInitialState = state => {
104
102
  export const createPlugin = eventDispatch => new Plugin({
105
103
  state: createPluginState(eventDispatch, createInitialState),
106
104
  key: listPluginKey,
107
-
108
- appendTransaction(transactions, _oldState, newState) {
109
- const lastTransaction = transactions[transactions.length - 1];
110
-
111
- if (!lastTransaction.docChanged || !lastTransaction.selectionSet) {
112
- return;
113
- }
114
-
115
- const tr = newState.tr;
116
- const rootList = findRootParentListNode(tr.selection.$from);
117
-
118
- if (!rootList) {
119
- return;
120
- }
121
-
122
- const listsJoined = joinSiblingLists({
123
- tr,
124
- direction: JoinDirection.RIGHT
125
- });
126
-
127
- if (tr.docChanged) {
128
- const {
129
- orderedList: orderedListsJoined,
130
- bulletList: bulletListsJoined
131
- } = listsJoined;
132
- addAnalytics(newState, tr, {
133
- action: ACTION.FIXED,
134
- actionSubject: ACTION_SUBJECT.LIST,
135
- eventType: EVENT_TYPE.TRACK,
136
- attributes: {
137
- orderedListsJoined,
138
- bulletListsJoined
139
- }
140
- });
141
- return tr;
142
- }
143
- },
144
-
145
105
  props: {
146
106
  decorations(state) {
147
107
  const {
@@ -69,7 +69,7 @@ export const buildTypeAheadInviteItemViewedPayload = (sessionId, contextIdentifi
69
69
  userRole
70
70
  });
71
71
  };
72
- export const buildTypeAheadInviteExposurePayload = (shouldEnableInvite, sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole) => {
72
+ export const buildTypeAheadInviteExposurePayload = (sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole) => {
73
73
  const {
74
74
  containerId,
75
75
  objectId,
@@ -77,8 +77,7 @@ export const buildTypeAheadInviteExposurePayload = (shouldEnableInvite, sessionI
77
77
  } = contextIdentifierProvider || {};
78
78
  return buildAnalyticsPayload('feature', 'exposed', OPERATIONAL_EVENT_TYPE, sessionId, {
79
79
  flagKey: 'confluence.frontend.invite.from.mention',
80
- value: shouldEnableInvite,
81
- cohort: inviteExperimentCohort,
80
+ value: inviteExperimentCohort || 'not-enrolled',
82
81
  containerId,
83
82
  objectId,
84
83
  childObjectId,
@@ -188,6 +188,7 @@ export const createTypeAheadConfig = ({
188
188
  }) => {
189
189
  let sessionId = uuid();
190
190
  let firstQueryWithoutResults = null;
191
+ const subscriptionKeys = new Set();
191
192
  const typeAhead = {
192
193
  id: TypeAheadAvailableNodes.MENTION,
193
194
  trigger: '@',
@@ -235,8 +236,13 @@ export const createTypeAheadConfig = ({
235
236
  return new Promise(resolve => {
236
237
  const key = `loadingMentionsForTypeAhead_${uuid()}`;
237
238
 
238
- const mentionsSubscribeCallback = (mentions, query = '', stats) => {
239
+ const mentionsSubscribeCallback = (mentions, resultQuery = '', stats) => {
240
+ if (query !== resultQuery) {
241
+ return;
242
+ }
243
+
239
244
  mentionProvider.unsubscribe(key);
245
+ subscriptionKeys.delete(key);
240
246
  const mentionItems = mentions.map(mention => memoizedToItem.call(mention));
241
247
  buildAndSendElementsTypeAheadAnalytics(fireEvent)({
242
248
  query,
@@ -246,6 +252,15 @@ export const createTypeAheadConfig = ({
246
252
 
247
253
  if (mentions.length === 0 && firstQueryWithoutResults === null) {
248
254
  firstQueryWithoutResults = query;
255
+ } // Growth (El-dorado) experiment design hard requirement
256
+
257
+
258
+ if (mentionItems.length <= 2) {
259
+ const {
260
+ inviteExperimentCohort,
261
+ userRole
262
+ } = mentionProvider;
263
+ fireEvent(buildTypeAheadInviteExposurePayload(sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole));
249
264
  }
250
265
 
251
266
  if (!mentionProvider.shouldEnableInvite || mentionItems.length > 2) {
@@ -263,6 +278,7 @@ export const createTypeAheadConfig = ({
263
278
  }
264
279
  };
265
280
 
281
+ subscriptionKeys.add(key);
266
282
  mentionProvider.subscribe(key, mentionsSubscribeCallback);
267
283
  mentionProvider.filter(query || '', { ...contextIdentifierProvider,
268
284
  sessionId
@@ -270,23 +286,8 @@ export const createTypeAheadConfig = ({
270
286
  });
271
287
  },
272
288
 
273
- onOpen: editorState => {
289
+ onOpen: () => {
274
290
  firstQueryWithoutResults = null;
275
- const pluginState = getMentionPluginState(editorState);
276
-
277
- if (!pluginState || !pluginState.mentionProvider) {
278
- return null;
279
- }
280
-
281
- const {
282
- contextIdentifierProvider,
283
- mentionProvider: {
284
- shouldEnableInvite,
285
- inviteExperimentCohort,
286
- userRole
287
- }
288
- } = pluginState;
289
- fireEvent(buildTypeAheadInviteExposurePayload(!!shouldEnableInvite, sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole));
290
291
  },
291
292
 
292
293
  selectItem(state, item, insert, {
@@ -361,12 +362,24 @@ export const createTypeAheadConfig = ({
361
362
  },
362
363
 
363
364
  dismiss({
365
+ editorState,
364
366
  query,
365
367
  stats
366
368
  }) {
367
369
  firstQueryWithoutResults = null;
368
370
  const pickerElapsedTime = stats.startedAt ? Date.now() - stats.startedAt : 0;
369
371
  fireEvent(buildTypeAheadCancelPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''));
372
+ const pluginState = getMentionPluginState(editorState);
373
+
374
+ if (pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider) {
375
+ const mentionProvider = pluginState.mentionProvider;
376
+
377
+ for (let key of subscriptionKeys) {
378
+ mentionProvider.unsubscribe(key);
379
+ }
380
+ }
381
+
382
+ subscriptionKeys.clear();
370
383
  sessionId = uuid();
371
384
  }
372
385
 
@@ -11,7 +11,7 @@ import { PanelType } from '@atlaskit/adf-schema';
11
11
  import { PanelSharedCssClassName } from '@atlaskit/editor-common';
12
12
  import { Emoji } from '@atlaskit/editor-common';
13
13
  import { panelAttrsToDom } from '../utils';
14
- const fitToHeight = 20;
14
+ import { akEditorCustomIconSize } from '@atlaskit/editor-shared-styles/consts';
15
15
  export const panelIcons = {
16
16
  info: InfoIcon,
17
17
  success: SuccessIcon,
@@ -37,7 +37,7 @@ export const PanelIcon = props => {
37
37
  shortName: panelIcon,
38
38
  showTooltip: false,
39
39
  allowTextFallback: false,
40
- fitToHeight: fitToHeight
40
+ fitToHeight: akEditorCustomIconSize
41
41
  });
42
42
  }
43
43
 
@@ -64,8 +64,10 @@ class PanelNodeView {
64
64
 
65
65
  if (!this.icon) {
66
66
  return;
67
- }
67
+ } // set contentEditable as false to be able to select the custom panels with keyboard
68
+
68
69
 
70
+ this.icon.contentEditable = 'false';
69
71
  ReactDOM.render( /*#__PURE__*/React.createElement(PanelIcon, {
70
72
  allowCustomPanel: pluginOptions.UNSAFE_allowCustomPanel,
71
73
  panelAttributes: node.attrs,
@@ -5,7 +5,7 @@ import NoteIcon from '@atlaskit/icon/glyph/editor/note';
5
5
  import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
6
6
  import WarningIcon from '@atlaskit/icon/glyph/editor/warning';
7
7
  import ErrorIcon from '@atlaskit/icon/glyph/editor/error';
8
- import HideEmojiIcon from '../floating-toolbar/ui/EditorHideEmojiIcon';
8
+ import RemoveEmojiIcon from '../floating-toolbar/ui/EditorRemoveEmojiIcon';
9
9
  import commonMessages from '../../messages';
10
10
  import { removePanel, changePanelType } from './actions';
11
11
  import { hoverDecoration } from '../base/pm-plugins/decoration';
@@ -206,13 +206,15 @@ export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabl
206
206
  selected: activePanelType === PanelType.CUSTOM && !!activePanelIcon,
207
207
  onChange: emojiShortName => changeEmoji(emojiShortName)
208
208
  };
209
- items.push(emojiPicker, {
210
- id: 'editor.panel.hideEmoji',
209
+ const removeEmojiButton = {
210
+ id: 'editor.panel.removeEmoji',
211
211
  type: 'button',
212
- icon: HideEmojiIcon,
212
+ icon: RemoveEmojiIcon,
213
213
  onClick: removeEmoji(),
214
- title: formatMessage(commonMessages.hideEmoji)
215
- }, {
214
+ title: formatMessage(commonMessages.removeEmoji),
215
+ disabled: activePanelIcon ? false : true
216
+ };
217
+ items.push(emojiPicker, removeEmojiButton, {
216
218
  type: 'separator'
217
219
  }, colorPicker);
218
220
  }
@@ -71,14 +71,14 @@ describe('getToolbarItems', () => {
71
71
  color: '#ABF5D1'
72
72
  }, true);
73
73
  });
74
- it(`should call changePanelType when clicked on hide emoji`, () => {
75
- const hideEmojiButton = itemsWithCustomPanelEnabled.find(item => item.type === 'button' && item.id === 'editor.panel.hideEmoji');
76
- hideEmojiButton.onClick(editorView.state);
74
+ it(`should call changePanelType when clicked on remove emoji`, () => {
75
+ const removeEmojiButton = itemsWithCustomPanelEnabled.find(item => item.type === 'button' && item.id === 'editor.panel.removeEmoji');
76
+ removeEmojiButton.onClick(editorView.state);
77
77
  expect(changePanelTypespy).toBeCalledWith(PanelType.CUSTOM, {
78
78
  emoji: undefined
79
79
  }, true);
80
80
  });
81
- it(`should not call changePanelType when clicked on hide emoji when no emoji in panel`, () => {
81
+ it(`should not call changePanelType when clicked on remove emoji when no emoji in panel`, () => {
82
82
  const {
83
83
  editorView
84
84
  } = createEditor({
@@ -89,11 +89,21 @@ describe('getToolbarItems', () => {
89
89
  providerFactory
90
90
  });
91
91
  const toolbarItems = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.CUSTOM);
92
- const hideEmojiButton = toolbarItems.find(item => item.type === 'button' && item.id === 'editor.panel.hideEmoji');
92
+ const removeEmojiButton = toolbarItems.find(item => item.type === 'button' && item.id === 'editor.panel.removeEmoji');
93
93
  changePanelTypespy.mockClear();
94
- hideEmojiButton.onClick(editorView.state);
94
+ removeEmojiButton.onClick(editorView.state);
95
95
  expect(changePanelTypespy).not.toBeCalled();
96
96
  });
97
+ it(`should have remove emoji button disabled when focus on panel without emoji`, () => {
98
+ const toolbarItems = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.CUSTOM, '#ABF5D1', '');
99
+ const removeEmojiButton = toolbarItems.find(item => item.type === 'button' && item.id === 'editor.panel.removeEmoji');
100
+ expect(removeEmojiButton.disabled).toBe(true);
101
+ });
102
+ it(`should have remove emoji button enabled when focus on panel with emoji`, () => {
103
+ const toolbarItems = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.CUSTOM, '#ABF5D1', ':smiley:');
104
+ const removeEmojiButton = toolbarItems.find(item => item.type === 'button' && item.id === 'editor.panel.removeEmoji');
105
+ expect(removeEmojiButton.disabled).toBe(false);
106
+ });
97
107
  });
98
108
  describe('analytics for custom panels', () => {
99
109
  const createEditor = createProsemirrorEditorFactory();
@@ -151,10 +161,10 @@ describe('getToolbarItems', () => {
151
161
  expect(createAnalyticsEvent).toHaveBeenCalledWith(payload);
152
162
  });
153
163
  it('Should trigger analytics when Icon is removed', () => {
154
- const hideEmojiButton = itemsWithCustomPanelEnabled.find(item => item.type === 'button' && item.id === 'editor.panel.hideEmoji');
164
+ const removeEmojiButton = itemsWithCustomPanelEnabled.find(item => item.type === 'button' && item.id === 'editor.panel.removeEmoji');
155
165
  const emojiPickerConfig = itemsWithCustomPanelEnabled.find(item => item.type === 'select' && item.selectType === 'emoji');
156
166
  emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
157
- hideEmojiButton.onClick(editorView.state, editorView.dispatch);
167
+ removeEmojiButton.onClick(editorView.state, editorView.dispatch);
158
168
  const payload = {
159
169
  action: ACTION.REMOVE_ICON,
160
170
  actionSubject: ACTION_SUBJECT.PANEL,