@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
@@ -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';
@@ -218,13 +218,15 @@ export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeTy
218
218
  return changeEmoji(emojiShortName);
219
219
  }
220
220
  };
221
- items.push(emojiPicker, {
222
- id: 'editor.panel.hideEmoji',
221
+ var removeEmojiButton = {
222
+ id: 'editor.panel.removeEmoji',
223
223
  type: 'button',
224
- icon: HideEmojiIcon,
224
+ icon: RemoveEmojiIcon,
225
225
  onClick: removeEmoji(),
226
- title: formatMessage(commonMessages.hideEmoji)
227
- }, {
226
+ title: formatMessage(commonMessages.removeEmoji),
227
+ disabled: activePanelIcon ? false : true
228
+ };
229
+ items.push(emojiPicker, removeEmojiButton, {
228
230
  type: 'separator'
229
231
  }, colorPicker);
230
232
  }
@@ -80,16 +80,16 @@ describe('getToolbarItems', function () {
80
80
  color: '#ABF5D1'
81
81
  }, true);
82
82
  });
83
- it("should call changePanelType when clicked on hide emoji", function () {
84
- var hideEmojiButton = itemsWithCustomPanelEnabled.find(function (item) {
85
- return item.type === 'button' && item.id === 'editor.panel.hideEmoji';
83
+ it("should call changePanelType when clicked on remove emoji", function () {
84
+ var removeEmojiButton = itemsWithCustomPanelEnabled.find(function (item) {
85
+ return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
86
86
  });
87
- hideEmojiButton.onClick(editorView.state);
87
+ removeEmojiButton.onClick(editorView.state);
88
88
  expect(changePanelTypespy).toBeCalledWith(PanelType.CUSTOM, {
89
89
  emoji: undefined
90
90
  }, true);
91
91
  });
92
- it("should not call changePanelType when clicked on hide emoji when no emoji in panel", function () {
92
+ it("should not call changePanelType when clicked on remove emoji when no emoji in panel", function () {
93
93
  var _createEditor2 = createEditor({
94
94
  doc: doc(panel({
95
95
  panelType: 'custom'
@@ -100,13 +100,27 @@ describe('getToolbarItems', function () {
100
100
  editorView = _createEditor2.editorView;
101
101
 
102
102
  var toolbarItems = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.CUSTOM);
103
- var hideEmojiButton = toolbarItems.find(function (item) {
104
- return item.type === 'button' && item.id === 'editor.panel.hideEmoji';
103
+ var removeEmojiButton = toolbarItems.find(function (item) {
104
+ return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
105
105
  });
106
106
  changePanelTypespy.mockClear();
107
- hideEmojiButton.onClick(editorView.state);
107
+ removeEmojiButton.onClick(editorView.state);
108
108
  expect(changePanelTypespy).not.toBeCalled();
109
109
  });
110
+ it("should have remove emoji button disabled when focus on panel without emoji", function () {
111
+ var toolbarItems = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.CUSTOM, '#ABF5D1', '');
112
+ var removeEmojiButton = toolbarItems.find(function (item) {
113
+ return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
114
+ });
115
+ expect(removeEmojiButton.disabled).toBe(true);
116
+ });
117
+ it("should have remove emoji button enabled when focus on panel with emoji", function () {
118
+ var toolbarItems = getToolbarItems(dummyFormatMessage, defaultSchema.nodes.panel, true, providerFactory, PanelType.CUSTOM, '#ABF5D1', ':smiley:');
119
+ var removeEmojiButton = toolbarItems.find(function (item) {
120
+ return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
121
+ });
122
+ expect(removeEmojiButton.disabled).toBe(false);
123
+ });
110
124
  });
111
125
  describe('analytics for custom panels', function () {
112
126
  var createEditor = createProsemirrorEditorFactory();
@@ -169,14 +183,14 @@ describe('getToolbarItems', function () {
169
183
  expect(createAnalyticsEvent).toHaveBeenCalledWith(payload);
170
184
  });
171
185
  it('Should trigger analytics when Icon is removed', function () {
172
- var hideEmojiButton = itemsWithCustomPanelEnabled.find(function (item) {
173
- return item.type === 'button' && item.id === 'editor.panel.hideEmoji';
186
+ var removeEmojiButton = itemsWithCustomPanelEnabled.find(function (item) {
187
+ return item.type === 'button' && item.id === 'editor.panel.removeEmoji';
174
188
  });
175
189
  var emojiPickerConfig = itemsWithCustomPanelEnabled.find(function (item) {
176
190
  return item.type === 'select' && item.selectType === 'emoji';
177
191
  });
178
192
  emojiPickerConfig.onChange(':smiley:')(editorView.state, editorView.dispatch);
179
- hideEmojiButton.onClick(editorView.state, editorView.dispatch);
193
+ removeEmojiButton.onClick(editorView.state, editorView.dispatch);
180
194
  var payload = {
181
195
  action: ACTION.REMOVE_ICON,
182
196
  actionSubject: ACTION_SUBJECT.PANEL,
@@ -6,8 +6,10 @@ import { safeInsert } from 'prosemirror-utils';
6
6
  import { AddColumnStep } from '@atlaskit/adf-schema/steps';
7
7
  import { getPluginState } from '../pm-plugins/plugin-factory';
8
8
  import { checkIfHeaderRowEnabled, copyPreviousRow } from '../utils';
9
- import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step'; // #endregion
9
+ import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
10
+ import { rescaleColumns } from '../transforms/column-width';
10
11
 
12
+ // #endregion
11
13
  function addColumnAtCustomStep(column) {
12
14
  return function (tr) {
13
15
  var table = findTable(tr.selection);
@@ -22,17 +24,30 @@ function addColumnAtCustomStep(column) {
22
24
 
23
25
  function addColumnAt(column) {
24
26
  var allowAddColumnCustomStep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
27
+ var view = arguments.length > 2 ? arguments[2] : undefined;
28
+ return function (tr) {
29
+ var updatedTr = tr;
25
30
 
26
- if (allowAddColumnCustomStep) {
27
- return addColumnAtCustomStep(column);
28
- }
31
+ if (allowAddColumnCustomStep) {
32
+ updatedTr = addColumnAtCustomStep(column)(updatedTr);
33
+ } else {
34
+ updatedTr = addColumnAtPMUtils(column)(updatedTr);
35
+ }
29
36
 
30
- return addColumnAtPMUtils(column);
37
+ var table = findTable(updatedTr.selection);
38
+
39
+ if (table) {
40
+ // [ED-8288] Update colwidths manually to avoid multiple dispatch in TableComponent
41
+ updatedTr = rescaleColumns(table, view)(updatedTr);
42
+ }
43
+
44
+ return updatedTr;
45
+ };
31
46
  } // :: (EditorState, dispatch: ?(tr: Transaction)) → bool
32
47
  // Command to add a column before the column with the selection.
33
48
 
34
49
 
35
- export var addColumnBefore = function addColumnBefore(state, dispatch) {
50
+ export var addColumnBefore = function addColumnBefore(state, dispatch, view) {
36
51
  var table = findTable(state.selection);
37
52
 
38
53
  if (!table) {
@@ -41,14 +56,14 @@ export var addColumnBefore = function addColumnBefore(state, dispatch) {
41
56
 
42
57
  if (dispatch) {
43
58
  var rect = selectedRect(state);
44
- dispatch(addColumnAt(rect.left, getAllowAddColumnCustomStep(state))(state.tr));
59
+ dispatch(addColumnAt(rect.left, getAllowAddColumnCustomStep(state), view)(state.tr));
45
60
  }
46
61
 
47
62
  return true;
48
63
  }; // :: (EditorState, dispatch: ?(tr: Transaction)) → bool
49
64
  // Command to add a column after the column with the selection.
50
65
 
51
- export var addColumnAfter = function addColumnAfter(state, dispatch) {
66
+ export var addColumnAfter = function addColumnAfter(state, dispatch, view) {
52
67
  var table = findTable(state.selection);
53
68
 
54
69
  if (!table) {
@@ -57,15 +72,15 @@ export var addColumnAfter = function addColumnAfter(state, dispatch) {
57
72
 
58
73
  if (dispatch) {
59
74
  var rect = selectedRect(state);
60
- dispatch(addColumnAt(rect.right, getAllowAddColumnCustomStep(state))(state.tr));
75
+ dispatch(addColumnAt(rect.right, getAllowAddColumnCustomStep(state), view)(state.tr));
61
76
  }
62
77
 
63
78
  return true;
64
79
  }; // #region Commands
65
80
 
66
81
  export var insertColumn = function insertColumn(column) {
67
- return function (state, dispatch) {
68
- var tr = addColumnAt(column, getAllowAddColumnCustomStep(state))(state.tr);
82
+ return function (state, dispatch, view) {
83
+ var tr = addColumnAt(column, getAllowAddColumnCustomStep(state), view)(state.tr);
69
84
  var table = findTable(tr.selection);
70
85
 
71
86
  if (!table) {
@@ -98,7 +98,7 @@ export var setCellAttr = function setCellAttr(name, value) {
98
98
  };
99
99
  };
100
100
  export var triggerUnlessTableHeader = function triggerUnlessTableHeader(command) {
101
- return function (state, dispatch) {
101
+ return function (state, dispatch, view) {
102
102
  var selection = state.selection,
103
103
  tableHeader = state.schema.nodes.tableHeader;
104
104
 
@@ -106,7 +106,7 @@ export var triggerUnlessTableHeader = function triggerUnlessTableHeader(command)
106
106
  var cell = findCellClosestToPos(selection.$from);
107
107
 
108
108
  if (cell && cell.node.type !== tableHeader) {
109
- return command(state, dispatch);
109
+ return command(state, dispatch, view);
110
110
  }
111
111
  }
112
112
 
@@ -114,7 +114,7 @@ export var triggerUnlessTableHeader = function triggerUnlessTableHeader(command)
114
114
  var rect = getSelectionRect(selection);
115
115
 
116
116
  if (!checkIfHeaderRowEnabled(state) || rect && rect.top > 0) {
117
- return command(state, dispatch);
117
+ return command(state, dispatch, view);
118
118
  }
119
119
  }
120
120
 
@@ -177,16 +177,17 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
177
177
  var layoutSize = _this.tableNodeLayoutSize(node, containerWidth.width, options);
178
178
 
179
179
  var hasNumberedColumnChanged = prevAttrs.isNumberColumnEnabled !== node.attrs.isNumberColumnEnabled;
180
+ var noOfColumnsChanged = tablesHaveDifferentNoOfColumns(node, prevNode);
180
181
 
181
182
  if ( // Breakout mode/layout changed
182
183
  layoutChanged || // We need to react if our parent changes
183
184
  // Scales the cols widths relative to the new parent width.
184
185
  parentWidthChanged || // Enabling / disabling this feature reduces or adds size to the table.
185
- hasNumberedColumnChanged || // Adding or removing columns from the table, should snap the remaining / new columns to the layout width.
186
- tablesHaveDifferentNoOfColumns(node, prevNode) || // This last check is also to cater for dynamic text sizing changing the 'default' layout width
186
+ hasNumberedColumnChanged || // This last check is also to cater for dynamic text sizing changing the 'default' layout width
187
187
  // Usually happens on window resize.
188
- layoutSize !== _this.layoutSize) {
189
- if (!hasNumberedColumnChanged) {
188
+ layoutSize !== _this.layoutSize || noOfColumnsChanged) {
189
+ // If column has been inserted/deleted avoid multi dispatch
190
+ if (!hasNumberedColumnChanged && !noOfColumnsChanged) {
190
191
  _this.scaleTable({
191
192
  parentWidth: parentWidth,
192
193
  layoutChanged: layoutChanged
@@ -3,7 +3,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import uuid from 'uuid';
5
5
  import { DOMSerializer } from 'prosemirror-model';
6
- import { setCellAttrs } from '@atlaskit/adf-schema';
6
+ import { getCellDomAttrs, getCellAttrs } from '@atlaskit/adf-schema';
7
7
  import { getFeatureFlags } from '../../feature-flags-context';
8
8
 
9
9
  var TableCellNodeView = /*#__PURE__*/function () {
@@ -33,16 +33,30 @@ var TableCellNodeView = /*#__PURE__*/function () {
33
33
  }
34
34
 
35
35
  _createClass(TableCellNodeView, [{
36
- key: "shouldRecreateNodeView",
37
- value: function shouldRecreateNodeView(node) {
36
+ key: "updateNodeView",
37
+ value: function updateNodeView(node) {
38
38
  var _this = this;
39
39
 
40
40
  if (this.node.type !== node.type) {
41
41
  return false;
42
42
  }
43
43
 
44
- var attrs = setCellAttrs(this.node);
45
- var nextAttrs = setCellAttrs(node); // added + changed attributes
44
+ var attrs = getCellDomAttrs(this.node);
45
+ var nextAttrs = getCellDomAttrs(node);
46
+
47
+ var _getCellAttrs = getCellAttrs(this.dom),
48
+ colspan = _getCellAttrs.colspan,
49
+ rowspan = _getCellAttrs.rowspan; // need to rerender when colspan/rowspan in dom are different from the node attrs
50
+ // this can happen when undoing merge cells
51
+
52
+
53
+ var defaultColspan = 1,
54
+ defaultRowspan = 1;
55
+
56
+ if (colspan !== (node.attrs.colspan || defaultColspan) || rowspan !== (node.attrs.rowspan || defaultRowspan)) {
57
+ return false;
58
+ } // added + changed attributes
59
+
46
60
 
47
61
  var addedAttrs = Object.entries(nextAttrs).filter(function (_ref2) {
48
62
  var _ref3 = _slicedToArray(_ref2, 2),
@@ -79,9 +93,9 @@ var TableCellNodeView = /*#__PURE__*/function () {
79
93
  }, {
80
94
  key: "update",
81
95
  value: function update(node) {
82
- var shouldUpdate = this.shouldRecreateNodeView(node);
96
+ var didUpdate = this.updateNodeView(node);
83
97
  this.node = node;
84
- return shouldUpdate;
98
+ return didUpdate;
85
99
  }
86
100
  }, {
87
101
  key: "destroy",
@@ -249,7 +249,7 @@ export var areColumnsEven = function areColumnsEven(resizeState) {
249
249
  });
250
250
  }; // Get the layout
251
251
 
252
- var normaliseTableLayout = function normaliseTableLayout(input) {
252
+ export var normaliseTableLayout = function normaliseTableLayout(input) {
253
253
  switch (input) {
254
254
  case 'wide':
255
255
  return input;
@@ -261,7 +261,6 @@ var normaliseTableLayout = function normaliseTableLayout(input) {
261
261
  return 'default';
262
262
  }
263
263
  };
264
-
265
264
  export var getNewResizeStateFromSelectedColumns = function getNewResizeStateFromSelectedColumns(rect, state, domAtPos, dynamicTextSizing) {
266
265
  var _getSelectedTableInfo = getSelectedTableInfo(state.selection),
267
266
  totalRowCount = _getSelectedTableInfo.totalRowCount,
@@ -82,7 +82,7 @@ export var scaleWithParent = function scaleWithParent(tableRef, parentWidth, tab
82
82
  return scaleTableTo(resizeState, Math.floor(parentWidth));
83
83
  }; // Scales the table to a given size and updates its colgroup DOM node
84
84
 
85
- function scaleTableTo(state, maxSize) {
85
+ export function scaleTableTo(state, maxSize) {
86
86
  var scaleFactor = maxSize / getTotalWidth(state);
87
87
 
88
88
  var newState = _objectSpread(_objectSpread({}, state), {}, {
@@ -102,12 +102,12 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
102
102
  var options = [{
103
103
  id: 'editor.table.insertColumn',
104
104
  title: formatMessage(tableMessages.insertColumn),
105
- onClick: function onClick(state, dispatch) {
105
+ onClick: function onClick(state, dispatch, view) {
106
106
  var selectionRect = getClosestSelectionRect(state);
107
107
  var index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.right;
108
108
 
109
109
  if (index) {
110
- insertColumnWithAnalytics(INPUT_METHOD.FLOATING_TB, index)(state, dispatch);
110
+ insertColumnWithAnalytics(INPUT_METHOD.FLOATING_TB, index)(state, dispatch, view);
111
111
  }
112
112
 
113
113
  return true;
@@ -137,11 +137,11 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
137
137
  title: formatMessage(tableMessages.removeColumns, {
138
138
  0: numberOfColumns
139
139
  }),
140
- onClick: function onClick(state, dispatch) {
140
+ onClick: function onClick(state, dispatch, view) {
141
141
  var selectionRect = getClosestSelectionRect(state);
142
142
 
143
143
  if (selectionRect) {
144
- deleteColumnsWithAnalytics(INPUT_METHOD.FLOATING_TB, selectionRect)(state, dispatch);
144
+ deleteColumnsWithAnalytics(INPUT_METHOD.FLOATING_TB, selectionRect)(state, dispatch, view);
145
145
  }
146
146
 
147
147
  return true;
@@ -5,7 +5,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
6
 
7
7
  import { TableMap } from '@atlaskit/editor-tables/table-map';
8
+ import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils';
8
9
  import { setMeta } from './metadata';
10
+ import { getResizeState, normaliseTableLayout } from '../pm-plugins/table-resizing/utils/resize-state';
11
+ import { getTableMaxWidth } from '../pm-plugins/table-resizing/utils/misc';
12
+ import { tableCellMinWidth } from '@atlaskit/editor-common';
13
+ import { scaleTableTo } from '../pm-plugins/table-resizing/utils/scale-table';
9
14
  export var updateColumnWidths = function updateColumnWidths(resizeState, table, start) {
10
15
  return function (tr) {
11
16
  var map = TableMap.get(table);
@@ -93,19 +98,66 @@ export var updateColumnWidths = function updateColumnWidths(resizeState, table,
93
98
  }
94
99
 
95
100
  var tablePos = start - 1;
96
- var _tr = tr,
97
- selection = _tr.selection;
98
- /* Create a mapping before the table node is replaced to allow the current
99
- * selection to be mapped back to it's original position inside the table.
101
+ var selectionBookmark = tr.selection.getBookmark();
102
+ tr.replaceWith(tablePos, tablePos + table.nodeSize, table.type.createChecked(table.attrs, rows, table.marks));
103
+ /**
104
+ * We want to restore to the original selection but w/o applying the mapping. Function
105
+ * tr.replaceWith puts the selection after the inserted content. We need to manually
106
+ * set the selection back to original state. Mapping in this case doesn't quite work
107
+ * e.g. if we change the content before a selection. This is because mapping
108
+ * means moving it if the content in front of it changed. Instead we can get
109
+ * bookmark of selection.
100
110
  *
101
- * If the mapping from the new 'replaceWith' transaction is used, prosemirror
102
- * will map the selection to after the table as it thinks the original table
103
- * node has been deleted.
111
+ * @see https://github.com/ProseMirror/prosemirror/issues/645
104
112
  */
105
113
 
106
- var originalMap = Object.assign(Object.create(Object.getPrototypeOf(tr.mapping)), tr.mapping);
107
- tr.replaceWith(tablePos, tablePos + table.nodeSize, table.type.createChecked(table.attrs, rows, table.marks)); // restore selection after replacing the table
114
+ return tr.setSelection(selectionBookmark.resolve(tr.doc));
115
+ };
116
+ };
117
+ /**
118
+ * This function is called when user inserts/deletes a column in a table to rescale all columns.
119
+ * This is done manually to avoid a multi-dispatch in TableComponent. See [ED-8288].
120
+ * @param table
121
+ * @param view
122
+ * @returns Updated transaction with rescaled columns for a given table
123
+ */
124
+
125
+ export var rescaleColumns = function rescaleColumns(table, view) {
126
+ return function (tr) {
127
+ if (!view || !hasTableBeenResized(table.node)) {
128
+ return tr;
129
+ }
130
+
131
+ var state = view.state;
132
+ var domAtPos = view.domAtPos.bind(view);
133
+ var maybeTable = domAtPos(table.start).node;
134
+ var tableRef = maybeTable.closest('table');
135
+
136
+ if (!tableRef) {
137
+ return tr;
138
+ }
139
+
140
+ var layout = normaliseTableLayout(tableRef === null || tableRef === void 0 ? void 0 : tableRef.dataset.layout);
141
+ var maxSize = getTableMaxWidth({
142
+ table: table.node,
143
+ tableStart: table.start,
144
+ state: state,
145
+ layout: layout,
146
+ dynamicTextSizing: true
147
+ });
148
+ var resizeState = getResizeState({
149
+ minWidth: tableCellMinWidth,
150
+ table: table.node,
151
+ start: table.start,
152
+ tableRef: tableRef,
153
+ domAtPos: domAtPos,
154
+ maxSize: maxSize
155
+ });
156
+
157
+ if (resizeState.overflow) {
158
+ resizeState = scaleTableTo(resizeState, maxSize);
159
+ }
108
160
 
109
- return tr.setSelection(selection.map(tr.doc, originalMap));
161
+ return updateColumnWidths(resizeState, table.node, table.start)(tr);
110
162
  };
111
163
  };
@@ -316,7 +316,7 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
316
316
  break;
317
317
 
318
318
  case 'insert_column':
319
- insertColumnWithAnalytics(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch);
319
+ insertColumnWithAnalytics(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
320
320
 
321
321
  _this.toggleOpen();
322
322
 
@@ -198,7 +198,7 @@ var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
198
198
  event.preventDefault();
199
199
  var state = editorView.state,
200
200
  dispatch = editorView.dispatch;
201
- insertColumnWithAnalytics(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch);
201
+ insertColumnWithAnalytics(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
202
202
  }
203
203
  }
204
204
  }]);
@@ -1,3 +1,4 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  import { TableMap } from '@atlaskit/editor-tables/table-map';
2
3
  import { findTable } from '@atlaskit/editor-tables/utils';
3
4
  export var getMergedCellsPositions = function getMergedCellsPositions(tr) {
@@ -18,4 +19,12 @@ export var getMergedCellsPositions = function getMergedCellsPositions(tr) {
18
19
  }
19
20
  });
20
21
  return mergedCells;
22
+ };
23
+ export var colsToRect = function colsToRect(cols, noOfRows) {
24
+ return {
25
+ left: Math.min.apply(Math, _toConsumableArray(cols)),
26
+ right: Math.max.apply(Math, _toConsumableArray(cols)) + 1,
27
+ top: 0,
28
+ bottom: noOfRows
29
+ };
21
30
  };
@@ -144,12 +144,6 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
144
144
  isOpen = _this$state.isOpen,
145
145
  isShowingMoreColors = _this$state.isShowingMoreColors;
146
146
 
147
- if (e.defaultPrevented) {
148
- // This should be handled by stopping propogation, but as an additional safety net
149
- // we ignore handled events for the purpose of hiding the popup.
150
- return;
151
- }
152
-
153
147
  if (isOpen === true) {
154
148
  _this.dispatchAnalyticsEvent(_this.buildAnalyticsPalette(ACTION.CLOSED, {
155
149
  isShowingMoreColors: isShowingMoreColors,
@@ -237,13 +231,15 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
237
231
  label: ""
238
232
  })))
239
233
  })
234
+ }, /*#__PURE__*/React.createElement("div", {
235
+ "data-testid": "text-color-palette"
240
236
  }, /*#__PURE__*/React.createElement(ColorPalette, {
241
237
  palette: palette,
242
238
  onClick: function onClick(color) {
243
239
  return _this2.changeTextColor(color, pluginState.disabled);
244
240
  },
245
241
  selectedColor: pluginState.color
246
- }), showMoreColorsToggle && /*#__PURE__*/React.createElement(ShowMoreWrapper, null, /*#__PURE__*/React.createElement(Button, {
242
+ })), showMoreColorsToggle && /*#__PURE__*/React.createElement(ShowMoreWrapper, null, /*#__PURE__*/React.createElement(Button, {
247
243
  appearance: "subtle",
248
244
  onClick: this.handleShowMoreToggle,
249
245
  iconBefore: /*#__PURE__*/React.createElement(EditorBackgroundColorIcon, {
@@ -8,10 +8,9 @@ import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
8
8
  import { Popup } from '@atlaskit/editor-common';
9
9
  import { borderRadius, gridSize } from '@atlaskit/theme/constants';
10
10
  import { N0, N60A, N50A } from '@atlaskit/theme/colors';
11
- import { divide } from '@atlaskit/theme/math';
12
11
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics';
13
12
  import { TypeAheadList } from './TypeAheadList';
14
- var TypeAheadContent = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: ", ";\n border-radius: ", "px;\n box-shadow: 0 0 1px ", ", 0 4px 8px -2px ", ";\n padding: ", "px 0;\n width: 320px;\n max-height: 380px; /* ~5.5 visibile items */\n overflow-y: auto;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n position: relative;\n"])), N0, borderRadius(), N60A, N50A, divide(gridSize, 2));
13
+ var TypeAheadContent = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: ", ";\n border-radius: ", "px;\n box-shadow: 0 0 1px ", ", 0 4px 8px -2px ", ";\n padding: ", "px 0;\n width: 320px;\n max-height: 380px; /* ~5.5 visibile items */\n overflow-y: auto;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n position: relative;\n"])), N0, borderRadius(), N60A, N50A, gridSize() / 2);
15
14
 
16
15
  var Highlight = function Highlight(_ref) {
17
16
  var state = _ref.state,
@@ -5,7 +5,7 @@ var _templateObject, _templateObject2;
5
5
 
6
6
  import React from 'react';
7
7
  import styled from 'styled-components';
8
- import { Popup } from '@atlaskit/editor-common';
8
+ import { Popup, withOuterListeners } from '@atlaskit/editor-common';
9
9
  import Button from '@atlaskit/button';
10
10
  import Tooltip from '@atlaskit/tooltip';
11
11
  import { N60A } from '@atlaskit/theme/colors';
@@ -34,6 +34,8 @@ var ColorPickerButton = function ColorPickerButton(props) {
34
34
  setIsPopupOpen(!isPopupOpen);
35
35
  };
36
36
 
37
+ var ColorPaletteWithListeners = withOuterListeners(ColorPalette);
38
+
37
39
  var onColorSelected = function onColorSelected(color, label) {
38
40
  setIsPopupOpen(false);
39
41
 
@@ -72,11 +74,12 @@ var ColorPickerButton = function ColorPickerButton(props) {
72
74
  fitWidth: 350,
73
75
  offset: [0, 10],
74
76
  alignX: props.alignX
75
- }, /*#__PURE__*/React.createElement(ColorPickerWrapper, null, /*#__PURE__*/React.createElement(ColorPalette, {
77
+ }, /*#__PURE__*/React.createElement(ColorPickerWrapper, null, /*#__PURE__*/React.createElement(ColorPaletteWithListeners, {
76
78
  palette: props.colorPalette,
77
79
  cols: props.cols,
78
80
  selectedColor: props.currentColor || null,
79
- onClick: onColorSelected
81
+ onClick: onColorSelected,
82
+ handleClickOutside: togglePopup
80
83
  })));
81
84
  };
82
85
 
@@ -11,6 +11,7 @@ import { mockCreateAnalyticsEvent, mockFire } from '@atlaskit/editor-test-helper
11
11
  import ColorPickerButton from './index';
12
12
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../plugins/analytics/types';
13
13
  import { editorAnalyticsChannel } from '../../plugins/analytics/consts';
14
+ import { act } from 'react-dom/test-utils';
14
15
  describe('color-picker-button', function () {
15
16
  var onChangeMock = jest.fn();
16
17
 
@@ -49,6 +50,20 @@ describe('color-picker-button', function () {
49
50
  expect(wrapper.find('ColorPalette')).toHaveLength(1);
50
51
  expect(wrapper.find('Color')).toHaveLength(21);
51
52
  });
53
+ it('should close ColorPalette popup after clicking outside', function () {
54
+ var wrapper = getWrapper(); // show the popup
55
+
56
+ wrapper.find('button').simulate('click'); // make sure the popup and picker are shown
57
+
58
+ expect(wrapper.find('Popup')).toHaveLength(1);
59
+ var colorPalette = wrapper.find('InjectIntl(ColorPalette)').instance();
60
+ act(function () {
61
+ colorPalette.props.handleClickOutside();
62
+ });
63
+ wrapper.update(); // make sure popup is hidden
64
+
65
+ expect(wrapper.find('Popup')).toHaveLength(0);
66
+ });
52
67
  it('should hide popup and call onChange after selecting a color', function () {
53
68
  var wrapper = getWrapper();
54
69
  selectColor(wrapper, 'Mintie'); // ensure popup is hidden
@@ -12,10 +12,9 @@ import ChevronRightIcon from '@atlaskit/icon/glyph/chevron-right';
12
12
  import Button from '@atlaskit/button';
13
13
  import { gridSize } from '@atlaskit/theme/constants';
14
14
  import { messages } from '../messages';
15
- import { multiply } from '@atlaskit/theme/math';
16
15
  export var ExpandContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-bottom: 1px solid ", ";\n"])), N40);
17
- export var ExpandControl = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n height: ", "px;\n justify-content: center;\n padding-right: ", "px;\n"])), multiply(gridSize, 6), gridSize());
18
- var ChevronContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n\n & > button {\n width: ", "px;\n height: ", "px;\n }\n"])), multiply(gridSize, 3), multiply(gridSize, 3));
16
+ export var ExpandControl = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n height: ", "px;\n justify-content: center;\n padding-right: ", "px;\n"])), gridSize() * 6, gridSize());
17
+ var ChevronContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n\n & > button {\n width: ", "px;\n height: ", "px;\n }\n"])), gridSize() * 3, gridSize() * 3);
19
18
  var LabelContainer = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 100%;\n align-items: center;\n display: flex;\n font-weight: 500;\n"])));
20
19
  var ExpandContentContainer = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: ", ";\n margin-top: -", "px;\n"])), function (_ref) {
21
20
  var isHidden = _ref.isHidden;
@@ -31,9 +31,8 @@ import { messages } from '../messages'; // eslint-disable-next-line import/no-cy
31
31
  import FormContent from '../FormContent';
32
32
  import { getNameFromDuplicateField, isDuplicateField } from '../utils';
33
33
  import { gridSize } from '@atlaskit/theme/constants';
34
- import { multiply } from '@atlaskit/theme/math';
35
34
  import { N40A } from '@atlaskit/theme/colors';
36
- var ActionsWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-top: 1px solid ", ";\n margin-top: ", "px;\n padding-top: ", "px;\n"])), N40A, multiply(gridSize, 2), multiply(gridSize, 2));
35
+ var ActionsWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-top: 1px solid ", ";\n margin-top: ", "px;\n padding-top: ", "px;\n"])), N40A, gridSize() * 2, gridSize() * 2);
37
36
 
38
37
  var populateFromParameters = function populateFromParameters(parameters, fields) {
39
38
  if (Object.keys(parameters).length) {
@@ -6,13 +6,12 @@ import React from 'react';
6
6
  import { injectIntl } from 'react-intl';
7
7
  import styled from 'styled-components';
8
8
  import { gridSize } from '@atlaskit/theme/constants';
9
- import { multiply } from '@atlaskit/theme/math';
10
9
  import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
11
10
  import Tooltip from '@atlaskit/tooltip';
12
11
  import * as colors from '@atlaskit/theme/colors';
13
12
  import { messages } from '../messages';
14
13
  var RemovableFieldWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n margin-bottom: ", "px;\n"])), function (props) {
15
- return props.hasMarginBottom ? multiply(gridSize, 2) : 0;
14
+ return props.hasMarginBottom ? gridSize() * 2 : 0;
16
15
  });
17
16
  var RemoveButtonWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n right: 0;\n top: 0;\n cursor: pointer;\n\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n"])), colors.N80, colors.R300);
18
17
 
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "149.0.2";
2
+ export var version = "150.0.3";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };