@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
|
@@ -6,7 +6,7 @@ import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useSta
|
|
|
6
6
|
import rafSchd from 'raf-schd';
|
|
7
7
|
import { useIntl } from 'react-intl-next';
|
|
8
8
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
9
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
9
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
10
10
|
import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
|
|
11
11
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
12
12
|
import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
@@ -409,15 +409,8 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
409
409
|
}, [editorView, getPos, node, isCommentEditor, widthToWidest, isToolbarAIFCEnabled, endMeasure, displayGapCursor, displayGuideline, updateWidth, scheduleResize, onResizeStop, pluginInjectionApi, attachAnalyticsEvent, tableRef, isTableScalingEnabled, shouldUseIncreasedScalingPercent, formatMessage]);
|
|
410
410
|
var handleTableSizeChangeOnKeypress = useCallback(function (step) {
|
|
411
411
|
var newWidth = width + step;
|
|
412
|
-
if (
|
|
413
|
-
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
} else {
|
|
417
|
-
// maxWidth when platform_editor_tables_scaling_css off is always a number
|
|
418
|
-
if (newWidth > maxWidth || newWidth < resizerMinWidth) {
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
412
|
+
if (newWidth < resizerMinWidth) {
|
|
413
|
+
return;
|
|
421
414
|
}
|
|
422
415
|
handleResizeStop({
|
|
423
416
|
width: width,
|
|
@@ -428,12 +421,13 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
428
421
|
width: step,
|
|
429
422
|
height: 0
|
|
430
423
|
});
|
|
431
|
-
}, [width, handleResizeStop,
|
|
424
|
+
}, [width, handleResizeStop, resizerMinWidth]);
|
|
432
425
|
var handleEscape = useCallback(function () {
|
|
433
426
|
editorView === null || editorView === void 0 || editorView.focus();
|
|
434
427
|
}, [editorView]);
|
|
435
428
|
var handleKeyDown = useCallback(function (event) {
|
|
436
429
|
var isBracketKey = event.code === 'BracketRight' || event.code === 'BracketLeft';
|
|
430
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
437
431
|
var metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
438
432
|
if (event.altKey || metaKey || event.shiftKey) {
|
|
439
433
|
areResizeMetaKeysPressed.current = true;
|
|
@@ -459,6 +453,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
459
453
|
}
|
|
460
454
|
var resizeHandleThumbEl = resizerRef.current.getResizerThumbEl();
|
|
461
455
|
var globalKeyDownHandler = function globalKeyDownHandler(event) {
|
|
456
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
462
457
|
var metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
463
458
|
if (!isTableSelected) {
|
|
464
459
|
return;
|
|
@@ -16,7 +16,6 @@ import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
|
16
16
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
17
17
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
18
18
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
19
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
20
19
|
import { pluginConfig as getPluginConfig } from '../pm-plugins/create-plugin-config';
|
|
21
20
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
22
21
|
import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
|
|
@@ -142,7 +141,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
142
141
|
if (this.view.state.selection.visible) {
|
|
143
142
|
selectionBookmark = this.view.state.selection.getBookmark();
|
|
144
143
|
}
|
|
145
|
-
if (this.dom
|
|
144
|
+
if (this.dom) {
|
|
146
145
|
this.dom.setAttribute('data-ssr-placeholder', "table-nodeview-".concat(this.node.attrs.localId));
|
|
147
146
|
this.dom.setAttribute('data-ssr-placeholder-replace', "table-nodeview-".concat(this.node.attrs.localId));
|
|
148
147
|
}
|
|
@@ -6,10 +6,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
6
|
import kebabCase from 'lodash/kebabCase';
|
|
7
7
|
import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
|
|
8
8
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
9
|
-
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
10
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
|
-
import {
|
|
12
|
-
import { generateColgroup, generateColgroupFromNode, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
10
|
+
import { generateColgroupFromNode, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
13
11
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
14
12
|
import { getTableResizerContainerMaxWidthInCSS, getTableResizerContainerForFullPageWidthInCSS, getTableResizerItemWidthInCSS } from '../pm-plugins/table-resizing/utils/misc';
|
|
15
13
|
import { getAlignmentStyle } from './table-container-styles';
|
|
@@ -17,16 +15,6 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
17
15
|
var tableNode = config.isNestingSupported ? tableWithNestedTable : table;
|
|
18
16
|
return _objectSpread(_objectSpread({}, tableNode), {}, {
|
|
19
17
|
toDOM: function toDOM(node) {
|
|
20
|
-
var _node$attrs$width;
|
|
21
|
-
var gutterPadding = function gutterPadding() {
|
|
22
|
-
if (editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
23
|
-
exposure: true
|
|
24
|
-
})) {
|
|
25
|
-
return 'calc(var(--ak-editor--large-gutter-padding) * 2)';
|
|
26
|
-
} else {
|
|
27
|
-
return "".concat(akEditorGutterPaddingDynamic() * 2, "px");
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
18
|
var alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout)).map(function (_ref) {
|
|
31
19
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
32
20
|
k = _ref2[0],
|
|
@@ -34,29 +22,23 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
34
22
|
return "".concat(kebabCase(k), ": ").concat(kebabCase(v));
|
|
35
23
|
}).join(';');
|
|
36
24
|
var tableMinWidth = getResizerMinWidth(node);
|
|
37
|
-
var tableWidthAttribute = node.attrs.width ? "".concat(node.attrs.width, "px") : "100%";
|
|
38
25
|
var isFullPageEditor = !config.isChromelessEditor && !config.isCommentEditor;
|
|
39
|
-
var attrs =
|
|
26
|
+
var attrs = {
|
|
40
27
|
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
41
28
|
'data-layout': node.attrs.layout,
|
|
42
29
|
'data-autosize': node.attrs.__autoSize,
|
|
43
30
|
'data-table-local-id': node.attrs.localId,
|
|
44
|
-
'data-table-width': node.attrs.width
|
|
45
|
-
}, expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true) && {
|
|
31
|
+
'data-table-width': node.attrs.width,
|
|
46
32
|
'data-ssr-placeholder': "table-".concat(node.attrs.localId),
|
|
47
33
|
'data-ssr-placeholder-replace': "table-".concat(node.attrs.localId)
|
|
48
|
-
}
|
|
34
|
+
};
|
|
49
35
|
|
|
50
36
|
// This would be used for table scaling in colgroup CSS
|
|
51
37
|
// cqw, or px is well supported
|
|
52
|
-
var resizableTableWidth =
|
|
38
|
+
var resizableTableWidth = isFullPageEditor ? getTableResizerContainerForFullPageWidthInCSS(node, config.isTableScalingEnabled) : "calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2))";
|
|
53
39
|
var colgroup = '';
|
|
54
40
|
if (config.allowColumnResizing) {
|
|
55
|
-
|
|
56
|
-
colgroup = ['colgroup', {}].concat(_toConsumableArray(generateColgroupFromNode(node, config.isCommentEditor, config.isChromelessEditor, config.isNested, config.isTableScalingEnabled, config.shouldUseIncreasedScalingPercent)));
|
|
57
|
-
} else {
|
|
58
|
-
colgroup = ['colgroup', {}].concat(_toConsumableArray(generateColgroup(node)));
|
|
59
|
-
}
|
|
41
|
+
colgroup = ['colgroup', {}].concat(_toConsumableArray(generateColgroupFromNode(node, config.isCommentEditor, config.isChromelessEditor, config.isNested, config.isTableScalingEnabled, config.shouldUseIncreasedScalingPercent)));
|
|
60
42
|
}
|
|
61
43
|
|
|
62
44
|
// For Chromeless editor, and nested tables in full page editor
|
|
@@ -105,7 +87,7 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
105
87
|
'data-testid': 'sticky-sentinel-bottom'
|
|
106
88
|
}]];
|
|
107
89
|
var tableContainerDiv = expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant1') || expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant2') || expValEquals('platform_editor_disable_table_overflow_shadows', 'cohort', 'variant3') ? tableContainerDivNext : tableContainerDivLegacy;
|
|
108
|
-
if (!config.tableResizingEnabled ||
|
|
90
|
+
if (!config.tableResizingEnabled || config.isNested) {
|
|
109
91
|
return ['div', {
|
|
110
92
|
class: 'tableView-content-wrap',
|
|
111
93
|
'data-prosemirror-initial-toDOM-render': 'true',
|
|
@@ -122,7 +104,7 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
122
104
|
style: convertToInlineCss({
|
|
123
105
|
'--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))',
|
|
124
106
|
'--ak-editor-table-width': resizableTableWidth,
|
|
125
|
-
width:
|
|
107
|
+
width: "var(--ak-editor-table-width)"
|
|
126
108
|
})
|
|
127
109
|
}, ['div', {
|
|
128
110
|
class: 'resizer-item display-handle',
|
|
@@ -133,8 +115,8 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
133
115
|
'--ak-editor-table-max-width': "".concat(TABLE_MAX_WIDTH, "px"),
|
|
134
116
|
'--ak-editor-table-min-width': "".concat(tableMinWidth, "px"),
|
|
135
117
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
136
|
-
maxWidth:
|
|
137
|
-
width:
|
|
118
|
+
maxWidth: getTableResizerContainerMaxWidthInCSS(config.isCommentEditor, config.isChromelessEditor, config.isTableScalingEnabled),
|
|
119
|
+
width: getTableResizerItemWidthInCSS(node, config.isCommentEditor, config.isChromelessEditor)
|
|
138
120
|
})
|
|
139
121
|
}, ['span', {
|
|
140
122
|
class: 'resizer-hover-zone'
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
1
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
3
|
export var getDragBehaviour = function getDragBehaviour(_ref) {
|
|
3
4
|
var altKey = _ref.altKey,
|
|
4
5
|
ctrlKey = _ref.ctrlKey;
|
|
6
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
5
7
|
var isCloneModifierKeyPressed = browser.mac ? altKey : ctrlKey;
|
|
6
8
|
return isCloneModifierKeyPressed ? 'clone' : 'move';
|
|
7
9
|
};
|
|
@@ -2,10 +2,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
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; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import {
|
|
5
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
6
|
+
import { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
6
7
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
8
|
import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveOpenNestedExpand } from '@atlaskit/editor-common/transforms';
|
|
8
|
-
import {
|
|
9
|
+
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
9
10
|
import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
10
11
|
import { TableMap } from '@atlaskit/editor-tables';
|
|
11
12
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
@@ -54,36 +55,6 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
54
55
|
return editorView.state;
|
|
55
56
|
};
|
|
56
57
|
var getNodeView = function getNodeView() {
|
|
57
|
-
// 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
|
|
58
|
-
if (expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
59
|
-
return {
|
|
60
|
-
table: tableView({
|
|
61
|
-
portalProviderAPI: portalProviderAPI,
|
|
62
|
-
eventDispatcher: eventDispatcher,
|
|
63
|
-
getEditorContainerWidth: getEditorContainerWidth,
|
|
64
|
-
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
65
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
66
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
67
|
-
isCommentEditor: isCommentEditor,
|
|
68
|
-
isChromelessEditor: isChromelessEditor
|
|
69
|
-
}),
|
|
70
|
-
tableRow: tableRowView({
|
|
71
|
-
eventDispatcher: eventDispatcher,
|
|
72
|
-
pluginInjectionApi: pluginInjectionApi
|
|
73
|
-
}),
|
|
74
|
-
tableCell: tableCellView({
|
|
75
|
-
eventDispatcher: eventDispatcher,
|
|
76
|
-
pluginInjectionApi: pluginInjectionApi
|
|
77
|
-
}),
|
|
78
|
-
tableHeader: tableHeaderView({
|
|
79
|
-
eventDispatcher: eventDispatcher,
|
|
80
|
-
pluginInjectionApi: pluginInjectionApi
|
|
81
|
-
})
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
if (isSSR()) {
|
|
85
|
-
return undefined;
|
|
86
|
-
}
|
|
87
58
|
return {
|
|
88
59
|
table: tableView({
|
|
89
60
|
portalProviderAPI: portalProviderAPI,
|
|
@@ -276,6 +247,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
276
247
|
var state = _ref2.state,
|
|
277
248
|
dispatch = _ref2.dispatch;
|
|
278
249
|
var decorationSet = decorationsPluginKey.getState(state);
|
|
250
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
279
251
|
if (findControlsHoverDecoration(decorationSet).length) {
|
|
280
252
|
clearHoverSelection()(state, dispatch);
|
|
281
253
|
}
|
|
@@ -4,7 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
5
5
|
import { tableCellMinWidth, tableNewColumnMinWidth } from '@atlaskit/editor-common/styles';
|
|
6
6
|
import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
|
|
7
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
7
|
import { getSelectedTableInfo } from '../../utils/analytics';
|
|
9
8
|
import { getColWidthFix, hasTableBeenResized, insertColgroupFromNode } from './colgroup';
|
|
10
9
|
import { getCellsRefsInColumn, getColumnStateFromDOM } from './column-state';
|
|
@@ -95,7 +94,7 @@ export var getResizeState = function getResizeState(_ref) {
|
|
|
95
94
|
|
|
96
95
|
// updates Colgroup DOM node with new widths
|
|
97
96
|
export var updateColgroup = function updateColgroup(state, tableRef, tableNode, isTableScalingEnabled, scalePercent) {
|
|
98
|
-
var cols =
|
|
97
|
+
var cols = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll(':scope > colgroup > col');
|
|
99
98
|
var columnsCount = cols === null || cols === void 0 ? void 0 : cols.length;
|
|
100
99
|
/**
|
|
101
100
|
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/esm/tablePlugin.js
CHANGED
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import React, { useEffect } from 'react';
|
|
5
5
|
import { tableCell, tableCellWithNestedTable, tableHeader, tableHeaderWithLocalId, tableHeaderWithNestedTable, tableRow, tableRowWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableCellWithNestedTableWithLocalId, tableRowWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from '@atlaskit/adf-schema';
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
7
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
7
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
8
8
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
9
9
|
import { IconTable } from '@atlaskit/editor-common/icons';
|
|
10
10
|
import { toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
@@ -460,6 +460,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
460
460
|
return isTableSelectorEnabled ? createSizeSelectorPlugin(dispatch) : undefined;
|
|
461
461
|
}
|
|
462
462
|
}];
|
|
463
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
463
464
|
|
|
464
465
|
// Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
|
|
465
466
|
// https://github.com/ProseMirror/prosemirror/issues/934
|
|
@@ -6,7 +6,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import ReactDOM from 'react-dom';
|
|
8
8
|
import { injectIntl } from 'react-intl-next';
|
|
9
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
9
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
10
10
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
11
11
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
12
12
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -109,6 +109,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
109
109
|
};
|
|
110
110
|
useEffect(function () {
|
|
111
111
|
var dragHandleDivRefCurrent = dragHandleDivRef.current;
|
|
112
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
112
113
|
if (dragHandleDivRefCurrent) {
|
|
113
114
|
return draggable({
|
|
114
115
|
element: dragHandleDivRefCurrent,
|
|
@@ -163,6 +164,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
163
164
|
}
|
|
164
165
|
}, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells]);
|
|
165
166
|
var showDragMenuAnchorId = isRow ? 'drag-handle-button-row' : 'drag-handle-button-column';
|
|
167
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
166
168
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
167
169
|
type: "button"
|
|
168
170
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -4,8 +4,6 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
4
4
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
-
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; }
|
|
8
|
-
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) { _defineProperty(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; }
|
|
9
7
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
9
|
import React, { Component } from 'react';
|
|
@@ -13,7 +11,6 @@ import classnames from 'classnames';
|
|
|
13
11
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
14
12
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
15
13
|
import { isRowSelected } from '@atlaskit/editor-tables/utils';
|
|
16
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
17
14
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
18
15
|
import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
|
|
19
16
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
@@ -104,7 +101,7 @@ var NumberColumn = /*#__PURE__*/function (_Component) {
|
|
|
104
101
|
tableActive = _this$props5.tableActive,
|
|
105
102
|
updateCellHoverLocation = _this$props5.updateCellHoverLocation;
|
|
106
103
|
var rowHeights = getRowHeights(tableRef);
|
|
107
|
-
if (isSSR()
|
|
104
|
+
if (isSSR()) {
|
|
108
105
|
return /*#__PURE__*/React.createElement("div", {
|
|
109
106
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
110
107
|
className: ClassName.NUMBERED_COLUMN,
|
|
@@ -123,15 +120,15 @@ var NumberColumn = /*#__PURE__*/function (_Component) {
|
|
|
123
120
|
return /*#__PURE__*/React.createElement("div", {
|
|
124
121
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
125
122
|
className: ClassName.NUMBERED_COLUMN,
|
|
126
|
-
style:
|
|
123
|
+
style: {
|
|
127
124
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
128
125
|
marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
|
|
129
126
|
borderLeft:
|
|
130
127
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
131
|
-
isDragAndDropEnabled && tableActive ? "1px solid ".concat(tableBorderColor) : undefined
|
|
132
|
-
|
|
128
|
+
isDragAndDropEnabled && tableActive ? "1px solid ".concat(tableBorderColor) : undefined,
|
|
129
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
133
130
|
visibility: 'visible'
|
|
134
|
-
}
|
|
131
|
+
},
|
|
135
132
|
contentEditable: false
|
|
136
133
|
}, rowHeights.map(function (rowHeight, index) {
|
|
137
134
|
return isDragAndDropEnabled ?
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
2
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
3
3
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
6
|
import { hoverCell, hoverRows, selectRow, selectRows } from '../../pm-plugins/commands';
|
|
6
7
|
import { isTableNested } from '../../pm-plugins/utils/nodes';
|
|
7
8
|
import { TableCssClassName as ClassName } from '../../types';
|
|
@@ -33,6 +34,7 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
33
34
|
var _selectRow = useCallback(function (row, expand) {
|
|
34
35
|
var state = editorView.state,
|
|
35
36
|
dispatch = editorView.dispatch;
|
|
37
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
36
38
|
if (browser.ie_version === 11) {
|
|
37
39
|
// Ignored via go/ees005
|
|
38
40
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -43,6 +45,7 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
43
45
|
var _selectRows = useCallback(function (rowIndexes) {
|
|
44
46
|
var state = editorView.state,
|
|
45
47
|
dispatch = editorView.dispatch;
|
|
48
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
46
49
|
if (browser.ie_version === 11) {
|
|
47
50
|
// Ignored via go/ees005
|
|
48
51
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -7,7 +7,7 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { css } from '@emotion/react';
|
|
10
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
10
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
11
11
|
import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
|
12
12
|
import { SORTABLE_COLUMN_ICON_CLASSNAME } from '@atlaskit/editor-common/table';
|
|
13
13
|
import { akEditorSelectedNodeClassName, akEditorSmallZIndex, akEditorStickyHeaderZIndex, akEditorTableCellOnStickyHeaderZIndex, akEditorTableNumberColumnWidth, akEditorTableToolbarSize, akEditorUnitZIndex, getSelectionStyles, MAX_BROWSER_SCROLLBAR_HEIGHT, SelectionStyle, relativeSizeToBaseFontSize, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
@@ -51,6 +51,7 @@ var tableStickyHeaderColumnControlsDecorationsStyle = function tableStickyHeader
|
|
|
51
51
|
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\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"])), ClassName.TABLE_STICKY, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.TABLE_STICKY, ClassName.COLUMN_CONTROLS_DECORATIONS, tableBorderColor, ClassName.TABLE_STICKY, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_SELECTED, ClassName.HOVERED_COLUMN, ClassName.COLUMN_CONTROLS_DECORATIONS);
|
|
52
52
|
};
|
|
53
53
|
var tableStickyHeaderFirefoxFixStyle = function tableStickyHeaderFirefoxFixStyle() {
|
|
54
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
54
55
|
/*
|
|
55
56
|
This is MAGIC!
|
|
56
57
|
This fixes a bug which occurs in firefox when the first row becomes sticky.
|
|
@@ -23,9 +23,7 @@ type ResizableTableContainerProps = {
|
|
|
23
23
|
tableRef: HTMLTableElement;
|
|
24
24
|
tableWrapperHeight?: number;
|
|
25
25
|
};
|
|
26
|
-
export declare const ResizableTableContainer: React.
|
|
27
|
-
children?: React.ReactNode | undefined;
|
|
28
|
-
}>;
|
|
26
|
+
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, lineLength, editorView, getPos, tableRef, isResizing, pluginInjectionApi, tableWrapperHeight, isWholeTableInDanger, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, }: PropsWithChildren<ResizableTableContainerProps>) => React.JSX.Element>;
|
|
29
27
|
type TableContainerProps = {
|
|
30
28
|
className: string;
|
|
31
29
|
containerWidth: EditorContainerWidth;
|
|
@@ -23,9 +23,7 @@ type ResizableTableContainerProps = {
|
|
|
23
23
|
tableRef: HTMLTableElement;
|
|
24
24
|
tableWrapperHeight?: number;
|
|
25
25
|
};
|
|
26
|
-
export declare const ResizableTableContainer: React.
|
|
27
|
-
children?: React.ReactNode | undefined;
|
|
28
|
-
}>;
|
|
26
|
+
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, lineLength, editorView, getPos, tableRef, isResizing, pluginInjectionApi, tableWrapperHeight, isWholeTableInDanger, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, }: PropsWithChildren<ResizableTableContainerProps>) => React.JSX.Element>;
|
|
29
27
|
type TableContainerProps = {
|
|
30
28
|
className: string;
|
|
31
29
|
containerWidth: EditorContainerWidth;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "15.2.
|
|
3
|
+
"version": "15.2.3",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"@atlaskit/primitives": "^16.0.0",
|
|
60
60
|
"@atlaskit/react-ufo": "^4.12.0",
|
|
61
61
|
"@atlaskit/theme": "^21.0.0",
|
|
62
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
62
|
+
"@atlaskit/tmp-editor-statsig": "^13.17.0",
|
|
63
63
|
"@atlaskit/toggle": "^15.1.0",
|
|
64
64
|
"@atlaskit/tokens": "^7.0.0",
|
|
65
|
-
"@atlaskit/tooltip": "^20.
|
|
65
|
+
"@atlaskit/tooltip": "^20.6.0",
|
|
66
66
|
"@babel/runtime": "^7.0.0",
|
|
67
67
|
"@emotion/react": "^11.7.1",
|
|
68
68
|
"classnames": "^2.2.5",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"uuid": "^3.1.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@atlaskit/editor-common": "^110.
|
|
75
|
+
"@atlaskit/editor-common": "^110.16.0",
|
|
76
76
|
"react": "^18.2.0",
|
|
77
77
|
"react-dom": "^18.2.0",
|
|
78
78
|
"react-intl-next": "npm:react-intl@^5.18.1"
|