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