@atlaskit/editor-plugin-table 15.2.1 → 15.2.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 +16 -0
- package/dist/cjs/nodeviews/TableComponentLegacy.js +23 -35
- package/dist/cjs/nodeviews/TableComponentNext.js +24 -36
- package/dist/cjs/nodeviews/TableContainer.js +31 -215
- package/dist/cjs/nodeviews/TableResizer.js +7 -12
- package/dist/cjs/nodeviews/table.js +1 -2
- package/dist/cjs/nodeviews/toDOM.js +9 -27
- package/dist/cjs/pm-plugins/drag-and-drop/utils/getDragBehaviour.js +3 -1
- package/dist/cjs/pm-plugins/main.js +3 -31
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +1 -2
- package/dist/cjs/tablePlugin.js +2 -1
- package/dist/cjs/ui/DragHandle/index.js +4 -2
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +5 -8
- package/dist/cjs/ui/TableFloatingControls/index.js +5 -2
- package/dist/cjs/ui/common-styles.js +2 -1
- package/dist/es2019/nodeviews/TableComponentLegacy.js +15 -27
- package/dist/es2019/nodeviews/TableComponentNext.js +16 -28
- package/dist/es2019/nodeviews/TableContainer.js +9 -190
- package/dist/es2019/nodeviews/TableResizer.js +6 -11
- package/dist/es2019/nodeviews/table.js +1 -2
- package/dist/es2019/nodeviews/toDOM.js +9 -28
- package/dist/es2019/pm-plugins/drag-and-drop/utils/getDragBehaviour.js +3 -1
- package/dist/es2019/pm-plugins/main.js +4 -32
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +1 -2
- package/dist/es2019/tablePlugin.js +2 -1
- package/dist/es2019/ui/DragHandle/index.js +3 -1
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +2 -5
- package/dist/es2019/ui/TableFloatingControls/index.js +4 -1
- package/dist/es2019/ui/common-styles.js +2 -1
- package/dist/esm/nodeviews/TableComponentLegacy.js +24 -36
- package/dist/esm/nodeviews/TableComponentNext.js +25 -37
- package/dist/esm/nodeviews/TableContainer.js +31 -215
- package/dist/esm/nodeviews/TableResizer.js +6 -11
- package/dist/esm/nodeviews/table.js +1 -2
- package/dist/esm/nodeviews/toDOM.js +10 -28
- package/dist/esm/pm-plugins/drag-and-drop/utils/getDragBehaviour.js +3 -1
- package/dist/esm/pm-plugins/main.js +4 -32
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +1 -2
- package/dist/esm/tablePlugin.js +2 -1
- package/dist/esm/ui/DragHandle/index.js +3 -1
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +5 -8
- package/dist/esm/ui/TableFloatingControls/index.js +4 -1
- package/dist/esm/ui/common-styles.js +2 -1
- package/dist/types/nodeviews/TableContainer.d.ts +1 -3
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +1 -3
- package/package.json +4 -4
|
@@ -418,15 +418,8 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
418
418
|
}, [editorView, getPos, node, isCommentEditor, widthToWidest, isToolbarAIFCEnabled, endMeasure, displayGapCursor, displayGuideline, updateWidth, scheduleResize, onResizeStop, pluginInjectionApi, attachAnalyticsEvent, tableRef, isTableScalingEnabled, shouldUseIncreasedScalingPercent, formatMessage]);
|
|
419
419
|
var handleTableSizeChangeOnKeypress = (0, _react.useCallback)(function (step) {
|
|
420
420
|
var newWidth = width + step;
|
|
421
|
-
if (
|
|
422
|
-
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
} else {
|
|
426
|
-
// maxWidth when platform_editor_tables_scaling_css off is always a number
|
|
427
|
-
if (newWidth > maxWidth || newWidth < resizerMinWidth) {
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
421
|
+
if (newWidth < resizerMinWidth) {
|
|
422
|
+
return;
|
|
430
423
|
}
|
|
431
424
|
handleResizeStop({
|
|
432
425
|
width: width,
|
|
@@ -437,13 +430,14 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
437
430
|
width: step,
|
|
438
431
|
height: 0
|
|
439
432
|
});
|
|
440
|
-
}, [width, handleResizeStop,
|
|
433
|
+
}, [width, handleResizeStop, resizerMinWidth]);
|
|
441
434
|
var handleEscape = (0, _react.useCallback)(function () {
|
|
442
435
|
editorView === null || editorView === void 0 || editorView.focus();
|
|
443
436
|
}, [editorView]);
|
|
444
437
|
var handleKeyDown = (0, _react.useCallback)(function (event) {
|
|
445
438
|
var isBracketKey = event.code === 'BracketRight' || event.code === 'BracketLeft';
|
|
446
|
-
var
|
|
439
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
440
|
+
var metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
447
441
|
if (event.altKey || metaKey || event.shiftKey) {
|
|
448
442
|
areResizeMetaKeysPressed.current = true;
|
|
449
443
|
}
|
|
@@ -468,7 +462,8 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
468
462
|
}
|
|
469
463
|
var resizeHandleThumbEl = resizerRef.current.getResizerThumbEl();
|
|
470
464
|
var globalKeyDownHandler = function globalKeyDownHandler(event) {
|
|
471
|
-
var
|
|
465
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
466
|
+
var metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
472
467
|
if (!isTableSelected) {
|
|
473
468
|
return;
|
|
474
469
|
}
|
|
@@ -20,7 +20,6 @@ var _model = require("@atlaskit/editor-prosemirror/model");
|
|
|
20
20
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
21
21
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
22
22
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
23
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
24
23
|
var _createPluginConfig = require("../pm-plugins/create-plugin-config");
|
|
25
24
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
26
25
|
var _tableWidth = require("../pm-plugins/table-width");
|
|
@@ -149,7 +148,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
149
148
|
if (this.view.state.selection.visible) {
|
|
150
149
|
selectionBookmark = this.view.state.selection.getBookmark();
|
|
151
150
|
}
|
|
152
|
-
if (this.dom
|
|
151
|
+
if (this.dom) {
|
|
153
152
|
this.dom.setAttribute('data-ssr-placeholder', "table-nodeview-".concat(this.node.attrs.localId));
|
|
154
153
|
this.dom.setAttribute('data-ssr-placeholder-replace', "table-nodeview-".concat(this.node.attrs.localId));
|
|
155
154
|
}
|
|
@@ -11,9 +11,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
var _kebabCase = _interopRequireDefault(require("lodash/kebabCase"));
|
|
12
12
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
13
13
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
14
|
-
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
15
14
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
15
|
var _colgroup = require("../pm-plugins/table-resizing/utils/colgroup");
|
|
18
16
|
var _consts = require("../pm-plugins/table-resizing/utils/consts");
|
|
19
17
|
var _misc = require("../pm-plugins/table-resizing/utils/misc");
|
|
@@ -24,16 +22,6 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
24
22
|
var tableNode = config.isNestingSupported ? _adfSchema.tableWithNestedTable : _adfSchema.table;
|
|
25
23
|
return _objectSpread(_objectSpread({}, tableNode), {}, {
|
|
26
24
|
toDOM: function toDOM(node) {
|
|
27
|
-
var _node$attrs$width;
|
|
28
|
-
var gutterPadding = function gutterPadding() {
|
|
29
|
-
if ((0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
|
|
30
|
-
exposure: true
|
|
31
|
-
})) {
|
|
32
|
-
return 'calc(var(--ak-editor--large-gutter-padding) * 2)';
|
|
33
|
-
} else {
|
|
34
|
-
return "".concat((0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2, "px");
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
25
|
var alignmentStyle = Object.entries((0, _tableContainerStyles.getAlignmentStyle)(node.attrs.layout)).map(function (_ref) {
|
|
38
26
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
39
27
|
k = _ref2[0],
|
|
@@ -41,29 +29,23 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
41
29
|
return "".concat((0, _kebabCase.default)(k), ": ").concat((0, _kebabCase.default)(v));
|
|
42
30
|
}).join(';');
|
|
43
31
|
var tableMinWidth = (0, _colgroup.getResizerMinWidth)(node);
|
|
44
|
-
var tableWidthAttribute = node.attrs.width ? "".concat(node.attrs.width, "px") : "100%";
|
|
45
32
|
var isFullPageEditor = !config.isChromelessEditor && !config.isCommentEditor;
|
|
46
|
-
var attrs =
|
|
33
|
+
var attrs = {
|
|
47
34
|
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
48
35
|
'data-layout': node.attrs.layout,
|
|
49
36
|
'data-autosize': node.attrs.__autoSize,
|
|
50
37
|
'data-table-local-id': node.attrs.localId,
|
|
51
|
-
'data-table-width': node.attrs.width
|
|
52
|
-
}, (0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true) && {
|
|
38
|
+
'data-table-width': node.attrs.width,
|
|
53
39
|
'data-ssr-placeholder': "table-".concat(node.attrs.localId),
|
|
54
40
|
'data-ssr-placeholder-replace': "table-".concat(node.attrs.localId)
|
|
55
|
-
}
|
|
41
|
+
};
|
|
56
42
|
|
|
57
43
|
// This would be used for table scaling in colgroup CSS
|
|
58
44
|
// cqw, or px is well supported
|
|
59
|
-
var resizableTableWidth =
|
|
45
|
+
var resizableTableWidth = isFullPageEditor ? (0, _misc.getTableResizerContainerForFullPageWidthInCSS)(node, config.isTableScalingEnabled) : "calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))";
|
|
60
46
|
var colgroup = '';
|
|
61
47
|
if (config.allowColumnResizing) {
|
|
62
|
-
|
|
63
|
-
colgroup = ['colgroup', {}].concat((0, _toConsumableArray2.default)((0, _colgroup.generateColgroupFromNode)(node, config.isCommentEditor, config.isChromelessEditor, config.isNested, config.isTableScalingEnabled, config.shouldUseIncreasedScalingPercent)));
|
|
64
|
-
} else {
|
|
65
|
-
colgroup = ['colgroup', {}].concat((0, _toConsumableArray2.default)((0, _colgroup.generateColgroup)(node)));
|
|
66
|
-
}
|
|
48
|
+
colgroup = ['colgroup', {}].concat((0, _toConsumableArray2.default)((0, _colgroup.generateColgroupFromNode)(node, config.isCommentEditor, config.isChromelessEditor, config.isNested, config.isTableScalingEnabled, config.shouldUseIncreasedScalingPercent)));
|
|
67
49
|
}
|
|
68
50
|
|
|
69
51
|
// For Chromeless editor, and nested tables in full page editor
|
|
@@ -112,7 +94,7 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
112
94
|
'data-testid': 'sticky-sentinel-bottom'
|
|
113
95
|
}]];
|
|
114
96
|
var tableContainerDiv = (0, _expValEquals.expValEquals)('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant1') || (0, _expValEquals.expValEquals)('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant2') || (0, _expValEquals.expValEquals)('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant3') ? tableContainerDivNext : tableContainerDivLegacy;
|
|
115
|
-
if (!config.tableResizingEnabled ||
|
|
97
|
+
if (!config.tableResizingEnabled || config.isNested) {
|
|
116
98
|
return ['div', {
|
|
117
99
|
class: 'tableView-content-wrap',
|
|
118
100
|
'data-prosemirror-initial-toDOM-render': 'true',
|
|
@@ -129,7 +111,7 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
129
111
|
style: (0, _lazyNodeView.convertToInlineCss)({
|
|
130
112
|
'--ak-editor-table-gutter-padding': config.isTableScalingEnabled ? 'calc(var(--ak-editor--large-gutter-padding) * 2)' : 'calc(var(--ak-editor--large-gutter-padding) * 2 - var(--ak-editor-resizer-handle-spacing))',
|
|
131
113
|
'--ak-editor-table-width': resizableTableWidth,
|
|
132
|
-
width:
|
|
114
|
+
width: "var(--ak-editor-table-width)"
|
|
133
115
|
})
|
|
134
116
|
}, ['div', {
|
|
135
117
|
class: 'resizer-item display-handle',
|
|
@@ -140,8 +122,8 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
140
122
|
'--ak-editor-table-max-width': "".concat(_consts.TABLE_MAX_WIDTH, "px"),
|
|
141
123
|
'--ak-editor-table-min-width': "".concat(tableMinWidth, "px"),
|
|
142
124
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
143
|
-
maxWidth: (0,
|
|
144
|
-
width: (0,
|
|
125
|
+
maxWidth: (0, _misc.getTableResizerContainerMaxWidthInCSS)(config.isCommentEditor, config.isChromelessEditor, config.isTableScalingEnabled),
|
|
126
|
+
width: (0, _misc.getTableResizerItemWidthInCSS)(node, config.isCommentEditor, config.isChromelessEditor)
|
|
145
127
|
})
|
|
146
128
|
}, ['span', {
|
|
147
129
|
class: 'resizer-hover-zone'
|
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getDragBehaviour = void 0;
|
|
7
7
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
8
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
8
9
|
var getDragBehaviour = exports.getDragBehaviour = function getDragBehaviour(_ref) {
|
|
9
10
|
var altKey = _ref.altKey,
|
|
10
11
|
ctrlKey = _ref.ctrlKey;
|
|
11
|
-
var
|
|
12
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
13
|
+
var isCloneModifierKeyPressed = browser.mac ? altKey : ctrlKey;
|
|
12
14
|
return isCloneModifierKeyPressed ? 'clone' : 'move';
|
|
13
15
|
};
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createPlugin = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
+
var _browser = require("@atlaskit/editor-common/browser");
|
|
10
11
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
11
12
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
12
13
|
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
@@ -61,36 +62,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
61
62
|
return editorView.state;
|
|
62
63
|
};
|
|
63
64
|
var getNodeView = function getNodeView() {
|
|
64
|
-
// Because the layout shift issues has been fixed under experiment platform_editor_tables_scaling_css, so still want to load nodeview on SSR if experiment is enabled
|
|
65
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
66
|
-
return {
|
|
67
|
-
table: (0, _tableNodeViews.tableView)({
|
|
68
|
-
portalProviderAPI: portalProviderAPI,
|
|
69
|
-
eventDispatcher: eventDispatcher,
|
|
70
|
-
getEditorContainerWidth: getEditorContainerWidth,
|
|
71
|
-
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
72
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
73
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
74
|
-
isCommentEditor: isCommentEditor,
|
|
75
|
-
isChromelessEditor: isChromelessEditor
|
|
76
|
-
}),
|
|
77
|
-
tableRow: (0, _tableNodeViews.tableRowView)({
|
|
78
|
-
eventDispatcher: eventDispatcher,
|
|
79
|
-
pluginInjectionApi: pluginInjectionApi
|
|
80
|
-
}),
|
|
81
|
-
tableCell: (0, _tableNodeViews.tableCellView)({
|
|
82
|
-
eventDispatcher: eventDispatcher,
|
|
83
|
-
pluginInjectionApi: pluginInjectionApi
|
|
84
|
-
}),
|
|
85
|
-
tableHeader: (0, _tableNodeViews.tableHeaderView)({
|
|
86
|
-
eventDispatcher: eventDispatcher,
|
|
87
|
-
pluginInjectionApi: pluginInjectionApi
|
|
88
|
-
})
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
if ((0, _coreUtils.isSSR)()) {
|
|
92
|
-
return undefined;
|
|
93
|
-
}
|
|
94
65
|
return {
|
|
95
66
|
table: (0, _tableNodeViews.tableView)({
|
|
96
67
|
portalProviderAPI: portalProviderAPI,
|
|
@@ -283,6 +254,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
283
254
|
var state = _ref2.state,
|
|
284
255
|
dispatch = _ref2.dispatch;
|
|
285
256
|
var decorationSet = _plugin.pluginKey.getState(state);
|
|
257
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
286
258
|
if ((0, _decoration.findControlsHoverDecoration)(decorationSet).length) {
|
|
287
259
|
(0, _commands.clearHoverSelection)()(state, dispatch);
|
|
288
260
|
}
|
|
@@ -290,7 +262,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
290
262
|
// ED-6069: workaround for Chrome given a regression introduced in prosemirror-view@1.6.8
|
|
291
263
|
// Returning true prevents that updateSelection() is getting called in the commit below:
|
|
292
264
|
// @see https://github.com/ProseMirror/prosemirror-view/commit/33fe4a8b01584f6b4103c279033dcd33e8047b95
|
|
293
|
-
if (
|
|
265
|
+
if (browser.chrome && event.target) {
|
|
294
266
|
// Ignored via go/ees005
|
|
295
267
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
296
268
|
var targetClassList = event.target.classList;
|
|
@@ -9,7 +9,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
10
10
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
11
11
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
12
|
var _analytics = require("../../utils/analytics");
|
|
14
13
|
var _colgroup = require("./colgroup");
|
|
15
14
|
var _columnState = require("./column-state");
|
|
@@ -102,7 +101,7 @@ var getResizeState = exports.getResizeState = function getResizeState(_ref) {
|
|
|
102
101
|
|
|
103
102
|
// updates Colgroup DOM node with new widths
|
|
104
103
|
var updateColgroup = exports.updateColgroup = function updateColgroup(state, tableRef, tableNode, isTableScalingEnabled, scalePercent) {
|
|
105
|
-
var cols =
|
|
104
|
+
var cols = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll(':scope > colgroup > col');
|
|
106
105
|
var columnsCount = cols === null || cols === void 0 ? void 0 : cols.length;
|
|
107
106
|
/**
|
|
108
107
|
updateColgroup will update whole table scale when click the column resize handle, this behavior will affect when table overflowed, when now resize handle been dragged and extend to make table overflowed, table will show overflow. This need to be confirmed because it conflict with how isTableScalingEnabled work.
|
package/dist/cjs/tablePlugin.js
CHANGED
|
@@ -469,10 +469,11 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
469
469
|
return isTableSelectorEnabled ? (0, _tableSizeSelector.createPlugin)(dispatch) : undefined;
|
|
470
470
|
}
|
|
471
471
|
}];
|
|
472
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
472
473
|
|
|
473
474
|
// Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
|
|
474
475
|
// https://github.com/ProseMirror/prosemirror/issues/934
|
|
475
|
-
if (
|
|
476
|
+
if (browser.safari) {
|
|
476
477
|
plugins.push({
|
|
477
478
|
name: 'tableSafariDeleteCompositionTextIssueWorkaround',
|
|
478
479
|
plugin: function plugin() {
|
|
@@ -118,6 +118,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
118
118
|
};
|
|
119
119
|
(0, _react.useEffect)(function () {
|
|
120
120
|
var dragHandleDivRefCurrent = dragHandleDivRef.current;
|
|
121
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
121
122
|
if (dragHandleDivRefCurrent) {
|
|
122
123
|
return (0, _adapter.draggable)({
|
|
123
124
|
element: dragHandleDivRefCurrent,
|
|
@@ -137,7 +138,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
137
138
|
getOffset: function getOffset(_ref3) {
|
|
138
139
|
var container = _ref3.container;
|
|
139
140
|
var rect = container.getBoundingClientRect();
|
|
140
|
-
if (
|
|
141
|
+
if (browser.safari) {
|
|
141
142
|
// See: https://product-fabric.atlassian.net/browse/ED-21442
|
|
142
143
|
// We need to ensure that the preview is not overlaying screen content when the snapshot is taken, otherwise
|
|
143
144
|
// safari will composite the screen text elements into the bitmap snapshot. The container is a wrapper which is already
|
|
@@ -172,6 +173,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
172
173
|
}
|
|
173
174
|
}, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells]);
|
|
174
175
|
var showDragMenuAnchorId = isRow ? 'drag-handle-button-row' : 'drag-handle-button-column';
|
|
176
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
175
177
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
|
|
176
178
|
type: "button"
|
|
177
179
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -248,7 +250,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
248
250
|
}
|
|
249
251
|
}, appearance !== 'placeholder' ?
|
|
250
252
|
// cannot block pointer events in Firefox as it breaks Dragging functionality
|
|
251
|
-
|
|
253
|
+
browser.gecko ?
|
|
252
254
|
/*#__PURE__*/
|
|
253
255
|
// Ignored via go/ees005
|
|
254
256
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -17,14 +17,11 @@ var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
|
17
17
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
18
18
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
19
19
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
20
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
21
20
|
var _commands = require("../../../pm-plugins/commands");
|
|
22
21
|
var _rowControls = require("../../../pm-plugins/utils/row-controls");
|
|
23
22
|
var _types = require("../../../types");
|
|
24
23
|
var _consts = require("../../consts");
|
|
25
24
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
26
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28
25
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
29
26
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
30
27
|
// Ignored via go/ees005
|
|
@@ -113,7 +110,7 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
113
110
|
tableActive = _this$props5.tableActive,
|
|
114
111
|
updateCellHoverLocation = _this$props5.updateCellHoverLocation;
|
|
115
112
|
var rowHeights = (0, _rowControls.getRowHeights)(tableRef);
|
|
116
|
-
if ((0, _coreUtils.isSSR)()
|
|
113
|
+
if ((0, _coreUtils.isSSR)()) {
|
|
117
114
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
118
115
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
119
116
|
className: _types.TableCssClassName.NUMBERED_COLUMN,
|
|
@@ -132,15 +129,15 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
132
129
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
133
130
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
134
131
|
className: _types.TableCssClassName.NUMBERED_COLUMN,
|
|
135
|
-
style:
|
|
132
|
+
style: {
|
|
136
133
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
137
134
|
marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
|
|
138
135
|
borderLeft:
|
|
139
136
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
140
|
-
isDragAndDropEnabled && tableActive ? "1px solid ".concat(_consts.tableBorderColor) : undefined
|
|
141
|
-
|
|
137
|
+
isDragAndDropEnabled && tableActive ? "1px solid ".concat(_consts.tableBorderColor) : undefined,
|
|
138
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
142
139
|
visibility: 'visible'
|
|
143
|
-
}
|
|
140
|
+
},
|
|
144
141
|
contentEditable: false
|
|
145
142
|
}, rowHeights.map(function (rowHeight, index) {
|
|
146
143
|
return isDragAndDropEnabled ?
|
|
@@ -10,6 +10,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
11
11
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
14
|
var _commands = require("../../pm-plugins/commands");
|
|
14
15
|
var _nodes = require("../../pm-plugins/utils/nodes");
|
|
15
16
|
var _types = require("../../types");
|
|
@@ -42,7 +43,8 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
42
43
|
var _selectRow = (0, _react.useCallback)(function (row, expand) {
|
|
43
44
|
var state = editorView.state,
|
|
44
45
|
dispatch = editorView.dispatch;
|
|
45
|
-
|
|
46
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
47
|
+
if (browser.ie_version === 11) {
|
|
46
48
|
// Ignored via go/ees005
|
|
47
49
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
48
50
|
editorView.dom.blur();
|
|
@@ -52,7 +54,8 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
52
54
|
var _selectRows = (0, _react.useCallback)(function (rowIndexes) {
|
|
53
55
|
var state = editorView.state,
|
|
54
56
|
dispatch = editorView.dispatch;
|
|
55
|
-
|
|
57
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
58
|
+
if (browser.ie_version === 11) {
|
|
56
59
|
// Ignored via go/ees005
|
|
57
60
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
58
61
|
editorView.dom.blur();
|
|
@@ -56,12 +56,13 @@ var tableStickyHeaderColumnControlsDecorationsStyle = function tableStickyHeader
|
|
|
56
56
|
return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\t\t.", " .", " {\n\t\t\tz-index: 0;\n\t\t\tleft: -1px;\n\t\t}\n\n\t\t.", " .", "::after {\n\t\t\tborder-left: 1px solid ", ";\n\t\t}\n\n\t\t.", " tr:first-of-type th.", " {\n\t\t\t&.", ", &.", " {\n\t\t\t\t.", "::after {\n\t\t\t\t\tleft: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t"])), _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _consts2.tableBorderColor, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_COLUMN, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS);
|
|
57
57
|
};
|
|
58
58
|
var tableStickyHeaderFirefoxFixStyle = function tableStickyHeaderFirefoxFixStyle() {
|
|
59
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
59
60
|
/*
|
|
60
61
|
This is MAGIC!
|
|
61
62
|
This fixes a bug which occurs in firefox when the first row becomes sticky.
|
|
62
63
|
see https://product-fabric.atlassian.net/browse/ED-19177
|
|
63
64
|
*/
|
|
64
|
-
if (
|
|
65
|
+
if (browser.gecko) {
|
|
65
66
|
return (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t.", " > tbody::before {\n\t\t\t\tcontent: '';\n\t\t\t}\n\t\t"])), _types.TableCssClassName.TABLE_STICKY);
|
|
66
67
|
}
|
|
67
68
|
};
|
|
@@ -5,12 +5,13 @@ import memoizeOne from 'memoize-one';
|
|
|
5
5
|
import rafSchedule from 'raf-schd';
|
|
6
6
|
import { injectIntl } from 'react-intl-next';
|
|
7
7
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
8
9
|
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
9
10
|
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
10
11
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
11
12
|
import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
12
13
|
import { tableMarginSides } from '@atlaskit/editor-common/styles';
|
|
13
|
-
import {
|
|
14
|
+
import { isValidPosition } from '@atlaskit/editor-common/utils';
|
|
14
15
|
import { akEditorTableNumberColumnWidth, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
15
16
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
16
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -39,7 +40,6 @@ import { ExternalDropTargets } from './ExternalDropTargets';
|
|
|
39
40
|
import { OverflowShadowsObserver } from './OverflowShadowsObserver';
|
|
40
41
|
import { TableContainer } from './TableContainer';
|
|
41
42
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
42
|
-
const isIE11 = browser.ie_version === 11;
|
|
43
43
|
// When table is inserted via paste, keyboard shortcut or quickInsert,
|
|
44
44
|
// componentDidUpdate is called multiple times. The isOverflowing value is correct only on the last update.
|
|
45
45
|
// To make sure we capture the last update, we use setTimeout.
|
|
@@ -364,7 +364,7 @@ class TableComponent extends React.Component {
|
|
|
364
364
|
isFullWidthModeAndLineLengthChanged
|
|
365
365
|
} = params;
|
|
366
366
|
const isFullPageEditor = !((_this$props$options = this.props.options) !== null && _this$props$options !== void 0 && _this$props$options.isCommentEditor) && !((_this$props$options2 = this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isChromelessEditor);
|
|
367
|
-
if (
|
|
367
|
+
if (isFullPageEditor) {
|
|
368
368
|
return !!isWindowResized || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
369
369
|
}
|
|
370
370
|
return isWidthChanged || isTableWidthChanged || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
@@ -435,10 +435,8 @@ class TableComponent extends React.Component {
|
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
});
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
441
|
-
}
|
|
438
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
439
|
+
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
442
440
|
}
|
|
443
441
|
}
|
|
444
442
|
initialiseEventListenersAfterMount() {
|
|
@@ -448,10 +446,10 @@ class TableComponent extends React.Component {
|
|
|
448
446
|
allowTableResizing,
|
|
449
447
|
eventDispatcher,
|
|
450
448
|
isDragAndDropEnabled,
|
|
451
|
-
getNode
|
|
452
|
-
getEditorFeatureFlags,
|
|
453
|
-
isTableScalingEnabled
|
|
449
|
+
getNode
|
|
454
450
|
} = this.props;
|
|
451
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
452
|
+
const isIE11 = browser.ie_version === 11;
|
|
455
453
|
|
|
456
454
|
// Ignored via go/ees005
|
|
457
455
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -464,17 +462,6 @@ class TableComponent extends React.Component {
|
|
|
464
462
|
// Ignored via go/ees005
|
|
465
463
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
466
464
|
this === null || this === void 0 ? void 0 : (_this$table3 = this.table) === null || _this$table3 === void 0 ? void 0 : _this$table3.addEventListener('mouseover', this.handleMouseOver);
|
|
467
|
-
const {
|
|
468
|
-
tableWithFixedColumnWidthsOption = false
|
|
469
|
-
} = getEditorFeatureFlags();
|
|
470
|
-
if (!expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
471
|
-
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
472
|
-
this.handleColgroupUpdates(true);
|
|
473
|
-
}
|
|
474
|
-
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
475
|
-
this.handleColgroupUpdates(true);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
465
|
if (this.wrapper) {
|
|
479
466
|
this.wrapperReisizeObserver = new ResizeObserver(entries => {
|
|
480
467
|
for (const entry of entries) {
|
|
@@ -535,6 +522,8 @@ class TableComponent extends React.Component {
|
|
|
535
522
|
view,
|
|
536
523
|
isInDanger
|
|
537
524
|
} = this.props;
|
|
525
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
526
|
+
const isIE11 = browser.ie_version === 11;
|
|
538
527
|
if (this.wrapper && !isIE11) {
|
|
539
528
|
// Ignored via go/ees005
|
|
540
529
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -569,10 +558,9 @@ class TableComponent extends React.Component {
|
|
|
569
558
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
570
559
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
571
560
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}
|
|
561
|
+
|
|
562
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
563
|
+
window.removeEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
576
564
|
|
|
577
565
|
// Ignored via go/ees005
|
|
578
566
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -659,7 +647,7 @@ class TableComponent extends React.Component {
|
|
|
659
647
|
} = containerWidth;
|
|
660
648
|
const isLineLengthChanged = ((_this$containerWidth = this.containerWidth) === null || _this$containerWidth === void 0 ? void 0 : _this$containerWidth.lineLength) !== containerLineLength;
|
|
661
649
|
const isFullWidthModeAndLineLengthChanged = this.updateColGroupFromFullWidthChange && isLineLengthChanged && fg('platform_editor_table_overflow_in_full_width_fix');
|
|
662
|
-
const maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged ||
|
|
650
|
+
const maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged || this.state.windowResized;
|
|
663
651
|
if (force || maybeScale || isFullWidthModeAndLineLengthChanged) {
|
|
664
652
|
var _this$containerWidth2, _this$props$options3, _this$props$options4, _this$props$options5;
|
|
665
653
|
const isWidthChanged = ((_this$containerWidth2 = this.containerWidth) === null || _this$containerWidth2 === void 0 ? void 0 : _this$containerWidth2.width) !== containerWidthValue;
|
|
@@ -774,7 +762,7 @@ class TableComponent extends React.Component {
|
|
|
774
762
|
shouldScale = true;
|
|
775
763
|
shouldHandleColgroupUpdates = true;
|
|
776
764
|
}
|
|
777
|
-
if (
|
|
765
|
+
if (this.state.windowResized) {
|
|
778
766
|
shouldHandleColgroupUpdates = true;
|
|
779
767
|
}
|
|
780
768
|
if (shouldHandleColgroupUpdates) {
|
|
@@ -3,11 +3,12 @@ import React from 'react';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import rafSchedule from 'raf-schd';
|
|
5
5
|
import { injectIntl } from 'react-intl-next';
|
|
6
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
6
7
|
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
7
8
|
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
8
9
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
9
10
|
import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
10
|
-
import {
|
|
11
|
+
import { isValidPosition } from '@atlaskit/editor-common/utils';
|
|
11
12
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
12
13
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
13
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -34,8 +35,6 @@ import TableFloatingControls from '../ui/TableFloatingControls';
|
|
|
34
35
|
import { ExternalDropTargets } from './ExternalDropTargets';
|
|
35
36
|
import { TableContainer } from './TableContainer';
|
|
36
37
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
37
|
-
const isIE11 = browser.ie_version === 11;
|
|
38
|
-
|
|
39
38
|
// Prevent unnecessary parentWidth updates when table is nested inside of a node that is nested itself.
|
|
40
39
|
const NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD = 2;
|
|
41
40
|
const NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD = 20;
|
|
@@ -297,7 +296,7 @@ class TableComponent extends React.Component {
|
|
|
297
296
|
isFullWidthModeAndLineLengthChanged
|
|
298
297
|
} = params;
|
|
299
298
|
const isFullPageEditor = !((_this$props$options = this.props.options) !== null && _this$props$options !== void 0 && _this$props$options.isCommentEditor) && !((_this$props$options2 = this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isChromelessEditor);
|
|
300
|
-
if (
|
|
299
|
+
if (isFullPageEditor) {
|
|
301
300
|
return !!isWindowResized || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
302
301
|
}
|
|
303
302
|
return isWidthChanged || isTableWidthChanged || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
@@ -366,10 +365,9 @@ class TableComponent extends React.Component {
|
|
|
366
365
|
}
|
|
367
366
|
}
|
|
368
367
|
});
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
}
|
|
368
|
+
|
|
369
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
370
|
+
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
373
371
|
}
|
|
374
372
|
}
|
|
375
373
|
initialiseEventListenersAfterMount() {
|
|
@@ -379,10 +377,10 @@ class TableComponent extends React.Component {
|
|
|
379
377
|
allowTableResizing,
|
|
380
378
|
eventDispatcher,
|
|
381
379
|
isDragAndDropEnabled,
|
|
382
|
-
getNode
|
|
383
|
-
getEditorFeatureFlags,
|
|
384
|
-
isTableScalingEnabled
|
|
380
|
+
getNode
|
|
385
381
|
} = this.props;
|
|
382
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
383
|
+
const isIE11 = browser.ie_version === 11;
|
|
386
384
|
|
|
387
385
|
// Ignored via go/ees005
|
|
388
386
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -395,17 +393,6 @@ class TableComponent extends React.Component {
|
|
|
395
393
|
// Ignored via go/ees005
|
|
396
394
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
397
395
|
this === null || this === void 0 ? void 0 : (_this$table3 = this.table) === null || _this$table3 === void 0 ? void 0 : _this$table3.addEventListener('mouseover', this.handleMouseOver);
|
|
398
|
-
const {
|
|
399
|
-
tableWithFixedColumnWidthsOption = false
|
|
400
|
-
} = getEditorFeatureFlags();
|
|
401
|
-
if (!expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
402
|
-
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
403
|
-
this.handleColgroupUpdates(true);
|
|
404
|
-
}
|
|
405
|
-
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
406
|
-
this.handleColgroupUpdates(true);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
396
|
if (this.wrapper) {
|
|
410
397
|
this.wrapperReisizeObserver = new ResizeObserver(entries => {
|
|
411
398
|
for (const entry of entries) {
|
|
@@ -462,6 +449,8 @@ class TableComponent extends React.Component {
|
|
|
462
449
|
view,
|
|
463
450
|
isInDanger
|
|
464
451
|
} = this.props;
|
|
452
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
453
|
+
const isIE11 = browser.ie_version === 11;
|
|
465
454
|
if (this.wrapper && !isIE11) {
|
|
466
455
|
// Ignored via go/ees005
|
|
467
456
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -496,10 +485,9 @@ class TableComponent extends React.Component {
|
|
|
496
485
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
497
486
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
498
487
|
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}
|
|
488
|
+
|
|
489
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
490
|
+
window.removeEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
503
491
|
|
|
504
492
|
// Ignored via go/ees005
|
|
505
493
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -583,7 +571,7 @@ class TableComponent extends React.Component {
|
|
|
583
571
|
} = containerWidth;
|
|
584
572
|
const isLineLengthChanged = ((_this$containerWidth = this.containerWidth) === null || _this$containerWidth === void 0 ? void 0 : _this$containerWidth.lineLength) !== containerLineLength;
|
|
585
573
|
const isFullWidthModeAndLineLengthChanged = this.updateColGroupFromFullWidthChange && isLineLengthChanged && fg('platform_editor_table_overflow_in_full_width_fix');
|
|
586
|
-
const maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged ||
|
|
574
|
+
const maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged || this.state.windowResized;
|
|
587
575
|
if (force || maybeScale || isFullWidthModeAndLineLengthChanged) {
|
|
588
576
|
var _this$containerWidth2, _this$props$options3, _this$props$options4, _this$props$options5;
|
|
589
577
|
const isWidthChanged = ((_this$containerWidth2 = this.containerWidth) === null || _this$containerWidth2 === void 0 ? void 0 : _this$containerWidth2.width) !== containerWidthValue;
|
|
@@ -698,7 +686,7 @@ class TableComponent extends React.Component {
|
|
|
698
686
|
shouldScale = true;
|
|
699
687
|
shouldHandleColgroupUpdates = true;
|
|
700
688
|
}
|
|
701
|
-
if (
|
|
689
|
+
if (this.state.windowResized) {
|
|
702
690
|
shouldHandleColgroupUpdates = true;
|
|
703
691
|
}
|
|
704
692
|
if (shouldHandleColgroupUpdates) {
|