@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
@@ -21,6 +21,8 @@ var _utils2 = require("../utils");
21
21
 
22
22
  var _getAllowAddColumnCustomStep = require("../utils/get-allow-add-column-custom-step");
23
23
 
24
+ var _columnWidth = require("../transforms/column-width");
25
+
24
26
  // #region Imports
25
27
  // #endregion
26
28
  function addColumnAtCustomStep(column) {
@@ -37,17 +39,30 @@ function addColumnAtCustomStep(column) {
37
39
 
38
40
  function addColumnAt(column) {
39
41
  var allowAddColumnCustomStep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
42
+ var view = arguments.length > 2 ? arguments[2] : undefined;
43
+ return function (tr) {
44
+ var updatedTr = tr;
40
45
 
41
- if (allowAddColumnCustomStep) {
42
- return addColumnAtCustomStep(column);
43
- }
46
+ if (allowAddColumnCustomStep) {
47
+ updatedTr = addColumnAtCustomStep(column)(updatedTr);
48
+ } else {
49
+ updatedTr = (0, _utils.addColumnAt)(column)(updatedTr);
50
+ }
51
+
52
+ var table = (0, _utils.findTable)(updatedTr.selection);
44
53
 
45
- return (0, _utils.addColumnAt)(column);
54
+ if (table) {
55
+ // [ED-8288] Update colwidths manually to avoid multiple dispatch in TableComponent
56
+ updatedTr = (0, _columnWidth.rescaleColumns)(table, view)(updatedTr);
57
+ }
58
+
59
+ return updatedTr;
60
+ };
46
61
  } // :: (EditorState, dispatch: ?(tr: Transaction)) → bool
47
62
  // Command to add a column before the column with the selection.
48
63
 
49
64
 
50
- var addColumnBefore = function addColumnBefore(state, dispatch) {
65
+ var addColumnBefore = function addColumnBefore(state, dispatch, view) {
51
66
  var table = (0, _utils.findTable)(state.selection);
52
67
 
53
68
  if (!table) {
@@ -56,7 +71,7 @@ var addColumnBefore = function addColumnBefore(state, dispatch) {
56
71
 
57
72
  if (dispatch) {
58
73
  var rect = (0, _utils.selectedRect)(state);
59
- dispatch(addColumnAt(rect.left, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(state))(state.tr));
74
+ dispatch(addColumnAt(rect.left, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(state), view)(state.tr));
60
75
  }
61
76
 
62
77
  return true;
@@ -66,7 +81,7 @@ var addColumnBefore = function addColumnBefore(state, dispatch) {
66
81
 
67
82
  exports.addColumnBefore = addColumnBefore;
68
83
 
69
- var addColumnAfter = function addColumnAfter(state, dispatch) {
84
+ var addColumnAfter = function addColumnAfter(state, dispatch, view) {
70
85
  var table = (0, _utils.findTable)(state.selection);
71
86
 
72
87
  if (!table) {
@@ -75,7 +90,7 @@ var addColumnAfter = function addColumnAfter(state, dispatch) {
75
90
 
76
91
  if (dispatch) {
77
92
  var rect = (0, _utils.selectedRect)(state);
78
- dispatch(addColumnAt(rect.right, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(state))(state.tr));
93
+ dispatch(addColumnAt(rect.right, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(state), view)(state.tr));
79
94
  }
80
95
 
81
96
  return true;
@@ -85,8 +100,8 @@ var addColumnAfter = function addColumnAfter(state, dispatch) {
85
100
  exports.addColumnAfter = addColumnAfter;
86
101
 
87
102
  var insertColumn = function insertColumn(column) {
88
- return function (state, dispatch) {
89
- var tr = addColumnAt(column, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(state))(state.tr);
103
+ return function (state, dispatch, view) {
104
+ var tr = addColumnAt(column, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(state), view)(state.tr);
90
105
  var table = (0, _utils.findTable)(tr.selection);
91
106
 
92
107
  if (!table) {
@@ -131,7 +131,7 @@ var setCellAttr = function setCellAttr(name, value) {
131
131
  exports.setCellAttr = setCellAttr;
132
132
 
133
133
  var triggerUnlessTableHeader = function triggerUnlessTableHeader(command) {
134
- return function (state, dispatch) {
134
+ return function (state, dispatch, view) {
135
135
  var selection = state.selection,
136
136
  tableHeader = state.schema.nodes.tableHeader;
137
137
 
@@ -139,7 +139,7 @@ var triggerUnlessTableHeader = function triggerUnlessTableHeader(command) {
139
139
  var cell = (0, _utils.findCellClosestToPos)(selection.$from);
140
140
 
141
141
  if (cell && cell.node.type !== tableHeader) {
142
- return command(state, dispatch);
142
+ return command(state, dispatch, view);
143
143
  }
144
144
  }
145
145
 
@@ -147,7 +147,7 @@ var triggerUnlessTableHeader = function triggerUnlessTableHeader(command) {
147
147
  var rect = (0, _utils.getSelectionRect)(selection);
148
148
 
149
149
  if (!(0, _nodes.checkIfHeaderRowEnabled)(state) || rect && rect.top > 0) {
150
- return command(state, dispatch);
150
+ return command(state, dispatch, view);
151
151
  }
152
152
  }
153
153
 
@@ -187,23 +187,23 @@ var arrowLeftFromText = function arrowLeftFromText(selection) {
187
187
 
188
188
  if (isSelectionAtStartOfTable($from, selection) && $from.parent.type.name === 'paragraph' && $from.depth === table.depth + 3 // + 3 for: row, cell & paragraph nodes
189
189
  ) {
190
- var _getSelectionPluginSt4 = (0, _pluginFactory.getPluginState)(state),
191
- selectionRelativeToNode = _getSelectionPluginSt4.selectionRelativeToNode;
192
-
193
- if (selectionRelativeToNode === _types.RelativeSelectionPos.Before) {
194
- // we have a text selection at start of first table cell, directly inside a top level paragraph,
195
- // and want to set gap cursor selection before table
196
- return setGapCursorBeforeTable()(state, dispatch);
197
- } else {
198
- // we have a text selection at start of first table cell, directly inside a top level paragraph,
199
- // and want to set a full table cell selection
200
- return selectFullTable({
201
- node: table.node,
202
- startPos: table.start,
203
- dir: TableSelectionDirection.BottomToTop
204
- })(state, dispatch);
205
- }
190
+ var _getSelectionPluginSt4 = (0, _pluginFactory.getPluginState)(state),
191
+ selectionRelativeToNode = _getSelectionPluginSt4.selectionRelativeToNode;
192
+
193
+ if (selectionRelativeToNode === _types.RelativeSelectionPos.Before) {
194
+ // we have a text selection at start of first table cell, directly inside a top level paragraph,
195
+ // and want to set gap cursor selection before table
196
+ return setGapCursorBeforeTable()(state, dispatch);
197
+ } else {
198
+ // we have a text selection at start of first table cell, directly inside a top level paragraph,
199
+ // and want to set a full table cell selection
200
+ return selectFullTable({
201
+ node: table.node,
202
+ startPos: table.start,
203
+ dir: TableSelectionDirection.BottomToTop
204
+ })(state, dispatch);
206
205
  }
206
+ }
207
207
  }
208
208
 
209
209
  return false;
@@ -219,14 +219,14 @@ var arrowRightFromText = function arrowRightFromText(selection) {
219
219
 
220
220
  if (isSelectionAtEndOfTable($to, selection) && $to.parent.type.name === 'paragraph' && $to.depth === table.depth + 3 // + 3 for: row, cell & paragraph nodes
221
221
  ) {
222
- // we have a text selection at end of last table cell, directly inside a top level paragraph,
223
- // and want to set a full table cell selection
224
- return selectFullTable({
225
- node: table.node,
226
- startPos: table.start,
227
- dir: TableSelectionDirection.TopToBottom
228
- })(state, dispatch);
229
- }
222
+ // we have a text selection at end of last table cell, directly inside a top level paragraph,
223
+ // and want to set a full table cell selection
224
+ return selectFullTable({
225
+ node: table.node,
226
+ startPos: table.start,
227
+ dir: TableSelectionDirection.TopToBottom
228
+ })(state, dispatch);
229
+ }
230
230
  }
231
231
 
232
232
  return false;
@@ -206,16 +206,17 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
206
206
  var layoutSize = _this.tableNodeLayoutSize(node, containerWidth.width, options);
207
207
 
208
208
  var hasNumberedColumnChanged = prevAttrs.isNumberColumnEnabled !== node.attrs.isNumberColumnEnabled;
209
+ var noOfColumnsChanged = (0, _utils4.tablesHaveDifferentNoOfColumns)(node, prevNode);
209
210
 
210
211
  if ( // Breakout mode/layout changed
211
212
  layoutChanged || // We need to react if our parent changes
212
213
  // Scales the cols widths relative to the new parent width.
213
214
  parentWidthChanged || // Enabling / disabling this feature reduces or adds size to the table.
214
- hasNumberedColumnChanged || // Adding or removing columns from the table, should snap the remaining / new columns to the layout width.
215
- (0, _utils4.tablesHaveDifferentNoOfColumns)(node, prevNode) || // This last check is also to cater for dynamic text sizing changing the 'default' layout width
215
+ hasNumberedColumnChanged || // This last check is also to cater for dynamic text sizing changing the 'default' layout width
216
216
  // Usually happens on window resize.
217
- layoutSize !== _this.layoutSize) {
218
- if (!hasNumberedColumnChanged) {
217
+ layoutSize !== _this.layoutSize || noOfColumnsChanged) {
218
+ // If column has been inserted/deleted avoid multi dispatch
219
+ if (!hasNumberedColumnChanged && !noOfColumnsChanged) {
219
220
  _this.scaleTable({
220
221
  parentWidth: parentWidth,
221
222
  layoutChanged: layoutChanged
@@ -47,16 +47,30 @@ var TableCellNodeView = /*#__PURE__*/function () {
47
47
  }
48
48
 
49
49
  (0, _createClass2.default)(TableCellNodeView, [{
50
- key: "shouldRecreateNodeView",
51
- value: function shouldRecreateNodeView(node) {
50
+ key: "updateNodeView",
51
+ value: function updateNodeView(node) {
52
52
  var _this = this;
53
53
 
54
54
  if (this.node.type !== node.type) {
55
55
  return false;
56
56
  }
57
57
 
58
- var attrs = (0, _adfSchema.setCellAttrs)(this.node);
59
- var nextAttrs = (0, _adfSchema.setCellAttrs)(node); // added + changed attributes
58
+ var attrs = (0, _adfSchema.getCellDomAttrs)(this.node);
59
+ var nextAttrs = (0, _adfSchema.getCellDomAttrs)(node);
60
+
61
+ var _getCellAttrs = (0, _adfSchema.getCellAttrs)(this.dom),
62
+ colspan = _getCellAttrs.colspan,
63
+ rowspan = _getCellAttrs.rowspan; // need to rerender when colspan/rowspan in dom are different from the node attrs
64
+ // this can happen when undoing merge cells
65
+
66
+
67
+ var defaultColspan = 1,
68
+ defaultRowspan = 1;
69
+
70
+ if (colspan !== (node.attrs.colspan || defaultColspan) || rowspan !== (node.attrs.rowspan || defaultRowspan)) {
71
+ return false;
72
+ } // added + changed attributes
73
+
60
74
 
61
75
  var addedAttrs = Object.entries(nextAttrs).filter(function (_ref2) {
62
76
  var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
@@ -93,9 +107,9 @@ var TableCellNodeView = /*#__PURE__*/function () {
93
107
  }, {
94
108
  key: "update",
95
109
  value: function update(node) {
96
- var shouldUpdate = this.shouldRecreateNodeView(node);
110
+ var didUpdate = this.updateNodeView(node);
97
111
  this.node = node;
98
- return shouldUpdate;
112
+ return didUpdate;
99
113
  }
100
114
  }, {
101
115
  key: "destroy",
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.getNewResizeStateFromSelectedColumns = exports.areColumnsEven = exports.bulkColumnsResize = exports.evenSelectedColumnsWidths = exports.evenAllColumnsWidths = exports.adjustColumnsWidths = exports.getTotalWidth = exports.updateColgroup = exports.getResizeState = void 0;
8
+ exports.getNewResizeStateFromSelectedColumns = exports.normaliseTableLayout = exports.areColumnsEven = exports.bulkColumnsResize = exports.evenSelectedColumnsWidths = exports.evenAllColumnsWidths = exports.adjustColumnsWidths = exports.getTotalWidth = exports.updateColgroup = exports.getResizeState = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
@@ -218,8 +218,7 @@ var bulkColumnsResize = function bulkColumnsResize(resizeState, columnsIndexes,
218
218
 
219
219
  var newState = _objectSpread(_objectSpread({}, resizeState), {}, {
220
220
  cols: cols.map(function (col) {
221
- if (columnsIndexes.indexOf(col.index) > -1 || // take from prev columns only if dragging the first handle to the left
222
- columnsIndexes.indexOf(sourceColumnIndex) > -1 && col.index < colIndex) {
221
+ if (columnsIndexes.indexOf(col.index) > -1 || columnsIndexes.indexOf(sourceColumnIndex) > -1 && col.index < colIndex) {
223
222
  return col;
224
223
  }
225
224
 
@@ -257,19 +256,19 @@ var bulkColumnsResize = function bulkColumnsResize(resizeState, columnsIndexes,
257
256
  } // table is in overflow: keep the dragged column at its widths and evenly distribute columns
258
257
  // to recover from overflow state
259
258
  else {
260
- var columnWidth = Math.floor((minTableWidth - sourceCol.width) / (newState.cols.length - 1));
261
- newState = _objectSpread(_objectSpread({}, resizeState), {}, {
262
- cols: newState.cols.map(function (col) {
263
- if (col.index === sourceCol.index) {
264
- return col;
265
- }
266
-
267
- return _objectSpread(_objectSpread({}, col), {}, {
268
- width: columnWidth
269
- });
270
- })
271
- });
272
- }
259
+ var columnWidth = Math.floor((minTableWidth - sourceCol.width) / (newState.cols.length - 1));
260
+ newState = _objectSpread(_objectSpread({}, resizeState), {}, {
261
+ cols: newState.cols.map(function (col) {
262
+ if (col.index === sourceCol.index) {
263
+ return col;
264
+ }
265
+
266
+ return _objectSpread(_objectSpread({}, col), {}, {
267
+ width: columnWidth
268
+ });
269
+ })
270
+ });
271
+ }
273
272
  } // fix total table widths by adding missing pixels to columns widths here and there
274
273
 
275
274
 
@@ -301,6 +300,8 @@ var normaliseTableLayout = function normaliseTableLayout(input) {
301
300
  }
302
301
  };
303
302
 
303
+ exports.normaliseTableLayout = normaliseTableLayout;
304
+
304
305
  var getNewResizeStateFromSelectedColumns = function getNewResizeStateFromSelectedColumns(rect, state, domAtPos, dynamicTextSizing) {
305
306
  var _getSelectedTableInfo = (0, _utils.getSelectedTableInfo)(state.selection),
306
307
  totalRowCount = _getSelectedTableInfo.totalRowCount,
@@ -5,6 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.scaleTableTo = scaleTableTo;
8
9
  exports.scaleWithParent = exports.scale = void 0;
9
10
 
10
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
@@ -133,12 +133,12 @@ var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorSta
133
133
  var options = [{
134
134
  id: 'editor.table.insertColumn',
135
135
  title: formatMessage(_messages2.default.insertColumn),
136
- onClick: function onClick(state, dispatch) {
136
+ onClick: function onClick(state, dispatch, view) {
137
137
  var selectionRect = getClosestSelectionRect(state);
138
138
  var index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.right;
139
139
 
140
140
  if (index) {
141
- (0, _commandsWithAnalytics.insertColumnWithAnalytics)(_analytics.INPUT_METHOD.FLOATING_TB, index)(state, dispatch);
141
+ (0, _commandsWithAnalytics.insertColumnWithAnalytics)(_analytics.INPUT_METHOD.FLOATING_TB, index)(state, dispatch, view);
142
142
  }
143
143
 
144
144
  return true;
@@ -168,11 +168,11 @@ var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorSta
168
168
  title: formatMessage(_messages2.default.removeColumns, {
169
169
  0: numberOfColumns
170
170
  }),
171
- onClick: function onClick(state, dispatch) {
171
+ onClick: function onClick(state, dispatch, view) {
172
172
  var selectionRect = getClosestSelectionRect(state);
173
173
 
174
174
  if (selectionRect) {
175
- (0, _commandsWithAnalytics.deleteColumnsWithAnalytics)(_analytics.INPUT_METHOD.FLOATING_TB, selectionRect)(state, dispatch);
175
+ (0, _commandsWithAnalytics.deleteColumnsWithAnalytics)(_analytics.INPUT_METHOD.FLOATING_TB, selectionRect)(state, dispatch, view);
176
176
  }
177
177
 
178
178
  return true;
@@ -5,14 +5,24 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.updateColumnWidths = void 0;
8
+ exports.rescaleColumns = exports.updateColumnWidths = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
12
  var _tableMap = require("@atlaskit/editor-tables/table-map");
13
13
 
14
+ var _utils = require("../pm-plugins/table-resizing/utils");
15
+
14
16
  var _metadata = require("./metadata");
15
17
 
18
+ var _resizeState = require("../pm-plugins/table-resizing/utils/resize-state");
19
+
20
+ var _misc = require("../pm-plugins/table-resizing/utils/misc");
21
+
22
+ var _editorCommon = require("@atlaskit/editor-common");
23
+
24
+ var _scaleTable = require("../pm-plugins/table-resizing/utils/scale-table");
25
+
16
26
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
17
27
 
18
28
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -105,21 +115,71 @@ var updateColumnWidths = function updateColumnWidths(resizeState, table, start)
105
115
  }
106
116
 
107
117
  var tablePos = start - 1;
108
- var _tr = tr,
109
- selection = _tr.selection;
110
- /* Create a mapping before the table node is replaced to allow the current
111
- * selection to be mapped back to it's original position inside the table.
118
+ var selectionBookmark = tr.selection.getBookmark();
119
+ tr.replaceWith(tablePos, tablePos + table.nodeSize, table.type.createChecked(table.attrs, rows, table.marks));
120
+ /**
121
+ * We want to restore to the original selection but w/o applying the mapping. Function
122
+ * tr.replaceWith puts the selection after the inserted content. We need to manually
123
+ * set the selection back to original state. Mapping in this case doesn't quite work
124
+ * e.g. if we change the content before a selection. This is because mapping
125
+ * means moving it if the content in front of it changed. Instead we can get
126
+ * bookmark of selection.
112
127
  *
113
- * If the mapping from the new 'replaceWith' transaction is used, prosemirror
114
- * will map the selection to after the table as it thinks the original table
115
- * node has been deleted.
128
+ * @see https://github.com/ProseMirror/prosemirror/issues/645
116
129
  */
117
130
 
118
- var originalMap = Object.assign(Object.create(Object.getPrototypeOf(tr.mapping)), tr.mapping);
119
- tr.replaceWith(tablePos, tablePos + table.nodeSize, table.type.createChecked(table.attrs, rows, table.marks)); // restore selection after replacing the table
131
+ return tr.setSelection(selectionBookmark.resolve(tr.doc));
132
+ };
133
+ };
134
+ /**
135
+ * This function is called when user inserts/deletes a column in a table to rescale all columns.
136
+ * This is done manually to avoid a multi-dispatch in TableComponent. See [ED-8288].
137
+ * @param table
138
+ * @param view
139
+ * @returns Updated transaction with rescaled columns for a given table
140
+ */
141
+
142
+
143
+ exports.updateColumnWidths = updateColumnWidths;
144
+
145
+ var rescaleColumns = function rescaleColumns(table, view) {
146
+ return function (tr) {
147
+ if (!view || !(0, _utils.hasTableBeenResized)(table.node)) {
148
+ return tr;
149
+ }
150
+
151
+ var state = view.state;
152
+ var domAtPos = view.domAtPos.bind(view);
153
+ var maybeTable = domAtPos(table.start).node;
154
+ var tableRef = maybeTable.closest('table');
155
+
156
+ if (!tableRef) {
157
+ return tr;
158
+ }
159
+
160
+ var layout = (0, _resizeState.normaliseTableLayout)(tableRef === null || tableRef === void 0 ? void 0 : tableRef.dataset.layout);
161
+ var maxSize = (0, _misc.getTableMaxWidth)({
162
+ table: table.node,
163
+ tableStart: table.start,
164
+ state: state,
165
+ layout: layout,
166
+ dynamicTextSizing: true
167
+ });
168
+ var resizeState = (0, _resizeState.getResizeState)({
169
+ minWidth: _editorCommon.tableCellMinWidth,
170
+ table: table.node,
171
+ start: table.start,
172
+ tableRef: tableRef,
173
+ domAtPos: domAtPos,
174
+ maxSize: maxSize
175
+ });
176
+
177
+ if (resizeState.overflow) {
178
+ resizeState = (0, _scaleTable.scaleTableTo)(resizeState, maxSize);
179
+ }
120
180
 
121
- return tr.setSelection(selection.map(tr.doc, originalMap));
181
+ return updateColumnWidths(resizeState, table.node, table.start)(tr);
122
182
  };
123
183
  };
124
184
 
125
- exports.updateColumnWidths = updateColumnWidths;
185
+ exports.rescaleColumns = rescaleColumns;
@@ -354,7 +354,7 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
354
354
  break;
355
355
 
356
356
  case 'insert_column':
357
- (0, _commandsWithAnalytics.insertColumnWithAnalytics)(_analytics.INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch);
357
+ (0, _commandsWithAnalytics.insertColumnWithAnalytics)(_analytics.INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
358
358
 
359
359
  _this.toggleOpen();
360
360
 
@@ -228,7 +228,7 @@ var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
228
228
  event.preventDefault();
229
229
  var state = editorView.state,
230
230
  dispatch = editorView.dispatch;
231
- (0, _commandsWithAnalytics.insertColumnWithAnalytics)(_analytics.INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch);
231
+ (0, _commandsWithAnalytics.insertColumnWithAnalytics)(_analytics.INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
232
232
  }
233
233
  }
234
234
  }]);
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
- exports.getMergedCellsPositions = void 0;
8
+ exports.colsToRect = exports.getMergedCellsPositions = void 0;
9
+
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
7
11
 
8
12
  var _tableMap = require("@atlaskit/editor-tables/table-map");
9
13
 
@@ -30,4 +34,15 @@ var getMergedCellsPositions = function getMergedCellsPositions(tr) {
30
34
  return mergedCells;
31
35
  };
32
36
 
33
- exports.getMergedCellsPositions = getMergedCellsPositions;
37
+ exports.getMergedCellsPositions = getMergedCellsPositions;
38
+
39
+ var colsToRect = function colsToRect(cols, noOfRows) {
40
+ return {
41
+ left: Math.min.apply(Math, (0, _toConsumableArray2.default)(cols)),
42
+ right: Math.max.apply(Math, (0, _toConsumableArray2.default)(cols)) + 1,
43
+ top: 0,
44
+ bottom: noOfRows
45
+ };
46
+ };
47
+
48
+ exports.colsToRect = colsToRect;
@@ -204,8 +204,7 @@ var deleteHandler = (0, _commands.filter)([_helpers.isInsideTaskOrDecisionItem,
204
204
  } // if nested, just unindent
205
205
 
206
206
 
207
- 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
208
- $next.node($next.depth - 1).type === taskList && $next.parent.type === taskList) {
207
+ if ($next.node($next.depth - 2).type === taskList || $next.node($next.depth - 1).type === taskList && $next.parent.type === taskList) {
209
208
  var tr = (0, _helpers.liftBlock)(state.tr, $next, $next);
210
209
 
211
210
  if (dispatch && tr) {
@@ -175,12 +175,6 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
175
175
  isOpen = _this$state.isOpen,
176
176
  isShowingMoreColors = _this$state.isShowingMoreColors;
177
177
 
178
- if (e.defaultPrevented) {
179
- // This should be handled by stopping propogation, but as an additional safety net
180
- // we ignore handled events for the purpose of hiding the popup.
181
- return;
182
- }
183
-
184
178
  if (isOpen === true) {
185
179
  _this.dispatchAnalyticsEvent(_this.buildAnalyticsPalette(_analytics.ACTION.CLOSED, {
186
180
  isShowingMoreColors: isShowingMoreColors,
@@ -266,13 +260,15 @@ var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
266
260
  label: ""
267
261
  })))
268
262
  })
263
+ }, /*#__PURE__*/_react.default.createElement("div", {
264
+ "data-testid": "text-color-palette"
269
265
  }, /*#__PURE__*/_react.default.createElement(_ColorPalette.default, {
270
266
  palette: palette,
271
267
  onClick: function onClick(color) {
272
268
  return _this2.changeTextColor(color, pluginState.disabled);
273
269
  },
274
270
  selectedColor: pluginState.color
275
- }), showMoreColorsToggle && /*#__PURE__*/_react.default.createElement(_styles2.ShowMoreWrapper, null, /*#__PURE__*/_react.default.createElement(_customThemeButton.default, {
271
+ })), showMoreColorsToggle && /*#__PURE__*/_react.default.createElement(_styles2.ShowMoreWrapper, null, /*#__PURE__*/_react.default.createElement(_customThemeButton.default, {
276
272
  appearance: "subtle",
277
273
  onClick: this.handleShowMoreToggle,
278
274
  iconBefore: /*#__PURE__*/_react.default.createElement(_backgroundColor.default, {
@@ -32,10 +32,7 @@ var _default = new _prosemirrorState.Plugin({
32
32
  var clickWasAtTextNode = !!(clickNode && clickNode.isText);
33
33
  var clickWasAtEndOfAParagraphNode = $click.parent.type === paragraph && $click.textOffset === 0 && $click.nodeAfter === null;
34
34
 
35
- if (clickWasAtEdgeOfATextNode && clickWasNearACodeMark && clickedDOMElementPosition && ( // if click did not occur at a text node or end of paragraph, then
36
- // it was at a directly adjacent non-text node, so we skip this manual
37
- // text selection logic to preserve that non-text node's selection
38
- clickWasAtTextNode || clickWasAtEndOfAParagraphNode)) {
35
+ if (clickWasAtEdgeOfATextNode && clickWasNearACodeMark && clickedDOMElementPosition && (clickWasAtTextNode || clickWasAtEndOfAParagraphNode)) {
39
36
  var clickWasInsideNodeDOM = event.target.parentNode === view.domAtPos(clickedDOMElementPosition).node && code.isInSet(view.state.doc.resolve(clickedDOMElementPosition).nodeAfter.marks);
40
37
  var 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()]
41
38
 
@@ -25,9 +25,26 @@ var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
25
25
  }
26
26
  });
27
27
  var selection = tr.selection;
28
- var isTextRangeSelection = selection instanceof _prosemirrorState.TextSelection && selection.$cursor === null;
29
- var nextTr = isTextRangeSelection ? tr.deleteSelection() : tr;
30
- return nextTr;
28
+
29
+ if (!(selection instanceof _prosemirrorState.TextSelection)) {
30
+ return tr;
31
+ }
32
+
33
+ if (!selection.$cursor) {
34
+ tr.deleteSelection();
35
+ return tr;
36
+ } // Search & Destroy placeholder
37
+
38
+
39
+ var cursorPos = selection.$cursor.pos;
40
+ var nodeAtCursor = tr.doc.nodeAt(cursorPos);
41
+ var isPlaceholderAtCursorPosition = nodeAtCursor && nodeAtCursor.type.name === 'placeholder';
42
+
43
+ if (nodeAtCursor && isPlaceholderAtCursorPosition) {
44
+ tr.delete(cursorPos, cursorPos + nodeAtCursor.nodeSize);
45
+ }
46
+
47
+ return tr;
31
48
  };
32
49
  };
33
50
 
@@ -73,7 +73,7 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
73
73
  var text = cleanedInputContent();
74
74
  onQueryChange(text);
75
75
  }, [onQueryChange, cleanedInputContent]);
76
- var onKeyDown = (0, _react.useCallback)(function (event) {
76
+ var checkKeyEvent = (0, _react.useCallback)(function (event) {
77
77
  var key = (0, _w3cKeyname.keyName)(event);
78
78
  var sel = document.getSelection();
79
79
  var raw = ref.current.textContent || '';
@@ -186,7 +186,10 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
186
186
  });
187
187
  event.preventDefault();
188
188
  event.stopPropagation();
189
+ return;
189
190
  }
191
+
192
+ checkKeyEvent(event);
190
193
  };
191
194
 
192
195
  var onFocusOut = function onFocusOut(event) {
@@ -281,7 +284,7 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
281
284
  element.removeEventListener('input', onInput);
282
285
  }
283
286
  };
284
- }, [triggerQueryPrefix, cleanedInputContent, onQueryFocus, cancel]);
287
+ }, [triggerQueryPrefix, cleanedInputContent, onQueryFocus, cancel, checkKeyEvent]);
285
288
  (0, _react.useEffect)(function () {
286
289
  var hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
287
290
 
@@ -311,7 +314,6 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
311
314
  contentEditable: true,
312
315
  innerRef: ref,
313
316
  onKeyUp: onKeyUp,
314
- onKeyDown: onKeyDown,
315
317
  onClick: onClick,
316
318
  role: "textbox",
317
319
  suppressContentEditableWarning: true,
@@ -23,8 +23,6 @@ var _constants = require("@atlaskit/theme/constants");
23
23
 
24
24
  var _colors = require("@atlaskit/theme/colors");
25
25
 
26
- var _math = require("@atlaskit/theme/math");
27
-
28
26
  var _analytics = require("../../analytics");
29
27
 
30
28
  var _TypeAheadList = require("./TypeAheadList");
@@ -35,7 +33,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
35
33
 
36
34
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
35
 
38
- var TypeAheadContent = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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"])), _colors.N0, (0, _constants.borderRadius)(), _colors.N60A, _colors.N50A, (0, _math.divide)(_constants.gridSize, 2));
36
+ var TypeAheadContent = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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"])), _colors.N0, (0, _constants.borderRadius)(), _colors.N60A, _colors.N50A, (0, _constants.gridSize)() / 2);
39
37
 
40
38
  var Highlight = function Highlight(_ref) {
41
39
  var state = _ref.state,