@atlaskit/editor-plugin-table 1.1.0 → 1.1.2

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 (284) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/index.js +0 -2
  3. package/dist/cjs/plugins/table/commands/clear.js +4 -16
  4. package/dist/cjs/plugins/table/commands/collapse.js +0 -6
  5. package/dist/cjs/plugins/table/commands/go-to-next-cell.js +7 -18
  6. package/dist/cjs/plugins/table/commands/hover.js +7 -37
  7. package/dist/cjs/plugins/table/commands/index.js +0 -8
  8. package/dist/cjs/plugins/table/commands/insert.js +17 -56
  9. package/dist/cjs/plugins/table/commands/misc.js +36 -132
  10. package/dist/cjs/plugins/table/commands/referentiality.js +0 -4
  11. package/dist/cjs/plugins/table/commands/selection.js +21 -87
  12. package/dist/cjs/plugins/table/commands/sort.js +2 -23
  13. package/dist/cjs/plugins/table/commands/split-cell.js +3 -11
  14. package/dist/cjs/plugins/table/commands/toggle.js +8 -34
  15. package/dist/cjs/plugins/table/commands-with-analytics.js +50 -139
  16. package/dist/cjs/plugins/table/create-plugin-config.js +0 -6
  17. package/dist/cjs/plugins/table/event-handlers.js +58 -160
  18. package/dist/cjs/plugins/table/handlers.js +10 -39
  19. package/dist/cjs/plugins/table/index.js +47 -91
  20. package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -41
  21. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +82 -188
  22. package/dist/cjs/plugins/table/nodeviews/table.js +12 -70
  23. package/dist/cjs/plugins/table/nodeviews/tableCell.js +15 -39
  24. package/dist/cjs/plugins/table/nodeviews/update-overflow-shadows.js +3 -15
  25. package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +0 -18
  26. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -27
  27. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-resizing.js +8 -20
  28. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +1 -3
  29. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/index.js +0 -3
  30. package/dist/cjs/plugins/table/pm-plugins/keymap.js +2 -15
  31. package/dist/cjs/plugins/table/pm-plugins/main.js +20 -72
  32. package/dist/cjs/plugins/table/pm-plugins/plugin-factory.js +25 -42
  33. package/dist/cjs/plugins/table/pm-plugins/plugin-key.js +0 -2
  34. package/dist/cjs/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -8
  35. package/dist/cjs/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +4 -23
  36. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/commands.js +0 -5
  37. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/index.js +0 -5
  38. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -13
  39. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +56 -138
  40. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-key.js +0 -2
  41. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-state.js +15 -30
  42. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +0 -6
  43. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/util.js +0 -5
  44. package/dist/cjs/plugins/table/pm-plugins/table-local-id.js +13 -44
  45. package/dist/cjs/plugins/table/pm-plugins/table-resizing/commands.js +12 -42
  46. package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +16 -52
  47. package/dist/cjs/plugins/table/pm-plugins/table-resizing/index.js +0 -4
  48. package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-factory.js +0 -10
  49. package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-key.js +0 -2
  50. package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin.js +5 -19
  51. package/dist/cjs/plugins/table/pm-plugins/table-resizing/reducer.js +0 -10
  52. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +0 -15
  53. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -28
  54. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/content-width.js +3 -23
  55. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +4 -46
  56. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/index.js +0 -9
  57. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +15 -36
  58. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-column.js +1 -4
  59. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +15 -71
  60. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +34 -82
  61. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +12 -36
  62. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.js +0 -2
  63. package/dist/cjs/plugins/table/pm-plugins/table-selection-keymap.js +0 -5
  64. package/dist/cjs/plugins/table/reducer.js +0 -24
  65. package/dist/cjs/plugins/table/toolbar.js +14 -94
  66. package/dist/cjs/plugins/table/transforms/column-width.js +12 -45
  67. package/dist/cjs/plugins/table/transforms/delete-columns.js +11 -76
  68. package/dist/cjs/plugins/table/transforms/delete-rows.js +4 -42
  69. package/dist/cjs/plugins/table/transforms/fix-tables.js +24 -61
  70. package/dist/cjs/plugins/table/transforms/index.js +0 -7
  71. package/dist/cjs/plugins/table/transforms/merge.js +14 -90
  72. package/dist/cjs/plugins/table/transforms/metadata.js +0 -5
  73. package/dist/cjs/plugins/table/transforms/replace-table.js +2 -13
  74. package/dist/cjs/plugins/table/transforms/split.js +18 -32
  75. package/dist/cjs/plugins/table/types.js +0 -11
  76. package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +10 -51
  77. package/dist/cjs/plugins/table/ui/FloatingContextualButton/styles.js +0 -12
  78. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +46 -145
  79. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +12 -35
  80. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/styles.js +0 -11
  81. package/dist/cjs/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +5 -12
  82. package/dist/cjs/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +3 -16
  83. package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +19 -89
  84. package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +6 -31
  85. package/dist/cjs/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +5 -22
  86. package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +25 -80
  87. package/dist/cjs/plugins/table/ui/LayoutButton/index.js +16 -64
  88. package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +14 -47
  89. package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +20 -48
  90. package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/index.js +10 -43
  91. package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +33 -74
  92. package/dist/cjs/plugins/table/ui/common-styles.js +6 -19
  93. package/dist/cjs/plugins/table/ui/consts.js +3 -8
  94. package/dist/cjs/plugins/table/ui/messages.js +0 -3
  95. package/dist/cjs/plugins/table/ui/ui-styles.js +0 -32
  96. package/dist/cjs/plugins/table/utils/analytics.js +4 -19
  97. package/dist/cjs/plugins/table/utils/collapse.js +4 -21
  98. package/dist/cjs/plugins/table/utils/column-controls.js +25 -61
  99. package/dist/cjs/plugins/table/utils/decoration.js +46 -114
  100. package/dist/cjs/plugins/table/utils/dom.js +4 -51
  101. package/dist/cjs/plugins/table/utils/get-allow-add-column-custom-step.js +0 -2
  102. package/dist/cjs/plugins/table/utils/index.js +0 -10
  103. package/dist/cjs/plugins/table/utils/nodes.js +5 -48
  104. package/dist/cjs/plugins/table/utils/paste.js +22 -47
  105. package/dist/cjs/plugins/table/utils/row-controls.js +6 -67
  106. package/dist/cjs/plugins/table/utils/selection.js +3 -36
  107. package/dist/cjs/plugins/table/utils/table.js +0 -11
  108. package/dist/cjs/plugins/table/utils/update-plugin-state-decorations.js +0 -4
  109. package/dist/cjs/plugins/table-plugin.js +0 -3
  110. package/dist/cjs/version.json +1 -1
  111. package/dist/es2019/plugins/table/commands/clear.js +3 -8
  112. package/dist/es2019/plugins/table/commands/collapse.js +0 -3
  113. package/dist/es2019/plugins/table/commands/go-to-next-cell.js +4 -7
  114. package/dist/es2019/plugins/table/commands/hover.js +7 -17
  115. package/dist/es2019/plugins/table/commands/insert.js +16 -36
  116. package/dist/es2019/plugins/table/commands/misc.js +37 -67
  117. package/dist/es2019/plugins/table/commands/selection.js +7 -62
  118. package/dist/es2019/plugins/table/commands/sort.js +0 -12
  119. package/dist/es2019/plugins/table/commands/split-cell.js +0 -4
  120. package/dist/es2019/plugins/table/commands/toggle.js +13 -15
  121. package/dist/es2019/plugins/table/commands-with-analytics.js +4 -14
  122. package/dist/es2019/plugins/table/event-handlers.js +14 -62
  123. package/dist/es2019/plugins/table/handlers.js +16 -26
  124. package/dist/es2019/plugins/table/index.js +12 -25
  125. package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -40
  126. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +27 -100
  127. package/dist/es2019/plugins/table/nodeviews/table.js +3 -33
  128. package/dist/es2019/plugins/table/nodeviews/tableCell.js +7 -16
  129. package/dist/es2019/plugins/table/nodeviews/update-overflow-shadows.js +3 -10
  130. package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +0 -5
  131. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +4 -13
  132. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-resizing.js +0 -3
  133. package/dist/es2019/plugins/table/pm-plugins/keymap.js +2 -3
  134. package/dist/es2019/plugins/table/pm-plugins/main.js +19 -43
  135. package/dist/es2019/plugins/table/pm-plugins/plugin-factory.js +2 -6
  136. package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -3
  137. package/dist/es2019/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +0 -12
  138. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -9
  139. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +55 -130
  140. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin-state.js +2 -9
  141. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/util.js +0 -3
  142. package/dist/es2019/plugins/table/pm-plugins/table-local-id.js +20 -39
  143. package/dist/es2019/plugins/table/pm-plugins/table-resizing/commands.js +7 -15
  144. package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +9 -27
  145. package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin-factory.js +2 -4
  146. package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin.js +2 -5
  147. package/dist/es2019/plugins/table/pm-plugins/table-resizing/reducer.js +8 -8
  148. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +0 -4
  149. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -11
  150. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/content-width.js +4 -21
  151. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -22
  152. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +10 -18
  153. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +29 -59
  154. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +54 -51
  155. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +9 -14
  156. package/dist/es2019/plugins/table/reducer.js +26 -30
  157. package/dist/es2019/plugins/table/toolbar.js +5 -48
  158. package/dist/es2019/plugins/table/transforms/column-width.js +16 -28
  159. package/dist/es2019/plugins/table/transforms/delete-columns.js +17 -58
  160. package/dist/es2019/plugins/table/transforms/delete-rows.js +8 -25
  161. package/dist/es2019/plugins/table/transforms/fix-tables.js +25 -42
  162. package/dist/es2019/plugins/table/transforms/merge.js +22 -70
  163. package/dist/es2019/plugins/table/transforms/metadata.js +3 -2
  164. package/dist/es2019/plugins/table/transforms/replace-table.js +0 -2
  165. package/dist/es2019/plugins/table/transforms/split.js +16 -19
  166. package/dist/es2019/plugins/table/types.js +2 -4
  167. package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +2 -16
  168. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +8 -54
  169. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +4 -13
  170. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +0 -2
  171. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +2 -11
  172. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +13 -49
  173. package/dist/es2019/plugins/table/ui/FloatingInsertButton/InsertButton.js +0 -8
  174. package/dist/es2019/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +16 -24
  175. package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +3 -31
  176. package/dist/es2019/plugins/table/ui/LayoutButton/index.js +2 -29
  177. package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +0 -12
  178. package/dist/es2019/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +6 -12
  179. package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/index.js +0 -9
  180. package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +4 -19
  181. package/dist/es2019/plugins/table/ui/common-styles.js +6 -5
  182. package/dist/es2019/plugins/table/ui/consts.js +4 -3
  183. package/dist/es2019/plugins/table/ui/ui-styles.js +0 -10
  184. package/dist/es2019/plugins/table/utils/analytics.js +0 -8
  185. package/dist/es2019/plugins/table/utils/collapse.js +3 -14
  186. package/dist/es2019/plugins/table/utils/column-controls.js +22 -37
  187. package/dist/es2019/plugins/table/utils/decoration.js +13 -51
  188. package/dist/es2019/plugins/table/utils/dom.js +3 -19
  189. package/dist/es2019/plugins/table/utils/nodes.js +2 -15
  190. package/dist/es2019/plugins/table/utils/paste.js +17 -22
  191. package/dist/es2019/plugins/table/utils/row-controls.js +12 -45
  192. package/dist/es2019/plugins/table/utils/selection.js +0 -21
  193. package/dist/es2019/plugins/table/utils/table.js +0 -2
  194. package/dist/es2019/version.json +1 -1
  195. package/dist/esm/plugins/table/commands/clear.js +3 -8
  196. package/dist/esm/plugins/table/commands/collapse.js +0 -3
  197. package/dist/esm/plugins/table/commands/go-to-next-cell.js +6 -9
  198. package/dist/esm/plugins/table/commands/hover.js +8 -18
  199. package/dist/esm/plugins/table/commands/insert.js +16 -36
  200. package/dist/esm/plugins/table/commands/misc.js +39 -78
  201. package/dist/esm/plugins/table/commands/selection.js +21 -78
  202. package/dist/esm/plugins/table/commands/sort.js +2 -14
  203. package/dist/esm/plugins/table/commands/split-cell.js +3 -8
  204. package/dist/esm/plugins/table/commands/toggle.js +11 -20
  205. package/dist/esm/plugins/table/commands-with-analytics.js +50 -85
  206. package/dist/esm/plugins/table/create-plugin-config.js +0 -3
  207. package/dist/esm/plugins/table/event-handlers.js +58 -123
  208. package/dist/esm/plugins/table/handlers.js +11 -29
  209. package/dist/esm/plugins/table/index.js +47 -60
  210. package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -44
  211. package/dist/esm/plugins/table/nodeviews/TableComponent.js +82 -181
  212. package/dist/esm/plugins/table/nodeviews/table.js +12 -52
  213. package/dist/esm/plugins/table/nodeviews/tableCell.js +15 -33
  214. package/dist/esm/plugins/table/nodeviews/update-overflow-shadows.js +3 -10
  215. package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +0 -5
  216. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -19
  217. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-resizing.js +8 -13
  218. package/dist/esm/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +1 -1
  219. package/dist/esm/plugins/table/pm-plugins/keymap.js +2 -3
  220. package/dist/esm/plugins/table/pm-plugins/main.js +20 -47
  221. package/dist/esm/plugins/table/pm-plugins/plugin-factory.js +25 -37
  222. package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -3
  223. package/dist/esm/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +3 -15
  224. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -9
  225. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +58 -147
  226. package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin-state.js +15 -27
  227. package/dist/esm/plugins/table/pm-plugins/sticky-headers/util.js +0 -3
  228. package/dist/esm/plugins/table/pm-plugins/table-local-id.js +14 -37
  229. package/dist/esm/plugins/table/pm-plugins/table-resizing/commands.js +12 -24
  230. package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +16 -36
  231. package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin-factory.js +0 -6
  232. package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin.js +5 -8
  233. package/dist/esm/plugins/table/pm-plugins/table-resizing/reducer.js +0 -7
  234. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +0 -4
  235. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -12
  236. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/content-width.js +5 -22
  237. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/dom.js +4 -23
  238. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +15 -23
  239. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +15 -60
  240. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +34 -55
  241. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +12 -24
  242. package/dist/esm/plugins/table/reducer.js +0 -20
  243. package/dist/esm/plugins/table/toolbar.js +13 -63
  244. package/dist/esm/plugins/table/transforms/column-width.js +12 -32
  245. package/dist/esm/plugins/table/transforms/delete-columns.js +11 -62
  246. package/dist/esm/plugins/table/transforms/delete-rows.js +4 -30
  247. package/dist/esm/plugins/table/transforms/fix-tables.js +24 -49
  248. package/dist/esm/plugins/table/transforms/merge.js +16 -75
  249. package/dist/esm/plugins/table/transforms/metadata.js +3 -2
  250. package/dist/esm/plugins/table/transforms/replace-table.js +2 -6
  251. package/dist/esm/plugins/table/transforms/split.js +18 -29
  252. package/dist/esm/plugins/table/types.js +0 -6
  253. package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +10 -31
  254. package/dist/esm/plugins/table/ui/FloatingContextualButton/styles.js +0 -2
  255. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +46 -126
  256. package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +13 -24
  257. package/dist/esm/plugins/table/ui/FloatingContextualMenu/styles.js +0 -2
  258. package/dist/esm/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +5 -7
  259. package/dist/esm/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +3 -13
  260. package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +19 -68
  261. package/dist/esm/plugins/table/ui/FloatingInsertButton/InsertButton.js +6 -14
  262. package/dist/esm/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +5 -18
  263. package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +25 -57
  264. package/dist/esm/plugins/table/ui/LayoutButton/index.js +16 -47
  265. package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +14 -35
  266. package/dist/esm/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +20 -38
  267. package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/index.js +10 -29
  268. package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +33 -62
  269. package/dist/esm/plugins/table/ui/common-styles.js +6 -7
  270. package/dist/esm/plugins/table/ui/consts.js +4 -3
  271. package/dist/esm/plugins/table/ui/ui-styles.js +0 -12
  272. package/dist/esm/plugins/table/utils/analytics.js +4 -13
  273. package/dist/esm/plugins/table/utils/collapse.js +4 -15
  274. package/dist/esm/plugins/table/utils/column-controls.js +25 -41
  275. package/dist/esm/plugins/table/utils/decoration.js +46 -88
  276. package/dist/esm/plugins/table/utils/dom.js +4 -20
  277. package/dist/esm/plugins/table/utils/nodes.js +5 -18
  278. package/dist/esm/plugins/table/utils/paste.js +24 -29
  279. package/dist/esm/plugins/table/utils/row-controls.js +6 -46
  280. package/dist/esm/plugins/table/utils/selection.js +3 -26
  281. package/dist/esm/plugins/table/utils/table.js +0 -2
  282. package/dist/esm/version.json +1 -1
  283. package/package.json +2 -2
  284. package/src/__tests__/visual-regression/cell-options-menu.ts +1 -12
