@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.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/plugins/table/commands/clear.js +4 -16
- package/dist/cjs/plugins/table/commands/collapse.js +0 -6
- package/dist/cjs/plugins/table/commands/go-to-next-cell.js +7 -18
- package/dist/cjs/plugins/table/commands/hover.js +7 -37
- package/dist/cjs/plugins/table/commands/index.js +0 -8
- package/dist/cjs/plugins/table/commands/insert.js +17 -56
- package/dist/cjs/plugins/table/commands/misc.js +36 -132
- package/dist/cjs/plugins/table/commands/referentiality.js +0 -4
- package/dist/cjs/plugins/table/commands/selection.js +21 -87
- package/dist/cjs/plugins/table/commands/sort.js +2 -23
- package/dist/cjs/plugins/table/commands/split-cell.js +3 -11
- package/dist/cjs/plugins/table/commands/toggle.js +8 -34
- package/dist/cjs/plugins/table/commands-with-analytics.js +50 -139
- package/dist/cjs/plugins/table/create-plugin-config.js +0 -6
- package/dist/cjs/plugins/table/event-handlers.js +58 -160
- package/dist/cjs/plugins/table/handlers.js +10 -39
- package/dist/cjs/plugins/table/index.js +47 -91
- package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -41
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +82 -188
- package/dist/cjs/plugins/table/nodeviews/table.js +12 -70
- package/dist/cjs/plugins/table/nodeviews/tableCell.js +15 -39
- package/dist/cjs/plugins/table/nodeviews/update-overflow-shadows.js +3 -15
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +0 -18
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -27
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-resizing.js +8 -20
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +1 -3
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/index.js +0 -3
- package/dist/cjs/plugins/table/pm-plugins/keymap.js +2 -15
- package/dist/cjs/plugins/table/pm-plugins/main.js +20 -72
- package/dist/cjs/plugins/table/pm-plugins/plugin-factory.js +25 -42
- package/dist/cjs/plugins/table/pm-plugins/plugin-key.js +0 -2
- package/dist/cjs/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -8
- package/dist/cjs/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +4 -23
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/commands.js +0 -5
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/index.js +0 -5
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -13
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +56 -138
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-key.js +0 -2
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-state.js +15 -30
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +0 -6
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/util.js +0 -5
- package/dist/cjs/plugins/table/pm-plugins/table-local-id.js +13 -44
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/commands.js +12 -42
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +16 -52
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/index.js +0 -4
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-factory.js +0 -10
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-key.js +0 -2
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin.js +5 -19
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/reducer.js +0 -10
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +0 -15
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -28
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/content-width.js +3 -23
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +4 -46
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/index.js +0 -9
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +15 -36
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-column.js +1 -4
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +15 -71
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +34 -82
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +12 -36
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.js +0 -2
- package/dist/cjs/plugins/table/pm-plugins/table-selection-keymap.js +0 -5
- package/dist/cjs/plugins/table/reducer.js +0 -24
- package/dist/cjs/plugins/table/toolbar.js +14 -94
- package/dist/cjs/plugins/table/transforms/column-width.js +12 -45
- package/dist/cjs/plugins/table/transforms/delete-columns.js +11 -76
- package/dist/cjs/plugins/table/transforms/delete-rows.js +4 -42
- package/dist/cjs/plugins/table/transforms/fix-tables.js +24 -61
- package/dist/cjs/plugins/table/transforms/index.js +0 -7
- package/dist/cjs/plugins/table/transforms/merge.js +14 -90
- package/dist/cjs/plugins/table/transforms/metadata.js +0 -5
- package/dist/cjs/plugins/table/transforms/replace-table.js +2 -13
- package/dist/cjs/plugins/table/transforms/split.js +18 -32
- package/dist/cjs/plugins/table/types.js +0 -11
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +10 -51
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/styles.js +0 -12
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +46 -145
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +12 -35
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/styles.js +0 -11
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +5 -12
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +3 -16
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +19 -89
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +6 -31
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +5 -22
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +25 -80
- package/dist/cjs/plugins/table/ui/LayoutButton/index.js +16 -64
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +14 -47
- package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +20 -48
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/index.js +10 -43
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +33 -74
- package/dist/cjs/plugins/table/ui/common-styles.js +6 -19
- package/dist/cjs/plugins/table/ui/consts.js +3 -8
- package/dist/cjs/plugins/table/ui/messages.js +0 -3
- package/dist/cjs/plugins/table/ui/ui-styles.js +0 -32
- package/dist/cjs/plugins/table/utils/analytics.js +4 -19
- package/dist/cjs/plugins/table/utils/collapse.js +4 -21
- package/dist/cjs/plugins/table/utils/column-controls.js +25 -61
- package/dist/cjs/plugins/table/utils/decoration.js +46 -114
- package/dist/cjs/plugins/table/utils/dom.js +4 -51
- package/dist/cjs/plugins/table/utils/get-allow-add-column-custom-step.js +0 -2
- package/dist/cjs/plugins/table/utils/index.js +0 -10
- package/dist/cjs/plugins/table/utils/nodes.js +5 -48
- package/dist/cjs/plugins/table/utils/paste.js +22 -47
- package/dist/cjs/plugins/table/utils/row-controls.js +6 -67
- package/dist/cjs/plugins/table/utils/selection.js +3 -36
- package/dist/cjs/plugins/table/utils/table.js +0 -11
- package/dist/cjs/plugins/table/utils/update-plugin-state-decorations.js +0 -4
- package/dist/cjs/plugins/table-plugin.js +0 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/commands/clear.js +3 -8
- package/dist/es2019/plugins/table/commands/collapse.js +0 -3
- package/dist/es2019/plugins/table/commands/go-to-next-cell.js +4 -7
- package/dist/es2019/plugins/table/commands/hover.js +7 -17
- package/dist/es2019/plugins/table/commands/insert.js +16 -36
- package/dist/es2019/plugins/table/commands/misc.js +37 -67
- package/dist/es2019/plugins/table/commands/selection.js +7 -62
- package/dist/es2019/plugins/table/commands/sort.js +0 -12
- package/dist/es2019/plugins/table/commands/split-cell.js +0 -4
- package/dist/es2019/plugins/table/commands/toggle.js +13 -15
- package/dist/es2019/plugins/table/commands-with-analytics.js +4 -14
- package/dist/es2019/plugins/table/event-handlers.js +14 -62
- package/dist/es2019/plugins/table/handlers.js +16 -26
- package/dist/es2019/plugins/table/index.js +12 -25
- package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -40
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +27 -100
- package/dist/es2019/plugins/table/nodeviews/table.js +3 -33
- package/dist/es2019/plugins/table/nodeviews/tableCell.js +7 -16
- package/dist/es2019/plugins/table/nodeviews/update-overflow-shadows.js +3 -10
- package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +0 -5
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +4 -13
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-resizing.js +0 -3
- package/dist/es2019/plugins/table/pm-plugins/keymap.js +2 -3
- package/dist/es2019/plugins/table/pm-plugins/main.js +19 -43
- package/dist/es2019/plugins/table/pm-plugins/plugin-factory.js +2 -6
- package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -3
- package/dist/es2019/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +0 -12
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -9
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +55 -130
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin-state.js +2 -9
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/util.js +0 -3
- package/dist/es2019/plugins/table/pm-plugins/table-local-id.js +20 -39
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/commands.js +7 -15
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +9 -27
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin-factory.js +2 -4
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin.js +2 -5
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/reducer.js +8 -8
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +0 -4
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -11
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/content-width.js +4 -21
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -22
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +10 -18
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +29 -59
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +54 -51
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +9 -14
- package/dist/es2019/plugins/table/reducer.js +26 -30
- package/dist/es2019/plugins/table/toolbar.js +5 -48
- package/dist/es2019/plugins/table/transforms/column-width.js +16 -28
- package/dist/es2019/plugins/table/transforms/delete-columns.js +17 -58
- package/dist/es2019/plugins/table/transforms/delete-rows.js +8 -25
- package/dist/es2019/plugins/table/transforms/fix-tables.js +25 -42
- package/dist/es2019/plugins/table/transforms/merge.js +22 -70
- package/dist/es2019/plugins/table/transforms/metadata.js +3 -2
- package/dist/es2019/plugins/table/transforms/replace-table.js +0 -2
- package/dist/es2019/plugins/table/transforms/split.js +16 -19
- package/dist/es2019/plugins/table/types.js +2 -4
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +2 -16
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +8 -54
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +4 -13
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +0 -2
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +2 -11
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +13 -49
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/InsertButton.js +0 -8
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +16 -24
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +3 -31
- package/dist/es2019/plugins/table/ui/LayoutButton/index.js +2 -29
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +0 -12
- package/dist/es2019/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +6 -12
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/index.js +0 -9
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +4 -19
- package/dist/es2019/plugins/table/ui/common-styles.js +6 -5
- package/dist/es2019/plugins/table/ui/consts.js +4 -3
- package/dist/es2019/plugins/table/ui/ui-styles.js +0 -10
- package/dist/es2019/plugins/table/utils/analytics.js +0 -8
- package/dist/es2019/plugins/table/utils/collapse.js +3 -14
- package/dist/es2019/plugins/table/utils/column-controls.js +22 -37
- package/dist/es2019/plugins/table/utils/decoration.js +13 -51
- package/dist/es2019/plugins/table/utils/dom.js +3 -19
- package/dist/es2019/plugins/table/utils/nodes.js +2 -15
- package/dist/es2019/plugins/table/utils/paste.js +17 -22
- package/dist/es2019/plugins/table/utils/row-controls.js +12 -45
- package/dist/es2019/plugins/table/utils/selection.js +0 -21
- package/dist/es2019/plugins/table/utils/table.js +0 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/commands/clear.js +3 -8
- package/dist/esm/plugins/table/commands/collapse.js +0 -3
- package/dist/esm/plugins/table/commands/go-to-next-cell.js +6 -9
- package/dist/esm/plugins/table/commands/hover.js +8 -18
- package/dist/esm/plugins/table/commands/insert.js +16 -36
- package/dist/esm/plugins/table/commands/misc.js +39 -78
- package/dist/esm/plugins/table/commands/selection.js +21 -78
- package/dist/esm/plugins/table/commands/sort.js +2 -14
- package/dist/esm/plugins/table/commands/split-cell.js +3 -8
- package/dist/esm/plugins/table/commands/toggle.js +11 -20
- package/dist/esm/plugins/table/commands-with-analytics.js +50 -85
- package/dist/esm/plugins/table/create-plugin-config.js +0 -3
- package/dist/esm/plugins/table/event-handlers.js +58 -123
- package/dist/esm/plugins/table/handlers.js +11 -29
- package/dist/esm/plugins/table/index.js +47 -60
- package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -44
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +82 -181
- package/dist/esm/plugins/table/nodeviews/table.js +12 -52
- package/dist/esm/plugins/table/nodeviews/tableCell.js +15 -33
- package/dist/esm/plugins/table/nodeviews/update-overflow-shadows.js +3 -10
- package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +0 -5
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -19
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-resizing.js +8 -13
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/keymap.js +2 -3
- package/dist/esm/plugins/table/pm-plugins/main.js +20 -47
- package/dist/esm/plugins/table/pm-plugins/plugin-factory.js +25 -37
- package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -3
- package/dist/esm/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +3 -15
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -9
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +58 -147
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin-state.js +15 -27
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/util.js +0 -3
- package/dist/esm/plugins/table/pm-plugins/table-local-id.js +14 -37
- package/dist/esm/plugins/table/pm-plugins/table-resizing/commands.js +12 -24
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +16 -36
- package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin-factory.js +0 -6
- package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin.js +5 -8
- package/dist/esm/plugins/table/pm-plugins/table-resizing/reducer.js +0 -7
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +0 -4
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -12
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/content-width.js +5 -22
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/dom.js +4 -23
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +15 -23
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +15 -60
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +34 -55
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +12 -24
- package/dist/esm/plugins/table/reducer.js +0 -20
- package/dist/esm/plugins/table/toolbar.js +13 -63
- package/dist/esm/plugins/table/transforms/column-width.js +12 -32
- package/dist/esm/plugins/table/transforms/delete-columns.js +11 -62
- package/dist/esm/plugins/table/transforms/delete-rows.js +4 -30
- package/dist/esm/plugins/table/transforms/fix-tables.js +24 -49
- package/dist/esm/plugins/table/transforms/merge.js +16 -75
- package/dist/esm/plugins/table/transforms/metadata.js +3 -2
- package/dist/esm/plugins/table/transforms/replace-table.js +2 -6
- package/dist/esm/plugins/table/transforms/split.js +18 -29
- package/dist/esm/plugins/table/types.js +0 -6
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +10 -31
- package/dist/esm/plugins/table/ui/FloatingContextualButton/styles.js +0 -2
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +46 -126
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +13 -24
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/styles.js +0 -2
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +5 -7
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +3 -13
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +19 -68
- package/dist/esm/plugins/table/ui/FloatingInsertButton/InsertButton.js +6 -14
- package/dist/esm/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +5 -18
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +25 -57
- package/dist/esm/plugins/table/ui/LayoutButton/index.js +16 -47
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +14 -35
- package/dist/esm/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +20 -38
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/index.js +10 -29
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +33 -62
- package/dist/esm/plugins/table/ui/common-styles.js +6 -7
- package/dist/esm/plugins/table/ui/consts.js +4 -3
- package/dist/esm/plugins/table/ui/ui-styles.js +0 -12
- package/dist/esm/plugins/table/utils/analytics.js +4 -13
- package/dist/esm/plugins/table/utils/collapse.js +4 -15
- package/dist/esm/plugins/table/utils/column-controls.js +25 -41
- package/dist/esm/plugins/table/utils/decoration.js +46 -88
- package/dist/esm/plugins/table/utils/dom.js +4 -20
- package/dist/esm/plugins/table/utils/nodes.js +5 -18
- package/dist/esm/plugins/table/utils/paste.js +24 -29
- package/dist/esm/plugins/table/utils/row-controls.js +6 -46
- package/dist/esm/plugins/table/utils/selection.js +3 -26
- package/dist/esm/plugins/table/utils/table.js +0 -2
- package/dist/esm/version.json +1 -1
- package/package.json +2 -2
- package/src/__tests__/visual-regression/cell-options-menu.ts +1 -12
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
|
|
5
4
|
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; }
|
|
6
|
-
|
|
7
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
-
|
|
9
6
|
import { Fragment } from 'prosemirror-model';
|
|
10
7
|
import { Selection } from 'prosemirror-state';
|
|
11
8
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
12
9
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
13
10
|
import { findTable, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
14
|
-
import { setMeta } from './metadata';
|
|
11
|
+
import { setMeta } from './metadata';
|
|
15
12
|
|
|
13
|
+
// re-creates table node with merged cells
|
|
16
14
|
export function mergeCells(tr) {
|
|
17
15
|
var selection = tr.selection;
|
|
18
|
-
|
|
19
16
|
if (!(selection instanceof CellSelection) || !canMergeCells(tr)) {
|
|
20
17
|
return tr;
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
var rect = getSelectionRect(selection);
|
|
24
20
|
var table = findTable(selection);
|
|
25
21
|
var map = TableMap.get(table.node);
|
|
@@ -27,52 +23,43 @@ export function mergeCells(tr) {
|
|
|
27
23
|
var selectedCells = map.cellsInRect(rect);
|
|
28
24
|
var mergedCellPos;
|
|
29
25
|
var rows = [];
|
|
30
|
-
|
|
31
26
|
for (var rowIndex = 0; rowIndex < map.height; rowIndex++) {
|
|
32
27
|
var rowCells = [];
|
|
33
28
|
var row = table.node.child(rowIndex);
|
|
34
|
-
|
|
35
29
|
for (var colIndex = 0; colIndex < map.width; colIndex++) {
|
|
36
30
|
var cellPos = map.map[rowIndex * map.width + colIndex];
|
|
37
31
|
var cell = table.node.nodeAt(cellPos);
|
|
38
|
-
|
|
39
32
|
if (!cell || seen.indexOf(cellPos) > -1) {
|
|
40
33
|
continue;
|
|
41
34
|
}
|
|
35
|
+
seen.push(cellPos);
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
// merged cell
|
|
45
38
|
if (colIndex === rect.left && rowIndex === rect.top) {
|
|
46
|
-
mergedCellPos = cellPos;
|
|
47
|
-
|
|
39
|
+
mergedCellPos = cellPos;
|
|
40
|
+
// merge content of the selected cells, dropping empty cells
|
|
48
41
|
var content = isEmptyCell(cell) ? Fragment.empty : cell.content;
|
|
49
42
|
var seenContent = [mergedCellPos];
|
|
50
|
-
|
|
51
43
|
for (var i = rect.top; i < rect.bottom; i++) {
|
|
52
44
|
for (var j = rect.left; j < rect.right; j++) {
|
|
53
45
|
var pos = map.map[i * map.width + j];
|
|
54
|
-
|
|
55
46
|
if (seenContent.indexOf(pos) === -1) {
|
|
56
47
|
seenContent.push(pos);
|
|
57
48
|
var copyCell = table.node.nodeAt(pos);
|
|
58
|
-
|
|
59
49
|
if (copyCell && !isEmptyCell(copyCell)) {
|
|
60
50
|
content = content.append(copyCell.content);
|
|
61
51
|
}
|
|
62
52
|
}
|
|
63
53
|
}
|
|
64
54
|
}
|
|
65
|
-
|
|
66
55
|
var rowspan = rect.bottom - rect.top;
|
|
67
|
-
|
|
68
56
|
if (rowspan < 1) {
|
|
69
57
|
return setMeta({
|
|
70
58
|
type: 'MERGE_CELLS',
|
|
71
59
|
problem: 'NEGATIVE_ROWSPAN'
|
|
72
60
|
})(tr);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
61
|
+
}
|
|
62
|
+
// update colspan and rowspan of the merged cell to span the selection
|
|
76
63
|
var attrs = addColSpan(_objectSpread(_objectSpread({}, cell.attrs), {}, {
|
|
77
64
|
rowspan: rowspan
|
|
78
65
|
}), cell.attrs.colspan, rect.right - rect.left - cell.attrs.colspan);
|
|
@@ -84,7 +71,6 @@ export function mergeCells(tr) {
|
|
|
84
71
|
rowCells.push(cell);
|
|
85
72
|
}
|
|
86
73
|
}
|
|
87
|
-
|
|
88
74
|
if (rowCells.length) {
|
|
89
75
|
rows.push(row.type.createChecked(row.attrs, rowCells, row.marks));
|
|
90
76
|
} else {
|
|
@@ -93,22 +79,17 @@ export function mergeCells(tr) {
|
|
|
93
79
|
var prevRow = rows[_i];
|
|
94
80
|
var cells = [];
|
|
95
81
|
var rowChanged = false;
|
|
96
|
-
|
|
97
82
|
for (var _j = 0; _j < prevRow.childCount; _j++) {
|
|
98
83
|
var _cell = prevRow.child(_j);
|
|
99
|
-
|
|
100
84
|
var _rowspan = _cell.attrs.rowspan;
|
|
101
|
-
|
|
102
85
|
if (_rowspan && _rowspan + _i - 1 >= rows.length) {
|
|
103
86
|
rowChanged = true;
|
|
104
|
-
|
|
105
87
|
if (_rowspan < 2) {
|
|
106
88
|
return setMeta({
|
|
107
89
|
type: 'MERGE_CELLS',
|
|
108
90
|
problem: 'NEGATIVE_ROWSPAN'
|
|
109
91
|
})(tr);
|
|
110
92
|
}
|
|
111
|
-
|
|
112
93
|
cells.push(_cell.type.createChecked(_objectSpread(_objectSpread({}, _cell.attrs), {}, {
|
|
113
94
|
rowspan: _rowspan - 1
|
|
114
95
|
}), _cell.content, _cell.marks));
|
|
@@ -116,117 +97,94 @@ export function mergeCells(tr) {
|
|
|
116
97
|
cells.push(_cell);
|
|
117
98
|
}
|
|
118
99
|
}
|
|
119
|
-
|
|
120
100
|
if (rowChanged) {
|
|
121
101
|
rows[_i] = row.type.createChecked(prevRow.attrs, cells, prevRow.marks);
|
|
122
102
|
}
|
|
123
103
|
}
|
|
124
104
|
}
|
|
125
|
-
}
|
|
126
|
-
|
|
105
|
+
}
|
|
127
106
|
|
|
107
|
+
// empty tables? cancel merging like nothing happened
|
|
128
108
|
if (!rows.length) {
|
|
129
109
|
return setMeta({
|
|
130
110
|
type: 'MERGE_CELLS',
|
|
131
111
|
problem: 'EMPTY_TABLE'
|
|
132
112
|
})(tr);
|
|
133
113
|
}
|
|
134
|
-
|
|
135
114
|
var newTable = table.node.type.createChecked(table.node.attrs, rows, table.node.marks);
|
|
136
115
|
var fixedTable = removeEmptyColumns(newTable);
|
|
137
|
-
|
|
138
116
|
if (fixedTable === null) {
|
|
139
117
|
return setMeta({
|
|
140
118
|
type: 'MERGE_CELLS',
|
|
141
119
|
problem: 'REMOVE_EMPTY_COLUMNS'
|
|
142
120
|
})(tr);
|
|
143
121
|
}
|
|
144
|
-
|
|
145
122
|
return setMeta({
|
|
146
123
|
type: 'MERGE_CELLS'
|
|
147
124
|
})(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable).setSelection(Selection.near(tr.doc.resolve((mergedCellPos || 0) + table.start))));
|
|
148
125
|
}
|
|
149
126
|
export function canMergeCells(tr) {
|
|
150
127
|
var selection = tr.selection;
|
|
151
|
-
|
|
152
128
|
if (!(selection instanceof CellSelection) || selection.$anchorCell.pos === selection.$headCell.pos) {
|
|
153
129
|
return false;
|
|
154
130
|
}
|
|
155
|
-
|
|
156
131
|
var rect = getSelectionRect(selection);
|
|
157
|
-
|
|
158
132
|
if (!rect) {
|
|
159
133
|
return false;
|
|
160
134
|
}
|
|
161
|
-
|
|
162
135
|
var table = selection.$anchorCell.node(-1);
|
|
163
136
|
var map = TableMap.get(table);
|
|
164
|
-
|
|
165
137
|
if (cellsOverlapRectangle(map, rect)) {
|
|
166
138
|
return false;
|
|
167
139
|
}
|
|
168
|
-
|
|
169
140
|
return true;
|
|
170
141
|
}
|
|
171
|
-
|
|
172
142
|
function isEmptyCell(cell) {
|
|
173
143
|
var content = cell.content;
|
|
174
144
|
return content.childCount === 1 && content.firstChild && content.firstChild.isTextblock && content.firstChild.childCount === 0;
|
|
175
145
|
}
|
|
176
|
-
|
|
177
146
|
function addColSpan(attrs, pos) {
|
|
178
147
|
var span = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
179
|
-
|
|
180
148
|
var newAttrs = _objectSpread(_objectSpread({}, attrs), {}, {
|
|
181
149
|
colspan: (attrs.colspan || 1) + span
|
|
182
150
|
});
|
|
183
|
-
|
|
184
151
|
if (newAttrs.colwidth) {
|
|
185
152
|
newAttrs.colwidth = newAttrs.colwidth.slice();
|
|
186
|
-
|
|
187
153
|
for (var i = 0; i < span; i++) {
|
|
188
154
|
newAttrs.colwidth.splice(pos, 0, 0);
|
|
189
155
|
}
|
|
190
156
|
}
|
|
191
|
-
|
|
192
157
|
return newAttrs;
|
|
193
158
|
}
|
|
194
|
-
|
|
195
159
|
function cellsOverlapRectangle(_ref, rect) {
|
|
196
160
|
var width = _ref.width,
|
|
197
|
-
|
|
198
|
-
|
|
161
|
+
height = _ref.height,
|
|
162
|
+
map = _ref.map;
|
|
199
163
|
var indexTop = rect.top * width + rect.left;
|
|
200
164
|
var indexLeft = indexTop;
|
|
201
165
|
var indexBottom = (rect.bottom - 1) * width + rect.left;
|
|
202
166
|
var indexRight = indexTop + (rect.right - rect.left - 1);
|
|
203
|
-
|
|
204
167
|
for (var i = rect.top; i < rect.bottom; i++) {
|
|
205
168
|
if (rect.left > 0 && map[indexLeft] === map[indexLeft - 1] || rect.right < width && map[indexRight] === map[indexRight + 1]) {
|
|
206
169
|
return true;
|
|
207
170
|
}
|
|
208
|
-
|
|
209
171
|
indexLeft += width;
|
|
210
172
|
indexRight += width;
|
|
211
173
|
}
|
|
212
|
-
|
|
213
174
|
for (var _i2 = rect.left; _i2 < rect.right; _i2++) {
|
|
214
175
|
if (rect.top > 0 && map[indexTop] === map[indexTop - width] || rect.bottom < height && map[indexBottom] === map[indexBottom + width]) {
|
|
215
176
|
return true;
|
|
216
177
|
}
|
|
217
|
-
|
|
218
178
|
indexTop++;
|
|
219
179
|
indexBottom++;
|
|
220
180
|
}
|
|
221
|
-
|
|
222
181
|
return false;
|
|
223
|
-
}
|
|
224
|
-
|
|
182
|
+
}
|
|
225
183
|
|
|
184
|
+
// returns an array of numbers, each number indicates the minimum colSpan in each column
|
|
226
185
|
function getMinColSpans(table) {
|
|
227
186
|
var map = TableMap.get(table);
|
|
228
187
|
var minColspans = [];
|
|
229
|
-
|
|
230
188
|
for (var colIndex = map.width - 1; colIndex >= 0; colIndex--) {
|
|
231
189
|
var cellsPositions = map.cellsInRect({
|
|
232
190
|
left: colIndex,
|
|
@@ -234,17 +192,15 @@ function getMinColSpans(table) {
|
|
|
234
192
|
top: 0,
|
|
235
193
|
bottom: map.height
|
|
236
194
|
});
|
|
237
|
-
|
|
238
195
|
if (cellsPositions.length) {
|
|
239
196
|
var colspans = cellsPositions.map(function (cellPos) {
|
|
240
197
|
var cell = table.nodeAt(cellPos);
|
|
241
|
-
|
|
242
198
|
if (cell) {
|
|
243
199
|
return cell.attrs.colspan;
|
|
244
200
|
}
|
|
245
201
|
});
|
|
246
|
-
var minColspan = Math.min.apply(Math, _toConsumableArray(colspans));
|
|
247
|
-
|
|
202
|
+
var minColspan = Math.min.apply(Math, _toConsumableArray(colspans));
|
|
203
|
+
// only care about the case when the next column is invisible
|
|
248
204
|
if (!minColspans[colIndex + 1]) {
|
|
249
205
|
minColspans[colIndex] = minColspan;
|
|
250
206
|
} else {
|
|
@@ -252,42 +208,33 @@ function getMinColSpans(table) {
|
|
|
252
208
|
}
|
|
253
209
|
}
|
|
254
210
|
}
|
|
255
|
-
|
|
256
211
|
return minColspans;
|
|
257
212
|
}
|
|
258
|
-
|
|
259
213
|
export function removeEmptyColumns(table) {
|
|
260
214
|
var map = TableMap.get(table);
|
|
261
215
|
var minColSpans = getMinColSpans(table);
|
|
262
|
-
|
|
263
216
|
if (!minColSpans.some(function (colspan) {
|
|
264
217
|
return colspan > 1;
|
|
265
218
|
})) {
|
|
266
219
|
return table;
|
|
267
220
|
}
|
|
268
|
-
|
|
269
221
|
var rows = [];
|
|
270
|
-
|
|
271
222
|
var _loop = function _loop(rowIndex) {
|
|
272
223
|
var cellsByCols = {};
|
|
273
224
|
var cols = Object.keys(minColSpans).map(Number);
|
|
274
|
-
|
|
275
225
|
for (var idx in cols) {
|
|
276
226
|
var colIndex = cols[idx];
|
|
277
227
|
var cellPos = map.map[colIndex + rowIndex * map.width];
|
|
278
228
|
var rect = map.findCell(cellPos);
|
|
279
229
|
var cell = cellsByCols[rect.left] || table.nodeAt(cellPos);
|
|
280
|
-
|
|
281
230
|
if (cell && rect.top === rowIndex) {
|
|
282
231
|
if (minColSpans[colIndex] > 1) {
|
|
283
232
|
var colspan = cell.attrs.colspan - minColSpans[colIndex] + 1;
|
|
284
|
-
|
|
285
233
|
if (colspan < 1) {
|
|
286
234
|
return {
|
|
287
235
|
v: null
|
|
288
236
|
};
|
|
289
237
|
}
|
|
290
|
-
|
|
291
238
|
var colwidth = cell.attrs.colwidth;
|
|
292
239
|
var newCell = cell.type.createChecked(_objectSpread(_objectSpread({}, cell.attrs), {}, {
|
|
293
240
|
colspan: colspan,
|
|
@@ -299,26 +246,20 @@ export function removeEmptyColumns(table) {
|
|
|
299
246
|
}
|
|
300
247
|
}
|
|
301
248
|
}
|
|
302
|
-
|
|
303
249
|
var rowCells = Object.keys(cellsByCols).map(function (col) {
|
|
304
250
|
return cellsByCols[col];
|
|
305
251
|
});
|
|
306
252
|
var row = table.child(rowIndex);
|
|
307
|
-
|
|
308
253
|
if (row) {
|
|
309
254
|
rows.push(row.type.createChecked(row.attrs, rowCells, row.marks));
|
|
310
255
|
}
|
|
311
256
|
};
|
|
312
|
-
|
|
313
257
|
for (var rowIndex = 0; rowIndex < map.height; rowIndex++) {
|
|
314
258
|
var _ret = _loop(rowIndex);
|
|
315
|
-
|
|
316
259
|
if (_typeof(_ret) === "object") return _ret.v;
|
|
317
260
|
}
|
|
318
|
-
|
|
319
261
|
if (!rows.length) {
|
|
320
262
|
return null;
|
|
321
263
|
}
|
|
322
|
-
|
|
323
264
|
return table.type.createChecked(table.attrs, rows, table.marks);
|
|
324
265
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
2
|
-
import { fireAnalytics } from './fix-tables';
|
|
2
|
+
import { fireAnalytics } from './fix-tables';
|
|
3
|
+
|
|
4
|
+
// Set metadata on a ProseMirror transaction for debugging purposes in Synchrony
|
|
3
5
|
|
|
4
6
|
export var setMeta = function setMeta(meta) {
|
|
5
7
|
return function (tr) {
|
|
@@ -7,7 +9,6 @@ export var setMeta = function setMeta(meta) {
|
|
|
7
9
|
// Send analytics event whenever we encounter with a problem
|
|
8
10
|
fireAnalytics(meta);
|
|
9
11
|
}
|
|
10
|
-
|
|
11
12
|
return tr.setMeta(pluginKey, meta);
|
|
12
13
|
};
|
|
13
14
|
};
|
|
@@ -6,16 +6,13 @@ import { getSelectedTableInfo } from '../utils';
|
|
|
6
6
|
export var replaceSelectedTable = function replaceSelectedTable(state, content, inputMethod, editorAnalyticsAPI) {
|
|
7
7
|
if (isTableSelected(state.selection)) {
|
|
8
8
|
var table = findTable(state.selection);
|
|
9
|
-
|
|
10
9
|
if (table) {
|
|
11
10
|
var slice = typeof content === 'string' ? new Slice(Fragment.from(state.schema.text(content)), 0, 0) : content;
|
|
12
11
|
var tr = state.tr.replace(table.pos, table.pos + table.node.nodeSize, slice);
|
|
13
12
|
tr.setSelection(TextSelection.create(tr.doc, table.pos + slice.size + 1));
|
|
14
|
-
|
|
15
13
|
var _getSelectedTableInfo = getSelectedTableInfo(state.selection),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
totalRowCount = _getSelectedTableInfo.totalRowCount,
|
|
15
|
+
totalColumnCount = _getSelectedTableInfo.totalColumnCount;
|
|
19
16
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
20
17
|
action: TABLE_ACTION.REPLACED,
|
|
21
18
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -29,6 +26,5 @@ export var replaceSelectedTable = function replaceSelectedTable(state, content,
|
|
|
29
26
|
return tr;
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
|
|
33
29
|
return state.tr;
|
|
34
30
|
};
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
4
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
8
|
-
|
|
9
5
|
/**
|
|
10
6
|
* Helper to split all the cells in a range of columns
|
|
11
7
|
* @param tr
|
|
@@ -16,67 +12,60 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
16
12
|
export function splitCellsInColumns(tr, tablePos, columnStart, columnEnd) {
|
|
17
13
|
var mapStart = tr.mapping.maps.length;
|
|
18
14
|
var table = tr.doc.nodeAt(tablePos);
|
|
19
|
-
|
|
20
15
|
if (!table) {
|
|
21
16
|
return tr;
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
var tableStart = tr.doc.resolve(tablePos).start(1);
|
|
25
19
|
var map = TableMap.get(table);
|
|
26
|
-
|
|
27
20
|
for (var column = columnStart; column < columnEnd; column++) {
|
|
28
21
|
for (var rowIndex = 0; rowIndex < map.height; rowIndex++) {
|
|
29
22
|
var cellIndex = rowIndex * map.width + column;
|
|
30
|
-
var cellPos = map.map[cellIndex];
|
|
31
|
-
|
|
32
|
-
var hasMergedCellsBefore = column > 0 && map.map[cellIndex - 1] === cellPos || rowIndex > 0 && map.map[(rowIndex - 1) * map.width + column] === cellPos; // Check if the cell contains another row/column
|
|
23
|
+
var cellPos = map.map[cellIndex];
|
|
33
24
|
|
|
25
|
+
// Check if the cell is contained by another by another row/column
|
|
26
|
+
var hasMergedCellsBefore = column > 0 && map.map[cellIndex - 1] === cellPos || rowIndex > 0 && map.map[(rowIndex - 1) * map.width + column] === cellPos;
|
|
27
|
+
// Check if the cell contains another row/column
|
|
34
28
|
var hasMergedCellsAfter = column < map.width - 1 && map.map[cellIndex + 1] === cellPos || rowIndex < map.height - 1 && map.map[(rowIndex + 1) * map.width + column] === cellPos;
|
|
35
|
-
|
|
36
29
|
if (!hasMergedCellsBefore && hasMergedCellsAfter) {
|
|
37
30
|
// Is a merged cell that start in this row/column
|
|
38
31
|
var cellNode = table.nodeAt(cellPos);
|
|
39
|
-
|
|
40
32
|
if (!cellNode) {
|
|
41
33
|
continue;
|
|
42
34
|
}
|
|
43
|
-
|
|
44
35
|
var _ref = cellNode.attrs,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var mapping = tr.mapping.slice(mapStart);
|
|
51
|
-
|
|
36
|
+
colwidth = _ref.colwidth,
|
|
37
|
+
_ref$colspan = _ref.colspan,
|
|
38
|
+
colspan = _ref$colspan === void 0 ? 1 : _ref$colspan,
|
|
39
|
+
_ref$rowspan = _ref.rowspan,
|
|
40
|
+
rowspan = _ref$rowspan === void 0 ? 1 : _ref$rowspan;
|
|
41
|
+
var mapping = tr.mapping.slice(mapStart);
|
|
42
|
+
|
|
43
|
+
// Update current node with the simple colspan
|
|
52
44
|
var baseAttrs = _objectSpread(_objectSpread({}, cellNode.attrs), {}, {
|
|
53
45
|
colspan: 1,
|
|
54
46
|
rowspan: 1
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
});
|
|
48
|
+
// Add the new cells
|
|
58
49
|
for (var cellRowIndex = rowIndex; cellRowIndex < rowIndex + rowspan; cellRowIndex++) {
|
|
59
50
|
for (var i = 0; i < colspan; i++) {
|
|
60
51
|
var _mapping = tr.mapping.slice(mapStart);
|
|
61
|
-
|
|
62
52
|
var _cellPos = map.positionAt(cellRowIndex, column + i, table);
|
|
63
|
-
|
|
64
53
|
tr.insert(_mapping.map(_cellPos + tableStart), cellNode.type.createAndFill(_objectSpread(_objectSpread({}, baseAttrs), {}, {
|
|
65
54
|
colwidth: colwidth ? [colwidth[i]] : undefined
|
|
66
55
|
})));
|
|
67
56
|
}
|
|
68
|
-
}
|
|
69
|
-
|
|
57
|
+
}
|
|
70
58
|
|
|
59
|
+
// Delete the original cell
|
|
71
60
|
mapping = tr.mapping.slice(mapStart);
|
|
72
|
-
tr.delete(mapping.map(cellPos + tableStart), mapping.map(cellPos + tableStart + cellNode.nodeSize));
|
|
61
|
+
tr.delete(mapping.map(cellPos + tableStart), mapping.map(cellPos + tableStart + cellNode.nodeSize));
|
|
73
62
|
|
|
63
|
+
// Skip rows based on rowspan
|
|
74
64
|
if (rowspan && rowspan > 1) {
|
|
75
65
|
rowIndex += rowspan - 1;
|
|
76
66
|
}
|
|
77
67
|
}
|
|
78
68
|
}
|
|
79
69
|
}
|
|
80
|
-
|
|
81
70
|
return tr;
|
|
82
71
|
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
4
|
import { tableCellSelector, tableHeaderSelector, tablePrefixSelector } from '@atlaskit/adf-schema';
|
|
8
5
|
import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
9
6
|
export var RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
|
|
10
7
|
export var TableDecorations;
|
|
11
|
-
|
|
12
8
|
(function (TableDecorations) {
|
|
13
9
|
TableDecorations["ALL_CONTROLS_HOVER"] = "CONTROLS_HOVER";
|
|
14
10
|
TableDecorations["ROW_CONTROLS_HOVER"] = "ROW_CONTROLS_HOVER";
|
|
@@ -21,7 +17,6 @@ export var TableDecorations;
|
|
|
21
17
|
TableDecorations["COLUMN_RESIZING_HANDLE_LINE"] = "COLUMN_RESIZING_HANDLE_LINE";
|
|
22
18
|
TableDecorations["LAST_CELL_ELEMENT"] = "LAST_CELL_ELEMENT";
|
|
23
19
|
})(TableDecorations || (TableDecorations = {}));
|
|
24
|
-
|
|
25
20
|
export var TableCssClassName = _objectSpread(_objectSpread({}, TableSharedCssClassName), {}, {
|
|
26
21
|
COLUMN_CONTROLS: "".concat(tablePrefixSelector, "-column-controls"),
|
|
27
22
|
COLUMN_CONTROLS_DECORATIONS: "".concat(tablePrefixSelector, "-column-controls-decoration"),
|
|
@@ -84,7 +79,6 @@ export var TableCssClassName = _objectSpread(_objectSpread({}, TableSharedCssCla
|
|
|
84
79
|
WITH_RESIZE_LINE_LAST_COLUMN: "".concat(tablePrefixSelector, "-column-resize-line-last-column")
|
|
85
80
|
});
|
|
86
81
|
export var ShadowEvent;
|
|
87
|
-
|
|
88
82
|
(function (ShadowEvent) {
|
|
89
83
|
ShadowEvent["SHOW_BEFORE_SHADOW"] = "showBeforeShadow";
|
|
90
84
|
ShadowEvent["SHOW_AFTER_SHADOW"] = "showAfterShadow";
|
|
@@ -5,11 +5,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
|
|
11
9
|
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; } }
|
|
12
|
-
|
|
13
10
|
/** @jsx jsx */
|
|
14
11
|
import React from 'react';
|
|
15
12
|
import { jsx } from '@emotion/react';
|
|
@@ -29,58 +26,47 @@ import { tableFloatingCellButtonStyles, tableFloatingCellButtonSelectedStyles }
|
|
|
29
26
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
30
27
|
export var FloatingContextualButtonInner = /*#__PURE__*/function (_React$Component) {
|
|
31
28
|
_inherits(FloatingContextualButtonInner, _React$Component);
|
|
32
|
-
|
|
33
29
|
var _super = _createSuper(FloatingContextualButtonInner);
|
|
34
|
-
|
|
35
30
|
function FloatingContextualButtonInner() {
|
|
36
31
|
var _this;
|
|
37
|
-
|
|
38
32
|
_classCallCheck(this, FloatingContextualButtonInner);
|
|
39
|
-
|
|
40
33
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
41
34
|
args[_key] = arguments[_key];
|
|
42
35
|
}
|
|
43
|
-
|
|
44
36
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
45
|
-
|
|
46
37
|
_defineProperty(_assertThisInitialized(_this), "handleClick", function () {
|
|
47
38
|
var _this$props$editorVie = _this.props.editorView,
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
state = _this$props$editorVie.state,
|
|
40
|
+
dispatch = _this$props$editorVie.dispatch;
|
|
41
|
+
// Clicking outside the dropdown handles toggling the menu closed
|
|
50
42
|
// (otherwise these two toggles combat each other).
|
|
51
43
|
// In the event a user clicks the chevron button again
|
|
52
44
|
// That will count as clicking outside the dropdown and
|
|
53
45
|
// will be toggled appropriately
|
|
54
|
-
|
|
55
46
|
if (!_this.props.isContextualMenuOpen) {
|
|
56
47
|
toggleContextualMenu()(state, dispatch);
|
|
57
48
|
}
|
|
58
49
|
});
|
|
59
|
-
|
|
60
50
|
return _this;
|
|
61
51
|
}
|
|
62
|
-
|
|
63
52
|
_createClass(FloatingContextualButtonInner, [{
|
|
64
53
|
key: "render",
|
|
65
54
|
value: function render() {
|
|
66
55
|
var _this$props = this.props,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
56
|
+
mountPoint = _this$props.mountPoint,
|
|
57
|
+
scrollableElement = _this$props.scrollableElement,
|
|
58
|
+
editorView = _this$props.editorView,
|
|
59
|
+
targetCellPosition = _this$props.targetCellPosition,
|
|
60
|
+
isContextualMenuOpen = _this$props.isContextualMenuOpen,
|
|
61
|
+
formatMessage = _this$props.intl.formatMessage,
|
|
62
|
+
dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent; // : Props & WrappedComponentProps
|
|
75
63
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
76
64
|
var targetCellRef;
|
|
77
|
-
|
|
78
65
|
try {
|
|
79
66
|
targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
|
|
80
67
|
} catch (error) {
|
|
81
68
|
// eslint-disable-next-line no-console
|
|
82
69
|
console.warn(error);
|
|
83
|
-
|
|
84
70
|
if (dispatchAnalyticsEvent) {
|
|
85
71
|
var payload = {
|
|
86
72
|
action: ACTION.ERRORED,
|
|
@@ -100,11 +86,9 @@ export var FloatingContextualButtonInner = /*#__PURE__*/function (_React$Compone
|
|
|
100
86
|
dispatchAnalyticsEvent(payload);
|
|
101
87
|
}
|
|
102
88
|
}
|
|
103
|
-
|
|
104
89
|
if (!targetCellRef || !(targetCellRef instanceof HTMLElement)) {
|
|
105
90
|
return null;
|
|
106
91
|
}
|
|
107
|
-
|
|
108
92
|
var tableWrapper = closestElement(targetCellRef, ".".concat(ClassName.TABLE_NODE_WRAPPER));
|
|
109
93
|
var labelCellOptions = formatMessage(messages.cellOptions);
|
|
110
94
|
var button = jsx("div", {
|
|
@@ -126,7 +110,6 @@ export var FloatingContextualButtonInner = /*#__PURE__*/function (_React$Compone
|
|
|
126
110
|
"aria-label": labelCellOptions
|
|
127
111
|
}));
|
|
128
112
|
var parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
|
|
129
|
-
|
|
130
113
|
if (this.props.stickyHeader && parentSticky) {
|
|
131
114
|
var pos = targetCellRef.getBoundingClientRect();
|
|
132
115
|
return jsx("div", {
|
|
@@ -138,7 +121,6 @@ export var FloatingContextualButtonInner = /*#__PURE__*/function (_React$Compone
|
|
|
138
121
|
}
|
|
139
122
|
}, button);
|
|
140
123
|
}
|
|
141
|
-
|
|
142
124
|
return jsx(Popup, {
|
|
143
125
|
alignX: "right",
|
|
144
126
|
alignY: "start",
|
|
@@ -158,12 +140,9 @@ export var FloatingContextualButtonInner = /*#__PURE__*/function (_React$Compone
|
|
|
158
140
|
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;
|
|
159
141
|
}
|
|
160
142
|
}]);
|
|
161
|
-
|
|
162
143
|
return FloatingContextualButtonInner;
|
|
163
144
|
}(React.Component);
|
|
164
|
-
|
|
165
145
|
_defineProperty(FloatingContextualButtonInner, "displayName", 'FloatingContextualButton');
|
|
166
|
-
|
|
167
146
|
var FloatingContextualButton = injectIntl(FloatingContextualButtonInner);
|
|
168
147
|
export default function (props) {
|
|
169
148
|
return jsx(ErrorBoundary, {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
|
|
3
2
|
var _templateObject, _templateObject2;
|
|
4
|
-
|
|
5
3
|
import { css } from '@emotion/react';
|
|
6
4
|
import { B75, DN0, DN60, N0, N20, N30A, N700 } from '@atlaskit/theme/colors';
|
|
7
5
|
import { borderRadius } from '@atlaskit/theme/constants';
|