@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,129 +1,89 @@
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.FloatingInsertButton = void 0;
9
-
10
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
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 _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
16
  var _react = _interopRequireDefault(require("react"));
27
-
28
17
  var _tableMap = require("@atlaskit/editor-tables/table-map");
29
-
30
18
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
31
-
32
19
  var _prosemirrorUtils = require("prosemirror-utils");
33
-
34
20
  var _utils = require("@atlaskit/editor-tables/utils");
35
-
36
21
  var _reactIntlNext = require("react-intl-next");
37
-
38
22
  var _ui = require("@atlaskit/editor-common/ui");
39
-
40
23
  var _utils2 = require("@atlaskit/editor-common/utils");
41
-
42
24
  var _analytics = require("@atlaskit/editor-common/analytics");
43
-
44
25
  var _commandsWithAnalytics = require("../../commands-with-analytics");
45
-
46
26
  var _types = require("../../types");
47
-
48
27
  var _utils3 = require("../../utils");
49
-
50
28
  var _getPopupOptions = _interopRequireDefault(require("./getPopupOptions"));
51
-
52
29
  var _InsertButton = _interopRequireDefault(require("./InsertButton"));
53
-
54
30
  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); }; }
55
-
56
31
  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; } }
57
-
58
32
  var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
59
33
  (0, _inherits2.default)(FloatingInsertButton, _React$Component);
60
-
61
34
  var _super = _createSuper(FloatingInsertButton);
62
-
63
35
  function FloatingInsertButton(props) {
64
36
  var _this;
65
-
66
37
  (0, _classCallCheck2.default)(this, FloatingInsertButton);
67
38
  _this = _super.call(this, props);
68
39
  _this.insertColumn = _this.insertColumn.bind((0, _assertThisInitialized2.default)(_this));
69
40
  _this.insertRow = _this.insertRow.bind((0, _assertThisInitialized2.default)(_this));
70
41
  return _this;
71
42
  }