@@ -4,11 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.composeDecorations = void 0;
7
-
8
7
  var composeDecorations = function composeDecorations(transformers) {
9
8
  return function (_ref) {
10
9
  var decorationSet = _ref.decorationSet,
11
- tr = _ref.tr;
10
+ tr = _ref.tr;
12
11
  return transformers.reduce(function (decorationSet, transform) {
13
12
  return transform({
14
13
  decorationSet: decorationSet,
@@ -17,5 +16,4 @@ var composeDecorations = function composeDecorations(transformers) {
17
16
  }, decorationSet);
18
17
  };
19
18
  };
20
-
21
19
  exports.composeDecorations = composeDecorations;
@@ -27,9 +27,6 @@ Object.defineProperty(exports, "maybeUpdateColumnControlsSelectedDecoration", {
27
27
  return _columnControls.maybeUpdateColumnControlsSelectedDecoration;
28
28
  }
29
29
  });
30
-
31
30
  var _columnControls = require("./column-controls");
32
-
33
31
  var _columnResizing = require("./column-resizing");
34
-
35
32
  var _composeDecorations = require("./compose-decorations");
@@ -1,33 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _typeof = require("@babel/runtime/helpers/typeof");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
8
  exports.keymapPlugin = keymapPlugin;
10
-
11
9
  var _prosemirrorKeymap = require("prosemirror-keymap");
12
-
13
10
  var _prosemirrorCommands = require("prosemirror-commands");
14
-
15
11
  var keymaps = _interopRequireWildcard(require("@atlaskit/editor-common/keymaps"));
16
-
17
12
  var _analytics = require("@atlaskit/editor-common/analytics");
18
-
19
13
  var _commands = require("../commands");
20
-
21
14
  var _commandsWithAnalytics = require("../commands-with-analytics");
22
-
23
15
  var _insert = require("../commands/insert");
24
-
25
16
  var _analytics2 = require("../utils/analytics");
26
-
27
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
28
-
29
18
  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; }
30
-
31
19
  var createTableWithAnalytics = function createTableWithAnalytics(editorAnalyticsAPI) {
32
20
  return (0, _analytics2.withEditorAnalyticsAPI)({
33
21
  action: _analytics.ACTION.INSERTED,
@@ -39,21 +27,20 @@ var createTableWithAnalytics = function createTableWithAnalytics(editorAnalytics
39
27
  eventType: _analytics.EVENT_TYPE.TRACK
40
28
  })(editorAnalyticsAPI)((0, _commands.createTable)());
41
29
  };
42
-
43
30
  function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI) {
44
31
  var list = {};
45
32
  keymaps.bindKeymapWithCommand(keymaps.nextCell.common, (0, _commands.goToNextCell)(editorAnalyticsAPI)(1), list);
46
33
  keymaps.bindKeymapWithCommand(keymaps.previousCell.common, (0, _commands.goToNextCell)(editorAnalyticsAPI)(-1), list);
47
34
  keymaps.bindKeymapWithCommand(keymaps.toggleTable.common, createTableWithAnalytics(editorAnalyticsAPI), list);
48
35
  keymaps.bindKeymapWithCommand(keymaps.backspace.common, (0, _prosemirrorCommands.chainCommands)((0, _commandsWithAnalytics.deleteTableIfSelectedWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD), (0, _commandsWithAnalytics.emptyMultipleCellsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD)), list);
49
- keymaps.bindKeymapWithCommand(keymaps.backspace.common, _commands.moveCursorBackward, list); // Add row/column shortcuts
36
+ keymaps.bindKeymapWithCommand(keymaps.backspace.common, _commands.moveCursorBackward, list);
50
37
 
38
+ // Add row/column shortcuts
51
39
  keymaps.bindKeymapWithCommand(keymaps.addRowBefore.common, (0, _commandsWithAnalytics.addRowAroundSelection)(editorAnalyticsAPI)('TOP'), list);
52
40
  keymaps.bindKeymapWithCommand(keymaps.addRowAfter.common, (0, _commandsWithAnalytics.addRowAroundSelection)(editorAnalyticsAPI)('BOTTOM'), list);
53
41
  keymaps.bindKeymapWithCommand(keymaps.addColumnBefore.common, (0, _commands.triggerUnlessTableHeader)((0, _insert.addColumnBefore)(getEditorContainerWidth)), list);
54
42
  keymaps.bindKeymapWithCommand(keymaps.addColumnAfter.common, (0, _insert.addColumnAfter)(getEditorContainerWidth), list);
55
43
  return (0, _prosemirrorKeymap.keymap)(list);
56
44
  }
57
-
58
45
  var _default = keymapPlugin;
59
46
  exports.default = _default;
@@ -1,65 +1,38 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createPlugin = void 0;
9
-
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
-
14
10
  var _prosemirrorUtils = require("prosemirror-utils");
15
-
16
11
  var _utils = require("@atlaskit/editor-tables/utils");
17
-
18
12
  var _utils2 = require("@atlaskit/editor-common/utils");
19
-
20
13
  var _commands = require("../commands");
21
-
22
14
  var _eventHandlers = require("../event-handlers");
23
-
24
15
  var _table = require("../nodeviews/table");
25
-
26
16
  var _plugin = require("../pm-plugins/decorations/plugin");
27
-
28
17
  var _transforms = require("../transforms");
29
-
30
18
  var _types = require("../types");
31
-
32
19
  var _utils3 = require("../utils");
33
-
34
20
  var _analytics = require("@atlaskit/editor-common/analytics");
35
-
36
21
  var _defaultTableSelection = require("./default-table-selection");
37
-
38
22
  var _pluginFactory = require("./plugin-factory");
39
-
40
23
  var _pluginKey = require("./plugin-key");
41
-
42
24
  var _tableCell = _interopRequireDefault(require("../nodeviews/tableCell"));
43
-
44
25
  var _misc = require("../commands/misc");
45
-
46
26
  var _transforms2 = require("@atlaskit/editor-common/transforms");
47
-
48
27
  var _coreUtils = require("@atlaskit/editor-common/core-utils");
49
-
50
28
  var _paste = require("../utils/paste");
51
-
52
29
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
53
-
54
30
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
55
-
56
31
  var isBreakoutEnabled;
57
32
  var isFullWidthModeEnabled;
58
33
  var wasFullWidthModeEnabled;
59
-
60
34
  var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, breakoutEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI) {
61
35
  var _window;
62
-
63
36
  isBreakoutEnabled = breakoutEnabled;
64
37
  isFullWidthModeEnabled = fullWidthModeEnabled;
65
38
  wasFullWidthModeEnabled = previousFullWidthModeEnabled;
@@ -77,7 +50,6 @@ var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, porta
77
50
  if (!entry.target.id) {
78
51
  return;
79
52
  }
80
-
81
53
  elementContentRects[entry.target.id] = entry.contentRect;
82
54
  });
