@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,5 +1,3 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
|
|
3
1
|
/** @jsx jsx */
|
|
4
2
|
import { jsx } from '@emotion/react';
|
|
5
3
|
import { defineMessages } from 'react-intl-next';
|
|
@@ -91,18 +89,18 @@ export var getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _
|
|
|
91
89
|
}),
|
|
92
90
|
options: options
|
|
93
91
|
};
|
|
94
|
-
};
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Added these options for mobile. Mobile bridge translates this menu and
|
|
95
95
|
// relay it to the native mobile. Native mobile displays the menu
|
|
96
96
|
// with native widgets. It's enabled via a plugin config.
|
|
97
|
-
|
|
98
97
|
export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorState, editorView, initialSelectionRect, _ref2, getEditorContainerWidth, editorAnalyticsAPI) {
|
|
99
98
|
var _pluginState$pluginCo, _pluginState$pluginCo2;
|
|
100
|
-
|
|
101
99
|
var formatMessage = _ref2.formatMessage;
|
|
102
100
|
var top = initialSelectionRect.top,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
bottom = initialSelectionRect.bottom,
|
|
102
|
+
right = initialSelectionRect.right,
|
|
103
|
+
left = initialSelectionRect.left;
|
|
106
104
|
var numberOfColumns = right - left;
|
|
107
105
|
var numberOfRows = bottom - top;
|
|
108
106
|
var pluginState = getPluginState(editorState);
|
|
@@ -112,11 +110,9 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
112
110
|
onClick: function onClick(state, dispatch, view) {
|
|
113
111
|
var selectionRect = getClosestSelectionRect(state);
|
|
114
112
|
var index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.right;
|
|
115
|
-
|
|
116
113
|
if (index) {
|
|
117
114
|
insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB, index)(state, dispatch, view);
|
|
118
115
|
}
|
|
119
|
-
|
|
120
116
|
return true;
|
|
121
117
|
},
|
|
122
118
|
selected: false,
|
|
@@ -130,14 +126,12 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
130
126
|
onClick: function onClick(state, dispatch) {
|
|
131
127
|
var selectionRect = getClosestSelectionRect(state);
|
|
132
128
|
var index = selectionRect === null || selectionRect === void 0 ? void 0 : selectionRect.bottom;
|
|
133
|
-
|
|
134
129
|
if (index) {
|
|
135
130
|
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB, {
|
|
136
131
|
index: index,
|
|
137
132
|
moveCursorToInsertedRow: true
|
|
138
133
|
})(state, dispatch);
|
|
139
134
|
}
|
|
140
|
-
|
|
141
135
|
return true;
|
|
142
136
|
},
|
|
143
137
|
selected: false,
|
|
@@ -152,11 +146,9 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
152
146
|
}),
|
|
153
147
|
onClick: function onClick(state, dispatch, view) {
|
|
154
148
|
var selectionRect = getClosestSelectionRect(state);
|
|
155
|
-
|
|
156
149
|
if (selectionRect) {
|
|
157
150
|
deleteColumnsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB, selectionRect)(state, dispatch, view);
|
|
158
151
|
}
|
|
159
|
-
|
|
160
152
|
return true;
|
|
161
153
|
},
|
|
162
154
|
onFocus: highlightColumnsHandler,
|
|
@@ -172,11 +164,9 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
172
164
|
}),
|
|
173
165
|
onClick: function onClick(state, dispatch) {
|
|
174
166
|
var selectionRect = getClosestSelectionRect(state);
|
|
175
|
-
|
|
176
167
|
if (selectionRect) {
|
|
177
168
|
deleteRowsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB, selectionRect, false)(state, dispatch);
|
|
178
169
|
}
|
|
179
|
-
|
|
180
170
|
return true;
|
|
181
171
|
},
|
|
182
172
|
onFocus: highlightRowsHandler,
|
|
@@ -198,22 +188,17 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
198
188
|
selected: false,
|
|
199
189
|
disabled: !splitCell(editorState)
|
|
200
190
|
}];
|
|
201
|
-
|
|
202
191
|
if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo = pluginState.pluginConfig) !== null && _pluginState$pluginCo !== void 0 && _pluginState$pluginCo.allowDistributeColumns) {
|
|
203
192
|
var _newResizeStateWithAn;
|
|
204
|
-
|
|
205
193
|
var newResizeStateWithAnalytics = editorView ? getNewResizeStateFromSelectedColumns(initialSelectionRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth) : undefined;
|
|
206
194
|
var wouldChange = (_newResizeStateWithAn = newResizeStateWithAnalytics === null || newResizeStateWithAnalytics === void 0 ? void 0 : newResizeStateWithAnalytics.changed) !== null && _newResizeStateWithAn !== void 0 ? _newResizeStateWithAn : false;
|
|
207
|
-
|
|
208
195
|
var distributeColumnWidths = function distributeColumnWidths(state, dispatch) {
|
|
209
196
|
if (newResizeStateWithAnalytics) {
|
|
210
197
|
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB, newResizeStateWithAnalytics)(state, dispatch);
|
|
211
198
|
return true;
|
|
212
199
|
}
|
|
213
|
-
|
|
214
200
|
return false;
|
|
215
201
|
};
|
|
216
|
-
|
|
217
202
|
options.push({
|
|
218
203
|
id: 'editor.table.distributeColumns',
|
|
219
204
|
title: formatMessage(ContextualMenuMessages.distributeColumns),
|
|
@@ -222,7 +207,6 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
222
207
|
disabled: !wouldChange
|
|
223
208
|
});
|
|
224
209
|
}
|
|
225
|
-
|
|
226
210
|
if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo2 = pluginState.pluginConfig) !== null && _pluginState$pluginCo2 !== void 0 && _pluginState$pluginCo2.allowColumnSorting) {
|
|
227
211
|
var hasMergedCellsInTable = getMergedCellsPositions(editorState.tr).length > 0;
|
|
228
212
|
var warning = hasMergedCellsInTable ? formatMessage(ContextualMenuMessages.canNotSortTable) : undefined;
|
|
@@ -234,7 +218,6 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
234
218
|
hoverMergedCells()(state, dispatch);
|
|
235
219
|
return true;
|
|
236
220
|
}
|
|
237
|
-
|
|
238
221
|
return false;
|
|
239
222
|
},
|
|
240
223
|
onMouseOut: function onMouseOut(state, dispatch) {
|
|
@@ -257,7 +240,6 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
257
240
|
hoverMergedCells()(state, dispatch);
|
|
258
241
|
return true;
|
|
259
242
|
}
|
|
260
|
-
|
|
261
243
|
return false;
|
|
262
244
|
},
|
|
263
245
|
onMouseOut: function onMouseOut(state, dispatch) {
|
|
@@ -273,7 +255,6 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
273
255
|
tooltip: warning
|
|
274
256
|
});
|
|
275
257
|
}
|
|
276
|
-
|
|
277
258
|
options.push({
|
|
278
259
|
id: 'editor.table.clearCells',
|
|
279
260
|
title: formatMessage(ContextualMenuMessages.clearCells, {
|
|
@@ -281,8 +262,7 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
281
262
|
}),
|
|
282
263
|
onClick: function onClick(state, dispatch) {
|
|
283
264
|
var _getPluginState = getPluginState(state),
|
|
284
|
-
|
|
285
|
-
|
|
265
|
+
targetCellPosition = _getPluginState.targetCellPosition;
|
|
286
266
|
emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB, targetCellPosition)(state, dispatch);
|
|
287
267
|
return true;
|
|
288
268
|
},
|
|
@@ -303,31 +283,26 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
303
283
|
showSelected: false
|
|
304
284
|
};
|
|
305
285
|
};
|
|
306
|
-
|
|
307
286
|
var getClosestSelectionRect = function getClosestSelectionRect(state) {
|
|
308
287
|
var selection = state.selection;
|
|
309
288
|
return isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
310
289
|
};
|
|
311
|
-
|
|
312
290
|
export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags, getEditorView) {
|
|
313
291
|
return function (config) {
|
|
314
292
|
return function (state, intl) {
|
|
315
293
|
var tableObject = findTable(state.selection);
|
|
316
294
|
var pluginState = getPluginState(state);
|
|
317
295
|
var resizeState = tableResizingPluginKey.getState(state);
|
|
318
|
-
|
|
319
296
|
if (tableObject && pluginState.editorHasFocus) {
|
|
320
297
|
var nodeType = state.schema.nodes.table;
|
|
321
298
|
var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI);
|
|
322
|
-
|
|
323
299
|
var _ref3 = getEditorFeatureFlags() || {},
|
|
324
|
-
|
|
325
|
-
|
|
300
|
+
tableCellOptionsInFloatingToolbar = _ref3.tableCellOptionsInFloatingToolbar;
|
|
326
301
|
var cellItems = getCellItems(config, state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, tableCellOptionsInFloatingToolbar);
|
|
327
|
-
var colorPicker = getColorPicker(state, menu, intl, getEditorContainerWidth, editorAnalyticsAPI, tableCellOptionsInFloatingToolbar);
|
|
302
|
+
var colorPicker = getColorPicker(state, menu, intl, getEditorContainerWidth, editorAnalyticsAPI, tableCellOptionsInFloatingToolbar);
|
|
328
303
|
|
|
304
|
+
// Check if we need to show confirm dialog for delete button
|
|
329
305
|
var confirmDialog;
|
|
330
|
-
|
|
331
306
|
if (isReferencedSource(state, tableObject.node)) {
|
|
332
307
|
confirmDialog = function confirmDialog() {
|
|
333
308
|
return {
|
|
@@ -349,23 +324,18 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
349
324
|
};
|
|
350
325
|
};
|
|
351
326
|
}
|
|
352
|
-
|
|
353
327
|
var getDomRef = function getDomRef(editorView) {
|
|
354
328
|
var element;
|
|
355
329
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
356
330
|
var parent = findParentDomRefOfType(nodeType, domAtPos)(state.selection);
|
|
357
|
-
|
|
358
331
|
if (parent) {
|
|
359
332
|
var tableRef = parent.querySelector('table') || undefined;
|
|
360
|
-
|
|
361
333
|
if (tableRef) {
|
|
362
334
|
element = closestElement(tableRef, ".".concat(TableCssClassName.TABLE_NODE_WRAPPER)) || undefined;
|
|
363
335
|
}
|
|
364
336
|
}
|
|
365
|
-
|
|
366
337
|
return element;
|
|
367
338
|
};
|
|
368
|
-
|
|
369
339
|
return {
|
|
370
340
|
title: 'Table floating controls',
|
|
371
341
|
getDomRef: getDomRef,
|
|
@@ -373,7 +343,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
373
343
|
offset: [0, 3],
|
|
374
344
|
zIndex: akEditorFloatingPanelZIndex + 1,
|
|
375
345
|
// Place the context menu slightly above the others
|
|
376
|
-
items: [menu, separator(menu.hidden)].concat(
|
|
346
|
+
items: [menu, separator(menu.hidden)].concat(cellItems, colorPicker, [{
|
|
377
347
|
type: 'extensions-placeholder',
|
|
378
348
|
separator: 'end'
|
|
379
349
|
}, {
|
|
@@ -407,25 +377,20 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
407
377
|
scrollable: true
|
|
408
378
|
};
|
|
409
379
|
}
|
|
410
|
-
|
|
411
380
|
return;
|
|
412
381
|
};
|
|
413
382
|
};
|
|
414
383
|
};
|
|
415
|
-
|
|
416
384
|
var separator = function separator(hidden) {
|
|
417
385
|
return {
|
|
418
386
|
type: 'separator',
|
|
419
387
|
hidden: hidden
|
|
420
388
|
};
|
|
421
389
|
};
|
|
422
|
-
|
|
423
390
|
var getCellItems = function getCellItems(pluginConfig, state, view, _ref4, getEditorContainerWidth, editorAnalyticsAPI, tableCellOptionsInFloatingToolbar) {
|
|
424
391
|
var formatMessage = _ref4.formatMessage;
|
|
425
|
-
|
|
426
392
|
if (pluginConfig.allowCellOptionsInFloatingToolbar || tableCellOptionsInFloatingToolbar) {
|
|
427
393
|
var initialSelectionRect = getClosestSelectionRect(state);
|
|
428
|
-
|
|
429
394
|
if (initialSelectionRect) {
|
|
430
395
|
var cellOptions = getToolbarCellOptionsConfig(state, view, initialSelectionRect, {
|
|
431
396
|
formatMessage: formatMessage
|
|
@@ -433,23 +398,17 @@ var getCellItems = function getCellItems(pluginConfig, state, view, _ref4, getEd
|
|
|
433
398
|
return [cellOptions, separator(cellOptions.hidden)];
|
|
434
399
|
}
|
|
435
400
|
}
|
|
436
|
-
|
|
437
401
|
return [];
|
|
438
402
|
};
|
|
439
|
-
|
|
440
403
|
var getColorPicker = function getColorPicker(state, menu, _ref5, getEditorContainerWidth, editorAnalyticsAPI, tableCellOptionsInFloatingToolbar) {
|
|
441
404
|
var _node$attrs;
|
|
442
|
-
|
|
443
405
|
var formatMessage = _ref5.formatMessage;
|
|
444
|
-
|
|
445
406
|
var _getPluginState2 = getPluginState(state),
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
407
|
+
targetCellPosition = _getPluginState2.targetCellPosition,
|
|
408
|
+
pluginConfig = _getPluginState2.pluginConfig;
|
|
449
409
|
if (!pluginConfig.allowBackgroundColor || !tableCellOptionsInFloatingToolbar) {
|
|
450
410
|
return [];
|
|
451
411
|
}
|
|
452
|
-
|
|
453
412
|
var node = targetCellPosition ? state.doc.nodeAt(targetCellPosition) : undefined;
|
|
454
413
|
var currentBackground = (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff';
|
|
455
414
|
var defaultPalette = cellBackgroundColorPalette.find(function (item) {
|
|
@@ -471,41 +430,32 @@ var getColorPicker = function getColorPicker(state, menu, _ref5, getEditorContai
|
|
|
471
430
|
}
|
|
472
431
|
}, separator(menu.hidden)];
|
|
473
432
|
};
|
|
474
|
-
|
|
475
433
|
var clickWithCheckboxHandler = function clickWithCheckboxHandler(isChecked, node, editorAnalyticsAPI) {
|
|
476
434
|
return function (state, dispatch) {
|
|
477
435
|
if (!node) {
|
|
478
436
|
return false;
|
|
479
437
|
}
|
|
480
|
-
|
|
481
438
|
if (!isChecked) {
|
|
482
439
|
return deleteTableWithAnalytics(editorAnalyticsAPI)(state, dispatch);
|
|
483
440
|
} else {
|
|
484
441
|
removeDescendantNodes(node)(state, dispatch);
|
|
485
442
|
}
|
|
486
|
-
|
|
487
443
|
return true;
|
|
488
444
|
};
|
|
489
445
|
};
|
|
490
|
-
|
|
491
446
|
var highlightRowsHandler = function highlightRowsHandler(state, dispatch) {
|
|
492
447
|
var selectionRect = getClosestSelectionRect(state);
|
|
493
|
-
|
|
494
448
|
if (selectionRect) {
|
|
495
449
|
hoverRows(getSelectedRowIndexes(selectionRect), true)(state, dispatch);
|
|
496
450
|
return true;
|
|
497
451
|
}
|
|
498
|
-
|
|
499
452
|
return false;
|
|
500
453
|
};
|
|
501
|
-
|
|
502
454
|
var highlightColumnsHandler = function highlightColumnsHandler(state, dispatch) {
|
|
503
455
|
var selectionRect = getClosestSelectionRect(state);
|
|
504
|
-
|
|
505
456
|
if (selectionRect) {
|
|
506
457
|
hoverColumns(getSelectedColumnIndexes(selectionRect), true)(state, dispatch);
|
|
507
458
|
return true;
|
|
508
459
|
}
|
|
509
|
-
|
|
510
460
|
return false;
|
|
511
461
|
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
4
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
8
5
|
import { tableNewColumnMinWidth } from '@atlaskit/editor-common/styles';
|
|
9
6
|
import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils';
|
|
@@ -15,18 +12,16 @@ import { scaleTableTo } from '../pm-plugins/table-resizing/utils/scale-table';
|
|
|
15
12
|
export var updateColumnWidths = function updateColumnWidths(resizeState, table, start) {
|
|
16
13
|
return function (tr) {
|
|
17
14
|
var map = TableMap.get(table);
|
|
18
|
-
var updatedCellsAttrs = {};
|
|
15
|
+
var updatedCellsAttrs = {};
|
|
19
16
|
|
|
17
|
+
// calculating new attributes for each cell
|
|
20
18
|
for (var columnIndex = 0; columnIndex < map.width; columnIndex++) {
|
|
21
19
|
for (var rowIndex = 0; rowIndex < map.height; rowIndex++) {
|
|
22
20
|
var width = resizeState.cols[columnIndex].width;
|
|
23
21
|
var mapIndex = rowIndex * map.width + columnIndex;
|
|
24
22
|
var cellPos = map.map[mapIndex];
|
|
25
|
-
|
|
26
23
|
var attrs = updatedCellsAttrs[cellPos] || _objectSpread({}, table.nodeAt(cellPos).attrs);
|
|
27
|
-
|
|
28
24
|
var colspan = attrs.colspan || 1;
|
|
29
|
-
|
|
30
25
|
if (attrs.colwidth && attrs.colwidth.length > colspan) {
|
|
31
26
|
tr = setMeta({
|
|
32
27
|
type: 'UPDATE_COLUMN_WIDTHS',
|
|
@@ -37,26 +32,22 @@ export var updateColumnWidths = function updateColumnWidths(resizeState, table,
|
|
|
37
32
|
}
|
|
38
33
|
})(tr);
|
|
39
34
|
attrs.colwidth = attrs.colwidth.slice(0, colspan);
|
|
40
|
-
}
|
|
41
|
-
|
|
35
|
+
}
|
|
42
36
|
|
|
37
|
+
// Rowspanning cell that has already been handled
|
|
43
38
|
if (rowIndex && map.map[mapIndex] === map.map[mapIndex - map.width]) {
|
|
44
39
|
continue;
|
|
45
40
|
}
|
|
46
|
-
|
|
47
41
|
var colspanIndex = colspan === 1 ? 0 : columnIndex - map.colCount(cellPos);
|
|
48
|
-
|
|
49
42
|
if (attrs.colwidth && attrs.colwidth[colspanIndex] === width) {
|
|
50
43
|
continue;
|
|
51
44
|
}
|
|
52
|
-
|
|
53
45
|
var colwidths = attrs.colwidth ? attrs.colwidth.slice() : Array.from({
|
|
54
46
|
length: colspan
|
|
55
47
|
}, function (_) {
|
|
56
48
|
return 0;
|
|
57
49
|
});
|
|
58
50
|
colwidths[colspanIndex] = width;
|
|
59
|
-
|
|
60
51
|
if (colwidths.length > colspan) {
|
|
61
52
|
tr = setMeta({
|
|
62
53
|
type: 'UPDATE_COLUMN_WIDTHS',
|
|
@@ -68,36 +59,29 @@ export var updateColumnWidths = function updateColumnWidths(resizeState, table,
|
|
|
68
59
|
})(tr);
|
|
69
60
|
colwidths = colwidths.slice(0, colspan);
|
|
70
61
|
}
|
|
71
|
-
|
|
72
62
|
updatedCellsAttrs[cellPos] = _objectSpread(_objectSpread({}, attrs), {}, {
|
|
73
63
|
colwidth: colwidths.includes(0) ? undefined : colwidths
|
|
74
64
|
});
|
|
75
65
|
}
|
|
76
|
-
}
|
|
77
|
-
|
|
66
|
+
}
|
|
78
67
|
|
|
68
|
+
// updating all cells with new attributes
|
|
79
69
|
var rows = [];
|
|
80
70
|
var seen = {};
|
|
81
|
-
|
|
82
71
|
for (var _rowIndex = 0; _rowIndex < map.height; _rowIndex++) {
|
|
83
72
|
var row = table.child(_rowIndex);
|
|
84
73
|
var cells = [];
|
|
85
|
-
|
|
86
74
|
for (var _columnIndex = 0; _columnIndex < map.width; _columnIndex++) {
|
|
87
75
|
var _mapIndex = _rowIndex * map.width + _columnIndex;
|
|
88
|
-
|
|
89
76
|
var pos = map.map[_mapIndex];
|
|
90
77
|
var cell = table.nodeAt(pos);
|
|
91
|
-
|
|
92
78
|
if (!seen[pos] && cell) {
|
|
93
79
|
cells.push(cell.type.createChecked(updatedCellsAttrs[pos] || cell.attrs, cell.content, cell.marks));
|
|
94
80
|
seen[pos] = true;
|
|
95
81
|
}
|
|
96
82
|
}
|
|
97
|
-
|
|
98
83
|
rows.push(row.type.createChecked(row.attrs, cells, row.marks));
|
|
99
84
|
}
|
|
100
|
-
|
|
101
85
|
var tablePos = start - 1;
|
|
102
86
|
var selectionBookmark = tr.selection.getBookmark();
|
|
103
87
|
tr.replaceWith(tablePos, tablePos + table.nodeSize, table.type.createChecked(table.attrs, rows, table.marks));
|
|
@@ -111,10 +95,10 @@ export var updateColumnWidths = function updateColumnWidths(resizeState, table,
|
|
|
111
95
|
*
|
|
112
96
|
* @see https://github.com/ProseMirror/prosemirror/issues/645
|
|
113
97
|
*/
|
|
114
|
-
|
|
115
98
|
return tr.setSelection(selectionBookmark.resolve(tr.doc));
|
|
116
99
|
};
|
|
117
100
|
};
|
|
101
|
+
|
|
118
102
|
/**
|
|
119
103
|
* This function is called when user inserts/deletes a column in a table to;
|
|
120
104
|
* - rescale all columns (if the table did not overflow before the insertion)
|
|
@@ -125,7 +109,6 @@ export var updateColumnWidths = function updateColumnWidths(resizeState, table,
|
|
|
125
109
|
* @param view
|
|
126
110
|
* @returns Updated transaction with rescaled columns for a given table
|
|
127
111
|
*/
|
|
128
|
-
|
|
129
112
|
export var rescaleColumns = function rescaleColumns(getEditorContainerWidth) {
|
|
130
113
|
return function (table, view) {
|
|
131
114
|
return function (tr) {
|
|
@@ -134,18 +117,15 @@ export var rescaleColumns = function rescaleColumns(getEditorContainerWidth) {
|
|
|
134
117
|
if (!view || !hasTableBeenResized(table.node)) {
|
|
135
118
|
return tr;
|
|
136
119
|
}
|
|
137
|
-
|
|
138
120
|
var state = view.state;
|
|
139
121
|
var domAtPos = view.domAtPos.bind(view);
|
|
140
122
|
var maybeTable = domAtPos(table.start).node;
|
|
141
123
|
var tableRef = maybeTable.closest('table');
|
|
142
|
-
|
|
143
124
|
if (!tableRef) {
|
|
144
125
|
return tr;
|
|
145
126
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
127
|
+
var layout = normaliseTableLayout(tableRef === null || tableRef === void 0 ? void 0 : tableRef.dataset.layout);
|
|
128
|
+
// The is the width the table can reach before overflowing
|
|
149
129
|
var maxSize = getTableMaxWidth({
|
|
150
130
|
table: table.node,
|
|
151
131
|
tableStart: table.start,
|
|
@@ -162,13 +142,13 @@ export var rescaleColumns = function rescaleColumns(getEditorContainerWidth) {
|
|
|
162
142
|
maxSize: maxSize
|
|
163
143
|
});
|
|
164
144
|
var previousTableWidth = resizeState.tableWidth - tableNewColumnMinWidth;
|
|
165
|
-
var tableDidntPreviouslyOverflow = previousTableWidth <= maxSize;
|
|
166
|
-
// we resize the cells to avoid the overflow occuring
|
|
145
|
+
var tableDidntPreviouslyOverflow = previousTableWidth <= maxSize;
|
|
167
146
|
|
|
147
|
+
// If the new table width will result in the table going into an overflow state
|
|
148
|
+
// we resize the cells to avoid the overflow occuring
|
|
168
149
|
if (tableDidntPreviouslyOverflow && resizeState.overflow) {
|
|
169
150
|
resizeState = scaleTableTo(resizeState, maxSize);
|
|
170
151
|
}
|
|
171
|
-
|
|
172
152
|
return updateColumnWidths(resizeState, table.node, table.start)(tr);
|
|
173
153
|
};
|
|
174
154
|
};
|