@atlaskit/editor-plugin-table 0.0.10 → 0.1.0

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 (213) hide show
  1. package/.eslintrc.js +35 -0
  2. package/CHANGELOG.md +23 -0
  3. package/commands/package.json +14 -0
  4. package/dist/cjs/plugins/table/commands/hover.js +4 -4
  5. package/dist/cjs/plugins/table/commands-with-analytics.js +59 -58
  6. package/dist/cjs/plugins/table/event-handlers.js +0 -1
  7. package/dist/cjs/plugins/table/index.js +54 -37
  8. package/dist/cjs/plugins/table/pm-plugins/table-resizing/index.js +9 -1
  9. package/dist/cjs/plugins/table/toolbar.js +150 -22
  10. package/dist/cjs/plugins/table/transforms/fix-tables.js +7 -7
  11. package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +1 -2
  12. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -6
  13. package/dist/cjs/plugins/table/ui/LayoutButton/index.js +3 -5
  14. package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
  15. package/dist/cjs/plugins/table/utils/column-controls.js +0 -1
  16. package/dist/cjs/plugins/table/utils/decoration.js +53 -4
  17. package/dist/cjs/plugins/table/utils/dom.js +0 -2
  18. package/dist/cjs/plugins/table/utils/paste.js +0 -1
  19. package/dist/cjs/version.json +1 -1
  20. package/dist/es2019/plugins/table/commands/hover.js +4 -4
  21. package/dist/es2019/plugins/table/commands-with-analytics.js +6 -9
  22. package/dist/es2019/plugins/table/event-handlers.js +1 -2
  23. package/dist/es2019/plugins/table/handlers.js +1 -2
  24. package/dist/es2019/plugins/table/index.js +23 -5
  25. package/dist/es2019/plugins/table/pm-plugins/keymap.js +1 -1
  26. package/dist/es2019/plugins/table/pm-plugins/table-local-id.js +1 -3
  27. package/dist/es2019/plugins/table/pm-plugins/table-resizing/index.js +2 -1
  28. package/dist/es2019/plugins/table/toolbar.js +133 -16
  29. package/dist/es2019/plugins/table/transforms/fix-tables.js +2 -4
  30. package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +1 -2
  31. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -6
  32. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +1 -2
  33. package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +1 -2
  34. package/dist/es2019/plugins/table/ui/LayoutButton/index.js +3 -5
  35. package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
  36. package/dist/es2019/plugins/table/utils/column-controls.js +0 -1
  37. package/dist/es2019/plugins/table/utils/decoration.js +60 -25
  38. package/dist/es2019/plugins/table/utils/dom.js +0 -2
  39. package/dist/es2019/plugins/table/utils/paste.js +1 -2
  40. package/dist/es2019/plugins/table/utils/row-controls.js +1 -2
  41. package/dist/es2019/version.json +1 -1
  42. package/dist/esm/plugins/table/commands/hover.js +4 -4
  43. package/dist/esm/plugins/table/commands-with-analytics.js +56 -55
  44. package/dist/esm/plugins/table/event-handlers.js +1 -2
  45. package/dist/esm/plugins/table/handlers.js +1 -2
  46. package/dist/esm/plugins/table/index.js +55 -38
  47. package/dist/esm/plugins/table/pm-plugins/keymap.js +1 -1
  48. package/dist/esm/plugins/table/pm-plugins/table-local-id.js +1 -3
  49. package/dist/esm/plugins/table/pm-plugins/table-resizing/index.js +2 -1
  50. package/dist/esm/plugins/table/toolbar.js +139 -17
  51. package/dist/esm/plugins/table/transforms/fix-tables.js +2 -4
  52. package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +1 -2
  53. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +4 -6
  54. package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +1 -2
  55. package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +1 -2
  56. package/dist/esm/plugins/table/ui/LayoutButton/index.js +3 -5
  57. package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
  58. package/dist/esm/plugins/table/utils/column-controls.js +0 -1
  59. package/dist/esm/plugins/table/utils/decoration.js +50 -4
  60. package/dist/esm/plugins/table/utils/dom.js +0 -2
  61. package/dist/esm/plugins/table/utils/paste.js +1 -2
  62. package/dist/esm/plugins/table/utils/row-controls.js +1 -2
  63. package/dist/esm/version.json +1 -1
  64. package/dist/types/plugins/table/commands-with-analytics.d.ts +5 -5
  65. package/dist/types/plugins/table/pm-plugins/table-resizing/index.d.ts +1 -0
  66. package/dist/types/plugins/table/toolbar.d.ts +2 -2
  67. package/dist/types/plugins/table/transforms/fix-tables.d.ts +1 -1
  68. package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
  69. package/dist/types-ts4.0/plugins/table/commands-with-analytics.d.ts +5 -5
  70. package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/index.d.ts +1 -0
  71. package/dist/types-ts4.0/plugins/table/toolbar.d.ts +2 -2
  72. package/dist/types-ts4.0/plugins/table/transforms/fix-tables.d.ts +1 -1
  73. package/dist/types-ts4.0/plugins/table/utils/decoration.d.ts +1 -1
  74. package/examples/config.jsonc +14 -0
  75. package/package.json +15 -11
  76. package/plugin-key/package.json +14 -0
  77. package/report.api.md +1 -1
  78. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/auto-size-documents.ts +0 -0
  79. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/basic-table.ts +0 -0
  80. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/empty-paragraph-underneath-table.ts +0 -0
  81. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/even-columns.ts +0 -0
  82. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/layout-documents.ts +0 -0
  83. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/merged-rows-and-cols-document.ts +0 -0
  84. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/nested-in-extension.ts +0 -0
  85. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/paragraph-and-table-adf.json +0 -0
  86. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/resize-documents.ts +0 -0
  87. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/scale.ts +0 -0
  88. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-inside-layout.ts +0 -0
  89. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-min-width-columns-document.ts +0 -0
  90. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-multiline-date.adf.json +0 -0
  91. package/src/{plugins/table/__tests__ → __tests__}/integration/__fixtures__/table-with-text-and-empty-row.ts +0 -0
  92. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/auto-size.ts.snap +0 -0
  93. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/change-date-inside-table.ts.snap +0 -0
  94. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/copy-button.ts.snap +0 -0
  95. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-columns.ts.snap +0 -0
  96. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-column-in-full-width.ts.snap +0 -0
  97. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-column-with-empty-action.ts.snap +0 -0
  98. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-last-row-with-empty-action.ts.snap +0 -0
  99. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-rows.ts.snap +0 -0
  100. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/delete-table-when-selected.ts.snap +0 -0
  101. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/deleting-empty-paragraph-under-table.ts.snap +0 -0
  102. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/even-columns.ts.snap +0 -0
  103. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/insert-cell-header-with-strong-mark.ts.snap +0 -0
  104. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/insert-row-inside-layout.ts.snap +0 -0
  105. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/layout.ts.snap +0 -0
  106. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/resize.ts.snap +0 -0
  107. package/src/{plugins/table/__tests__ → __tests__}/integration/__snapshots__/scale.ts.snap +0 -0
  108. package/src/{plugins/table/__tests__ → __tests__}/integration/arrow-down-into-table.ts +0 -0
  109. package/src/{plugins/table/__tests__ → __tests__}/integration/auto-size.ts +0 -0
  110. package/src/{plugins/table/__tests__ → __tests__}/integration/block-node-selection.ts +1 -0
  111. package/src/{plugins/table/__tests__ → __tests__}/integration/cell-selection.ts +0 -0
  112. package/src/{plugins/table/__tests__ → __tests__}/integration/change-date-inside-table.ts +0 -0
  113. package/src/{plugins/table/__tests__ → __tests__}/integration/copy-button.ts +1 -1
  114. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-columns.ts +2 -2
  115. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-column-in-full-width.ts +1 -1
  116. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-column-with-empty-action.ts +1 -1
  117. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-last-row-with-empty-action.ts +1 -1
  118. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-rows.ts +2 -2
  119. package/src/{plugins/table/__tests__ → __tests__}/integration/delete-table-when-selected.ts +0 -0
  120. package/src/{plugins/table/__tests__ → __tests__}/integration/deleting-empty-paragraph-under-table.ts +0 -0
  121. package/src/{plugins/table/__tests__ → __tests__}/integration/even-columns.ts +0 -0
  122. package/src/{plugins/table/__tests__ → __tests__}/integration/insert-cell-header-with-strong-mark.ts +0 -0
  123. package/src/{plugins/table/__tests__ → __tests__}/integration/insert-long-smart-link.ts +1 -0
  124. package/src/{plugins/table/__tests__ → __tests__}/integration/insert-row-inside-layout.ts +0 -0
  125. package/src/{plugins/table/__tests__ → __tests__}/integration/layout.ts +0 -0
  126. package/src/{plugins/table/__tests__ → __tests__}/integration/resize-handler.ts +0 -0
  127. package/src/{plugins/table/__tests__ → __tests__}/integration/resize.ts +1 -1
  128. package/src/{plugins/table/__tests__ → __tests__}/integration/scale.ts +0 -0
  129. package/src/__tests__/integration/table-controls-selection.ts +71 -0
  130. package/src/__tests__/unit/analytics.ts +8 -9
  131. package/src/{plugins/table/__tests__ → __tests__}/unit/commands/go-to-next-cell.ts +4 -4
  132. package/src/{plugins/table/__tests__ → __tests__}/unit/commands/insert.ts +4 -4
  133. package/src/{plugins/table/__tests__ → __tests__}/unit/commands/misc.ts +12 -6
  134. package/src/{plugins/table/__tests__ → __tests__}/unit/commands.ts +7 -7
  135. package/src/__tests__/unit/copy-button.ts +22 -0
  136. package/src/__tests__/unit/event-handlers.ts +120 -1
  137. package/src/{plugins/table/__tests__ → __tests__}/unit/get-toolbar-config.ts +8 -3
  138. package/src/{plugins/table/__tests__ → __tests__}/unit/nodeviews/OverflowShadowsObserver.ts +2 -2
  139. package/src/{plugins/table/__tests__ → __tests__}/unit/nodeviews/TableComponent.tsx +11 -11
  140. package/src/{plugins/table/__tests__ → __tests__}/unit/nodeviews/table.ts +5 -5
  141. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/column-controls.ts +2 -2
  142. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/column-resizing.ts +9 -6
  143. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/decorations/plugin.ts +5 -5
  144. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/main-with-allow-collapse.ts +4 -4
  145. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/main.ts +6 -6
  146. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +2 -2
  147. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/sticky-headers/tableRow.tsx +16 -13
  148. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-local-id.ts +3 -6
  149. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-resizing/colgroup.ts +1 -1
  150. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-resizing/event-handlers.ts +3 -3
  151. package/src/{plugins/table/__tests__ → __tests__}/unit/pm-plugins/table-selection-keymap.ts +3 -3
  152. package/src/{plugins/table/__tests__ → __tests__}/unit/toolbar.ts +5 -9
  153. package/src/{plugins/table/__tests__ → __tests__}/unit/utils/collapse.ts +2 -2
  154. package/src/{plugins/table/__tests__ → __tests__}/unit/utils/column-controls.ts +1 -1
  155. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__fixtures__/table-with-100-numbered-list-items.json +0 -0
  156. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-should-remove-the-table-column-on-click-1-snap.png +0 -0
  157. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +0 -0
  158. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-should-remove-the-table-row-on-click-1-snap.png +0 -0
  159. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +0 -0
  160. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/copy-button-ts-floating-toolbar-copy-button-table-target-node-displays-blue-border-when-copy-button-is-hovered-1-snap.png +0 -0
  161. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-1-snap.png +0 -0
  162. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-2-snap.png +0 -0
  163. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-3-snap.png +0 -0
  164. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/cell-options-menu.ts +2 -0
  165. package/src/__tests__/visual-regression/copy-button.ts +181 -0
  166. package/src/{plugins/table/__tests__ → __tests__}/visual-regression/index.ts +3 -1
  167. package/src/plugins/table/commands/hover.ts +4 -1
  168. package/src/plugins/table/commands-with-analytics.ts +12 -8
  169. package/src/plugins/table/event-handlers.ts +0 -1
  170. package/src/plugins/table/handlers.ts +0 -1
  171. package/src/plugins/table/index.tsx +28 -2
  172. package/src/plugins/table/pm-plugins/keymap.ts +1 -1
  173. package/src/plugins/table/pm-plugins/table-local-id.ts +0 -2
  174. package/src/plugins/table/pm-plugins/table-resizing/index.ts +1 -0
  175. package/src/plugins/table/{toolbar.ts → toolbar.tsx} +186 -14
  176. package/src/plugins/table/transforms/fix-tables.ts +2 -3
  177. package/src/plugins/table/ui/FloatingContextualButton/index.tsx +0 -1
  178. package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +13 -10
  179. package/src/plugins/table/ui/FloatingContextualMenu/__tests__/ContextualMenu.tsx +1 -0
  180. package/src/plugins/table/ui/FloatingContextualMenu/__tests__/FloatingContextualMenu.tsx +1 -0
  181. package/src/plugins/table/ui/FloatingDeleteButton/index.tsx +0 -1
  182. package/src/plugins/table/ui/FloatingInsertButton/index.tsx +0 -1
  183. package/src/plugins/table/ui/LayoutButton/index.tsx +2 -4
  184. package/src/plugins/table/ui/TableFloatingControls/CornerControls/index.tsx +1 -0
  185. package/src/plugins/table/utils/column-controls.ts +0 -1
  186. package/src/plugins/table/utils/decoration.ts +44 -5
  187. package/src/plugins/table/utils/dom.ts +0 -2
  188. package/src/plugins/table/utils/paste.ts +0 -1
  189. package/src/plugins/table/utils/row-controls.ts +0 -1
  190. package/types/package.json +5 -5
  191. package/ui/common-styles/package.json +14 -0
  192. package/ui/consts/package.json +14 -0
  193. package/dist/cjs/plugins/plugin-key.js +0 -17
  194. package/dist/cjs/plugins/table/todo-stubs.js +0 -10
  195. package/dist/cjs/types.js +0 -5
  196. package/dist/es2019/plugins/plugin-key.js +0 -3
  197. package/dist/es2019/plugins/table/todo-stubs.js +0 -1
  198. package/dist/es2019/types.js +0 -1
  199. package/dist/esm/plugins/plugin-key.js +0 -5
  200. package/dist/esm/plugins/table/todo-stubs.js +0 -1
  201. package/dist/esm/types.js +0 -1
  202. package/dist/types/plugins/plugin-key.d.ts +0 -4
  203. package/dist/types/plugins/table/todo-stubs.d.ts +0 -1
  204. package/dist/types/types.d.ts +0 -3
  205. package/dist/types-ts4.0/plugins/plugin-key.d.ts +0 -4
  206. package/dist/types-ts4.0/plugins/table/todo-stubs.d.ts +0 -1
  207. package/dist/types-ts4.0/types.d.ts +0 -3
  208. package/src/plugins/plugin-key.ts +0 -7
  209. package/src/plugins/table/__tests__/integration/table-controls-selection.ts +0 -70
  210. package/src/plugins/table/__tests__/unit/event-handlers.ts +0 -130
  211. package/src/plugins/table/todo-stubs.ts +0 -1
  212. package/src/types.ts +0 -3
  213. package/tmp/api-report-tmp.d.ts +0 -91
