@atlaskit/editor-core 149.0.0 → 150.0.1

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 (299) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/cjs/create-editor/create-plugins-list.js +2 -1
  3. package/dist/cjs/editor.js +1 -4
  4. package/dist/cjs/i18n/cs.js +18 -2
  5. package/dist/cjs/i18n/da.js +18 -2
  6. package/dist/cjs/i18n/de.js +18 -2
  7. package/dist/cjs/i18n/es.js +13 -2
  8. package/dist/cjs/i18n/et.js +0 -1
  9. package/dist/cjs/i18n/fi.js +13 -2
  10. package/dist/cjs/i18n/fr.js +13 -2
  11. package/dist/cjs/i18n/hu.js +14 -3
  12. package/dist/cjs/i18n/it.js +18 -2
  13. package/dist/cjs/i18n/ja.js +13 -2
  14. package/dist/cjs/i18n/ko.js +13 -2
  15. package/dist/cjs/i18n/nb.js +13 -2
  16. package/dist/cjs/i18n/nl.js +18 -2
  17. package/dist/cjs/i18n/pl.js +16 -2
  18. package/dist/cjs/i18n/pt_BR.js +14 -3
  19. package/dist/cjs/i18n/pt_PT.js +0 -1
  20. package/dist/cjs/i18n/ru.js +13 -2
  21. package/dist/cjs/i18n/sk.js +0 -1
  22. package/dist/cjs/i18n/sv.js +18 -2
  23. package/dist/cjs/i18n/th.js +18 -2
  24. package/dist/cjs/i18n/tr.js +16 -2
  25. package/dist/cjs/i18n/uk.js +18 -2
  26. package/dist/cjs/i18n/vi.js +13 -2
  27. package/dist/cjs/i18n/zh.js +18 -2
  28. package/dist/cjs/i18n/zh_TW.js +18 -2
  29. package/dist/cjs/messages.js +4 -4
  30. package/dist/cjs/nodeviews/SelectionBasedNodeView.js +1 -2
  31. package/dist/cjs/plugins/analytics/types/enums.js +0 -1
  32. package/dist/cjs/plugins/analytics/types/node-events.js +1 -0
  33. package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -3
  34. package/dist/cjs/plugins/expand/pm-plugins/keymap.js +2 -2
  35. package/dist/cjs/plugins/extension/actions.js +16 -16
  36. package/dist/cjs/plugins/extension/pm-plugins/main.js +4 -4
  37. package/dist/cjs/plugins/floating-toolbar/ui/{EditorHideEmojiIcon.js → EditorRemoveEmojiIcon.js} +2 -2
  38. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +5 -2
  39. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +14 -0
  40. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +19 -22
  41. package/dist/cjs/plugins/layout/actions.js +70 -16
  42. package/dist/cjs/plugins/layout/index.js +3 -2
  43. package/dist/cjs/plugins/layout/pm-plugins/main.js +3 -1
  44. package/dist/cjs/plugins/layout/toolbar-messages.js +5 -0
  45. package/dist/cjs/plugins/layout/toolbar.js +11 -2
  46. package/dist/cjs/plugins/list/pm-plugins/main.js +0 -38
  47. package/dist/cjs/plugins/macro/actions.js +14 -14
  48. package/dist/cjs/plugins/mentions/analytics.js +2 -3
  49. package/dist/cjs/plugins/mentions/type-ahead/index.js +7 -12
  50. package/dist/cjs/plugins/panel/nodeviews/panel.js +7 -3
  51. package/dist/cjs/plugins/panel/toolbar.js +8 -6
  52. package/dist/cjs/plugins/panel/toolbar.test.js +25 -11
  53. package/dist/cjs/plugins/paste/handlers.js +2 -2
  54. package/dist/cjs/plugins/selection/gap-cursor/actions.js +5 -6
  55. package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +1 -3
  56. package/dist/cjs/plugins/table/commands/insert.js +25 -10
  57. package/dist/cjs/plugins/table/commands/misc.js +3 -3
  58. package/dist/cjs/plugins/table/commands/selection.js +24 -24
  59. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +5 -4
  60. package/dist/cjs/plugins/table/nodeviews/tableCell.js +20 -6
  61. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +17 -16
  62. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +1 -0
  63. package/dist/cjs/plugins/table/toolbar.js +4 -4
  64. package/dist/cjs/plugins/table/transforms/column-width.js +72 -12
  65. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
  66. package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +1 -1
  67. package/dist/cjs/plugins/table/utils/table.js +17 -2
  68. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
  69. package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
  70. package/dist/cjs/plugins/text-formatting/pm-plugins/cursor.js +1 -4
  71. package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
  72. package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +5 -3
  73. package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +1 -3
  74. package/dist/cjs/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +1 -3
  75. package/dist/cjs/ui/ColorPickerButton/index.js +5 -2
  76. package/dist/cjs/ui/ColorPickerButton/index.test.js +16 -0
  77. package/dist/cjs/ui/ConfigPanel/Fields/Expand.js +2 -4
  78. package/dist/cjs/ui/ConfigPanel/Fields/Fieldset.js +1 -3
  79. package/dist/cjs/ui/ConfigPanel/NestedForms/RemovableField.js +1 -3
  80. package/dist/cjs/ui/PanelTextInput/index.js +1 -3
  81. package/dist/cjs/utils/compare.js +7 -7
  82. package/dist/cjs/utils/index.js +7 -8
  83. package/dist/cjs/utils/rich-media-utils.js +2 -2
  84. package/dist/cjs/version-wrapper.js +1 -1
  85. package/dist/cjs/version.json +1 -1
  86. package/dist/es2019/create-editor/create-plugins-list.js +2 -1
  87. package/dist/es2019/editor.js +1 -4
  88. package/dist/es2019/i18n/cs.js +18 -2
  89. package/dist/es2019/i18n/da.js +18 -2
  90. package/dist/es2019/i18n/de.js +18 -2
  91. package/dist/es2019/i18n/es.js +13 -2
  92. package/dist/es2019/i18n/et.js +0 -1
  93. package/dist/es2019/i18n/fi.js +13 -2
  94. package/dist/es2019/i18n/fr.js +13 -2
  95. package/dist/es2019/i18n/hu.js +14 -3
  96. package/dist/es2019/i18n/it.js +18 -2
  97. package/dist/es2019/i18n/ja.js +13 -2
  98. package/dist/es2019/i18n/ko.js +13 -2
  99. package/dist/es2019/i18n/nb.js +13 -2
  100. package/dist/es2019/i18n/nl.js +18 -2
  101. package/dist/es2019/i18n/pl.js +16 -2
  102. package/dist/es2019/i18n/pt_BR.js +14 -3
  103. package/dist/es2019/i18n/pt_PT.js +0 -1
  104. package/dist/es2019/i18n/ru.js +13 -2
  105. package/dist/es2019/i18n/sk.js +0 -1
  106. package/dist/es2019/i18n/sv.js +18 -2
  107. package/dist/es2019/i18n/th.js +18 -2
  108. package/dist/es2019/i18n/tr.js +16 -2
  109. package/dist/es2019/i18n/uk.js +18 -2
  110. package/dist/es2019/i18n/vi.js +13 -2
  111. package/dist/es2019/i18n/zh.js +18 -2
  112. package/dist/es2019/i18n/zh_TW.js +18 -2
  113. package/dist/es2019/messages.js +4 -4
  114. package/dist/es2019/nodeviews/SelectionBasedNodeView.js +1 -2
  115. package/dist/es2019/plugins/analytics/types/enums.js +0 -1
  116. package/dist/es2019/plugins/analytics/types/node-events.js +1 -0
  117. package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -3
  118. package/dist/es2019/plugins/expand/pm-plugins/keymap.js +2 -2
  119. package/dist/es2019/plugins/extension/actions.js +16 -16
  120. package/dist/es2019/plugins/extension/pm-plugins/main.js +4 -4
  121. package/dist/es2019/plugins/floating-toolbar/ui/{EditorHideEmojiIcon.js → EditorRemoveEmojiIcon.js} +1 -1
  122. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +5 -3
  123. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +14 -0
  124. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +20 -23
  125. package/dist/es2019/plugins/layout/actions.js +64 -13
  126. package/dist/es2019/plugins/layout/index.js +3 -2
  127. package/dist/es2019/plugins/layout/pm-plugins/main.js +3 -1
  128. package/dist/es2019/plugins/layout/toolbar-messages.js +5 -0
  129. package/dist/es2019/plugins/layout/toolbar.js +10 -2
  130. package/dist/es2019/plugins/list/pm-plugins/main.js +1 -41
  131. package/dist/es2019/plugins/macro/actions.js +14 -14
  132. package/dist/es2019/plugins/mentions/analytics.js +2 -3
  133. package/dist/es2019/plugins/mentions/type-ahead/index.js +9 -15
  134. package/dist/es2019/plugins/panel/nodeviews/panel.js +5 -3
  135. package/dist/es2019/plugins/panel/toolbar.js +8 -6
  136. package/dist/es2019/plugins/panel/toolbar.test.js +18 -8
  137. package/dist/es2019/plugins/paste/handlers.js +2 -2
  138. package/dist/es2019/plugins/selection/gap-cursor/actions.js +5 -6
  139. package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +1 -3
  140. package/dist/es2019/plugins/table/commands/insert.js +27 -12
  141. package/dist/es2019/plugins/table/commands/misc.js +3 -3
  142. package/dist/es2019/plugins/table/commands/selection.js +25 -25
  143. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +5 -4
  144. package/dist/es2019/plugins/table/nodeviews/tableCell.js +19 -6
  145. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +14 -16
  146. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +1 -1
  147. package/dist/es2019/plugins/table/toolbar.js +4 -4
  148. package/dist/es2019/plugins/table/transforms/column-width.js +62 -11
  149. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
  150. package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +1 -1
  151. package/dist/es2019/plugins/table/utils/table.js +7 -1
  152. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
  153. package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
  154. package/dist/es2019/plugins/text-formatting/pm-plugins/cursor.js +1 -4
  155. package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
  156. package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +5 -3
  157. package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +1 -2
  158. package/dist/es2019/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +1 -3
  159. package/dist/es2019/ui/ColorPickerButton/index.js +6 -3
  160. package/dist/es2019/ui/ColorPickerButton/index.test.js +15 -0
  161. package/dist/es2019/ui/ConfigPanel/Fields/Expand.js +3 -4
  162. package/dist/es2019/ui/ConfigPanel/Fields/Fieldset.js +2 -3
  163. package/dist/es2019/ui/ConfigPanel/NestedForms/RemovableField.js +1 -2
  164. package/dist/es2019/ui/ConfigPanel/transformers.js +9 -9
  165. package/dist/es2019/ui/PanelTextInput/index.js +1 -3
  166. package/dist/es2019/utils/compare.js +7 -7
  167. package/dist/es2019/utils/index.js +7 -8
  168. package/dist/es2019/utils/rich-media-utils.js +2 -2
  169. package/dist/es2019/version-wrapper.js +1 -1
  170. package/dist/es2019/version.json +1 -1
  171. package/dist/esm/create-editor/create-plugins-list.js +2 -1
  172. package/dist/esm/editor.js +1 -4
  173. package/dist/esm/i18n/cs.js +18 -2
  174. package/dist/esm/i18n/da.js +18 -2
  175. package/dist/esm/i18n/de.js +18 -2
  176. package/dist/esm/i18n/es.js +13 -2
  177. package/dist/esm/i18n/et.js +0 -1
  178. package/dist/esm/i18n/fi.js +13 -2
  179. package/dist/esm/i18n/fr.js +13 -2
  180. package/dist/esm/i18n/hu.js +14 -3
  181. package/dist/esm/i18n/it.js +18 -2
  182. package/dist/esm/i18n/ja.js +13 -2
  183. package/dist/esm/i18n/ko.js +13 -2
  184. package/dist/esm/i18n/nb.js +13 -2
  185. package/dist/esm/i18n/nl.js +18 -2
  186. package/dist/esm/i18n/pl.js +16 -2
  187. package/dist/esm/i18n/pt_BR.js +14 -3
  188. package/dist/esm/i18n/pt_PT.js +0 -1
  189. package/dist/esm/i18n/ru.js +13 -2
  190. package/dist/esm/i18n/sk.js +0 -1
  191. package/dist/esm/i18n/sv.js +18 -2
  192. package/dist/esm/i18n/th.js +18 -2
  193. package/dist/esm/i18n/tr.js +16 -2
  194. package/dist/esm/i18n/uk.js +18 -2
  195. package/dist/esm/i18n/vi.js +13 -2
  196. package/dist/esm/i18n/zh.js +18 -2
  197. package/dist/esm/i18n/zh_TW.js +18 -2
  198. package/dist/esm/messages.js +4 -4
  199. package/dist/esm/nodeviews/SelectionBasedNodeView.js +1 -2
  200. package/dist/esm/plugins/analytics/types/enums.js +0 -1
  201. package/dist/esm/plugins/analytics/types/node-events.js +1 -0
  202. package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -3
  203. package/dist/esm/plugins/expand/pm-plugins/keymap.js +2 -2
  204. package/dist/esm/plugins/extension/actions.js +16 -16
  205. package/dist/esm/plugins/extension/pm-plugins/main.js +4 -4
  206. package/dist/esm/plugins/floating-toolbar/ui/{EditorHideEmojiIcon.js → EditorRemoveEmojiIcon.js} +1 -1
  207. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +6 -3
  208. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +14 -0
  209. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +20 -23
  210. package/dist/esm/plugins/layout/actions.js +66 -13
  211. package/dist/esm/plugins/layout/index.js +3 -2
  212. package/dist/esm/plugins/layout/pm-plugins/main.js +3 -1
  213. package/dist/esm/plugins/layout/toolbar-messages.js +5 -0
  214. package/dist/esm/plugins/layout/toolbar.js +10 -2
  215. package/dist/esm/plugins/list/pm-plugins/main.js +1 -37
  216. package/dist/esm/plugins/macro/actions.js +14 -14
  217. package/dist/esm/plugins/mentions/analytics.js +2 -3
  218. package/dist/esm/plugins/mentions/type-ahead/index.js +7 -12
  219. package/dist/esm/plugins/panel/nodeviews/panel.js +5 -3
  220. package/dist/esm/plugins/panel/toolbar.js +8 -6
  221. package/dist/esm/plugins/panel/toolbar.test.js +25 -11
  222. package/dist/esm/plugins/paste/handlers.js +2 -2
  223. package/dist/esm/plugins/selection/gap-cursor/actions.js +5 -6
  224. package/dist/esm/plugins/selection/pm-plugins/selection-main.js +1 -3
  225. package/dist/esm/plugins/table/commands/insert.js +26 -11
  226. package/dist/esm/plugins/table/commands/misc.js +3 -3
  227. package/dist/esm/plugins/table/commands/selection.js +24 -24
  228. package/dist/esm/plugins/table/nodeviews/TableComponent.js +5 -4
  229. package/dist/esm/plugins/table/nodeviews/tableCell.js +21 -7
  230. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +15 -17
  231. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +1 -1
  232. package/dist/esm/plugins/table/toolbar.js +4 -4
  233. package/dist/esm/plugins/table/transforms/column-width.js +62 -10
  234. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
  235. package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +1 -1
  236. package/dist/esm/plugins/table/utils/table.js +9 -0
  237. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
  238. package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +3 -7
  239. package/dist/esm/plugins/text-formatting/pm-plugins/cursor.js +1 -4
  240. package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -3
  241. package/dist/esm/plugins/type-ahead/ui/InputQuery.js +5 -3
  242. package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +1 -2
  243. package/dist/esm/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +1 -3
  244. package/dist/esm/ui/ColorPickerButton/index.js +6 -3
  245. package/dist/esm/ui/ColorPickerButton/index.test.js +15 -0
  246. package/dist/esm/ui/ConfigPanel/Fields/Expand.js +2 -3
  247. package/dist/esm/ui/ConfigPanel/Fields/Fieldset.js +1 -2
  248. package/dist/esm/ui/ConfigPanel/NestedForms/RemovableField.js +1 -2
  249. package/dist/esm/ui/PanelTextInput/index.js +1 -3
  250. package/dist/esm/utils/compare.js +7 -7
  251. package/dist/esm/utils/index.js +7 -8
  252. package/dist/esm/utils/rich-media-utils.js +2 -2
  253. package/dist/esm/version-wrapper.js +1 -1
  254. package/dist/esm/version.json +1 -1
  255. package/dist/types/i18n/cs.d.ts +16 -0
  256. package/dist/types/i18n/da.d.ts +16 -0
  257. package/dist/types/i18n/de.d.ts +16 -0
  258. package/dist/types/i18n/es.d.ts +11 -0
  259. package/dist/types/i18n/et.d.ts +0 -1
  260. package/dist/types/i18n/fi.d.ts +11 -0
  261. package/dist/types/i18n/fr.d.ts +11 -0
  262. package/dist/types/i18n/hu.d.ts +11 -0
  263. package/dist/types/i18n/it.d.ts +16 -0
  264. package/dist/types/i18n/ja.d.ts +11 -0
  265. package/dist/types/i18n/ko.d.ts +11 -0
  266. package/dist/types/i18n/nb.d.ts +11 -0
  267. package/dist/types/i18n/nl.d.ts +16 -0
  268. package/dist/types/i18n/pl.d.ts +14 -0
  269. package/dist/types/i18n/pt_BR.d.ts +11 -0
  270. package/dist/types/i18n/pt_PT.d.ts +0 -1
  271. package/dist/types/i18n/ru.d.ts +11 -0
  272. package/dist/types/i18n/sk.d.ts +0 -1
  273. package/dist/types/i18n/sv.d.ts +16 -0
  274. package/dist/types/i18n/th.d.ts +16 -0
  275. package/dist/types/i18n/tr.d.ts +14 -0
  276. package/dist/types/i18n/uk.d.ts +16 -0
  277. package/dist/types/i18n/vi.d.ts +11 -0
  278. package/dist/types/i18n/zh.d.ts +16 -0
  279. package/dist/types/i18n/zh_TW.d.ts +16 -0
  280. package/dist/types/messages.d.ts +1 -1
  281. package/dist/types/plugins/analytics/types/enums.d.ts +0 -1
  282. package/dist/types/plugins/analytics/types/general-events.d.ts +1 -1
  283. package/dist/types/plugins/analytics/types/list-events.d.ts +1 -5
  284. package/dist/types/plugins/analytics/types/node-events.d.ts +1 -0
  285. package/dist/types/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.d.ts +1 -0
  286. package/dist/types/plugins/layout/actions.d.ts +1 -0
  287. package/dist/types/plugins/layout/pm-plugins/types.d.ts +1 -0
  288. package/dist/types/plugins/layout/toolbar-messages.d.ts +5 -0
  289. package/dist/types/plugins/layout/toolbar.d.ts +1 -1
  290. package/dist/types/plugins/layout/types.d.ts +2 -1
  291. package/dist/types/plugins/mentions/analytics.d.ts +1 -1
  292. package/dist/types/plugins/table/nodeviews/tableCell.d.ts +1 -1
  293. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +2 -0
  294. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -0
  295. package/dist/types/plugins/table/transforms/column-width.d.ts +10 -0
  296. package/dist/types/plugins/table/utils/table.d.ts +2 -0
  297. package/dist/types/ui/ConfigPanel/Fields/Expand.d.ts +1 -1
  298. package/package.json +22 -22
  299. package/dist/types/plugins/floating-toolbar/ui/EditorHideEmojiIcon.d.ts +0 -1
