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