@atlaskit/editor-plugin-table 0.0.1 → 0.0.3
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/plugins/table/index.js +42 -15
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/index.js +287 -255
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/index.js +41 -15
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +2 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/table/index.d.ts +1 -2
- package/dist/types-ts4.0/index.d.ts +1 -0
- package/dist/types-ts4.0/plugins/plugin-key.d.ts +4 -0
- package/dist/types-ts4.0/plugins/table/commands/clear.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/commands/collapse.d.ts +2 -0
- package/dist/types-ts4.0/plugins/table/commands/go-to-next-cell.d.ts +4 -0
- package/dist/types-ts4.0/plugins/table/commands/hover.d.ts +8 -0
- package/dist/types-ts4.0/plugins/table/commands/index.d.ts +7 -0
- package/dist/types-ts4.0/plugins/table/commands/insert.d.ts +10 -0
- package/dist/types-ts4.0/plugins/table/commands/misc.d.ts +27 -0
- package/dist/types-ts4.0/plugins/table/commands/selection.d.ts +8 -0
- package/dist/types-ts4.0/plugins/table/commands/sort.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/commands/split-cell.d.ts +6 -0
- package/dist/types-ts4.0/plugins/table/commands/toggle.d.ts +12 -0
- package/dist/types-ts4.0/plugins/table/commands-with-analytics.d.ts +26 -0
- package/dist/types-ts4.0/plugins/table/create-plugin-config.d.ts +2 -0
- package/dist/types-ts4.0/plugins/table/event-handlers.d.ts +16 -0
- package/dist/types-ts4.0/plugins/table/handlers.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/index.d.ts +17 -0
- package/dist/types-ts4.0/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +26 -0
- package/dist/types-ts4.0/plugins/table/nodeviews/TableComponent.d.ts +72 -0
- package/dist/types-ts4.0/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +9 -0
- package/dist/types-ts4.0/plugins/table/nodeviews/__mocks__/OverridableMock.d.ts +9 -0
- package/dist/types-ts4.0/plugins/table/nodeviews/table.d.ts +31 -0
- package/dist/types-ts4.0/plugins/table/nodeviews/tableCell.d.ts +19 -0
- package/dist/types-ts4.0/plugins/table/nodeviews/types.d.ts +23 -0
- package/dist/types-ts4.0/plugins/table/nodeviews/update-overflow-shadows.d.ts +8 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/plugin.d.ts +7 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +2 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +2 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/index.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/decorations/utils/types.d.ts +6 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/default-table-selection.d.ts +5 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/keymap.d.ts +5 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/main.d.ts +8 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/plugin-factory.d.ts +1 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.d.ts +4 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +15 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/commands.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/index.d.ts +6 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +6 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +65 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +4 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/types.d.ts +16 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/sticky-headers/util.d.ts +2 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-local-id.d.ts +22 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/commands.d.ts +25 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +4 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/index.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +4 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/plugin.d.ts +6 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/reducer.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +8 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +14 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +4 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +13 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +12 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +22 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +4 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +29 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +17 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +22 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +1 -0
- package/dist/types-ts4.0/plugins/table/pm-plugins/table-selection-keymap.d.ts +4 -0
- package/dist/types-ts4.0/plugins/table/reducer.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/todo-stubs.d.ts +1 -0
- package/dist/types-ts4.0/plugins/table/toolbar.d.ts +36 -0
- package/dist/types-ts4.0/plugins/table/transforms/column-width.d.ts +18 -0
- package/dist/types-ts4.0/plugins/table/transforms/delete-columns.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/transforms/delete-rows.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/transforms/fix-tables.d.ts +10 -0
- package/dist/types-ts4.0/plugins/table/transforms/index.d.ts +7 -0
- package/dist/types-ts4.0/plugins/table/transforms/merge.d.ts +5 -0
- package/dist/types-ts4.0/plugins/table/transforms/metadata.d.ts +21 -0
- package/dist/types-ts4.0/plugins/table/transforms/replace-table.d.ts +5 -0
- package/dist/types-ts4.0/plugins/table/transforms/split.d.ts +9 -0
- package/dist/types-ts4.0/plugins/table/types.d.ts +328 -0
- package/dist/types-ts4.0/plugins/table/ui/FloatingContextualButton/index.d.ts +29 -0
- package/dist/types-ts4.0/plugins/table/ui/FloatingContextualButton/styles.d.ts +1 -0
- package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +87 -0
- package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/index.d.ts +22 -0
- package/dist/types-ts4.0/plugins/table/ui/FloatingContextualMenu/styles.d.ts +2 -0
- package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +14 -0
- package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +10 -0
- package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/index.d.ts +54 -0
- package/dist/types-ts4.0/plugins/table/ui/FloatingDeleteButton/types.d.ts +1 -0
- package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +12 -0
- package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +3 -0
- package/dist/types-ts4.0/plugins/table/ui/FloatingInsertButton/index.d.ts +35 -0
- package/dist/types-ts4.0/plugins/table/ui/LayoutButton/index.d.ts +21 -0
- package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +19 -0
- package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +21 -0
- package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +17 -0
- package/dist/types-ts4.0/plugins/table/ui/TableFloatingControls/index.d.ts +40 -0
- package/dist/types-ts4.0/plugins/table/ui/common-styles.d.ts +4 -0
- package/dist/types-ts4.0/plugins/table/ui/consts.d.ts +39 -0
- package/dist/types-ts4.0/plugins/table/ui/messages.d.ts +38 -0
- package/dist/types-ts4.0/plugins/table/ui/ui-styles.d.ts +15 -0
- package/dist/types-ts4.0/plugins/table/utils/analytics.d.ts +18 -0
- package/dist/types-ts4.0/plugins/table/utils/collapse.d.ts +29 -0
- package/dist/types-ts4.0/plugins/table/utils/column-controls.d.ts +10 -0
- package/dist/types-ts4.0/plugins/table/utils/decoration.d.ts +16 -0
- package/dist/types-ts4.0/plugins/table/utils/dom.d.ts +20 -0
- package/dist/types-ts4.0/plugins/table/utils/get-allow-add-column-custom-step.d.ts +2 -0
- package/dist/types-ts4.0/plugins/table/utils/index.d.ts +11 -0
- package/dist/types-ts4.0/plugins/table/utils/nodes.d.ts +12 -0
- package/dist/types-ts4.0/plugins/table/utils/paste.d.ts +14 -0
- package/dist/types-ts4.0/plugins/table/utils/referentiality.d.ts +2 -0
- package/dist/types-ts4.0/plugins/table/utils/row-controls.d.ts +16 -0
- package/dist/types-ts4.0/plugins/table/utils/selection.d.ts +6 -0
- package/dist/types-ts4.0/plugins/table/utils/table.d.ts +4 -0
- package/dist/types-ts4.0/plugins/table/utils/update-plugin-state-decorations.d.ts +4 -0
- package/dist/types-ts4.0/plugins/table-plugin.d.ts +2 -0
- package/dist/types-ts4.0/types.d.ts +3 -0
- package/examples/99-testing.tsx +227 -0
- package/package.json +16 -3
- package/report.api.md +61 -24
- package/src/plugins/table/__tests__/integration/__fixtures__/auto-size-documents.ts +439 -0
- package/src/plugins/table/__tests__/integration/__fixtures__/basic-table.ts +120 -0
- package/src/plugins/table/__tests__/integration/__fixtures__/empty-paragraph-underneath-table.ts +396 -0
- package/src/plugins/table/__tests__/integration/__fixtures__/even-columns.ts +493 -0
- package/src/plugins/table/__tests__/integration/__fixtures__/layout-documents.ts +607 -0
- package/src/plugins/table/__tests__/integration/__fixtures__/merged-rows-and-cols-document.ts +343 -0
- package/src/plugins/table/__tests__/integration/__fixtures__/nested-in-extension.ts +163 -0
- package/src/plugins/table/__tests__/integration/__fixtures__/paragraph-and-table-adf.json +130 -0
- package/src/plugins/table/__tests__/integration/__fixtures__/resize-documents.ts +1610 -0
- package/src/plugins/table/__tests__/integration/__fixtures__/scale.ts +825 -0
- package/src/plugins/table/__tests__/integration/__fixtures__/table-inside-layout.ts +145 -0
- package/src/plugins/table/__tests__/integration/__fixtures__/table-with-min-width-columns-document.ts +175 -0
- package/src/plugins/table/__tests__/integration/__fixtures__/table-with-multiline-date.adf.json +168 -0
- package/src/plugins/table/__tests__/integration/__fixtures__/table-with-text-and-empty-row.ts +216 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/auto-size.ts.snap +609 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/change-date-inside-table.ts.snap +173 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/copy-button.ts.snap +421 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/delete-columns.ts.snap +818 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/delete-last-column-in-full-width.ts.snap +119 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/delete-last-column-with-empty-action.ts.snap +119 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/delete-last-row-with-empty-action.ts.snap +227 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/delete-rows.ts.snap +959 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/delete-table-when-selected.ts.snap +101 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/deleting-empty-paragraph-under-table.ts.snap +502 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/even-columns.ts.snap +645 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/insert-cell-header-with-strong-mark.ts.snap +172 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/insert-row-inside-layout.ts.snap +238 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/layout.ts.snap +1645 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/resize.ts.snap +2674 -0
- package/src/plugins/table/__tests__/integration/__snapshots__/scale.ts.snap +1083 -0
- package/src/plugins/table/__tests__/integration/arrow-down-into-table.ts +38 -0
- package/src/plugins/table/__tests__/integration/auto-size.ts +87 -0
- package/src/plugins/table/__tests__/integration/block-node-selection.ts +162 -163
- package/src/plugins/table/__tests__/integration/cell-selection.ts +101 -0
- package/src/plugins/table/__tests__/integration/change-date-inside-table.ts +47 -0
- package/src/plugins/table/__tests__/integration/copy-button.ts +179 -0
- package/src/plugins/table/__tests__/integration/delete-columns.ts +95 -0
- package/src/plugins/table/__tests__/integration/delete-last-column-in-full-width.ts +70 -0
- package/src/plugins/table/__tests__/integration/delete-last-column-with-empty-action.ts +58 -0
- package/src/plugins/table/__tests__/integration/delete-last-row-with-empty-action.ts +97 -0
- package/src/plugins/table/__tests__/integration/delete-rows.ts +122 -0
- package/src/plugins/table/__tests__/integration/delete-table-when-selected.ts +110 -0
- package/src/plugins/table/__tests__/integration/deleting-empty-paragraph-under-table.ts +86 -0
- package/src/plugins/table/__tests__/integration/even-columns.ts +72 -0
- package/src/plugins/table/__tests__/integration/insert-cell-header-with-strong-mark.ts +40 -0
- package/src/plugins/table/__tests__/integration/insert-long-smart-link.ts +52 -0
- package/src/plugins/table/__tests__/integration/insert-row-inside-layout.ts +47 -0
- package/src/plugins/table/__tests__/integration/layout.ts +224 -0
- package/src/plugins/table/__tests__/integration/resize-handler.ts +101 -0
- package/src/plugins/table/__tests__/integration/resize.ts +342 -0
- package/src/plugins/table/__tests__/integration/scale.ts +67 -0
- package/src/plugins/table/__tests__/integration/table-controls-selection.ts +70 -0
- package/src/plugins/table/__tests__/unit/commands/insert.ts +0 -1
- package/src/plugins/table/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +2 -0
- package/src/plugins/table/index.tsx +322 -295
- package/src/plugins/table/ui/FloatingContextualButton/index.tsx +2 -2
- package/types/package.json +8 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
3
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
3
4
|
import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
|
|
4
5
|
import { createTable } from '@atlaskit/editor-tables/utils';
|
|
@@ -29,280 +30,311 @@ import LayoutButton from './ui/LayoutButton';
|
|
|
29
30
|
import { isLayoutSupported } from './utils';
|
|
30
31
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
31
32
|
|
|
32
|
-
const
|
|
33
|
-
var _document, _document$body;
|
|
33
|
+
const defaultGetEditorFeatureFlags = () => ({});
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const tablesPlugin = options => {
|
|
36
|
+
const editorViewRef = {
|
|
37
|
+
current: null
|
|
37
38
|
};
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const defaultGetEditorFeatureFlags = () => ({});
|
|
41
39
|
|
|
42
|
-
const
|
|
43
|
-
|
|
40
|
+
const defaultGetEditorContainerWidth = () => {
|
|
41
|
+
if (!editorViewRef.current) {
|
|
42
|
+
var _document, _document$body;
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}, {
|
|
50
|
-
name: 'tableHeader',
|
|
51
|
-
node: tableHeader
|
|
52
|
-
}, {
|
|
53
|
-
name: 'tableRow',
|
|
54
|
-
node: tableRow
|
|
55
|
-
}, {
|
|
56
|
-
name: 'tableCell',
|
|
57
|
-
node: tableCell
|
|
58
|
-
}];
|
|
59
|
-
},
|
|
44
|
+
return {
|
|
45
|
+
width: ((_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) || 500
|
|
46
|
+
};
|
|
47
|
+
}
|
|
60
48
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
plugin: ({
|
|
65
|
-
dispatchAnalyticsEvent,
|
|
66
|
-
dispatch,
|
|
67
|
-
portalProviderAPI,
|
|
68
|
-
eventDispatcher
|
|
69
|
-
}) => {
|
|
70
|
-
const {
|
|
71
|
-
fullWidthEnabled,
|
|
72
|
-
wasFullWidthEnabled,
|
|
73
|
-
breakoutEnabled,
|
|
74
|
-
tableOptions,
|
|
75
|
-
editorAnalyticsAPI,
|
|
76
|
-
getEditorFeatureFlags
|
|
77
|
-
} = options || {};
|
|
78
|
-
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), (options === null || options === void 0 ? void 0 : options.getEditorContainerWidth) || defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI);
|
|
79
|
-
}
|
|
80
|
-
}, {
|
|
81
|
-
name: 'tablePMColResizing',
|
|
82
|
-
plugin: ({
|
|
83
|
-
dispatch
|
|
84
|
-
}) => {
|
|
85
|
-
const {
|
|
86
|
-
fullWidthEnabled,
|
|
87
|
-
tableOptions,
|
|
88
|
-
editorAnalyticsAPI,
|
|
89
|
-
getEditorContainerWidth,
|
|
90
|
-
getEditorFeatureFlags
|
|
91
|
-
} = options || {};
|
|
92
|
-
const {
|
|
93
|
-
allowColumnResizing
|
|
94
|
-
} = pluginConfig(tableOptions);
|
|
95
|
-
return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
|
|
96
|
-
lastColumnResizable: !fullWidthEnabled
|
|
97
|
-
}, getEditorContainerWidth || defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI) : undefined;
|
|
49
|
+
const {
|
|
50
|
+
current: {
|
|
51
|
+
state
|
|
98
52
|
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}, // Needs to be lower priority than editor-tables.tableEditing
|
|
103
|
-
// plugin as it is currently swallowing backspace events inside tables
|
|
104
|
-
{
|
|
105
|
-
name: 'tableKeymap',
|
|
106
|
-
plugin: () => keymapPlugin((options === null || options === void 0 ? void 0 : options.getEditorContainerWidth) || defaultGetEditorContainerWidth, options === null || options === void 0 ? void 0 : options.editorAnalyticsAPI)
|
|
107
|
-
}, {
|
|
108
|
-
name: 'tableSelectionKeymap',
|
|
109
|
-
plugin: () => tableSelectionKeymapPlugin(options === null || options === void 0 ? void 0 : options.editorSelectionAPI)
|
|
110
|
-
}, {
|
|
111
|
-
name: 'tableEditing',
|
|
112
|
-
plugin: () => tableEditing()
|
|
113
|
-
}, {
|
|
114
|
-
name: 'tableStickyHeaders',
|
|
115
|
-
plugin: ({
|
|
116
|
-
dispatch,
|
|
117
|
-
eventDispatcher
|
|
118
|
-
}) => options && options.tableOptions.stickyHeaders ? createStickyHeadersPlugin(dispatch, eventDispatcher, () => [], (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags) : undefined
|
|
119
|
-
}, {
|
|
120
|
-
name: 'tableLocalId',
|
|
121
|
-
plugin: ({
|
|
122
|
-
dispatch
|
|
123
|
-
}) => createTableLocalIdPlugin(dispatch)
|
|
124
|
-
}]; // workaround for prosemirrors delayed dom selection syncing during pointer drag
|
|
125
|
-
// causing issues with table selections in Safari
|
|
126
|
-
// https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
|
|
127
|
-
// NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
|
|
128
|
-
// https://github.com/ProseMirror/prosemirror-view/pull/116
|
|
53
|
+
} = editorViewRef; // TODO: ED-15663
|
|
54
|
+
// Please, do not copy or use this kind of code below
|
|
55
|
+
// @ts-ignore
|
|
129
56
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
name: 'tableSafariDelayedDomSelectionSyncingWorkaround',
|
|
133
|
-
plugin: () => {
|
|
134
|
-
return createTableSafariDelayedDomSelectionSyncingWorkaroundPlugin();
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
} // Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
|
|
138
|
-
// https://github.com/ProseMirror/prosemirror/issues/934
|
|
57
|
+
return state['widthPlugin$'];
|
|
58
|
+
};
|
|
139
59
|
|
|
60
|
+
return {
|
|
61
|
+
name: 'table',
|
|
140
62
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
name: '
|
|
63
|
+
nodes() {
|
|
64
|
+
return [{
|
|
65
|
+
name: 'table',
|
|
66
|
+
node: table
|
|
67
|
+
}, {
|
|
68
|
+
name: 'tableHeader',
|
|
69
|
+
node: tableHeader
|
|
70
|
+
}, {
|
|
71
|
+
name: 'tableRow',
|
|
72
|
+
node: tableRow
|
|
73
|
+
}, {
|
|
74
|
+
name: 'tableCell',
|
|
75
|
+
node: tableCell
|
|
76
|
+
}];
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
pmPlugins() {
|
|
80
|
+
const plugins = [{
|
|
81
|
+
name: 'table',
|
|
82
|
+
plugin: ({
|
|
83
|
+
dispatchAnalyticsEvent,
|
|
84
|
+
dispatch,
|
|
85
|
+
portalProviderAPI,
|
|
86
|
+
eventDispatcher
|
|
87
|
+
}) => {
|
|
88
|
+
const {
|
|
89
|
+
fullWidthEnabled,
|
|
90
|
+
wasFullWidthEnabled,
|
|
91
|
+
breakoutEnabled,
|
|
92
|
+
tableOptions,
|
|
93
|
+
editorAnalyticsAPI,
|
|
94
|
+
getEditorFeatureFlags
|
|
95
|
+
} = options || {};
|
|
96
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI);
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
name: 'tablePMColResizing',
|
|
100
|
+
plugin: ({
|
|
101
|
+
dispatch
|
|
102
|
+
}) => {
|
|
103
|
+
const {
|
|
104
|
+
fullWidthEnabled,
|
|
105
|
+
tableOptions,
|
|
106
|
+
editorAnalyticsAPI,
|
|
107
|
+
getEditorFeatureFlags
|
|
108
|
+
} = options || {};
|
|
109
|
+
const {
|
|
110
|
+
allowColumnResizing
|
|
111
|
+
} = pluginConfig(tableOptions);
|
|
112
|
+
return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
|
|
113
|
+
lastColumnResizable: !fullWidthEnabled
|
|
114
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI) : undefined;
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
name: 'tableEditing',
|
|
118
|
+
plugin: () => createDecorationsPlugin()
|
|
119
|
+
}, // Needs to be lower priority than editor-tables.tableEditing
|
|
120
|
+
// plugin as it is currently swallowing backspace events inside tables
|
|
121
|
+
{
|
|
122
|
+
name: 'tableKeymap',
|
|
123
|
+
plugin: () => keymapPlugin(defaultGetEditorContainerWidth, options === null || options === void 0 ? void 0 : options.editorAnalyticsAPI)
|
|
124
|
+
}, {
|
|
125
|
+
name: 'tableSelectionKeymap',
|
|
126
|
+
plugin: () => tableSelectionKeymapPlugin(options === null || options === void 0 ? void 0 : options.editorSelectionAPI)
|
|
127
|
+
}, {
|
|
128
|
+
name: 'tableEditing',
|
|
129
|
+
plugin: () => tableEditing()
|
|
130
|
+
}, {
|
|
131
|
+
name: 'tableStickyHeaders',
|
|
132
|
+
plugin: ({
|
|
133
|
+
dispatch,
|
|
134
|
+
eventDispatcher
|
|
135
|
+
}) => options && options.tableOptions.stickyHeaders ? createStickyHeadersPlugin(dispatch, eventDispatcher, () => [], (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags) : undefined
|
|
136
|
+
}, {
|
|
137
|
+
name: 'tableLocalId',
|
|
138
|
+
plugin: ({
|
|
139
|
+
dispatch
|
|
140
|
+
}) => createTableLocalIdPlugin(dispatch)
|
|
141
|
+
}, {
|
|
142
|
+
name: 'tableGetEditorViewReferencePlugin',
|
|
144
143
|
plugin: () => {
|
|
145
|
-
return
|
|
144
|
+
return new SafePlugin({
|
|
145
|
+
view: editorView => {
|
|
146
|
+
editorViewRef.current = editorView;
|
|
147
|
+
return {
|
|
148
|
+
destroy: () => {
|
|
149
|
+
editorViewRef.current = null;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
});
|
|
146
154
|
}
|
|
147
|
-
}
|
|
148
|
-
|
|
155
|
+
}]; // workaround for prosemirrors delayed dom selection syncing during pointer drag
|
|
156
|
+
// causing issues with table selections in Safari
|
|
157
|
+
// https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
|
|
158
|
+
// NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
|
|
159
|
+
// https://github.com/ProseMirror/prosemirror-view/pull/116
|
|
149
160
|
|
|
150
|
-
|
|
151
|
-
|
|
161
|
+
if (browser.safari) {
|
|
162
|
+
plugins.push({
|
|
163
|
+
name: 'tableSafariDelayedDomSelectionSyncingWorkaround',
|
|
164
|
+
plugin: () => {
|
|
165
|
+
return createTableSafariDelayedDomSelectionSyncingWorkaroundPlugin();
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
} // Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
|
|
169
|
+
// https://github.com/ProseMirror/prosemirror/issues/934
|
|
152
170
|
|
|
153
|
-
contentComponent({
|
|
154
|
-
editorView,
|
|
155
|
-
popupsMountPoint,
|
|
156
|
-
popupsBoundariesElement,
|
|
157
|
-
popupsScrollableElement,
|
|
158
|
-
dispatchAnalyticsEvent
|
|
159
|
-
}) {
|
|
160
|
-
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
161
|
-
component: ACTION_SUBJECT.TABLES_PLUGIN,
|
|
162
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
163
|
-
fallbackComponent: null
|
|
164
|
-
}, /*#__PURE__*/React.createElement(WithPluginState, {
|
|
165
|
-
plugins: {
|
|
166
|
-
tablePluginState: pluginKey,
|
|
167
|
-
tableResizingPluginState: tableResizingPluginKey,
|
|
168
|
-
stickyHeadersState: stickyHeadersPluginKey
|
|
169
|
-
},
|
|
170
|
-
render: ({
|
|
171
|
-
tableResizingPluginState: resizingPluginState,
|
|
172
|
-
stickyHeadersState,
|
|
173
|
-
tablePluginState
|
|
174
|
-
}) => {
|
|
175
|
-
const {
|
|
176
|
-
state
|
|
177
|
-
} = editorView;
|
|
178
|
-
const isDragging = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
179
|
-
const {
|
|
180
|
-
tableNode,
|
|
181
|
-
tablePos,
|
|
182
|
-
targetCellPosition,
|
|
183
|
-
isContextualMenuOpen,
|
|
184
|
-
layout,
|
|
185
|
-
tableRef,
|
|
186
|
-
pluginConfig,
|
|
187
|
-
insertColumnButtonIndex,
|
|
188
|
-
insertRowButtonIndex,
|
|
189
|
-
isHeaderColumnEnabled,
|
|
190
|
-
isHeaderRowEnabled,
|
|
191
|
-
tableWrapperTarget
|
|
192
|
-
} = tablePluginState;
|
|
193
|
-
const {
|
|
194
|
-
allowControls
|
|
195
|
-
} = pluginConfig;
|
|
196
|
-
const stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
|
|
197
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && tableRef && !isDragging && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
|
|
198
|
-
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
199
|
-
editorView: editorView,
|
|
200
|
-
tableNode: tableNode,
|
|
201
|
-
mountPoint: popupsMountPoint,
|
|
202
|
-
targetCellPosition: targetCellPosition,
|
|
203
|
-
scrollableElement: popupsScrollableElement,
|
|
204
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
205
|
-
isContextualMenuOpen: isContextualMenuOpen,
|
|
206
|
-
layout: layout,
|
|
207
|
-
stickyHeader: stickyHeader
|
|
208
|
-
}), allowControls && /*#__PURE__*/React.createElement(FloatingInsertButton, {
|
|
209
|
-
tableNode: tableNode,
|
|
210
|
-
tableRef: tableRef,
|
|
211
|
-
insertColumnButtonIndex: insertColumnButtonIndex,
|
|
212
|
-
insertRowButtonIndex: insertRowButtonIndex,
|
|
213
|
-
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
214
|
-
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
215
|
-
editorView: editorView,
|
|
216
|
-
mountPoint: popupsMountPoint,
|
|
217
|
-
boundariesElement: popupsBoundariesElement,
|
|
218
|
-
scrollableElement: popupsScrollableElement,
|
|
219
|
-
hasStickyHeaders: stickyHeader && stickyHeader.sticky,
|
|
220
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
221
|
-
editorAnalyticsAPI: options === null || options === void 0 ? void 0 : options.editorAnalyticsAPI,
|
|
222
|
-
getEditorContainerWidth: (options === null || options === void 0 ? void 0 : options.getEditorContainerWidth) || defaultGetEditorContainerWidth
|
|
223
|
-
}), /*#__PURE__*/React.createElement(FloatingContextualMenu, {
|
|
224
|
-
editorView: editorView,
|
|
225
|
-
mountPoint: popupsMountPoint,
|
|
226
|
-
boundariesElement: popupsBoundariesElement,
|
|
227
|
-
targetCellPosition: targetCellPosition,
|
|
228
|
-
isOpen: Boolean(isContextualMenuOpen),
|
|
229
|
-
pluginConfig: pluginConfig,
|
|
230
|
-
editorAnalyticsAPI: options === null || options === void 0 ? void 0 : options.editorAnalyticsAPI,
|
|
231
|
-
getEditorContainerWidth: (options === null || options === void 0 ? void 0 : options.getEditorContainerWidth) || defaultGetEditorContainerWidth
|
|
232
|
-
}), allowControls && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
233
|
-
editorView: editorView,
|
|
234
|
-
selection: editorView.state.selection,
|
|
235
|
-
tableRef: tableRef,
|
|
236
|
-
mountPoint: popupsMountPoint,
|
|
237
|
-
boundariesElement: popupsBoundariesElement,
|
|
238
|
-
scrollableElement: popupsScrollableElement,
|
|
239
|
-
stickyHeaders: stickyHeader,
|
|
240
|
-
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
241
|
-
editorAnalyticsAPI: options === null || options === void 0 ? void 0 : options.editorAnalyticsAPI
|
|
242
|
-
}), isLayoutSupported(state) && options && options.breakoutEnabled && /*#__PURE__*/React.createElement(LayoutButton, {
|
|
243
|
-
editorView: editorView,
|
|
244
|
-
mountPoint: popupsMountPoint,
|
|
245
|
-
boundariesElement: popupsBoundariesElement,
|
|
246
|
-
scrollableElement: popupsScrollableElement,
|
|
247
|
-
targetRef: tableWrapperTarget,
|
|
248
|
-
layout: layout,
|
|
249
|
-
isResizing: !!resizingPluginState && !!resizingPluginState.dragging,
|
|
250
|
-
stickyHeader: stickyHeader,
|
|
251
|
-
editorAnalyticsAPI: options === null || options === void 0 ? void 0 : options.editorAnalyticsAPI
|
|
252
|
-
}));
|
|
253
|
-
}
|
|
254
|
-
}));
|
|
255
|
-
},
|
|
256
171
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
// An EditorPlugin may manage more than one node.
|
|
265
|
-
if (nodeName !== 'table') {
|
|
266
|
-
return null;
|
|
172
|
+
if (browser.safari) {
|
|
173
|
+
plugins.push({
|
|
174
|
+
name: 'tableSafariDeleteCompositionTextIssueWorkaround',
|
|
175
|
+
plugin: () => {
|
|
176
|
+
return createTableSafariDeleteCompositionTextIssueWorkaroundPlugin();
|
|
177
|
+
}
|
|
178
|
+
});
|
|
267
179
|
}
|
|
268
180
|
|
|
269
|
-
|
|
270
|
-
schema
|
|
271
|
-
});
|
|
272
|
-
return table;
|
|
181
|
+
return plugins;
|
|
273
182
|
},
|
|
274
|
-
quickInsert: ({
|
|
275
|
-
formatMessage
|
|
276
|
-
}) => [{
|
|
277
|
-
id: 'table',
|
|
278
|
-
title: formatMessage(messages.table),
|
|
279
|
-
description: formatMessage(messages.tableDescription),
|
|
280
|
-
keywords: ['cell', 'table'],
|
|
281
|
-
priority: 600,
|
|
282
|
-
keyshortcut: tooltip(toggleTable),
|
|
283
183
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
184
|
+
contentComponent({
|
|
185
|
+
editorView,
|
|
186
|
+
popupsMountPoint,
|
|
187
|
+
popupsBoundariesElement,
|
|
188
|
+
popupsScrollableElement,
|
|
189
|
+
dispatchAnalyticsEvent
|
|
190
|
+
}) {
|
|
191
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
192
|
+
component: ACTION_SUBJECT.TABLES_PLUGIN,
|
|
193
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
194
|
+
fallbackComponent: null
|
|
195
|
+
}, /*#__PURE__*/React.createElement(WithPluginState, {
|
|
196
|
+
plugins: {
|
|
197
|
+
tablePluginState: pluginKey,
|
|
198
|
+
tableResizingPluginState: tableResizingPluginKey,
|
|
199
|
+
stickyHeadersState: stickyHeadersPluginKey
|
|
200
|
+
},
|
|
201
|
+
render: ({
|
|
202
|
+
tableResizingPluginState: resizingPluginState,
|
|
203
|
+
stickyHeadersState,
|
|
204
|
+
tablePluginState
|
|
205
|
+
}) => {
|
|
206
|
+
const {
|
|
207
|
+
state
|
|
208
|
+
} = editorView;
|
|
209
|
+
const isDragging = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
210
|
+
const {
|
|
211
|
+
tableNode,
|
|
212
|
+
tablePos,
|
|
213
|
+
targetCellPosition,
|
|
214
|
+
isContextualMenuOpen,
|
|
215
|
+
layout,
|
|
216
|
+
tableRef,
|
|
217
|
+
pluginConfig,
|
|
218
|
+
insertColumnButtonIndex,
|
|
219
|
+
insertRowButtonIndex,
|
|
220
|
+
isHeaderColumnEnabled,
|
|
221
|
+
isHeaderRowEnabled,
|
|
222
|
+
tableWrapperTarget
|
|
223
|
+
} = tablePluginState;
|
|
224
|
+
const {
|
|
225
|
+
allowControls
|
|
226
|
+
} = pluginConfig;
|
|
227
|
+
const stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
|
|
228
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && tableRef && !isDragging && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
|
|
229
|
+
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
230
|
+
editorView: editorView,
|
|
231
|
+
tableNode: tableNode,
|
|
232
|
+
mountPoint: popupsMountPoint,
|
|
233
|
+
targetCellPosition: targetCellPosition,
|
|
234
|
+
scrollableElement: popupsScrollableElement,
|
|
235
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
236
|
+
isContextualMenuOpen: isContextualMenuOpen,
|
|
237
|
+
layout: layout,
|
|
238
|
+
stickyHeader: stickyHeader
|
|
239
|
+
}), allowControls && /*#__PURE__*/React.createElement(FloatingInsertButton, {
|
|
240
|
+
tableNode: tableNode,
|
|
241
|
+
tableRef: tableRef,
|
|
242
|
+
insertColumnButtonIndex: insertColumnButtonIndex,
|
|
243
|
+
insertRowButtonIndex: insertRowButtonIndex,
|
|
244
|
+
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
245
|
+
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
246
|
+
editorView: editorView,
|
|
247
|
+
mountPoint: popupsMountPoint,
|
|
248
|
+
boundariesElement: popupsBoundariesElement,
|
|
249
|
+
scrollableElement: popupsScrollableElement,
|
|
250
|
+
hasStickyHeaders: stickyHeader && stickyHeader.sticky,
|
|
251
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
252
|
+
editorAnalyticsAPI: options === null || options === void 0 ? void 0 : options.editorAnalyticsAPI,
|
|
253
|
+
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
254
|
+
}), /*#__PURE__*/React.createElement(FloatingContextualMenu, {
|
|
255
|
+
editorView: editorView,
|
|
256
|
+
mountPoint: popupsMountPoint,
|
|
257
|
+
boundariesElement: popupsBoundariesElement,
|
|
258
|
+
targetCellPosition: targetCellPosition,
|
|
259
|
+
isOpen: Boolean(isContextualMenuOpen),
|
|
260
|
+
pluginConfig: pluginConfig,
|
|
261
|
+
editorAnalyticsAPI: options === null || options === void 0 ? void 0 : options.editorAnalyticsAPI,
|
|
262
|
+
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
263
|
+
}), allowControls && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
264
|
+
editorView: editorView,
|
|
265
|
+
selection: editorView.state.selection,
|
|
266
|
+
tableRef: tableRef,
|
|
267
|
+
mountPoint: popupsMountPoint,
|
|
268
|
+
boundariesElement: popupsBoundariesElement,
|
|
269
|
+
scrollableElement: popupsScrollableElement,
|
|
270
|
+
stickyHeaders: stickyHeader,
|
|
271
|
+
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
272
|
+
editorAnalyticsAPI: options === null || options === void 0 ? void 0 : options.editorAnalyticsAPI
|
|
273
|
+
}), isLayoutSupported(state) && options && options.breakoutEnabled && /*#__PURE__*/React.createElement(LayoutButton, {
|
|
274
|
+
editorView: editorView,
|
|
275
|
+
mountPoint: popupsMountPoint,
|
|
276
|
+
boundariesElement: popupsBoundariesElement,
|
|
277
|
+
scrollableElement: popupsScrollableElement,
|
|
278
|
+
targetRef: tableWrapperTarget,
|
|
279
|
+
layout: layout,
|
|
280
|
+
isResizing: !!resizingPluginState && !!resizingPluginState.dragging,
|
|
281
|
+
stickyHeader: stickyHeader,
|
|
282
|
+
editorAnalyticsAPI: options === null || options === void 0 ? void 0 : options.editorAnalyticsAPI
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
}));
|
|
286
|
+
},
|
|
287
287
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
288
|
+
pluginsOptions: {
|
|
289
|
+
// TODO: ED-14676 This is not the final API design
|
|
290
|
+
// For now, we are using this on (insert-api/api.ts) but we may create a proper place for it
|
|
291
|
+
createNodeHandler: ({
|
|
292
|
+
nodeName,
|
|
293
|
+
schema
|
|
294
|
+
}) => {
|
|
295
|
+
// An EditorPlugin may manage more than one node.
|
|
296
|
+
if (nodeName !== 'table') {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const table = createTable({
|
|
301
|
+
schema
|
|
302
|
+
});
|
|
303
|
+
return table;
|
|
304
|
+
},
|
|
305
|
+
quickInsert: ({
|
|
306
|
+
formatMessage
|
|
307
|
+
}) => [{
|
|
308
|
+
id: 'table',
|
|
309
|
+
title: formatMessage(messages.table),
|
|
310
|
+
description: formatMessage(messages.tableDescription),
|
|
311
|
+
keywords: ['cell', 'table'],
|
|
312
|
+
priority: 600,
|
|
313
|
+
keyshortcut: tooltip(toggleTable),
|
|
302
314
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
315
|
+
// icon: () => <IconTable />,
|
|
316
|
+
action(insert, state) {
|
|
317
|
+
var _options$editorAnalyt;
|
|
318
|
+
|
|
319
|
+
const tr = insert(createTable({
|
|
320
|
+
schema: state.schema
|
|
321
|
+
}));
|
|
322
|
+
options === null || options === void 0 ? void 0 : (_options$editorAnalyt = options.editorAnalyticsAPI) === null || _options$editorAnalyt === void 0 ? void 0 : _options$editorAnalyt.attachAnalyticsEvent({
|
|
323
|
+
action: ACTION.INSERTED,
|
|
324
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
325
|
+
actionSubjectId: ACTION_SUBJECT_ID.TABLE,
|
|
326
|
+
attributes: {
|
|
327
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
328
|
+
},
|
|
329
|
+
eventType: EVENT_TYPE.TRACK
|
|
330
|
+
})(tr);
|
|
331
|
+
return tr;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
}],
|
|
335
|
+
floatingToolbar: getToolbarConfig(defaultGetEditorContainerWidth, options === null || options === void 0 ? void 0 : options.editorAnalyticsAPI)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
};
|
|
307
339
|
|
|
308
340
|
export default tablesPlugin;
|
|
@@ -69,8 +69,8 @@ export class FloatingContextualButtonInner extends React.Component {
|
|
|
69
69
|
selection: editorView.state.selection.toJSON(),
|
|
70
70
|
position: targetCellPosition,
|
|
71
71
|
docSize: editorView.state.doc.nodeSize,
|
|
72
|
-
error: error.
|
|
73
|
-
errorStack: error.stack
|
|
72
|
+
error: error instanceof Error ? error.message : String(error),
|
|
73
|
+
errorStack: error instanceof Error ? error.stack : undefined
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
dispatchAnalyticsEvent(payload);
|
package/dist/es2019/version.json
CHANGED