@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
@@ -1,58 +1,33 @@
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.default = exports.createTableView = void 0;
9
-
10
8
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
-
12
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
11
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
12
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
19
-
20
13
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
21
-
22
14
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
23
-
24
15
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
-
26
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
-
28
17
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
29
-
30
18
  var _react = _interopRequireDefault(require("react"));
31
-
32
19
  var _prosemirrorModel = require("prosemirror-model");
33
-
34
20
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
35
-
36
21
  var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
37
-
38
22
  var _createPluginConfig = require("../create-plugin-config");
39
-
40
23
  var _pluginFactory = require("../pm-plugins/plugin-factory");
41
-
42
24
  var _pluginKey = require("../pm-plugins/plugin-key");
43
-
44
25
  var _tableResizing = require("../pm-plugins/table-resizing");
45
-
46
26
  var _utils = require("../pm-plugins/table-resizing/utils");
47
-
48
27
  var _tableMap = require("@atlaskit/editor-tables/table-map");
49
-
50
28
  var _TableComponent = _interopRequireDefault(require("./TableComponent"));
51
-
52
29
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
53
-
54
30
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
55
-
56
31
  var tableAttributes = function tableAttributes(node) {
57
32
  return {
58
33
  'data-number-column': node.attrs.isNumberColumnEnabled,
@@ -61,25 +36,18 @@ var tableAttributes = function tableAttributes(node) {
61
36
  'data-table-local-id': node.attrs.localId || ''
62
37
  };
63
38
  };
64
-
65
39
  var toDOM = function toDOM(node, props) {
66
40
  var colgroup = '';
67
-
68
41
  if (props.allowColumnResizing) {
69
42
  colgroup = ['colgroup', {}].concat((0, _toConsumableArray2.default)((0, _utils.generateColgroup)(node)));
70
43
  }
71
-
72
44
  return ['table', tableAttributes(node), colgroup, ['tbody', 0]];
73
45
  };
74
-
75
46
  var TableView = /*#__PURE__*/function (_ReactNodeView) {
76
47
  (0, _inherits2.default)(TableView, _ReactNodeView);
77
-
78
48
  var _super = _createSuper(TableView);
79
-
80
49
  function TableView(props) {
81
50
  var _this;
82
-
83
51
  (0, _classCallCheck2.default)(this, TableView);
84
52
  _this = _super.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, undefined, undefined, props.hasIntlContext);
85
53
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getNode", function () {
@@ -91,27 +59,22 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
91
59
  _this.eventDispatcher = props.eventDispatcher;
92
60
  return _this;
93
61
  }
94
-
95
62
  (0, _createClass2.default)(TableView, [{
96
63
  key: "getContentDOM",
97
64
  value: function getContentDOM() {
98
65
  var rendered = _prosemirrorModel.DOMSerializer.renderSpec(document, toDOM(this.node, this.reactComponentProps));
99
-
100
66
  if (rendered.dom) {
101
67
  this.table = rendered.dom;
102
68
  }
103
-
104
69
  return rendered;
105
70
  }
106
71
  }, {
107
72
  key: "setDomAttrs",
108
73
  value: function setDomAttrs(node) {
109
74
  var _this2 = this;
110
-
111
75
  if (!this.table) {
112
76
  return;
113
77
  }
114
-
115
78
  var attrs = tableAttributes(node);
116
79
  Object.keys(attrs).forEach(function (attr) {
117
80
  _this2.table.setAttribute(attr, attrs[attr]);
@@ -121,7 +84,6 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
121
84
  key: "render",
122
85
  value: function render(props, forwardRef) {
123
86
  var _this3 = this;
124
-
125
87
  // TODO: ED-15663
126
88
  // Please, do not copy or use this kind of code below
127
89
  // @ts-ignore
@@ -130,10 +92,11 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
130
92
  getState: function getState(state) {
131
93
  return state['widthPlugin$'];
132
94
  }
133
- }; // TODO: ED-15663
95
+ };
96
+
97
+ // TODO: ED-15663
134
98
  // Please, do not copy or use this kind of code below
135
99
  // @ts-ignore
136
-
137
100
  var fakeMediaPluginKey = {
138
101
  key: 'mediaPlugin$',
139
102
  getState: function getState(state) {
@@ -150,8 +113,8 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
150
113
  editorView: props.view,
151
114
  render: function render(pluginStates) {
152
115
  var tableResizingPluginState = pluginStates.tableResizingPluginState,
153
- pluginState = pluginStates.pluginState,
154
- mediaState = pluginStates.mediaState;
116
+ pluginState = pluginStates.pluginState,
117
+ mediaState = pluginStates.mediaState;
155
118
  var tableActive = props.getPos() === pluginState.tablePos;
156
119
  var containerWidth = props.getEditorContainerWidth();
157
120
  return /*#__PURE__*/_react.default.createElement(_TableComponent.default, {
@@ -180,85 +143,65 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
180
143
  value: function viewShouldUpdate(nextNode) {
181
144
  if (this.tableRenderOptimization) {
182
145
  var _getPluginState = (0, _pluginFactory.getPluginState)(this.view.state),
183
- hoveredRows = _getPluginState.hoveredRows;
184
-
146
+ hoveredRows = _getPluginState.hoveredRows;
185
147
  var hoveredRowsChanged = !!(hoveredRows !== null && hoveredRows !== void 0 && hoveredRows.length) !== this.hasHoveredRows;
186
-
187
148
  if (nextNode.attrs.isNumberColumnEnabled && hoveredRowsChanged) {
188
149
  this.hasHoveredRows = !!(hoveredRows !== null && hoveredRows !== void 0 && hoveredRows.length);
189
150
  return true;
190
151
  }
191
-
192
152
  var _node = this.getNode();
193
-
194
153
  if ((0, _typeof2.default)(_node.attrs) !== (0, _typeof2.default)(nextNode.attrs)) {
195
154
  return true;
196
155
  }
197
-
198
156
  var attrKeys = Object.keys(_node.attrs);
199
157
  var nextAttrKeys = Object.keys(nextNode.attrs);
200
-
201
158
  if (attrKeys.length !== nextAttrKeys.length) {
202
159
  return true;
203
160
  }
204
-
205
161
  var tableMap = _tableMap.TableMap.get(_node);
206
-
207
162
  var nextTableMap = _tableMap.TableMap.get(nextNode);
208
-
209
163
  if (tableMap.width !== nextTableMap.width) {
210
164
  return true;
211
165
  }
212
-
213
166
  return attrKeys.some(function (key) {
214
167
  return _node.attrs[key] !== nextNode.attrs[key];
215
168
  });
216
169
  }
217
-
218
170
  return (0, _get2.default)((0, _getPrototypeOf2.default)(TableView.prototype), "viewShouldUpdate", this).call(this, nextNode);
219
171
  }
220
172
  }, {
221
173
  key: "ignoreMutation",
222
174
  value: function ignoreMutation(mutation) {
223
175
  var type = mutation.type,
224
- _mutation$target = mutation.target,
225
- nodeName = _mutation$target.nodeName,
226
- firstChild = _mutation$target.firstChild;
227
-
176
+ _mutation$target = mutation.target,
177
+ nodeName = _mutation$target.nodeName,
178
+ firstChild = _mutation$target.firstChild;
228
179
  if (type === 'selection' && (nodeName === null || nodeName === void 0 ? void 0 : nodeName.toUpperCase()) === 'DIV' && (firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeName.toUpperCase()) === 'TABLE') {
229
180
  return false;
230
181
  }
231
-
232
182
  return true;
233
183
  }
234
184
  }, {
235
185
  key: "destroy",
236
186
  value: function destroy() {
237
187
  var _this$eventDispatcher;
238
-
239
188
  if (this.resizeObserver) {
240
189
  this.resizeObserver.disconnect();
241
190
  }
242
-
243
191
  (_this$eventDispatcher = this.eventDispatcher) === null || _this$eventDispatcher === void 0 ? void 0 : _this$eventDispatcher.emit('TABLE_DELETED', this.node);
244
192
  (0, _get2.default)((0, _getPrototypeOf2.default)(TableView.prototype), "destroy", this).call(this);
245
193
  }
246
194
  }]);
247
195
  return TableView;
248
196
  }(_reactNodeView.default);
249
-
250
197
  exports.default = TableView;
251
-
252
198
  var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, options, getEditorContainerWidth, getEditorFeatureFlags) {
253
199
  var _getPluginState2 = (0, _pluginFactory.getPluginState)(view.state),
254
- pluginConfig = _getPluginState2.pluginConfig;
255
-
200
+ pluginConfig = _getPluginState2.pluginConfig;
256
201
  var _getPluginConfig = (0, _createPluginConfig.pluginConfig)(pluginConfig),
257
- allowColumnResizing = _getPluginConfig.allowColumnResizing;
258
-
202
+ allowColumnResizing = _getPluginConfig.allowColumnResizing;
259
203
  var _getEditorFeatureFlag = getEditorFeatureFlags(),
260
- tableRenderOptimization = _getEditorFeatureFlag.tableRenderOptimization;
261
-
204
+ tableRenderOptimization = _getEditorFeatureFlag.tableRenderOptimization;
262
205
  var hasIntlContext = true;
263
206
  return new TableView({
264
207
  node: node,
@@ -274,5 +217,4 @@ var createTableView = function createTableView(node, view, getPos, portalProvide
274
217
  hasIntlContext: hasIntlContext
275
218
  }).init();
276
219
  };
277
-
278
220
  exports.createTableView = createTableView;
@@ -1,44 +1,31 @@
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.default = void 0;
9
-
10
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
11
  var _uuid = _interopRequireDefault(require("uuid"));
17
-
18
12
  var _prosemirrorModel = require("prosemirror-model");
19
-
20
13
  var _adfSchema = require("@atlaskit/adf-schema");
21
-
22
14
  var DEFAULT_COL_SPAN = 1;
23
15
  var DEFAULT_ROW_SPAN = 1;
24
-
25
16
  var TableCellNodeView = /*#__PURE__*/function () {
26
17
  function TableCellNodeView(node, view, getPos, getEditorFeatureFlags, observer) {
27
18
  (0, _classCallCheck2.default)(this, TableCellNodeView);
28
19
  this.view = view;
29
20
  this.node = node;
30
-
31
21
  var _DOMSerializer$render = _prosemirrorModel.DOMSerializer.renderSpec(document, node.type.spec.toDOM(node)),
32
- dom = _DOMSerializer$render.dom,
33
- contentDOM = _DOMSerializer$render.contentDOM;
34
-
22
+ dom = _DOMSerializer$render.dom,
23
+ contentDOM = _DOMSerializer$render.contentDOM;
35
24
  this.getPos = getPos;
36
25
  this.dom = dom;
37
26
  this.contentDOM = contentDOM;
38
-
39
27
  var _getEditorFeatureFlag = getEditorFeatureFlags(),
40
- mouseMoveOptimization = _getEditorFeatureFlag.mouseMoveOptimization;
41
-
28
+ mouseMoveOptimization = _getEditorFeatureFlag.mouseMoveOptimization;
42
29
  if (mouseMoveOptimization && observer) {
43
30
  this.contentDOM.id = (0, _uuid.default)();
44
31
  this.mouseMoveOptimization = mouseMoveOptimization;
@@ -46,71 +33,61 @@ var TableCellNodeView = /*#__PURE__*/function () {
46
33
  observer.observe(this.contentDOM);
47
34
  }
48
35
  }
49
-
50
36
  (0, _createClass2.default)(TableCellNodeView, [{
51
37
  key: "updateNodeView",
52
38
  value: function updateNodeView(node) {
53
39
  var _this = this;
54
-
55
40
  if (this.node.type !== node.type) {
56
41
  return false;
57
42
  }
58
-
59
43
  var attrs = (0, _adfSchema.getCellDomAttrs)(this.node);
60
44
  var nextAttrs = (0, _adfSchema.getCellDomAttrs)(node);
61
-
62
45
  var _getCellAttrs = (0, _adfSchema.getCellAttrs)(this.dom),
63
- colspan = _getCellAttrs.colspan,
64
- rowspan = _getCellAttrs.rowspan; // need to rerender when colspan/rowspan in dom are different from the node attrs
65
- // this can happen when undoing merge cells
66
-
46
+ colspan = _getCellAttrs.colspan,
47
+ rowspan = _getCellAttrs.rowspan;
67
48
 
49
+ // need to rerender when colspan/rowspan in dom are different from the node attrs
50
+ // this can happen when undoing merge cells
68
51
  if (colspan !== (node.attrs.colspan || DEFAULT_COL_SPAN) || rowspan !== (node.attrs.rowspan || DEFAULT_ROW_SPAN)) {
69
52
  return false;
70
- } // added + changed attributes
71
-
53
+ }
72
54
 
55
+ // added + changed attributes
73
56
  var addedAttrs = Object.entries(nextAttrs).filter(function (_ref) {
74
57
  var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
75
- key = _ref2[0],
76
- value = _ref2[1];
77
-
58
+ key = _ref2[0],
59
+ value = _ref2[1];
78
60
  return attrs[key] !== value;
79
61
  });
80
62
  var removedAttrs = Object.keys(attrs).filter(function (key) {
81
63
  return !nextAttrs.hasOwnProperty(key);
82
64
  });
83
-
84
65
  if (addedAttrs.length || removedAttrs.length) {
85
66
  addedAttrs.forEach(function (_ref3) {
86
67
  var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
87
- key = _ref4[0],
88
- value = _ref4[1];
89
-
68
+ key = _ref4[0],
69
+ value = _ref4[1];
90
70
  return _this.dom.setAttribute(key, value || '');
91
71
  });
92
72
  removedAttrs.forEach(function (key) {
93
73
  return _this.dom.removeAttribute(key);
94
74
  });
95
75
  return true;
96
- } // Return true to not re-render this node view
97
-
76
+ }
98
77
 
78
+ // Return true to not re-render this node view
99
79
  if (this.node.sameMarkup(node)) {
100
80
  return true;
101
81
  }
102
-
103
82
  return false;
104
83
  }
105
84
  }, {
106
85
  key: "update",
107
86
  value: function update(node) {
108
87
  var didUpdate = this.updateNodeView(node);
109
-
110
88
  if (didUpdate) {
111
89
  this.node = node;
112
90
  }
113
-
114
91
  return didUpdate;
115
92
  }
116
93
  }, {
@@ -123,5 +100,4 @@ var TableCellNodeView = /*#__PURE__*/function () {
123
100
  }]);
124
101
  return TableCellNodeView;
125
102
  }();
126
-
127
103
  exports.default = TableCellNodeView;
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.updateShadowListForStickyStyles = exports.updateOverflowShadows = void 0;
7
-
8
7
  var _types = require("../types");
9
-
10
8
  var updateShadowListForStickyStyles = function updateShadowListForStickyStyles(heightStyle, shadows) {
11
9
  Array.from(shadows).forEach(function (shadow) {
12
10
  if (shadow.classList.contains(_types.TableCssClassName.TABLE_STICKY_SHADOW)) {
@@ -16,45 +14,36 @@ var updateShadowListForStickyStyles = function updateShadowListForStickyStyles(h
16
14
  }
17
15
  });
18
16
  };
17
+
19
18
  /**
20
19
  * Update overflow shadows for a given wrapper & table.
21
20
  * if `overflowShadowOptimization` is enabled, this will exit early.
22
21
  */
23
-
24
-
25
22
  exports.updateShadowListForStickyStyles = updateShadowListForStickyStyles;
26
-
27
23
  var updateOverflowShadows = function updateOverflowShadows(getEditorFeatureFlags) {
28
24
  return function (editorState, wrapper, table, rightShadows, leftShadows) {
29
25
  var _getEditorFeatureFlag;
30
-
31
26
  if (((_getEditorFeatureFlag = getEditorFeatureFlags()) === null || _getEditorFeatureFlag === void 0 ? void 0 : _getEditorFeatureFlag.tableOverflowShadowsOptimization) === true) {
32
27
  return false;
33
- } // Right shadow
34
-
35
-
28
+ }
29
+ // Right shadow
36
30
  if (table && wrapper) {
37
31
  var stickyRow = wrapper.querySelector('tr.sticky');
38
32
  var stickyCell = stickyRow && stickyRow.firstElementChild;
39
-
40
33
  if (rightShadows) {
41
34
  var diff = table.offsetWidth - wrapper.offsetWidth;
42
-
43
35
  for (var i = 0; i < rightShadows.length; i++) {
44
36
  var rightShadow = rightShadows[i];
45
37
  rightShadow.style.display = diff > 0 && diff > wrapper.scrollLeft ? 'block' : 'none';
46
-
47
38
  if (rightShadow.classList.contains(_types.TableCssClassName.TABLE_STICKY_SHADOW) && stickyCell) {
48
39
  rightShadow.style.height = "".concat(stickyCell.clientHeight + 1, "px");
49
40
  }
50
41
  }
51
42
  }
52
-
53
43
  if (leftShadows) {
54
44
  for (var _i = 0; _i < leftShadows.length; _i++) {
55
45
  var leftShadow = leftShadows[_i];
56
46
  leftShadow.style.display = wrapper.scrollLeft > 0 ? 'block' : 'none';
57
-
58
47
  if (leftShadow.classList.contains(_types.TableCssClassName.TABLE_STICKY_SHADOW) && stickyCell) {
59
48
  leftShadow.style.height = "".concat(stickyCell.clientHeight + 1, "px");
60
49
  }
@@ -63,5 +52,4 @@ var updateOverflowShadows = function updateOverflowShadows(getEditorFeatureFlags
63
52
  }
64
53
  };
65
54
  };
66
-
67
55
  exports.updateOverflowShadows = updateOverflowShadows;
@@ -4,28 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.pluginKey = exports.handleDocOrSelectionChanged = exports.getDecorations = 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 _cellSelection = require("@atlaskit/editor-tables/cell-selection");
13
-
14
10
  var _prosemirrorView = require("prosemirror-view");
15
-
16
11
  var _pluginKey = require("../plugin-key");
17
-
18
12
  var _utils = require("./utils");
19
-
20
13
  var pluginKey = new _prosemirrorState.PluginKey('tableDecorationsPlugin');
21
14
  exports.pluginKey = pluginKey;
22
-
23
15
  var getDecorations = function getDecorations(state) {
24
16
  return pluginKey.getState(state);
25
17
  };
26
-
27
18
  exports.getDecorations = getDecorations;
28
-
29
19
  var handleDocOrSelectionChanged = function handleDocOrSelectionChanged(tr, decorationSet, oldState) {
30
20
  if (tr.docChanged || tr.selection instanceof _cellSelection.CellSelection) {
31
21
  return (0, _utils.buildColumnControlsDecorations)({
@@ -34,7 +24,6 @@ var handleDocOrSelectionChanged = function handleDocOrSelectionChanged(tr, decor
34
24
  });
35
25
  } else if (tr.selectionSet) {
36
26
  var isTransactionFromMouseClick = !tr.docChanged && tr.selectionSet && tr.getMeta('pointer');
37
-
38
27
  if (isTransactionFromMouseClick || oldState.selection instanceof _cellSelection.CellSelection) {
39
28
  return (0, _utils.maybeUpdateColumnControlsSelectedDecoration)({
40
29
  decorationSet: decorationSet,
@@ -42,12 +31,9 @@ var handleDocOrSelectionChanged = function handleDocOrSelectionChanged(tr, decor
42
31
  });
43
32
  }
44
33
  }
45
-
46
34
  return decorationSet;
47
35
  };
48
-
49
36
  exports.handleDocOrSelectionChanged = handleDocOrSelectionChanged;
50
-
51
37
  var createPlugin = function createPlugin() {
52
38
  return new _safePlugin.SafePlugin({
53
39
  state: {
@@ -57,16 +43,13 @@ var createPlugin = function createPlugin() {
57
43
  apply: function apply(tr, decorationSet, oldState) {
58
44
  var pluginState = decorationSet;
59
45
  var meta = tr.getMeta(_pluginKey.pluginKey);
60
-
61
46
  if (meta && meta.data && meta.data.decorationSet) {
62
47
  pluginState = meta.data.decorationSet;
63
48
  }
64
-
65
49
  if (tr.docChanged || tr.selectionSet) {
66
50
  pluginState = pluginState.map(tr.mapping, tr.doc);
67
51
  return handleDocOrSelectionChanged(tr, pluginState, oldState);
68
52
  }
69
-
70
53
  return pluginState;
71
54
  }
72
55
  },
@@ -78,5 +61,4 @@ var createPlugin = function createPlugin() {
78
61
  }
79
62
  });
80
63
  };
81
-
82
64
  exports.createPlugin = createPlugin;
@@ -4,83 +4,64 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.maybeUpdateColumnControlsSelectedDecoration = exports.buildColumnControlsDecorations = void 0;
7
-
8
7
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
9
-
10
8
  var _utils = require("@atlaskit/editor-tables/utils");
11
-
12
9
  var _types = require("../../../types");
13
-
14
10
  var _decoration = require("../../../utils/decoration");
15
-
16
11
  var _composeDecorations = require("./compose-decorations");
17
-
18
12
  var isColumnSelected = function isColumnSelected(tr) {
19
13
  return tr.selection instanceof _cellSelection.CellSelection && tr.selection.isColSelection();
20
- }; // @see: https://product-fabric.atlassian.net/browse/ED-3796
21
-
14
+ };
22
15
 
16
+ // @see: https://product-fabric.atlassian.net/browse/ED-3796
23
17
  var removeControlsHoverDecoration = function removeControlsHoverDecoration(_ref) {
24
18
  var decorationSet = _ref.decorationSet;
25
19
  return decorationSet.remove((0, _decoration.findControlsHoverDecoration)(decorationSet));
26
20
  };
27
-
28
21
  var maybeUpdateColumnSelectedDecoration = function maybeUpdateColumnSelectedDecoration(_ref2) {
29
22
  var decorationSet = _ref2.decorationSet,
30
- tr = _ref2.tr;
31
-
23
+ tr = _ref2.tr;
32
24
  if (!isColumnSelected(tr)) {
33
25
  return decorationSet;
34
26
  }
35
-
36
27
  return (0, _decoration.updateDecorations)(tr.doc, decorationSet, (0, _decoration.createColumnSelectedDecoration)(tr), _types.TableDecorations.COLUMN_SELECTED);
37
28
  };
38
-
39
29
  var maybeUpdateColumnControlsDecoration = function maybeUpdateColumnControlsDecoration(_ref3) {
40
30
  var decorationSet = _ref3.decorationSet,
41
- tr = _ref3.tr;
31
+ tr = _ref3.tr;
42
32
  var table = (0, _utils.findTable)(tr.selection);
43
-
44
33
  if (!table) {
45
34
  return decorationSet;
46
35
  }
47
-
48
36
  return (0, _decoration.updateDecorations)(tr.doc, decorationSet, (0, _decoration.createColumnControlsDecoration)(tr.selection), _types.TableDecorations.COLUMN_CONTROLS_DECORATIONS);
49
- }; // @see: https://product-fabric.atlassian.net/browse/ED-7304
50
-
37
+ };
51
38
 
39
+ // @see: https://product-fabric.atlassian.net/browse/ED-7304
52
40
  var removeColumnControlsSelectedDecoration = function removeColumnControlsSelectedDecoration(_ref4) {
53
41
  var decorationSet = _ref4.decorationSet;
54
42
  return decorationSet.remove((0, _decoration.findColumnControlSelectedDecoration)(decorationSet));
55
43
  };
56
-
57
44
  var hasColumnSelectedDecorations = function hasColumnSelectedDecorations(decorationSet) {
58
45
  return !!(0, _decoration.findColumnControlSelectedDecoration)(decorationSet).length;
59
46
  };
60
-
61
47
  var maybeUpdateColumnControlsSelectedDecoration = function maybeUpdateColumnControlsSelectedDecoration(_ref5) {
62
48
  var decorationSet = _ref5.decorationSet,
63
- tr = _ref5.tr;
64
-
49
+ tr = _ref5.tr;
65
50
  if (!hasColumnSelectedDecorations(decorationSet)) {
66
51
  return decorationSet;
67
52
  }
68
-
69
53
  return removeColumnControlsSelectedDecoration({
70
54
  decorationSet: decorationSet,
71
55
  tr: tr
72
56
  });
73
57
  };
74
-
75
58
  exports.maybeUpdateColumnControlsSelectedDecoration = maybeUpdateColumnControlsSelectedDecoration;
76
-
77
59
  var buildColumnControlsDecorations = function buildColumnControlsDecorations(_ref6) {
78
60
  var decorationSet = _ref6.decorationSet,
79
- tr = _ref6.tr;
61
+ tr = _ref6.tr;
80
62
  return (0, _composeDecorations.composeDecorations)([removeColumnControlsSelectedDecoration, removeControlsHoverDecoration, maybeUpdateColumnSelectedDecoration, maybeUpdateColumnControlsDecoration])({
81
63
  decorationSet: decorationSet,
82
64
  tr: tr
83
65
  });
84
66
  };
85
-
86
67
  exports.buildColumnControlsDecorations = buildColumnControlsDecorations;
@@ -1,55 +1,43 @@
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.buildColumnResizingDecorations = void 0;
9
-
10
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
9
  var _types = require("../../../types");
13
-
14
10
  var _decoration = require("../../../utils/decoration");
15
-
16
11
  var _composeDecorations = require("./compose-decorations");
17
-
18
12
  var emptyDecorations = [[], []];
19
-
20
13
  var updateColumnResizeHandle = function updateColumnResizeHandle(columnResizesDecorations) {
21
14
  return function (_ref) {
22
15
  var decorationSet = _ref.decorationSet,
23
- tr = _ref.tr;
16
+ tr = _ref.tr;
24
17
  return (0, _decoration.updateDecorations)(tr.doc, decorationSet, columnResizesDecorations, _types.TableDecorations.COLUMN_RESIZING_HANDLE);
25
18
  };
26
19
  };
27
-
28
20
  var updateLastCellElement = function updateLastCellElement(lastCellElementsDecorations) {
29
21
  return function (_ref2) {
30
22
  var decorationSet = _ref2.decorationSet,
31
- tr = _ref2.tr;
23
+ tr = _ref2.tr;
32
24
  return (0, _decoration.updateDecorations)(tr.doc, decorationSet, lastCellElementsDecorations, _types.TableDecorations.LAST_CELL_ELEMENT);
33
25
  };
34
26
  };
35
-
36
27
  var buildColumnResizingDecorations = function buildColumnResizingDecorations(rowEndIndex, columnEndIndex) {
37
28
  return function (_ref3) {
38
29
  var tr = _ref3.tr,
39
- decorationSet = _ref3.decorationSet;
40
-
30
+ decorationSet = _ref3.decorationSet;
41
31
  var _ref4 = columnEndIndex < 0 ? emptyDecorations : (0, _decoration.createResizeHandleDecoration)(tr, rowEndIndex, {
42
- right: columnEndIndex
43
- }),
44
- _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
45
- columnResizesDecorations = _ref5[0],
46
- lastCellElementsDecorations = _ref5[1];
47
-
32
+ right: columnEndIndex
33
+ }),
34
+ _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
35
+ columnResizesDecorations = _ref5[0],
36
+ lastCellElementsDecorations = _ref5[1];
48
37
  return (0, _composeDecorations.composeDecorations)([updateColumnResizeHandle(columnResizesDecorations), updateLastCellElement(lastCellElementsDecorations)])({
49
38
  decorationSet: decorationSet,
50
39
  tr: tr
51
40
  });
52
41
  };
53
42
  };
54
-
55
43
  exports.buildColumnResizingDecorations = buildColumnResizingDecorations;