@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,76 +1,42 @@
|
|
|
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.messages = exports.default = exports.ContextualMenu = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
11
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
22
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
15
|
var _react = require("react");
|
|
25
|
-
|
|
26
16
|
var _react2 = require("@emotion/react");
|
|
27
|
-
|
|
28
17
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
29
|
-
|
|
30
18
|
var _reactIntlNext = require("react-intl-next");
|
|
31
|
-
|
|
32
19
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
33
|
-
|
|
34
20
|
var _uiColor = require("@atlaskit/editor-common/ui-color");
|
|
35
|
-
|
|
36
21
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
37
|
-
|
|
38
22
|
var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
|
|
39
|
-
|
|
40
23
|
var _styles = require("./styles");
|
|
41
|
-
|
|
42
24
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
43
|
-
|
|
44
25
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
45
|
-
|
|
46
26
|
var _commands = require("../../commands");
|
|
47
|
-
|
|
48
27
|
var _commandsWithAnalytics = require("../../commands-with-analytics");
|
|
49
|
-
|
|
50
28
|
var _pluginFactory = require("../../pm-plugins/plugin-factory");
|
|
51
|
-
|
|
52
29
|
var _transforms = require("../../transforms");
|
|
53
|
-
|
|
54
30
|
var _types = require("../../types");
|
|
55
|
-
|
|
56
31
|
var _steps = require("@atlaskit/adf-schema/steps");
|
|
57
|
-
|
|
58
32
|
var _utils3 = require("../../utils");
|
|
59
|
-
|
|
60
33
|
var _messages = _interopRequireDefault(require("../messages"));
|
|
61
|
-
|
|
62
34
|
var _consts = require("../consts");
|
|
63
|
-
|
|
64
35
|
var _resizeState = require("../../pm-plugins/table-resizing/utils/resize-state");
|
|
65
|
-
|
|
66
36
|
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; }
|
|
67
|
-
|
|
68
37
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
69
|
-
|
|
70
38
|
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); }; }
|
|
71
|
-
|
|
72
39
|
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; } }
|
|
73
|
-
|
|
74
40
|
var messages = (0, _reactIntlNext.defineMessages)({
|
|
75
41
|
cellBackground: {
|
|
76
42
|
id: 'fabric.editor.cellBackground',
|
|
@@ -114,59 +80,48 @@ var messages = (0, _reactIntlNext.defineMessages)({
|
|
|
114
80
|
}
|
|
115
81
|
});
|
|
116
82
|
exports.messages = messages;
|
|
117
|
-
|
|
118
83
|
var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
119
84
|
(0, _inherits2.default)(ContextualMenu, _Component);
|
|
120
|
-
|
|
121
85
|
var _super = _createSuper(ContextualMenu);
|
|
122
|
-
|
|
123
86
|
function ContextualMenu() {
|
|
124
87
|
var _this;
|
|
125
|
-
|
|
126
88
|
(0, _classCallCheck2.default)(this, ContextualMenu);
|
|
127
|
-
|
|
128
89
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
129
90
|
args[_key] = arguments[_key];
|
|
130
91
|
}
|
|
131
|
-
|
|
132
92
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
133
93
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
134
94
|
isSubmenuOpen: false
|
|
135
95
|
});
|
|
136
96
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleSubMenuRef", function (ref) {
|
|
137
97
|
var parent = (0, _utils2.closestElement)(_this.props.editorView.dom, '.fabric-editor-popup-scroll-parent');
|
|
138
|
-
|
|
139
98
|
if (!(parent && ref)) {
|
|
140
99
|
return;
|
|
141
100
|
}
|
|
142
|
-
|
|
143
101
|
var boundariesRect = parent.getBoundingClientRect();
|
|
144
102
|
var rect = ref.getBoundingClientRect();
|
|
145
|
-
|
|
146
103
|
if (rect.left + rect.width > boundariesRect.width) {
|
|
147
104
|
ref.style.left = "-".concat(rect.width, "px");
|
|
148
105
|
}
|
|
149
106
|
});
|
|
150
107
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createItems", function () {
|
|
151
108
|
var _this$props = _this.props,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
109
|
+
allowMergeCells = _this$props.allowMergeCells,
|
|
110
|
+
allowColumnSorting = _this$props.allowColumnSorting,
|
|
111
|
+
allowBackgroundColor = _this$props.allowBackgroundColor,
|
|
112
|
+
state = _this$props.editorView.state,
|
|
113
|
+
isOpen = _this$props.isOpen,
|
|
114
|
+
selectionRect = _this$props.selectionRect,
|
|
115
|
+
formatMessage = _this$props.intl.formatMessage,
|
|
116
|
+
editorView = _this$props.editorView;
|
|
160
117
|
var items = [];
|
|
161
|
-
var isSubmenuOpen = _this.state.isSubmenuOpen;
|
|
162
|
-
|
|
118
|
+
var isSubmenuOpen = _this.state.isSubmenuOpen;
|
|
119
|
+
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
163
120
|
var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
121
|
+
targetCellPosition = _getPluginState.targetCellPosition,
|
|
122
|
+
allowDistributeColumns = _getPluginState.pluginConfig.allowDistributeColumns;
|
|
167
123
|
if (allowBackgroundColor) {
|
|
168
124
|
var _node$attrs;
|
|
169
|
-
|
|
170
125
|
var node = isOpen && targetCellPosition ? state.doc.nodeAt(targetCellPosition) : null;
|
|
171
126
|
var background = (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff';
|
|
172
127
|
items.push({
|
|
@@ -188,7 +143,6 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
188
143
|
})))
|
|
189
144
|
});
|
|
190
145
|
}
|
|
191
|
-
|
|
192
146
|
items.push({
|
|
193
147
|
content: formatMessage(_messages.default.insertColumn),
|
|
194
148
|
value: {
|
|
@@ -208,9 +162,9 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
208
162
|
}, (0, _keymaps.tooltip)(_keymaps.addRowAfter))
|
|
209
163
|
});
|
|
210
164
|
var top = selectionRect.top,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
165
|
+
bottom = selectionRect.bottom,
|
|
166
|
+
right = selectionRect.right,
|
|
167
|
+
left = selectionRect.left;
|
|
214
168
|
var noOfColumns = right - left;
|
|
215
169
|
var noOfRows = bottom - top;
|
|
216
170
|
items.push({
|
|
@@ -229,7 +183,6 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
229
183
|
name: 'delete_row'
|
|
230
184
|
}
|
|
231
185
|
});
|
|
232
|
-
|
|
233
186
|
if (allowMergeCells) {
|
|
234
187
|
items.push({
|
|
235
188
|
content: formatMessage(messages.mergeCells),
|
|
@@ -246,10 +199,8 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
246
199
|
isDisabled: !(0, _utils.splitCell)(state)
|
|
247
200
|
});
|
|
248
201
|
}
|
|
249
|
-
|
|
250
202
|
if (allowDistributeColumns) {
|
|
251
203
|
var _newResizeState$chang;
|
|
252
|
-
|
|
253
204
|
var newResizeState = (0, _resizeState.getNewResizeStateFromSelectedColumns)(selectionRect, state, editorView.domAtPos.bind(editorView), _this.props.getEditorContainerWidth);
|
|
254
205
|
var wouldChange = (_newResizeState$chang = newResizeState === null || newResizeState === void 0 ? void 0 : newResizeState.changed) !== null && _newResizeState$chang !== void 0 ? _newResizeState$chang : false;
|
|
255
206
|
items.push({
|
|
@@ -260,7 +211,6 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
260
211
|
isDisabled: !wouldChange
|
|
261
212
|
});
|
|
262
213
|
}
|
|
263
|
-
|
|
264
214
|
if (allowColumnSorting) {
|
|
265
215
|
var hasMergedCellsInTable = (0, _utils3.getMergedCellsPositions)(state.tr).length > 0;
|
|
266
216
|
var warning = hasMergedCellsInTable ? {
|
|
@@ -280,7 +230,6 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
280
230
|
}
|
|
281
231
|
}, warning));
|
|
282
232
|
}
|
|
283
|
-
|
|
284
233
|
items.push({
|
|
285
234
|
content: formatMessage(messages.clearCells, {
|
|
286
235
|
0: Math.max(noOfColumns, noOfRows)
|
|
@@ -299,107 +248,73 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
299
248
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMenuItemActivated", function (_ref) {
|
|
300
249
|
var item = _ref.item;
|
|
301
250
|
var _this$props2 = _this.props,
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
251
|
+
editorView = _this$props2.editorView,
|
|
252
|
+
selectionRect = _this$props2.selectionRect,
|
|
253
|
+
editorAnalyticsAPI = _this$props2.editorAnalyticsAPI,
|
|
254
|
+
getEditorContainerWidth = _this$props2.getEditorContainerWidth;
|
|
255
|
+
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
307
256
|
var state = editorView.state,
|
|
308
|
-
|
|
309
|
-
|
|
257
|
+
dispatch = editorView.dispatch;
|
|
310
258
|
var _getPluginState2 = (0, _pluginFactory.getPluginState)(state),
|
|
311
|
-
|
|
312
|
-
|
|
259
|
+
targetCellPosition = _getPluginState2.targetCellPosition;
|
|
313
260
|
switch (item.value.name) {
|
|
314
261
|
case 'sort_column_desc':
|
|
315
262
|
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, selectionRect.left, _steps.TableSortOrder.DESC)(state, dispatch);
|
|
316
|
-
|
|
317
263
|
_this.toggleOpen();
|
|
318
|
-
|
|
319
264
|
break;
|
|
320
|
-
|
|
321
265
|
case 'sort_column_asc':
|
|
322
266
|
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, selectionRect.left, _steps.TableSortOrder.ASC)(state, dispatch);
|
|
323
|
-
|
|
324
267
|
_this.toggleOpen();
|
|
325
|
-
|
|
326
268
|
break;
|
|
327
|
-
|
|
328
269
|
case 'merge':
|
|
329
270
|
(0, _commandsWithAnalytics.mergeCellsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU)(state, dispatch);
|
|
330
|
-
|
|
331
271
|
_this.toggleOpen();
|
|
332
|
-
|
|
333
272
|
break;
|
|
334
|
-
|
|
335
273
|
case 'split':
|
|
336
274
|
(0, _commandsWithAnalytics.splitCellWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU)(state, dispatch);
|
|
337
|
-
|
|
338
275
|
_this.toggleOpen();
|
|
339
|
-
|
|
340
276
|
break;
|
|
341
|
-
|
|
342
277
|
case 'distribute_columns':
|
|
343
278
|
var newResizeStateWithAnalytics = (0, _resizeState.getNewResizeStateFromSelectedColumns)(selectionRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth);
|
|
344
|
-
|
|
345
279
|
if (newResizeStateWithAnalytics) {
|
|
346
280
|
(0, _commandsWithAnalytics.distributeColumnsWidthsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, newResizeStateWithAnalytics)(state, dispatch);
|
|
347
|
-
|
|
348
281
|
_this.toggleOpen();
|
|
349
282
|
}
|
|
350
|
-
|
|
351
283
|
break;
|
|
352
|
-
|
|
353
284
|
case 'clear':
|
|
354
285
|
(0, _commandsWithAnalytics.emptyMultipleCellsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, targetCellPosition)(state, dispatch);
|
|
355
|
-
|
|
356
286
|
_this.toggleOpen();
|
|
357
|
-
|
|
358
287
|
break;
|
|
359
|
-
|
|
360
288
|
case 'insert_column':
|
|
361
289
|
(0, _commandsWithAnalytics.insertColumnWithAnalytics)(getEditorContainerWidth, editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
|
|
362
|
-
|
|
363
290
|
_this.toggleOpen();
|
|
364
|
-
|
|
365
291
|
break;
|
|
366
|
-
|
|
367
292
|
case 'insert_row':
|
|
368
293
|
(0, _commandsWithAnalytics.insertRowWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, {
|
|
369
294
|
index: selectionRect.bottom,
|
|
370
295
|
moveCursorToInsertedRow: true
|
|
371
296
|
})(state, dispatch);
|
|
372
|
-
|
|
373
297
|
_this.toggleOpen();
|
|
374
|
-
|
|
375
298
|
break;
|
|
376
|
-
|
|
377
299
|
case 'delete_column':
|
|
378
300
|
(0, _commandsWithAnalytics.deleteColumnsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, selectionRect)(state, dispatch);
|
|
379
|
-
|
|
380
301
|
_this.toggleOpen();
|
|
381
|
-
|
|
382
302
|
break;
|
|
383
|
-
|
|
384
303
|
case 'delete_row':
|
|
385
304
|
var _getPluginState3 = (0, _pluginFactory.getPluginState)(state),
|
|
386
|
-
|
|
387
|
-
|
|
305
|
+
isHeaderRowRequired = _getPluginState3.pluginConfig.isHeaderRowRequired;
|
|
388
306
|
(0, _commandsWithAnalytics.deleteRowsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, selectionRect, !!isHeaderRowRequired)(state, dispatch);
|
|
389
|
-
|
|
390
307
|
_this.toggleOpen();
|
|
391
|
-
|
|
392
308
|
break;
|
|
393
309
|
}
|
|
394
310
|
});
|
|
395
311
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleOpen", function () {
|
|
396
312
|
var _this$props3 = _this.props,
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
313
|
+
isOpen = _this$props3.isOpen,
|
|
314
|
+
_this$props3$editorVi = _this$props3.editorView,
|
|
315
|
+
state = _this$props3$editorVi.state,
|
|
316
|
+
dispatch = _this$props3$editorVi.dispatch;
|
|
401
317
|
(0, _commands.toggleContextualMenu)()(state, dispatch);
|
|
402
|
-
|
|
403
318
|
if (!isOpen) {
|
|
404
319
|
_this.setState({
|
|
405
320
|
isSubmenuOpen: false
|
|
@@ -408,10 +323,9 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
408
323
|
});
|
|
409
324
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleOpenChange", function () {
|
|
410
325
|
var _this$props$editorVie = _this.props.editorView,
|
|
411
|
-
|
|
412
|
-
|
|
326
|
+
state = _this$props$editorVie.state,
|
|
327
|
+
dispatch = _this$props$editorVie.dispatch;
|
|
413
328
|
(0, _commands.toggleContextualMenu)()(state, dispatch);
|
|
414
|
-
|
|
415
329
|
_this.setState({
|
|
416
330
|
isSubmenuOpen: false
|
|
417
331
|
});
|
|
@@ -419,11 +333,10 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
419
333
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleItemMouseEnter", function (_ref2) {
|
|
420
334
|
var item = _ref2.item;
|
|
421
335
|
var _this$props4 = _this.props,
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
336
|
+
_this$props4$editorVi = _this$props4.editorView,
|
|
337
|
+
state = _this$props4$editorVi.state,
|
|
338
|
+
dispatch = _this$props4$editorVi.dispatch,
|
|
339
|
+
selectionRect = _this$props4.selectionRect;
|
|
427
340
|
if (item.value.name === 'background') {
|
|
428
341
|
if (!_this.state.isSubmenuOpen) {
|
|
429
342
|
_this.setState({
|
|
@@ -431,15 +344,12 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
431
344
|
});
|
|
432
345
|
}
|
|
433
346
|
}
|
|
434
|
-
|
|
435
347
|
if (item.value.name === 'delete_column') {
|
|
436
348
|
(0, _commands.hoverColumns)((0, _utils3.getSelectedColumnIndexes)(selectionRect), true)(state, dispatch);
|
|
437
349
|
}
|
|
438
|
-
|
|
439
350
|
if (item.value.name === 'delete_row') {
|
|
440
351
|
(0, _commands.hoverRows)((0, _utils3.getSelectedRowIndexes)(selectionRect), true)(state, dispatch);
|
|
441
352
|
}
|
|
442
|
-
|
|
443
353
|
if (['sort_column_asc', 'sort_column_desc'].indexOf(item.value.name) > -1 && (0, _utils3.getMergedCellsPositions)(state.tr).length !== 0) {
|
|
444
354
|
(0, _commands.hoverMergedCells)()(state, dispatch);
|
|
445
355
|
}
|
|
@@ -447,13 +357,11 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
447
357
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleItemMouseLeave", function (_ref3) {
|
|
448
358
|
var item = _ref3.item;
|
|
449
359
|
var _this$props$editorVie2 = _this.props.editorView,
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
360
|
+
state = _this$props$editorVie2.state,
|
|
361
|
+
dispatch = _this$props$editorVie2.dispatch;
|
|
453
362
|
if (item.value.name === 'background') {
|
|
454
363
|
_this.closeSubmenu();
|
|
455
364
|
}
|
|
456
|
-
|
|
457
365
|
if (['sort_column_asc', 'sort_column_desc', 'delete_column', 'delete_row'].indexOf(item.value.name) > -1) {
|
|
458
366
|
(0, _commands.clearHoverSelection)()(state, dispatch);
|
|
459
367
|
}
|
|
@@ -467,40 +375,36 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
467
375
|
});
|
|
468
376
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setColor", function (color) {
|
|
469
377
|
var _this$props5 = _this.props,
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
378
|
+
editorView = _this$props5.editorView,
|
|
379
|
+
editorAnalyticsAPI = _this$props5.editorAnalyticsAPI;
|
|
380
|
+
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
473
381
|
var _getPluginState4 = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
474
|
-
|
|
475
|
-
|
|
382
|
+
targetCellPosition = _getPluginState4.targetCellPosition;
|
|
476
383
|
var state = editorView.state,
|
|
477
|
-
|
|
384
|
+
dispatch = editorView.dispatch;
|
|
478
385
|
(0, _commandsWithAnalytics.setColorWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, color, targetCellPosition)(state, dispatch);
|
|
479
|
-
|
|
480
386
|
_this.toggleOpen();
|
|
481
387
|
});
|
|
482
388
|
return _this;
|
|
483
389
|
}
|
|
484
|
-
|
|
485
390
|
(0, _createClass2.default)(ContextualMenu, [{
|
|
486
391
|
key: "render",
|
|
487
392
|
value: function render() {
|
|
488
393
|
var _this$props6 = this.props,
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
394
|
+
isOpen = _this$props6.isOpen,
|
|
395
|
+
mountPoint = _this$props6.mountPoint,
|
|
396
|
+
offset = _this$props6.offset,
|
|
397
|
+
boundariesElement = _this$props6.boundariesElement;
|
|
493
398
|
var items = this.createItems();
|
|
494
|
-
|
|
495
399
|
if (!items) {
|
|
496
400
|
return null;
|
|
497
401
|
}
|
|
498
|
-
|
|
499
402
|
return (0, _react2.jsx)("div", {
|
|
500
403
|
"data-testid": "table-cell-contextual-menu",
|
|
501
404
|
onMouseLeave: this.closeSubmenu
|
|
502
405
|
}, (0, _react2.jsx)(_uiMenu.DropdownMenu, {
|
|
503
|
-
mountTo: mountPoint
|
|
406
|
+
mountTo: mountPoint
|
|
407
|
+
//This needs be removed when the a11y is completely handled
|
|
504
408
|
//Disabling key navigation now as it works only partially
|
|
505
409
|
,
|
|
506
410
|
disableArrowKeyNavigation: true,
|
|
@@ -519,12 +423,9 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
519
423
|
}]);
|
|
520
424
|
return ContextualMenu;
|
|
521
425
|
}(_react.Component);
|
|
522
|
-
|
|
523
426
|
exports.ContextualMenu = ContextualMenu;
|
|
524
427
|
(0, _defineProperty2.default)(ContextualMenu, "defaultProps", {
|
|
525
428
|
boundariesElement: document.body
|
|
526
429
|
});
|
|
527
|
-
|
|
528
430
|
var _default = (0, _reactIntlNext.injectIntl)(ContextualMenu);
|
|
529
|
-
|
|
530
431
|
exports.default = _default;
|
|
@@ -1,85 +1,62 @@
|
|
|
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 _react = require("@emotion/react");
|
|
11
|
-
|
|
12
9
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
13
|
-
|
|
14
10
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
15
|
-
|
|
16
11
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
17
|
-
|
|
18
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
19
|
-
|
|
20
13
|
var _pluginFactory = require("../../pm-plugins/plugin-factory");
|
|
21
|
-
|
|
22
14
|
var _pluginKey = require("../../pm-plugins/plugin-key");
|
|
23
|
-
|
|
24
15
|
var _consts = require("../consts");
|
|
25
|
-
|
|
26
16
|
var _styles = require("./styles");
|
|
27
|
-
|
|
28
17
|
var _ContextualMenu = _interopRequireDefault(require("./ContextualMenu"));
|
|
29
|
-
|
|
30
18
|
/** @jsx jsx */
|
|
19
|
+
|
|
31
20
|
// offset of the contextual menu dropdown
|
|
32
21
|
var calculateOffset = function calculateOffset(targetCellRef, state) {
|
|
33
22
|
var _pluginKey$getState = _pluginKey.pluginKey.getState(state),
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
tableRef = _pluginKey$getState.tableRef;
|
|
36
24
|
var top = -_consts.contextualMenuTriggerSize;
|
|
37
|
-
|
|
38
25
|
if (tableRef && targetCellRef) {
|
|
39
26
|
var targetOffset = targetCellRef.getBoundingClientRect();
|
|
40
27
|
var tableOffset = tableRef.getBoundingClientRect();
|
|
41
28
|
var topDiff = targetOffset.top - tableOffset.top;
|
|
42
|
-
|
|
43
29
|
if (topDiff < 200) {
|
|
44
30
|
top -= topDiff + 2;
|
|
45
31
|
}
|
|
46
32
|
}
|
|
47
|
-
|
|
48
33
|
return [_consts.contextualMenuTriggerSize / 2, top];
|
|
49
34
|
};
|
|
50
|
-
|
|
51
35
|
var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
52
36
|
var mountPoint = _ref.mountPoint,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
37
|
+
boundariesElement = _ref.boundariesElement,
|
|
38
|
+
scrollableElement = _ref.scrollableElement,
|
|
39
|
+
editorView = _ref.editorView,
|
|
40
|
+
isOpen = _ref.isOpen,
|
|
41
|
+
pluginConfig = _ref.pluginConfig,
|
|
42
|
+
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
43
|
+
getEditorContainerWidth = _ref.getEditorContainerWidth;
|
|
61
44
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
62
45
|
var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
63
|
-
|
|
64
|
-
|
|
46
|
+
targetCellPosition = _getPluginState.targetCellPosition;
|
|
65
47
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
66
48
|
return null;
|
|
67
49
|
}
|
|
68
|
-
|
|
69
50
|
var selection = editorView.state.selection;
|
|
70
51
|
var selectionRect = (0, _utils.isSelectionType)(selection, 'cell') ? (0, _utils.getSelectionRect)(selection) : (0, _utils.findCellRectClosestToPos)(selection.$from);
|
|
71
|
-
|
|
72
52
|
if (!selectionRect) {
|
|
73
53
|
return null;
|
|
74
54
|
}
|
|
75
|
-
|
|
76
55
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
77
56
|
var targetCellRef = (0, _prosemirrorUtils.findDomRefAtPos)(targetCellPosition, domAtPos);
|
|
78
|
-
|
|
79
57
|
if (!targetCellRef) {
|
|
80
58
|
return null;
|
|
81
59
|
}
|
|
82
|
-
|
|
83
60
|
return (0, _react.jsx)(_ui.Popup, {
|
|
84
61
|
alignX: "right",
|
|
85
62
|
alignY: "top",
|
|
@@ -88,7 +65,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
88
65
|
boundariesElement: boundariesElement,
|
|
89
66
|
scrollableElement: scrollableElement,
|
|
90
67
|
fitHeight: 188,
|
|
91
|
-
fitWidth: _consts.contextualMenuDropdownWidth
|
|
68
|
+
fitWidth: _consts.contextualMenuDropdownWidth
|
|
69
|
+
// z-index value below is to ensure that this menu is above other floating menu
|
|
92
70
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
93
71
|
,
|
|
94
72
|
zIndex: _editorSharedStyles.akEditorFloatingOverlapPanelZIndex,
|
|
@@ -110,7 +88,6 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
110
88
|
getEditorContainerWidth: getEditorContainerWidth
|
|
111
89
|
})));
|
|
112
90
|
};
|
|
113
|
-
|
|
114
91
|
FloatingContextualMenu.displayName = 'FloatingContextualMenu';
|
|
115
92
|
var _default = FloatingContextualMenu;
|
|
116
93
|
exports.default = _default;
|
|
@@ -1,32 +1,21 @@
|
|
|
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.tablePopupStyles = exports.cellColourPreviewStyles = void 0;
|
|
9
|
-
|
|
10
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
-
|
|
12
9
|
var _react = require("@emotion/react");
|
|
13
|
-
|
|
14
10
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
15
|
-
|
|
16
11
|
var _colors = require("@atlaskit/theme/colors");
|
|
17
|
-
|
|
18
12
|
var _consts = require("../consts");
|
|
19
|
-
|
|
20
13
|
var _types = require("../../types");
|
|
21
|
-
|
|
22
14
|
var _constants = require("@atlaskit/theme/constants");
|
|
23
|
-
|
|
24
15
|
var _templateObject, _templateObject2;
|
|
25
|
-
|
|
26
16
|
var cellColourPreviewStyles = function cellColourPreviewStyles(selectedColor) {
|
|
27
17
|
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n &::before {\n background: ", ";\n }\n"])), selectedColor);
|
|
28
18
|
};
|
|
29
|
-
|
|
30
19
|
exports.cellColourPreviewStyles = cellColourPreviewStyles;
|
|
31
20
|
var tablePopupStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n border-radius: ", "px;\n background: ", ";\n box-shadow: ", ";\n display: block;\n position: absolute;\n top: 0;\n left: ", "px;\n padding: 8px;\n\n > div {\n padding: 0;\n }\n }\n\n .", " {\n display: flex;\n\n &::before {\n content: '';\n display: block;\n border: 1px solid ", ";\n border-radius: ", "px;\n width: 20px;\n height: 20px;\n }\n\n &::after {\n content: '\u203A';\n margin-left: 4px;\n line-height: 20px;\n color: ", ";\n }\n }\n"])), _types.TableCssClassName.CONTEXTUAL_SUBMENU, (0, _constants.borderRadius)(), "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N60A, ", 0 0 1px ").concat(_colors.N60A), ")"), _consts.contextualMenuDropdownWidth, _types.TableCssClassName.CONTEXTUAL_MENU_ICON, _adfSchema.tableBackgroundBorderColor, (0, _constants.borderRadius)(), "var(--ds-icon, ".concat(_colors.N90, ")"));
|
|
32
21
|
exports.tablePopupStyles = tablePopupStyles;
|
|
@@ -1,25 +1,20 @@
|
|
|
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 _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _reactIntlNext = require("react-intl-next");
|
|
13
|
-
|
|
14
10
|
var _types = require("../../types");
|
|
15
|
-
|
|
16
11
|
var DeleteButton = function DeleteButton(_ref) {
|
|
17
12
|
var style = _ref.style,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
onClick = _ref.onClick,
|
|
14
|
+
onMouseEnter = _ref.onMouseEnter,
|
|
15
|
+
onMouseLeave = _ref.onMouseLeave,
|
|
16
|
+
removeLabel = _ref.removeLabel,
|
|
17
|
+
formatMessage = _ref.intl.formatMessage;
|
|
23
18
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
24
19
|
className: _types.TableCssClassName.CONTROLS_DELETE_BUTTON_WRAP,
|
|
25
20
|
style: style,
|
|
@@ -43,7 +38,5 @@ var DeleteButton = function DeleteButton(_ref) {
|
|
|
43
38
|
fillRule: "evenodd"
|
|
44
39
|
}))));
|
|
45
40
|
};
|
|
46
|
-
|
|
47
41
|
var _default = (0, _reactIntlNext.injectIntl)(DeleteButton);
|
|
48
|
-
|
|
49
42
|
exports.default = _default;
|