72
-
73
43
  (0, _createClass2.default)(FloatingInsertButton, [{
74
44
  key: "render",
75
45
  value: function render() {
76
46
  var _this$props = this.props,
77
- tableNode = _this$props.tableNode,
78
- editorView = _this$props.editorView,
79
- insertColumnButtonIndex = _this$props.insertColumnButtonIndex,
80
- insertRowButtonIndex = _this$props.insertRowButtonIndex,
81
- tableRef = _this$props.tableRef,
82
- mountPoint = _this$props.mountPoint,
83
- boundariesElement = _this$props.boundariesElement,
84
- isHeaderColumnEnabled = _this$props.isHeaderColumnEnabled,
85
- isHeaderRowEnabled = _this$props.isHeaderRowEnabled,
86
- dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent;
47
+ tableNode = _this$props.tableNode,
48
+ editorView = _this$props.editorView,
49
+ insertColumnButtonIndex = _this$props.insertColumnButtonIndex,
50
+ insertRowButtonIndex = _this$props.insertRowButtonIndex,
51
+ tableRef = _this$props.tableRef,
52
+ mountPoint = _this$props.mountPoint,
53
+ boundariesElement = _this$props.boundariesElement,
54
+ isHeaderColumnEnabled = _this$props.isHeaderColumnEnabled,
55
+ isHeaderRowEnabled = _this$props.isHeaderRowEnabled,
56
+ dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent;
87
57
  var type = typeof insertColumnButtonIndex !== 'undefined' ? 'column' : typeof insertRowButtonIndex !== 'undefined' ? 'row' : null;
88
-
89
58
  if (!tableNode || !tableRef || !type) {
90
59
  return null;
91
- } // We can’t display the insert button for row|colum index 0
92
- // when the header row|colum is enabled, this feature will be change on the future
93
-
60
+ }
94
61
 
62
+ // We can’t display the insert button for row|colum index 0
63
+ // when the header row|colum is enabled, this feature will be change on the future
95
64
  if (type === 'column' && isHeaderColumnEnabled && insertColumnButtonIndex === 0 || type === 'row' && isHeaderRowEnabled && insertRowButtonIndex === 0) {
96
65
  return null;
97
66
  }
98
-
99
67
  var tr = editorView.state.tr;
100
-
101
68
  if (tr.selection instanceof _cellSelection.CellSelection && (tr.selection.isColSelection() || tr.selection.isRowSelection())) {
102
69
  return null;
103
70
  }
104
-
105
71
  var cellPosition = this.getCellPosition(type);
106
-
107
72
  if (!cellPosition) {
108
73
  return null;
109
74
  }
110
-
111
75
  var tablePos = (0, _utils.findTable)(editorView.state.selection);
112
-
113
76
  if (!tablePos) {
114
77
  return null;
115
78
  }
116
-
117
79
  var domAtPos = editorView.domAtPos.bind(editorView);
118
80
  var pos = cellPosition + tablePos.start + 1;
119
81
  var target;
120
-
121
82
  try {
122
83
  target = (0, _prosemirrorUtils.findDomRefAtPos)(pos, domAtPos);
123
84
  } catch (error) {
124
85
  // eslint-disable-next-line no-console
125
86
  console.warn(error);
126
-
127
87
  if (dispatchAnalyticsEvent) {
128
88
  var payload = {
129
89
  action: _analytics.ACTION.ERRORED,
@@ -143,17 +103,13 @@ var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
143
103
  dispatchAnalyticsEvent(payload);
144
104
  }
145
105
  }
146
-
147
106
  if (!target || !(target instanceof HTMLElement)) {
148
107
  return null;
149
108
  }
150
-
151
109
  var targetCellRef = type === 'row' ? (0, _utils2.closestElement)(target, 'tr') : (0, _utils2.closestElement)(target, 'td, th');
152
-
153
110
  if (!targetCellRef) {
154
111
  return null;
155
112
  }
156
-
157
113
  var tableContainerWrapper = (0, _utils2.closestElement)(targetCellRef, ".".concat(_types.TableCssClassName.TABLE_CONTAINER));
158
114
  var tableWrapper = (0, _utils2.closestElement)(targetCellRef, ".".concat(_types.TableCssClassName.TABLE_NODE_WRAPPER));
159
115
  var index = type === 'column' ? insertColumnButtonIndex : insertRowButtonIndex;
@@ -176,27 +132,21 @@ var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
176
132
  key: "getCellPosition",
177
133
  value: function getCellPosition(type) {
178
134
  var _this$props2 = this.props,
179
- tableNode = _this$props2.tableNode,
180
- insertColumnButtonIndex = _this$props2.insertColumnButtonIndex,
181
- insertRowButtonIndex = _this$props2.insertRowButtonIndex;
182
-
135
+ tableNode = _this$props2.tableNode,
136
+ insertColumnButtonIndex = _this$props2.insertColumnButtonIndex,
137
+ insertRowButtonIndex = _this$props2.insertRowButtonIndex;
183
138
  var tableMap = _tableMap.TableMap.get(tableNode);
184
-
185
139
  if (type === 'column') {
186
140
  var columnIndex = insertColumnButtonIndex === 0 ? 0 : insertColumnButtonIndex - 1;
187
-
188
141
  if (columnIndex > tableMap.width - 1) {
189
142
  return null;
190
143
  }
191
-
192
144
  return tableMap.positionAt(0, columnIndex, tableNode);
193
145
  } else {
194
146
  var rowIndex = insertRowButtonIndex === 0 ? 0 : insertRowButtonIndex - 1;
195
-
196
147
  if (rowIndex > tableMap.height - 1) {
197
148
  return null;
198
149
  }
199
-
200
150
  return tableMap.positionAt(rowIndex, 0, tableNode);
201
151
  }
202
152
  }
@@ -204,14 +154,13 @@ var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
204
154
  key: "insertRow",
205
155
  value: function insertRow(event) {
206
156
  var _this$props3 = this.props,
207
- editorView = _this$props3.editorView,
208
- insertRowButtonIndex = _this$props3.insertRowButtonIndex,
209
- editorAnalyticsAPI = _this$props3.editorAnalyticsAPI;
210
-
157
+ editorView = _this$props3.editorView,
158
+ insertRowButtonIndex = _this$props3.insertRowButtonIndex,
159
+ editorAnalyticsAPI = _this$props3.editorAnalyticsAPI;
211
160
  if (typeof insertRowButtonIndex !== 'undefined') {
212
161
  event.preventDefault();
213
162
  var state = editorView.state,
214
- dispatch = editorView.dispatch;
163
+ dispatch = editorView.dispatch;
215
164
  (0, _commandsWithAnalytics.insertRowWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.BUTTON, {
216
165
  index: insertRowButtonIndex,
217
166
  moveCursorToInsertedRow: true
@@ -222,25 +171,21 @@ var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
222
171
  key: "insertColumn",
223
172
  value: function insertColumn(event) {
224
173
  var _this$props4 = this.props,
225
- editorView = _this$props4.editorView,
226
- insertColumnButtonIndex = _this$props4.insertColumnButtonIndex,
227
- editorAnalyticsAPI = _this$props4.editorAnalyticsAPI,
228
- getEditorContainerWidth = _this$props4.getEditorContainerWidth;
229
-
174
+ editorView = _this$props4.editorView,
175
+ insertColumnButtonIndex = _this$props4.insertColumnButtonIndex,
176
+ editorAnalyticsAPI = _this$props4.editorAnalyticsAPI,
177
+ getEditorContainerWidth = _this$props4.getEditorContainerWidth;
230
178
  if (typeof insertColumnButtonIndex !== 'undefined') {
231
179
  event.preventDefault();
232
180
  var state = editorView.state,
233
- dispatch = editorView.dispatch;
181
+ dispatch = editorView.dispatch;
234
182
  (0, _commandsWithAnalytics.insertColumnWithAnalytics)(getEditorContainerWidth, editorAnalyticsAPI)(_analytics.INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
235
183
  }
236
184
  }
237
185
  }]);
238
186
  return FloatingInsertButton;
239
187
  }(_react.default.Component);
240
-
241
188
  exports.FloatingInsertButton = FloatingInsertButton;
242
189
  (0, _defineProperty2.default)(FloatingInsertButton, "displayName", 'FloatingInsertButton');
243
-
244
190
  var _default = (0, _reactIntlNext.injectIntl)(FloatingInsertButton);
245
-
246
191
  exports.default = _default;
@@ -1,62 +1,35 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.default = void 0;
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 _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
16
  var _react = _interopRequireWildcard(require("react"));
27
-
28
17
  var _classnames2 = _interopRequireDefault(require("classnames"));
29
-
30
18
  var _reactIntlNext = require("react-intl-next");
31
-
32
19
  var _ui = require("@atlaskit/editor-common/ui");
33
-
34
20
  var _collapse = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/collapse"));
35
-
36
21
  var _expand = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/expand"));
37
-
38
22
  var _messages = _interopRequireDefault(require("@atlaskit/editor-common/messages"));
39
-
40
23
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
41
-
42
24
  var _commandsWithAnalytics = require("../../commands-with-analytics");
43
-
44
25
  var _types = require("../../types");
45
-
46
26
  var _prosemirrorUtils = require("prosemirror-utils");
47
-
48
27
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
49
-
50
28
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
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
  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; }
57
-
58
32
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
59
-
60
33
  var addPopupOffset = function addPopupOffset(pos) {
61
34
  return _objectSpread(_objectSpread({}, pos), {}, {
62
35
  // add 12 pixels to align y position with
@@ -64,41 +37,31 @@ var addPopupOffset = function addPopupOffset(pos) {
64
37
  top: pos.top ? pos.top + 12 : undefined
65
38
  });
66
39
  };
67
-
68
40
  var getMessage = function getMessage(layout) {
69
41
  switch (layout) {
70
42
  case 'default':
71
43
  return _messages.default.layoutWide;
72
-
73
44
  case 'wide':
74
45
  return _messages.default.layoutFullWidth;
75
-
76
46
  default:
77
47
  return _messages.default.layoutFixedWidth;
78
48
  }
79
49
  };
80
-
81
50
  var LayoutButton = /*#__PURE__*/function (_React$Component) {
82
51
  (0, _inherits2.default)(LayoutButton, _React$Component);
83
-
84
52
  var _super = _createSuper(LayoutButton);
85
-
86
53
  function LayoutButton() {
87
54
  var _this;
88
-
89
55
  (0, _classCallCheck2.default)(this, LayoutButton);
90
-
91
56
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
92
57
  args[_key] = arguments[_key];
93
58
  }
94
-
95
59
  _this = _super.call.apply(_super, [this].concat(args));
96
60
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "stickyButtonRef", /*#__PURE__*/(0, _react.createRef)());
97
61
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resizeObserver", new ResizeObserver(function (entries) {
98
62
  entries.forEach(function (entry) {
99
63
  var resizeButton = _this.stickyButtonRef.current;
100
64
  var tableWrapper = _this.props.targetRef;
101
-
102
65
  if (resizeButton && tableWrapper) {
103
66
  var clientRect = tableWrapper.getBoundingClientRect();
104
67
  resizeButton.style.left = "".concat(clientRect.right, "px");
@@ -107,29 +70,28 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
107
70
  }));
108
71
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function () {
109
72
  var _this$props$editorVie = _this.props.editorView,
110
- state = _this$props$editorVie.state,
111
- dispatch = _this$props$editorVie.dispatch;
73
+ state = _this$props$editorVie.state,
74
+ dispatch = _this$props$editorVie.dispatch;
112
75
  (0, _commandsWithAnalytics.toggleTableLayoutWithAnalytics)(_this.props.editorAnalyticsAPI)(state, dispatch);
113
76
  });
114
77
  return _this;
115
78
  }
116
-
117
79
  (0, _createClass2.default)(LayoutButton, [{
118
80
  key: "getTitle",
119
81
  value: function getTitle() {
120
82
  var _this$props = this.props,
121
- formatMessage = _this$props.intl.formatMessage,
122
- _this$props$layout = _this$props.layout,
123
- layout = _this$props$layout === void 0 ? 'default' : _this$props$layout;
83
+ formatMessage = _this$props.intl.formatMessage,
84
+ _this$props$layout = _this$props.layout,
85
+ layout = _this$props$layout === void 0 ? 'default' : _this$props$layout;
124
86
  return formatMessage(getMessage(layout));
125
87
  }
126
88
  }, {
127
89
  key: "toolbarButton",
128
90
  value: function toolbarButton() {
129
91
  var _this$props2 = this.props,
130
- isResizing = _this$props2.isResizing,
131
- _this$props2$layout = _this$props2.layout,
132
- layout = _this$props2$layout === void 0 ? 'default' : _this$props2$layout;
92
+ isResizing = _this$props2.isResizing,
93
+ _this$props2$layout = _this$props2.layout,
94
+ layout = _this$props2$layout === void 0 ? 'default' : _this$props2$layout;
133
95
  var title = this.getTitle();
134
96
  return /*#__PURE__*/_react.default.createElement("div", {
135
97
  className: (0, _classnames2.default)(_types.TableCssClassName.LAYOUT_BUTTON, (0, _defineProperty2.default)({}, _types.TableCssClassName.IS_RESIZING, isResizing))
@@ -155,11 +117,9 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
155
117
  key: "renderSticky",
156
118
  value: function renderSticky(button, targetRef, tableRef) {
157
119
  var title = this.getTitle();
158
-
159
120
  if (!(targetRef instanceof HTMLElement) || !(tableRef instanceof HTMLElement)) {
160
121
  return null;
161
122
  }
162
-
163
123
  var pos = targetRef.getBoundingClientRect();
164
124
  var tablePos = tableRef.getBoundingClientRect();
165
125
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -176,15 +136,13 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
176
136
  key: "renderPopup",
177
137
  value: function renderPopup(button) {
178
138
  var _this$props3 = this.props,
179
- mountPoint = _this$props3.mountPoint,
180
- boundariesElement = _this$props3.boundariesElement,
181
- scrollableElement = _this$props3.scrollableElement,
182
- targetRef = _this$props3.targetRef;
183
-
139
+ mountPoint = _this$props3.mountPoint,
140
+ boundariesElement = _this$props3.boundariesElement,
141
+ scrollableElement = _this$props3.scrollableElement,
142
+ targetRef = _this$props3.targetRef;
184
143
  if (!targetRef) {
185
144
  return null;
186
145
  }
187
-
188
146
  var title = this.getTitle();
189
147
  return /*#__PURE__*/_react.default.createElement(_ui.Popup, {
190
148
  ariaLabel: title,
@@ -205,7 +163,6 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
205
163
  var stickyHeader = this.props.stickyHeader;
206
164
  var button = this.toolbarButton();
207
165
  var stickyTargetRef = stickyHeader && stickyHeader.sticky && stickyHeader.pos ? this.getStickyTargetRef(stickyHeader.pos) : null;
208
-
209
166
  if (stickyTargetRef && this.props.targetRef) {
210
167
  return this.renderSticky(button, stickyTargetRef, this.props.targetRef);
211
168
  } else {
@@ -217,7 +174,6 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
217
174
  value: function componentDidMount() {
218
175
  var dom = this.props.editorView.dom;
219
176
  var scrollPanel = dom.closest('.fabric-editor-popup-scroll-parent');
220
-
221
177
  if (scrollPanel instanceof HTMLElement) {
222
178
  this.resizeObserver.observe(scrollPanel);
223
179
  }
@@ -227,7 +183,6 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
227
183
  value: function componentWillUnmount() {
228
184
  var dom = this.props.editorView.dom;
229
185
  var scrollPanel = dom.closest('.fabric-editor-popup-scroll-parent');
230
-
231
186
  if (scrollPanel instanceof HTMLElement) {
232
187
  this.resizeObserver.unobserve(scrollPanel);
233
188
  }
@@ -236,18 +191,15 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
236
191
  key: "shouldComponentUpdate",
237
192
  value: function shouldComponentUpdate(nextProps) {
238
193
  var _this$props4 = this.props,
239
- targetRef = _this$props4.targetRef,
240
- layout = _this$props4.layout,
241
- isResizing = _this$props4.isResizing,
242
- stickyHeader = _this$props4.stickyHeader;
194
+ targetRef = _this$props4.targetRef,
195
+ layout = _this$props4.layout,
196
+ isResizing = _this$props4.isResizing,
197
+ stickyHeader = _this$props4.stickyHeader;
243
198
  return stickyHeader !== nextProps.stickyHeader || targetRef !== nextProps.targetRef || layout !== nextProps.layout || isResizing !== nextProps.isResizing;
244
199
  }
245
200
  }]);
246
201
  return LayoutButton;
247
202
  }(_react.default.Component);
248
-
249
203
  (0, _defineProperty2.default)(LayoutButton, "displayName", 'LayoutButton');
250
-
251
204
  var _default = (0, _reactIntlNext.injectIntl)(LayoutButton);
252
-
253
205
  exports.default = _default;
@@ -1,50 +1,29 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.CornerControls = void 0;
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 _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
16
  var _react = _interopRequireWildcard(require("react"));
27
-
28
17
  var _reactIntlNext = require("react-intl-next");
29
-
30
18
  var _classnames = _interopRequireDefault(require("classnames"));
31
-
32
19
  var _tableMap = require("@atlaskit/editor-tables/table-map");
33
-
34
20
  var _utils = require("@atlaskit/editor-tables/utils");
35
-
36
21
  var _commands = require("../../../commands");
37
-
38
22
  var _types = require("../../../types");
39
-
40
23
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
41
-
42
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
43
-
44
25
  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); }; }
45
-
46
26
  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; } }
47
-
48
27
  var messages = (0, _reactIntlNext.defineMessages)({
49
28
  cornerControl: {
50
29
  id: 'fabric.editor.cornerControl',
@@ -52,71 +31,60 @@ var messages = (0, _reactIntlNext.defineMessages)({
52
31
  description: 'A button on the upper left corner of the table that shows up when the table is in focus. Clicking on it will select the entire table.'
53
32
  }
54
33
  });
55
-
56
34
  var CornerControlComponent = /*#__PURE__*/function (_Component) {
57
35
  (0, _inherits2.default)(CornerControlComponent, _Component);
58
-
59
36
  var _super = _createSuper(CornerControlComponent);
60
-
61
37
  function CornerControlComponent() {
62
38
  var _this;
63
-
64
39
  (0, _classCallCheck2.default)(this, CornerControlComponent);
65
-
66
40
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
67
41
  args[_key] = arguments[_key];
68
42
  }
69
-
70
43
  _this = _super.call.apply(_super, [this].concat(args));
71
44
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isActive", function () {
72
45
  var _this$props = _this.props,
73
- editorView = _this$props.editorView,
74
- hoveredRows = _this$props.hoveredRows,
75
- isResizing = _this$props.isResizing;
46
+ editorView = _this$props.editorView,
47
+ hoveredRows = _this$props.hoveredRows,
48
+ isResizing = _this$props.isResizing;
76
49
  var selection = editorView.state.selection;
77
50
  var table = (0, _utils.findTable)(selection);
78
-
79
51
  if (!table) {
80
52
  return false;
81
53
  }
82
-
83
54
  return (0, _utils.isTableSelected)(selection) || hoveredRows && hoveredRows.length === _tableMap.TableMap.get(table.node).height && !isResizing;
84
55
  });
85
56
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clearHoverSelection", function () {
86
57
  var _this$props$editorVie = _this.props.editorView,
87
- state = _this$props$editorVie.state,
88
- dispatch = _this$props$editorVie.dispatch;
58
+ state = _this$props$editorVie.state,
59
+ dispatch = _this$props$editorVie.dispatch;
89
60
  (0, _commands.clearHoverSelection)()(state, dispatch);
90
61
  });
91
62
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selectTable", function () {
92
63
  var _this$props$editorVie2 = _this.props.editorView,
93
- state = _this$props$editorVie2.state,
94
- dispatch = _this$props$editorVie2.dispatch;
64
+ state = _this$props$editorVie2.state,
65
+ dispatch = _this$props$editorVie2.dispatch;
95
66
  dispatch((0, _utils.selectTable)(state.tr).setMeta('addToHistory', false));
96
67
  });
97
68
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hoverTable", function () {
98
69
  var _this$props$editorVie3 = _this.props.editorView,
99
- state = _this$props$editorVie3.state,
100
- dispatch = _this$props$editorVie3.dispatch;
70
+ state = _this$props$editorVie3.state,
71
+ dispatch = _this$props$editorVie3.dispatch;
101
72
  (0, _commands.hoverTable)()(state, dispatch);
102
73
  });
103
74
  return _this;
104
75
  }
105
-
106
76
  (0, _createClass2.default)(CornerControlComponent, [{
107
77
  key: "render",
108
78
  value: function render() {
109
79
  var _this$props2 = this.props,
110
- isInDanger = _this$props2.isInDanger,
111
- tableRef = _this$props2.tableRef,
112
- isHeaderColumnEnabled = _this$props2.isHeaderColumnEnabled,
113
- isHeaderRowEnabled = _this$props2.isHeaderRowEnabled,
114
- formatMessage = _this$props2.intl.formatMessage;
115
-
80
+ isInDanger = _this$props2.isInDanger,
81
+ tableRef = _this$props2.tableRef,
82
+ isHeaderColumnEnabled = _this$props2.isHeaderColumnEnabled,
83
+ isHeaderRowEnabled = _this$props2.isHeaderRowEnabled,
84
+ formatMessage = _this$props2.intl.formatMessage;
116
85
  if (!tableRef) {
117
86
  return null;
118
87
  }
119
-
120
88
  var isActive = this.isActive();
121
89
  return /*#__PURE__*/_react.default.createElement("div", {
122
90
  className: (0, _classnames.default)(_types.TableCssClassName.CORNER_CONTROLS, {
@@ -149,6 +117,5 @@ var CornerControlComponent = /*#__PURE__*/function (_Component) {
149
117
  }]);
150
118
  return CornerControlComponent;
151
119
  }(_react.Component);
152
-
153
120
  var CornerControls = (0, _reactIntlNext.injectIntl)(CornerControlComponent);
154
121
  exports.CornerControls = CornerControls;