@atlaskit/editor-plugin-table 7.25.22 → 7.25.24
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/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/nodeviews/TableComponent.js +1 -1
- package/dist/cjs/nodeviews/TableResizer.js +5 -1
- package/dist/cjs/nodeviews/TableStickyScrollbar.js +2 -2
- package/dist/cjs/nodeviews/lazy-node-views.js +5 -5
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +0 -1
- package/dist/cjs/toDOM.js +2 -2
- package/dist/es2019/nodeviews/TableComponent.js +1 -1
- package/dist/es2019/nodeviews/TableResizer.js +5 -1
- package/dist/es2019/nodeviews/TableStickyScrollbar.js +2 -2
- package/dist/es2019/nodeviews/lazy-node-views.js +5 -5
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +0 -1
- package/dist/es2019/toDOM.js +2 -2
- package/dist/esm/nodeviews/TableComponent.js +1 -1
- package/dist/esm/nodeviews/TableResizer.js +5 -1
- package/dist/esm/nodeviews/TableStickyScrollbar.js +2 -2
- package/dist/esm/nodeviews/lazy-node-views.js +5 -5
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +0 -1
- package/dist/esm/toDOM.js +2 -2
- package/package.json +2 -4
- package/src/nodeviews/TableComponent.tsx +5 -1
- package/src/nodeviews/TableResizer.tsx +5 -1
- package/src/nodeviews/TableStickyScrollbar.ts +2 -2
- package/src/nodeviews/lazy-node-views.ts +5 -5
- package/src/pm-plugins/table-resizing/event-handlers.ts +1 -1
- package/src/toDOM.ts +2 -2
- package/tsconfig.app.json +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.25.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#139034](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/139034)
|
|
8
|
+
[`517cdc0f7ea1a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/517cdc0f7ea1a) -
|
|
9
|
+
Used experiment for lazy node view
|
|
10
|
+
|
|
11
|
+
## 7.25.23
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#139279](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/139279)
|
|
16
|
+
[`70db87daa2f22`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/70db87daa2f22) -
|
|
17
|
+
[ux] Fix for column resizing for table that were resized to full-width in comment editor.
|
|
18
|
+
|
|
3
19
|
## 7.25.22
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -636,7 +636,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
636
636
|
if (isInDanger && !table) {
|
|
637
637
|
(0, _commands.clearHoverSelection)()(view.state, view.dispatch);
|
|
638
638
|
}
|
|
639
|
-
if ((_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled) {
|
|
639
|
+
if ((_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled && !(options !== null && options !== void 0 && options.isTableScalingEnabled)) {
|
|
640
640
|
this.removeInlineTableWidth();
|
|
641
641
|
}
|
|
642
642
|
if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
|
|
@@ -294,6 +294,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
294
294
|
var _node$attrs$localId2, _node$attrs2;
|
|
295
295
|
isResizing.current = false;
|
|
296
296
|
var newWidth = originalState.width + delta.width;
|
|
297
|
+
var originalNewWidth = newWidth;
|
|
297
298
|
var state = editorView.state,
|
|
298
299
|
dispatch = editorView.dispatch;
|
|
299
300
|
var pos = getPos();
|
|
@@ -329,7 +330,10 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
329
330
|
node: newNode,
|
|
330
331
|
prevNode: node,
|
|
331
332
|
start: pos + 1,
|
|
332
|
-
|
|
333
|
+
// We use originalNewWidth in comment editor, because in comment editor
|
|
334
|
+
// newWidth can be underined when table is resized to 'full-width'
|
|
335
|
+
// scaleTable function needs number value to work correctly.
|
|
336
|
+
parentWidth: isCommentEditor ? originalNewWidth : newWidth
|
|
333
337
|
}, editorView.domAtPos.bind(editorView), pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent || false, isCommentEditor)(tr);
|
|
334
338
|
var scaledNode = tr.doc.nodeAt(pos);
|
|
335
339
|
(_attachAnalyticsEvent2 = attachAnalyticsEvent((0, _analytics2.generateResizedPayload)({
|
|
@@ -9,7 +9,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
12
|
-
var
|
|
12
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
13
13
|
var _types = require("../types");
|
|
14
14
|
var TableStickyScrollbar = exports.TableStickyScrollbar = /*#__PURE__*/function () {
|
|
15
15
|
function TableStickyScrollbar(wrapper, view) {
|
|
@@ -24,7 +24,7 @@ var TableStickyScrollbar = exports.TableStickyScrollbar = /*#__PURE__*/function
|
|
|
24
24
|
});
|
|
25
25
|
this.wrapper = wrapper;
|
|
26
26
|
this.view = view;
|
|
27
|
-
if ((0,
|
|
27
|
+
if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', true)) {
|
|
28
28
|
requestAnimationFrame(function () {
|
|
29
29
|
_this.init();
|
|
30
30
|
});
|
|
@@ -7,14 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.lazyTableView = exports.lazyTableRowView = exports.lazyTableHeaderView = exports.lazyTableCellView = void 0;
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
10
|
-
var
|
|
10
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
11
11
|
var _table = require("./table");
|
|
12
12
|
var _TableCell = _interopRequireDefault(require("./TableCell"));
|
|
13
13
|
var _TableRow = _interopRequireDefault(require("./TableRow"));
|
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != (0, _typeof2.default)(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } // TODO: Clean up ED-23976
|
|
16
16
|
var lazyTableView = exports.lazyTableView = function lazyTableView(options) {
|
|
17
|
-
if (
|
|
17
|
+
if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false)) {
|
|
18
18
|
return function (node, view, getPos) {
|
|
19
19
|
return (0, _table.createTableView)(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isTableAlignmentEnabled, options.isCommentEditor, options.isChromelessEditor);
|
|
20
20
|
};
|
|
@@ -50,7 +50,7 @@ var lazyTableView = exports.lazyTableView = function lazyTableView(options) {
|
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
52
|
var lazyTableCellView = exports.lazyTableCellView = function lazyTableCellView(options) {
|
|
53
|
-
if (
|
|
53
|
+
if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false)) {
|
|
54
54
|
return function (node, view, getPos) {
|
|
55
55
|
var _options$pluginInject;
|
|
56
56
|
return new _TableCell.default(node, view, getPos, options.eventDispatcher, (_options$pluginInject = options.pluginInjectionApi) === null || _options$pluginInject === void 0 || (_options$pluginInject = _options$pluginInject.analytics) === null || _options$pluginInject === void 0 ? void 0 : _options$pluginInject.actions);
|
|
@@ -81,7 +81,7 @@ var lazyTableCellView = exports.lazyTableCellView = function lazyTableCellView(o
|
|
|
81
81
|
});
|
|
82
82
|
};
|
|
83
83
|
var lazyTableHeaderView = exports.lazyTableHeaderView = function lazyTableHeaderView(options) {
|
|
84
|
-
if (
|
|
84
|
+
if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false)) {
|
|
85
85
|
return function (node, view, getPos) {
|
|
86
86
|
var _options$pluginInject2;
|
|
87
87
|
return new _TableCell.default(node, view, getPos, options.eventDispatcher, (_options$pluginInject2 = options.pluginInjectionApi) === null || _options$pluginInject2 === void 0 || (_options$pluginInject2 = _options$pluginInject2.analytics) === null || _options$pluginInject2 === void 0 ? void 0 : _options$pluginInject2.actions);
|
|
@@ -112,7 +112,7 @@ var lazyTableHeaderView = exports.lazyTableHeaderView = function lazyTableHeader
|
|
|
112
112
|
});
|
|
113
113
|
};
|
|
114
114
|
var lazyTableRowView = exports.lazyTableRowView = function lazyTableRowView(options) {
|
|
115
|
-
if (
|
|
115
|
+
if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false)) {
|
|
116
116
|
return function (node, view, getPos) {
|
|
117
117
|
return new _TableRow.default(node, view, getPos, options.eventDispatcher);
|
|
118
118
|
};
|
|
@@ -307,7 +307,6 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
|
|
|
307
307
|
} else {
|
|
308
308
|
var _table$attrs2;
|
|
309
309
|
var scalePercent = isTableScalingEnabled && isCommentEditor && !((_table$attrs2 = table.attrs) !== null && _table$attrs2 !== void 0 && _table$attrs2.width) ? (0, _misc2.getScalingPercentForTableWithoutWidth)(table, dom) : (0, _misc2.getTableScalingPercent)(originalTable, dom, shouldUseIncreasedScalingPercent);
|
|
310
|
-
// This function is called for Full-page/Fixed-page tables and table that have width attr value in Comment editor
|
|
311
310
|
(0, _utils3.resizeColumn)(resizeState, colIndex, resizedDelta, dom, table, undefined, shouldScale, scalePercent);
|
|
312
311
|
}
|
|
313
312
|
(0, _utils3.updateControls)()(state);
|
package/dist/cjs/toDOM.js
CHANGED
|
@@ -11,13 +11,13 @@ 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 _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
14
|
-
var
|
|
14
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
15
|
var _tableContainerStyles = require("./nodeviews/table-container-styles");
|
|
16
16
|
var _colgroup = require("./pm-plugins/table-resizing/utils/colgroup");
|
|
17
17
|
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; }
|
|
18
18
|
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; }
|
|
19
19
|
var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(config) {
|
|
20
|
-
if (
|
|
20
|
+
if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false)) {
|
|
21
21
|
return _adfSchema.table;
|
|
22
22
|
}
|
|
23
23
|
return _objectSpread(_objectSpread({}, _adfSchema.table), {}, {
|
|
@@ -616,7 +616,7 @@ class TableComponent extends React.Component {
|
|
|
616
616
|
if (isInDanger && !table) {
|
|
617
617
|
clearHoverSelection()(view.state, view.dispatch);
|
|
618
618
|
}
|
|
619
|
-
if ((_this$props$options11 = this.props.options) !== null && _this$props$options11 !== void 0 && _this$props$options11.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled) {
|
|
619
|
+
if ((_this$props$options11 = this.props.options) !== null && _this$props$options11 !== void 0 && _this$props$options11.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled && !(options !== null && options !== void 0 && options.isTableScalingEnabled)) {
|
|
620
620
|
this.removeInlineTableWidth();
|
|
621
621
|
}
|
|
622
622
|
if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
|
|
@@ -287,6 +287,7 @@ export const TableResizer = ({
|
|
|
287
287
|
var _node$attrs$localId2, _node$attrs2;
|
|
288
288
|
isResizing.current = false;
|
|
289
289
|
let newWidth = originalState.width + delta.width;
|
|
290
|
+
const originalNewWidth = newWidth;
|
|
290
291
|
const {
|
|
291
292
|
state,
|
|
292
293
|
dispatch
|
|
@@ -325,7 +326,10 @@ export const TableResizer = ({
|
|
|
325
326
|
node: newNode,
|
|
326
327
|
prevNode: node,
|
|
327
328
|
start: pos + 1,
|
|
328
|
-
|
|
329
|
+
// We use originalNewWidth in comment editor, because in comment editor
|
|
330
|
+
// newWidth can be underined when table is resized to 'full-width'
|
|
331
|
+
// scaleTable function needs number value to work correctly.
|
|
332
|
+
parentWidth: isCommentEditor ? originalNewWidth : newWidth
|
|
329
333
|
}, editorView.domAtPos.bind(editorView), pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent || false, isCommentEditor)(tr);
|
|
330
334
|
const scaledNode = tr.doc.nodeAt(pos);
|
|
331
335
|
(_attachAnalyticsEvent2 = attachAnalyticsEvent(generateResizedPayload({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
3
|
-
import {
|
|
3
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
4
|
import { TableCssClassName as ClassName } from '../types';
|
|
5
5
|
export class TableStickyScrollbar {
|
|
6
6
|
constructor(wrapper, view) {
|
|
@@ -13,7 +13,7 @@ export class TableStickyScrollbar {
|
|
|
13
13
|
});
|
|
14
14
|
this.wrapper = wrapper;
|
|
15
15
|
this.view = view;
|
|
16
|
-
if (
|
|
16
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', true)) {
|
|
17
17
|
requestAnimationFrame(() => {
|
|
18
18
|
this.init();
|
|
19
19
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
|
-
import {
|
|
2
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
3
|
// TODO: Clean up ED-23976
|
|
4
4
|
import { createTableView } from './table';
|
|
5
5
|
import TableCell from './TableCell';
|
|
6
6
|
import TableRow from './TableRow';
|
|
7
7
|
export const lazyTableView = options => {
|
|
8
|
-
if (
|
|
8
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
9
9
|
return (node, view, getPos) => {
|
|
10
10
|
return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isTableAlignmentEnabled, options.isCommentEditor, options.isChromelessEditor);
|
|
11
11
|
};
|
|
@@ -39,7 +39,7 @@ export const lazyTableView = options => {
|
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
41
|
export const lazyTableCellView = options => {
|
|
42
|
-
if (
|
|
42
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
43
43
|
return (node, view, getPos) => {
|
|
44
44
|
var _options$pluginInject, _options$pluginInject2;
|
|
45
45
|
return new TableCell(node, view, getPos, options.eventDispatcher, (_options$pluginInject = options.pluginInjectionApi) === null || _options$pluginInject === void 0 ? void 0 : (_options$pluginInject2 = _options$pluginInject.analytics) === null || _options$pluginInject2 === void 0 ? void 0 : _options$pluginInject2.actions);
|
|
@@ -68,7 +68,7 @@ export const lazyTableCellView = options => {
|
|
|
68
68
|
});
|
|
69
69
|
};
|
|
70
70
|
export const lazyTableHeaderView = options => {
|
|
71
|
-
if (
|
|
71
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
72
72
|
return (node, view, getPos) => {
|
|
73
73
|
var _options$pluginInject3, _options$pluginInject4;
|
|
74
74
|
return new TableCell(node, view, getPos, options.eventDispatcher, (_options$pluginInject3 = options.pluginInjectionApi) === null || _options$pluginInject3 === void 0 ? void 0 : (_options$pluginInject4 = _options$pluginInject3.analytics) === null || _options$pluginInject4 === void 0 ? void 0 : _options$pluginInject4.actions);
|
|
@@ -97,7 +97,7 @@ export const lazyTableHeaderView = options => {
|
|
|
97
97
|
});
|
|
98
98
|
};
|
|
99
99
|
export const lazyTableRowView = options => {
|
|
100
|
-
if (
|
|
100
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
101
101
|
return (node, view, getPos) => {
|
|
102
102
|
return new TableRow(node, view, getPos, options.eventDispatcher);
|
|
103
103
|
};
|
|
@@ -318,7 +318,6 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
|
|
|
318
318
|
} else {
|
|
319
319
|
var _table$attrs2;
|
|
320
320
|
const scalePercent = isTableScalingEnabled && isCommentEditor && !((_table$attrs2 = table.attrs) !== null && _table$attrs2 !== void 0 && _table$attrs2.width) ? getScalingPercentForTableWithoutWidth(table, dom) : getTableScalingPercent(originalTable, dom, shouldUseIncreasedScalingPercent);
|
|
321
|
-
// This function is called for Full-page/Fixed-page tables and table that have width attr value in Comment editor
|
|
322
321
|
resizeColumn(resizeState, colIndex, resizedDelta, dom, table, undefined, shouldScale, scalePercent);
|
|
323
322
|
}
|
|
324
323
|
updateControls()(state);
|
package/dist/es2019/toDOM.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import kebabCase from 'lodash/kebabCase';
|
|
2
2
|
import { table } from '@atlaskit/adf-schema';
|
|
3
3
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import {
|
|
4
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
5
|
import { getAlignmentStyle } from './nodeviews/table-container-styles';
|
|
6
6
|
import { generateColgroup } from './pm-plugins/table-resizing/utils/colgroup';
|
|
7
7
|
export const tableNodeSpecWithFixedToDOM = config => {
|
|
8
|
-
if (
|
|
8
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
9
9
|
return table;
|
|
10
10
|
}
|
|
11
11
|
return {
|
|
@@ -629,7 +629,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
629
629
|
if (isInDanger && !table) {
|
|
630
630
|
clearHoverSelection()(view.state, view.dispatch);
|
|
631
631
|
}
|
|
632
|
-
if ((_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled) {
|
|
632
|
+
if ((_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled && !(options !== null && options !== void 0 && options.isTableScalingEnabled)) {
|
|
633
633
|
this.removeInlineTableWidth();
|
|
634
634
|
}
|
|
635
635
|
if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
|
|
@@ -284,6 +284,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
284
284
|
var _node$attrs$localId2, _node$attrs2;
|
|
285
285
|
isResizing.current = false;
|
|
286
286
|
var newWidth = originalState.width + delta.width;
|
|
287
|
+
var originalNewWidth = newWidth;
|
|
287
288
|
var state = editorView.state,
|
|
288
289
|
dispatch = editorView.dispatch;
|
|
289
290
|
var pos = getPos();
|
|
@@ -319,7 +320,10 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
319
320
|
node: newNode,
|
|
320
321
|
prevNode: node,
|
|
321
322
|
start: pos + 1,
|
|
322
|
-
|
|
323
|
+
// We use originalNewWidth in comment editor, because in comment editor
|
|
324
|
+
// newWidth can be underined when table is resized to 'full-width'
|
|
325
|
+
// scaleTable function needs number value to work correctly.
|
|
326
|
+
parentWidth: isCommentEditor ? originalNewWidth : newWidth
|
|
323
327
|
}, editorView.domAtPos.bind(editorView), pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent || false, isCommentEditor)(tr);
|
|
324
328
|
var scaledNode = tr.doc.nodeAt(pos);
|
|
325
329
|
(_attachAnalyticsEvent2 = attachAnalyticsEvent(generateResizedPayload({
|
|
@@ -2,7 +2,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
5
|
-
import {
|
|
5
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
6
|
import { TableCssClassName as ClassName } from '../types';
|
|
7
7
|
export var TableStickyScrollbar = /*#__PURE__*/function () {
|
|
8
8
|
function TableStickyScrollbar(wrapper, view) {
|
|
@@ -17,7 +17,7 @@ export var TableStickyScrollbar = /*#__PURE__*/function () {
|
|
|
17
17
|
});
|
|
18
18
|
this.wrapper = wrapper;
|
|
19
19
|
this.view = view;
|
|
20
|
-
if (
|
|
20
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', true)) {
|
|
21
21
|
requestAnimationFrame(function () {
|
|
22
22
|
_this.init();
|
|
23
23
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
|
-
import {
|
|
2
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
3
|
// TODO: Clean up ED-23976
|
|
4
4
|
import { createTableView } from './table';
|
|
5
5
|
import TableCell from './TableCell';
|
|
6
6
|
import TableRow from './TableRow';
|
|
7
7
|
export var lazyTableView = function lazyTableView(options) {
|
|
8
|
-
if (
|
|
8
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
9
9
|
return function (node, view, getPos) {
|
|
10
10
|
return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isTableAlignmentEnabled, options.isCommentEditor, options.isChromelessEditor);
|
|
11
11
|
};
|
|
@@ -39,7 +39,7 @@ export var lazyTableView = function lazyTableView(options) {
|
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
41
|
export var lazyTableCellView = function lazyTableCellView(options) {
|
|
42
|
-
if (
|
|
42
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
43
43
|
return function (node, view, getPos) {
|
|
44
44
|
var _options$pluginInject;
|
|
45
45
|
return new TableCell(node, view, getPos, options.eventDispatcher, (_options$pluginInject = options.pluginInjectionApi) === null || _options$pluginInject === void 0 || (_options$pluginInject = _options$pluginInject.analytics) === null || _options$pluginInject === void 0 ? void 0 : _options$pluginInject.actions);
|
|
@@ -68,7 +68,7 @@ export var lazyTableCellView = function lazyTableCellView(options) {
|
|
|
68
68
|
});
|
|
69
69
|
};
|
|
70
70
|
export var lazyTableHeaderView = function lazyTableHeaderView(options) {
|
|
71
|
-
if (
|
|
71
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
72
72
|
return function (node, view, getPos) {
|
|
73
73
|
var _options$pluginInject2;
|
|
74
74
|
return new TableCell(node, view, getPos, options.eventDispatcher, (_options$pluginInject2 = options.pluginInjectionApi) === null || _options$pluginInject2 === void 0 || (_options$pluginInject2 = _options$pluginInject2.analytics) === null || _options$pluginInject2 === void 0 ? void 0 : _options$pluginInject2.actions);
|
|
@@ -97,7 +97,7 @@ export var lazyTableHeaderView = function lazyTableHeaderView(options) {
|
|
|
97
97
|
});
|
|
98
98
|
};
|
|
99
99
|
export var lazyTableRowView = function lazyTableRowView(options) {
|
|
100
|
-
if (
|
|
100
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
101
101
|
return function (node, view, getPos) {
|
|
102
102
|
return new TableRow(node, view, getPos, options.eventDispatcher);
|
|
103
103
|
};
|
|
@@ -300,7 +300,6 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
300
300
|
} else {
|
|
301
301
|
var _table$attrs2;
|
|
302
302
|
var scalePercent = isTableScalingEnabled && isCommentEditor && !((_table$attrs2 = table.attrs) !== null && _table$attrs2 !== void 0 && _table$attrs2.width) ? getScalingPercentForTableWithoutWidth(table, dom) : getTableScalingPercent(originalTable, dom, shouldUseIncreasedScalingPercent);
|
|
303
|
-
// This function is called for Full-page/Fixed-page tables and table that have width attr value in Comment editor
|
|
304
303
|
resizeColumn(resizeState, colIndex, resizedDelta, dom, table, undefined, shouldScale, scalePercent);
|
|
305
304
|
}
|
|
306
305
|
updateControls()(state);
|
package/dist/esm/toDOM.js
CHANGED
|
@@ -6,11 +6,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
6
|
import kebabCase from 'lodash/kebabCase';
|
|
7
7
|
import { table } from '@atlaskit/adf-schema';
|
|
8
8
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
9
|
-
import {
|
|
9
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
10
|
import { getAlignmentStyle } from './nodeviews/table-container-styles';
|
|
11
11
|
import { generateColgroup } from './pm-plugins/table-resizing/utils/colgroup';
|
|
12
12
|
export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(config) {
|
|
13
|
-
if (
|
|
13
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
14
14
|
return table;
|
|
15
15
|
}
|
|
16
16
|
return _objectSpread(_objectSpread({}, table), {}, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.25.
|
|
3
|
+
"version": "7.25.24",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
52
52
|
"@atlaskit/primitives": "^12.1.0",
|
|
53
53
|
"@atlaskit/theme": "^13.0.0",
|
|
54
|
+
"@atlaskit/tmp-editor-statsig": "^2.1.8",
|
|
54
55
|
"@atlaskit/toggle": "^13.4.0",
|
|
55
56
|
"@atlaskit/tokens": "^1.59.0",
|
|
56
57
|
"@atlaskit/tooltip": "^18.7.0",
|
|
@@ -102,9 +103,6 @@
|
|
|
102
103
|
}
|
|
103
104
|
},
|
|
104
105
|
"platform-feature-flags": {
|
|
105
|
-
"platform_editor_lazy-node-views": {
|
|
106
|
-
"type": "boolean"
|
|
107
|
-
},
|
|
108
106
|
"platform.editor.table.use-shared-state-hook": {
|
|
109
107
|
"type": "boolean"
|
|
110
108
|
},
|
|
@@ -575,7 +575,11 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
575
575
|
clearHoverSelection()(view.state, view.dispatch);
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
-
if (
|
|
578
|
+
if (
|
|
579
|
+
this.props.options?.isCommentEditor &&
|
|
580
|
+
options?.isTableResizingEnabled &&
|
|
581
|
+
!options?.isTableScalingEnabled
|
|
582
|
+
) {
|
|
579
583
|
this.removeInlineTableWidth();
|
|
580
584
|
}
|
|
581
585
|
|
|
@@ -540,6 +540,7 @@ export const TableResizer = ({
|
|
|
540
540
|
(originalState, delta) => {
|
|
541
541
|
isResizing.current = false;
|
|
542
542
|
let newWidth: number | undefined = originalState.width + delta.width;
|
|
543
|
+
const originalNewWidth = newWidth;
|
|
543
544
|
const { state, dispatch } = editorView;
|
|
544
545
|
const pos = getPos();
|
|
545
546
|
const currentTableNodeLocalId = node?.attrs?.localId ?? '';
|
|
@@ -585,7 +586,10 @@ export const TableResizer = ({
|
|
|
585
586
|
node: newNode,
|
|
586
587
|
prevNode: node,
|
|
587
588
|
start: pos + 1,
|
|
588
|
-
|
|
589
|
+
// We use originalNewWidth in comment editor, because in comment editor
|
|
590
|
+
// newWidth can be underined when table is resized to 'full-width'
|
|
591
|
+
// scaleTable function needs number value to work correctly.
|
|
592
|
+
parentWidth: isCommentEditor ? originalNewWidth : newWidth,
|
|
589
593
|
},
|
|
590
594
|
editorView.domAtPos.bind(editorView),
|
|
591
595
|
pluginInjectionApi,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import {
|
|
3
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
4
|
|
|
5
5
|
import { TableCssClassName as ClassName } from '../types';
|
|
6
6
|
|
|
@@ -25,7 +25,7 @@ export class TableStickyScrollbar {
|
|
|
25
25
|
this.wrapper = wrapper;
|
|
26
26
|
this.view = view;
|
|
27
27
|
|
|
28
|
-
if (
|
|
28
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', true)) {
|
|
29
29
|
requestAnimationFrame(() => {
|
|
30
30
|
this.init();
|
|
31
31
|
});
|
|
@@ -5,7 +5,7 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
|
5
5
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
6
6
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
7
|
import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
-
import {
|
|
8
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
9
|
|
|
10
10
|
import type { PluginInjectionAPI } from '../types';
|
|
11
11
|
|
|
@@ -27,7 +27,7 @@ type TableViewOptions = {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const lazyTableView = (options: TableViewOptions) => {
|
|
30
|
-
if (
|
|
30
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
31
31
|
return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
|
|
32
32
|
return createTableView(
|
|
33
33
|
node,
|
|
@@ -101,7 +101,7 @@ type TableCellViewOptions = {
|
|
|
101
101
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
102
102
|
};
|
|
103
103
|
export const lazyTableCellView = (options: TableCellViewOptions) => {
|
|
104
|
-
if (
|
|
104
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
105
105
|
return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
|
|
106
106
|
return new TableCell(
|
|
107
107
|
node,
|
|
@@ -148,7 +148,7 @@ export const lazyTableCellView = (options: TableCellViewOptions) => {
|
|
|
148
148
|
};
|
|
149
149
|
|
|
150
150
|
export const lazyTableHeaderView = (options: TableCellViewOptions) => {
|
|
151
|
-
if (
|
|
151
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
152
152
|
return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
|
|
153
153
|
return new TableCell(
|
|
154
154
|
node,
|
|
@@ -195,7 +195,7 @@ export const lazyTableHeaderView = (options: TableCellViewOptions) => {
|
|
|
195
195
|
};
|
|
196
196
|
|
|
197
197
|
export const lazyTableRowView = (options: TableCellViewOptions) => {
|
|
198
|
-
if (
|
|
198
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
199
199
|
return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
|
|
200
200
|
return new TableRow(node, view, getPos, options.eventDispatcher);
|
|
201
201
|
};
|
|
@@ -397,7 +397,7 @@ export const handleMouseDown = (
|
|
|
397
397
|
isTableScalingEnabled && isCommentEditor && !table.attrs?.width
|
|
398
398
|
? getScalingPercentForTableWithoutWidth(table, dom)
|
|
399
399
|
: getTableScalingPercent(originalTable, dom, shouldUseIncreasedScalingPercent);
|
|
400
|
-
|
|
400
|
+
|
|
401
401
|
resizeColumn(
|
|
402
402
|
resizeState,
|
|
403
403
|
colIndex,
|
package/src/toDOM.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { table } from '@atlaskit/adf-schema';
|
|
|
4
4
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/src/types';
|
|
5
5
|
import type { DOMOutputSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
7
|
-
import {
|
|
7
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
8
|
|
|
9
9
|
import { getAlignmentStyle } from './nodeviews/table-container-styles';
|
|
10
10
|
import { generateColgroup } from './pm-plugins/table-resizing/utils/colgroup';
|
|
@@ -15,7 +15,7 @@ type Config = {
|
|
|
15
15
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
16
16
|
};
|
|
17
17
|
export const tableNodeSpecWithFixedToDOM = (config: Config): typeof table => {
|
|
18
|
-
if (
|
|
18
|
+
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
19
19
|
return table;
|
|
20
20
|
}
|
|
21
21
|
|