@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
|
@@ -39,13 +39,8 @@ Object.defineProperty(exports, "updateStickyState", {
|
|
|
39
39
|
return _commands.updateStickyState;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
|
|
43
42
|
var _plugin = require("./plugin");
|
|
44
|
-
|
|
45
43
|
var _pluginKey = require("./plugin-key");
|
|
46
|
-
|
|
47
44
|
var _util = require("./util");
|
|
48
|
-
|
|
49
45
|
var _commands = require("./commands");
|
|
50
|
-
|
|
51
46
|
var _tableRow = require("./nodeviews/tableRow");
|
|
@@ -4,43 +4,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getTree = exports.getTop = void 0;
|
|
7
|
-
|
|
8
7
|
var getTree = function getTree(tr) {
|
|
9
8
|
// pm renders into tbody, owned by react
|
|
10
9
|
var tbody = tr.parentElement;
|
|
11
|
-
|
|
12
10
|
if (!tbody) {
|
|
13
11
|
return null;
|
|
14
|
-
}
|
|
15
|
-
|
|
12
|
+
}
|
|
16
13
|
|
|
14
|
+
// rendered by react
|
|
17
15
|
var table = tbody.parentElement;
|
|
18
|
-
|
|
19
16
|
if (!table) {
|
|
20
17
|
return null;
|
|
21
|
-
}
|
|
22
|
-
|
|
18
|
+
}
|
|
23
19
|
|
|
20
|
+
// rendered by react
|
|
24
21
|
var wrapper = table.parentElement;
|
|
25
|
-
|
|
26
22
|
if (!wrapper) {
|
|
27
23
|
return null;
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
return {
|
|
31
26
|
wrapper: wrapper,
|
|
32
27
|
table: table
|
|
33
28
|
};
|
|
34
29
|
};
|
|
35
|
-
|
|
36
30
|
exports.getTree = getTree;
|
|
37
|
-
|
|
38
31
|
var getTop = function getTop(element) {
|
|
39
32
|
if (!element || element instanceof Window) {
|
|
40
33
|
return 0;
|
|
41
34
|
}
|
|
42
|
-
|
|
43
35
|
return element.getBoundingClientRect().top;
|
|
44
36
|
};
|
|
45
|
-
|
|
46
37
|
exports.getTop = getTop;
|
|
@@ -1,44 +1,29 @@
|
|
|
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.supportedHeaderRow = exports.TableRowNodeView = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
11
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
17
|
-
|
|
18
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
19
|
-
|
|
20
13
|
var _types = require("../../../types");
|
|
21
|
-
|
|
22
14
|
var _consts = require("../../../ui/consts");
|
|
23
|
-
|
|
24
15
|
var _pluginKey = require("../../plugin-key");
|
|
25
|
-
|
|
26
16
|
var _dom = require("../../table-resizing/utils/dom");
|
|
27
|
-
|
|
28
17
|
var _commands = require("../commands");
|
|
29
|
-
|
|
30
18
|
var _dom2 = require("./dom");
|
|
31
|
-
|
|
32
19
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
33
|
-
|
|
34
20
|
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
35
|
-
|
|
36
21
|
// limit scroll event calls
|
|
37
|
-
var HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
|
|
38
|
-
// if too short it would trigger too many dom updates.
|
|
22
|
+
var HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
|
|
39
23
|
|
|
24
|
+
// timeout for resetting the scroll class - if it’s too long then users won’t be able to click on the header cells,
|
|
25
|
+
// if too short it would trigger too many dom updates.
|
|
40
26
|
var HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT = 400;
|
|
41
|
-
|
|
42
27
|
var anyChildCellMergedAcrossRow = function anyChildCellMergedAcrossRow(node) {
|
|
43
28
|
return (0, _utils.mapChildren)(node, function (child) {
|
|
44
29
|
return child.attrs.rowspan || 0;
|
|
@@ -46,12 +31,11 @@ var anyChildCellMergedAcrossRow = function anyChildCellMergedAcrossRow(node) {
|
|
|
46
31
|
return rowspan > 1;
|
|
47
32
|
});
|
|
48
33
|
};
|
|
34
|
+
|
|
49
35
|
/**
|
|
50
36
|
* Compare two table row nodes and return true if the two table rows have a
|
|
51
37
|
* different number of table cells or if table cell row spans are different
|
|
52
38
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
39
|
var rowHasDifferentMergedCells = function rowHasDifferentMergedCells(prevNode, incomingNode) {
|
|
56
40
|
var incomingNodeChildrenRowSpan = (0, _utils.mapChildren)(prevNode, function (child) {
|
|
57
41
|
return child.attrs.rowspan || 0;
|
|
@@ -63,6 +47,7 @@ var rowHasDifferentMergedCells = function rowHasDifferentMergedCells(prevNode, i
|
|
|
63
47
|
return child !== incomingNodeChildrenRowSpan[index];
|
|
64
48
|
});
|
|
65
49
|
};
|
|
50
|
+
|
|
66
51
|
/**
|
|
67
52
|
* Check if a given node is a header row with this definition:
|
|
68
53
|
* - all children are tableHeader cells
|
|
@@ -71,8 +56,6 @@ var rowHasDifferentMergedCells = function rowHasDifferentMergedCells(prevNode, i
|
|
|
71
56
|
* @param node ProseMirror node
|
|
72
57
|
* @return boolean if it meets definition
|
|
73
58
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
59
|
var supportedHeaderRow = function supportedHeaderRow(node) {
|
|
77
60
|
var allHeaders = (0, _utils.mapChildren)(node, function (child) {
|
|
78
61
|
return child.type.name === 'tableHeader';
|
|
@@ -80,13 +63,10 @@ var supportedHeaderRow = function supportedHeaderRow(node) {
|
|
|
80
63
|
var someMerged = anyChildCellMergedAcrossRow(node);
|
|
81
64
|
return allHeaders && !someMerged;
|
|
82
65
|
};
|
|
83
|
-
|
|
84
66
|
exports.supportedHeaderRow = supportedHeaderRow;
|
|
85
|
-
|
|
86
67
|
var TableRowNodeView = /*#__PURE__*/function () {
|
|
87
68
|
function TableRowNodeView(node, view, getPos, eventDispatcher, getEditorFeatureFlags) {
|
|
88
69
|
var _this = this;
|
|
89
|
-
|
|
90
70
|
(0, _classCallCheck2.default)(this, TableRowNodeView);
|
|
91
71
|
(0, _defineProperty2.default)(this, "colControlsOffset", 0);
|
|
92
72
|
(0, _defineProperty2.default)(this, "focused", false);
|
|
@@ -100,7 +80,6 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
100
80
|
(0, _defineProperty2.default)(this, "headerRowMouseScroll", (0, _throttle.default)(function () {
|
|
101
81
|
if (_this.isSticky) {
|
|
102
82
|
_this.dom.classList.add('no-pointer-events');
|
|
103
|
-
|
|
104
83
|
_this.headerRowMouseScrollEnd();
|
|
105
84
|
}
|
|
106
85
|
}, HEADER_ROW_SCROLL_THROTTLE_TIMEOUT));
|
|
@@ -108,9 +87,9 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
108
87
|
if (!_this.tree) {
|
|
109
88
|
return;
|
|
110
89
|
}
|
|
90
|
+
_this.latestDomTop = (0, _dom2.getTop)(_this.tree.wrapper);
|
|
111
91
|
|
|
112
|
-
|
|
113
|
-
|
|
92
|
+
// kick off rAF loop again if it hasn't already happened
|
|
114
93
|
if (!_this.nextFrame) {
|
|
115
94
|
_this.loop();
|
|
116
95
|
}
|
|
@@ -120,43 +99,39 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
120
99
|
if (_this.previousDomTop === _this.latestDomTop && _this.previousPadding === _this.padding) {
|
|
121
100
|
_this.nextFrame = undefined;
|
|
122
101
|
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
102
|
+
}
|
|
125
103
|
|
|
104
|
+
// can't store these since React might re-render at any time
|
|
126
105
|
var tree = _this.tree;
|
|
127
|
-
|
|
128
106
|
if (!tree) {
|
|
129
107
|
_this.nextFrame = undefined;
|
|
130
108
|
return;
|
|
131
109
|
}
|
|
110
|
+
_this.paint(tree);
|
|
132
111
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
112
|
+
// run again on next frame
|
|
136
113
|
_this.previousPadding = _this.padding;
|
|
137
114
|
_this.previousDomTop = _this.latestDomTop;
|
|
138
|
-
|
|
139
115
|
_this.loop();
|
|
140
116
|
});
|
|
141
117
|
});
|
|
142
118
|
(0, _defineProperty2.default)(this, "paint", function (tree) {
|
|
143
119
|
var table = tree.table,
|
|
144
|
-
|
|
145
|
-
// The jumpiness happen under that time and this is to avoid it.
|
|
120
|
+
wrapper = tree.wrapper;
|
|
146
121
|
|
|
122
|
+
// If the previous refresh is less than 10ms then don't do anything.
|
|
123
|
+
// The jumpiness happen under that time and this is to avoid it.
|
|
147
124
|
var timelapse = Math.abs(performance.now() - _this.lastTimePainted);
|
|
148
|
-
|
|
149
125
|
if (timelapse < 10) {
|
|
150
126
|
return;
|
|
151
127
|
}
|
|
152
|
-
|
|
153
128
|
if (_this.shouldHeaderStick(tree)) {
|
|
154
129
|
_this.makeHeaderRowSticky(tree);
|
|
155
130
|
} else {
|
|
156
131
|
_this.makeRowHeaderNotSticky(table);
|
|
157
|
-
}
|
|
158
|
-
|
|
132
|
+
}
|
|
159
133
|
|
|
134
|
+
// ensure scroll positions are locked
|
|
160
135
|
_this.dom.scrollLeft = wrapper.scrollLeft;
|
|
161
136
|
_this.lastTimePainted = performance.now();
|
|
162
137
|
});
|
|
@@ -164,12 +139,11 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
164
139
|
var tableRef = state.tableRef;
|
|
165
140
|
var focusChanged = false;
|
|
166
141
|
var tree = _this.tree;
|
|
167
|
-
|
|
168
142
|
if (!tree) {
|
|
169
143
|
return;
|
|
170
|
-
}
|
|
171
|
-
|
|
144
|
+
}
|
|
172
145
|
|
|
146
|
+
// when header rows are toggled off - mark sentinels as unobserved
|
|
173
147
|
if (!state.isHeaderRowEnabled) {
|
|
174
148
|
[_this.sentinels.top, _this.sentinels.bottom].forEach(function (el) {
|
|
175
149
|
if (el) {
|
|
@@ -177,26 +151,22 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
177
151
|
}
|
|
178
152
|
});
|
|
179
153
|
}
|
|
154
|
+
var isCurrentTableSelected = tableRef === tree.table;
|
|
180
155
|
|
|
181
|
-
|
|
182
|
-
|
|
156
|
+
// If current table selected and header row is toggled off, turn off sticky header
|
|
183
157
|
if (isCurrentTableSelected && !state.isHeaderRowEnabled && _this.tree) {
|
|
184
158
|
_this.makeRowHeaderNotSticky(_this.tree.table);
|
|
185
159
|
}
|
|
186
|
-
|
|
187
160
|
if (isCurrentTableSelected !== _this.focused) {
|
|
188
161
|
focusChanged = true;
|
|
189
162
|
}
|
|
190
|
-
|
|
191
163
|
_this.focused = isCurrentTableSelected;
|
|
192
164
|
var wrapper = tree.wrapper;
|
|
193
165
|
var tableContainer = wrapper.parentElement;
|
|
194
166
|
var tableContentWrapper = tableContainer.parentElement;
|
|
195
167
|
var layoutContainer = tableContentWrapper && tableContentWrapper.parentElement;
|
|
196
|
-
|
|
197
168
|
if (isCurrentTableSelected) {
|
|
198
169
|
_this.colControlsOffset = _consts.tableControlsSpacing;
|
|
199
|
-
|
|
200
170
|
if (layoutContainer && layoutContainer.getAttribute('data-layout-content')) {
|
|
201
171
|
// move table a little out of the way
|
|
202
172
|
// to provide spacing for table controls
|
|
@@ -204,109 +174,89 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
204
174
|
}
|
|
205
175
|
} else {
|
|
206
176
|
_this.colControlsOffset = 0;
|
|
207
|
-
|
|
208
177
|
if (layoutContainer && layoutContainer.getAttribute('data-layout-content')) {
|
|
209
178
|
tableContentWrapper.style.removeProperty('padding-left');
|
|
210
179
|
}
|
|
211
|
-
}
|
|
212
|
-
|
|
180
|
+
}
|
|
213
181
|
|
|
182
|
+
// run after table style changes have been committed
|
|
214
183
|
setTimeout(function () {
|
|
215
184
|
// if focus changed while header is sticky - still repaint the positions will shift
|
|
216
185
|
if (!_this.stickyHeadersOptimization || focusChanged && _this.isSticky) {
|
|
217
186
|
_this.paint(tree);
|
|
218
187
|
}
|
|
219
|
-
|
|
220
188
|
(0, _dom.syncStickyRowToTable)(tree.table);
|
|
221
189
|
}, 0);
|
|
222
190
|
});
|
|
223
191
|
(0, _defineProperty2.default)(this, "onWidthPluginState", function () {
|
|
224
192
|
// table width might have changed, sync that back to sticky row
|
|
225
193
|
var tree = _this.tree;
|
|
226
|
-
|
|
227
194
|
if (!tree) {
|
|
228
195
|
return;
|
|
229
196
|
}
|
|
230
|
-
|
|
231
197
|
(0, _dom.syncStickyRowToTable)(tree.table);
|
|
232
198
|
});
|
|
233
199
|
(0, _defineProperty2.default)(this, "shouldHeaderStick", function (tree) {
|
|
234
200
|
var wrapper = tree.wrapper;
|
|
235
201
|
var tableWrapperRect = wrapper.getBoundingClientRect();
|
|
236
|
-
|
|
237
202
|
var editorAreaRect = _this.editorScrollableElement.getBoundingClientRect();
|
|
238
|
-
|
|
239
203
|
var stickyHeaderRect = _this.contentDOM.getBoundingClientRect();
|
|
240
|
-
|
|
241
204
|
var firstHeaderRow = !_this.dom.previousElementSibling;
|
|
242
205
|
var subsequentRows = !!_this.dom.nextElementSibling;
|
|
243
|
-
var isHeaderValid = firstHeaderRow && subsequentRows;
|
|
206
|
+
var isHeaderValid = firstHeaderRow && subsequentRows;
|
|
207
|
+
|
|
208
|
+
// if the table wrapper is less than the editor top pos then make it sticky
|
|
244
209
|
// Make header sticky if table wrapper top is outside viewport
|
|
245
210
|
// but bottom is still in the viewport.
|
|
246
|
-
|
|
247
211
|
if (tableWrapperRect.top < editorAreaRect.top && tableWrapperRect.bottom > editorAreaRect.top && isHeaderValid) {
|
|
248
212
|
return true;
|
|
249
|
-
}
|
|
250
|
-
|
|
213
|
+
}
|
|
251
214
|
|
|
215
|
+
// if the sticky header is below the editor area make it non-sticky
|
|
252
216
|
if (stickyHeaderRect.top > editorAreaRect.top) {
|
|
253
217
|
return false;
|
|
254
|
-
}
|
|
255
|
-
|
|
218
|
+
}
|
|
256
219
|
|
|
220
|
+
// otherwise make it non-sticky
|
|
257
221
|
return false;
|
|
258
222
|
});
|
|
259
223
|
(0, _defineProperty2.default)(this, "makeHeaderRowSticky", function (tree) {
|
|
260
224
|
var _tbody$firstChild;
|
|
261
|
-
|
|
262
225
|
// If header row height is more than 50% of viewport height don't do this
|
|
263
226
|
if (_this.stickyRowHeight && _this.stickyRowHeight > window.innerHeight / 2) {
|
|
264
227
|
return;
|
|
265
228
|
}
|
|
229
|
+
var table = tree.table;
|
|
266
230
|
|
|
267
|
-
|
|
268
|
-
|
|
231
|
+
// ED-16035 Make sure sticky header is only applied to first row
|
|
269
232
|
var tbody = _this.dom.parentElement;
|
|
270
233
|
var isFirstHeader = tbody === null || tbody === void 0 ? void 0 : (_tbody$firstChild = tbody.firstChild) === null || _tbody$firstChild === void 0 ? void 0 : _tbody$firstChild.isEqualNode(_this.dom);
|
|
271
|
-
|
|
272
234
|
if (!isFirstHeader) {
|
|
273
235
|
return;
|
|
274
236
|
}
|
|
275
|
-
|
|
276
237
|
var currentTableTop = _this.getCurrentTableTop(tree);
|
|
277
|
-
|
|
278
238
|
var domTop = currentTableTop > 0 ? _this.topPosEditorElement : _this.topPosEditorElement + currentTableTop;
|
|
279
|
-
|
|
280
239
|
if (!_this.isSticky) {
|
|
281
240
|
(0, _dom.syncStickyRowToTable)(table);
|
|
282
|
-
|
|
283
241
|
_this.dom.classList.add('sticky');
|
|
284
|
-
|
|
285
242
|
table.classList.add(_types.TableCssClassName.TABLE_STICKY);
|
|
286
243
|
_this.isSticky = true;
|
|
287
244
|
}
|
|
288
|
-
|
|
289
245
|
_this.dom.style.top = "".concat(domTop, "px");
|
|
290
246
|
(0, _dom.updateStickyMargins)(table);
|
|
291
|
-
|
|
292
247
|
_this.emitOn(domTop, _this.colControlsOffset);
|
|
293
248
|
});
|
|
294
249
|
(0, _defineProperty2.default)(this, "makeRowHeaderNotSticky", function (table) {
|
|
295
250
|
var isEditorDestroyed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
296
|
-
|
|
297
251
|
if (!_this.isSticky || !table || !_this.dom) {
|
|
298
252
|
return;
|
|
299
253
|
}
|
|
300
|
-
|
|
301
254
|
_this.dom.style.removeProperty('width');
|
|
302
|
-
|
|
303
255
|
_this.dom.classList.remove('sticky');
|
|
304
|
-
|
|
305
256
|
table.classList.remove(_types.TableCssClassName.TABLE_STICKY);
|
|
306
257
|
_this.isSticky = false;
|
|
307
258
|
_this.dom.style.top = '';
|
|
308
259
|
table.style.removeProperty('margin-top');
|
|
309
|
-
|
|
310
260
|
_this.emitOff(isEditorDestroyed);
|
|
311
261
|
});
|
|
312
262
|
(0, _defineProperty2.default)(this, "getWrapperoffset", function () {
|
|
@@ -329,7 +279,6 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
329
279
|
if (top === _this.top && padding === _this.padding) {
|
|
330
280
|
return;
|
|
331
281
|
}
|
|
332
|
-
|
|
333
282
|
_this.top = top;
|
|
334
283
|
_this.padding = padding;
|
|
335
284
|
(0, _commands.updateStickyState)({
|
|
@@ -343,10 +292,8 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
343
292
|
if (_this.top === 0 && _this.padding === 0) {
|
|
344
293
|
return;
|
|
345
294
|
}
|
|
346
|
-
|
|
347
295
|
_this.top = 0;
|
|
348
296
|
_this.padding = 0;
|
|
349
|
-
|
|
350
297
|
if (!isEditorDestroyed) {
|
|
351
298
|
(0, _commands.updateStickyState)({
|
|
352
299
|
pos: _this.getPos(),
|
|
@@ -368,18 +315,18 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
368
315
|
this.lastTimePainted = 0;
|
|
369
316
|
this.isHeaderRow = supportedHeaderRow(node);
|
|
370
317
|
this.isSticky = false;
|
|
371
|
-
|
|
372
318
|
if (this.isHeaderRow) {
|
|
373
319
|
this.dom.setAttribute('data-header-row', 'true');
|
|
374
320
|
this.subscribe();
|
|
375
321
|
}
|
|
376
322
|
}
|
|
377
|
-
/* external events */
|
|
378
|
-
|
|
379
323
|
|
|
324
|
+
/* external events */
|
|
380
325
|
(0, _createClass2.default)(TableRowNodeView, [{
|
|
381
326
|
key: "tree",
|
|
382
|
-
get:
|
|
327
|
+
get:
|
|
328
|
+
// this is the sticky header table row
|
|
329
|
+
|
|
383
330
|
function get() {
|
|
384
331
|
return (0, _dom2.getTree)(this.dom);
|
|
385
332
|
}
|
|
@@ -387,17 +334,14 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
387
334
|
key: "subscribe",
|
|
388
335
|
value: function subscribe() {
|
|
389
336
|
this.editorScrollableElement = (0, _ui.findOverflowScrollParent)(this.view.dom) || window;
|
|
390
|
-
|
|
391
337
|
if (this.editorScrollableElement) {
|
|
392
338
|
if (this.stickyHeadersOptimization) {
|
|
393
339
|
this.initObservers();
|
|
394
340
|
} else {
|
|
395
341
|
this.editorScrollableElement.addEventListener('scroll', this.onScroll);
|
|
396
342
|
}
|
|
397
|
-
|
|
398
343
|
this.topPosEditorElement = (0, _dom2.getTop)(this.editorScrollableElement);
|
|
399
344
|
}
|
|
400
|
-
|
|
401
345
|
this.eventDispatcher.on('widthPlugin', this.onWidthPluginState);
|
|
402
346
|
this.eventDispatcher.on(_pluginKey.pluginKey.key, this.onTablePluginState);
|
|
403
347
|
this.listening = true;
|
|
@@ -410,50 +354,41 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
410
354
|
if (!this.listening) {
|
|
411
355
|
return;
|
|
412
356
|
}
|
|
413
|
-
|
|
414
357
|
if (this.intersectionObserver) {
|
|
415
358
|
this.intersectionObserver.disconnect();
|
|
416
359
|
}
|
|
417
|
-
|
|
418
360
|
if (this.resizeObserver) {
|
|
419
361
|
this.resizeObserver.disconnect();
|
|
420
362
|
}
|
|
421
|
-
|
|
422
363
|
if (this.editorScrollableElement && !this.stickyHeadersOptimization) {
|
|
423
364
|
this.editorScrollableElement.removeEventListener('scroll', this.onScroll);
|
|
424
365
|
}
|
|
425
|
-
|
|
426
366
|
this.eventDispatcher.off('widthPlugin', this.onWidthPluginState);
|
|
427
367
|
this.eventDispatcher.off(_pluginKey.pluginKey.key, this.onTablePluginState);
|
|
428
368
|
this.listening = false;
|
|
429
369
|
this.dom.removeEventListener('wheel', this.headerRowMouseScroll);
|
|
430
370
|
this.dom.removeEventListener('touchmove', this.headerRowMouseScroll);
|
|
431
|
-
}
|
|
371
|
+
}
|
|
432
372
|
|
|
373
|
+
// initialize intersection observer to track if table is within scroll area
|
|
433
374
|
}, {
|
|
434
375
|
key: "initObservers",
|
|
435
376
|
value: function initObservers() {
|
|
436
377
|
var _this2 = this;
|
|
437
|
-
|
|
438
378
|
if (!this.dom || this.dom.dataset.isObserved) {
|
|
439
379
|
return;
|
|
440
380
|
}
|
|
441
|
-
|
|
442
381
|
this.dom.dataset.isObserved = 'true';
|
|
443
382
|
this.createIntersectionObserver();
|
|
444
383
|
this.createResizeObserver();
|
|
445
|
-
|
|
446
384
|
if (!this.intersectionObserver || !this.resizeObserver) {
|
|
447
385
|
return;
|
|
448
386
|
}
|
|
449
|
-
|
|
450
387
|
this.resizeObserver.observe(this.dom);
|
|
451
388
|
window.requestAnimationFrame(function () {
|
|
452
389
|
var _this2$tree;
|
|
453
|
-
|
|
454
390
|
// we expect tree to be defined after animation frame
|
|
455
391
|
var tableContainer = (_this2$tree = _this2.tree) === null || _this2$tree === void 0 ? void 0 : _this2$tree.wrapper.closest(".".concat(_types.TableCssClassName.NODEVIEW_WRAPPER));
|
|
456
|
-
|
|
457
392
|
if (tableContainer) {
|
|
458
393
|
_this2.sentinels.top = tableContainer.getElementsByClassName(_types.TableCssClassName.TABLE_STICKY_SENTINEL_TOP).item(0);
|
|
459
394
|
_this2.sentinels.bottom = tableContainer.getElementsByClassName(_types.TableCssClassName.TABLE_STICKY_SENTINEL_BOTTOM).item(0);
|
|
@@ -461,30 +396,28 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
461
396
|
// skip if already observed for another row on this table
|
|
462
397
|
if (el && !el.dataset.isObserved) {
|
|
463
398
|
el.dataset.isObserved = 'true';
|
|
464
|
-
|
|
465
399
|
_this2.intersectionObserver.observe(el);
|
|
466
400
|
}
|
|
467
401
|
});
|
|
468
402
|
}
|
|
469
403
|
});
|
|
470
|
-
}
|
|
471
|
-
// to allocate for new header height
|
|
404
|
+
}
|
|
472
405
|
|
|
406
|
+
// updating bottom sentinel position if sticky header height changes
|
|
407
|
+
// to allocate for new header height
|
|
473
408
|
}, {
|
|
474
409
|
key: "createResizeObserver",
|
|
475
410
|
value: function createResizeObserver() {
|
|
476
411
|
var _this3 = this;
|
|
477
|
-
|
|
478
412
|
this.resizeObserver = new ResizeObserver(function (entries) {
|
|
479
413
|
if (!_this3.tree) {
|
|
480
414
|
return;
|
|
481
415
|
}
|
|
482
|
-
|
|
483
416
|
var table = _this3.tree.table;
|
|
484
417
|
entries.forEach(function (entry) {
|
|
485
418
|
var newHeight = entry.contentRect ? entry.contentRect.height : entry.target.offsetHeight;
|
|
486
|
-
|
|
487
|
-
|
|
419
|
+
if (_this3.sentinels.bottom &&
|
|
420
|
+
// When the table header is sticky, it would be taller by a 1px (border-bottom),
|
|
488
421
|
// So we adding this check to allow a 1px difference.
|
|
489
422
|
Math.abs(newHeight - (_this3.stickyRowHeight || 0)) > _consts.stickyHeaderBorderBottomWidth) {
|
|
490
423
|
_this3.stickyRowHeight = newHeight;
|
|
@@ -498,39 +431,31 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
498
431
|
key: "createIntersectionObserver",
|
|
499
432
|
value: function createIntersectionObserver() {
|
|
500
433
|
var _this4 = this;
|
|
501
|
-
|
|
502
434
|
this.intersectionObserver = new IntersectionObserver(function (entries, _) {
|
|
503
435
|
if (!_this4.tree) {
|
|
504
436
|
return;
|
|
505
437
|
}
|
|
506
|
-
|
|
507
438
|
var table = _this4.tree.table;
|
|
508
439
|
entries.forEach(function (entry) {
|
|
509
440
|
var _entry$rootBounds;
|
|
441
|
+
var target = entry.target;
|
|
510
442
|
|
|
511
|
-
|
|
512
|
-
|
|
443
|
+
// if the rootBounds has 0 height, e.g. confluence preview mode, we do nothing.
|
|
513
444
|
if (((_entry$rootBounds = entry.rootBounds) === null || _entry$rootBounds === void 0 ? void 0 : _entry$rootBounds.height) === 0) {
|
|
514
445
|
return;
|
|
515
446
|
}
|
|
516
|
-
|
|
517
447
|
if (target.classList.contains(_types.TableCssClassName.TABLE_STICKY_SENTINEL_TOP)) {
|
|
518
448
|
var _entry$rootBounds2;
|
|
519
|
-
|
|
520
449
|
var sentinelIsBelowScrollArea = (((_entry$rootBounds2 = entry.rootBounds) === null || _entry$rootBounds2 === void 0 ? void 0 : _entry$rootBounds2.bottom) || 0) < entry.boundingClientRect.bottom;
|
|
521
|
-
|
|
522
450
|
if (!entry.isIntersecting && !sentinelIsBelowScrollArea) {
|
|
523
451
|
_this4.tree && _this4.makeHeaderRowSticky(_this4.tree);
|
|
524
452
|
} else {
|
|
525
453
|
table && _this4.makeRowHeaderNotSticky(table);
|
|
526
454
|
}
|
|
527
455
|
}
|
|
528
|
-
|
|
529
456
|
if (target.classList.contains(_types.TableCssClassName.TABLE_STICKY_SENTINEL_BOTTOM)) {
|
|
530
457
|
var _entry$rootBounds3;
|
|
531
|
-
|
|
532
458
|
var sentinelIsAboveScrollArea = entry.boundingClientRect.top - _this4.dom.offsetHeight < (((_entry$rootBounds3 = entry.rootBounds) === null || _entry$rootBounds3 === void 0 ? void 0 : _entry$rootBounds3.top) || 0);
|
|
533
|
-
|
|
534
459
|
if (table && !entry.isIntersecting && sentinelIsAboveScrollArea) {
|
|
535
460
|
_this4.makeRowHeaderNotSticky(table);
|
|
536
461
|
} else if (entry.isIntersecting && sentinelIsAboveScrollArea) {
|
|
@@ -542,38 +467,37 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
542
467
|
root: this.editorScrollableElement
|
|
543
468
|
});
|
|
544
469
|
}
|
|
545
|
-
/* paint/update loop */
|
|
546
470
|
|
|
471
|
+
/* paint/update loop */
|
|
547
472
|
}, {
|
|
548
473
|
key: "update",
|
|
549
|
-
value:
|
|
550
|
-
/* nodeview lifecycle */
|
|
474
|
+
value: /* nodeview lifecycle */
|
|
551
475
|
function update(node) {
|
|
552
476
|
// do nothing if nodes were identical
|
|
553
477
|
if (node === this.node) {
|
|
554
478
|
return true;
|
|
555
|
-
}
|
|
556
|
-
// changing away from one
|
|
557
|
-
|
|
479
|
+
}
|
|
558
480
|
|
|
481
|
+
// see if we're changing into a header row or
|
|
482
|
+
// changing away from one
|
|
559
483
|
var newNodeIsHeaderRow = supportedHeaderRow(node);
|
|
560
|
-
|
|
561
484
|
if (this.isHeaderRow !== newNodeIsHeaderRow) {
|
|
562
485
|
return false; // re-create nodeview
|
|
563
486
|
}
|
|
564
487
|
|
|
565
488
|
if (rowHasDifferentMergedCells(this.node, node)) {
|
|
566
489
|
return false;
|
|
567
|
-
}
|
|
568
|
-
|
|
490
|
+
}
|
|
569
491
|
|
|
570
|
-
|
|
492
|
+
// node is different but no need to re-create nodeview
|
|
493
|
+
this.node = node;
|
|
571
494
|
|
|
495
|
+
// don't do anything if we're just a regular tr
|
|
572
496
|
if (!this.isHeaderRow) {
|
|
573
497
|
return true;
|
|
574
|
-
}
|
|
575
|
-
|
|
498
|
+
}
|
|
576
499
|
|
|
500
|
+
// something changed, sync widths
|
|
577
501
|
var tbody = this.dom.parentElement;
|
|
578
502
|
var table = tbody && tbody.parentElement;
|
|
579
503
|
(0, _dom.syncStickyRowToTable)(table);
|
|
@@ -583,11 +507,9 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
583
507
|
key: "destroy",
|
|
584
508
|
value: function destroy() {
|
|
585
509
|
this.unsubscribe();
|
|
586
|
-
|
|
587
510
|
if (this.tree) {
|
|
588
511
|
this.makeRowHeaderNotSticky(this.tree.table, true);
|
|
589
512
|
}
|
|
590
|
-
|
|
591
513
|
this.emitOff(true);
|
|
592
514
|
}
|
|
593
515
|
}, {
|
|
@@ -609,19 +531,15 @@ var TableRowNodeView = /*#__PURE__*/function () {
|
|
|
609
531
|
* from the composition end is ignored than prosemirror will end up with; invalid table markup nesting and a misplaced
|
|
610
532
|
* selection and insertion.
|
|
611
533
|
*/
|
|
612
|
-
|
|
613
534
|
var isNodeInsertion = mutationRecord.type === 'childList' && mutationRecord.target.nodeName === 'TR' && mutationRecord.addedNodes.length;
|
|
614
|
-
|
|
615
535
|
if (isTableSelection || isNodeInsertion) {
|
|
616
536
|
return false;
|
|
617
537
|
}
|
|
618
|
-
|
|
619
538
|
return true;
|
|
620
539
|
}
|
|
621
|
-
/* receive external events */
|
|
622
540
|
|
|
541
|
+
/* receive external events */
|
|
623
542
|
}]);
|
|
624
543
|
return TableRowNodeView;
|
|
625
544
|
}();
|
|
626
|
-
|
|
627
545
|
exports.TableRowNodeView = TableRowNodeView;
|