83
55
  }) : undefined;
@@ -88,21 +60,18 @@ var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, porta
88
60
  tableHeader: function tableHeader(node, view, getPos) {
89
61
  return new _tableCell.default(node, view, getPos, getEditorFeatureFlags, observer);
90
62
  }
91
- }; // Used to prevent invalid table cell spans being reported more than once per editor/document
63
+ };
92
64
 
65
+ // Used to prevent invalid table cell spans being reported more than once per editor/document
93
66
  var invalidTableIds = [];
94
67
  var editorViewRef = null;
95
-
96
68
  var getCurrentEditorState = function getCurrentEditorState() {
97
69
  var editorView = editorViewRef;
98
-
99
70
  if (!editorView) {
100
71
  return null;
101
72
  }
102
-
103
73
  return editorView.state;
104
74
  };
105
-
106
75
  return new _safePlugin.SafePlugin({
107
76
  state: state,
108
77
  key: _pluginKey.pluginKey,
@@ -110,14 +79,12 @@ var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, porta
110
79
  var tr = transactions.find(function (tr) {
111
80
  return tr.getMeta('uiEvent') === 'cut';
112
81
  });
113
-
114
82
  function reportInvalidTableCellSpanAttrs(invalidNodeAttr) {
115
83
  if (invalidTableIds.find(function (id) {
116
84
  return id === invalidNodeAttr.tableLocalId;
117
85
  })) {
118
86
  return;
119
87
  }
120
-
121
88
  invalidTableIds.push(invalidNodeAttr.tableLocalId);
122
89
  dispatchAnalyticsEvent({
123
90
  action: _analytics.ACTION.INVALID_DOCUMENT_ENCOUNTERED,
@@ -131,13 +98,11 @@ var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, porta
131
98
  }
132
99
  });
133
100
  }
134
-
135
101
  if (tr) {
136
102
  // "fixTables" removes empty rows as we don't allow that in schema
137
103
  var updatedTr = (0, _eventHandlers.handleCut)(tr, oldState, newState, editorAnalyticsAPI);
138
104
  return (0, _transforms.fixTables)(updatedTr) || updatedTr;
139
105
  }
140
-
141
106
  if (transactions.find(function (tr) {
142
107
  return tr.docChanged;
143
108
  })) {
@@ -150,38 +115,30 @@ var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, porta
150
115
  return {
151
116
  update: function update(view) {
152
117
  var state = view.state,
153
- dispatch = view.dispatch;
118
+ dispatch = view.dispatch;
154
119
  var selection = state.selection;
155
120
  var pluginState = (0, _pluginFactory.getPluginState)(state);
156
121
  var tableRef;
157
122
  var tableNode;
158
-
159
123
  if (pluginState.editorHasFocus) {
160
124
  var parent = (0, _prosemirrorUtils.findParentDomRefOfType)(state.schema.nodes.table, domAtPos)(selection);
161
-
162
125
  if (parent) {
163
126
  tableRef = parent.querySelector('table') || undefined;
164
127
  }
165
-
166
128
  tableNode = (0, _utils.findTable)(state.selection);
167
129
  }
168
-
169
130
  if (pluginState.tableRef !== tableRef) {
170
131
  (0, _commands.setTableRef)(tableRef)(state, dispatch);
171
132
  }
172
-
173
133
  if (pluginState.tableNode !== tableNode) {
174
134
  (0, _utils3.updateResizeHandles)(tableRef);
175
135
  }
176
-
177
136
  if (pluginState.editorHasFocus && pluginState.tableRef) {
178
137
  var _ref = state.selection,
179
- $cursor = _ref.$cursor;
180
-
138
+ $cursor = _ref.$cursor;
181
139
  if ($cursor) {
182
140
  // Only update bold when it's a cursor
183
141
  var tableCellHeader = (0, _prosemirrorUtils.findParentNodeOfType)(state.schema.nodes.tableHeader)(state.selection);
184
-
185
142
  if (tableCellHeader) {
186
143
  (0, _commands.addBoldInEmptyHeaderCells)(tableCellHeader)(state, dispatch);
187
144
  }
@@ -198,67 +155,61 @@ var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, porta
198
155
  props: {
199
156
  transformPasted: function transformPasted(slice) {
200
157
  var editorState = getCurrentEditorState();
201
-
202
158
  if (!editorState) {
203
159
  return slice;
204
160
  }
161
+ var schema = editorState.schema;
205
162
 
206
- var schema = editorState.schema; // if we're pasting to outside a table or outside a table
163
+ // if we're pasting to outside a table or outside a table
207
164
  // header, ensure that we apply any table headers to the first
208
165
  // row of content we see, if required
209
-
210
166
  if (!(0, _coreUtils.insideTable)(editorState) && (0, _paste.isHeaderRowRequired)(editorState)) {
211
167
  slice = (0, _misc.transformSliceToAddTableHeaders)(slice, schema);
212
168
  }
169
+ slice = (0, _utils3.transformSliceToFixHardBreakProblemOnCopyFromCell)(slice, schema);
213
170
 
214
- slice = (0, _utils3.transformSliceToFixHardBreakProblemOnCopyFromCell)(slice, schema); // We do this separately, so it also applies to drag/drop events
171
+ // We do this separately, so it also applies to drag/drop events
215
172
  // This needs to go before `transformSliceToRemoveOpenExpand`
173
+ slice = (0, _transforms2.transformSliceToRemoveOpenLayoutNodes)(slice, schema);
216
174
 
217
- slice = (0, _transforms2.transformSliceToRemoveOpenLayoutNodes)(slice, schema); // If a partial paste of expand, paste only the content
175
+ // If a partial paste of expand, paste only the content
218
176
  // This needs to go before `transformSliceToRemoveOpenTable`
219
-
220
177
  slice = (0, _transforms2.transformSliceToRemoveOpenExpand)(slice, schema);
221
- /** If a partial paste of table, paste only table's content */
222
178
 
179
+ /** If a partial paste of table, paste only table's content */
223
180
  slice = (0, _utils3.transformSliceToRemoveOpenTable)(slice, schema);
224
- /** If a partial paste of bodied extension, paste only text */
225
181
 
182
+ /** If a partial paste of bodied extension, paste only text */
226
183
  slice = (0, _transforms2.transformSliceToRemoveOpenBodiedExtension)(slice, schema);
227
184
  slice = (0, _utils3.transformSliceToCorrectEmptyTableCells)(slice, schema);
228
-
229
185
  if (!pluginConfig.allowColumnResizing) {
230
186
  slice = (0, _misc.transformSliceToRemoveColumnsWidths)(slice, schema);
231
- } // If we don't allow background on cells, we need to remove it
232
- // from the paste slice
233
-
187
+ }
234
188
 
189
+ // If we don't allow background on cells, we need to remove it
190
+ // from the paste slice
235
191
  if (!pluginConfig.allowBackgroundColor) {
236
192
  slice = (0, _misc.transformSliceRemoveCellBackgroundColor)(slice, schema);
237
193
  }
238
-
239
194
  return slice;
240
195
  },
241
196
  handleClick: function handleClick(_ref2, _pos, event) {
242
197
  var state = _ref2.state,
243
- dispatch = _ref2.dispatch;
244
-
198
+ dispatch = _ref2.dispatch;
245
199
  var decorationSet = _plugin.pluginKey.getState(state);
246
-
247
200
  if ((0, _utils3.findControlsHoverDecoration)(decorationSet).length) {
248
201
  (0, _commands.clearHoverSelection)()(state, dispatch);
249
- } // ED-6069: workaround for Chrome given a regression introduced in prosemirror-view@1.6.8
202
+ }
203
+
204
+ // ED-6069: workaround for Chrome given a regression introduced in prosemirror-view@1.6.8
250
205
  // Returning true prevents that updateSelection() is getting called in the commit below:
251
206
  // @see https://github.com/ProseMirror/prosemirror-view/commit/33fe4a8b01584f6b4103c279033dcd33e8047b95
252
-
253
-
254
207
  if (_utils2.browser.chrome && event.target) {
255
208
  var targetClassList = event.target.classList;
256
-
257
209
  if (targetClassList.contains(_types.TableCssClassName.CONTROLS_BUTTON) || targetClassList.contains(_types.TableCssClassName.CONTEXTUAL_MENU_BUTTON)) {
258
210
  return true;
259
211
  }
260
212
  }
261
-
262
213
  return false;
263
214
  },
264
215
  handleScrollToSelection: function handleScrollToSelection(view) {
@@ -271,14 +222,12 @@ var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, porta
271
222
  },
272
223
  handleTextInput: function handleTextInput(_ref3, from, to, text) {
273
224
  var state = _ref3.state,
274
- dispatch = _ref3.dispatch;
225
+ dispatch = _ref3.dispatch;
275
226
  var tr = (0, _transforms.replaceSelectedTable)(state, text, _analytics.INPUT_METHOD.KEYBOARD, editorAnalyticsAPI);
276
-
277
227
  if (tr.selectionSet) {
278
228
  dispatch(tr);
279
229
  return true;
280
230
  }
281
-
282
231
  return false;
283
232
  },
284
233
  nodeViews: _objectSpread(_objectSpread({}, tableCellNodeview), {}, {
@@ -304,5 +253,4 @@ var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, porta
304
253
  }
305
254
  });
306
255
  };
307
-
308
256
  exports.createPlugin = createPlugin;
@@ -1,65 +1,48 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.getPluginState = exports.createPluginState = exports.createCommand = void 0;
9
-
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  var _utils = require("@atlaskit/editor-common/utils");
13
-
14
10
  var _handlers = require("../handlers");
15
-
16
11
  var _reducer = _interopRequireDefault(require("../reducer"));
17
-
18
12
  var _pluginKey = require("./plugin-key");
19
-
20
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
-
22
14
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
-
24
15
  var _pluginFactory = (0, _utils.pluginFactory)(_pluginKey.pluginKey, _reducer.default, {
25
- mapping: function mapping(tr, pluginState) {
26
- if (tr.docChanged) {
27
- var updatedTargetCell = {};
28
-
29
- if (pluginState.targetCellPosition) {
30
- var _tr$mapping$mapResult = tr.mapping.mapResult(pluginState.targetCellPosition),
16
+ mapping: function mapping(tr, pluginState) {
17
+ if (tr.docChanged) {
18
+ var updatedTargetCell = {};
19
+ if (pluginState.targetCellPosition) {
20
+ var _tr$mapping$mapResult = tr.mapping.mapResult(pluginState.targetCellPosition),
31
21
  pos = _tr$mapping$mapResult.pos,
32
22
  deleted = _tr$mapping$mapResult.deleted;
33
-
34
- updatedTargetCell = {
35
- targetCellPosition: deleted ? undefined : pos
36
- };
37
- }
38
-
39
- var updatedTablePos = {};
40
-
41
- if (pluginState.tablePos) {
42
- var _tr$mapping$mapResult2 = tr.mapping.mapResult(pluginState.tablePos, -1),
23
+ updatedTargetCell = {
24
+ targetCellPosition: deleted ? undefined : pos
25
+ };
26
+ }
27
+ var updatedTablePos = {};
28
+ if (pluginState.tablePos) {
29
+ var _tr$mapping$mapResult2 = tr.mapping.mapResult(pluginState.tablePos, -1),
43
30
  _pos = _tr$mapping$mapResult2.pos,
44
31
  _deleted = _tr$mapping$mapResult2.deleted;
45
-
46
- updatedTablePos = {
47
- tablePos: _deleted ? undefined : _pos
48
- };
32
+ updatedTablePos = {
33
+ tablePos: _deleted ? undefined : _pos
34
+ };
35
+ }
36
+ return _objectSpread(_objectSpread(_objectSpread({}, pluginState), updatedTargetCell), updatedTablePos);
49
37
  }
50
-
51
- return _objectSpread(_objectSpread(_objectSpread({}, pluginState), updatedTargetCell), updatedTablePos);
52
- }
53
-
54
- return pluginState;
55
- },
56
- onDocChanged: _handlers.handleDocOrSelectionChanged,
57
- onSelectionChanged: _handlers.handleDocOrSelectionChanged
58
- }),
59
- createPluginState = _pluginFactory.createPluginState,
60
- createCommand = _pluginFactory.createCommand,
61
- getPluginState = _pluginFactory.getPluginState;
62
-
38
+ return pluginState;
39
+ },
40
+ onDocChanged: _handlers.handleDocOrSelectionChanged,
41
+ onSelectionChanged: _handlers.handleDocOrSelectionChanged
42
+ }),
43
+ createPluginState = _pluginFactory.createPluginState,
44
+ createCommand = _pluginFactory.createCommand,
45
+ getPluginState = _pluginFactory.getPluginState;
63
46
  exports.getPluginState = getPluginState;
64
47
  exports.createCommand = createCommand;
65
48
  exports.createPluginState = createPluginState;
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.pluginKey = void 0;
7
-
8
7
  var _prosemirrorState = require("prosemirror-state");
9
-
10
8
  var pluginKey = new _prosemirrorState.PluginKey('tablePlugin');
11
9
  exports.pluginKey = pluginKey;
@@ -4,14 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.tableSafariDelayedDomSelectionSyncingWorkaroundKey = exports.createPlugin = void 0;
7
-
8
7
  var _prosemirrorState = require("prosemirror-state");
9
-
10
8
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
11
-
12
9
  var tableSafariDelayedDomSelectionSyncingWorkaroundKey = new _prosemirrorState.PluginKey('tableSafariDelayedDomSelectionSyncingWorkaround');
13
10
  exports.tableSafariDelayedDomSelectionSyncingWorkaroundKey = tableSafariDelayedDomSelectionSyncingWorkaroundKey;
14
-
15
11
  var createPlugin = function createPlugin() {
16
12
  // From a review of the prosemirror-view source code,
17
13
  // the only places where a view relies on the presence
@@ -20,6 +16,7 @@ var createPlugin = function createPlugin() {
20
16
  // to delay drag selections
21
17
  // - to ensure it is cleaned up when the mouseup
22
18
  // event is not fired in a previous mousedown event
19
+
23
20
  // Because we are manually wiping the view.mouseDown,
24
21
  // we manage this custom cleanup ourselves
25
22
  var prevMouseDownDone = null;
@@ -33,13 +30,16 @@ var createPlugin = function createPlugin() {
33
30
  // DOM selection syncing during pointer drag.
34
31
  //
35
32
  // https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
33
+
36
34
  // NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
37
35
  // https://github.com/ProseMirror/prosemirror-view/pull/116
36
+
38
37
  // This fix removes the selectionToDOM from the view
39
38
  // prior to selectionToDOM being called.
40
39
  // selectionToDOM checks if there is an "active"
41
40
  // mouseDown, and if so, it delays running logic
42
41
  // which causes the table selections issue.
42
+
43
43
  // The handleDOMEvents are called before ProseMirror
44
44
  // events fired on the editable DOM element.
45
45
  // This means the view.mouseView will not yet be
@@ -51,21 +51,22 @@ var createPlugin = function createPlugin() {
51
51
  // prepend a task which will clear the mouseDown from
52
52
  // the view. We do this using a setTimout with no
53
53
  // interval.
54
+
54
55
  if (prevMouseDownDone) {
55
56
  // avoid memory leaks when the mouseup event is not fired
56
57
  // in a previous mousedown event
57
58
  prevMouseDownDone();
58
59
  }
59
-
60
60
  setTimeout(function () {
61
61
  // the ts-ignores here are required due to the
62
62
  // view.mouseDown being an internal which is
63
63
  // not part of the views type signature
64
+
64
65
  // @ts-ignore
65
66
  if (view.mouseDown) {
66
67
  // @ts-ignore
67
- prevMouseDownDone = view.mouseDown.done.bind(view.mouseDown); // @ts-ignore
68
-
68
+ prevMouseDownDone = view.mouseDown.done.bind(view.mouseDown);
69
+ // @ts-ignore
69
70
  view.mouseDown = null;
70
71
  }
71
72
  });
@@ -75,5 +76,4 @@ var createPlugin = function createPlugin() {
75
76
  }
76
77
  });
77
78
  };
78
-
79
79
  exports.createPlugin = createPlugin;
@@ -4,21 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.tableSafariDeleteCompositionTextIssueWorkaroundKey = exports.createPlugin = void 0;
7
-
8
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
9
-
10
8
  var _prosemirrorState = require("prosemirror-state");
11
-
12
9
  var _prosemirrorView = require("prosemirror-view");
13
-
14
10
  /**
15
11
  * Fix an issue that composition text replacement in Safari removes empty nodes during text composition text deletion.
16
12
  * https://github.com/ProseMirror/prosemirror/issues/934
17
13
  * We will remove this plugin when Webkit fix the problem itself.
18
14
  */
15
+
19
16
  var tableSafariDeleteCompositionTextIssueWorkaroundKey = new _prosemirrorState.PluginKey('tableSafariDeleteCompositionTextIssueWorkaround');
20
17
  exports.tableSafariDeleteCompositionTextIssueWorkaroundKey = tableSafariDeleteCompositionTextIssueWorkaroundKey;
21
-
22
18
  var createPlugin = function createPlugin() {
23
19
  return new _safePlugin.SafePlugin({
24
20
  key: tableSafariDeleteCompositionTextIssueWorkaroundKey,
@@ -31,28 +27,22 @@ var createPlugin = function createPlugin() {
31
27
  },
32
28
  apply: function apply(tr, value) {
33
29
  var renderSpan = tr.getMeta(tableSafariDeleteCompositionTextIssueWorkaroundKey);
34
-
35
30
  if (typeof renderSpan === 'undefined') {
36
31
  return value;
37
32
  }
38
-
39
33
  var decorations;
40
-
41
34
  if (renderSpan) {
42
35
  // Find position of the first text node in case it has multiple text nodes created by Japanese IME
43
36
  var $from = tr.selection.$from;
44
37
  var pos = $from.before($from.depth);
45
-
46
38
  var spanDecoration = _prosemirrorView.Decoration.widget(pos, function () {
47
39
  var spanElement = document.createElement('span');
48
40
  return spanElement;
49
41
  });
50
-
51
42
  decorations = _prosemirrorView.DecorationSet.create(tr.doc, [spanDecoration]);
52
43
  } else {
53
44
  decorations = _prosemirrorView.DecorationSet.empty;
54
45
  }
55
-
56
46
  return {
57
47
  renderSpan: renderSpan,
58
48
  decorations: decorations
@@ -68,43 +58,35 @@ var createPlugin = function createPlugin() {
68
58
  if ((event === null || event === void 0 ? void 0 : event.inputType) !== 'deleteCompositionText') {
69
59
  return false;
70
60
  }
71
-
72
61
  var selection = window.getSelection();
73
-
74
62
  if (!selection || selection.rangeCount <= 0 || selection.type !== 'Range') {
75
63
  return false;
76
64
  }
77
-
78
65
  var range = selection.getRangeAt(0);
79
66
  var startContainer = range.startContainer,
80
- endContainer = range.endContainer,
81
- endOffset = range.endOffset,
82
- startOffset = range.startOffset;
67
+ endContainer = range.endContainer,
68
+ endOffset = range.endOffset,
69
+ startOffset = range.startOffset;
83
70
  /**
84
71
  * On Safari when composition text is deleted, it deletes any empty elements it finds up the dom tree. Prosemirror can sometimes be confused by this
85
72
  * and will think that we meant to delete those elements. This fix forces the resulting node to not be empty.
86
73
  * The condition here checks to see if the entire text node is about to be swapped inside of an element
87
74
  */
88
-
89
75
  if (startContainer.nodeType === Node.TEXT_NODE && startContainer === endContainer && startOffset === 0 && endOffset === startContainer.length) {
90
76
  var tr = view.state.tr;
91
77
  tr.setMeta(tableSafariDeleteCompositionTextIssueWorkaroundKey, true);
92
78
  view.dispatch(tr);
93
79
  }
94
-
95
80
  return false;
96
81
  },
97
82
  input: function input(view, event) {
98
83
  if ((event === null || event === void 0 ? void 0 : event.inputType) !== 'deleteCompositionText') {
99
84
  return false;
100
85
  }
101
-
102
86
  var selection = window.getSelection();
103
-
104
87
  if (!selection) {
105
88
  return false;
106
89
  }
107
-
108
90
  var tr = view.state.tr;
109
91
  tr.setMeta(tableSafariDeleteCompositionTextIssueWorkaroundKey, false);
110
92
  view.dispatch(tr);
@@ -114,5 +96,4 @@ var createPlugin = function createPlugin() {
114
96
  }
115
97
  });
116
98
  };
117
-
118
99
  exports.createPlugin = createPlugin;
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.updateStickyState = exports.removeStickyState = void 0;
7
-
8
7
  var _pluginState = require("./plugin-state");
9
-
10
8
  var updateStickyState = function updateStickyState(rowState) {
11
9
  return (0, _pluginState.createCommand)({
12
10
  name: 'UPDATE',
@@ -15,9 +13,7 @@ var updateStickyState = function updateStickyState(rowState) {
15
13
  return tr.setMeta('addToHistory', false);
16
14
  });
17
15
  };
18
-
19
16
  exports.updateStickyState = updateStickyState;
20
-
21
17
  var removeStickyState = function removeStickyState(pos) {
22
18
  return (0, _pluginState.createCommand)({
23
19
  name: 'REMOVE',
@@ -26,5 +22,4 @@ var removeStickyState = function removeStickyState(pos) {
26
22
  return tr.setMeta('addToHistory', false);
27
23
  });
28
24
  };
29
-
30
25
  exports.removeStickyState = removeStickyState;