@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
|
@@ -17,7 +17,6 @@ export default class TableCellNodeView {
|
|
|
17
17
|
const {
|
|
18
18
|
mouseMoveOptimization
|
|
19
19
|
} = getEditorFeatureFlags();
|
|
20
|
-
|
|
21
20
|
if (mouseMoveOptimization && observer) {
|
|
22
21
|
this.contentDOM.id = uuid();
|
|
23
22
|
this.mouseMoveOptimization = mouseMoveOptimization;
|
|
@@ -25,56 +24,48 @@ export default class TableCellNodeView {
|
|
|
25
24
|
observer.observe(this.contentDOM);
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
|
-
|
|
29
27
|
updateNodeView(node) {
|
|
30
28
|
if (this.node.type !== node.type) {
|
|
31
29
|
return false;
|
|
32
30
|
}
|
|
33
|
-
|
|
34
31
|
const attrs = getCellDomAttrs(this.node);
|
|
35
32
|
const nextAttrs = getCellDomAttrs(node);
|
|
36
33
|
const {
|
|
37
34
|
colspan,
|
|
38
35
|
rowspan
|
|
39
|
-
} = getCellAttrs(this.dom);
|
|
40
|
-
// this can happen when undoing merge cells
|
|
36
|
+
} = getCellAttrs(this.dom);
|
|
41
37
|
|
|
38
|
+
// need to rerender when colspan/rowspan in dom are different from the node attrs
|
|
39
|
+
// this can happen when undoing merge cells
|
|
42
40
|
if (colspan !== (node.attrs.colspan || DEFAULT_COL_SPAN) || rowspan !== (node.attrs.rowspan || DEFAULT_ROW_SPAN)) {
|
|
43
41
|
return false;
|
|
44
|
-
}
|
|
45
|
-
|
|
42
|
+
}
|
|
46
43
|
|
|
44
|
+
// added + changed attributes
|
|
47
45
|
const addedAttrs = Object.entries(nextAttrs).filter(([key, value]) => attrs[key] !== value);
|
|
48
46
|
const removedAttrs = Object.keys(attrs).filter(key => !nextAttrs.hasOwnProperty(key));
|
|
49
|
-
|
|
50
47
|
if (addedAttrs.length || removedAttrs.length) {
|
|
51
48
|
addedAttrs.forEach(([key, value]) => this.dom.setAttribute(key, value || ''));
|
|
52
49
|
removedAttrs.forEach(key => this.dom.removeAttribute(key));
|
|
53
50
|
return true;
|
|
54
|
-
}
|
|
55
|
-
|
|
51
|
+
}
|
|
56
52
|
|
|
53
|
+
// Return true to not re-render this node view
|
|
57
54
|
if (this.node.sameMarkup(node)) {
|
|
58
55
|
return true;
|
|
59
56
|
}
|
|
60
|
-
|
|
61
57
|
return false;
|
|
62
58
|
}
|
|
63
|
-
|
|
64
59
|
update(node) {
|
|
65
60
|
const didUpdate = this.updateNodeView(node);
|
|
66
|
-
|
|
67
61
|
if (didUpdate) {
|
|
68
62
|
this.node = node;
|
|
69
63
|
}
|
|
70
|
-
|
|
71
64
|
return didUpdate;
|
|
72
65
|
}
|
|
73
|
-
|
|
74
66
|
destroy() {
|
|
75
67
|
if (this.mouseMoveOptimization && this.observer) {
|
|
76
68
|
this.observer.unobserve(this.contentDOM);
|
|
77
69
|
}
|
|
78
70
|
}
|
|
79
|
-
|
|
80
71
|
}
|
|
@@ -8,41 +8,34 @@ export const updateShadowListForStickyStyles = (heightStyle, shadows) => {
|
|
|
8
8
|
}
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
* Update overflow shadows for a given wrapper & table.
|
|
13
14
|
* if `overflowShadowOptimization` is enabled, this will exit early.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
16
|
export const updateOverflowShadows = getEditorFeatureFlags => (editorState, wrapper, table, rightShadows, leftShadows) => {
|
|
17
17
|
var _getEditorFeatureFlag;
|
|
18
|
-
|
|
19
18
|
if (((_getEditorFeatureFlag = getEditorFeatureFlags()) === null || _getEditorFeatureFlag === void 0 ? void 0 : _getEditorFeatureFlag.tableOverflowShadowsOptimization) === true) {
|
|
20
19
|
return false;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
}
|
|
21
|
+
// Right shadow
|
|
24
22
|
if (table && wrapper) {
|
|
25
23
|
const stickyRow = wrapper.querySelector('tr.sticky');
|
|
26
24
|
const stickyCell = stickyRow && stickyRow.firstElementChild;
|
|
27
|
-
|
|
28
25
|
if (rightShadows) {
|
|
29
26
|
const diff = table.offsetWidth - wrapper.offsetWidth;
|
|
30
|
-
|
|
31
27
|
for (let i = 0; i < rightShadows.length; i++) {
|
|
32
28
|
const rightShadow = rightShadows[i];
|
|
33
29
|
rightShadow.style.display = diff > 0 && diff > wrapper.scrollLeft ? 'block' : 'none';
|
|
34
|
-
|
|
35
30
|
if (rightShadow.classList.contains(ClassName.TABLE_STICKY_SHADOW) && stickyCell) {
|
|
36
31
|
rightShadow.style.height = `${stickyCell.clientHeight + 1}px`;
|
|
37
32
|
}
|
|
38
33
|
}
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
if (leftShadows) {
|
|
42
36
|
for (let i = 0; i < leftShadows.length; i++) {
|
|
43
37
|
const leftShadow = leftShadows[i];
|
|
44
38
|
leftShadow.style.display = wrapper.scrollLeft > 0 ? 'block' : 'none';
|
|
45
|
-
|
|
46
39
|
if (leftShadow.classList.contains(ClassName.TABLE_STICKY_SHADOW) && stickyCell) {
|
|
47
40
|
leftShadow.style.height = `${stickyCell.clientHeight + 1}px`;
|
|
48
41
|
}
|
|
@@ -14,7 +14,6 @@ export const handleDocOrSelectionChanged = (tr, decorationSet, oldState) => {
|
|
|
14
14
|
});
|
|
15
15
|
} else if (tr.selectionSet) {
|
|
16
16
|
const isTransactionFromMouseClick = !tr.docChanged && tr.selectionSet && tr.getMeta('pointer');
|
|
17
|
-
|
|
18
17
|
if (isTransactionFromMouseClick || oldState.selection instanceof CellSelection) {
|
|
19
18
|
return maybeUpdateColumnControlsSelectedDecoration({
|
|
20
19
|
decorationSet,
|
|
@@ -22,7 +21,6 @@ export const handleDocOrSelectionChanged = (tr, decorationSet, oldState) => {
|
|
|
22
21
|
});
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
|
-
|
|
26
24
|
return decorationSet;
|
|
27
25
|
};
|
|
28
26
|
export const createPlugin = () => {
|
|
@@ -32,16 +30,13 @@ export const createPlugin = () => {
|
|
|
32
30
|
apply: (tr, decorationSet, oldState) => {
|
|
33
31
|
let pluginState = decorationSet;
|
|
34
32
|
const meta = tr.getMeta(tablePluginKey);
|
|
35
|
-
|
|
36
33
|
if (meta && meta.data && meta.data.decorationSet) {
|
|
37
34
|
pluginState = meta.data.decorationSet;
|
|
38
35
|
}
|
|
39
|
-
|
|
40
36
|
if (tr.docChanged || tr.selectionSet) {
|
|
41
37
|
pluginState = pluginState.map(tr.mapping, tr.doc);
|
|
42
38
|
return handleDocOrSelectionChanged(tr, pluginState, oldState);
|
|
43
39
|
}
|
|
44
|
-
|
|
45
40
|
return pluginState;
|
|
46
41
|
}
|
|
47
42
|
},
|
|
@@ -3,14 +3,12 @@ import { findTable } from '@atlaskit/editor-tables/utils';
|
|
|
3
3
|
import { TableDecorations } from '../../../types';
|
|
4
4
|
import { createColumnControlsDecoration, createColumnSelectedDecoration, findColumnControlSelectedDecoration, findControlsHoverDecoration, updateDecorations } from '../../../utils/decoration';
|
|
5
5
|
import { composeDecorations } from './compose-decorations';
|
|
6
|
+
const isColumnSelected = tr => tr.selection instanceof CellSelection && tr.selection.isColSelection();
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
// @see: https://product-fabric.atlassian.net/browse/ED-3796
|
|
10
9
|
const removeControlsHoverDecoration = ({
|
|
11
10
|
decorationSet
|
|
12
11
|
}) => decorationSet.remove(findControlsHoverDecoration(decorationSet));
|
|
13
|
-
|
|
14
12
|
const maybeUpdateColumnSelectedDecoration = ({
|
|
15
13
|
decorationSet,
|
|
16
14
|
tr
|
|
@@ -18,30 +16,24 @@ const maybeUpdateColumnSelectedDecoration = ({
|
|
|
18
16
|
if (!isColumnSelected(tr)) {
|
|
19
17
|
return decorationSet;
|
|
20
18
|
}
|
|
21
|
-
|
|
22
19
|
return updateDecorations(tr.doc, decorationSet, createColumnSelectedDecoration(tr), TableDecorations.COLUMN_SELECTED);
|
|
23
20
|
};
|
|
24
|
-
|
|
25
21
|
const maybeUpdateColumnControlsDecoration = ({
|
|
26
22
|
decorationSet,
|
|
27
23
|
tr
|
|
28
24
|
}) => {
|
|
29
25
|
const table = findTable(tr.selection);
|
|
30
|
-
|
|
31
26
|
if (!table) {
|
|
32
27
|
return decorationSet;
|
|
33
28
|
}
|
|
34
|
-
|
|
35
29
|
return updateDecorations(tr.doc, decorationSet, createColumnControlsDecoration(tr.selection), TableDecorations.COLUMN_CONTROLS_DECORATIONS);
|
|
36
|
-
};
|
|
37
|
-
|
|
30
|
+
};
|
|
38
31
|
|
|
32
|
+
// @see: https://product-fabric.atlassian.net/browse/ED-7304
|
|
39
33
|
const removeColumnControlsSelectedDecoration = ({
|
|
40
34
|
decorationSet
|
|
41
35
|
}) => decorationSet.remove(findColumnControlSelectedDecoration(decorationSet));
|
|
42
|
-
|
|
43
36
|
const hasColumnSelectedDecorations = decorationSet => !!findColumnControlSelectedDecoration(decorationSet).length;
|
|
44
|
-
|
|
45
37
|
export const maybeUpdateColumnControlsSelectedDecoration = ({
|
|
46
38
|
decorationSet,
|
|
47
39
|
tr
|
|
@@ -49,7 +41,6 @@ export const maybeUpdateColumnControlsSelectedDecoration = ({
|
|
|
49
41
|
if (!hasColumnSelectedDecorations(decorationSet)) {
|
|
50
42
|
return decorationSet;
|
|
51
43
|
}
|
|
52
|
-
|
|
53
44
|
return removeColumnControlsSelectedDecoration({
|
|
54
45
|
decorationSet,
|
|
55
46
|
tr
|
|
@@ -2,17 +2,14 @@ import { TableDecorations } from '../../../types';
|
|
|
2
2
|
import { createResizeHandleDecoration, updateDecorations } from '../../../utils/decoration';
|
|
3
3
|
import { composeDecorations } from './compose-decorations';
|
|
4
4
|
const emptyDecorations = [[], []];
|
|
5
|
-
|
|
6
5
|
const updateColumnResizeHandle = columnResizesDecorations => ({
|
|
7
6
|
decorationSet,
|
|
8
7
|
tr
|
|
9
8
|
}) => updateDecorations(tr.doc, decorationSet, columnResizesDecorations, TableDecorations.COLUMN_RESIZING_HANDLE);
|
|
10
|
-
|
|
11
9
|
const updateLastCellElement = lastCellElementsDecorations => ({
|
|
12
10
|
decorationSet,
|
|
13
11
|
tr
|
|
14
12
|
}) => updateDecorations(tr.doc, decorationSet, lastCellElementsDecorations, TableDecorations.LAST_CELL_ELEMENT);
|
|
15
|
-
|
|
16
13
|
export const buildColumnResizingDecorations = (rowEndIndex, columnEndIndex) => ({
|
|
17
14
|
tr,
|
|
18
15
|
decorationSet
|
|
@@ -6,7 +6,6 @@ import { triggerUnlessTableHeader, createTable, goToNextCell, moveCursorBackward
|
|
|
6
6
|
import { addRowAroundSelection, emptyMultipleCellsWithAnalytics, deleteTableIfSelectedWithAnalytics } from '../commands-with-analytics';
|
|
7
7
|
import { addColumnAfter, addColumnBefore } from '../commands/insert';
|
|
8
8
|
import { withEditorAnalyticsAPI } from '../utils/analytics';
|
|
9
|
-
|
|
10
9
|
const createTableWithAnalytics = editorAnalyticsAPI => withEditorAnalyticsAPI({
|
|
11
10
|
action: ACTION.INSERTED,
|
|
12
11
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
@@ -16,15 +15,15 @@ const createTableWithAnalytics = editorAnalyticsAPI => withEditorAnalyticsAPI({
|
|
|
16
15
|
},
|
|
17
16
|
eventType: EVENT_TYPE.TRACK
|
|
18
17
|
})(editorAnalyticsAPI)(createTable());
|
|
19
|
-
|
|
20
18
|
export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI) {
|
|
21
19
|
const list = {};
|
|
22
20
|
keymaps.bindKeymapWithCommand(keymaps.nextCell.common, goToNextCell(editorAnalyticsAPI)(1), list);
|
|
23
21
|
keymaps.bindKeymapWithCommand(keymaps.previousCell.common, goToNextCell(editorAnalyticsAPI)(-1), list);
|
|
24
22
|
keymaps.bindKeymapWithCommand(keymaps.toggleTable.common, createTableWithAnalytics(editorAnalyticsAPI), list);
|
|
25
23
|
keymaps.bindKeymapWithCommand(keymaps.backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
|
|
26
|
-
keymaps.bindKeymapWithCommand(keymaps.backspace.common, moveCursorBackward, list);
|
|
24
|
+
keymaps.bindKeymapWithCommand(keymaps.backspace.common, moveCursorBackward, list);
|
|
27
25
|
|
|
26
|
+
// Add row/column shortcuts
|
|
28
27
|
keymaps.bindKeymapWithCommand(keymaps.addRowBefore.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
|
|
29
28
|
keymaps.bindKeymapWithCommand(keymaps.addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
30
29
|
keymaps.bindKeymapWithCommand(keymaps.addColumnBefore.common, triggerUnlessTableHeader(addColumnBefore(getEditorContainerWidth)), list);
|
|
@@ -26,7 +26,6 @@ let isFullWidthModeEnabled;
|
|
|
26
26
|
let wasFullWidthModeEnabled;
|
|
27
27
|
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, breakoutEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI) => {
|
|
28
28
|
var _window;
|
|
29
|
-
|
|
30
29
|
isBreakoutEnabled = breakoutEnabled;
|
|
31
30
|
isFullWidthModeEnabled = fullWidthModeEnabled;
|
|
32
31
|
wasFullWidthModeEnabled = previousFullWidthModeEnabled;
|
|
@@ -45,39 +44,33 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
45
44
|
if (!entry.target.id) {
|
|
46
45
|
return;
|
|
47
46
|
}
|
|
48
|
-
|
|
49
47
|
elementContentRects[entry.target.id] = entry.contentRect;
|
|
50
48
|
});
|
|
51
49
|
}) : undefined;
|
|
52
50
|
const tableCellNodeview = {
|
|
53
51
|
tableCell: (node, view, getPos) => new TableCellNodeView(node, view, getPos, getEditorFeatureFlags, observer),
|
|
54
52
|
tableHeader: (node, view, getPos) => new TableCellNodeView(node, view, getPos, getEditorFeatureFlags, observer)
|
|
55
|
-
};
|
|
53
|
+
};
|
|
56
54
|
|
|
55
|
+
// Used to prevent invalid table cell spans being reported more than once per editor/document
|
|
57
56
|
const invalidTableIds = [];
|
|
58
57
|
let editorViewRef = null;
|
|
59
|
-
|
|
60
58
|
const getCurrentEditorState = () => {
|
|
61
59
|
const editorView = editorViewRef;
|
|
62
|
-
|
|
63
60
|
if (!editorView) {
|
|
64
61
|
return null;
|
|
65
62
|
}
|
|
66
|
-
|
|
67
63
|
return editorView.state;
|
|
68
64
|
};
|
|
69
|
-
|
|
70
65
|
return new SafePlugin({
|
|
71
66
|
state: state,
|
|
72
67
|
key: pluginKey,
|
|
73
68
|
appendTransaction: (transactions, oldState, newState) => {
|
|
74
69
|
const tr = transactions.find(tr => tr.getMeta('uiEvent') === 'cut');
|
|
75
|
-
|
|
76
70
|
function reportInvalidTableCellSpanAttrs(invalidNodeAttr) {
|
|
77
71
|
if (invalidTableIds.find(id => id === invalidNodeAttr.tableLocalId)) {
|
|
78
72
|
return;
|
|
79
73
|
}
|
|
80
|
-
|
|
81
74
|
invalidTableIds.push(invalidNodeAttr.tableLocalId);
|
|
82
75
|
dispatchAnalyticsEvent({
|
|
83
76
|
action: ACTION.INVALID_DOCUMENT_ENCOUNTERED,
|
|
@@ -91,13 +84,11 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
91
84
|
}
|
|
92
85
|
});
|
|
93
86
|
}
|
|
94
|
-
|
|
95
87
|
if (tr) {
|
|
96
88
|
// "fixTables" removes empty rows as we don't allow that in schema
|
|
97
89
|
const updatedTr = handleCut(tr, oldState, newState, editorAnalyticsAPI);
|
|
98
90
|
return fixTables(updatedTr) || updatedTr;
|
|
99
91
|
}
|
|
100
|
-
|
|
101
92
|
if (transactions.find(tr => tr.docChanged)) {
|
|
102
93
|
return fixTables(newState.tr, reportInvalidTableCellSpanAttrs);
|
|
103
94
|
}
|
|
@@ -117,34 +108,26 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
117
108
|
const pluginState = getPluginState(state);
|
|
118
109
|
let tableRef;
|
|
119
110
|
let tableNode;
|
|
120
|
-
|
|
121
111
|
if (pluginState.editorHasFocus) {
|
|
122
112
|
const parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
|
|
123
|
-
|
|
124
113
|
if (parent) {
|
|
125
114
|
tableRef = parent.querySelector('table') || undefined;
|
|
126
115
|
}
|
|
127
|
-
|
|
128
116
|
tableNode = findTable(state.selection);
|
|
129
117
|
}
|
|
130
|
-
|
|
131
118
|
if (pluginState.tableRef !== tableRef) {
|
|
132
119
|
setTableRef(tableRef)(state, dispatch);
|
|
133
120
|
}
|
|
134
|
-
|
|
135
121
|
if (pluginState.tableNode !== tableNode) {
|
|
136
122
|
updateResizeHandles(tableRef);
|
|
137
123
|
}
|
|
138
|
-
|
|
139
124
|
if (pluginState.editorHasFocus && pluginState.tableRef) {
|
|
140
125
|
const {
|
|
141
126
|
$cursor
|
|
142
127
|
} = state.selection;
|
|
143
|
-
|
|
144
128
|
if ($cursor) {
|
|
145
129
|
// Only update bold when it's a cursor
|
|
146
130
|
const tableCellHeader = findParentNodeOfType(state.schema.nodes.tableHeader)(state.selection);
|
|
147
|
-
|
|
148
131
|
if (tableCellHeader) {
|
|
149
132
|
addBoldInEmptyHeaderCells(tableCellHeader)(state, dispatch);
|
|
150
133
|
}
|
|
@@ -161,70 +144,64 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
161
144
|
props: {
|
|
162
145
|
transformPasted(slice) {
|
|
163
146
|
const editorState = getCurrentEditorState();
|
|
164
|
-
|
|
165
147
|
if (!editorState) {
|
|
166
148
|
return slice;
|
|
167
149
|
}
|
|
168
|
-
|
|
169
150
|
const {
|
|
170
151
|
schema
|
|
171
|
-
} = editorState;
|
|
152
|
+
} = editorState;
|
|
153
|
+
|
|
154
|
+
// if we're pasting to outside a table or outside a table
|
|
172
155
|
// header, ensure that we apply any table headers to the first
|
|
173
156
|
// row of content we see, if required
|
|
174
|
-
|
|
175
157
|
if (!insideTable(editorState) && isHeaderRowRequired(editorState)) {
|
|
176
158
|
slice = transformSliceToAddTableHeaders(slice, schema);
|
|
177
159
|
}
|
|
160
|
+
slice = transformSliceToFixHardBreakProblemOnCopyFromCell(slice, schema);
|
|
178
161
|
|
|
179
|
-
|
|
162
|
+
// We do this separately, so it also applies to drag/drop events
|
|
180
163
|
// This needs to go before `transformSliceToRemoveOpenExpand`
|
|
164
|
+
slice = transformSliceToRemoveOpenLayoutNodes(slice, schema);
|
|
181
165
|
|
|
182
|
-
|
|
166
|
+
// If a partial paste of expand, paste only the content
|
|
183
167
|
// This needs to go before `transformSliceToRemoveOpenTable`
|
|
184
|
-
|
|
185
168
|
slice = transformSliceToRemoveOpenExpand(slice, schema);
|
|
186
|
-
/** If a partial paste of table, paste only table's content */
|
|
187
169
|
|
|
170
|
+
/** If a partial paste of table, paste only table's content */
|
|
188
171
|
slice = transformSliceToRemoveOpenTable(slice, schema);
|
|
189
|
-
/** If a partial paste of bodied extension, paste only text */
|
|
190
172
|
|
|
173
|
+
/** If a partial paste of bodied extension, paste only text */
|
|
191
174
|
slice = transformSliceToRemoveOpenBodiedExtension(slice, schema);
|
|
192
175
|
slice = transformSliceToCorrectEmptyTableCells(slice, schema);
|
|
193
|
-
|
|
194
176
|
if (!pluginConfig.allowColumnResizing) {
|
|
195
177
|
slice = transformSliceToRemoveColumnsWidths(slice, schema);
|
|
196
|
-
}
|
|
197
|
-
// from the paste slice
|
|
198
|
-
|
|
178
|
+
}
|
|
199
179
|
|
|
180
|
+
// If we don't allow background on cells, we need to remove it
|
|
181
|
+
// from the paste slice
|
|
200
182
|
if (!pluginConfig.allowBackgroundColor) {
|
|
201
183
|
slice = transformSliceRemoveCellBackgroundColor(slice, schema);
|
|
202
184
|
}
|
|
203
|
-
|
|
204
185
|
return slice;
|
|
205
186
|
},
|
|
206
|
-
|
|
207
187
|
handleClick: ({
|
|
208
188
|
state,
|
|
209
189
|
dispatch
|
|
210
190
|
}, _pos, event) => {
|
|
211
191
|
const decorationSet = decorationsPluginKey.getState(state);
|
|
212
|
-
|
|
213
192
|
if (findControlsHoverDecoration(decorationSet).length) {
|
|
214
193
|
clearHoverSelection()(state, dispatch);
|
|
215
|
-
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ED-6069: workaround for Chrome given a regression introduced in prosemirror-view@1.6.8
|
|
216
197
|
// Returning true prevents that updateSelection() is getting called in the commit below:
|
|
217
198
|
// @see https://github.com/ProseMirror/prosemirror-view/commit/33fe4a8b01584f6b4103c279033dcd33e8047b95
|
|
218
|
-
|
|
219
|
-
|
|
220
199
|
if (browser.chrome && event.target) {
|
|
221
200
|
const targetClassList = event.target.classList;
|
|
222
|
-
|
|
223
201
|
if (targetClassList.contains(ClassName.CONTROLS_BUTTON) || targetClassList.contains(ClassName.CONTEXTUAL_MENU_BUTTON)) {
|
|
224
202
|
return true;
|
|
225
203
|
}
|
|
226
204
|
}
|
|
227
|
-
|
|
228
205
|
return false;
|
|
229
206
|
},
|
|
230
207
|
handleScrollToSelection: view => {
|
|
@@ -242,15 +219,14 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
242
219
|
dispatch
|
|
243
220
|
}, from, to, text) => {
|
|
244
221
|
const tr = replaceSelectedTable(state, text, INPUT_METHOD.KEYBOARD, editorAnalyticsAPI);
|
|
245
|
-
|
|
246
222
|
if (tr.selectionSet) {
|
|
247
223
|
dispatch(tr);
|
|
248
224
|
return true;
|
|
249
225
|
}
|
|
250
|
-
|
|
251
226
|
return false;
|
|
252
227
|
},
|
|
253
|
-
nodeViews: {
|
|
228
|
+
nodeViews: {
|
|
229
|
+
//temporary flag to test tableCell optimisation
|
|
254
230
|
...tableCellNodeview,
|
|
255
231
|
table: (node, view, getPos) => createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
256
232
|
isBreakoutEnabled,
|
|
@@ -10,7 +10,6 @@ export const {
|
|
|
10
10
|
mapping: (tr, pluginState) => {
|
|
11
11
|
if (tr.docChanged) {
|
|
12
12
|
let updatedTargetCell = {};
|
|
13
|
-
|
|
14
13
|
if (pluginState.targetCellPosition) {
|
|
15
14
|
const {
|
|
16
15
|
pos,
|
|
@@ -20,9 +19,7 @@ export const {
|
|
|
20
19
|
targetCellPosition: deleted ? undefined : pos
|
|
21
20
|
};
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
let updatedTablePos = {};
|
|
25
|
-
|
|
26
23
|
if (pluginState.tablePos) {
|
|
27
24
|
const {
|
|
28
25
|
pos,
|
|
@@ -32,13 +29,12 @@ export const {
|
|
|
32
29
|
tablePos: deleted ? undefined : pos
|
|
33
30
|
};
|
|
34
31
|
}
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
return {
|
|
33
|
+
...pluginState,
|
|
37
34
|
...updatedTargetCell,
|
|
38
35
|
...updatedTablePos
|
|
39
36
|
};
|
|
40
37
|
}
|
|
41
|
-
|
|
42
38
|
return pluginState;
|
|
43
39
|
},
|
|
44
40
|
onDocChanged: handleDocOrSelectionChanged,
|
package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js
CHANGED
|
@@ -9,6 +9,7 @@ export const createPlugin = () => {
|
|
|
9
9
|
// to delay drag selections
|
|
10
10
|
// - to ensure it is cleaned up when the mouseup
|
|
11
11
|
// event is not fired in a previous mousedown event
|
|
12
|
+
|
|
12
13
|
// Because we are manually wiping the view.mouseDown,
|
|
13
14
|
// we manage this custom cleanup ourselves
|
|
14
15
|
let prevMouseDownDone = null;
|
|
@@ -22,13 +23,16 @@ export const createPlugin = () => {
|
|
|
22
23
|
// DOM selection syncing during pointer drag.
|
|
23
24
|
//
|
|
24
25
|
// https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
|
|
26
|
+
|
|
25
27
|
// NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
|
|
26
28
|
// https://github.com/ProseMirror/prosemirror-view/pull/116
|
|
29
|
+
|
|
27
30
|
// This fix removes the selectionToDOM from the view
|
|
28
31
|
// prior to selectionToDOM being called.
|
|
29
32
|
// selectionToDOM checks if there is an "active"
|
|
30
33
|
// mouseDown, and if so, it delays running logic
|
|
31
34
|
// which causes the table selections issue.
|
|
35
|
+
|
|
32
36
|
// The handleDOMEvents are called before ProseMirror
|
|
33
37
|
// events fired on the editable DOM element.
|
|
34
38
|
// This means the view.mouseView will not yet be
|
|
@@ -40,21 +44,22 @@ export const createPlugin = () => {
|
|
|
40
44
|
// prepend a task which will clear the mouseDown from
|
|
41
45
|
// the view. We do this using a setTimout with no
|
|
42
46
|
// interval.
|
|
47
|
+
|
|
43
48
|
if (prevMouseDownDone) {
|
|
44
49
|
// avoid memory leaks when the mouseup event is not fired
|
|
45
50
|
// in a previous mousedown event
|
|
46
51
|
prevMouseDownDone();
|
|
47
52
|
}
|
|
48
|
-
|
|
49
53
|
setTimeout(() => {
|
|
50
54
|
// the ts-ignores here are required due to the
|
|
51
55
|
// view.mouseDown being an internal which is
|
|
52
56
|
// not part of the views type signature
|
|
57
|
+
|
|
53
58
|
// @ts-ignore
|
|
54
59
|
if (view.mouseDown) {
|
|
55
60
|
// @ts-ignore
|
|
56
|
-
prevMouseDownDone = view.mouseDown.done.bind(view.mouseDown);
|
|
57
|
-
|
|
61
|
+
prevMouseDownDone = view.mouseDown.done.bind(view.mouseDown);
|
|
62
|
+
// @ts-ignore
|
|
58
63
|
view.mouseDown = null;
|
|
59
64
|
}
|
|
60
65
|
});
|
package/dist/es2019/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js
CHANGED
|
@@ -17,13 +17,10 @@ export const createPlugin = () => {
|
|
|
17
17
|
}),
|
|
18
18
|
apply: (tr, value) => {
|
|
19
19
|
const renderSpan = tr.getMeta(tableSafariDeleteCompositionTextIssueWorkaroundKey);
|
|
20
|
-
|
|
21
20
|
if (typeof renderSpan === 'undefined') {
|
|
22
21
|
return value;
|
|
23
22
|
}
|
|
24
|
-
|
|
25
23
|
let decorations;
|
|
26
|
-
|
|
27
24
|
if (renderSpan) {
|
|
28
25
|
// Find position of the first text node in case it has multiple text nodes created by Japanese IME
|
|
29
26
|
const {
|
|
@@ -38,7 +35,6 @@ export const createPlugin = () => {
|
|
|
38
35
|
} else {
|
|
39
36
|
decorations = DecorationSet.empty;
|
|
40
37
|
}
|
|
41
|
-
|
|
42
38
|
return {
|
|
43
39
|
renderSpan,
|
|
44
40
|
decorations
|
|
@@ -52,13 +48,10 @@ export const createPlugin = () => {
|
|
|
52
48
|
if ((event === null || event === void 0 ? void 0 : event.inputType) !== 'deleteCompositionText') {
|
|
53
49
|
return false;
|
|
54
50
|
}
|
|
55
|
-
|
|
56
51
|
const selection = window.getSelection();
|
|
57
|
-
|
|
58
52
|
if (!selection || selection.rangeCount <= 0 || selection.type !== 'Range') {
|
|
59
53
|
return false;
|
|
60
54
|
}
|
|
61
|
-
|
|
62
55
|
const range = selection.getRangeAt(0);
|
|
63
56
|
const {
|
|
64
57
|
startContainer,
|
|
@@ -71,7 +64,6 @@ export const createPlugin = () => {
|
|
|
71
64
|
* and will think that we meant to delete those elements. This fix forces the resulting node to not be empty.
|
|
72
65
|
* The condition here checks to see if the entire text node is about to be swapped inside of an element
|
|
73
66
|
*/
|
|
74
|
-
|
|
75
67
|
if (startContainer.nodeType === Node.TEXT_NODE && startContainer === endContainer && startOffset === 0 && endOffset === startContainer.length) {
|
|
76
68
|
const {
|
|
77
69
|
tr
|
|
@@ -79,20 +71,16 @@ export const createPlugin = () => {
|
|
|
79
71
|
tr.setMeta(tableSafariDeleteCompositionTextIssueWorkaroundKey, true);
|
|
80
72
|
view.dispatch(tr);
|
|
81
73
|
}
|
|
82
|
-
|
|
83
74
|
return false;
|
|
84
75
|
},
|
|
85
76
|
input: (view, event) => {
|
|
86
77
|
if ((event === null || event === void 0 ? void 0 : event.inputType) !== 'deleteCompositionText') {
|
|
87
78
|
return false;
|
|
88
79
|
}
|
|
89
|
-
|
|
90
80
|
const selection = window.getSelection();
|
|
91
|
-
|
|
92
81
|
if (!selection) {
|
|
93
82
|
return false;
|
|
94
83
|
}
|
|
95
|
-
|
|
96
84
|
const {
|
|
97
85
|
tr
|
|
98
86
|
} = view.state;
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
export const getTree = tr => {
|
|
2
2
|
// pm renders into tbody, owned by react
|
|
3
3
|
const tbody = tr.parentElement;
|
|
4
|
-
|
|
5
4
|
if (!tbody) {
|
|
6
5
|
return null;
|
|
7
|
-
}
|
|
8
|
-
|
|
6
|
+
}
|
|
9
7
|
|
|
8
|
+
// rendered by react
|
|
10
9
|
const table = tbody.parentElement;
|
|
11
|
-
|
|
12
10
|
if (!table) {
|
|
13
11
|
return null;
|
|
14
|
-
}
|
|
15
|
-
|
|
12
|
+
}
|
|
16
13
|
|
|
14
|
+
// rendered by react
|
|
17
15
|
const wrapper = table.parentElement;
|
|
18
|
-
|
|
19
16
|
if (!wrapper) {
|
|
20
17
|
return null;
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
return {
|
|
24
20
|
wrapper: wrapper,
|
|
25
21
|
table: table
|
|
@@ -29,6 +25,5 @@ export const getTop = element => {
|
|
|
29
25
|
if (!element || element instanceof Window) {
|
|
30
26
|
return 0;
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
return element.getBoundingClientRect().top;
|
|
34
29
|
};
|