@atlaskit/editor-plugin-table 7.30.2 → 7.31.1
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 +25 -0
- package/dist/cjs/commands/column-resize.js +10 -8
- package/dist/cjs/commands/misc.js +4 -4
- package/dist/cjs/event-handlers.js +69 -65
- package/dist/cjs/plugin.js +94 -53
- package/dist/cjs/pm-plugins/decorations/utils/column-resizing.js +2 -2
- package/dist/cjs/pm-plugins/keymap.js +18 -15
- package/dist/cjs/pm-plugins/main.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/cjs/pm-plugins/view-mode-sort/index.js +35 -10
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +1 -1
- package/dist/cjs/ui/common-styles.js +8 -18
- package/dist/cjs/utils/decoration.js +28 -8
- package/dist/es2019/commands/column-resize.js +10 -8
- package/dist/es2019/commands/misc.js +4 -4
- package/dist/es2019/event-handlers.js +4 -4
- package/dist/es2019/plugin.js +53 -9
- package/dist/es2019/pm-plugins/decorations/utils/column-resizing.js +2 -2
- package/dist/es2019/pm-plugins/keymap.js +7 -4
- package/dist/es2019/pm-plugins/main.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/es2019/pm-plugins/view-mode-sort/index.js +33 -10
- package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +1 -1
- package/dist/es2019/ui/common-styles.js +0 -15
- package/dist/es2019/utils/decoration.js +26 -9
- package/dist/esm/commands/column-resize.js +10 -8
- package/dist/esm/commands/misc.js +4 -4
- package/dist/esm/event-handlers.js +69 -65
- package/dist/esm/plugin.js +91 -50
- package/dist/esm/pm-plugins/decorations/utils/column-resizing.js +2 -2
- package/dist/esm/pm-plugins/keymap.js +18 -15
- package/dist/esm/pm-plugins/main.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/esm/pm-plugins/view-mode-sort/index.js +35 -10
- package/dist/esm/ui/FloatingContextualButton/FixedButton.js +1 -1
- package/dist/esm/ui/common-styles.js +8 -18
- package/dist/esm/utils/decoration.js +28 -8
- package/dist/types/commands/column-resize.d.ts +5 -2
- package/dist/types/commands/misc.d.ts +3 -2
- package/dist/types/commands/toggle.d.ts +1 -1
- package/dist/types/commands-with-analytics.d.ts +2 -2
- package/dist/types/event-handlers.d.ts +2 -1
- package/dist/types/pm-plugins/decorations/utils/column-resizing.d.ts +2 -1
- package/dist/types/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/event-handlers.d.ts +2 -1
- package/dist/types/pm-plugins/table-resizing/plugin.d.ts +2 -1
- package/dist/types/pm-plugins/view-mode-sort/index.d.ts +2 -1
- package/dist/types/toDOM.d.ts +1 -1
- package/dist/types/utils/decoration.d.ts +2 -1
- package/dist/types-ts4.5/commands/column-resize.d.ts +5 -2
- package/dist/types-ts4.5/commands/misc.d.ts +3 -2
- package/dist/types-ts4.5/commands/toggle.d.ts +1 -1
- package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -2
- package/dist/types-ts4.5/event-handlers.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/decorations/utils/column-resizing.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/event-handlers.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/plugin.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/view-mode-sort/index.d.ts +2 -1
- package/dist/types-ts4.5/toDOM.d.ts +1 -1
- package/dist/types-ts4.5/utils/decoration.d.ts +2 -1
- package/package.json +11 -7
- package/src/commands/column-resize.ts +18 -1
- package/src/commands/misc.ts +5 -0
- package/src/commands-with-analytics.ts +2 -2
- package/src/event-handlers.ts +22 -20
- package/src/plugin.tsx +63 -6
- package/src/pm-plugins/decorations/utils/column-resizing.ts +3 -0
- package/src/pm-plugins/keymap.ts +5 -0
- package/src/pm-plugins/main.ts +2 -1
- package/src/pm-plugins/table-resizing/event-handlers.ts +8 -1
- package/src/pm-plugins/table-resizing/plugin.ts +3 -0
- package/src/pm-plugins/view-mode-sort/index.ts +73 -34
- package/src/toDOM.ts +1 -1
- package/src/toolbar.tsx +1 -1
- package/src/ui/FloatingContextualButton/FixedButton.tsx +1 -1
- package/src/ui/common-styles.ts +0 -17
- package/src/utils/decoration.ts +39 -13
|
@@ -245,78 +245,82 @@ export var handleMouseLeave = function handleMouseLeave(view, event) {
|
|
|
245
245
|
|
|
246
246
|
// IMPORTANT: The mouse move handler has been setup with RAF schedule to avoid Reflows which will occur as some methods
|
|
247
247
|
// need to access the mouse event offset position and also the target clientWidth vallue.
|
|
248
|
-
var handleMouseMoveDebounce =
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
var element = event.target;
|
|
253
|
-
if (isColumnControlsDecorations(element) || isDragColumnFloatingInsertDot(element)) {
|
|
254
|
-
var state = view.state,
|
|
255
|
-
dispatch = view.dispatch;
|
|
256
|
-
var _getPluginState6 = getPluginState(state),
|
|
257
|
-
insertColumnButtonIndex = _getPluginState6.insertColumnButtonIndex;
|
|
258
|
-
var _getColumnOrRowIndex9 = getColumnOrRowIndex(element),
|
|
259
|
-
_getColumnOrRowIndex10 = _slicedToArray(_getColumnOrRowIndex9, 2),
|
|
260
|
-
startIndex = _getColumnOrRowIndex10[0],
|
|
261
|
-
endIndex = _getColumnOrRowIndex10[1];
|
|
262
|
-
var positionColumn = getMousePositionHorizontalRelativeByElement(event, offsetX, undefined) === 'right' ? endIndex : startIndex;
|
|
263
|
-
if (positionColumn !== insertColumnButtonIndex) {
|
|
264
|
-
return showInsertColumnButton(positionColumn)(state, dispatch);
|
|
248
|
+
var handleMouseMoveDebounce = function handleMouseMoveDebounce(nodeViewPortalProviderAPI) {
|
|
249
|
+
return rafSchedule(function (view, event, offsetX) {
|
|
250
|
+
if (!(event.target instanceof HTMLElement)) {
|
|
251
|
+
return false;
|
|
265
252
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
253
|
+
var element = event.target;
|
|
254
|
+
if (isColumnControlsDecorations(element) || isDragColumnFloatingInsertDot(element)) {
|
|
255
|
+
var state = view.state,
|
|
256
|
+
dispatch = view.dispatch;
|
|
257
|
+
var _getPluginState6 = getPluginState(state),
|
|
258
|
+
insertColumnButtonIndex = _getPluginState6.insertColumnButtonIndex;
|
|
259
|
+
var _getColumnOrRowIndex9 = getColumnOrRowIndex(element),
|
|
260
|
+
_getColumnOrRowIndex10 = _slicedToArray(_getColumnOrRowIndex9, 2),
|
|
261
|
+
startIndex = _getColumnOrRowIndex10[0],
|
|
262
|
+
endIndex = _getColumnOrRowIndex10[1];
|
|
263
|
+
var positionColumn = getMousePositionHorizontalRelativeByElement(event, offsetX, undefined) === 'right' ? endIndex : startIndex;
|
|
264
|
+
if (positionColumn !== insertColumnButtonIndex) {
|
|
265
|
+
return showInsertColumnButton(positionColumn)(state, dispatch);
|
|
266
|
+
}
|
|
279
267
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
var
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
268
|
+
if (isRowControlsButton(element) || isDragRowFloatingInsertDot(element)) {
|
|
269
|
+
var _state3 = view.state,
|
|
270
|
+
_dispatch4 = view.dispatch;
|
|
271
|
+
var _getPluginState7 = getPluginState(_state3),
|
|
272
|
+
insertRowButtonIndex = _getPluginState7.insertRowButtonIndex;
|
|
273
|
+
var _getColumnOrRowIndex11 = getColumnOrRowIndex(element),
|
|
274
|
+
_getColumnOrRowIndex12 = _slicedToArray(_getColumnOrRowIndex11, 2),
|
|
275
|
+
_startIndex3 = _getColumnOrRowIndex12[0],
|
|
276
|
+
_endIndex2 = _getColumnOrRowIndex12[1];
|
|
277
|
+
var positionRow = getMousePositionVerticalRelativeByElement(event) === 'bottom' ? _endIndex2 : _startIndex3;
|
|
278
|
+
if (positionRow !== insertRowButtonIndex) {
|
|
279
|
+
return showInsertRowButton(positionRow)(_state3, _dispatch4);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (!isResizeHandleDecoration(element) && isCell(element)) {
|
|
283
|
+
var _positionColumn = getMousePositionHorizontalRelativeByElement(event, offsetX, RESIZE_HANDLE_AREA_DECORATION_GAP);
|
|
284
|
+
if (_positionColumn !== null) {
|
|
285
|
+
var _state4 = view.state,
|
|
286
|
+
_dispatch5 = view.dispatch;
|
|
287
|
+
var _getPluginState8 = getPluginState(_state4),
|
|
288
|
+
resizeHandleColumnIndex = _getPluginState8.resizeHandleColumnIndex,
|
|
289
|
+
resizeHandleRowIndex = _getPluginState8.resizeHandleRowIndex;
|
|
290
|
+
var isKeyboardResize = getPluginState(_state4).isKeyboardResize;
|
|
291
|
+
var tableCell = closestElement(element, 'td, th');
|
|
292
|
+
var cellStartPosition = view.posAtDOM(tableCell, 0);
|
|
293
|
+
var rect = findCellRectClosestToPos(_state4.doc.resolve(cellStartPosition));
|
|
294
|
+
if (rect) {
|
|
295
|
+
var columnEndIndexTarget = _positionColumn === 'left' ? rect.left : rect.right;
|
|
296
|
+
var rowIndexTarget = rect.top;
|
|
297
|
+
if ((columnEndIndexTarget !== resizeHandleColumnIndex || rowIndexTarget !== resizeHandleRowIndex || !hasResizeHandler({
|
|
298
|
+
target: element,
|
|
299
|
+
columnEndIndexTarget: columnEndIndexTarget
|
|
300
|
+
})) && !isKeyboardResize // if initiated by keyboard don't need to react on hover for other resize sliders
|
|
301
|
+
) {
|
|
302
|
+
return addResizeHandleDecorations(rowIndexTarget, columnEndIndexTarget, true, nodeViewPortalProviderAPI)(_state4, _dispatch5);
|
|
303
|
+
}
|
|
302
304
|
}
|
|
303
305
|
}
|
|
304
306
|
}
|
|
305
|
-
}
|
|
306
|
-
return false;
|
|
307
|
-
});
|
|
308
|
-
export var handleMouseMove = function handleMouseMove(view, event) {
|
|
309
|
-
if (!(event.target instanceof HTMLElement)) {
|
|
310
307
|
return false;
|
|
311
|
-
}
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
export var handleMouseMove = function handleMouseMove(nodeViewPortalProviderAPI) {
|
|
311
|
+
return function (view, event) {
|
|
312
|
+
if (!(event.target instanceof HTMLElement)) {
|
|
313
|
+
return false;
|
|
314
|
+
}
|
|
312
315
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
316
|
+
// NOTE: When accessing offsetX in gecko from a deferred callback, it will return 0. However it will be non-zero if accessed
|
|
317
|
+
// within the scope of it's initial mouse move handler. Also Chrome does return the correct value, however it could trigger
|
|
318
|
+
// a reflow. So for now this will just grab the offsetX value immediately for gecko and chrome will calculate later
|
|
319
|
+
// in the deferred callback handler.
|
|
320
|
+
// Bug Tracking: https://bugzilla.mozilla.org/show_bug.cgi?id=1882903
|
|
321
|
+
handleMouseMoveDebounce(nodeViewPortalProviderAPI)(view, event, browser.gecko ? event.offsetX : NaN);
|
|
322
|
+
return false;
|
|
323
|
+
};
|
|
320
324
|
};
|
|
321
325
|
export function handleTripleClick(view, pos) {
|
|
322
326
|
var state = view.state,
|
package/dist/esm/plugin.js
CHANGED
|
@@ -9,11 +9,15 @@ import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
|
9
9
|
import { IconTable } from '@atlaskit/editor-common/icons';
|
|
10
10
|
import { toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
11
11
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
12
|
+
import { getParentOfTypeCount, getPositionAfterTopParentNodeOfType } from '@atlaskit/editor-common/nesting';
|
|
12
13
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
13
14
|
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
15
|
+
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
16
|
+
import { hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
14
17
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
15
18
|
import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
|
|
16
19
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
17
21
|
import { insertTableWithSize } from './commands/insert';
|
|
18
22
|
import { pluginConfig } from './create-plugin-config';
|
|
19
23
|
import { createPlugin as createTableAnalyticsPlugin } from './pm-plugins/analytics/plugin';
|
|
@@ -115,6 +119,21 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
115
119
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
116
120
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
|
|
117
121
|
})(state.schema);
|
|
122
|
+
|
|
123
|
+
// If the cursor is inside a table
|
|
124
|
+
var insertAt;
|
|
125
|
+
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && fg('platform_editor_use_nested_table_pm_nodes')) {
|
|
126
|
+
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|
|
127
|
+
if (editorExperiment('nested-tables-in-tables', false, {
|
|
128
|
+
exposure: true
|
|
129
|
+
}) || getParentOfTypeCount(state.schema.nodes.table)(state.selection) > 1) {
|
|
130
|
+
var positionAfterTopTable = getPositionAfterTopParentNodeOfType(state.schema.nodes.table)(state.selection);
|
|
131
|
+
if (!positionAfterTopTable) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
insertAt = TextSelection.create(state.doc, positionAfterTopTable);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
118
137
|
return (_api$contentInsertion = api === null || api === void 0 || (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 || (_api$contentInsertion2 = _api$contentInsertion2.actions) === null || _api$contentInsertion2 === void 0 ? void 0 : _api$contentInsertion2.insert({
|
|
119
138
|
state: state,
|
|
120
139
|
dispatch: dispatch,
|
|
@@ -125,7 +144,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
125
144
|
attributes: _objectSpread(_objectSpread({}, analyticsPayload.attributes), {}, {
|
|
126
145
|
localId: node.attrs.localId
|
|
127
146
|
})
|
|
128
|
-
})
|
|
147
|
+
}),
|
|
148
|
+
insertAt: insertAt
|
|
129
149
|
}
|
|
130
150
|
})) !== null && _api$contentInsertion !== void 0 ? _api$contentInsertion : false;
|
|
131
151
|
};
|
|
@@ -181,6 +201,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
181
201
|
var dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
182
202
|
dispatch = _ref2.dispatch,
|
|
183
203
|
portalProviderAPI = _ref2.portalProviderAPI,
|
|
204
|
+
nodeViewPortalProviderAPI = _ref2.nodeViewPortalProviderAPI,
|
|
184
205
|
eventDispatcher = _ref2.eventDispatcher,
|
|
185
206
|
getIntl = _ref2.getIntl;
|
|
186
207
|
var _ref3 = options || {},
|
|
@@ -194,12 +215,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
194
215
|
isTableAlignmentEnabled = _ref3.isTableAlignmentEnabled,
|
|
195
216
|
isCommentEditor = _ref3.isCommentEditor,
|
|
196
217
|
isChromelessEditor = _ref3.isChromelessEditor;
|
|
197
|
-
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor);
|
|
218
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor);
|
|
198
219
|
}
|
|
199
220
|
}, {
|
|
200
221
|
name: 'tablePMColResizing',
|
|
201
222
|
plugin: function plugin(_ref4) {
|
|
202
|
-
var dispatch = _ref4.dispatch
|
|
223
|
+
var dispatch = _ref4.dispatch,
|
|
224
|
+
nodeViewPortalProviderAPI = _ref4.nodeViewPortalProviderAPI;
|
|
203
225
|
var _ref5 = options || {},
|
|
204
226
|
fullWidthEnabled = _ref5.fullWidthEnabled,
|
|
205
227
|
tableOptions = _ref5.tableOptions,
|
|
@@ -211,7 +233,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
211
233
|
allowColumnResizing = _pluginConfig2.allowColumnResizing;
|
|
212
234
|
return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
|
|
213
235
|
lastColumnResizable: !fullWidthEnabled
|
|
214
|
-
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, api, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled, isTableAlignmentEnabled, !!(options !== null && options !== void 0 && options.isCommentEditor)) : undefined;
|
|
236
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled, isTableAlignmentEnabled, !!(options !== null && options !== void 0 && options.isCommentEditor)) : undefined;
|
|
215
237
|
}
|
|
216
238
|
}, {
|
|
217
239
|
name: 'tableEditing',
|
|
@@ -224,7 +246,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
224
246
|
{
|
|
225
247
|
name: 'tableKeymap',
|
|
226
248
|
plugin: function plugin(_ref6) {
|
|
227
|
-
var getIntl = _ref6.getIntl
|
|
249
|
+
var getIntl = _ref6.getIntl,
|
|
250
|
+
nodeViewPortalProviderAPI = _ref6.nodeViewPortalProviderAPI;
|
|
228
251
|
var _ref7 = options || {},
|
|
229
252
|
dragAndDropEnabled = _ref7.dragAndDropEnabled,
|
|
230
253
|
_ref7$isTableScalingE = _ref7.isTableScalingEnabled,
|
|
@@ -239,7 +262,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
239
262
|
isChromelessEditor = _ref7$isChromelessEdi === void 0 ? false : _ref7$isChromelessEdi,
|
|
240
263
|
_ref7$tableResizingEn = _ref7.tableResizingEnabled,
|
|
241
264
|
tableResizingEnabled = _ref7$tableResizingEn === void 0 ? false : _ref7$tableResizingEn;
|
|
242
|
-
return keymapPlugin(defaultGetEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
|
|
265
|
+
return keymapPlugin(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
|
|
243
266
|
}
|
|
244
267
|
}, {
|
|
245
268
|
name: 'tableSelectionKeymap',
|
|
@@ -286,45 +309,46 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
286
309
|
}
|
|
287
310
|
}, {
|
|
288
311
|
name: 'tableViewModeSort',
|
|
289
|
-
plugin: function plugin() {
|
|
290
|
-
|
|
312
|
+
plugin: function plugin(_ref13) {
|
|
313
|
+
var nodeViewPortalProviderAPI = _ref13.nodeViewPortalProviderAPI;
|
|
314
|
+
return api !== null && api !== void 0 && api.editorViewMode ? createViewModeSortPlugin(api, nodeViewPortalProviderAPI) : undefined;
|
|
291
315
|
}
|
|
292
316
|
}, {
|
|
293
317
|
name: 'tableLocalId',
|
|
294
|
-
plugin: function plugin(
|
|
295
|
-
var dispatch =
|
|
318
|
+
plugin: function plugin(_ref14) {
|
|
319
|
+
var dispatch = _ref14.dispatch;
|
|
296
320
|
return createTableLocalIdPlugin(dispatch);
|
|
297
321
|
}
|
|
298
322
|
}, {
|
|
299
323
|
name: 'tableWidth',
|
|
300
|
-
plugin: function plugin(
|
|
324
|
+
plugin: function plugin(_ref15) {
|
|
301
325
|
var _options$fullWidthEna, _options$isTableScali, _options$isTableAlign, _options$isCommentEdi;
|
|
302
|
-
var dispatchAnalyticsEvent =
|
|
303
|
-
dispatch =
|
|
326
|
+
var dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent,
|
|
327
|
+
dispatch = _ref15.dispatch;
|
|
304
328
|
return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$isTableAlign = options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled) !== null && _options$isTableAlign !== void 0 ? _options$isTableAlign : false, (_options$isCommentEdi = options === null || options === void 0 ? void 0 : options.isCommentEditor) !== null && _options$isCommentEdi !== void 0 ? _options$isCommentEdi : false) : undefined;
|
|
305
329
|
}
|
|
306
330
|
}, {
|
|
307
331
|
name: 'tableWidthInCommentFix',
|
|
308
|
-
plugin: function plugin(
|
|
332
|
+
plugin: function plugin(_ref16) {
|
|
309
333
|
var _options$isTableAlign2;
|
|
310
|
-
var dispatch =
|
|
334
|
+
var dispatch = _ref16.dispatch;
|
|
311
335
|
return options !== null && options !== void 0 && options.tableResizingEnabled && options !== null && options !== void 0 && options.isCommentEditor ? createTableWidthInCommentFixPlugin(dispatch, (_options$isTableAlign2 = options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled) !== null && _options$isTableAlign2 !== void 0 ? _options$isTableAlign2 : false) : undefined;
|
|
312
336
|
}
|
|
313
337
|
},
|
|
314
338
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
315
339
|
{
|
|
316
340
|
name: 'tableOverflowAnalyticsPlugin',
|
|
317
|
-
plugin: function plugin(
|
|
341
|
+
plugin: function plugin(_ref17) {
|
|
318
342
|
var _options$tableResizin;
|
|
319
|
-
var dispatch =
|
|
320
|
-
dispatchAnalyticsEvent =
|
|
343
|
+
var dispatch = _ref17.dispatch,
|
|
344
|
+
dispatchAnalyticsEvent = _ref17.dispatchAnalyticsEvent;
|
|
321
345
|
return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableResizin = options === null || options === void 0 ? void 0 : options.tableResizingEnabled) !== null && _options$tableResizin !== void 0 ? _options$tableResizin : false);
|
|
322
346
|
}
|
|
323
347
|
}, {
|
|
324
348
|
name: 'tableAnalyticsPlugin',
|
|
325
|
-
plugin: function plugin(
|
|
326
|
-
var dispatch =
|
|
327
|
-
dispatchAnalyticsEvent =
|
|
349
|
+
plugin: function plugin(_ref18) {
|
|
350
|
+
var dispatch = _ref18.dispatch,
|
|
351
|
+
dispatchAnalyticsEvent = _ref18.dispatchAnalyticsEvent;
|
|
328
352
|
return createTableAnalyticsPlugin(dispatch, dispatchAnalyticsEvent);
|
|
329
353
|
}
|
|
330
354
|
}, {
|
|
@@ -355,13 +379,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
355
379
|
}
|
|
356
380
|
return plugins;
|
|
357
381
|
},
|
|
358
|
-
contentComponent: function contentComponent(
|
|
382
|
+
contentComponent: function contentComponent(_ref19) {
|
|
359
383
|
var _api$featureFlags;
|
|
360
|
-
var editorView =
|
|
361
|
-
popupsMountPoint =
|
|
362
|
-
popupsBoundariesElement =
|
|
363
|
-
popupsScrollableElement =
|
|
364
|
-
dispatchAnalyticsEvent =
|
|
384
|
+
var editorView = _ref19.editorView,
|
|
385
|
+
popupsMountPoint = _ref19.popupsMountPoint,
|
|
386
|
+
popupsBoundariesElement = _ref19.popupsBoundariesElement,
|
|
387
|
+
popupsScrollableElement = _ref19.popupsScrollableElement,
|
|
388
|
+
dispatchAnalyticsEvent = _ref19.dispatchAnalyticsEvent;
|
|
365
389
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
366
390
|
component: ACTION_SUBJECT.TABLES_PLUGIN,
|
|
367
391
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -377,32 +401,32 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
377
401
|
stickyHeadersState: stickyHeadersPluginKey,
|
|
378
402
|
dragAndDropState: dragAndDropPluginKey
|
|
379
403
|
},
|
|
380
|
-
render: function render(
|
|
381
|
-
var resizingPluginState =
|
|
382
|
-
stickyHeadersState =
|
|
383
|
-
tablePluginState =
|
|
384
|
-
tableWidthPluginState =
|
|
385
|
-
dragAndDropState =
|
|
404
|
+
render: function render(_ref20) {
|
|
405
|
+
var resizingPluginState = _ref20.tableResizingPluginState,
|
|
406
|
+
stickyHeadersState = _ref20.stickyHeadersState,
|
|
407
|
+
tablePluginState = _ref20.tablePluginState,
|
|
408
|
+
tableWidthPluginState = _ref20.tableWidthPluginState,
|
|
409
|
+
dragAndDropState = _ref20.dragAndDropState;
|
|
386
410
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
387
411
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
388
412
|
var resizingTableLocalId = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableLocalId;
|
|
389
413
|
var resizingTableRef = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableRef;
|
|
390
414
|
var isResizing = isColumnResizing || isTableResizing;
|
|
391
415
|
var widthToWidest = tablePluginState === null || tablePluginState === void 0 ? void 0 : tablePluginState.widthToWidest;
|
|
392
|
-
var
|
|
393
|
-
tableNode =
|
|
394
|
-
tablePos =
|
|
395
|
-
targetCellPosition =
|
|
396
|
-
isContextualMenuOpen =
|
|
397
|
-
tableRef =
|
|
398
|
-
pluginConfig =
|
|
399
|
-
insertColumnButtonIndex =
|
|
400
|
-
insertRowButtonIndex =
|
|
401
|
-
isHeaderColumnEnabled =
|
|
402
|
-
isHeaderRowEnabled =
|
|
403
|
-
isDragAndDropEnabled =
|
|
404
|
-
tableWrapperTarget =
|
|
405
|
-
isCellMenuOpenByKeyboard =
|
|
416
|
+
var _ref21 = tablePluginState,
|
|
417
|
+
tableNode = _ref21.tableNode,
|
|
418
|
+
tablePos = _ref21.tablePos,
|
|
419
|
+
targetCellPosition = _ref21.targetCellPosition,
|
|
420
|
+
isContextualMenuOpen = _ref21.isContextualMenuOpen,
|
|
421
|
+
tableRef = _ref21.tableRef,
|
|
422
|
+
pluginConfig = _ref21.pluginConfig,
|
|
423
|
+
insertColumnButtonIndex = _ref21.insertColumnButtonIndex,
|
|
424
|
+
insertRowButtonIndex = _ref21.insertRowButtonIndex,
|
|
425
|
+
isHeaderColumnEnabled = _ref21.isHeaderColumnEnabled,
|
|
426
|
+
isHeaderRowEnabled = _ref21.isHeaderRowEnabled,
|
|
427
|
+
isDragAndDropEnabled = _ref21.isDragAndDropEnabled,
|
|
428
|
+
tableWrapperTarget = _ref21.tableWrapperTarget,
|
|
429
|
+
isCellMenuOpenByKeyboard = _ref21.isCellMenuOpenByKeyboard;
|
|
406
430
|
var allowControls = pluginConfig.allowControls;
|
|
407
431
|
var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
|
|
408
432
|
return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && (tableRef || isCellMenuOpenByKeyboard) && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
|
|
@@ -495,8 +519,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
495
519
|
}));
|
|
496
520
|
},
|
|
497
521
|
pluginsOptions: {
|
|
498
|
-
quickInsert: function quickInsert(
|
|
499
|
-
var formatMessage =
|
|
522
|
+
quickInsert: function quickInsert(_ref22) {
|
|
523
|
+
var formatMessage = _ref22.formatMessage;
|
|
500
524
|
return [{
|
|
501
525
|
id: 'table',
|
|
502
526
|
title: formatMessage(messages.table),
|
|
@@ -519,7 +543,24 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
519
543
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
520
544
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
|
|
521
545
|
})(state.schema);
|
|
522
|
-
var tr =
|
|
546
|
+
var tr = state.tr;
|
|
547
|
+
// If the cursor is inside a table
|
|
548
|
+
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && fg('platform_editor_use_nested_table_pm_nodes')) {
|
|
549
|
+
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|
|
550
|
+
if (editorExperiment('nested-tables-in-tables', false, {
|
|
551
|
+
exposure: true
|
|
552
|
+
}) || getParentOfTypeCount(state.schema.nodes.table)(state.selection) > 1) {
|
|
553
|
+
// Nesting is too deep insert table after the top parent table
|
|
554
|
+
var positionAfterTopTable = getPositionAfterTopParentNodeOfType(state.schema.nodes.table)(state.selection);
|
|
555
|
+
tr = safeInsert(tableNode, positionAfterTopTable)(tr);
|
|
556
|
+
tr.scrollIntoView();
|
|
557
|
+
} else {
|
|
558
|
+
// Table can be nested in parent table
|
|
559
|
+
tr = insert(tableNode);
|
|
560
|
+
}
|
|
561
|
+
} else {
|
|
562
|
+
tr = insert(tableNode);
|
|
563
|
+
}
|
|
523
564
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
524
565
|
action: ACTION.INSERTED,
|
|
525
566
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
@@ -17,13 +17,13 @@ var updateLastCellElement = function updateLastCellElement(lastCellElementsDecor
|
|
|
17
17
|
return updateDecorations(tr.doc, decorationSet, lastCellElementsDecorations, TableDecorations.LAST_CELL_ELEMENT);
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
export var buildColumnResizingDecorations = function buildColumnResizingDecorations(rowEndIndex, columnEndIndex, includeTooltip, getIntl) {
|
|
20
|
+
export var buildColumnResizingDecorations = function buildColumnResizingDecorations(rowEndIndex, columnEndIndex, includeTooltip, getIntl, nodeViewPortalProviderAPI) {
|
|
21
21
|
return function (_ref3) {
|
|
22
22
|
var tr = _ref3.tr,
|
|
23
23
|
decorationSet = _ref3.decorationSet;
|
|
24
24
|
var _ref4 = columnEndIndex < 0 ? emptyDecorations : createResizeHandleDecoration(tr, rowEndIndex, {
|
|
25
25
|
right: columnEndIndex
|
|
26
|
-
}, includeTooltip, getIntl),
|
|
26
|
+
}, includeTooltip, getIntl, nodeViewPortalProviderAPI),
|
|
27
27
|
_ref5 = _slicedToArray(_ref4, 2),
|
|
28
28
|
columnResizesDecorations = _ref5[0],
|
|
29
29
|
lastCellElementsDecorations = _ref5[1];
|
|
@@ -7,19 +7,19 @@ import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSele
|
|
|
7
7
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
8
8
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, createTable } from '../commands/insert';
|
|
9
9
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
10
|
-
export function keymapPlugin(getEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled) {
|
|
10
|
+
export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled) {
|
|
11
11
|
var _pluginInjectionApi$a;
|
|
12
|
-
var isTableScalingEnabled = arguments.length >
|
|
13
|
-
var isTableAlignmentEnabled = arguments.length >
|
|
14
|
-
var isFullWidthEnabled = arguments.length >
|
|
15
|
-
var pluginInjectionApi = arguments.length >
|
|
16
|
-
var getIntl = arguments.length >
|
|
17
|
-
var isCellBackgroundDuplicated = arguments.length >
|
|
18
|
-
var isTableFixedColumnWidthsOptionEnabled = arguments.length >
|
|
19
|
-
var shouldUseIncreasedScalingPercent = arguments.length >
|
|
20
|
-
var isCommentEditor = arguments.length >
|
|
21
|
-
var isChromelessEditor = arguments.length >
|
|
22
|
-
var isTableResizingEnabled = arguments.length >
|
|
12
|
+
var isTableScalingEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
13
|
+
var isTableAlignmentEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
14
|
+
var isFullWidthEnabled = arguments.length > 7 ? arguments[7] : undefined;
|
|
15
|
+
var pluginInjectionApi = arguments.length > 8 ? arguments[8] : undefined;
|
|
16
|
+
var getIntl = arguments.length > 9 ? arguments[9] : undefined;
|
|
17
|
+
var isCellBackgroundDuplicated = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
|
|
18
|
+
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : false;
|
|
19
|
+
var shouldUseIncreasedScalingPercent = arguments.length > 12 ? arguments[12] : undefined;
|
|
20
|
+
var isCommentEditor = arguments.length > 13 ? arguments[13] : undefined;
|
|
21
|
+
var isChromelessEditor = arguments.length > 14 ? arguments[14] : undefined;
|
|
22
|
+
var isTableResizingEnabled = arguments.length > 15 ? arguments[15] : undefined;
|
|
23
23
|
var list = {};
|
|
24
24
|
var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
25
25
|
bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
|
|
@@ -57,17 +57,20 @@ export function keymapPlugin(getEditorContainerWidth, api, editorAnalyticsAPI, d
|
|
|
57
57
|
}
|
|
58
58
|
bindKeymapWithCommand(startColumnResizing.common, initiateKeyboardColumnResizing({
|
|
59
59
|
ariaNotify: ariaNotifyPlugin,
|
|
60
|
-
getIntl: getIntl
|
|
60
|
+
getIntl: getIntl,
|
|
61
|
+
nodeViewPortalProviderAPI: nodeViewPortalProviderAPI
|
|
61
62
|
}), list);
|
|
62
63
|
bindKeymapWithCommand(moveRight.common, activateNextResizeArea({
|
|
63
64
|
direction: 1,
|
|
64
65
|
ariaNotify: ariaNotifyPlugin,
|
|
65
|
-
getIntl: getIntl
|
|
66
|
+
getIntl: getIntl,
|
|
67
|
+
nodeViewPortalProviderAPI: nodeViewPortalProviderAPI
|
|
66
68
|
}), list);
|
|
67
69
|
bindKeymapWithCommand(moveLeft.common, activateNextResizeArea({
|
|
68
70
|
direction: -1,
|
|
69
71
|
ariaNotify: ariaNotifyPlugin,
|
|
70
|
-
getIntl: getIntl
|
|
72
|
+
getIntl: getIntl,
|
|
73
|
+
nodeViewPortalProviderAPI: nodeViewPortalProviderAPI
|
|
71
74
|
}), list);
|
|
72
75
|
bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI, api)(-10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, !!isCommentEditor, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
73
76
|
bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI, api)(10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, !!isCommentEditor, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
@@ -22,7 +22,7 @@ import { isHeaderRowRequired, transformSliceTableLayoutDefaultToCenter } from '.
|
|
|
22
22
|
import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
|
|
23
23
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
24
24
|
import { pluginKey } from './plugin-key';
|
|
25
|
-
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor) {
|
|
25
|
+
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor) {
|
|
26
26
|
var _accessibilityUtils;
|
|
27
27
|
var state = createPluginState(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
28
28
|
pluginConfig: pluginConfig,
|
|
@@ -278,7 +278,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
278
278
|
blur: handleBlur,
|
|
279
279
|
mousedown: withCellTracking(handleMouseDown),
|
|
280
280
|
mouseleave: handleMouseLeave,
|
|
281
|
-
mousemove: whenTableInFocus(handleMouseMove),
|
|
281
|
+
mousemove: whenTableInFocus(handleMouseMove(nodeViewPortalProviderAPI)),
|
|
282
282
|
mouseenter: handleMouseEnter,
|
|
283
283
|
mouseup: whenTableInFocus(handleMouseUp),
|
|
284
284
|
click: withCellTracking(whenTableInFocus(handleClick))
|
|
@@ -18,7 +18,7 @@ import { currentColWidth, getResizeState, getTableMaxWidth, pointsAtCell, resize
|
|
|
18
18
|
import { TABLE_OFFSET_IN_COMMENT_EDITOR } from './utils/consts';
|
|
19
19
|
import { getScalingPercentForTableWithoutWidth, getTableScalingPercent } from './utils/misc';
|
|
20
20
|
import { scaleResizeState } from './utils/resize-column';
|
|
21
|
-
export var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, api, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
21
|
+
export var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
22
22
|
var _originalTable$attrs;
|
|
23
23
|
var state = view.state,
|
|
24
24
|
dispatch = view.dispatch;
|
|
@@ -103,7 +103,7 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
103
103
|
|
|
104
104
|
// When we start resizing a column we need to ensure the underlying tooltip is removed from the decoration to avoid
|
|
105
105
|
// unnecessary tooltips being displayed during drag.
|
|
106
|
-
updateResizeHandleDecorations(undefined, undefined, false)(state, dispatch);
|
|
106
|
+
updateResizeHandleDecorations(nodeViewPortalProviderAPI, undefined, undefined, false)(state, dispatch);
|
|
107
107
|
|
|
108
108
|
// for new column resizing, take the current scaled version of table widths and use those as the basis for resizing
|
|
109
109
|
// implication: the scaled version of the table becomes the source of truth
|
|
@@ -8,7 +8,7 @@ import { handleMouseDown } from './event-handlers';
|
|
|
8
8
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
9
9
|
import { pluginKey } from './plugin-key';
|
|
10
10
|
import { getResizeCellPos } from './utils';
|
|
11
|
-
export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, api, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
11
|
+
export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
12
12
|
var _ref$lastColumnResiza = _ref.lastColumnResizable,
|
|
13
13
|
lastColumnResizable = _ref$lastColumnResiza === void 0 ? true : _ref$lastColumnResiza;
|
|
14
14
|
return new SafePlugin({
|
|
@@ -46,7 +46,7 @@ export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorF
|
|
|
46
46
|
isColumnKeyboardResizeStarted = isKeyboardResize;
|
|
47
47
|
}
|
|
48
48
|
if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
|
|
49
|
-
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, api, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor)) {
|
|
49
|
+
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor)) {
|
|
50
50
|
var _state = view.state,
|
|
51
51
|
_dispatch = view.dispatch;
|
|
52
52
|
return setResizeHandlePos(resizeHandlePos)(_state, _dispatch);
|