@@ -9,6 +9,8 @@ exports.messages = exports.getToolbarMenuConfig = exports.getToolbarConfig = exp
9
9
 
10
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
11
 
12
+ var _react = require("@emotion/react");
13
+
12
14
  var _reactIntlNext = require("react-intl-next");
13
15
 
14
16
  var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
@@ -25,11 +27,13 @@ var _tableResizing = require("./pm-plugins/table-resizing");
25
27
 
26
28
  var _types = require("./types");
27
29
 
30
+ var _utils = require("./utils");
31
+
28
32
  var _referentiality = require("./utils/referentiality");
29
33
 
30
34
  var _analytics = require("@atlaskit/editor-common/analytics");
31
35
 
32
- var _utils = require("@atlaskit/editor-tables/utils");
36
+ var _utils2 = require("@atlaskit/editor-tables/utils");
33
37
 
34
38
  var _transforms = require("./transforms");
35
39
 
@@ -39,8 +43,19 @@ var _ContextualMenu = require("./ui/FloatingContextualMenu/ContextualMenu");
39
43
 
40
44
  var _prosemirrorUtils = require("prosemirror-utils");
41
45
 
42
- var _utils2 = require("@atlaskit/editor-common/utils");
46
+ var _utils3 = require("@atlaskit/editor-common/utils");
47
+
48
+ var _keymaps = require("@atlaskit/editor-common/keymaps");
49
+
50
+ var _resizeState = require("./pm-plugins/table-resizing/utils/resize-state");
51
+
52
+ var _steps = require("@atlaskit/adf-schema/steps");
43
53
 
