@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
@@ -10,13 +10,14 @@ import { syncStickyRowToTable, updateStickyMargins as updateTableMargin } from '
10
10
  import { updateStickyState } from '../commands';
11
11
  import { getTop, getTree } from './dom';
12
12
  import debounce from 'lodash/debounce';
13
- import throttle from 'lodash/throttle'; // limit scroll event calls
13
+ import throttle from 'lodash/throttle';
14
14
 
15
- var HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200; // timeout for resetting the scroll class - if it’s too long then users won’t be able to click on the header cells,
16
- // if too short it would trigger too many dom updates.
15
+ // limit scroll event calls
16
+ var HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
17
17
 
18
+ // timeout for resetting the scroll class - if it’s too long then users won’t be able to click on the header cells,
19
+ // if too short it would trigger too many dom updates.
18
20
  var HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT = 400;
19
-
20
21
  var anyChildCellMergedAcrossRow = function anyChildCellMergedAcrossRow(node) {
21
22
  return mapChildren(node, function (child) {
22
23
  return child.attrs.rowspan || 0;
@@ -24,12 +25,11 @@ var anyChildCellMergedAcrossRow = function anyChildCellMergedAcrossRow(node) {
24
25
  return rowspan > 1;
25
26
  });
26
27
  };
28
+
27
29
  /**
28
30
  * Compare two table row nodes and return true if the two table rows have a
29
31
  * different number of table cells or if table cell row spans are different
30
32
  */
31
-
32
-
33
33
  var rowHasDifferentMergedCells = function rowHasDifferentMergedCells(prevNode, incomingNode) {
34
34
  var incomingNodeChildrenRowSpan = mapChildren(prevNode, function (child) {
35
35
  return child.attrs.rowspan || 0;
@@ -41,6 +41,7 @@ var rowHasDifferentMergedCells = function rowHasDifferentMergedCells(prevNode, i
41
41
  return child !== incomingNodeChildrenRowSpan[index];
42
42
  });
43
43
  };
44
+
44
45
  /**
45
46
  * Check if a given node is a header row with this definition:
46
47
  * - all children are tableHeader cells
@@ -49,8 +50,6 @@ var rowHasDifferentMergedCells = function rowHasDifferentMergedCells(prevNode, i
49
50
  * @param node ProseMirror node
50
51
  * @return boolean if it meets definition
51
52
  */
52
-
53
-
54
53
  export var supportedHeaderRow = function supportedHeaderRow(node) {
55
54
  var allHeaders = mapChildren(node, function (child) {
56
55
  return child.type.name === 'tableHeader';
@@ -61,102 +60,83 @@ export var supportedHeaderRow = function supportedHeaderRow(node) {
61
60
  export var TableRowNodeView = /*#__PURE__*/function () {
62
61
  function TableRowNodeView(node, view, getPos, eventDispatcher, getEditorFeatureFlags) {
63
62
  var _this = this;
64
-
65
63
  _classCallCheck(this, TableRowNodeView);
66
-
67
64
  _defineProperty(this, "colControlsOffset", 0);
68
-
69
65
  _defineProperty(this, "focused", false);
70
-
71
66
  _defineProperty(this, "topPosEditorElement", 0);
72
-
73
67
  _defineProperty(this, "stickyHeadersOptimization", false);
74
-
75
68
  _defineProperty(this, "sentinels", {});
76
-
77
69
  _defineProperty(this, "listening", false);
78
-
79
70
  _defineProperty(this, "headerRowMouseScrollEnd", debounce(function () {
80
71
  _this.dom.classList.remove('no-pointer-events');
81
72
  }, HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT));
82
-
83
73
  _defineProperty(this, "headerRowMouseScroll", throttle(function () {
84
74
  if (_this.isSticky) {
85
75
  _this.dom.classList.add('no-pointer-events');
86
-
87
76
  _this.headerRowMouseScrollEnd();
88
77
  }
89
78
  }, HEADER_ROW_SCROLL_THROTTLE_TIMEOUT));
90
-
91
79
  _defineProperty(this, "onScroll", function () {
92
80
  if (!_this.tree) {
93
81
  return;
94
82
  }
83
+ _this.latestDomTop = getTop(_this.tree.wrapper);
95
84
 
96
- _this.latestDomTop = getTop(_this.tree.wrapper); // kick off rAF loop again if it hasn't already happened
97
-
85
+ // kick off rAF loop again if it hasn't already happened
98
86
  if (!_this.nextFrame) {
99
87
  _this.loop();
100
88
  }
101
89
  });
102
-
103
90
  _defineProperty(this, "loop", function () {
104
91
  _this.nextFrame = window.requestAnimationFrame(function () {
105
92
  if (_this.previousDomTop === _this.latestDomTop && _this.previousPadding === _this.padding) {
106
93
  _this.nextFrame = undefined;
107
94
  return;
108
- } // can't store these since React might re-render at any time
109
-
95
+ }
110
96
 
97
+ // can't store these since React might re-render at any time
111
98
  var tree = _this.tree;
112
-
113
99
  if (!tree) {
114
100
  _this.nextFrame = undefined;
115
101
  return;
116
102
  }
103
+ _this.paint(tree);
117
104
 
118
- _this.paint(tree); // run again on next frame
119
-
120
-
105
+ // run again on next frame
121
106
  _this.previousPadding = _this.padding;
122
107
  _this.previousDomTop = _this.latestDomTop;
123
-
124
108
  _this.loop();
125
109
  });
126
110
  });
127
-
128
111
  _defineProperty(this, "paint", function (tree) {
129
112
  var table = tree.table,
130
- wrapper = tree.wrapper; // If the previous refresh is less than 10ms then don't do anything.
131
- // The jumpiness happen under that time and this is to avoid it.
113
+ wrapper = tree.wrapper;
132
114
 
115
+ // If the previous refresh is less than 10ms then don't do anything.
116
+ // The jumpiness happen under that time and this is to avoid it.
133
117
  var timelapse = Math.abs(performance.now() - _this.lastTimePainted);
134
-
135
118
  if (timelapse < 10) {
136
119
  return;
137
120
  }
138
-
139
121
  if (_this.shouldHeaderStick(tree)) {
140
122
  _this.makeHeaderRowSticky(tree);
141
123
  } else {
142
124
  _this.makeRowHeaderNotSticky(table);
143
- } // ensure scroll positions are locked
144
-
125
+ }
145
126
 
127
+ // ensure scroll positions are locked
146
128
  _this.dom.scrollLeft = wrapper.scrollLeft;
147
129
  _this.lastTimePainted = performance.now();
148
130
  });
149
-
150
131
  _defineProperty(this, "onTablePluginState", function (state) {
151
132
  var tableRef = state.tableRef;
152
133
  var focusChanged = false;
153
134
  var tree = _this.tree;
154
-
155
135
  if (!tree) {
156
136
  return;
157
- } // when header rows are toggled off - mark sentinels as unobserved
158
-
137
+ }
159
138
 
139
+ // when header rows are toggled off - mark sentinels as unobserved
160
140
  if (!state.isHeaderRowEnabled) {
161
141
  [_this.sentinels.top, _this.sentinels.bottom].forEach(function (el) {
162
142
  if (el) {
@@ -164,26 +144,22 @@ export var TableRowNodeView = /*#__PURE__*/function () {
164
144
  }
165
145
  });
166
146
  }
147
+ var isCurrentTableSelected = tableRef === tree.table;
167
148
 
168
- var isCurrentTableSelected = tableRef === tree.table; // If current table selected and header row is toggled off, turn off sticky header
169
-
149
+ // If current table selected and header row is toggled off, turn off sticky header
170
150
  if (isCurrentTableSelected && !state.isHeaderRowEnabled && _this.tree) {
171
151
  _this.makeRowHeaderNotSticky(_this.tree.table);
172
152
  }
173
-
174
153
  if (isCurrentTableSelected !== _this.focused) {
175
154
  focusChanged = true;
176
155
  }
177
-
178
156
  _this.focused = isCurrentTableSelected;
179
157
  var wrapper = tree.wrapper;
180
158
  var tableContainer = wrapper.parentElement;
181
159
  var tableContentWrapper = tableContainer.parentElement;
182
160
  var layoutContainer = tableContentWrapper && tableContentWrapper.parentElement;
183
-
184
161
  if (isCurrentTableSelected) {
185
162
  _this.colControlsOffset = tableControlsSpacing;
186
-
187
163
  if (layoutContainer && layoutContainer.getAttribute('data-layout-content')) {
188
164
  // move table a little out of the way
189
165
  // to provide spacing for table controls
@@ -191,143 +167,111 @@ export var TableRowNodeView = /*#__PURE__*/function () {
191
167
  }
192
168
  } else {
193
169
  _this.colControlsOffset = 0;
194
-
195
170
  if (layoutContainer && layoutContainer.getAttribute('data-layout-content')) {
196
171
  tableContentWrapper.style.removeProperty('padding-left');
197
172
  }
198
- } // run after table style changes have been committed
199
-
173
+ }
200
174
 
175
+ // run after table style changes have been committed
201
176
  setTimeout(function () {
202
177
  // if focus changed while header is sticky - still repaint the positions will shift
203
178
  if (!_this.stickyHeadersOptimization || focusChanged && _this.isSticky) {
204
179
  _this.paint(tree);
205
180
  }
206
-
207
181
  syncStickyRowToTable(tree.table);
208
182
  }, 0);
209
183
  });
210
-
211
184
  _defineProperty(this, "onWidthPluginState", function () {
212
185
  // table width might have changed, sync that back to sticky row
213
186
  var tree = _this.tree;
214
-
215
187
  if (!tree) {
216
188
  return;
217
189
  }
218
-
219
190
  syncStickyRowToTable(tree.table);
220
191
  });
221
-
222
192
  _defineProperty(this, "shouldHeaderStick", function (tree) {
223
193
  var wrapper = tree.wrapper;
224
194
  var tableWrapperRect = wrapper.getBoundingClientRect();
225
-
226
195
  var editorAreaRect = _this.editorScrollableElement.getBoundingClientRect();
227
-
228
196
  var stickyHeaderRect = _this.contentDOM.getBoundingClientRect();
229
-
230
197
  var firstHeaderRow = !_this.dom.previousElementSibling;
231
198
  var subsequentRows = !!_this.dom.nextElementSibling;
232
- var isHeaderValid = firstHeaderRow && subsequentRows; // if the table wrapper is less than the editor top pos then make it sticky
199
+ var isHeaderValid = firstHeaderRow && subsequentRows;
200
+
201
+ // if the table wrapper is less than the editor top pos then make it sticky
233
202
  // Make header sticky if table wrapper top is outside viewport
234
203
  // but bottom is still in the viewport.
235
-
236
204
  if (tableWrapperRect.top < editorAreaRect.top && tableWrapperRect.bottom > editorAreaRect.top && isHeaderValid) {
237
205
  return true;
238
- } // if the sticky header is below the editor area make it non-sticky
239
-
206
+ }
240
207
 
208
+ // if the sticky header is below the editor area make it non-sticky
241
209
  if (stickyHeaderRect.top > editorAreaRect.top) {
242
210
  return false;
243
- } // otherwise make it non-sticky
244
-
211
+ }
245
212
 
213
+ // otherwise make it non-sticky
246
214
  return false;
247
215
  });
248
-
249
216
  _defineProperty(this, "makeHeaderRowSticky", function (tree) {
250
217
  var _tbody$firstChild;
251
-
252
218
  // If header row height is more than 50% of viewport height don't do this
253
219
  if (_this.stickyRowHeight && _this.stickyRowHeight > window.innerHeight / 2) {
254
220
  return;
255
221
  }
222
+ var table = tree.table;
256
223
 
257
- var table = tree.table; // ED-16035 Make sure sticky header is only applied to first row
258
-
224
+ // ED-16035 Make sure sticky header is only applied to first row
259
225
  var tbody = _this.dom.parentElement;
260
226
  var isFirstHeader = tbody === null || tbody === void 0 ? void 0 : (_tbody$firstChild = tbody.firstChild) === null || _tbody$firstChild === void 0 ? void 0 : _tbody$firstChild.isEqualNode(_this.dom);
261
-
262
227
  if (!isFirstHeader) {
263
228
  return;
264
229
  }
265
-
266
230
  var currentTableTop = _this.getCurrentTableTop(tree);
267
-
268
231
  var domTop = currentTableTop > 0 ? _this.topPosEditorElement : _this.topPosEditorElement + currentTableTop;
269
-
270
232
  if (!_this.isSticky) {
271
233
  syncStickyRowToTable(table);
272
-
273
234
  _this.dom.classList.add('sticky');
274
-
275
235
  table.classList.add(ClassName.TABLE_STICKY);
276
236
  _this.isSticky = true;
277
237
  }
278
-
279
238
  _this.dom.style.top = "".concat(domTop, "px");
280
239
  updateTableMargin(table);
281
-
282
240
  _this.emitOn(domTop, _this.colControlsOffset);
283
241
  });
284
-
285
242
  _defineProperty(this, "makeRowHeaderNotSticky", function (table) {
286
243
  var isEditorDestroyed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
287
-
288
244
  if (!_this.isSticky || !table || !_this.dom) {
289
245
  return;
290
246
  }
291
-
292
247
  _this.dom.style.removeProperty('width');
293
-
294
248
  _this.dom.classList.remove('sticky');
295
-
296
249
  table.classList.remove(ClassName.TABLE_STICKY);
297
250
  _this.isSticky = false;
298
251
  _this.dom.style.top = '';
299
252
  table.style.removeProperty('margin-top');
300
-
301
253
  _this.emitOff(isEditorDestroyed);
302
254
  });
303
-
304
255
  _defineProperty(this, "getWrapperoffset", function () {
305
256
  var inverse = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
306
257
  var focusValue = inverse ? !_this.focused : _this.focused;
307
258
  return focusValue ? 0 : tableControlsSpacing;
308
259
  });
309
-
310
260
  _defineProperty(this, "getWrapperRefTop", function (wrapper) {
311
261
  return Math.round(getTop(wrapper)) + _this.getWrapperoffset();
312
262
  });
313
-
314
263
  _defineProperty(this, "getScrolledTableTop", function (wrapper) {
315
264
  return _this.getWrapperRefTop(wrapper) - _this.topPosEditorElement;
316
265
  });
317
-
318
266
  _defineProperty(this, "getCurrentTableTop", function (tree) {
319
267
  return _this.getScrolledTableTop(tree.wrapper) + tree.table.clientHeight;
320
268
  });
321
-
322
269
  _defineProperty(this, "padding", 0);
323
-
324
270
  _defineProperty(this, "top", 0);
325
-
326
271
  _defineProperty(this, "emitOn", function (top, padding) {
327
272
  if (top === _this.top && padding === _this.padding) {
328
273
  return;
329
274
  }
330
-
331
275
  _this.top = top;
332
276
  _this.padding = padding;
333
277
  updateStickyState({
@@ -337,15 +281,12 @@ export var TableRowNodeView = /*#__PURE__*/function () {
337
281
  padding: padding
338
282
  })(_this.view.state, _this.view.dispatch, _this.view);
339
283
  });
340
-
341
284
  _defineProperty(this, "emitOff", function (isEditorDestroyed) {
342
285
  if (_this.top === 0 && _this.padding === 0) {
343
286
  return;
344
287
  }
345
-
346
288
  _this.top = 0;
347
289
  _this.padding = 0;
348
-
349
290
  if (!isEditorDestroyed) {
350
291
  updateStickyState({
351
292
  pos: _this.getPos(),
@@ -355,7 +296,6 @@ export var TableRowNodeView = /*#__PURE__*/function () {
355
296
  })(_this.view.state, _this.view.dispatch, _this.view);
356
297
  }
357
298
  });
358
-
359
299
  this.view = view;
360
300
  this.node = node;
361
301
  this.getPos = getPos;
@@ -368,18 +308,18 @@ export var TableRowNodeView = /*#__PURE__*/function () {
368
308
  this.lastTimePainted = 0;
369
309
  this.isHeaderRow = supportedHeaderRow(node);
370
310
  this.isSticky = false;
371
-
372
311
  if (this.isHeaderRow) {
373
312
  this.dom.setAttribute('data-header-row', 'true');
374
313
  this.subscribe();
375
314
  }
376
315
  }
377
- /* external events */
378
-
379
316
 
317
+ /* external events */
380
318
  _createClass(TableRowNodeView, [{
381
319
  key: "tree",
382
- get: // this is the sticky header table row
320
+ get:
321
+ // this is the sticky header table row
322
+
383
323
  function get() {
384
324
  return getTree(this.dom);
385
325
  }
@@ -387,17 +327,14 @@ export var TableRowNodeView = /*#__PURE__*/function () {
387
327
  key: "subscribe",
388
328
  value: function subscribe() {
389
329
  this.editorScrollableElement = findOverflowScrollParent(this.view.dom) || window;
390
-
391
330
  if (this.editorScrollableElement) {
392
331
  if (this.stickyHeadersOptimization) {
393
332
  this.initObservers();
394
333
  } else {
395
334
  this.editorScrollableElement.addEventListener('scroll', this.onScroll);
396
335
  }
397
-
398
336
  this.topPosEditorElement = getTop(this.editorScrollableElement);
399
337
  }
400
-
401
338
  this.eventDispatcher.on('widthPlugin', this.onWidthPluginState);
402
339
  this.eventDispatcher.on(tablePluginKey.key, this.onTablePluginState);
403
340
  this.listening = true;
@@ -410,50 +347,41 @@ export var TableRowNodeView = /*#__PURE__*/function () {
410
347
  if (!this.listening) {
411
348
  return;
412
349
  }
413
-
414
350
  if (this.intersectionObserver) {
415
351
  this.intersectionObserver.disconnect();
416
352
  }
417
-
418
353
  if (this.resizeObserver) {
419
354
  this.resizeObserver.disconnect();
420
355
  }
421
-
422
356
  if (this.editorScrollableElement && !this.stickyHeadersOptimization) {
423
357
  this.editorScrollableElement.removeEventListener('scroll', this.onScroll);
424
358
  }
425
-
426
359
  this.eventDispatcher.off('widthPlugin', this.onWidthPluginState);
427
360
  this.eventDispatcher.off(tablePluginKey.key, this.onTablePluginState);
428
361
  this.listening = false;
429
362
  this.dom.removeEventListener('wheel', this.headerRowMouseScroll);
430
363
  this.dom.removeEventListener('touchmove', this.headerRowMouseScroll);
431
- } // initialize intersection observer to track if table is within scroll area
364
+ }
432
365
 
366
+ // initialize intersection observer to track if table is within scroll area
433
367
  }, {
434
368
  key: "initObservers",
435
369
  value: function initObservers() {
436
370
  var _this2 = this;
437
-
438
371
  if (!this.dom || this.dom.dataset.isObserved) {
439
372
  return;
440
373
  }
441
-
442
374
  this.dom.dataset.isObserved = 'true';
443
375
  this.createIntersectionObserver();
444
376
  this.createResizeObserver();
445
-
446
377
  if (!this.intersectionObserver || !this.resizeObserver) {
447
378
  return;
448
379
  }
449
-
450
380
  this.resizeObserver.observe(this.dom);
451
381
  window.requestAnimationFrame(function () {
452
382
  var _this2$tree;
453
-
454
383
  // we expect tree to be defined after animation frame
455
384
  var tableContainer = (_this2$tree = _this2.tree) === null || _this2$tree === void 0 ? void 0 : _this2$tree.wrapper.closest(".".concat(TableCssClassName.NODEVIEW_WRAPPER));
456
-
457
385
  if (tableContainer) {
458
386
  _this2.sentinels.top = tableContainer.getElementsByClassName(ClassName.TABLE_STICKY_SENTINEL_TOP).item(0);
459
387
  _this2.sentinels.bottom = tableContainer.getElementsByClassName(ClassName.TABLE_STICKY_SENTINEL_BOTTOM).item(0);
@@ -461,30 +389,28 @@ export var TableRowNodeView = /*#__PURE__*/function () {
461
389
  // skip if already observed for another row on this table
462
390
  if (el && !el.dataset.isObserved) {
463
391
  el.dataset.isObserved = 'true';
464
-
465
392
  _this2.intersectionObserver.observe(el);
466
393
  }
467
394
  });
468
395
  }
469
396
  });
470
- } // updating bottom sentinel position if sticky header height changes
471
- // to allocate for new header height
397
+ }
472
398
 
399
+ // updating bottom sentinel position if sticky header height changes
400
+ // to allocate for new header height
473
401
  }, {
474
402
  key: "createResizeObserver",
475
403
  value: function createResizeObserver() {
476
404
  var _this3 = this;
477
-
478
405
  this.resizeObserver = new ResizeObserver(function (entries) {
479
406
  if (!_this3.tree) {
480
407
  return;
481
408
  }
482
-
483
409
  var table = _this3.tree.table;
484
410
  entries.forEach(function (entry) {
485
411
  var newHeight = entry.contentRect ? entry.contentRect.height : entry.target.offsetHeight;
486
-
487
- if (_this3.sentinels.bottom && // When the table header is sticky, it would be taller by a 1px (border-bottom),
412
+ if (_this3.sentinels.bottom &&
413
+ // When the table header is sticky, it would be taller by a 1px (border-bottom),
488
414
  // So we adding this check to allow a 1px difference.
489
415
  Math.abs(newHeight - (_this3.stickyRowHeight || 0)) > stickyHeaderBorderBottomWidth) {
490
416
  _this3.stickyRowHeight = newHeight;
@@ -498,39 +424,31 @@ export var TableRowNodeView = /*#__PURE__*/function () {
498
424
  key: "createIntersectionObserver",
499
425
  value: function createIntersectionObserver() {
500
426
  var _this4 = this;
501
-
502
427
  this.intersectionObserver = new IntersectionObserver(function (entries, _) {
503
428
  if (!_this4.tree) {
504
429
  return;
505
430
  }
506
-
507
431
  var table = _this4.tree.table;
508
432
  entries.forEach(function (entry) {
509
433
  var _entry$rootBounds;
434
+ var target = entry.target;
510
435
 
511
- var target = entry.target; // if the rootBounds has 0 height, e.g. confluence preview mode, we do nothing.
512
-
436
+ // if the rootBounds has 0 height, e.g. confluence preview mode, we do nothing.
513
437
  if (((_entry$rootBounds = entry.rootBounds) === null || _entry$rootBounds === void 0 ? void 0 : _entry$rootBounds.height) === 0) {
514
438
  return;
515
439
  }
516
-
517
440
  if (target.classList.contains(ClassName.TABLE_STICKY_SENTINEL_TOP)) {
518
441
  var _entry$rootBounds2;
519
-
520
442
  var sentinelIsBelowScrollArea = (((_entry$rootBounds2 = entry.rootBounds) === null || _entry$rootBounds2 === void 0 ? void 0 : _entry$rootBounds2.bottom) || 0) < entry.boundingClientRect.bottom;
521
-
522
443
  if (!entry.isIntersecting && !sentinelIsBelowScrollArea) {
523
444
  _this4.tree && _this4.makeHeaderRowSticky(_this4.tree);
524
445
  } else {
525
446
  table && _this4.makeRowHeaderNotSticky(table);
526
447
  }
527
448
  }
528
-
529
449
  if (target.classList.contains(ClassName.TABLE_STICKY_SENTINEL_BOTTOM)) {
530
450
  var _entry$rootBounds3;
531
-
532
451
  var sentinelIsAboveScrollArea = entry.boundingClientRect.top - _this4.dom.offsetHeight < (((_entry$rootBounds3 = entry.rootBounds) === null || _entry$rootBounds3 === void 0 ? void 0 : _entry$rootBounds3.top) || 0);
533
-
534
452
  if (table && !entry.isIntersecting && sentinelIsAboveScrollArea) {
535
453
  _this4.makeRowHeaderNotSticky(table);
536
454
  } else if (entry.isIntersecting && sentinelIsAboveScrollArea) {
@@ -542,38 +460,37 @@ export var TableRowNodeView = /*#__PURE__*/function () {
542
460
  root: this.editorScrollableElement
543
461
  });
544
462
  }
545
- /* paint/update loop */
546
463
 
464
+ /* paint/update loop */
547
465
  }, {
548
466
  key: "update",
549
- value:
550
- /* nodeview lifecycle */
467
+ value: /* nodeview lifecycle */
551
468
  function update(node) {
552
469
  // do nothing if nodes were identical
553
470
  if (node === this.node) {
554
471
  return true;
555
- } // see if we're changing into a header row or
556
- // changing away from one
557
-
472
+ }
558
473
 
474
+ // see if we're changing into a header row or
475
+ // changing away from one
559
476
  var newNodeIsHeaderRow = supportedHeaderRow(node);
560
-
561
477
  if (this.isHeaderRow !== newNodeIsHeaderRow) {
562
478
  return false; // re-create nodeview
563
479
  }
564
480
 
565
481
  if (rowHasDifferentMergedCells(this.node, node)) {
566
482
  return false;
567
- } // node is different but no need to re-create nodeview
568
-
483
+ }
569
484
 
570
- this.node = node; // don't do anything if we're just a regular tr
485
+ // node is different but no need to re-create nodeview
486
+ this.node = node;
571
487
 
488
+ // don't do anything if we're just a regular tr
572
489
  if (!this.isHeaderRow) {
573
490
  return true;
574
- } // something changed, sync widths
575
-
491
+ }
576
492
 
493
+ // something changed, sync widths
577
494
  var tbody = this.dom.parentElement;
578
495
  var table = tbody && tbody.parentElement;
579
496
  syncStickyRowToTable(table);
@@ -583,11 +500,9 @@ export var TableRowNodeView = /*#__PURE__*/function () {
583
500
  key: "destroy",
584
501
  value: function destroy() {
585
502
  this.unsubscribe();
586
-
587
503
  if (this.tree) {
588
504
  this.makeRowHeaderNotSticky(this.tree.table, true);
589
505
  }
590
-
591
506
  this.emitOff(true);
592
507
  }
593
508
  }, {
@@ -609,18 +524,14 @@ export var TableRowNodeView = /*#__PURE__*/function () {
609
524
  * from the composition end is ignored than prosemirror will end up with; invalid table markup nesting and a misplaced
610
525
  * selection and insertion.
611
526
  */
612
-
613
527
  var isNodeInsertion = mutationRecord.type === 'childList' && mutationRecord.target.nodeName === 'TR' && mutationRecord.addedNodes.length;
614
-
615
528
  if (isTableSelection || isNodeInsertion) {
616
529
  return false;
617
530
  }
618
-
619
531
  return true;
620
532
  }
621
- /* receive external events */
622
533
 
534
+ /* receive external events */
623
535
  }]);
624
-
625
536
  return TableRowNodeView;
626
537
  }();
@@ -1,57 +1,45 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  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; }
4
-
5
3
  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) { _defineProperty(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; }
6
-
7
4
  import { pluginFactory } from '@atlaskit/editor-common/utils';
8
5
  import { pluginKey } from './plugin-key';
9
-
10
6
  var reducer = function reducer(pluginState, action) {
11
7
  if (action.name === 'UPDATE') {
12
8
  var updated = false;
13
9
  var updatedState = pluginState.map(function (oldTableState) {
14
10
  var replace = oldTableState.pos === action.state.pos;
15
-
16
11
  if (replace) {
17
12
  updated = true;
18
13
  }
19
-
20
14
  return replace ? action.state : oldTableState;
21
15
  });
22
-
23
16
  if (!updated) {
24
17
  // new, add it
25
18
  updatedState.push(action.state);
26
19
  }
27
-
28
20
  return updatedState;
29
21
  } else if (action.name === 'REMOVE') {
30
22
  return pluginState.filter(function (rowState) {
31
23
  return rowState.pos !== action.pos;
32
24
  });
33
25
  }
34
-
35
26
  return pluginState;
36
27
  };
37
-
38
28
  var _pluginFactory = pluginFactory(pluginKey, reducer, {
39
- mapping: function mapping(tr, pluginState) {
40
- if (tr.docChanged) {
41
- return pluginState.map(function (rowInfo) {
42
- var remapped = tr.mapping.mapResult(rowInfo.pos);
43
- return remapped ? _objectSpread(_objectSpread({}, rowInfo), {}, {
44
- pos: remapped.pos
45
- }) : undefined;
46
- }).filter(function (f) {
47
- return f !== undefined;
48
- });
29
+ mapping: function mapping(tr, pluginState) {
30
+ if (tr.docChanged) {
31
+ return pluginState.map(function (rowInfo) {
32
+ var remapped = tr.mapping.mapResult(rowInfo.pos);
33
+ return remapped ? _objectSpread(_objectSpread({}, rowInfo), {}, {
34
+ pos: remapped.pos
35
+ }) : undefined;
36
+ }).filter(function (f) {
37
+ return f !== undefined;
38
+ });
39
+ }
40
+ return pluginState;
49
41
  }
50
-
51
- return pluginState;
52
- }
53
- }),
54
- createPluginState = _pluginFactory.createPluginState,
55
- createCommand = _pluginFactory.createCommand;
56
-
42
+ }),
43
+ createPluginState = _pluginFactory.createPluginState,
44
+ createCommand = _pluginFactory.createCommand;
57
45
  export { createPluginState, createCommand };