@@ -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 tr => {
13
15
  const table = findTable(tr.selection);
@@ -20,17 +22,30 @@ function addColumnAtCustomStep(column) {
20
22
  };
21
23
  }
22
24
 
23
- function addColumnAt(column, allowAddColumnCustomStep = false) {
24
- if (allowAddColumnCustomStep) {
25
- return addColumnAtCustomStep(column);
26
- }
25
+ function addColumnAt(column, allowAddColumnCustomStep = false, view) {
26
+ return tr => {
27
+ let updatedTr = tr;
28
+
29
+ if (allowAddColumnCustomStep) {
30
+ updatedTr = addColumnAtCustomStep(column)(updatedTr);
31
+ } else {
32
+ updatedTr = addColumnAtPMUtils(column)(updatedTr);
33
+ }
27
34
 
28
- return addColumnAtPMUtils(column);
35
+ const table = findTable(updatedTr.selection);
36
+
37
+ if (table) {
38
+ // [ED-8288] Update colwidths manually to avoid multiple dispatch in TableComponent
39
+ updatedTr = rescaleColumns(table, view)(updatedTr);
40
+ }
41
+
42
+ return updatedTr;
43
+ };
29
44
  } // :: (EditorState, dispatch: ?(tr: Transaction)) → bool
30
45
  // Command to add a column before the column with the selection.
31
46
 
32
47
 
33
- export const addColumnBefore = (state, dispatch) => {
48
+ export const addColumnBefore = (state, dispatch, view) => {
34
49
  const table = findTable(state.selection);
35
50
 
36
51
  if (!table) {
@@ -39,14 +54,14 @@ export const addColumnBefore = (state, dispatch) => {
39
54
 
40
55
  if (dispatch) {
41
56
  let rect = selectedRect(state);
42
- dispatch(addColumnAt(rect.left, getAllowAddColumnCustomStep(state))(state.tr));
57
+ dispatch(addColumnAt(rect.left, getAllowAddColumnCustomStep(state), view)(state.tr));
43
58
  }
44
59
 
45
60
  return true;
46
61
  }; // :: (EditorState, dispatch: ?(tr: Transaction)) → bool
47
62
  // Command to add a column after the column with the selection.
48
63
 
49
- export const addColumnAfter = (state, dispatch) => {
64
+ export const addColumnAfter = (state, dispatch, view) => {
50
65
  const table = findTable(state.selection);
51
66
 
52
67
  if (!table) {
@@ -55,14 +70,14 @@ export const addColumnAfter = (state, dispatch) => {
55
70
 
56
71
  if (dispatch) {
57
72
  let rect = selectedRect(state);
58
- dispatch(addColumnAt(rect.right, getAllowAddColumnCustomStep(state))(state.tr));
73
+ dispatch(addColumnAt(rect.right, getAllowAddColumnCustomStep(state), view)(state.tr));
59
74
  }
60
75
 
61
76
  return true;
62
77
  }; // #region Commands
63
78
 
64
- export const insertColumn = column => (state, dispatch) => {
65
- const tr = addColumnAt(column, getAllowAddColumnCustomStep(state))(state.tr);
79
+ export const insertColumn = column => (state, dispatch, view) => {
80
+ let tr = addColumnAt(column, getAllowAddColumnCustomStep(state), view)(state.tr);
66
81
  const table = findTable(tr.selection);
67
82
 
68
83
  if (!table) {
@@ -89,7 +89,7 @@ export const setCellAttr = (name, value) => (state, dispatch) => {
89
89
 
90
90
  return false;
91
91
  };
92
- export const triggerUnlessTableHeader = command => (state, dispatch) => {
92
+ export const triggerUnlessTableHeader = command => (state, dispatch, view) => {
93
93
  const {
94
94
  selection,
95
95
  schema: {
@@ -103,7 +103,7 @@ export const triggerUnlessTableHeader = command => (state, dispatch) => {
103
103
  const cell = findCellClosestToPos(selection.$from);
104
104
 
105
105
  if (cell && cell.node.type !== tableHeader) {
106
- return command(state, dispatch);
106
+ return command(state, dispatch, view);
107
107
  }
108
108
  }
109
109
 
@@ -111,7 +111,7 @@ export const triggerUnlessTableHeader = command => (state, dispatch) => {
111
111
  const rect = getSelectionRect(selection);
112
112
 
113
113
  if (!checkIfHeaderRowEnabled(state) || rect && rect.top > 0) {
114
- return command(state, dispatch);
114
+ return command(state, dispatch, view);
115
115
  }
116
116
  }
117
117
 
@@ -171,24 +171,24 @@ const arrowLeftFromText = selection => (state, dispatch) => {
171
171
 
172
172
  if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 // + 3 for: row, cell & paragraph nodes
173
173
  ) {
174
- const {
175
- selectionRelativeToNode
176
- } = getSelectionPluginState(state);
177
-
178
- if (selectionRelativeToNode === RelativeSelectionPos.Before) {
179
- // we have a text selection at start of first table cell, directly inside a top level paragraph,
180
- // and want to set gap cursor selection before table
181
- return setGapCursorBeforeTable()(state, dispatch);
182
- } else {
183
- // we have a text selection at start of first table cell, directly inside a top level paragraph,
184
- // and want to set a full table cell selection
185
- return selectFullTable({
186
- node: table.node,
187
- startPos: table.start,
188
- dir: TableSelectionDirection.BottomToTop
189
- })(state, dispatch);
190
- }
174
+ const {
175
+ selectionRelativeToNode
176
+ } = getSelectionPluginState(state);
177
+
178
+ if (selectionRelativeToNode === RelativeSelectionPos.Before) {
179
+ // we have a text selection at start of first table cell, directly inside a top level paragraph,
180
+ // and want to set gap cursor selection before table
181
+ return setGapCursorBeforeTable()(state, dispatch);
182
+ } else {
183
+ // we have a text selection at start of first table cell, directly inside a top level paragraph,
184
+ // and want to set a full table cell selection
185
+ return selectFullTable({
186
+ node: table.node,
187
+ startPos: table.start,
188
+ dir: TableSelectionDirection.BottomToTop
189
+ })(state, dispatch);
191
190
  }
191
+ }
192
192
  }
193
193
 
194
194
  return false;
@@ -204,14 +204,14 @@ const arrowRightFromText = selection => (state, dispatch) => {
204
204
 
205
205
  if (isSelectionAtEndOfTable($to, selection) && $to.parent.type.name === 'paragraph' && $to.depth === table.depth + 3 // + 3 for: row, cell & paragraph nodes
206
206
  ) {
207
- // we have a text selection at end of last table cell, directly inside a top level paragraph,
208
- // and want to set a full table cell selection
209
- return selectFullTable({
210
- node: table.node,
211
- startPos: table.start,
212
- dir: TableSelectionDirection.TopToBottom
213
- })(state, dispatch);
214
- }
207
+ // we have a text selection at end of last table cell, directly inside a top level paragraph,
208
+ // and want to set a full table cell selection
209
+ return selectFullTable({
210
+ node: table.node,
211
+ startPos: table.start,
212
+ dir: TableSelectionDirection.TopToBottom
213
+ })(state, dispatch);
214
+ }
215
215
  }
216
216
 
217
217
  return false;
@@ -156,16 +156,17 @@ class TableComponent extends React.Component {
156
156
  const parentWidthChanged = parentWidth && parentWidth !== this.state.parentWidth;
157
157
  const layoutSize = this.tableNodeLayoutSize(node, containerWidth.width, options);
158
158
  const hasNumberedColumnChanged = prevAttrs.isNumberColumnEnabled !== node.attrs.isNumberColumnEnabled;
159
+ const noOfColumnsChanged = tablesHaveDifferentNoOfColumns(node, prevNode);
159
160
 
160
161
  if ( // Breakout mode/layout changed
161
162
  layoutChanged || // We need to react if our parent changes
162
163
  // Scales the cols widths relative to the new parent width.
163
164
  parentWidthChanged || // Enabling / disabling this feature reduces or adds size to the table.
164
- hasNumberedColumnChanged || // Adding or removing columns from the table, should snap the remaining / new columns to the layout width.
165
- tablesHaveDifferentNoOfColumns(node, prevNode) || // This last check is also to cater for dynamic text sizing changing the 'default' layout width
165
+ hasNumberedColumnChanged || // This last check is also to cater for dynamic text sizing changing the 'default' layout width
166
166
  // Usually happens on window resize.
167
- layoutSize !== this.layoutSize) {
168
- if (!hasNumberedColumnChanged) {
167
+ layoutSize !== this.layoutSize || noOfColumnsChanged) {
168
+ // If column has been inserted/deleted avoid multi dispatch
169
+ if (!hasNumberedColumnChanged && !noOfColumnsChanged) {
169
170
  this.scaleTable({
170
171
  parentWidth,
171
172
  layoutChanged
@@ -1,6 +1,6 @@
1
1
  import uuid from 'uuid';
2
2
  import { DOMSerializer } from 'prosemirror-model';
3
- import { setCellAttrs } from '@atlaskit/adf-schema';
3
+ import { getCellDomAttrs, getCellAttrs } from '@atlaskit/adf-schema';
4
4
  import { getFeatureFlags } from '../../feature-flags-context';
5
5
  export default class TableCellNodeView {
6
6
  constructor(node, view, getPos, observer) {
@@ -25,13 +25,26 @@ export default class TableCellNodeView {
25
25
  }
26
26
  }
27
27
 
28
- shouldRecreateNodeView(node) {
28
+ updateNodeView(node) {
29
29
  if (this.node.type !== node.type) {
30
30
  return false;
31
31
  }
32
32
 
33
- const attrs = setCellAttrs(this.node);
34
- const nextAttrs = setCellAttrs(node); // added + changed attributes
33
+ const attrs = getCellDomAttrs(this.node);
34
+ const nextAttrs = getCellDomAttrs(node);
35
+ const {
36
+ colspan,
37
+ rowspan
38
+ } = getCellAttrs(this.dom); // need to rerender when colspan/rowspan in dom are different from the node attrs
39
+ // this can happen when undoing merge cells
40
+
41
+ const defaultColspan = 1,
42
+ defaultRowspan = 1;
43
+
44
+ if (colspan !== (node.attrs.colspan || defaultColspan) || rowspan !== (node.attrs.rowspan || defaultRowspan)) {
45
+ return false;
46
+ } // added + changed attributes
47
+
35
48
 
36
49
  const addedAttrs = Object.entries(nextAttrs).filter(([key, value]) => attrs[key] !== value);
37
50
  const removedAttrs = Object.keys(attrs).filter(key => !nextAttrs.hasOwnProperty(key));
@@ -51,9 +64,9 @@ export default class TableCellNodeView {
51
64
  }
52
65
 
53
66
  update(node) {
54
- const shouldUpdate = this.shouldRecreateNodeView(node);
67
+ const didUpdate = this.updateNodeView(node);
55
68
  this.node = node;
56
- return shouldUpdate;
69
+ return didUpdate;
57
70
  }
58
71
 
59
72
  destroy() {
@@ -146,8 +146,7 @@ export const bulkColumnsResize = (resizeState, columnsIndexes, sourceColumnIndex
146
146
  });
147
147
  let newState = { ...resizeState,
148
148
  cols: cols.map(col => {
149
- if (columnsIndexes.indexOf(col.index) > -1 || // take from prev columns only if dragging the first handle to the left
150
- columnsIndexes.indexOf(sourceColumnIndex) > -1 && col.index < colIndex) {
149
+ if (columnsIndexes.indexOf(col.index) > -1 || columnsIndexes.indexOf(sourceColumnIndex) > -1 && col.index < colIndex) {
151
150
  return col;
152
151
  }
153
152
 
@@ -184,19 +183,19 @@ export const bulkColumnsResize = (resizeState, columnsIndexes, sourceColumnIndex
184
183
  } // table is in overflow: keep the dragged column at its widths and evenly distribute columns
185
184
  // to recover from overflow state
186
185
  else {
187
- const columnWidth = Math.floor((minTableWidth - sourceCol.width) / (newState.cols.length - 1));
188
- newState = { ...resizeState,
189
- cols: newState.cols.map(col => {
190
- if (col.index === sourceCol.index) {
191
- return col;
192
- }
186
+ const columnWidth = Math.floor((minTableWidth - sourceCol.width) / (newState.cols.length - 1));
187
+ newState = { ...resizeState,
188
+ cols: newState.cols.map(col => {
189
+ if (col.index === sourceCol.index) {
190
+ return col;
191
+ }
193
192
 
194
- return { ...col,
195
- width: columnWidth
196
- };
197
- })
198
- };
199
- }
193
+ return { ...col,
194
+ width: columnWidth
195
+ };
196
+ })
197
+ };
198
+ }
200
199
  } // fix total table widths by adding missing pixels to columns widths here and there
201
200
 
202
201
 
@@ -207,7 +206,7 @@ export const areColumnsEven = resizeState => {
207
206
  return newResizeState.cols.every((col, i) => col.width === resizeState.cols[i].width);
208
207
  }; // Get the layout
209
208
 
210
- const normaliseTableLayout = input => {
209
+ export const normaliseTableLayout = input => {
211
210
  switch (input) {
212
211
  case 'wide':
213
212
  return input;
@@ -219,7 +218,6 @@ const normaliseTableLayout = input => {
219
218
  return 'default';
220
219
  }
221
220
  };
222
-
223
221
  export const getNewResizeStateFromSelectedColumns = (rect, state, domAtPos, dynamicTextSizing) => {
224
222
  const {
225
223
  totalRowCount,
@@ -78,7 +78,7 @@ export const scaleWithParent = (tableRef, parentWidth, table, start, domAtPos) =
78
78
  return scaleTableTo(resizeState, Math.floor(parentWidth));
79
79
  }; // Scales the table to a given size and updates its colgroup DOM node
80
80
 
81
- function scaleTableTo(state, maxSize) {
81
+ export function scaleTableTo(state, maxSize) {
82
82
  const scaleFactor = maxSize / getTotalWidth(state);
83
83
  let newState = { ...state,
84
84
  maxSize,
@@ -97,12 +97,12 @@ export const getToolbarCellOptionsConfig = (editorState, initialSelectionRect, {
97
97
  const options = [{
98
98
  id: 'editor.table.insertColumn',
99
99
  title: formatMessage(tableMessages.insertColumn),
100
- onClick: (state, dispatch) => {
100
+ onClick: (state, dispatch, view) => {
101
101
  const selectionRect = getClosestSelectionRect(state);
102
102
  const index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.right;
103
103
 
104
104
  if (index) {
105
- insertColumnWithAnalytics(INPUT_METHOD.FLOATING_TB, index)(state, dispatch);
105
+ insertColumnWithAnalytics(INPUT_METHOD.FLOATING_TB, index)(state, dispatch, view);
106
106
  }
107
107
 
108
108
  return true;
@@ -132,11 +132,11 @@ export const getToolbarCellOptionsConfig = (editorState, initialSelectionRect, {
132
132
  title: formatMessage(tableMessages.removeColumns, {
133
133
  0: numberOfColumns
134
134
  }),
135
- onClick: (state, dispatch) => {
135
+ onClick: (state, dispatch, view) => {
136
136
  const selectionRect = getClosestSelectionRect(state);
137
137
 
138
138
  if (selectionRect) {
139
- deleteColumnsWithAnalytics(INPUT_METHOD.FLOATING_TB, selectionRect)(state, dispatch);
139
+ deleteColumnsWithAnalytics(INPUT_METHOD.FLOATING_TB, selectionRect)(state, dispatch, view);
140
140
  }
141
141
 
142
142
  return true;
@@ -1,5 +1,10 @@
1
1
  import { TableMap } from '@atlaskit/editor-tables/table-map';
2
+ import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils';
2
3
  import { setMeta } from './metadata';
4
+ import { getResizeState, normaliseTableLayout } from '../pm-plugins/table-resizing/utils/resize-state';
5
+ import { getTableMaxWidth } from '../pm-plugins/table-resizing/utils/misc';
6
+ import { tableCellMinWidth } from '@atlaskit/editor-common';
7
+ import { scaleTableTo } from '../pm-plugins/table-resizing/utils/scale-table';
3
8
  export const updateColumnWidths = (resizeState, table, start) => tr => {
4
9
  const map = TableMap.get(table);
5
10
  const updatedCellsAttrs = {}; // calculating new attributes for each cell
@@ -84,19 +89,65 @@ export const updateColumnWidths = (resizeState, table, start) => tr => {
84
89
  }
85
90
 
86
91
  const tablePos = start - 1;
87
- const {
88
- selection
89
- } = tr;
90
- /* Create a mapping before the table node is replaced to allow the current
91
- * selection to be mapped back to it's original position inside the table.
92
+ const selectionBookmark = tr.selection.getBookmark();
93
+ tr.replaceWith(tablePos, tablePos + table.nodeSize, table.type.createChecked(table.attrs, rows, table.marks));
94
+ /**
95
+ * We want to restore to the original selection but w/o applying the mapping. Function
96
+ * tr.replaceWith puts the selection after the inserted content. We need to manually
97
+ * set the selection back to original state. Mapping in this case doesn't quite work
98
+ * e.g. if we change the content before a selection. This is because mapping
99
+ * means moving it if the content in front of it changed. Instead we can get
100
+ * bookmark of selection.
92
101
  *
93
- * If the mapping from the new 'replaceWith' transaction is used, prosemirror
94
- * will map the selection to after the table as it thinks the original table
95
- * node has been deleted.
102
+ * @see https://github.com/ProseMirror/prosemirror/issues/645
96
103
  */
97
104
 
98
- const originalMap = Object.assign(Object.create(Object.getPrototypeOf(tr.mapping)), tr.mapping);
99
- tr.replaceWith(tablePos, tablePos + table.nodeSize, table.type.createChecked(table.attrs, rows, table.marks)); // restore selection after replacing the table
105
+ return tr.setSelection(selectionBookmark.resolve(tr.doc));
106
+ };
107
+ /**
108
+ * This function is called when user inserts/deletes a column in a table to rescale all columns.
109
+ * This is done manually to avoid a multi-dispatch in TableComponent. See [ED-8288].
110
+ * @param table
111
+ * @param view
112
+ * @returns Updated transaction with rescaled columns for a given table
113
+ */
114
+
115
+ export const rescaleColumns = (table, view) => tr => {
116
+ if (!view || !hasTableBeenResized(table.node)) {
117
+ return tr;
118
+ }
119
+
120
+ const {
121
+ state
122
+ } = view;
123
+ const domAtPos = view.domAtPos.bind(view);
124
+ const maybeTable = domAtPos(table.start).node;
125
+ const tableRef = maybeTable.closest('table');
126
+
127
+ if (!tableRef) {
128
+ return tr;
129
+ }
130
+
131
+ const layout = normaliseTableLayout(tableRef === null || tableRef === void 0 ? void 0 : tableRef.dataset.layout);
132
+ const maxSize = getTableMaxWidth({
133
+ table: table.node,
134
+ tableStart: table.start,
135
+ state,
136
+ layout,
137
+ dynamicTextSizing: true
138
+ });
139
+ let resizeState = getResizeState({
140
+ minWidth: tableCellMinWidth,
141
+ table: table.node,
142
+ start: table.start,
143
+ tableRef,
144
+ domAtPos,
145
+ maxSize
146
+ });
147
+
148
+ if (resizeState.overflow) {
149
+ resizeState = scaleTableTo(resizeState, maxSize);
150
+ }
100
151
 
101
- return tr.setSelection(selection.map(tr.doc, originalMap));
152
+ return updateColumnWidths(resizeState, table.node, table.start)(tr);
102
153
  };
@@ -296,7 +296,7 @@ class ContextualMenu extends Component {
296
296
  break;
297
297
 
298
298
  case 'insert_column':
299
- insertColumnWithAnalytics(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch);
299
+ insertColumnWithAnalytics(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
300
300
  this.toggleOpen();
301
301
  break;
302
302
 
@@ -185,7 +185,7 @@ class FloatingInsertButton extends React.Component {
185
185
  state,
186
186
  dispatch
187
187
  } = editorView;
188
- insertColumnWithAnalytics(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch);
188
+ insertColumnWithAnalytics(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
189
189
  }
190
190
  }
191
191
 
@@ -18,4 +18,10 @@ export const getMergedCellsPositions = tr => {
18
18
  }
19
19
  });
20
20
  return mergedCells;
21
- };
21
+ };
22
+ export const colsToRect = (cols, noOfRows) => ({
23
+ left: Math.min(...cols),
24
+ right: Math.max(...cols) + 1,
25
+ top: 0,
26
+ bottom: noOfRows
27
+ });
@@ -173,8 +173,7 @@ const deleteHandler = filter([isInsideTaskOrDecisionItem, isEmptySelectionAtEnd]
173
173
  } // if nested, just unindent
174
174
 
175
175
 
176
- if ($next.node($next.depth - 2).type === taskList || // this is for the case when we are on a non-nested item and next one is nested
177
- $next.node($next.depth - 1).type === taskList && $next.parent.type === taskList) {
176
+ if ($next.node($next.depth - 2).type === taskList || $next.node($next.depth - 1).type === taskList && $next.parent.type === taskList) {
178
177
  const tr = liftBlock(state.tr, $next, $next);
179
178
 
180
179
  if (dispatch && tr) {
@@ -117,12 +117,6 @@ class ToolbarTextColor extends React.Component {
117
117
  isShowingMoreColors
118
118
  } = this.state;
119
119
 
120
- if (e.defaultPrevented) {
121
- // This should be handled by stopping propogation, but as an additional safety net
122
- // we ignore handled events for the purpose of hiding the popup.
123
- return;
124
- }
125
-
126
120
  if (isOpen === true) {
127
121
  this.dispatchAnalyticsEvent(this.buildAnalyticsPalette(ACTION.CLOSED, {
128
122
  isShowingMoreColors,
@@ -207,11 +201,13 @@ class ToolbarTextColor extends React.Component {
207
201
  label: ""
208
202
  })))
209
203
  })
204
+ }, /*#__PURE__*/React.createElement("div", {
205
+ "data-testid": "text-color-palette"
210
206
  }, /*#__PURE__*/React.createElement(ColorPalette, {
211
207
  palette: palette,
212
208
  onClick: color => this.changeTextColor(color, pluginState.disabled),
213
209
  selectedColor: pluginState.color
214
- }), showMoreColorsToggle && /*#__PURE__*/React.createElement(ShowMoreWrapper, null, /*#__PURE__*/React.createElement(Button, {
210
+ })), showMoreColorsToggle && /*#__PURE__*/React.createElement(ShowMoreWrapper, null, /*#__PURE__*/React.createElement(Button, {
215
211
  appearance: "subtle",
216
212
  onClick: this.handleShowMoreToggle,
217
213
  iconBefore: /*#__PURE__*/React.createElement(EditorBackgroundColorIcon, {
@@ -28,10 +28,7 @@ export default new Plugin({
28
28
  const clickWasAtTextNode = !!(clickNode && clickNode.isText);
29
29
  const clickWasAtEndOfAParagraphNode = $click.parent.type === paragraph && $click.textOffset === 0 && $click.nodeAfter === null;
30
30
 
31
- if (clickWasAtEdgeOfATextNode && clickWasNearACodeMark && clickedDOMElementPosition && ( // if click did not occur at a text node or end of paragraph, then
32
- // it was at a directly adjacent non-text node, so we skip this manual
33
- // text selection logic to preserve that non-text node's selection
34
- clickWasAtTextNode || clickWasAtEndOfAParagraphNode)) {
31
+ if (clickWasAtEdgeOfATextNode && clickWasNearACodeMark && clickedDOMElementPosition && (clickWasAtTextNode || clickWasAtEndOfAParagraphNode)) {
35
32
  const clickWasInsideNodeDOM = event.target.parentNode === view.domAtPos(clickedDOMElementPosition).node && code.isInSet(view.state.doc.resolve(clickedDOMElementPosition).nodeAfter.marks);
36
33
  const nodeNextToClick = $click.nodeBefore && code.isInSet($click.nodeBefore.marks) ? $click.nodeAfter : $click.nodeBefore; // Need to set the selection here to allow clicking between [code('text'),{<>},emoji()]
37
34
 
@@ -17,7 +17,24 @@ export const openTypeAheadAtCursor = ({
17
17
  const {
18
18
  selection
19
19
  } = tr;
20
- const isTextRangeSelection = selection instanceof TextSelection && selection.$cursor === null;
21
- const nextTr = isTextRangeSelection ? tr.deleteSelection() : tr;
22
- return nextTr;
20
+
21
+ if (!(selection instanceof TextSelection)) {
22
+ return tr;
23
+ }
24
+
25
+ if (!selection.$cursor) {
26
+ tr.deleteSelection();
27
+ return tr;
28
+ } // Search & Destroy placeholder
29
+
30
+
31
+ const cursorPos = selection.$cursor.pos;
32
+ const nodeAtCursor = tr.doc.nodeAt(cursorPos);
33
+ const isPlaceholderAtCursorPosition = nodeAtCursor && nodeAtCursor.type.name === 'placeholder';
34
+
35
+ if (nodeAtCursor && isPlaceholderAtCursorPosition) {
36
+ tr.delete(cursorPos, cursorPos + nodeAtCursor.nodeSize);
37
+ }
38
+
39
+ return tr;
23
40
  };
@@ -51,7 +51,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
51
51
  const text = cleanedInputContent();
52
52
  onQueryChange(text);
53
53
  }, [onQueryChange, cleanedInputContent]);
54
- const onKeyDown = useCallback(event => {
54
+ const checkKeyEvent = useCallback(event => {
55
55
  const key = keyNameNormalized(event);
56
56
  const sel = document.getSelection();
57
57
  const raw = ref.current.textContent || '';
@@ -166,7 +166,10 @@ export const InputQuery = /*#__PURE__*/React.memo(({
166
166
  });
167
167
  event.preventDefault();
168
168
  event.stopPropagation();
169
+ return;
169
170
  }
171
+
172
+ checkKeyEvent(event);
170
173
  };
171
174
 
172
175
  const onFocusOut = event => {
@@ -265,7 +268,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
265
268
  element.removeEventListener('input', onInput);
266
269
  }
267
270
  };
268
- }, [triggerQueryPrefix, cleanedInputContent, onQueryFocus, cancel]);
271
+ }, [triggerQueryPrefix, cleanedInputContent, onQueryFocus, cancel, checkKeyEvent]);
269
272
  useEffect(() => {
270
273
  const hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
271
274
 
@@ -295,7 +298,6 @@ export const InputQuery = /*#__PURE__*/React.memo(({
295
298
  contentEditable: true,
296
299
  innerRef: ref,
297
300
  onKeyUp: onKeyUp,
298
- onKeyDown: onKeyDown,
299
301
  onClick: onClick,
300
302
  role: "textbox",
301
303
  suppressContentEditableWarning: true,
@@ -4,14 +4,13 @@ import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
4
4
  import { Popup } from '@atlaskit/editor-common';
5
5
  import { borderRadius, gridSize } from '@atlaskit/theme/constants';
6
6
  import { N0, N60A, N50A } from '@atlaskit/theme/colors';
7
- import { divide } from '@atlaskit/theme/math';
8
7
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics';
9
8
  import { TypeAheadList } from './TypeAheadList';
10
9
  const TypeAheadContent = styled.div`
11
10
  background: ${N0};
12
11
  border-radius: ${borderRadius()}px;
13
12
  box-shadow: 0 0 1px ${N60A}, 0 4px 8px -2px ${N50A};
14
- padding: ${divide(gridSize, 2)}px 0;
13
+ padding: ${gridSize() / 2}px 0;
15
14
  width: 320px;
16
15
  max-height: 380px; /* ~5.5 visibile items */
17
16
  overflow-y: auto;
@@ -60,9 +60,7 @@ export const subscribeToToolbarAndPickerUpdates = (editorView, cb) => {
60
60
  const oldToolbarConfig = getOldConfigWithNodeInfo(lastUpdatedState);
61
61
  const isToolbarEqual = areToolbarsSame(toolbarConfig, oldToolbarConfig);
62
62
 
63
- if (dateState !== oldDateState || statusState !== oldStatusState || // Sometimes the toolbar changes while a picker is open, we dont care about this
64
- // EG A nested status or date node in a table
65
- !isToolbarEqual && !statusState.showStatusPickerAt && !dateState.showDatePickerAt) {
63
+ if (dateState !== oldDateState || statusState !== oldStatusState || !isToolbarEqual && !statusState.showStatusPickerAt && !dateState.showDatePickerAt) {
66
64
  shouldCallback = true;
67
65
  }
68
66
  } else {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import { Popup } from '@atlaskit/editor-common';
3
+ import { Popup, withOuterListeners } from '@atlaskit/editor-common';
4
4
  import Button from '@atlaskit/button';
5
5
  import Tooltip from '@atlaskit/tooltip';
6
6
  import { N60A } from '@atlaskit/theme/colors';
@@ -32,6 +32,8 @@ const ColorPickerButton = props => {
32
32
  setIsPopupOpen(!isPopupOpen);
33
33
  };
34
34
 
35
+ const ColorPaletteWithListeners = withOuterListeners(ColorPalette);
36
+
35
37
  const onColorSelected = (color, label) => {
36
38
  setIsPopupOpen(false);
37
39
 
@@ -68,11 +70,12 @@ const ColorPickerButton = props => {
68
70
  fitWidth: 350,
69
71
  offset: [0, 10],
70
72
  alignX: props.alignX
71
- }, /*#__PURE__*/React.createElement(ColorPickerWrapper, null, /*#__PURE__*/React.createElement(ColorPalette, {
73
+ }, /*#__PURE__*/React.createElement(ColorPickerWrapper, null, /*#__PURE__*/React.createElement(ColorPaletteWithListeners, {
72
74
  palette: props.colorPalette,
73
75
  cols: props.cols,
74
76
  selectedColor: props.currentColor || null,
75
- onClick: onColorSelected
77
+ onClick: onColorSelected,
78
+ handleClickOutside: togglePopup
76
79
  })));
77
80
  };
78
81