@atlaskit/editor-plugin-table 19.0.0 → 20.0.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 +37 -0
- package/dist/cjs/nodeviews/TableResizer.js +1 -1
- package/dist/cjs/nodeviews/table.js +18 -2
- package/dist/cjs/nodeviews/toDOM.js +18 -4
- package/dist/cjs/pm-plugins/keymap.js +12 -12
- package/dist/cjs/pm-plugins/main.js +41 -7
- package/dist/cjs/pm-plugins/table-width.js +10 -0
- package/dist/cjs/pm-plugins/transforms/content-mode.js +48 -0
- package/dist/cjs/pm-plugins/transforms/fix-tables.js +4 -35
- package/dist/cjs/pm-plugins/transforms/table-transform-utils.js +62 -0
- package/dist/cjs/pm-plugins/utils/tableMode.js +149 -0
- package/dist/cjs/tablePlugin.js +45 -40
- package/dist/cjs/ui/ContentComponent.js +1 -0
- package/dist/cjs/ui/event-handlers.js +3 -2
- package/dist/cjs/ui/global-styles.js +2 -1
- package/dist/cjs/ui/toolbar.js +36 -7
- package/dist/es2019/nodeviews/TableResizer.js +1 -1
- package/dist/es2019/nodeviews/table.js +18 -2
- package/dist/es2019/nodeviews/toDOM.js +18 -4
- package/dist/es2019/pm-plugins/keymap.js +2 -2
- package/dist/es2019/pm-plugins/main.js +41 -7
- package/dist/es2019/pm-plugins/table-width.js +10 -0
- package/dist/es2019/pm-plugins/transforms/content-mode.js +39 -0
- package/dist/es2019/pm-plugins/transforms/fix-tables.js +2 -33
- package/dist/es2019/pm-plugins/transforms/table-transform-utils.js +56 -0
- package/dist/es2019/pm-plugins/utils/tableMode.js +148 -0
- package/dist/es2019/tablePlugin.js +10 -4
- package/dist/es2019/ui/ContentComponent.js +1 -0
- package/dist/es2019/ui/event-handlers.js +4 -3
- package/dist/es2019/ui/global-styles.js +2 -1
- package/dist/es2019/ui/toolbar.js +33 -6
- package/dist/esm/nodeviews/TableResizer.js +1 -1
- package/dist/esm/nodeviews/table.js +18 -2
- package/dist/esm/nodeviews/toDOM.js +18 -4
- package/dist/esm/pm-plugins/keymap.js +12 -12
- package/dist/esm/pm-plugins/main.js +41 -7
- package/dist/esm/pm-plugins/table-width.js +10 -0
- package/dist/esm/pm-plugins/transforms/content-mode.js +41 -0
- package/dist/esm/pm-plugins/transforms/fix-tables.js +2 -33
- package/dist/esm/pm-plugins/transforms/table-transform-utils.js +56 -0
- package/dist/esm/pm-plugins/utils/tableMode.js +143 -0
- package/dist/esm/tablePlugin.js +45 -40
- package/dist/esm/ui/ContentComponent.js +1 -0
- package/dist/esm/ui/event-handlers.js +4 -3
- package/dist/esm/ui/global-styles.js +2 -1
- package/dist/esm/ui/toolbar.js +36 -7
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/transforms/content-mode.d.ts +8 -0
- package/dist/types/pm-plugins/transforms/table-transform-utils.d.ts +11 -0
- package/dist/types/pm-plugins/utils/tableMode.d.ts +22 -0
- package/dist/types/tablePluginType.d.ts +6 -0
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types/ui/global-styles.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/transforms/content-mode.d.ts +8 -0
- package/dist/types-ts4.5/pm-plugins/transforms/table-transform-utils.d.ts +11 -0
- package/dist/types-ts4.5/pm-plugins/utils/tableMode.d.ts +22 -0
- package/dist/types-ts4.5/tablePluginType.d.ts +6 -0
- package/dist/types-ts4.5/types/index.d.ts +3 -0
- package/dist/types-ts4.5/ui/global-styles.d.ts +2 -1
- package/package.json +21 -20
package/dist/esm/tablePlugin.js
CHANGED
|
@@ -66,6 +66,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
66
66
|
};
|
|
67
67
|
var options = _objectSpread(_objectSpread({}, config), {}, {
|
|
68
68
|
tableOptions: (_config$tableOptions = config === null || config === void 0 ? void 0 : config.tableOptions) !== null && _config$tableOptions !== void 0 ? _config$tableOptions : {},
|
|
69
|
+
dragAndDropEnabled: (config === null || config === void 0 ? void 0 : config.dragAndDropEnabled) || fg('platform_editor_enable_table_dnd'),
|
|
69
70
|
isTableScalingEnabled: (config === null || config === void 0 ? void 0 : config.isTableScalingEnabled) || fg('platform_editor_enable_table_scaling')
|
|
70
71
|
});
|
|
71
72
|
var defaultGetEditorContainerWidth = function defaultGetEditorContainerWidth() {
|
|
@@ -282,10 +283,11 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
282
283
|
wasFullWidthEnabled = _ref3.wasFullWidthEnabled,
|
|
283
284
|
tableOptions = _ref3.tableOptions,
|
|
284
285
|
getEditorFeatureFlags = _ref3.getEditorFeatureFlags,
|
|
286
|
+
dragAndDropEnabled = _ref3.dragAndDropEnabled,
|
|
285
287
|
isTableScalingEnabled = _ref3.isTableScalingEnabled,
|
|
286
288
|
isCommentEditor = _ref3.isCommentEditor,
|
|
287
289
|
isChromelessEditor = _ref3.isChromelessEditor;
|
|
288
|
-
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption);
|
|
290
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption);
|
|
289
291
|
}
|
|
290
292
|
}, {
|
|
291
293
|
name: 'tablePMColResizing',
|
|
@@ -317,6 +319,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
317
319
|
var getIntl = _ref6.getIntl,
|
|
318
320
|
nodeViewPortalProviderAPI = _ref6.nodeViewPortalProviderAPI;
|
|
319
321
|
var _ref7 = options || {},
|
|
322
|
+
dragAndDropEnabled = _ref7.dragAndDropEnabled,
|
|
320
323
|
_ref7$isTableScalingE = _ref7.isTableScalingEnabled,
|
|
321
324
|
isTableScalingEnabled = _ref7$isTableScalingE === void 0 ? false : _ref7$isTableScalingE,
|
|
322
325
|
_ref7$fullWidthEnable = _ref7.fullWidthEnabled,
|
|
@@ -326,7 +329,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
326
329
|
_ref7$isChromelessEdi = _ref7.isChromelessEditor,
|
|
327
330
|
isChromelessEditor = _ref7$isChromelessEdi === void 0 ? false : _ref7$isChromelessEdi,
|
|
328
331
|
tableOptions = _ref7.tableOptions;
|
|
329
|
-
return keymapPlugin(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled, tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.allowTableAlignment, fullWidthEnabled, api, getIntl, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.allowTableResizing);
|
|
332
|
+
return keymapPlugin(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.allowTableAlignment, fullWidthEnabled, api, getIntl, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.allowTableResizing);
|
|
330
333
|
}
|
|
331
334
|
}, {
|
|
332
335
|
name: 'tableSelectionKeymap',
|
|
@@ -337,10 +340,12 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
337
340
|
}, {
|
|
338
341
|
name: 'tableEditing',
|
|
339
342
|
plugin: function plugin() {
|
|
343
|
+
var _ref9 = options || {},
|
|
344
|
+
dragAndDropEnabled = _ref9.dragAndDropEnabled;
|
|
340
345
|
return tableEditing({
|
|
341
|
-
reportFixedTable: function reportFixedTable(
|
|
342
|
-
var tr =
|
|
343
|
-
reason =
|
|
346
|
+
reportFixedTable: function reportFixedTable(_ref0) {
|
|
347
|
+
var tr = _ref0.tr,
|
|
348
|
+
reason = _ref0.reason;
|
|
344
349
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
345
350
|
action: TABLE_ACTION.FIXED,
|
|
346
351
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -351,71 +356,71 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
351
356
|
eventType: EVENT_TYPE.TRACK
|
|
352
357
|
})(tr);
|
|
353
358
|
},
|
|
354
|
-
dragAndDropEnabled:
|
|
359
|
+
dragAndDropEnabled: dragAndDropEnabled
|
|
355
360
|
});
|
|
356
361
|
}
|
|
357
362
|
}, {
|
|
358
363
|
name: 'tableStickyHeaders',
|
|
359
|
-
plugin: function plugin(
|
|
360
|
-
var dispatch =
|
|
364
|
+
plugin: function plugin(_ref1) {
|
|
365
|
+
var dispatch = _ref1.dispatch;
|
|
361
366
|
return options && options.tableOptions.stickyHeaders ? createStickyHeadersPlugin(dispatch, function () {
|
|
362
367
|
return [];
|
|
363
368
|
}) : undefined;
|
|
364
369
|
}
|
|
365
370
|
}, {
|
|
366
371
|
name: 'tableDragAndDrop',
|
|
367
|
-
plugin: function plugin(
|
|
368
|
-
var dispatch =
|
|
369
|
-
return createDragAndDropPlugin(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options.isCommentEditor, api);
|
|
372
|
+
plugin: function plugin(_ref10) {
|
|
373
|
+
var dispatch = _ref10.dispatch;
|
|
374
|
+
return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options.isCommentEditor, api) : undefined;
|
|
370
375
|
}
|
|
371
376
|
}, {
|
|
372
377
|
name: 'tableViewModeSort',
|
|
373
|
-
plugin: function plugin(
|
|
374
|
-
var nodeViewPortalProviderAPI =
|
|
378
|
+
plugin: function plugin(_ref11) {
|
|
379
|
+
var nodeViewPortalProviderAPI = _ref11.nodeViewPortalProviderAPI;
|
|
375
380
|
return api !== null && api !== void 0 && api.editorViewMode ? createViewModeSortPlugin(api, nodeViewPortalProviderAPI) : undefined;
|
|
376
381
|
}
|
|
377
382
|
}, {
|
|
378
383
|
name: 'tableLocalId',
|
|
379
|
-
plugin: function plugin(
|
|
380
|
-
var dispatch =
|
|
384
|
+
plugin: function plugin(_ref12) {
|
|
385
|
+
var dispatch = _ref12.dispatch;
|
|
381
386
|
return !fg('platform_editor_adf_with_localid') ? createTableLocalIdPlugin(dispatch) : undefined;
|
|
382
387
|
}
|
|
383
388
|
}, {
|
|
384
389
|
name: 'tableWidth',
|
|
385
|
-
plugin: function plugin(
|
|
390
|
+
plugin: function plugin(_ref13) {
|
|
386
391
|
var _options$fullWidthEna, _options$maxWidthEnab, _options$isTableScali, _options$tableOptions3, _options$isCommentEdi;
|
|
387
|
-
var dispatchAnalyticsEvent =
|
|
388
|
-
dispatch =
|
|
392
|
+
var dispatchAnalyticsEvent = _ref13.dispatchAnalyticsEvent,
|
|
393
|
+
dispatch = _ref13.dispatch;
|
|
389
394
|
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$maxWidthEnab = options.maxWidthEnabled) !== null && _options$maxWidthEnab !== void 0 ? _options$maxWidthEnab : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$tableOptions3 = options.tableOptions.allowTableResizing) !== null && _options$tableOptions3 !== void 0 ? _options$tableOptions3 : false, (_options$isCommentEdi = options.isCommentEditor) !== null && _options$isCommentEdi !== void 0 ? _options$isCommentEdi : false) : undefined;
|
|
390
395
|
}
|
|
391
396
|
}, {
|
|
392
397
|
name: 'tableWidthInCommentFix',
|
|
393
|
-
plugin: function plugin(
|
|
398
|
+
plugin: function plugin(_ref14) {
|
|
394
399
|
var _options$tableOptions4;
|
|
395
|
-
var dispatch =
|
|
400
|
+
var dispatch = _ref14.dispatch;
|
|
396
401
|
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing && options !== null && options !== void 0 && options.isCommentEditor ? createTableWidthInCommentFixPlugin(dispatch, (_options$tableOptions4 = options.tableOptions.allowTableAlignment) !== null && _options$tableOptions4 !== void 0 ? _options$tableOptions4 : false) : undefined;
|
|
397
402
|
}
|
|
398
403
|
},
|
|
399
404
|
// TODO: ED-26961 - should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
400
405
|
{
|
|
401
406
|
name: 'tableOverflowAnalyticsPlugin',
|
|
402
|
-
plugin: function plugin(
|
|
407
|
+
plugin: function plugin(_ref15) {
|
|
403
408
|
var _options$tableOptions5;
|
|
404
|
-
var dispatch =
|
|
405
|
-
dispatchAnalyticsEvent =
|
|
409
|
+
var dispatch = _ref15.dispatch,
|
|
410
|
+
dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent;
|
|
406
411
|
return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableOptions5 = options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing) !== null && _options$tableOptions5 !== void 0 ? _options$tableOptions5 : false);
|
|
407
412
|
}
|
|
408
413
|
}, {
|
|
409
414
|
name: 'tableAnalyticsPlugin',
|
|
410
|
-
plugin: function plugin(
|
|
411
|
-
var dispatch =
|
|
412
|
-
dispatchAnalyticsEvent =
|
|
415
|
+
plugin: function plugin(_ref16) {
|
|
416
|
+
var dispatch = _ref16.dispatch,
|
|
417
|
+
dispatchAnalyticsEvent = _ref16.dispatchAnalyticsEvent;
|
|
413
418
|
return createTableAnalyticsPlugin(dispatch, dispatchAnalyticsEvent);
|
|
414
419
|
}
|
|
415
420
|
}, {
|
|
416
421
|
name: 'tableGetEditorViewReferencePlugin',
|
|
417
|
-
plugin: function plugin(
|
|
418
|
-
var dispatchAnalyticsEvent =
|
|
422
|
+
plugin: function plugin(_ref17) {
|
|
423
|
+
var dispatchAnalyticsEvent = _ref17.dispatchAnalyticsEvent;
|
|
419
424
|
return new SafePlugin({
|
|
420
425
|
view: function view(editorView) {
|
|
421
426
|
editorViewRef.current = editorView;
|
|
@@ -469,8 +474,8 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
469
474
|
}
|
|
470
475
|
}, {
|
|
471
476
|
name: 'tableSizeSelectorPlugin',
|
|
472
|
-
plugin: function plugin(
|
|
473
|
-
var dispatch =
|
|
477
|
+
plugin: function plugin(_ref18) {
|
|
478
|
+
var dispatch = _ref18.dispatch;
|
|
474
479
|
return isTableSelectorEnabled ? createSizeSelectorPlugin(dispatch) : undefined;
|
|
475
480
|
}
|
|
476
481
|
}, {
|
|
@@ -501,12 +506,12 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
501
506
|
}
|
|
502
507
|
return plugins;
|
|
503
508
|
},
|
|
504
|
-
contentComponent: function contentComponent(
|
|
505
|
-
var editorView =
|
|
506
|
-
popupsMountPoint =
|
|
507
|
-
popupsBoundariesElement =
|
|
508
|
-
popupsScrollableElement =
|
|
509
|
-
dispatchAnalyticsEvent =
|
|
509
|
+
contentComponent: function contentComponent(_ref19) {
|
|
510
|
+
var editorView = _ref19.editorView,
|
|
511
|
+
popupsMountPoint = _ref19.popupsMountPoint,
|
|
512
|
+
popupsBoundariesElement = _ref19.popupsBoundariesElement,
|
|
513
|
+
popupsScrollableElement = _ref19.popupsScrollableElement,
|
|
514
|
+
dispatchAnalyticsEvent = _ref19.dispatchAnalyticsEvent;
|
|
510
515
|
return /*#__PURE__*/React.createElement(ContentComponent, {
|
|
511
516
|
api: api,
|
|
512
517
|
editorView: editorView,
|
|
@@ -521,8 +526,8 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
521
526
|
});
|
|
522
527
|
},
|
|
523
528
|
pluginsOptions: {
|
|
524
|
-
quickInsert: function quickInsert(
|
|
525
|
-
var formatMessage =
|
|
529
|
+
quickInsert: function quickInsert(_ref20) {
|
|
530
|
+
var formatMessage = _ref20.formatMessage;
|
|
526
531
|
return [{
|
|
527
532
|
id: 'table',
|
|
528
533
|
title: formatMessage(messages.table),
|
|
@@ -592,8 +597,8 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
592
597
|
return editorViewRef.current;
|
|
593
598
|
}, options, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
594
599
|
},
|
|
595
|
-
usePluginHook: function usePluginHook(
|
|
596
|
-
var editorView =
|
|
600
|
+
usePluginHook: function usePluginHook(_ref21) {
|
|
601
|
+
var editorView = _ref21.editorView;
|
|
597
602
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['editorViewMode'], function (states) {
|
|
598
603
|
var _states$editorViewMod;
|
|
599
604
|
return {
|
|
@@ -211,6 +211,7 @@ export var ContentComponent = function ContentComponent(_ref3) {
|
|
|
211
211
|
fallbackComponent: null
|
|
212
212
|
}, /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
|
|
213
213
|
featureFlags: api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState(),
|
|
214
|
+
isDragAndDropEnabledOption: options === null || options === void 0 ? void 0 : options.dragAndDropEnabled,
|
|
214
215
|
api: api
|
|
215
216
|
}), /*#__PURE__*/React.createElement(ContentComponentInternal, {
|
|
216
217
|
api: api,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import rafSchedule from 'raf-schd';
|
|
3
3
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
4
5
|
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
5
|
-
import {
|
|
6
|
+
import { closestElement, isElementInTableCell, isLastItemMediaGroup, setNodeSelection } from '@atlaskit/editor-common/utils';
|
|
6
7
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
8
|
import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
8
9
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
@@ -39,7 +40,7 @@ export var handleBlur = function handleBlur(view, event) {
|
|
|
39
40
|
dispatch = view.dispatch;
|
|
40
41
|
// IE version check for ED-4665
|
|
41
42
|
// Calendar focus check for ED-10466
|
|
42
|
-
if (
|
|
43
|
+
if (getBrowserInfo().ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event) && !isFocusingDragHandles(event) && !isFocusingDragHandlesClickableZone(event)) {
|
|
43
44
|
setEditorFocus(false)(state, dispatch);
|
|
44
45
|
}
|
|
45
46
|
event.preventDefault();
|
|
@@ -349,7 +350,7 @@ export var handleMouseMove = function handleMouseMove(nodeViewPortalProviderAPI)
|
|
|
349
350
|
// a reflow. So for now this will just grab the offsetX value immediately for gecko and chrome will calculate later
|
|
350
351
|
// in the deferred callback handler.
|
|
351
352
|
// Bug Tracking: https://bugzilla.mozilla.org/show_bug.cgi?id=1882903
|
|
352
|
-
handleMouseMoveDebounce(nodeViewPortalProviderAPI)(view, event,
|
|
353
|
+
handleMouseMoveDebounce(nodeViewPortalProviderAPI)(view, event, getBrowserInfo().gecko ? event.offsetX : NaN);
|
|
353
354
|
return false;
|
|
354
355
|
};
|
|
355
356
|
};
|
|
@@ -8,6 +8,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
8
8
|
import { tableStyles } from './common-styles';
|
|
9
9
|
export var GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
|
|
10
10
|
var featureFlags = _ref.featureFlags,
|
|
11
|
+
isDragAndDropEnabledOption = _ref.isDragAndDropEnabledOption,
|
|
11
12
|
api = _ref.api;
|
|
12
13
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['editorViewMode'], function (states) {
|
|
13
14
|
var _states$editorViewMod;
|
|
@@ -20,7 +21,7 @@ export var GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
|
|
|
20
21
|
return jsx(Global, {
|
|
21
22
|
styles: tableStyles({
|
|
22
23
|
featureFlags: featureFlags,
|
|
23
|
-
isDragAndDropEnabled: !isLivePageViewMode
|
|
24
|
+
isDragAndDropEnabled: isDragAndDropEnabledOption && !isLivePageViewMode
|
|
24
25
|
})
|
|
25
26
|
});
|
|
26
27
|
};
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -32,6 +32,7 @@ import AlignImageLeftIcon from '@atlaskit/icon/core/align-image-left';
|
|
|
32
32
|
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
33
33
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
34
34
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
35
|
+
import ShrinkHorizontalIcon from '@atlaskit/icon/core/shrink-horizontal';
|
|
35
36
|
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
36
37
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
37
38
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -48,6 +49,7 @@ import { normaliseAlignment } from '../pm-plugins/utils/alignment';
|
|
|
48
49
|
import { isTableNested } from '../pm-plugins/utils/nodes';
|
|
49
50
|
import { getSelectedColumnIndexes, getSelectedRowIndexes } from '../pm-plugins/utils/selection';
|
|
50
51
|
import { getMergedCellsPositions } from '../pm-plugins/utils/table';
|
|
52
|
+
import { applyMeasuredWidthToSelectedTable, isContentModeSupported } from '../pm-plugins/utils/tableMode';
|
|
51
53
|
import { TableCssClassName } from '../types';
|
|
52
54
|
import { FloatingAlignmentButtons } from './FloatingAlignmentButtons/FloatingAlignmentButtons';
|
|
53
55
|
export var getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _ref, editorAnalyticsAPI) {
|
|
@@ -410,11 +412,17 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
410
412
|
var areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
411
413
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
412
414
|
var _api$editorViewMode;
|
|
413
|
-
var
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
415
|
+
var isDragHandleMenuOpened = false;
|
|
416
|
+
var isTableRowOrColumnDragged = false;
|
|
417
|
+
if (options !== null && options !== void 0 && options.dragAndDropEnabled) {
|
|
418
|
+
var _getDragDropPluginSta = getDragDropPluginState(state),
|
|
419
|
+
_getDragDropPluginSta2 = _getDragDropPluginSta.isDragMenuOpen,
|
|
420
|
+
isDragMenuOpen = _getDragDropPluginSta2 === void 0 ? false : _getDragDropPluginSta2,
|
|
421
|
+
_getDragDropPluginSta3 = _getDragDropPluginSta.isDragging,
|
|
422
|
+
isDragging = _getDragDropPluginSta3 === void 0 ? false : _getDragDropPluginSta3;
|
|
423
|
+
isDragHandleMenuOpened = isDragMenuOpen;
|
|
424
|
+
isTableRowOrColumnDragged = isDragging;
|
|
425
|
+
}
|
|
418
426
|
var isTableOrColumnResizing = !!(resizeState !== null && resizeState !== void 0 && resizeState.dragging || tableWidthState !== null && tableWidthState !== void 0 && tableWidthState.resizing);
|
|
419
427
|
var isTableMenuOpened = pluginState.isContextualMenuOpen || isDragHandleMenuOpened;
|
|
420
428
|
var isTableState = isTableRowOrColumnDragged || isTableOrColumnResizing || isTableMenuOpened;
|
|
@@ -435,7 +443,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
435
443
|
// We don't want to show floating toolbar while resizing the table
|
|
436
444
|
var isWidthResizing = tableWidthState === null || tableWidthState === void 0 ? void 0 : tableWidthState.resizing;
|
|
437
445
|
if (tableObject && pluginState.editorHasFocus && !isWidthResizing) {
|
|
438
|
-
var _api$limitedMode$shar, _api$limitedMode, _api$extension, _api$extension2;
|
|
446
|
+
var _api$limitedMode$shar, _api$limitedMode, _api$editorViewMode2, _api$extension, _api$extension2;
|
|
439
447
|
var isNested = pluginState.tablePos && isTableNested(state, pluginState.tablePos);
|
|
440
448
|
var isTableScalingWithFixedColumnWidthsOptionShown = isTableScalingEnabled && isTableFixedColumnWidthsOptionEnabled && !isNested;
|
|
441
449
|
var areTableColumWidthsFixed = tableObject.node.attrs.displayMode === 'fixed';
|
|
@@ -465,6 +473,27 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
465
473
|
var cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor, isLimitedModeEnabled);
|
|
466
474
|
var columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor, isLimitedModeEnabled) : [];
|
|
467
475
|
var colorPicker = !areAnyNewToolbarFlagsEnabled ? getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView) : [];
|
|
476
|
+
var fitToContentButton = isContentModeSupported({
|
|
477
|
+
allowColumnResizing: !!pluginState.pluginConfig.allowColumnResizing,
|
|
478
|
+
allowTableResizing: !!pluginState.pluginConfig.allowTableResizing,
|
|
479
|
+
isFullPageEditor: !pluginState.isChromelessEditor && !pluginState.isCommentEditor
|
|
480
|
+
}) && !isNested && (api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 || (_api$editorViewMode2 = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.mode) !== 'view' && expValEquals('platform_editor_table_fit_to_content_on_demand', 'isEnabled', true) ? [{
|
|
481
|
+
id: 'editor.table.fitToContent',
|
|
482
|
+
type: 'button',
|
|
483
|
+
title: intl.formatMessage(messages.fitToContent),
|
|
484
|
+
icon: function icon() {
|
|
485
|
+
return jsx(ShrinkHorizontalIcon, {
|
|
486
|
+
spacing: 'spacious',
|
|
487
|
+
label: ''
|
|
488
|
+
});
|
|
489
|
+
},
|
|
490
|
+
onClick: function onClick(_state, _dispatch, view) {
|
|
491
|
+
if (view) {
|
|
492
|
+
applyMeasuredWidthToSelectedTable(view, api !== null && api !== void 0 ? api : undefined);
|
|
493
|
+
}
|
|
494
|
+
return true;
|
|
495
|
+
}
|
|
496
|
+
}] : [];
|
|
468
497
|
|
|
469
498
|
// Check if we need to show confirm dialog for delete button
|
|
470
499
|
var confirmDialog;
|
|
@@ -543,7 +572,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
543
572
|
},
|
|
544
573
|
zIndex: akEditorFloatingPanelZIndex + 1,
|
|
545
574
|
// Place the context menu slightly above the others
|
|
546
|
-
items: [menu].concat(_toConsumableArray(!areAnyNewToolbarFlagsEnabled ? [separator(menu.hidden)] : []), _toConsumableArray(alignmentMenu), _toConsumableArray(!areAnyNewToolbarFlagsEnabled ? [separator(alignmentMenu.length === 0)] : []), _toConsumableArray(cellItems), _toConsumableArray(columnSettingsItems), _toConsumableArray(colorPicker), _toConsumableArray(!areAnyNewToolbarFlagsEnabled ? [{
|
|
575
|
+
items: [menu].concat(_toConsumableArray(!areAnyNewToolbarFlagsEnabled ? [separator(menu.hidden)] : []), _toConsumableArray(alignmentMenu), _toConsumableArray(!areAnyNewToolbarFlagsEnabled ? [separator(alignmentMenu.length === 0)] : []), _toConsumableArray(cellItems), _toConsumableArray(columnSettingsItems), fitToContentButton, _toConsumableArray(colorPicker), _toConsumableArray(!areAnyNewToolbarFlagsEnabled ? [{
|
|
547
576
|
type: 'extensions-placeholder',
|
|
548
577
|
separator: 'end'
|
|
549
578
|
}, copyButton, {
|
|
@@ -4,5 +4,5 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
|
4
4
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
5
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
6
6
|
import type { PluginInjectionAPI, PluginInjectionAPIWithA11y } from '../types';
|
|
7
|
-
export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, nodeViewPortalProviderAPI: PortalProviderAPI, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthEnabled?: boolean, pluginInjectionApi?: PluginInjectionAPIWithA11y, getIntl?: () => IntlShape, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean, isTableResizingEnabled?: boolean): SafePlugin;
|
|
7
|
+
export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, nodeViewPortalProviderAPI: PortalProviderAPI, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, dragAndDropEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthEnabled?: boolean, pluginInjectionApi?: PluginInjectionAPIWithA11y, getIntl?: () => IntlShape, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean, isTableResizingEnabled?: boolean): SafePlugin;
|
|
8
8
|
export default keymapPlugin;
|
|
@@ -5,4 +5,4 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
8
|
-
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, nodeViewPortalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean, allowFixedColumnWidthOption?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
8
|
+
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, nodeViewPortalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean, allowFixedColumnWidthOption?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export type TableMeasurement = {
|
|
4
|
+
colWidths: Array<number>;
|
|
5
|
+
tableWidth: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const getTableMeasurement: (tableRef: HTMLTableElement) => TableMeasurement;
|
|
8
|
+
export declare const applyTableMeasurement: (tr: Transaction, tableNode: PMNode, { colWidths, tableWidth }: TableMeasurement, tablePos: number) => Transaction;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare const replaceCells: (tr: Transaction, table: PMNode, tablePos: number, modifyCell: (cell: PMNode, rowIndex: number, colIndex: number) => PMNode) => Transaction;
|
|
4
|
+
/**
|
|
5
|
+
* Position-preserving alternative to `replaceCells`.
|
|
6
|
+
*
|
|
7
|
+
* Uses `setNodeMarkup` per cell instead of rebuilding the whole table with
|
|
8
|
+
* `replaceWith`, so document positions inside cells are never invalidated.
|
|
9
|
+
* This preserves any existing selection through `tr.mapping`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const updateCellsMarkup: (tr: Transaction, table: PMNode, tablePos: number, modifyCell: (cell: PMNode, rowIndex: number, colIndex: number) => PMNode) => Transaction;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import type { PluginInjectionAPI } from '../../types';
|
|
4
|
+
type ContentModePluginOptions = {
|
|
5
|
+
allowColumnResizing: boolean;
|
|
6
|
+
allowTableResizing: boolean;
|
|
7
|
+
isFullPageEditor: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const isTableInContentMode: ({ allowColumnResizing, allowTableResizing, isFullPageEditor, isTableNested, node, }: ContentModePluginOptions & {
|
|
10
|
+
isTableNested?: boolean;
|
|
11
|
+
node?: PMNode;
|
|
12
|
+
}) => boolean;
|
|
13
|
+
export declare const isContentModeSupported: ({ allowColumnResizing, allowTableResizing, isFullPageEditor, }: ContentModePluginOptions) => boolean;
|
|
14
|
+
export declare const hasTableBeenResized: (node: PMNode) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Iterates all top-level tables in the document, and for those in content mode,
|
|
17
|
+
* measures rendered column widths and sets colwidth + table width attributes
|
|
18
|
+
* in a single batched transaction.
|
|
19
|
+
*/
|
|
20
|
+
export declare const applyMeasuredWidthToAllTables: (view: EditorView, pluginInjectionApi?: PluginInjectionAPI) => void;
|
|
21
|
+
export declare const applyMeasuredWidthToSelectedTable: (view: EditorView, api?: PluginInjectionAPI) => void;
|
|
22
|
+
export {};
|
|
@@ -23,6 +23,12 @@ export interface TablePluginOptions {
|
|
|
23
23
|
* Note: This feature requires ADF schema changes to be supported.
|
|
24
24
|
*/
|
|
25
25
|
allowFixedColumnWidthOption?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-49683 Internal documentation for deprecation (no external access)}
|
|
28
|
+
* Deprecating this prop to enable drag and drop in tables by default.
|
|
29
|
+
* See {@link https://hello.atlassian.net/wiki/spaces/EDITOR/pages/6312469305/Deprecating+legacy+table+controls} for rollout plan
|
|
30
|
+
**/
|
|
31
|
+
dragAndDropEnabled?: boolean;
|
|
26
32
|
fullWidthEnabled?: boolean;
|
|
27
33
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
28
34
|
isChromelessEditor?: boolean;
|
|
@@ -95,6 +95,8 @@ export interface TablePluginState {
|
|
|
95
95
|
insertColumnButtonIndex?: number;
|
|
96
96
|
insertRowButtonIndex?: number;
|
|
97
97
|
isCellMenuOpenByKeyboard?: boolean;
|
|
98
|
+
isChromelessEditor?: boolean;
|
|
99
|
+
isCommentEditor?: boolean;
|
|
98
100
|
isContextualMenuOpen?: boolean;
|
|
99
101
|
isDragAndDropEnabled?: boolean;
|
|
100
102
|
isFullWidthModeEnabled?: boolean;
|
|
@@ -448,6 +450,7 @@ export declare const TableCssClassName: {
|
|
|
448
450
|
TABLE_STICKY_SENTINEL_TOP: "pm-table-sticky-sentinel-top";
|
|
449
451
|
TABLE_STICKY_SHADOW: "pm-table-sticky-shadow";
|
|
450
452
|
TABLE_STICKY_WRAPPER: "pm-table-sticky-wrapper";
|
|
453
|
+
TABLE_VIEW_CONTENT_WRAP: "tableView-content-wrap";
|
|
451
454
|
};
|
|
452
455
|
export interface ToolbarMenuConfig {
|
|
453
456
|
allowCollapse?: boolean;
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { PluginInjectionAPI } from '../types';
|
|
8
|
-
export declare const GlobalStylesWrapper: ({ featureFlags, api, }: {
|
|
8
|
+
export declare const GlobalStylesWrapper: ({ featureFlags, isDragAndDropEnabledOption, api, }: {
|
|
9
9
|
api?: PluginInjectionAPI;
|
|
10
10
|
featureFlags: FeatureFlags | undefined;
|
|
11
|
+
isDragAndDropEnabledOption?: boolean;
|
|
11
12
|
}) => jsx.JSX.Element;
|
|
@@ -4,5 +4,5 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
|
4
4
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
5
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
6
6
|
import type { PluginInjectionAPI, PluginInjectionAPIWithA11y } from '../types';
|
|
7
|
-
export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, nodeViewPortalProviderAPI: PortalProviderAPI, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthEnabled?: boolean, pluginInjectionApi?: PluginInjectionAPIWithA11y, getIntl?: () => IntlShape, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean, isTableResizingEnabled?: boolean): SafePlugin;
|
|
7
|
+
export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, nodeViewPortalProviderAPI: PortalProviderAPI, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, dragAndDropEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthEnabled?: boolean, pluginInjectionApi?: PluginInjectionAPIWithA11y, getIntl?: () => IntlShape, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean, isTableResizingEnabled?: boolean): SafePlugin;
|
|
8
8
|
export default keymapPlugin;
|
|
@@ -5,4 +5,4 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
8
|
-
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, nodeViewPortalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean, allowFixedColumnWidthOption?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
8
|
+
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, nodeViewPortalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean, allowFixedColumnWidthOption?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export type TableMeasurement = {
|
|
4
|
+
colWidths: Array<number>;
|
|
5
|
+
tableWidth: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const getTableMeasurement: (tableRef: HTMLTableElement) => TableMeasurement;
|
|
8
|
+
export declare const applyTableMeasurement: (tr: Transaction, tableNode: PMNode, { colWidths, tableWidth }: TableMeasurement, tablePos: number) => Transaction;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare const replaceCells: (tr: Transaction, table: PMNode, tablePos: number, modifyCell: (cell: PMNode, rowIndex: number, colIndex: number) => PMNode) => Transaction;
|
|
4
|
+
/**
|
|
5
|
+
* Position-preserving alternative to `replaceCells`.
|
|
6
|
+
*
|
|
7
|
+
* Uses `setNodeMarkup` per cell instead of rebuilding the whole table with
|
|
8
|
+
* `replaceWith`, so document positions inside cells are never invalidated.
|
|
9
|
+
* This preserves any existing selection through `tr.mapping`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const updateCellsMarkup: (tr: Transaction, table: PMNode, tablePos: number, modifyCell: (cell: PMNode, rowIndex: number, colIndex: number) => PMNode) => Transaction;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import type { PluginInjectionAPI } from '../../types';
|
|
4
|
+
type ContentModePluginOptions = {
|
|
5
|
+
allowColumnResizing: boolean;
|
|
6
|
+
allowTableResizing: boolean;
|
|
7
|
+
isFullPageEditor: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const isTableInContentMode: ({ allowColumnResizing, allowTableResizing, isFullPageEditor, isTableNested, node, }: ContentModePluginOptions & {
|
|
10
|
+
isTableNested?: boolean;
|
|
11
|
+
node?: PMNode;
|
|
12
|
+
}) => boolean;
|
|
13
|
+
export declare const isContentModeSupported: ({ allowColumnResizing, allowTableResizing, isFullPageEditor, }: ContentModePluginOptions) => boolean;
|
|
14
|
+
export declare const hasTableBeenResized: (node: PMNode) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Iterates all top-level tables in the document, and for those in content mode,
|
|
17
|
+
* measures rendered column widths and sets colwidth + table width attributes
|
|
18
|
+
* in a single batched transaction.
|
|
19
|
+
*/
|
|
20
|
+
export declare const applyMeasuredWidthToAllTables: (view: EditorView, pluginInjectionApi?: PluginInjectionAPI) => void;
|
|
21
|
+
export declare const applyMeasuredWidthToSelectedTable: (view: EditorView, api?: PluginInjectionAPI) => void;
|
|
22
|
+
export {};
|
|
@@ -23,6 +23,12 @@ export interface TablePluginOptions {
|
|
|
23
23
|
* Note: This feature requires ADF schema changes to be supported.
|
|
24
24
|
*/
|
|
25
25
|
allowFixedColumnWidthOption?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-49683 Internal documentation for deprecation (no external access)}
|
|
28
|
+
* Deprecating this prop to enable drag and drop in tables by default.
|
|
29
|
+
* See {@link https://hello.atlassian.net/wiki/spaces/EDITOR/pages/6312469305/Deprecating+legacy+table+controls} for rollout plan
|
|
30
|
+
**/
|
|
31
|
+
dragAndDropEnabled?: boolean;
|
|
26
32
|
fullWidthEnabled?: boolean;
|
|
27
33
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
28
34
|
isChromelessEditor?: boolean;
|
|
@@ -95,6 +95,8 @@ export interface TablePluginState {
|
|
|
95
95
|
insertColumnButtonIndex?: number;
|
|
96
96
|
insertRowButtonIndex?: number;
|
|
97
97
|
isCellMenuOpenByKeyboard?: boolean;
|
|
98
|
+
isChromelessEditor?: boolean;
|
|
99
|
+
isCommentEditor?: boolean;
|
|
98
100
|
isContextualMenuOpen?: boolean;
|
|
99
101
|
isDragAndDropEnabled?: boolean;
|
|
100
102
|
isFullWidthModeEnabled?: boolean;
|
|
@@ -448,6 +450,7 @@ export declare const TableCssClassName: {
|
|
|
448
450
|
TABLE_STICKY_SENTINEL_TOP: "pm-table-sticky-sentinel-top";
|
|
449
451
|
TABLE_STICKY_SHADOW: "pm-table-sticky-shadow";
|
|
450
452
|
TABLE_STICKY_WRAPPER: "pm-table-sticky-wrapper";
|
|
453
|
+
TABLE_VIEW_CONTENT_WRAP: "tableView-content-wrap";
|
|
451
454
|
};
|
|
452
455
|
export interface ToolbarMenuConfig {
|
|
453
456
|
allowCollapse?: boolean;
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { PluginInjectionAPI } from '../types';
|
|
8
|
-
export declare const GlobalStylesWrapper: ({ featureFlags, api, }: {
|
|
8
|
+
export declare const GlobalStylesWrapper: ({ featureFlags, isDragAndDropEnabledOption, api, }: {
|
|
9
9
|
api?: PluginInjectionAPI;
|
|
10
10
|
featureFlags: FeatureFlags | undefined;
|
|
11
|
+
isDragAndDropEnabledOption?: boolean;
|
|
11
12
|
}) => jsx.JSX.Element;
|