54
+ var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
55
+
56
+ var _uiColor = require("@atlaskit/editor-common/ui-color");
57
+
58
+ /** @jsx jsx */
44
59
  var messages = (0, _reactIntlNext.defineMessages)({
45
60
  tableOptions: {
46
61
  id: 'fabric.editor.tableOptions',
@@ -115,6 +130,8 @@ var getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _ref, ed
115
130
  exports.getToolbarMenuConfig = getToolbarMenuConfig;
116
131
 
117
132
  var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorState, initialSelectionRect, _ref2, getEditorContainerWidth, editorAnalyticsAPI) {
133
+ var _pluginState$pluginCo, _pluginState$pluginCo2;
134
+
118
135
  var formatMessage = _ref2.formatMessage;
119
136
  var top = initialSelectionRect.top,
120
137
  bottom = initialSelectionRect.bottom,
@@ -122,6 +139,7 @@ var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorSta
122
139
  left = initialSelectionRect.left;
123
140
  var numberOfColumns = right - left;
124
141
  var numberOfRows = bottom - top;
142
+ var pluginState = (0, _pluginFactory.getPluginState)(editorState);
125
143
  var options = [{
126
144
  id: 'editor.table.insertColumn',
127
145
  title: formatMessage(_messages2.default.insertColumn),
@@ -136,7 +154,10 @@ var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorSta
136
154
  return true;
137
155
  },
138
156
  selected: false,
139
- disabled: false
157
+ disabled: false,
158
+ elemAfter: (0, _react.jsx)("div", {
159
+ css: _shortcut.shortcutStyle
160
+ }, (0, _keymaps.tooltip)(_keymaps.addColumnAfter))
140
161
  }, {
141
162
  id: 'editor.table.insertRow',
142
163
  title: formatMessage(_messages2.default.insertRow),
@@ -154,7 +175,10 @@ var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorSta
154
175
  return true;
155
176
  },
156
177
  selected: false,
157
- disabled: false
178
+ disabled: false,
179
+ elemAfter: (0, _react.jsx)("div", {
180
+ css: _shortcut.shortcutStyle
181
+ }, (0, _keymaps.tooltip)(_keymaps.addRowAfter))
158
182
  }, {
159
183
  id: 'editor.table.removeColumns',
160
184
  title: formatMessage(_messages2.default.removeColumns, {
@@ -190,16 +214,63 @@ var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorSta
190
214
  }, {
191
215
  id: 'editor.table.mergeCells',
192
216
  title: formatMessage(_ContextualMenu.messages.mergeCells),
193
- onClick: (0, _commandsWithAnalytics.mergeCellsWithAnalytics)(editorAnalyticsAPI),
217
+ onClick: (0, _commandsWithAnalytics.mergeCellsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB),
194
218
  selected: false,
195
219
  disabled: !(0, _transforms.canMergeCells)(editorState.tr)
196
220
  }, {
197
221
  id: 'editor.table.splitCell',
198
222
  title: formatMessage(_ContextualMenu.messages.splitCell),
199
- onClick: (0, _commandsWithAnalytics.splitCellWithAnalytics)(editorAnalyticsAPI),
223
+ onClick: (0, _commandsWithAnalytics.splitCellWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB),
200
224
  selected: false,
201
- disabled: !(0, _utils.splitCell)(editorState)
202
- }, {
225
+ disabled: !(0, _utils2.splitCell)(editorState)
226
+ }];
227
+
228
+ if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo = pluginState.pluginConfig) !== null && _pluginState$pluginCo !== void 0 && _pluginState$pluginCo.allowDistributeColumns) {
229
+ var distributeColumnWidths = function distributeColumnWidths(state, dispatch, view) {
230
+ var newResizeStateWithAnalytics = view ? (0, _resizeState.getNewResizeStateFromSelectedColumns)(initialSelectionRect, editorState, view.domAtPos.bind(view), getEditorContainerWidth) : undefined;
231
+
232
+ if (newResizeStateWithAnalytics) {
233
+ (0, _commandsWithAnalytics.distributeColumnsWidthsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB, newResizeStateWithAnalytics)(state, dispatch);
234
+ return true;
235
+ }
236
+
237
+ return false;
238
+ };
239
+
240
+ options.push({
241
+ id: 'editor.table.distributeColumns',
242
+ title: formatMessage(_ContextualMenu.messages.distributeColumns),
243
+ onClick: distributeColumnWidths,
244
+ selected: false,
245
+ disabled: numberOfColumns <= 1
246
+ });
247
+ }
248
+
249
+ if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo2 = pluginState.pluginConfig) !== null && _pluginState$pluginCo2 !== void 0 && _pluginState$pluginCo2.allowColumnSorting) {
250
+ var hasMergedCellsInTable = (0, _utils.getMergedCellsPositions)(editorState.tr).length > 0;
251
+ options.push({
252
+ id: 'editor.table.sortColumnAsc',
253
+ title: formatMessage(_ContextualMenu.messages.sortColumnASC),
254
+ onClick: function onClick(state, dispatch) {
255
+ (0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB, initialSelectionRect.left, _steps.TableSortOrder.ASC)(state, dispatch);
256
+ return true;
257
+ },
258
+ selected: false,
259
+ disabled: hasMergedCellsInTable
260
+ });
261
+ options.push({
262
+ id: 'editor.table.sortColumnDesc',
263
+ title: formatMessage(_ContextualMenu.messages.sortColumnDESC),
264
+ onClick: function onClick(state, dispatch) {
265
+ (0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB, initialSelectionRect.left, _steps.TableSortOrder.DESC)(state, dispatch);
266
+ return true;
267
+ },
268
+ selected: false,
269
+ disabled: hasMergedCellsInTable
270
+ });
271
+ }
272
+
273
+ options.push({
203
274
  id: 'editor.table.clearCells',
204
275
  title: formatMessage(_ContextualMenu.messages.clearCells, {
205
276
  0: Math.max(numberOfColumns, numberOfRows)
@@ -212,14 +283,19 @@ var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorSta
212
283
  return true;
213
284
  },
214
285
  selected: false,
215
- disabled: false
216
- }];
286
+ disabled: false,
287
+ elemAfter: (0, _react.jsx)("div", {
288
+ css: _shortcut.shortcutStyle
289
+ }, (0, _keymaps.tooltip)(_keymaps.backspace))
290
+ });
217
291
  return {
218
292
  id: 'editor.table.cellOptions',
219
293
  type: 'dropdown',
220
294
  title: formatMessage(_messages2.default.cellOptions),
221
- hidden: true,
222
- options: options
295
+ options: options,
296
+ // Increased dropdown item width to prevent labels from being truncated
297
+ dropdownWidth: 230,
298
+ showSelected: false
223
299
  };
