@atlaskit/editor-plugin-table 1.3.1 → 1.4.0
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 +15 -0
- package/dist/cjs/plugins/table/commands/misc.js +1 -2
- package/dist/cjs/plugins/table/index.js +25 -34
- package/dist/cjs/plugins/table/transforms/column-width.js +0 -17
- package/dist/cjs/plugins/table/transforms/delete-columns.js +4 -13
- package/dist/cjs/plugins/table/transforms/delete-rows.js +4 -13
- package/dist/cjs/plugins/table/transforms/fix-tables.js +6 -24
- package/dist/cjs/plugins/table/transforms/index.js +0 -13
- package/dist/cjs/plugins/table/transforms/merge.js +5 -20
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/commands/misc.js +2 -3
- package/dist/es2019/plugins/table/index.js +21 -33
- package/dist/es2019/plugins/table/transforms/column-width.js +0 -17
- package/dist/es2019/plugins/table/transforms/delete-columns.js +4 -13
- package/dist/es2019/plugins/table/transforms/delete-rows.js +4 -13
- package/dist/es2019/plugins/table/transforms/fix-tables.js +0 -14
- package/dist/es2019/plugins/table/transforms/index.js +1 -2
- package/dist/es2019/plugins/table/transforms/merge.js +5 -21
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/commands/misc.js +2 -3
- package/dist/esm/plugins/table/index.js +25 -34
- package/dist/esm/plugins/table/transforms/column-width.js +0 -17
- package/dist/esm/plugins/table/transforms/delete-columns.js +4 -13
- package/dist/esm/plugins/table/transforms/delete-rows.js +4 -13
- package/dist/esm/plugins/table/transforms/fix-tables.js +0 -17
- package/dist/esm/plugins/table/transforms/index.js +1 -2
- package/dist/esm/plugins/table/transforms/merge.js +5 -21
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/table/index.d.ts +9 -0
- package/dist/types/plugins/table/transforms/fix-tables.d.ts +0 -1
- package/dist/types/plugins/table/transforms/index.d.ts +1 -2
- package/dist/types-ts4.5/i18n/cs.d.ts +35 -0
- package/dist/types-ts4.5/i18n/da.d.ts +33 -0
- package/dist/types-ts4.5/i18n/de.d.ts +33 -0
- package/dist/types-ts4.5/i18n/en.d.ts +35 -0
- package/dist/types-ts4.5/i18n/en_GB.d.ts +35 -0
- package/dist/types-ts4.5/i18n/es.d.ts +33 -0
- package/dist/types-ts4.5/i18n/fi.d.ts +33 -0
- package/dist/types-ts4.5/i18n/fr.d.ts +35 -0
- package/dist/types-ts4.5/i18n/hu.d.ts +35 -0
- package/dist/types-ts4.5/i18n/it.d.ts +35 -0
- package/dist/types-ts4.5/i18n/ja.d.ts +35 -0
- package/dist/types-ts4.5/i18n/ko.d.ts +33 -0
- package/dist/types-ts4.5/i18n/nb.d.ts +33 -0
- package/dist/types-ts4.5/i18n/nl.d.ts +35 -0
- package/dist/types-ts4.5/i18n/pl.d.ts +35 -0
- package/dist/types-ts4.5/i18n/pt_BR.d.ts +35 -0
- package/dist/types-ts4.5/i18n/ru.d.ts +35 -0
- package/dist/types-ts4.5/i18n/sv.d.ts +33 -0
- package/dist/types-ts4.5/i18n/th.d.ts +33 -0
- package/dist/types-ts4.5/i18n/tr.d.ts +35 -0
- package/dist/types-ts4.5/i18n/uk.d.ts +35 -0
- package/dist/types-ts4.5/i18n/vi.d.ts +33 -0
- package/dist/types-ts4.5/i18n/zh.d.ts +35 -0
- package/dist/types-ts4.5/i18n/zh_TW.d.ts +35 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/commands/clear.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/commands/collapse.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/commands/go-to-next-cell.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/commands/index.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/commands/insert.d.ts +10 -0
- package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +27 -0
- package/dist/types-ts4.5/plugins/table/commands/referentiality.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/commands/selection.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/commands/sort.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/commands/split-cell.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/commands/toggle.d.ts +12 -0
- package/dist/types-ts4.5/plugins/table/commands-with-analytics.d.ts +26 -0
- package/dist/types-ts4.5/plugins/table/create-plugin-config.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/handlers.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/index.d.ts +30 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +25 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +73 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverridableMock.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +34 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/tableCell.d.ts +19 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +24 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/update-overflow-shadows.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +7 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/index.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/types.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/default-table-selection.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/keymap.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-factory.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/commands.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/index.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +72 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/types.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/util.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-local-id.d.ts +22 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/commands.d.ts +25 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/index.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/reducer.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +14 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +13 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +12 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +22 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +29 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +17 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +22 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-selection-keymap.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/reducer.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/toolbar.d.ts +37 -0
- package/dist/types-ts4.5/plugins/table/transforms/column-width.d.ts +18 -0
- package/dist/types-ts4.5/plugins/table/transforms/delete-columns.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/transforms/delete-rows.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/transforms/fix-tables.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/transforms/index.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/transforms/merge.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/transforms/replace-table.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/transforms/split.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/types.d.ts +332 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/index.d.ts +29 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/styles.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +88 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/index.d.ts +23 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/styles.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +14 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +10 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/index.d.ts +54 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +12 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/index.d.ts +35 -0
- package/dist/types-ts4.5/plugins/table/ui/LayoutButton/index.d.ts +21 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +21 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +17 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +40 -0
- package/dist/types-ts4.5/plugins/table/ui/common-styles.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +39 -0
- package/dist/types-ts4.5/plugins/table/ui/messages.d.ts +58 -0
- package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/utils/analytics.d.ts +18 -0
- package/dist/types-ts4.5/plugins/table/utils/collapse.d.ts +29 -0
- package/dist/types-ts4.5/plugins/table/utils/column-controls.d.ts +10 -0
- package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +20 -0
- package/dist/types-ts4.5/plugins/table/utils/get-allow-add-column-custom-step.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +11 -0
- package/dist/types-ts4.5/plugins/table/utils/nodes.d.ts +12 -0
- package/dist/types-ts4.5/plugins/table/utils/paste.d.ts +14 -0
- package/dist/types-ts4.5/plugins/table/utils/row-controls.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/utils/selection.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/utils/table.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/utils/update-plugin-state-decorations.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table-plugin.d.ts +2 -0
- package/dist/types-ts4.5/types/i18n.d.ts +5 -0
- package/examples/99-testing.tsx +4 -94
- package/package.json +7 -5
- package/report.api.md +11 -0
- package/src/__tests__/unit/analytics.ts +6 -0
- package/src/__tests__/unit/collab.ts +6 -0
- package/src/__tests__/unit/color-picker.ts +4 -0
- package/src/__tests__/unit/commands/go-to-next-cell.ts +8 -1
- package/src/__tests__/unit/commands/insert.ts +6 -0
- package/src/__tests__/unit/commands/misc.ts +14 -6
- package/src/__tests__/unit/commands/sort.ts +19 -12
- package/src/__tests__/unit/commands.ts +10 -2
- package/src/__tests__/unit/copy-paste.ts +6 -0
- package/src/__tests__/unit/event-handlers/index.ts +13 -8
- package/src/__tests__/unit/event-handlers.ts +13 -1
- package/src/__tests__/unit/fix-tables.ts +8 -4
- package/src/__tests__/unit/get-toolbar-config.ts +4 -0
- package/src/__tests__/unit/handlers.ts +8 -1
- package/src/__tests__/unit/hover-selection.ts +8 -1
- package/src/__tests__/unit/index.ts +10 -2
- package/src/__tests__/unit/keymap.ts +10 -4
- package/src/__tests__/unit/layout.ts +4 -0
- package/src/__tests__/unit/nodeviews/cell.ts +6 -0
- package/src/__tests__/unit/nodeviews/table.ts +16 -9
- package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +14 -4
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +8 -1
- package/src/__tests__/unit/pm-plugins/main-with-allow-collapse.ts +4 -0
- package/src/__tests__/unit/pm-plugins/main.ts +6 -0
- package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +8 -4
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +13 -4
- package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +6 -0
- package/src/__tests__/unit/pm-plugins/table-selection-keymap.ts +6 -0
- package/src/__tests__/unit/sort-column.ts +6 -0
- package/src/__tests__/unit/toolbar.ts +16 -9
- package/src/__tests__/unit/transforms/delete-columns.ts +8 -1
- package/src/__tests__/unit/transforms/delete-rows.ts +8 -1
- package/src/__tests__/unit/transforms/merging.ts +8 -1
- package/src/__tests__/unit/ui/ContextualMenu.tsx +8 -4
- package/src/__tests__/unit/ui/CornerControls.tsx +8 -1
- package/src/__tests__/unit/ui/FloatingContextualButton.tsx +8 -1
- package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +8 -1
- package/src/__tests__/unit/ui/RowControls.tsx +8 -1
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +8 -1
- package/src/__tests__/unit/undo-redo.ts +6 -0
- package/src/__tests__/unit/utils/collapse.ts +4 -0
- package/src/__tests__/unit/utils/nodes.ts +8 -1
- package/src/__tests__/unit/utils/row-controls.ts +8 -1
- package/src/__tests__/unit/utils.ts +8 -1
- package/src/plugins/table/commands/misc.ts +2 -4
- package/src/plugins/table/index.tsx +39 -40
- package/src/plugins/table/transforms/column-width.ts +0 -11
- package/src/plugins/table/transforms/delete-columns.ts +4 -5
- package/src/plugins/table/transforms/delete-rows.ts +4 -7
- package/src/plugins/table/transforms/fix-tables.ts +0 -17
- package/src/plugins/table/transforms/index.ts +1 -2
- package/src/plugins/table/transforms/merge.ts +9 -20
- package/dist/cjs/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +0 -79
- package/dist/cjs/plugins/table/transforms/metadata.js +0 -20
- package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +0 -71
- package/dist/es2019/plugins/table/transforms/metadata.js +0 -12
- package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +0 -71
- package/dist/esm/plugins/table/transforms/metadata.js +0 -14
- package/dist/types/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.d.ts +0 -4
- package/dist/types/plugins/table/transforms/metadata.d.ts +0 -21
- package/src/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.ts +0 -78
- package/src/plugins/table/transforms/metadata.ts +0 -35
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
2
2
|
import { akEditorDefaultLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
3
|
-
import { sendLogs } from '@atlaskit/editor-common/utils';
|
|
4
3
|
import { calculateColumnWidth, contentWidth, getCellsRefsInColumn, getLayoutSize } from '../pm-plugins/table-resizing/utils';
|
|
5
|
-
export const fireAnalytics = (properties = {}) => sendLogs({
|
|
6
|
-
events: [{
|
|
7
|
-
name: 'atlaskit.fabric.editor.fixtable',
|
|
8
|
-
product: 'atlaskit',
|
|
9
|
-
properties,
|
|
10
|
-
serverTime: new Date().getTime(),
|
|
11
|
-
server: 'local',
|
|
12
|
-
user: '-'
|
|
13
|
-
}]
|
|
14
|
-
});
|
|
15
4
|
const validateTableCellNodeAttrs = ({
|
|
16
5
|
colspan,
|
|
17
6
|
rowspan,
|
|
@@ -70,9 +59,6 @@ export const removeExtraneousColumnWidths = (node, basePos, tr, reportInvalidTab
|
|
|
70
59
|
return cell;
|
|
71
60
|
});
|
|
72
61
|
if (hasProblems) {
|
|
73
|
-
fireAnalytics({
|
|
74
|
-
message: 'removeExtraneousColumnWidths'
|
|
75
|
-
});
|
|
76
62
|
return true;
|
|
77
63
|
}
|
|
78
64
|
return false;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { fixTables, fixAutoSizedTable } from './fix-tables';
|
|
2
2
|
export { mergeCells, canMergeCells, mergeEmptyColumns } from './merge';
|
|
3
3
|
export { deleteColumns } from './delete-columns';
|
|
4
4
|
export { deleteRows } from './delete-rows';
|
|
5
5
|
export { updateColumnWidths } from './column-width';
|
|
6
|
-
export { setMeta } from './metadata';
|
|
7
6
|
export { replaceSelectedTable } from './replace-table';
|
|
@@ -3,8 +3,6 @@ import { Selection } from 'prosemirror-state';
|
|
|
3
3
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
5
|
import { findTable, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
6
|
-
import { setMeta } from './metadata';
|
|
7
|
-
|
|
8
6
|
// re-creates table node with merged cells
|
|
9
7
|
export function mergeCells(tr) {
|
|
10
8
|
const {
|
|
@@ -51,10 +49,7 @@ export function mergeCells(tr) {
|
|
|
51
49
|
}
|
|
52
50
|
const rowspan = rect.bottom - rect.top;
|
|
53
51
|
if (rowspan < 1) {
|
|
54
|
-
return
|
|
55
|
-
type: 'MERGE_CELLS',
|
|
56
|
-
problem: 'NEGATIVE_ROWSPAN'
|
|
57
|
-
})(tr);
|
|
52
|
+
return tr;
|
|
58
53
|
}
|
|
59
54
|
// update colspan and rowspan of the merged cell to span the selection
|
|
60
55
|
const attrs = addColSpan({
|
|
@@ -85,10 +80,7 @@ export function mergeCells(tr) {
|
|
|
85
80
|
if (rowspan && rowspan + i - 1 >= rows.length) {
|
|
86
81
|
rowChanged = true;
|
|
87
82
|
if (rowspan < 2) {
|
|
88
|
-
return
|
|
89
|
-
type: 'MERGE_CELLS',
|
|
90
|
-
problem: 'NEGATIVE_ROWSPAN'
|
|
91
|
-
})(tr);
|
|
83
|
+
return tr;
|
|
92
84
|
}
|
|
93
85
|
cells.push(cell.type.createChecked({
|
|
94
86
|
...cell.attrs,
|
|
@@ -107,22 +99,14 @@ export function mergeCells(tr) {
|
|
|
107
99
|
|
|
108
100
|
// empty tables? cancel merging like nothing happened
|
|
109
101
|
if (!rows.length) {
|
|
110
|
-
return
|
|
111
|
-
type: 'MERGE_CELLS',
|
|
112
|
-
problem: 'EMPTY_TABLE'
|
|
113
|
-
})(tr);
|
|
102
|
+
return tr;
|
|
114
103
|
}
|
|
115
104
|
const newTable = table.node.type.createChecked(table.node.attrs, rows, table.node.marks);
|
|
116
105
|
const fixedTable = mergeEmptyColumns(newTable);
|
|
117
106
|
if (fixedTable === null) {
|
|
118
|
-
return
|
|
119
|
-
type: 'MERGE_CELLS',
|
|
120
|
-
problem: 'REMOVE_EMPTY_COLUMNS'
|
|
121
|
-
})(tr);
|
|
107
|
+
return tr;
|
|
122
108
|
}
|
|
123
|
-
return
|
|
124
|
-
type: 'MERGE_CELLS'
|
|
125
|
-
})(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable).setSelection(Selection.near(tr.doc.resolve((mergedCellPos || 0) + table.start))));
|
|
109
|
+
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable).setSelection(Selection.near(tr.doc.resolve((mergedCellPos || 0) + table.start)));
|
|
126
110
|
}
|
|
127
111
|
export function canMergeCells(tr) {
|
|
128
112
|
const {
|
package/dist/es2019/version.json
CHANGED
|
@@ -3,7 +3,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
// #region Imports
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { TextSelection } from 'prosemirror-state';
|
|
7
7
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
8
8
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
9
9
|
import { selectionCell, findCellClosestToPos, findTable, getCellsInColumn, getCellsInRow, getSelectionRect, isSelectionType, removeTable, selectColumn as selectColumnTransform, selectRow as selectRowTransform, setCellAttrs, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
@@ -259,9 +259,8 @@ export var setMultipleCellAttrs = function setMultipleCellAttrs(attrs, targetCel
|
|
|
259
259
|
cursorPos = cell.pos;
|
|
260
260
|
}
|
|
261
261
|
if (tr.docChanged && cursorPos !== undefined) {
|
|
262
|
-
var $pos = tr.doc.resolve(tr.mapping.map(cursorPos));
|
|
263
262
|
if (dispatch) {
|
|
264
|
-
dispatch(tr
|
|
263
|
+
dispatch(tr);
|
|
265
264
|
}
|
|
266
265
|
return true;
|
|
267
266
|
}
|
|
@@ -11,7 +11,6 @@ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/
|
|
|
11
11
|
import { IconTable } from '@atlaskit/editor-common/icons';
|
|
12
12
|
import { pluginConfig } from './create-plugin-config';
|
|
13
13
|
import { createPlugin as createTableLocalIdPlugin } from './pm-plugins/table-local-id';
|
|
14
|
-
import { createPlugin as createTableSafariDelayedDomSelectionSyncingWorkaroundPlugin } from './pm-plugins/safari-delayed-dom-selection-syncing-workaround';
|
|
15
14
|
import { createPlugin as createTableSafariDeleteCompositionTextIssueWorkaroundPlugin } from './pm-plugins/safari-delete-composition-text-issue-workaround';
|
|
16
15
|
import { createPlugin as createDecorationsPlugin } from './pm-plugins/decorations/plugin';
|
|
17
16
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
@@ -31,7 +30,7 @@ import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
|
31
30
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
32
31
|
return {};
|
|
33
32
|
};
|
|
34
|
-
var tablesPlugin = function tablesPlugin(options) {
|
|
33
|
+
var tablesPlugin = function tablesPlugin(options, api) {
|
|
35
34
|
var editorViewRef = {
|
|
36
35
|
current: null
|
|
37
36
|
};
|
|
@@ -51,6 +50,25 @@ var tablesPlugin = function tablesPlugin(options) {
|
|
|
51
50
|
};
|
|
52
51
|
return {
|
|
53
52
|
name: 'table',
|
|
53
|
+
actions: {
|
|
54
|
+
insertTable: function insertTable(analyticsPayload) {
|
|
55
|
+
return function (state, dispatch) {
|
|
56
|
+
var _api$dependencies$con, _api$dependencies, _api$dependencies$con2, _api$dependencies$con3;
|
|
57
|
+
var node = createTable({
|
|
58
|
+
schema: state.schema
|
|
59
|
+
});
|
|
60
|
+
return (_api$dependencies$con = api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$con2 = _api$dependencies.contentInsertion) === null || _api$dependencies$con2 === void 0 ? void 0 : (_api$dependencies$con3 = _api$dependencies$con2.actions) === null || _api$dependencies$con3 === void 0 ? void 0 : _api$dependencies$con3.insert({
|
|
61
|
+
state: state,
|
|
62
|
+
dispatch: dispatch,
|
|
63
|
+
node: node,
|
|
64
|
+
options: {
|
|
65
|
+
selectNodeInserted: false,
|
|
66
|
+
analyticsPayload: analyticsPayload
|
|
67
|
+
}
|
|
68
|
+
})) !== null && _api$dependencies$con !== void 0 ? _api$dependencies$con : false;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
},
|
|
54
72
|
nodes: function nodes() {
|
|
55
73
|
return [{
|
|
56
74
|
name: 'table',
|
|
@@ -74,7 +92,9 @@ var tablesPlugin = function tablesPlugin(options) {
|
|
|
74
92
|
dispatch = _ref.dispatch,
|
|
75
93
|
portalProviderAPI = _ref.portalProviderAPI,
|
|
76
94
|
eventDispatcher = _ref.eventDispatcher;
|
|
77
|
-
var _ref2 = options || {
|
|
95
|
+
var _ref2 = options || {
|
|
96
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : api.dependencies.analytics.actions
|
|
97
|
+
},
|
|
78
98
|
fullWidthEnabled = _ref2.fullWidthEnabled,
|
|
79
99
|
wasFullWidthEnabled = _ref2.wasFullWidthEnabled,
|
|
80
100
|
breakoutEnabled = _ref2.breakoutEnabled,
|
|
@@ -168,21 +188,6 @@ var tablesPlugin = function tablesPlugin(options) {
|
|
|
168
188
|
}
|
|
169
189
|
}];
|
|
170
190
|
|
|
171
|
-
// workaround for prosemirrors delayed dom selection syncing during pointer drag
|
|
172
|
-
// causing issues with table selections in Safari
|
|
173
|
-
// https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
|
|
174
|
-
|
|
175
|
-
// NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
|
|
176
|
-
// https://github.com/ProseMirror/prosemirror-view/pull/116
|
|
177
|
-
if (browser.safari) {
|
|
178
|
-
plugins.push({
|
|
179
|
-
name: 'tableSafariDelayedDomSelectionSyncingWorkaround',
|
|
180
|
-
plugin: function plugin() {
|
|
181
|
-
return createTableSafariDelayedDomSelectionSyncingWorkaroundPlugin();
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
|
|
186
191
|
// Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
|
|
187
192
|
// https://github.com/ProseMirror/prosemirror/issues/934
|
|
188
193
|
if (browser.safari) {
|
|
@@ -293,22 +298,8 @@ var tablesPlugin = function tablesPlugin(options) {
|
|
|
293
298
|
}));
|
|
294
299
|
},
|
|
295
300
|
pluginsOptions: {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
createNodeHandler: function createNodeHandler(_ref11) {
|
|
299
|
-
var nodeName = _ref11.nodeName,
|
|
300
|
-
schema = _ref11.schema;
|
|
301
|
-
// An EditorPlugin may manage more than one node.
|
|
302
|
-
if (nodeName !== 'table') {
|
|
303
|
-
return null;
|
|
304
|
-
}
|
|
305
|
-
var table = createTable({
|
|
306
|
-
schema: schema
|
|
307
|
-
});
|
|
308
|
-
return table;
|
|
309
|
-
},
|
|
310
|
-
quickInsert: function quickInsert(_ref12) {
|
|
311
|
-
var formatMessage = _ref12.formatMessage;
|
|
301
|
+
quickInsert: function quickInsert(_ref11) {
|
|
302
|
+
var formatMessage = _ref11.formatMessage;
|
|
312
303
|
return [{
|
|
313
304
|
id: 'table',
|
|
314
305
|
title: formatMessage(messages.table),
|
|
@@ -5,7 +5,6 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
5
5
|
import { tableNewColumnMinWidth } from '@atlaskit/editor-common/styles';
|
|
6
6
|
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
7
7
|
import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils';
|
|
8
|
-
import { setMeta } from './metadata';
|
|
9
8
|
import { getResizeState, normaliseTableLayout } from '../pm-plugins/table-resizing/utils/resize-state';
|
|
10
9
|
import { getTableMaxWidth } from '../pm-plugins/table-resizing/utils/misc';
|
|
11
10
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
@@ -26,14 +25,6 @@ export var updateColumnWidths = function updateColumnWidths(resizeState, table,
|
|
|
26
25
|
var attrs = updatedCellsAttrs[cellPos] || _objectSpread({}, table.nodeAt(cellPos).attrs);
|
|
27
26
|
var colspan = attrs.colspan || 1;
|
|
28
27
|
if (attrs.colwidth && attrs.colwidth.length > colspan) {
|
|
29
|
-
tr = setMeta({
|
|
30
|
-
type: 'UPDATE_COLUMN_WIDTHS',
|
|
31
|
-
problem: 'COLWIDTHS_BEFORE_UPDATE',
|
|
32
|
-
data: {
|
|
33
|
-
colwidths: attrs.colwidth,
|
|
34
|
-
colspan: colspan
|
|
35
|
-
}
|
|
36
|
-
})(tr);
|
|
37
28
|
attrs.colwidth = attrs.colwidth.slice(0, colspan);
|
|
38
29
|
}
|
|
39
30
|
|
|
@@ -52,14 +43,6 @@ export var updateColumnWidths = function updateColumnWidths(resizeState, table,
|
|
|
52
43
|
});
|
|
53
44
|
colwidths[colspanIndex] = width;
|
|
54
45
|
if (colwidths.length > colspan) {
|
|
55
|
-
tr = setMeta({
|
|
56
|
-
type: 'UPDATE_COLUMN_WIDTHS',
|
|
57
|
-
problem: 'COLWIDTHS_AFTER_UPDATE',
|
|
58
|
-
data: {
|
|
59
|
-
colwidths: colwidths,
|
|
60
|
-
colspan: colspan
|
|
61
|
-
}
|
|
62
|
-
})(tr);
|
|
63
46
|
colwidths = colwidths.slice(0, colspan);
|
|
64
47
|
}
|
|
65
48
|
updatedCellsAttrs[cellPos] = _objectSpread(_objectSpread({}, attrs), {}, {
|
|
@@ -6,7 +6,6 @@ import { Selection } from 'prosemirror-state';
|
|
|
6
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
7
7
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { AddColumnStep } from '@atlaskit/adf-schema/steps';
|
|
9
|
-
import { setMeta } from './metadata';
|
|
10
9
|
import { splitCellsInColumns } from './split';
|
|
11
10
|
var deleteColumnsCustomStep = function deleteColumnsCustomStep(rect) {
|
|
12
11
|
return function (tr) {
|
|
@@ -133,25 +132,17 @@ var deleteColumnsLegacy = function deleteColumnsLegacy(rect) {
|
|
|
133
132
|
}
|
|
134
133
|
}
|
|
135
134
|
if (!rows.length) {
|
|
136
|
-
return
|
|
137
|
-
type: 'DELETE_COLUMNS',
|
|
138
|
-
problem: 'EMPTY_TABLE'
|
|
139
|
-
})(tr);
|
|
135
|
+
return tr;
|
|
140
136
|
}
|
|
141
137
|
var newTable = table.node.type.createChecked(table.node.attrs, rows, table.node.marks);
|
|
142
138
|
var fixedTable = fixRowSpans(newTable);
|
|
143
139
|
if (fixedTable === null) {
|
|
144
|
-
return
|
|
145
|
-
type: 'DELETE_COLUMNS',
|
|
146
|
-
problem: 'FIX_ROWSPANS'
|
|
147
|
-
})(tr);
|
|
140
|
+
return tr;
|
|
148
141
|
}
|
|
149
142
|
var cursorPos = getNextCursorPos(newTable, columnsToDelete);
|
|
150
|
-
return
|
|
151
|
-
type: 'DELETE_COLUMNS'
|
|
152
|
-
})(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
143
|
+
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
153
144
|
// move cursor to the left of the deleted columns if possible, otherwise - to the first column
|
|
154
|
-
.setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos)))
|
|
145
|
+
.setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos)));
|
|
155
146
|
};
|
|
156
147
|
};
|
|
157
148
|
function getNextCursorPos(table, deletedColumns) {
|
|
@@ -6,7 +6,6 @@ import { Selection } from 'prosemirror-state';
|
|
|
6
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
7
7
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { mergeEmptyColumns } from './merge';
|
|
9
|
-
import { setMeta } from './metadata';
|
|
10
9
|
export var deleteRows = function deleteRows(rect) {
|
|
11
10
|
var isHeaderRowRequired = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
12
11
|
return function (tr) {
|
|
@@ -101,25 +100,17 @@ export var deleteRows = function deleteRows(rect) {
|
|
|
101
100
|
_loop(rowIndex);
|
|
102
101
|
}
|
|
103
102
|
if (!rows.length) {
|
|
104
|
-
return
|
|
105
|
-
type: 'DELETE_ROWS',
|
|
106
|
-
problem: 'EMPTY_TABLE'
|
|
107
|
-
})(tr);
|
|
103
|
+
return tr;
|
|
108
104
|
}
|
|
109
105
|
var newTable = table.node.type.createChecked(table.node.attrs, rows, table.node.marks);
|
|
110
106
|
var fixedTable = mergeEmptyColumns(newTable);
|
|
111
107
|
if (fixedTable === null) {
|
|
112
|
-
return
|
|
113
|
-
type: 'DELETE_ROWS',
|
|
114
|
-
problem: 'REMOVE_EMPTY_COLUMNS'
|
|
115
|
-
})(tr);
|
|
108
|
+
return tr;
|
|
116
109
|
}
|
|
117
110
|
var cursorPos = getNextCursorPos(newTable, rowsToDelete);
|
|
118
|
-
return
|
|
119
|
-
type: 'DELETE_ROWS'
|
|
120
|
-
})(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
111
|
+
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
121
112
|
// move cursor before the deleted rows if possible, otherwise - to the first row
|
|
122
|
-
.setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos)))
|
|
113
|
+
.setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos)));
|
|
123
114
|
};
|
|
124
115
|
};
|
|
125
116
|
function getNextCursorPos(table, deletedRows) {
|
|
@@ -3,21 +3,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { akEditorDefaultLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
6
|
-
import { sendLogs } from '@atlaskit/editor-common/utils';
|
|
7
6
|
import { calculateColumnWidth, contentWidth, getCellsRefsInColumn, getLayoutSize } from '../pm-plugins/table-resizing/utils';
|
|
8
|
-
export var fireAnalytics = function fireAnalytics() {
|
|
9
|
-
var properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10
|
-
return sendLogs({
|
|
11
|
-
events: [{
|
|
12
|
-
name: 'atlaskit.fabric.editor.fixtable',
|
|
13
|
-
product: 'atlaskit',
|
|
14
|
-
properties: properties,
|
|
15
|
-
serverTime: new Date().getTime(),
|
|
16
|
-
server: 'local',
|
|
17
|
-
user: '-'
|
|
18
|
-
}]
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
7
|
var validateTableCellNodeAttrs = function validateTableCellNodeAttrs(_ref, reportInvalidTableCellSpanAttrs) {
|
|
22
8
|
var colspan = _ref.colspan,
|
|
23
9
|
rowspan = _ref.rowspan,
|
|
@@ -73,9 +59,6 @@ export var removeExtraneousColumnWidths = function removeExtraneousColumnWidths(
|
|
|
73
59
|
return cell;
|
|
74
60
|
});
|
|
75
61
|
if (hasProblems) {
|
|
76
|
-
fireAnalytics({
|
|
77
|
-
message: 'removeExtraneousColumnWidths'
|
|
78
|
-
});
|
|
79
62
|
return true;
|
|
80
63
|
}
|
|
81
64
|
return false;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { fixTables, fixAutoSizedTable } from './fix-tables';
|
|
2
2
|
export { mergeCells, canMergeCells, mergeEmptyColumns } from './merge';
|
|
3
3
|
export { deleteColumns } from './delete-columns';
|
|
4
4
|
export { deleteRows } from './delete-rows';
|
|
5
5
|
export { updateColumnWidths } from './column-width';
|
|
6
|
-
export { setMeta } from './metadata';
|
|
7
6
|
export { replaceSelectedTable } from './replace-table';
|
|
@@ -6,8 +6,6 @@ import { Selection } from 'prosemirror-state';
|
|
|
6
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
7
7
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
8
8
|
import { findTable, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
|
-
import { setMeta } from './metadata';
|
|
10
|
-
|
|
11
9
|
// re-creates table node with merged cells
|
|
12
10
|
export function mergeCells(tr) {
|
|
13
11
|
var selection = tr.selection;
|
|
@@ -52,10 +50,7 @@ export function mergeCells(tr) {
|
|
|
52
50
|
}
|
|
53
51
|
var rowspan = rect.bottom - rect.top;
|
|
54
52
|
if (rowspan < 1) {
|
|
55
|
-
return
|
|
56
|
-
type: 'MERGE_CELLS',
|
|
57
|
-
problem: 'NEGATIVE_ROWSPAN'
|
|
58
|
-
})(tr);
|
|
53
|
+
return tr;
|
|
59
54
|
}
|
|
60
55
|
// update colspan and rowspan of the merged cell to span the selection
|
|
61
56
|
var attrs = addColSpan(_objectSpread(_objectSpread({}, cell.attrs), {}, {
|
|
@@ -83,10 +78,7 @@ export function mergeCells(tr) {
|
|
|
83
78
|
if (_rowspan && _rowspan + _i - 1 >= rows.length) {
|
|
84
79
|
rowChanged = true;
|
|
85
80
|
if (_rowspan < 2) {
|
|
86
|
-
return
|
|
87
|
-
type: 'MERGE_CELLS',
|
|
88
|
-
problem: 'NEGATIVE_ROWSPAN'
|
|
89
|
-
})(tr);
|
|
81
|
+
return tr;
|
|
90
82
|
}
|
|
91
83
|
cells.push(_cell.type.createChecked(_objectSpread(_objectSpread({}, _cell.attrs), {}, {
|
|
92
84
|
rowspan: _rowspan - 1
|
|
@@ -104,22 +96,14 @@ export function mergeCells(tr) {
|
|
|
104
96
|
|
|
105
97
|
// empty tables? cancel merging like nothing happened
|
|
106
98
|
if (!rows.length) {
|
|
107
|
-
return
|
|
108
|
-
type: 'MERGE_CELLS',
|
|
109
|
-
problem: 'EMPTY_TABLE'
|
|
110
|
-
})(tr);
|
|
99
|
+
return tr;
|
|
111
100
|
}
|
|
112
101
|
var newTable = table.node.type.createChecked(table.node.attrs, rows, table.node.marks);
|
|
113
102
|
var fixedTable = mergeEmptyColumns(newTable);
|
|
114
103
|
if (fixedTable === null) {
|
|
115
|
-
return
|
|
116
|
-
type: 'MERGE_CELLS',
|
|
117
|
-
problem: 'REMOVE_EMPTY_COLUMNS'
|
|
118
|
-
})(tr);
|
|
104
|
+
return tr;
|
|
119
105
|
}
|
|
120
|
-
return
|
|
121
|
-
type: 'MERGE_CELLS'
|
|
122
|
-
})(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable).setSelection(Selection.near(tr.doc.resolve((mergedCellPos || 0) + table.start))));
|
|
106
|
+
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable).setSelection(Selection.near(tr.doc.resolve((mergedCellPos || 0) + table.start)));
|
|
123
107
|
}
|
|
124
108
|
export function canMergeCells(tr) {
|
|
125
109
|
var selection = tr.selection;
|
package/dist/esm/version.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
|
+
import { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
4
|
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
3
5
|
import { PluginConfig } from './types';
|
|
4
6
|
import type { GetEditorFeatureFlags, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
7
|
+
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
8
|
+
import type { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
5
9
|
interface TablePluginOptions {
|
|
6
10
|
tableOptions: PluginConfig;
|
|
7
11
|
breakoutEnabled?: boolean;
|
|
@@ -12,7 +16,12 @@ interface TablePluginOptions {
|
|
|
12
16
|
editorSelectionAPI?: EditorSelectionAPI;
|
|
13
17
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
14
18
|
}
|
|
19
|
+
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
15
20
|
declare const tablesPlugin: NextEditorPlugin<'table', {
|
|
16
21
|
pluginConfiguration: TablePluginOptions | undefined;
|
|
22
|
+
actions: {
|
|
23
|
+
insertTable: InsertTableAction;
|
|
24
|
+
};
|
|
25
|
+
dependencies: [typeof analyticsPlugin, typeof contentInsertionPlugin];
|
|
17
26
|
}>;
|
|
18
27
|
export default tablesPlugin;
|
|
@@ -2,7 +2,6 @@ import { Node as PMNode } from 'prosemirror-model';
|
|
|
2
2
|
import { Transaction } from 'prosemirror-state';
|
|
3
3
|
import { EditorView } from 'prosemirror-view';
|
|
4
4
|
import { ReportInvalidNodeAttrs } from '../types';
|
|
5
|
-
export declare const fireAnalytics: (properties?: {}) => Promise<Response>;
|
|
6
5
|
export declare const removeExtraneousColumnWidths: (node: PMNode, basePos: number, tr: Transaction, reportInvalidTableCellSpanAttrs?: ReportInvalidNodeAttrs) => boolean;
|
|
7
6
|
export declare const fixTables: (tr: Transaction, reportInvalidTableCellSpanAttrs?: ReportInvalidNodeAttrs) => Transaction | undefined;
|
|
8
7
|
export declare const fixAutoSizedTable: (view: EditorView, tableNode: PMNode, tableRef: HTMLTableElement, tablePos: number, opts: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { fixTables, fixAutoSizedTable } from './fix-tables';
|
|
2
2
|
export { mergeCells, canMergeCells, mergeEmptyColumns } from './merge';
|
|
3
3
|
export { deleteColumns } from './delete-columns';
|
|
4
4
|
export { deleteRows } from './delete-rows';
|
|
5
5
|
export { updateColumnWidths } from './column-width';
|
|
6
|
-
export { setMeta } from './metadata';
|
|
7
6
|
export { replaceSelectedTable } from './replace-table';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NOTE:
|
|
3
|
+
*
|
|
4
|
+
* This file is automatically generated by Traduki 2.0.
|
|
5
|
+
* DO NOT CHANGE IT BY HAND or your changes will be lost.
|
|
6
|
+
*/
|
|
7
|
+
declare const _default: {
|
|
8
|
+
'fabric.editor.canNotSortTable': string;
|
|
9
|
+
'fabric.editor.cellBackground': string;
|
|
10
|
+
'fabric.editor.cellOptions': string;
|
|
11
|
+
'fabric.editor.clearCells': string;
|
|
12
|
+
'fabric.editor.collapseTable': string;
|
|
13
|
+
'fabric.editor.cornerControl': string;
|
|
14
|
+
'fabric.editor.distributeColumns': string;
|
|
15
|
+
'fabric.editor.extension.confirmDeleteLinkedModalMessagePrefix': string;
|
|
16
|
+
'fabric.editor.extension.deleteElementTitle': string;
|
|
17
|
+
'fabric.editor.extension.sourceNoTitledName': string;
|
|
18
|
+
'fabric.editor.floatingToolbar.confirmModalCheckboxLabel': string;
|
|
19
|
+
'fabric.editor.headerColumn': string;
|
|
20
|
+
'fabric.editor.headerRow': string;
|
|
21
|
+
'fabric.editor.insertColumn': string;
|
|
22
|
+
'fabric.editor.insertRow': string;
|
|
23
|
+
'fabric.editor.mergeCells': string;
|
|
24
|
+
'fabric.editor.numberedColumn': string;
|
|
25
|
+
'fabric.editor.removeColumns': string;
|
|
26
|
+
'fabric.editor.removeRows': string;
|
|
27
|
+
'fabric.editor.rowControl': string;
|
|
28
|
+
'fabric.editor.sortColumnASC': string;
|
|
29
|
+
'fabric.editor.sortColumnDESC': string;
|
|
30
|
+
'fabric.editor.splitCell': string;
|
|
31
|
+
'fabric.editor.tableOptions': string;
|
|
32
|
+
'fabric.editor.tables.confirmDeleteLinkedModalMessage': string;
|
|
33
|
+
'fabric.editor.tables.confirmDeleteLinkedModalOKButton': string;
|
|
34
|
+
};
|
|
35
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NOTE:
|
|
3
|
+
*
|
|
4
|
+
* This file is automatically generated by Traduki 2.0.
|
|
5
|
+
* DO NOT CHANGE IT BY HAND or your changes will be lost.
|
|
6
|
+
*/
|
|
7
|
+
declare const _default: {
|
|
8
|
+
'fabric.editor.canNotSortTable': string;
|
|
9
|
+
'fabric.editor.cellBackground': string;
|
|
10
|
+
'fabric.editor.cellOptions': string;
|
|
11
|
+
'fabric.editor.clearCells': string;
|
|
12
|
+
'fabric.editor.collapseTable': string;
|
|
13
|
+
'fabric.editor.cornerControl': string;
|
|
14
|
+
'fabric.editor.distributeColumns': string;
|
|
15
|
+
'fabric.editor.extension.deleteElementTitle': string;
|
|
16
|
+
'fabric.editor.floatingToolbar.confirmModalCheckboxLabel': string;
|
|
17
|
+
'fabric.editor.headerColumn': string;
|
|
18
|
+
'fabric.editor.headerRow': string;
|
|
19
|
+
'fabric.editor.insertColumn': string;
|
|
20
|
+
'fabric.editor.insertRow': string;
|
|
21
|
+
'fabric.editor.mergeCells': string;
|
|
22
|
+
'fabric.editor.numberedColumn': string;
|
|
23
|
+
'fabric.editor.removeColumns': string;
|
|
24
|
+
'fabric.editor.removeRows': string;
|
|
25
|
+
'fabric.editor.rowControl': string;
|
|
26
|
+
'fabric.editor.sortColumnASC': string;
|
|
27
|
+
'fabric.editor.sortColumnDESC': string;
|
|
28
|
+
'fabric.editor.splitCell': string;
|
|
29
|
+
'fabric.editor.tableOptions': string;
|
|
30
|
+
'fabric.editor.tables.confirmDeleteLinkedModalMessage': string;
|
|
31
|
+
'fabric.editor.tables.confirmDeleteLinkedModalOKButton': string;
|
|
32
|
+
};
|
|
33
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NOTE:
|
|
3
|
+
*
|
|
4
|
+
* This file is automatically generated by Traduki 2.0.
|
|
5
|
+
* DO NOT CHANGE IT BY HAND or your changes will be lost.
|
|
6
|
+
*/
|
|
7
|
+
declare const _default: {
|
|
8
|
+
'fabric.editor.canNotSortTable': string;
|
|
9
|
+
'fabric.editor.cellBackground': string;
|
|
10
|
+
'fabric.editor.cellOptions': string;
|
|
11
|
+
'fabric.editor.clearCells': string;
|
|
12
|
+
'fabric.editor.collapseTable': string;
|
|
13
|
+
'fabric.editor.cornerControl': string;
|
|
14
|
+
'fabric.editor.distributeColumns': string;
|
|
15
|
+
'fabric.editor.extension.deleteElementTitle': string;
|
|
16
|
+
'fabric.editor.floatingToolbar.confirmModalCheckboxLabel': string;
|
|
17
|
+
'fabric.editor.headerColumn': string;
|
|
18
|
+
'fabric.editor.headerRow': string;
|
|
19
|
+
'fabric.editor.insertColumn': string;
|
|
20
|
+
'fabric.editor.insertRow': string;
|
|
21
|
+
'fabric.editor.mergeCells': string;
|
|
22
|
+
'fabric.editor.numberedColumn': string;
|
|
23
|
+
'fabric.editor.removeColumns': string;
|
|
24
|
+
'fabric.editor.removeRows': string;
|
|
25
|
+
'fabric.editor.rowControl': string;
|
|
26
|
+
'fabric.editor.sortColumnASC': string;
|
|
27
|
+
'fabric.editor.sortColumnDESC': string;
|
|
28
|
+
'fabric.editor.splitCell': string;
|
|
29
|
+
'fabric.editor.tableOptions': string;
|
|
30
|
+
'fabric.editor.tables.confirmDeleteLinkedModalMessage': string;
|
|
31
|
+
'fabric.editor.tables.confirmDeleteLinkedModalOKButton': string;
|
|
32
|
+
};
|
|
33
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NOTE:
|
|
3
|
+
*
|
|
4
|
+
* This file is automatically generated by Traduki 2.0.
|
|
5
|
+
* DO NOT CHANGE IT BY HAND or your changes will be lost.
|
|
6
|
+
*/
|
|
7
|
+
declare const _default: {
|
|
8
|
+
'fabric.editor.canNotSortTable': string;
|
|
9
|
+
'fabric.editor.cellBackground': string;
|
|
10
|
+
'fabric.editor.cellOptions': string;
|
|
11
|
+
'fabric.editor.clearCells': string;
|
|
12
|
+
'fabric.editor.collapseTable': string;
|
|
13
|
+
'fabric.editor.cornerControl': string;
|
|
14
|
+
'fabric.editor.distributeColumns': string;
|
|
15
|
+
'fabric.editor.extension.confirmDeleteLinkedModalMessagePrefix': string;
|
|
16
|
+
'fabric.editor.extension.deleteElementTitle': string;
|
|
17
|
+
'fabric.editor.extension.sourceNoTitledName': string;
|
|
18
|
+
'fabric.editor.floatingToolbar.confirmModalCheckboxLabel': string;
|
|
19
|
+
'fabric.editor.headerColumn': string;
|
|
20
|
+
'fabric.editor.headerRow': string;
|
|
21
|
+
'fabric.editor.insertColumn': string;
|
|
22
|
+
'fabric.editor.insertRow': string;
|
|
23
|
+
'fabric.editor.mergeCells': string;
|
|
24
|
+
'fabric.editor.numberedColumn': string;
|
|
25
|
+
'fabric.editor.removeColumns': string;
|
|
26
|
+
'fabric.editor.removeRows': string;
|
|
27
|
+
'fabric.editor.rowControl': string;
|
|
28
|
+
'fabric.editor.sortColumnASC': string;
|
|
29
|
+
'fabric.editor.sortColumnDESC': string;
|
|
30
|
+
'fabric.editor.splitCell': string;
|
|
31
|
+
'fabric.editor.tableOptions': string;
|
|
32
|
+
'fabric.editor.tables.confirmDeleteLinkedModalMessage': string;
|
|
33
|
+
'fabric.editor.tables.confirmDeleteLinkedModalOKButton': string;
|
|
34
|
+
};
|
|
35
|
+
export default _default;
|