@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,46 +1,30 @@
|
|
|
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.triggerUnlessTableHeader = exports.transformSliceToRemoveColumnsWidths = exports.transformSliceToAddTableHeaders = exports.transformSliceRemoveCellBackgroundColor = exports.showInsertRowButton = exports.showInsertColumnButton = exports.setTableRef = exports.setMultipleCellAttrs = exports.setEditorFocus = exports.setCellAttr = exports.selectRow = exports.selectColumn = exports.moveCursorBackward = exports.hideInsertColumnOrRowButton = exports.deleteTableIfSelected = exports.deleteTable = exports.convertFirstRowToHeader = exports.autoSizeTable = exports.addResizeHandleDecorations = exports.addBoldInEmptyHeaderCells = void 0;
|
|
9
|
-
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
9
|
var _prosemirrorState = require("prosemirror-state");
|
|
13
|
-
|
|
14
10
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
15
|
-
|
|
16
11
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
17
|
-
|
|
18
12
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
19
|
-
|
|
20
13
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
21
|
-
|
|
22
14
|
var _plugin = require("../pm-plugins/decorations/plugin");
|
|
23
|
-
|
|
24
15
|
var _utils3 = require("../pm-plugins/decorations/utils");
|
|
25
|
-
|
|
26
16
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
27
|
-
|
|
28
17
|
var _transforms = require("../transforms");
|
|
29
|
-
|
|
30
18
|
var _types = require("../types");
|
|
31
|
-
|
|
32
19
|
var _decoration = require("../utils/decoration");
|
|
33
|
-
|
|
34
20
|
var _nodes = require("../utils/nodes");
|
|
35
|
-
|
|
36
21
|
var _updatePluginStateDecorations = require("../utils/update-plugin-state-decorations");
|
|
37
|
-
|
|
38
22
|
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; }
|
|
39
|
-
|
|
40
23
|
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; }
|
|
41
|
-
|
|
42
24
|
// #endregion
|
|
25
|
+
|
|
43
26
|
// #endregion
|
|
27
|
+
|
|
44
28
|
// #region Commands
|
|
45
29
|
var setEditorFocus = function setEditorFocus(editorHasFocus) {
|
|
46
30
|
return (0, _pluginFactory.createCommand)({
|
|
@@ -50,9 +34,7 @@ var setEditorFocus = function setEditorFocus(editorHasFocus) {
|
|
|
50
34
|
}
|
|
51
35
|
});
|
|
52
36
|
};
|
|
53
|
-
|
|
54
37
|
exports.setEditorFocus = setEditorFocus;
|
|
55
|
-
|
|
56
38
|
var setTableRef = function setTableRef(ref) {
|
|
57
39
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
58
40
|
var tableRef = ref;
|
|
@@ -82,14 +64,11 @@ var setTableRef = function setTableRef(ref) {
|
|
|
82
64
|
return tr.setMeta('addToHistory', false);
|
|
83
65
|
});
|
|
84
66
|
};
|
|
85
|
-
|
|
86
67
|
exports.setTableRef = setTableRef;
|
|
87
|
-
|
|
88
68
|
var setCellAttr = function setCellAttr(name, value) {
|
|
89
69
|
return function (state, dispatch) {
|
|
90
70
|
var tr = state.tr,
|
|
91
|
-
|
|
92
|
-
|
|
71
|
+
selection = state.selection;
|
|
93
72
|
if (selection instanceof _cellSelection.CellSelection) {
|
|
94
73
|
var updated = false;
|
|
95
74
|
selection.forEachCell(function (cell, pos) {
|
|
@@ -98,88 +77,68 @@ var setCellAttr = function setCellAttr(name, value) {
|
|
|
98
77
|
updated = true;
|
|
99
78
|
}
|
|
100
79
|
});
|
|
101
|
-
|
|
102
80
|
if (updated) {
|
|
103
81
|
if (dispatch) {
|
|
104
82
|
dispatch(tr);
|
|
105
83
|
}
|
|
106
|
-
|
|
107
84
|
return true;
|
|
108
85
|
}
|
|
109
86
|
} else {
|
|
110
87
|
var cell = (0, _utils.selectionCell)(state.selection);
|
|
111
|
-
|
|
112
88
|
if (cell) {
|
|
113
89
|
if (dispatch) {
|
|
114
90
|
var _cell$nodeAfter, _cell$nodeAfter2;
|
|
115
|
-
|
|
116
91
|
dispatch(tr.setNodeMarkup(cell.pos, (_cell$nodeAfter = cell.nodeAfter) === null || _cell$nodeAfter === void 0 ? void 0 : _cell$nodeAfter.type, _objectSpread(_objectSpread({}, (_cell$nodeAfter2 = cell.nodeAfter) === null || _cell$nodeAfter2 === void 0 ? void 0 : _cell$nodeAfter2.attrs), {}, (0, _defineProperty2.default)({}, name, value))));
|
|
117
92
|
}
|
|
118
|
-
|
|
119
93
|
return true;
|
|
120
94
|
}
|
|
121
95
|
}
|
|
122
|
-
|
|
123
96
|
return false;
|
|
124
97
|
};
|
|
125
98
|
};
|
|
126
|
-
|
|
127
99
|
exports.setCellAttr = setCellAttr;
|
|
128
|
-
|
|
129
100
|
var triggerUnlessTableHeader = function triggerUnlessTableHeader(command) {
|
|
130
101
|
return function (state, dispatch, view) {
|
|
131
102
|
var selection = state.selection,
|
|
132
|
-
|
|
133
|
-
|
|
103
|
+
tableHeader = state.schema.nodes.tableHeader;
|
|
134
104
|
if (selection instanceof _prosemirrorState.TextSelection) {
|
|
135
105
|
var cell = (0, _utils.findCellClosestToPos)(selection.$from);
|
|
136
|
-
|
|
137
106
|
if (cell && cell.node.type !== tableHeader) {
|
|
138
107
|
return command(state, dispatch, view);
|
|
139
108
|
}
|
|
140
109
|
}
|
|
141
|
-
|
|
142
110
|
if (selection instanceof _cellSelection.CellSelection) {
|
|
143
111
|
var rect = (0, _utils.getSelectionRect)(selection);
|
|
144
|
-
|
|
145
112
|
if (!(0, _nodes.checkIfHeaderRowEnabled)(selection) || rect && rect.top > 0) {
|
|
146
113
|
return command(state, dispatch, view);
|
|
147
114
|
}
|
|
148
115
|
}
|
|
149
|
-
|
|
150
116
|
return false;
|
|
151
117
|
};
|
|
152
118
|
};
|
|
153
|
-
|
|
154
119
|
exports.triggerUnlessTableHeader = triggerUnlessTableHeader;
|
|
155
|
-
|
|
156
120
|
var transformSliceRemoveCellBackgroundColor = function transformSliceRemoveCellBackgroundColor(slice, schema) {
|
|
157
121
|
var _schema$nodes = schema.nodes,
|
|
158
|
-
|
|
159
|
-
|
|
122
|
+
tableCell = _schema$nodes.tableCell,
|
|
123
|
+
tableHeader = _schema$nodes.tableHeader;
|
|
160
124
|
return (0, _utils2.mapSlice)(slice, function (maybeCell) {
|
|
161
125
|
if (maybeCell.type === tableCell || maybeCell.type === tableHeader) {
|
|
162
126
|
var cellAttrs = _objectSpread({}, maybeCell.attrs);
|
|
163
|
-
|
|
164
127
|
cellAttrs.background = undefined;
|
|
165
128
|
return maybeCell.type.createChecked(cellAttrs, maybeCell.content, maybeCell.marks);
|
|
166
129
|
}
|
|
167
|
-
|
|
168
130
|
return maybeCell;
|
|
169
131
|
});
|
|
170
132
|
};
|
|
171
|
-
|
|
172
133
|
exports.transformSliceRemoveCellBackgroundColor = transformSliceRemoveCellBackgroundColor;
|
|
173
|
-
|
|
174
134
|
var transformSliceToAddTableHeaders = function transformSliceToAddTableHeaders(slice, schema) {
|
|
175
135
|
var _schema$nodes2 = schema.nodes,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
136
|
+
table = _schema$nodes2.table,
|
|
137
|
+
tableHeader = _schema$nodes2.tableHeader,
|
|
138
|
+
tableRow = _schema$nodes2.tableRow;
|
|
179
139
|
return (0, _utils2.mapSlice)(slice, function (maybeTable) {
|
|
180
140
|
if (maybeTable.type === table) {
|
|
181
141
|
var firstRow = maybeTable.firstChild;
|
|
182
|
-
|
|
183
142
|
if (firstRow) {
|
|
184
143
|
var headerCols = [];
|
|
185
144
|
firstRow.forEach(function (oldCol) {
|
|
@@ -189,147 +148,120 @@ var transformSliceToAddTableHeaders = function transformSliceToAddTableHeaders(s
|
|
|
189
148
|
return maybeTable.copy(maybeTable.content.replaceChild(0, headerRow));
|
|
190
149
|
}
|
|
191
150
|
}
|
|
192
|
-
|
|
193
151
|
return maybeTable;
|
|
194
152
|
});
|
|
195
153
|
};
|
|
196
|
-
|
|
197
154
|
exports.transformSliceToAddTableHeaders = transformSliceToAddTableHeaders;
|
|
198
|
-
|
|
199
155
|
var transformSliceToRemoveColumnsWidths = function transformSliceToRemoveColumnsWidths(slice, schema) {
|
|
200
156
|
var _schema$nodes3 = schema.nodes,
|
|
201
|
-
|
|
202
|
-
|
|
157
|
+
tableHeader = _schema$nodes3.tableHeader,
|
|
158
|
+
tableCell = _schema$nodes3.tableCell;
|
|
203
159
|
return (0, _utils2.mapSlice)(slice, function (maybeCell) {
|
|
204
160
|
if (maybeCell.type === tableCell || maybeCell.type === tableHeader) {
|
|
205
161
|
if (!maybeCell.attrs.colwidth) {
|
|
206
162
|
return maybeCell;
|
|
207
163
|
}
|
|
208
|
-
|
|
209
164
|
return maybeCell.type.createChecked(_objectSpread(_objectSpread({}, maybeCell.attrs), {}, {
|
|
210
165
|
colwidth: undefined
|
|
211
166
|
}), maybeCell.content, maybeCell.marks);
|
|
212
167
|
}
|
|
213
|
-
|
|
214
168
|
return maybeCell;
|
|
215
169
|
});
|
|
216
170
|
};
|
|
217
|
-
|
|
218
171
|
exports.transformSliceToRemoveColumnsWidths = transformSliceToRemoveColumnsWidths;
|
|
219
|
-
|
|
220
172
|
var deleteTable = function deleteTable(state, dispatch) {
|
|
221
173
|
if (dispatch) {
|
|
222
174
|
dispatch((0, _utils.removeTable)(state.tr));
|
|
223
175
|
}
|
|
224
|
-
|
|
225
176
|
return true;
|
|
226
177
|
};
|
|
227
|
-
|
|
228
178
|
exports.deleteTable = deleteTable;
|
|
229
|
-
|
|
230
179
|
var deleteTableIfSelected = function deleteTableIfSelected(state, dispatch) {
|
|
231
180
|
if ((0, _utils.isTableSelected)(state.selection)) {
|
|
232
181
|
return deleteTable(state, dispatch);
|
|
233
182
|
}
|
|
234
|
-
|
|
235
183
|
return false;
|
|
236
184
|
};
|
|
237
|
-
|
|
238
185
|
exports.deleteTableIfSelected = deleteTableIfSelected;
|
|
239
|
-
|
|
240
186
|
var convertFirstRowToHeader = function convertFirstRowToHeader(schema) {
|
|
241
187
|
return function (tr) {
|
|
242
188
|
var table = (0, _utils.findTable)(tr.selection);
|
|
243
|
-
|
|
244
189
|
var map = _tableMap.TableMap.get(table.node);
|
|
245
|
-
|
|
246
190
|
for (var i = 0; i < map.width; i++) {
|
|
247
191
|
var cell = table.node.child(0).child(i);
|
|
248
192
|
tr.setNodeMarkup(table.start + map.map[i], schema.nodes.tableHeader, cell.attrs);
|
|
249
193
|
}
|
|
250
|
-
|
|
251
194
|
return tr;
|
|
252
195
|
};
|
|
253
196
|
};
|
|
254
|
-
|
|
255
197
|
exports.convertFirstRowToHeader = convertFirstRowToHeader;
|
|
256
|
-
|
|
257
198
|
var moveCursorBackward = function moveCursorBackward(state, dispatch) {
|
|
258
199
|
var _ref = state.selection,
|
|
259
|
-
|
|
260
|
-
|
|
200
|
+
$cursor = _ref.$cursor;
|
|
201
|
+
// if cursor is in the middle of a text node, do nothing
|
|
261
202
|
if (!$cursor || $cursor.parentOffset > 0) {
|
|
262
203
|
return false;
|
|
263
|
-
}
|
|
264
|
-
|
|
204
|
+
}
|
|
265
205
|
|
|
206
|
+
// find the node before the cursor
|
|
266
207
|
var before;
|
|
267
208
|
var cut;
|
|
268
|
-
|
|
269
209
|
if (!(0, _nodes.isIsolating)($cursor.parent)) {
|
|
270
210
|
for (var i = $cursor.depth - 1; !before && i >= 0; i--) {
|
|
271
211
|
if ($cursor.index(i) > 0) {
|
|
272
212
|
cut = $cursor.before(i + 1);
|
|
273
213
|
before = $cursor.node(i).child($cursor.index(i) - 1);
|
|
274
214
|
}
|
|
275
|
-
|
|
276
215
|
if ((0, _nodes.isIsolating)($cursor.node(i))) {
|
|
277
216
|
break;
|
|
278
217
|
}
|
|
279
218
|
}
|
|
280
|
-
}
|
|
281
|
-
|
|
219
|
+
}
|
|
282
220
|
|
|
221
|
+
// if the node before is not a table node - do nothing
|
|
283
222
|
if (!before || before.type !== state.schema.nodes.table) {
|
|
284
223
|
return false;
|
|
285
224
|
}
|
|
225
|
+
|
|
286
226
|
/*
|
|
287
227
|
ensure we're just at a top level paragraph
|
|
288
228
|
otherwise, perform regular backspace behaviour
|
|
289
229
|
*/
|
|
290
|
-
|
|
291
|
-
|
|
292
230
|
var grandparent = $cursor.node($cursor.depth - 1);
|
|
293
|
-
|
|
294
231
|
if ($cursor.parent.type !== state.schema.nodes.paragraph || grandparent && grandparent.type !== state.schema.nodes.doc) {
|
|
295
232
|
return false;
|
|
296
233
|
}
|
|
297
|
-
|
|
298
234
|
var tr = state.tr;
|
|
299
|
-
var lastCellPos = (cut || 0) - 4;
|
|
300
|
-
|
|
235
|
+
var lastCellPos = (cut || 0) - 4;
|
|
236
|
+
// need to move cursor inside the table to be able to calculate table's offset
|
|
301
237
|
tr.setSelection(new _prosemirrorState.TextSelection(state.doc.resolve(lastCellPos)));
|
|
302
238
|
var $from = tr.selection.$from;
|
|
303
239
|
var start = $from.start(-1);
|
|
304
|
-
var pos = start + $from.parent.nodeSize - 1;
|
|
240
|
+
var pos = start + $from.parent.nodeSize - 1;
|
|
241
|
+
|
|
242
|
+
// move cursor to the last cell
|
|
305
243
|
// it doesn't join node before (last cell) with node after (content after the cursor)
|
|
306
244
|
// due to ridiculous amount of PM code that would have been required to overwrite
|
|
245
|
+
tr.setSelection(new _prosemirrorState.TextSelection(state.doc.resolve(pos)));
|
|
307
246
|
|
|
308
|
-
|
|
309
|
-
|
|
247
|
+
// if we are inside an empty paragraph not at the end of the doc we delete it
|
|
310
248
|
var cursorNode = $cursor.node();
|
|
311
249
|
var docEnd = state.doc.content.size;
|
|
312
250
|
var paragraphWrapStart = $cursor.pos - 1;
|
|
313
251
|
var paragraphWrapEnd = $cursor.pos + 1;
|
|
314
|
-
|
|
315
252
|
if (cursorNode.content.size === 0 && $cursor.pos + 1 !== docEnd) {
|
|
316
253
|
tr.delete(paragraphWrapStart, paragraphWrapEnd);
|
|
317
254
|
}
|
|
318
|
-
|
|
319
255
|
if (dispatch) {
|
|
320
256
|
dispatch(tr);
|
|
321
257
|
}
|
|
322
|
-
|
|
323
258
|
return true;
|
|
324
259
|
};
|
|
325
|
-
|
|
326
260
|
exports.moveCursorBackward = moveCursorBackward;
|
|
327
|
-
|
|
328
261
|
var setMultipleCellAttrs = function setMultipleCellAttrs(attrs, targetCellPosition) {
|
|
329
262
|
return function (state, dispatch) {
|
|
330
263
|
var cursorPos;
|
|
331
264
|
var tr = state.tr;
|
|
332
|
-
|
|
333
265
|
if ((0, _utils.isSelectionType)(tr.selection, 'cell')) {
|
|
334
266
|
var selection = tr.selection;
|
|
335
267
|
selection.forEachCell(function (_cell, pos) {
|
|
@@ -342,31 +274,23 @@ var setMultipleCellAttrs = function setMultipleCellAttrs(attrs, targetCellPositi
|
|
|
342
274
|
tr = (0, _utils.setCellAttrs)(cell, attrs)(tr);
|
|
343
275
|
cursorPos = cell.pos;
|
|
344
276
|
}
|
|
345
|
-
|
|
346
277
|
if (tr.docChanged && cursorPos !== undefined) {
|
|
347
278
|
var $pos = tr.doc.resolve(tr.mapping.map(cursorPos));
|
|
348
|
-
|
|
349
279
|
if (dispatch) {
|
|
350
280
|
dispatch(tr.setSelection(_prosemirrorState.Selection.near($pos)));
|
|
351
281
|
}
|
|
352
|
-
|
|
353
282
|
return true;
|
|
354
283
|
}
|
|
355
|
-
|
|
356
284
|
return false;
|
|
357
285
|
};
|
|
358
286
|
};
|
|
359
|
-
|
|
360
287
|
exports.setMultipleCellAttrs = setMultipleCellAttrs;
|
|
361
|
-
|
|
362
288
|
var selectColumn = function selectColumn(column, expand) {
|
|
363
289
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
364
290
|
var cells = (0, _utils.getCellsInColumn)(column)(state.tr.selection);
|
|
365
|
-
|
|
366
291
|
if (!cells || !cells.length || typeof cells[0].pos !== 'number') {
|
|
367
292
|
return false;
|
|
368
293
|
}
|
|
369
|
-
|
|
370
294
|
var decorations = (0, _decoration.createColumnSelectedDecoration)((0, _utils.selectColumn)(column, expand)(state.tr));
|
|
371
295
|
var decorationSet = (0, _updatePluginStateDecorations.updatePluginStateDecorations)(state, decorations, _types.TableDecorations.COLUMN_SELECTED);
|
|
372
296
|
var targetCellPosition = cells[0].pos;
|
|
@@ -381,18 +305,14 @@ var selectColumn = function selectColumn(column, expand) {
|
|
|
381
305
|
return (0, _utils.selectColumn)(column, expand)(tr).setMeta('addToHistory', false);
|
|
382
306
|
});
|
|
383
307
|
};
|
|
384
|
-
|
|
385
308
|
exports.selectColumn = selectColumn;
|
|
386
|
-
|
|
387
309
|
var selectRow = function selectRow(row, expand) {
|
|
388
310
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
389
311
|
var targetCellPosition;
|
|
390
312
|
var cells = (0, _utils.getCellsInRow)(row)(state.tr.selection);
|
|
391
|
-
|
|
392
313
|
if (cells && cells.length) {
|
|
393
314
|
targetCellPosition = cells[0].pos;
|
|
394
315
|
}
|
|
395
|
-
|
|
396
316
|
return {
|
|
397
317
|
type: 'SET_TARGET_CELL_POSITION',
|
|
398
318
|
data: {
|
|
@@ -403,9 +323,7 @@ var selectRow = function selectRow(row, expand) {
|
|
|
403
323
|
return (0, _utils.selectRow)(row, expand)(tr).setMeta('addToHistory', false);
|
|
404
324
|
});
|
|
405
325
|
};
|
|
406
|
-
|
|
407
326
|
exports.selectRow = selectRow;
|
|
408
|
-
|
|
409
327
|
var showInsertColumnButton = function showInsertColumnButton(columnIndex) {
|
|
410
328
|
return (0, _pluginFactory.createCommand)(function (_) {
|
|
411
329
|
return columnIndex > -1 ? {
|
|
@@ -418,9 +336,7 @@ var showInsertColumnButton = function showInsertColumnButton(columnIndex) {
|
|
|
418
336
|
return tr.setMeta('addToHistory', false);
|
|
419
337
|
});
|
|
420
338
|
};
|
|
421
|
-
|
|
422
339
|
exports.showInsertColumnButton = showInsertColumnButton;
|
|
423
|
-
|
|
424
340
|
var showInsertRowButton = function showInsertRowButton(rowIndex) {
|
|
425
341
|
return (0, _pluginFactory.createCommand)(function (_) {
|
|
426
342
|
return rowIndex > -1 ? {
|
|
@@ -433,9 +349,7 @@ var showInsertRowButton = function showInsertRowButton(rowIndex) {
|
|
|
433
349
|
return tr.setMeta('addToHistory', false);
|
|
434
350
|
});
|
|
435
351
|
};
|
|
436
|
-
|
|
437
352
|
exports.showInsertRowButton = showInsertRowButton;
|
|
438
|
-
|
|
439
353
|
var hideInsertColumnOrRowButton = function hideInsertColumnOrRowButton() {
|
|
440
354
|
return (0, _pluginFactory.createCommand)({
|
|
441
355
|
type: 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON'
|
|
@@ -443,20 +357,15 @@ var hideInsertColumnOrRowButton = function hideInsertColumnOrRowButton() {
|
|
|
443
357
|
return tr.setMeta('addToHistory', false);
|
|
444
358
|
});
|
|
445
359
|
};
|
|
446
|
-
|
|
447
360
|
exports.hideInsertColumnOrRowButton = hideInsertColumnOrRowButton;
|
|
448
|
-
|
|
449
361
|
var addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex) {
|
|
450
362
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
451
363
|
var tableNode = (0, _utils.findTable)(state.selection);
|
|
452
|
-
|
|
453
364
|
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
454
|
-
|
|
455
|
-
|
|
365
|
+
allowColumnResizing = _getPluginState.pluginConfig.allowColumnResizing;
|
|
456
366
|
if (!tableNode || !allowColumnResizing) {
|
|
457
367
|
return false;
|
|
458
368
|
}
|
|
459
|
-
|
|
460
369
|
return {
|
|
461
370
|
type: 'ADD_RESIZE_HANDLE_DECORATIONS',
|
|
462
371
|
data: {
|
|
@@ -472,40 +381,35 @@ var addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, c
|
|
|
472
381
|
return tr.setMeta('addToHistory', false);
|
|
473
382
|
});
|
|
474
383
|
};
|
|
475
|
-
|
|
476
384
|
exports.addResizeHandleDecorations = addResizeHandleDecorations;
|
|
477
|
-
|
|
478
385
|
var autoSizeTable = function autoSizeTable(view, node, table, basePos, opts) {
|
|
479
386
|
view.dispatch((0, _transforms.fixAutoSizedTable)(view, node, table, basePos, opts));
|
|
480
387
|
return true;
|
|
481
388
|
};
|
|
482
|
-
|
|
483
389
|
exports.autoSizeTable = autoSizeTable;
|
|
484
|
-
|
|
485
390
|
var addBoldInEmptyHeaderCells = function addBoldInEmptyHeaderCells(tableCellHeader) {
|
|
486
391
|
return function (state, dispatch) {
|
|
487
392
|
var tr = state.tr;
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
(0, _utils2.isTextSelection)(tr.selection) && tr.selection.$cursor &&
|
|
393
|
+
if (
|
|
394
|
+
// Avoid infinite loop when the current selection is not a TextSelection
|
|
395
|
+
(0, _utils2.isTextSelection)(tr.selection) && tr.selection.$cursor &&
|
|
396
|
+
// When storedMark is null that means this is the initial state
|
|
491
397
|
// if the user press to remove the mark storedMark will be an empty array
|
|
492
398
|
// and we shouldn't apply the strong mark
|
|
493
|
-
tr.storedMarks == null &&
|
|
494
|
-
|
|
399
|
+
tr.storedMarks == null &&
|
|
400
|
+
// Check if the current node is a direct child from paragraph
|
|
401
|
+
tr.selection.$from.depth === tableCellHeader.depth + 1 &&
|
|
402
|
+
// this logic is applied only for empty paragraph
|
|
495
403
|
tableCellHeader.node.nodeSize === 4 && (0, _utils2.isParagraph)(tableCellHeader.node.firstChild, state.schema)) {
|
|
496
404
|
var strong = state.schema.marks.strong;
|
|
497
405
|
tr.setStoredMarks([strong.create()]).setMeta('addToHistory', false);
|
|
498
|
-
|
|
499
406
|
if (dispatch) {
|
|
500
407
|
dispatch(tr);
|
|
501
408
|
}
|
|
502
|
-
|
|
503
409
|
return true;
|
|
504
410
|
}
|
|
505
|
-
|
|
506
411
|
return false;
|
|
507
412
|
};
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
|
|
413
|
+
};
|
|
414
|
+
// #endregion
|
|
511
415
|
exports.addBoldInEmptyHeaderCells = addBoldInEmptyHeaderCells;
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.removeDescendantNodes = void 0;
|
|
7
|
-
|
|
8
7
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
9
|
-
|
|
10
8
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
11
|
-
|
|
12
9
|
var removeDescendantNodes = function removeDescendantNodes(sourceNode) {
|
|
13
10
|
return (0, _pluginFactory.createCommand)({
|
|
14
11
|
type: 'UPDATE_STATE',
|
|
@@ -19,5 +16,4 @@ var removeDescendantNodes = function removeDescendantNodes(sourceNode) {
|
|
|
19
16
|
return sourceNode ? (0, _utils.removeConnectedNodes)(state, sourceNode) : tr;
|
|
20
17
|
});
|
|
21
18
|
};
|
|
22
|
-
|
|
23
19
|
exports.removeDescendantNodes = removeDescendantNodes;
|