224
300
  };
225
301
 
@@ -227,13 +303,13 @@ exports.getToolbarCellOptionsConfig = getToolbarCellOptionsConfig;
227
303
 
228
304
  var getClosestSelectionRect = function getClosestSelectionRect(state) {
229
305
  var selection = state.selection;
230
- return (0, _utils.isSelectionType)(selection, 'cell') ? (0, _utils.getSelectionRect)(selection) : (0, _utils.findCellRectClosestToPos)(selection.$from);
306
+ return (0, _utils2.isSelectionType)(selection, 'cell') ? (0, _utils2.getSelectionRect)(selection) : (0, _utils2.findCellRectClosestToPos)(selection.$from);
231
307
  };
232
308
 
233
- var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editorAnalyticsAPI) {
309
+ var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags) {
234
310
  return function (config) {
235
311
  return function (state, intl) {
236
- var tableObject = (0, _utils.findTable)(state.selection);
312
+ var tableObject = (0, _utils2.findTable)(state.selection);
237
313
  var pluginState = (0, _pluginFactory.getPluginState)(state);
238
314
 
239
315
  var resizeState = _tableResizing.pluginKey.getState(state);
@@ -241,7 +317,12 @@ var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editor
241
317
  if (tableObject && pluginState.editorHasFocus) {
242
318
  var nodeType = state.schema.nodes.table;
243
319
  var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI);
244
- var cellItems = getCellItems(config, state, intl, getEditorContainerWidth, editorAnalyticsAPI); // Check if we need to show confirm dialog for delete button
320
+
321
+ var _ref3 = getEditorFeatureFlags() || {},
322
+ tableCellOptionsInFloatingToolbar = _ref3.tableCellOptionsInFloatingToolbar;
323
+
324
+ var cellItems = getCellItems(config, state, intl, getEditorContainerWidth, editorAnalyticsAPI, tableCellOptionsInFloatingToolbar);
325
+ var colorPicker = getColorPicker(state, menu, intl, getEditorContainerWidth, editorAnalyticsAPI, tableCellOptionsInFloatingToolbar); // Check if we need to show confirm dialog for delete button
245
326
 
246
327
  var confirmDialog;
247
328
  var localId = tableObject.node.attrs.localId;
@@ -262,7 +343,7 @@ var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editor
262
343
  var tableRef = parent.querySelector('table') || undefined;
263
344
 
264
345
  if (tableRef) {
265
- element = (0, _utils2.closestElement)(tableRef, ".".concat(_types.TableCssClassName.TABLE_NODE_WRAPPER)) || undefined;
346
+ element = (0, _utils3.closestElement)(tableRef, ".".concat(_types.TableCssClassName.TABLE_NODE_WRAPPER)) || undefined;
266
347
  }
267
348
  }
268
349
 
@@ -274,9 +355,20 @@ var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editor
274
355
  getDomRef: getDomRef,
275
356
  nodeType: nodeType,
276
357
  offset: [0, 3],
277
- items: [menu, separator(menu.hidden)].concat((0, _toConsumableArray2.default)(cellItems), [{
358
+ items: [menu, separator(menu.hidden)].concat((0, _toConsumableArray2.default)(cellItems), (0, _toConsumableArray2.default)(colorPicker), [{
278
359
  type: 'extensions-placeholder',
279
360
  separator: 'end'
361
+ }, {
362
+ type: 'copy-button',
363
+ items: [{
364
+ state: state,
365
+ formatMessage: intl.formatMessage,
366
+ nodeType: nodeType,
367
+ onMouseEnter: (0, _commands.hoverTable)(false, true),
368
+ onMouseLeave: (0, _commands.clearHoverSelection)()
369
+ }, {
370
+ type: 'separator'
371
+ }]
280
372
  }, {
281
373
  id: 'editor.table.delete',
282
374
  type: 'button',
@@ -288,7 +380,8 @@ var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editor
288
380
  onMouseLeave: (0, _commands.clearHoverSelection)(),
289
381
  title: intl.formatMessage(_messages.default.remove),
290
382
  confirmDialog: confirmDialog
291
- }])
383
+ }]),
384
+ scrollable: true
292
385
  };
293
386
  }
294
387
 
@@ -306,10 +399,10 @@ var separator = function separator(hidden) {
306
399
  };
307
400
  };
308
401
 
309
- var getCellItems = function getCellItems(pluginConfig, state, _ref3, getEditorContainerWidth, editorAnalyticsAPI) {
310
- var formatMessage = _ref3.formatMessage;
402
+ var getCellItems = function getCellItems(pluginConfig, state, _ref4, getEditorContainerWidth, editorAnalyticsAPI, tableCellOptionsInFloatingToolbar) {
403
+ var formatMessage = _ref4.formatMessage;
311
404
 
312
- if (pluginConfig.allowCellOptionsInFloatingToolbar) {
405
+ if (pluginConfig.allowCellOptionsInFloatingToolbar || tableCellOptionsInFloatingToolbar) {
313
406
  var initialSelectionRect = getClosestSelectionRect(state);
314
407
 
315
408
  if (initialSelectionRect) {
@@ -321,4 +414,39 @@ var getCellItems = function getCellItems(pluginConfig, state, _ref3, getEditorCo
321
414
  }
322
415
 
323
416
  return [];
417
+ };
418
+
419
+ var getColorPicker = function getColorPicker(state, menu, _ref5, getEditorContainerWidth, editorAnalyticsAPI, tableCellOptionsInFloatingToolbar) {
420
+ var _node$attrs;
421
+
422
+ var formatMessage = _ref5.formatMessage;
423
+
424
+ var _getPluginState2 = (0, _pluginFactory.getPluginState)(state),
425
+ targetCellPosition = _getPluginState2.targetCellPosition,
426
+ pluginConfig = _getPluginState2.pluginConfig;
427
+
428
+ if (!pluginConfig.allowBackgroundColor || !tableCellOptionsInFloatingToolbar) {
429
+ return [];
430
+ }
431
+
432
+ var node = targetCellPosition ? state.doc.nodeAt(targetCellPosition) : undefined;
433
+ var currentBackground = (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff';
434
+ var defaultPalette = _uiColor.cellBackgroundColorPalette.find(function (item) {
435
+ return item.value === currentBackground;
436
+ }) || {
437
+ label: 'Custom',
438
+ value: currentBackground,
439
+ border: _uiColor.DEFAULT_BORDER_COLOR
440
+ };
441
+ return [{
442
+ id: 'editor.panel.colorPicker',
443
+ title: formatMessage(_ContextualMenu.messages.cellBackground),
444
+ type: 'select',
445
+ selectType: 'color',
446
+ defaultValue: defaultPalette,
447
+ options: _uiColor.cellBackgroundColorPalette,
448
+ onChange: function onChange(option) {
449
+ return (0, _commandsWithAnalytics.setColorWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB, option.value, targetCellPosition);
450
+ }
451
+ }, separator(menu.hidden)];
324
452
  };
@@ -13,9 +13,9 @@ var _styles = require("@atlaskit/editor-common/styles");
13
13
 
14
14
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
15
15
 
16
- var _todoStubs = require("../todo-stubs");
16
+ var _utils = require("@atlaskit/editor-common/utils");
17
17
 
18
- var _utils = require("../pm-plugins/table-resizing/utils");
18
+ var _utils2 = require("../pm-plugins/table-resizing/utils");
19
19
 
20
20
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
21
 
@@ -23,7 +23,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
23
23
 
24
24
  var fireAnalytics = function fireAnalytics() {
25
25
  var properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26
- return (0, _todoStubs.sendLogs)({
26
+ return (0, _utils.sendLogs)({
27
27
  events: [{
28
28
  name: 'atlaskit.fabric.editor.fixtable',
29
29
  product: 'atlaskit',
@@ -146,7 +146,7 @@ var fixAutoSizedTable = function fixAutoSizedTable(view, tableNode, tableRef, ta
146
146
  return acc + current;
147
147
  }, 0);
148
148
  var tableLayout = getLayoutBasedOnWidth(totalContentWidth);
149
- var maxLayoutSize = (0, _utils.getLayoutSize)(tableLayout, opts.containerWidth, {}); // Content width will generally not meet the constraints of the layout
149
+ var maxLayoutSize = (0, _utils2.getLayoutSize)(tableLayout, opts.containerWidth, {}); // Content width will generally not meet the constraints of the layout
150
150
  // whether it be below or above, so we scale our columns widths
151
151
  // to meet these requirements
152
152
 
@@ -199,9 +199,9 @@ function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
199
199
 
200
200
  for (var span = 0; span < colspan; span++) {
201
201
  var colIdx = col + span;
202
- var cells = (0, _utils.getCellsRefsInColumn)(colIdx, tableNode, tableStart, domAtPos);
203
- var colWidth = (0, _utils.calculateColumnWidth)(cells, function (_, col) {
204
- return (0, _utils.contentWidth)(col, tableRef).width;
202
+ var cells = (0, _utils2.getCellsRefsInColumn)(colIdx, tableNode, tableStart, domAtPos);
203
+ var colWidth = (0, _utils2.calculateColumnWidth)(cells, function (_, col) {
204
+ return (0, _utils2.contentWidth)(col, tableRef).width;
205
205
  });
206
206
  cols[colIdx] = Math.max(colWidth, _styles.tableCellMinWidth);
207
207
  }
@@ -175,8 +175,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/function (_React$Component) {
175
175
  key: "shouldComponentUpdate",
176
176
  value: function shouldComponentUpdate(nextProps) {
177
177
  return this.props.tableNode !== nextProps.tableNode || this.props.targetCellPosition !== nextProps.targetCellPosition || this.props.layout !== nextProps.layout || this.props.isContextualMenuOpen !== nextProps.isContextualMenuOpen || this.props.isNumberColumnEnabled !== nextProps.isNumberColumnEnabled || this.props.stickyHeader !== nextProps.stickyHeader;
178
- } // TODO: restore
179
-
178
+ }
180
179
  }]);
181
180
  return FloatingContextualButtonInner;
182
181
  }(_react.default.Component);
@@ -326,14 +326,14 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
326
326
  break;
327
327
 
328
328
  case 'merge':
329
- (0, _commandsWithAnalytics.mergeCellsWithAnalytics)(editorAnalyticsAPI)(state, dispatch);
329
+ (0, _commandsWithAnalytics.mergeCellsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU)(state, dispatch);
330
330
 
331
331
  _this.toggleOpen();
332
332
 
333
333
  break;
334
334
 
335
335
  case 'split':
336
- (0, _commandsWithAnalytics.splitCellWithAnalytics)(editorAnalyticsAPI)(state, dispatch);
336
+ (0, _commandsWithAnalytics.splitCellWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU)(state, dispatch);
337
337
 
338
338
  _this.toggleOpen();
339
339
 
@@ -474,10 +474,8 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
474
474
  targetCellPosition = _getPluginState4.targetCellPosition;
475
475
 
476
476
  var state = editorView.state,
477
- dispatch = editorView.dispatch; // setColorWithAnalytics(color, targetCellPosition)(state, dispatch);
478
- // TODO: restore
479
-
480
- (0, _commandsWithAnalytics.setColorWithAnalytics)(editorAnalyticsAPI)(color, targetCellPosition)(state, dispatch);
477
+ dispatch = editorView.dispatch;
478
+ (0, _commandsWithAnalytics.setColorWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, color, targetCellPosition)(state, dispatch);
481
479
 
482
480
  _this.toggleOpen();
483
481
  });
@@ -154,8 +154,7 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
154
154
  }, {
155
155
  key: "renderSticky",
156
156
  value: function renderSticky(button, targetRef, tableRef) {
157
- // const title = this.getTitle();
158
- var title = 'TODO MISSING TITLE';
157
+ var title = this.getTitle();
159
158
 
160
159
  if (!(targetRef instanceof HTMLElement) || !(tableRef instanceof HTMLElement)) {
161
160
  return null;
@@ -184,10 +183,9 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
184
183
 
185
184
  if (!targetRef) {
186
185
  return null;
187
- } // const title = this.getTitle();
188
-
186
+ }
189
187
 
190
- var title = 'TODO MISSING TITLE';
188
+ var title = this.getTitle();
191
189
  return /*#__PURE__*/_react.default.createElement(_ui.Popup, {
192
190
  ariaLabel: title,
193
191
  target: targetRef,
@@ -125,7 +125,8 @@ var CornerControlComponent = /*#__PURE__*/function (_Component) {
125
125
  }),
126
126
  style: {
127
127
  top: this.props.stickyTop !== undefined ? "".concat(this.props.stickyTop, "px") : undefined
128
- }
128
+ },
129
+ contentEditable: false
129
130
  }, /*#__PURE__*/_react.default.createElement("button", {
130
131
  "aria-label": formatMessage(messages.cornerControl),
131
132
  type: "button",
@@ -23,7 +23,6 @@ var _types = require("../types");
23
23
 
24
24
  var _consts = require("../ui/consts");
25
25
 
26
- // import { maphElem } from '@atlaskit/editor-core/src/utils/dom';
27
26
  var getColumnsWidths = function getColumnsWidths(view) {
28
27
  var selection = view.state.selection;
29
28
  var widths = [];
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.updateDecorations = exports.findControlsHoverDecoration = exports.findColumnControlSelectedDecoration = exports.createResizeHandleDecoration = exports.createControlsHoverDecoration = exports.createColumnSelectedDecoration = exports.createColumnLineResize = exports.createColumnControlsDecoration = exports.createCellHoverDecoration = void 0;
7
9
 
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+
8
12
  var _tableMap = require("@atlaskit/editor-tables/table-map");
9
13
 
10
14
  var _utils = require("@atlaskit/editor-tables/utils");
@@ -15,7 +19,6 @@ var _utils2 = require("@atlaskit/editor-common/utils");
15
19
 
16
20
  var _types = require("../types");
17
21
 
18
- // import { nonNullable } from '@atlaskit/editor-core/src/utils';
19
22
  var filterDecorationByKey = function filterDecorationByKey(key, decorationSet) {
20
23
  return decorationSet.find(undefined, undefined, function (spec) {
21
24
  return spec.key.indexOf(key) > -1;
@@ -46,8 +49,54 @@ var createCellHoverDecoration = function createCellHoverDecoration(cells, type)
46
49
 
47
50
  exports.createCellHoverDecoration = createCellHoverDecoration;
48
51
 
49
- var createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, danger, selected) {
50
- return cells.map(function (cell) {
52
+ var createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, danger, selected) {
53
+ var table = (0, _utils.findTable)(tr.selection);
54
+
55
+ if (!table) {
56
+ return [];
57
+ }
58
+
59
+ var map = _tableMap.TableMap.get(table.node);
60
+
61
+ var _cells$reduce = cells.reduce(function (_ref, cell) {
62
+ var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
63
+ min = _ref2[0],
64
+ max = _ref2[1];
65
+
66
+ if (min === null || cell.pos < min) {
67
+ min = cell.pos;
68
+ }
69
+
70
+ if (max === null || cell.pos > max) {
71
+ max = cell.pos;
72
+ }
73
+
74
+ return [min, max];
75
+ }, [null, null]),
76
+ _cells$reduce2 = (0, _slicedToArray2.default)(_cells$reduce, 2),
77
+ min = _cells$reduce2[0],
78
+ max = _cells$reduce2[1];
79
+
80
+ if (min === null || max === null) {
81
+ return [];
82
+ }
83
+
84
+ var updatedCells = cells.map(function (x) {
85
+ return x.pos;
86
+ }); // ED-15246 fixed trello card table overflow issue
87
+ // If columns / rows have been merged the hovered selection is different to the actual selection
88
+ // So If the table cells are in danger we want to create a "rectangle" selection
89
+ // to match the "clicked" selection
90
+
91
+ if (danger) {
92
+ var rect = map.rectBetween(min - table.start, max - table.start);
93
+ updatedCells = map.cellsInRect(rect).map(function (x) {
94
+ return x + table.start;
95
+ });
96
+ }
97
+
98
+ return updatedCells.map(function (pos) {
99
+ var cell = tr.doc.nodeAt(pos);
51
100
  var classes = [_types.TableCssClassName.HOVERED_CELL];
52
101
 
53
102
  if (danger) {
@@ -75,7 +124,7 @@ var createControlsHoverDecoration = function createControlsHoverDecoration(cells
75
124
  break;
76
125
  }
77
126
 
78
- return _prosemirrorView.Decoration.node(cell.pos, cell.pos + cell.node.nodeSize, {
127
+ return _prosemirrorView.Decoration.node(pos, pos + cell.nodeSize, {
79
128
  class: classes.join(' ')
80
129
  }, {
81
130
  key: key
@@ -11,8 +11,6 @@ var _types = require("../types");
11
11
 
12
12
  var _consts = require("../ui/consts");
13
13
 
14
- // import { containsClassName } from '@atlaskit/editor-core/src/utils';
15
- // import { closestElement } from '@atlaskit/editor-core/src/utils/dom';
16
14
  var SELECTOR_TABLE_LEAFS = ".".concat(_types.TableCssClassName.TABLE_CELL, ", .").concat(_types.TableCssClassName.TABLE_HEADER_CELL);
17
15
 
18
16
  var isCell = function isCell(node) {
@@ -18,7 +18,6 @@ var _utils = require("@atlaskit/editor-common/utils");
18
18
 
19
19
  var _pluginFactory = require("../pm-plugins/plugin-factory");
20
20
 
21
- // import { flatmap, mapSlice } from '@atlaskit/editor-core/src/utils/slice';
22
21
  // lifts up the content of each cell, returning an array of nodes
23
22
  var unwrapContentFromTable = function unwrapContentFromTable(maybeTable) {
24
23
  var schema = maybeTable.type.schema;
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "0.0.10"
3
+ "version": "0.1.0"
4
4
  }
@@ -37,13 +37,13 @@ export const hoverMergedCells = () => createCommand(state => {
37
37
  };
38
38
  }, tr => tr.setMeta('addToHistory', false));
39
39
  export const hoverColumns = (hoveredColumns, isInDanger) => createCommand(state => {
40
- const cells = getCellsInColumn(hoveredColumns)(state.selection);
40
+ const cells = getCellsInColumn(hoveredColumns)(state.tr.selection);
41
41
 
42
42
  if (!cells) {
43
43
  return false;
44
44
  }
45
45
 
46
- const decorations = createControlsHoverDecoration(cells, 'column', isInDanger);
46
+ const decorations = createControlsHoverDecoration(cells, 'column', state.tr, isInDanger);
47
47
  return {
48
48
  type: 'HOVER_COLUMNS',
49
49
  data: {
@@ -60,7 +60,7 @@ export const hoverRows = (hoveredRows, isInDanger) => createCommand(state => {
60
60
  return false;
61
61
  }
62
62
 
63
- const decorations = createControlsHoverDecoration(cells, 'row', isInDanger);
63
+ const decorations = createControlsHoverDecoration(cells, 'row', state.tr, isInDanger);
64
64
  return {
65
65
  type: 'HOVER_ROWS',
66
66
  data: {
@@ -86,7 +86,7 @@ export const hoverTable = (isInDanger, isSelected) => createCommand(state => {
86
86
  return false;
87
87
  }
88
88
 
89
- const decorations = createControlsHoverDecoration(cells, 'table', isInDanger, isSelected);
89
+ const decorations = createControlsHoverDecoration(cells, 'table', state.tr, isInDanger, isSelected);
90
90
  return {
91
91
  type: 'HOVER_TABLE',
92
92
  data: {
@@ -44,7 +44,7 @@ export const emptyMultipleCellsWithAnalytics = editorAnalyticsAPI => (inputMetho
44
44
  eventType: EVENT_TYPE.TRACK
45
45
  };
46
46
  })(editorAnalyticsAPI)(clearMultipleCells(targetCellPosition));
47
- export const mergeCellsWithAnalytics = editorAnalyticsAPI => withEditorAnalyticsAPI(({
47
+ export const mergeCellsWithAnalytics = editorAnalyticsAPI => inputMethod => withEditorAnalyticsAPI(({
48
48
  selection
49
49
  }) => {
50
50
  const {
@@ -59,8 +59,7 @@ export const mergeCellsWithAnalytics = editorAnalyticsAPI => withEditorAnalytics
59
59
  actionSubject: ACTION_SUBJECT.TABLE,
60
60
  actionSubjectId: null,
61
61
  attributes: {
62
- inputMethod: INPUT_METHOD.CONTEXT_MENU,
63
- // TODO: merge with floating toolbar once command is updated
62
+ inputMethod,
64
63
  horizontalCells,
65
64
  verticalCells,
66
65
  totalCells,
@@ -76,7 +75,7 @@ export const mergeCellsWithAnalytics = editorAnalyticsAPI => withEditorAnalytics
76
75
 
77
76
  return true;
78
77
  });
79
- export const splitCellWithAnalytics = editorAnalyticsAPI => withEditorAnalyticsAPI(({
78
+ export const splitCellWithAnalytics = editorAnalyticsAPI => inputMethod => withEditorAnalyticsAPI(({
80
79
  selection
81
80
  }) => {
82
81
  const {
@@ -95,8 +94,7 @@ export const splitCellWithAnalytics = editorAnalyticsAPI => withEditorAnalyticsA
95
94
  actionSubject: ACTION_SUBJECT.TABLE,
96
95
  actionSubjectId: null,
97
96
  attributes: {
98
- inputMethod: INPUT_METHOD.CONTEXT_MENU,
99
- // TODO: merge with floating toolbar once command is updated
97
+ inputMethod,
100
98
  horizontalCells,
101
99
  verticalCells,
102
100
  totalCells: horizontalCells * verticalCells,
@@ -109,7 +107,7 @@ export const splitCellWithAnalytics = editorAnalyticsAPI => withEditorAnalyticsA
109
107
 
110
108
  return;
111
109
  })(editorAnalyticsAPI)(splitCell);
112
- export const setColorWithAnalytics = editorAnalyticsAPI => (cellColor, targetCellPosition) => withEditorAnalyticsAPI(({
110
+ export const setColorWithAnalytics = editorAnalyticsAPI => (inputMethod, cellColor, targetCellPosition) => withEditorAnalyticsAPI(({
113
111
  selection
114
112
  }) => {
115
113
  const {
@@ -124,8 +122,7 @@ export const setColorWithAnalytics = editorAnalyticsAPI => (cellColor, targetCel
124
122
  actionSubject: ACTION_SUBJECT.TABLE,
125
123
  actionSubjectId: null,
126
124
  attributes: {
127
- inputMethod: INPUT_METHOD.CONTEXT_MENU,
128
- // TODO: merge with floating toolbar once command is updated
125
+ inputMethod,
129
126
  cellColor: (tableBackgroundColorPalette.get(cellColor.toLowerCase()) || cellColor).toLowerCase(),
130
127
  horizontalCells,
131
128
  verticalCells,
@@ -3,8 +3,7 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
3
3
  import { TableMap } from '@atlaskit/editor-tables/table-map';
4
4
  import { cellAround, findCellRectClosestToPos, findTable, getSelectionRect, removeTable } from '@atlaskit/editor-tables/utils';
5
5
  import { browser } from '@atlaskit/editor-common/utils';
6
- import { isElementInTableCell, isLastItemMediaGroup, setNodeSelection } from '@atlaskit/editor-common/utils'; // import { closestElement } from '@atlaskit/editor-core/src/utils/dom';
7
-
6
+ import { isElementInTableCell, isLastItemMediaGroup, setNodeSelection } from '@atlaskit/editor-common/utils';
8
7
  import { closestElement } from '@atlaskit/editor-common/utils';
9
8
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
10
9
  import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverColumns, selectColumn, setEditorFocus, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from './commands';
@@ -1,7 +1,6 @@
1
1
  // #region Imports
2
2
  import { findParentNodeOfType } from 'prosemirror-utils';
3
- import { findTable } from '@atlaskit/editor-tables/utils'; // import { isTextInput } from '../../utils/is-text-input';
4
-
3
+ import { findTable } from '@atlaskit/editor-tables/utils';
5
4
  import { isTextInput } from '@atlaskit/editor-common/utils';
6
5
  import { isTableCollapsible } from './utils/collapse';
7
6
  import { defaultTableSelection } from './pm-plugins/default-table-selection';