@atlaskit/editor-plugin-table 10.4.1 → 10.4.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 +34 -0
- package/dist/cjs/nodeviews/toDOM.js +3 -7
- package/dist/cjs/pm-plugins/main.js +24 -23
- package/dist/es2019/nodeviews/toDOM.js +3 -7
- package/dist/es2019/pm-plugins/main.js +25 -24
- package/dist/esm/nodeviews/toDOM.js +3 -7
- package/dist/esm/pm-plugins/main.js +25 -24
- package/package.json +9 -9
- package/src/nodeviews/toDOM.ts +4 -10
- package/src/pm-plugins/main.ts +21 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 10.4.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#126154](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/126154)
|
|
8
|
+
[`be67d47906a7f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/be67d47906a7f) -
|
|
9
|
+
[ED-27099]
|
|
10
|
+
|
|
11
|
+
# Improvements
|
|
12
|
+
|
|
13
|
+
Feature Flag: `platform_editor_table_layout_shift_fix`
|
|
14
|
+
|
|
15
|
+
- Make all Editor block nodes a proper inline container
|
|
16
|
+
|
|
17
|
+
Feature Flag: `platform_editor_render_table_fallback_to_dom_on_ssr`
|
|
18
|
+
|
|
19
|
+
- Always render the Table.toDOM when on SSR
|
|
20
|
+
|
|
21
|
+
# Clean up
|
|
22
|
+
|
|
23
|
+
`platform_editor_exp_lazy_node_views`
|
|
24
|
+
|
|
25
|
+
- Make the `tableNodeSpecWithFixedToDOM` the default `Table.toDOM`
|
|
26
|
+
|
|
27
|
+
`platform_editor_table_layout_shift_fix`
|
|
28
|
+
|
|
29
|
+
- Fix the typo `px` typo
|
|
30
|
+
|
|
31
|
+
## 10.4.2
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
|
|
3
37
|
## 10.4.1
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -12,8 +12,6 @@ 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
14
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
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 _tableContainerStyles = require("./table-container-styles");
|
|
@@ -21,9 +19,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
21
19
|
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; }
|
|
22
20
|
var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(config) {
|
|
23
21
|
var tableNode = config.isNestingSupported ? _adfSchema.tableWithNestedTable : _adfSchema.table;
|
|
24
|
-
if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false)) {
|
|
25
|
-
return tableNode;
|
|
26
|
-
}
|
|
27
22
|
return _objectSpread(_objectSpread({}, tableNode), {}, {
|
|
28
23
|
toDOM: function toDOM(node) {
|
|
29
24
|
var gutterPadding = (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2;
|
|
@@ -76,12 +71,13 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
76
71
|
class: 'tableView-content-wrap'
|
|
77
72
|
}, tableContainerDiv];
|
|
78
73
|
}
|
|
74
|
+
var tableWidthAttribute = node.attrs.width ? "".concat(node.attrs.width, "px") : "100%";
|
|
79
75
|
var tableResizingDiv = ['div', {
|
|
80
76
|
'data-testid': 'table-alignment-container',
|
|
81
77
|
style: alignmentStyle
|
|
82
78
|
}, ['div', {
|
|
83
79
|
class: 'pm-table-resizer-container',
|
|
84
|
-
style: "width: min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(
|
|
80
|
+
style: "width: min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(tableWidthAttribute, ");")
|
|
85
81
|
}, ['div', {
|
|
86
82
|
class: 'resizer-item display-handle',
|
|
87
83
|
style: (0, _lazyNodeView.convertToInlineCss)({
|
|
@@ -93,7 +89,7 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
93
89
|
'--ak-editor-table-min-width': "".concat(tableMinWidth, "px"),
|
|
94
90
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
95
91
|
maxWidth: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))",
|
|
96
|
-
width:
|
|
92
|
+
width: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(tableWidthAttribute, ")")
|
|
97
93
|
})
|
|
98
94
|
}, ['span', {
|
|
99
95
|
class: 'resizer-hover-zone'
|
|
@@ -59,6 +59,29 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
59
59
|
}
|
|
60
60
|
return editorView.state;
|
|
61
61
|
};
|
|
62
|
+
var nodeViews = (0, _coreUtils.isSSR)() && (0, _platformFeatureFlags.fg)('platform_editor_table_fallback_to_dom_on_ssr') ? undefined : {
|
|
63
|
+
table: (0, _lazyNodeViews.lazyTableView)({
|
|
64
|
+
portalProviderAPI: portalProviderAPI,
|
|
65
|
+
eventDispatcher: eventDispatcher,
|
|
66
|
+
getEditorContainerWidth: getEditorContainerWidth,
|
|
67
|
+
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
68
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
69
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
70
|
+
isCommentEditor: isCommentEditor,
|
|
71
|
+
isChromelessEditor: isChromelessEditor
|
|
72
|
+
}),
|
|
73
|
+
tableRow: (0, _lazyNodeViews.lazyTableRowView)({
|
|
74
|
+
eventDispatcher: eventDispatcher
|
|
75
|
+
}),
|
|
76
|
+
tableCell: (0, _lazyNodeViews.lazyTableCellView)({
|
|
77
|
+
eventDispatcher: eventDispatcher,
|
|
78
|
+
pluginInjectionApi: pluginInjectionApi
|
|
79
|
+
}),
|
|
80
|
+
tableHeader: (0, _lazyNodeViews.lazyTableHeaderView)({
|
|
81
|
+
eventDispatcher: eventDispatcher,
|
|
82
|
+
pluginInjectionApi: pluginInjectionApi
|
|
83
|
+
})
|
|
84
|
+
};
|
|
62
85
|
return new _safePlugin.SafePlugin({
|
|
63
86
|
state: state,
|
|
64
87
|
key: _pluginKey.pluginKey,
|
|
@@ -275,29 +298,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
275
298
|
}
|
|
276
299
|
return false;
|
|
277
300
|
},
|
|
278
|
-
nodeViews:
|
|
279
|
-
table: (0, _lazyNodeViews.lazyTableView)({
|
|
280
|
-
portalProviderAPI: portalProviderAPI,
|
|
281
|
-
eventDispatcher: eventDispatcher,
|
|
282
|
-
getEditorContainerWidth: getEditorContainerWidth,
|
|
283
|
-
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
284
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
285
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
286
|
-
isCommentEditor: isCommentEditor,
|
|
287
|
-
isChromelessEditor: isChromelessEditor
|
|
288
|
-
}),
|
|
289
|
-
tableRow: (0, _lazyNodeViews.lazyTableRowView)({
|
|
290
|
-
eventDispatcher: eventDispatcher
|
|
291
|
-
}),
|
|
292
|
-
tableCell: (0, _lazyNodeViews.lazyTableCellView)({
|
|
293
|
-
eventDispatcher: eventDispatcher,
|
|
294
|
-
pluginInjectionApi: pluginInjectionApi
|
|
295
|
-
}),
|
|
296
|
-
tableHeader: (0, _lazyNodeViews.lazyTableHeaderView)({
|
|
297
|
-
eventDispatcher: eventDispatcher,
|
|
298
|
-
pluginInjectionApi: pluginInjectionApi
|
|
299
|
-
})
|
|
300
|
-
},
|
|
301
|
+
nodeViews: nodeViews,
|
|
301
302
|
handleDOMEvents: {
|
|
302
303
|
focus: _eventHandlers.handleFocus,
|
|
303
304
|
blur: _eventHandlers.handleBlur,
|
|
@@ -2,16 +2,11 @@ import kebabCase from 'lodash/kebabCase';
|
|
|
2
2
|
import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
|
|
3
3
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
4
4
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
5
|
import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
8
6
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
9
7
|
import { getAlignmentStyle } from './table-container-styles';
|
|
10
8
|
export const tableNodeSpecWithFixedToDOM = config => {
|
|
11
9
|
const tableNode = config.isNestingSupported ? tableWithNestedTable : table;
|
|
12
|
-
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
13
|
-
return tableNode;
|
|
14
|
-
}
|
|
15
10
|
return {
|
|
16
11
|
...tableNode,
|
|
17
12
|
toDOM: node => {
|
|
@@ -60,12 +55,13 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
60
55
|
class: 'tableView-content-wrap'
|
|
61
56
|
}, tableContainerDiv];
|
|
62
57
|
}
|
|
58
|
+
const tableWidthAttribute = node.attrs.width ? `${node.attrs.width}px` : `100%`;
|
|
63
59
|
const tableResizingDiv = ['div', {
|
|
64
60
|
'data-testid': 'table-alignment-container',
|
|
65
61
|
style: alignmentStyle
|
|
66
62
|
}, ['div', {
|
|
67
63
|
class: 'pm-table-resizer-container',
|
|
68
|
-
style: `width: min(calc(100cqw - ${gutterPadding}px), ${
|
|
64
|
+
style: `width: min(calc(100cqw - ${gutterPadding}px), ${tableWidthAttribute});`
|
|
69
65
|
}, ['div', {
|
|
70
66
|
class: 'resizer-item display-handle',
|
|
71
67
|
style: convertToInlineCss({
|
|
@@ -77,7 +73,7 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
77
73
|
'--ak-editor-table-min-width': `${tableMinWidth}px`,
|
|
78
74
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
79
75
|
maxWidth: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))`,
|
|
80
|
-
width:
|
|
76
|
+
width: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${tableWidthAttribute})`
|
|
81
77
|
})
|
|
82
78
|
}, ['span', {
|
|
83
79
|
class: 'resizer-hover-zone'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
2
|
+
import { insideTable, isSSR } from '@atlaskit/editor-common/core-utils';
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveOpenNestedExpand } from '@atlaskit/editor-common/transforms';
|
|
5
5
|
import { browser, closestElement } from '@atlaskit/editor-common/utils';
|
|
@@ -50,6 +50,29 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
50
50
|
}
|
|
51
51
|
return editorView.state;
|
|
52
52
|
};
|
|
53
|
+
const nodeViews = isSSR() && fg('platform_editor_table_fallback_to_dom_on_ssr') ? undefined : {
|
|
54
|
+
table: lazyTableView({
|
|
55
|
+
portalProviderAPI,
|
|
56
|
+
eventDispatcher,
|
|
57
|
+
getEditorContainerWidth,
|
|
58
|
+
getEditorFeatureFlags,
|
|
59
|
+
dispatchAnalyticsEvent,
|
|
60
|
+
pluginInjectionApi,
|
|
61
|
+
isCommentEditor,
|
|
62
|
+
isChromelessEditor
|
|
63
|
+
}),
|
|
64
|
+
tableRow: lazyTableRowView({
|
|
65
|
+
eventDispatcher
|
|
66
|
+
}),
|
|
67
|
+
tableCell: lazyTableCellView({
|
|
68
|
+
eventDispatcher,
|
|
69
|
+
pluginInjectionApi
|
|
70
|
+
}),
|
|
71
|
+
tableHeader: lazyTableHeaderView({
|
|
72
|
+
eventDispatcher,
|
|
73
|
+
pluginInjectionApi
|
|
74
|
+
})
|
|
75
|
+
};
|
|
53
76
|
return new SafePlugin({
|
|
54
77
|
state: state,
|
|
55
78
|
key: pluginKey,
|
|
@@ -273,29 +296,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
273
296
|
}
|
|
274
297
|
return false;
|
|
275
298
|
},
|
|
276
|
-
nodeViews
|
|
277
|
-
table: lazyTableView({
|
|
278
|
-
portalProviderAPI,
|
|
279
|
-
eventDispatcher,
|
|
280
|
-
getEditorContainerWidth,
|
|
281
|
-
getEditorFeatureFlags,
|
|
282
|
-
dispatchAnalyticsEvent,
|
|
283
|
-
pluginInjectionApi,
|
|
284
|
-
isCommentEditor,
|
|
285
|
-
isChromelessEditor
|
|
286
|
-
}),
|
|
287
|
-
tableRow: lazyTableRowView({
|
|
288
|
-
eventDispatcher
|
|
289
|
-
}),
|
|
290
|
-
tableCell: lazyTableCellView({
|
|
291
|
-
eventDispatcher,
|
|
292
|
-
pluginInjectionApi
|
|
293
|
-
}),
|
|
294
|
-
tableHeader: lazyTableHeaderView({
|
|
295
|
-
eventDispatcher,
|
|
296
|
-
pluginInjectionApi
|
|
297
|
-
})
|
|
298
|
-
},
|
|
299
|
+
nodeViews,
|
|
299
300
|
handleDOMEvents: {
|
|
300
301
|
focus: handleFocus,
|
|
301
302
|
blur: handleBlur,
|
|
@@ -7,16 +7,11 @@ 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
9
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
10
|
import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
13
11
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
14
12
|
import { getAlignmentStyle } from './table-container-styles';
|
|
15
13
|
export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(config) {
|
|
16
14
|
var tableNode = config.isNestingSupported ? tableWithNestedTable : table;
|
|
17
|
-
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
18
|
-
return tableNode;
|
|
19
|
-
}
|
|
20
15
|
return _objectSpread(_objectSpread({}, tableNode), {}, {
|
|
21
16
|
toDOM: function toDOM(node) {
|
|
22
17
|
var gutterPadding = akEditorGutterPaddingDynamic() * 2;
|
|
@@ -69,12 +64,13 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
69
64
|
class: 'tableView-content-wrap'
|
|
70
65
|
}, tableContainerDiv];
|
|
71
66
|
}
|
|
67
|
+
var tableWidthAttribute = node.attrs.width ? "".concat(node.attrs.width, "px") : "100%";
|
|
72
68
|
var tableResizingDiv = ['div', {
|
|
73
69
|
'data-testid': 'table-alignment-container',
|
|
74
70
|
style: alignmentStyle
|
|
75
71
|
}, ['div', {
|
|
76
72
|
class: 'pm-table-resizer-container',
|
|
77
|
-
style: "width: min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(
|
|
73
|
+
style: "width: min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(tableWidthAttribute, ");")
|
|
78
74
|
}, ['div', {
|
|
79
75
|
class: 'resizer-item display-handle',
|
|
80
76
|
style: convertToInlineCss({
|
|
@@ -86,7 +82,7 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
86
82
|
'--ak-editor-table-min-width': "".concat(tableMinWidth, "px"),
|
|
87
83
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
88
84
|
maxWidth: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))",
|
|
89
|
-
width:
|
|
85
|
+
width: "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(tableWidthAttribute, ")")
|
|
90
86
|
})
|
|
91
87
|
}, ['span', {
|
|
92
88
|
class: 'resizer-hover-zone'
|
|
@@ -2,7 +2,7 @@ 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 { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
5
|
+
import { insideTable, isSSR } from '@atlaskit/editor-common/core-utils';
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
7
|
import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveOpenNestedExpand } from '@atlaskit/editor-common/transforms';
|
|
8
8
|
import { browser, closestElement } from '@atlaskit/editor-common/utils';
|
|
@@ -52,6 +52,29 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
52
52
|
}
|
|
53
53
|
return editorView.state;
|
|
54
54
|
};
|
|
55
|
+
var nodeViews = isSSR() && fg('platform_editor_table_fallback_to_dom_on_ssr') ? undefined : {
|
|
56
|
+
table: lazyTableView({
|
|
57
|
+
portalProviderAPI: portalProviderAPI,
|
|
58
|
+
eventDispatcher: eventDispatcher,
|
|
59
|
+
getEditorContainerWidth: getEditorContainerWidth,
|
|
60
|
+
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
61
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
62
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
63
|
+
isCommentEditor: isCommentEditor,
|
|
64
|
+
isChromelessEditor: isChromelessEditor
|
|
65
|
+
}),
|
|
66
|
+
tableRow: lazyTableRowView({
|
|
67
|
+
eventDispatcher: eventDispatcher
|
|
68
|
+
}),
|
|
69
|
+
tableCell: lazyTableCellView({
|
|
70
|
+
eventDispatcher: eventDispatcher,
|
|
71
|
+
pluginInjectionApi: pluginInjectionApi
|
|
72
|
+
}),
|
|
73
|
+
tableHeader: lazyTableHeaderView({
|
|
74
|
+
eventDispatcher: eventDispatcher,
|
|
75
|
+
pluginInjectionApi: pluginInjectionApi
|
|
76
|
+
})
|
|
77
|
+
};
|
|
55
78
|
return new SafePlugin({
|
|
56
79
|
state: state,
|
|
57
80
|
key: pluginKey,
|
|
@@ -268,29 +291,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
268
291
|
}
|
|
269
292
|
return false;
|
|
270
293
|
},
|
|
271
|
-
nodeViews:
|
|
272
|
-
table: lazyTableView({
|
|
273
|
-
portalProviderAPI: portalProviderAPI,
|
|
274
|
-
eventDispatcher: eventDispatcher,
|
|
275
|
-
getEditorContainerWidth: getEditorContainerWidth,
|
|
276
|
-
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
277
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
278
|
-
pluginInjectionApi: pluginInjectionApi,
|
|
279
|
-
isCommentEditor: isCommentEditor,
|
|
280
|
-
isChromelessEditor: isChromelessEditor
|
|
281
|
-
}),
|
|
282
|
-
tableRow: lazyTableRowView({
|
|
283
|
-
eventDispatcher: eventDispatcher
|
|
284
|
-
}),
|
|
285
|
-
tableCell: lazyTableCellView({
|
|
286
|
-
eventDispatcher: eventDispatcher,
|
|
287
|
-
pluginInjectionApi: pluginInjectionApi
|
|
288
|
-
}),
|
|
289
|
-
tableHeader: lazyTableHeaderView({
|
|
290
|
-
eventDispatcher: eventDispatcher,
|
|
291
|
-
pluginInjectionApi: pluginInjectionApi
|
|
292
|
-
})
|
|
293
|
-
},
|
|
294
|
+
nodeViews: nodeViews,
|
|
294
295
|
handleDOMEvents: {
|
|
295
296
|
focus: handleFocus,
|
|
296
297
|
blur: handleBlur,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.3",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
33
33
|
"@atlaskit/button": "^21.1.0",
|
|
34
34
|
"@atlaskit/custom-steps": "^0.11.0",
|
|
35
|
-
"@atlaskit/editor-common": "^102.
|
|
36
|
-
"@atlaskit/editor-palette": "^2.
|
|
35
|
+
"@atlaskit/editor-common": "^102.9.0",
|
|
36
|
+
"@atlaskit/editor-palette": "^2.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
38
|
-
"@atlaskit/editor-plugin-analytics": "^2.
|
|
38
|
+
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-batch-attribute-updates": "^2.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-content-insertion": "^2.1.0",
|
|
41
41
|
"@atlaskit/editor-plugin-editor-viewmode": "^3.0.0",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
54
54
|
"@atlaskit/primitives": "^14.1.0",
|
|
55
55
|
"@atlaskit/theme": "^18.0.0",
|
|
56
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
56
|
+
"@atlaskit/tmp-editor-statsig": "^4.1.0",
|
|
57
57
|
"@atlaskit/toggle": "^15.0.0",
|
|
58
|
-
"@atlaskit/tokens": "^4.
|
|
58
|
+
"@atlaskit/tokens": "^4.5.0",
|
|
59
59
|
"@atlaskit/tooltip": "^20.0.0",
|
|
60
60
|
"@babel/runtime": "^7.0.0",
|
|
61
61
|
"@emotion/react": "^11.7.1",
|
|
@@ -109,6 +109,9 @@
|
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
111
|
"platform-feature-flags": {
|
|
112
|
+
"platform_editor_table_fallback_to_dom_on_ssr": {
|
|
113
|
+
"type": "boolean"
|
|
114
|
+
},
|
|
112
115
|
"platform_editor_batch_steps_table": {
|
|
113
116
|
"type": "boolean"
|
|
114
117
|
},
|
|
@@ -149,9 +152,6 @@
|
|
|
149
152
|
"platform_editor_nested_tables_paste_wrap_fix": {
|
|
150
153
|
"type": "boolean"
|
|
151
154
|
},
|
|
152
|
-
"platform_editor_table_layout_shift_fix": {
|
|
153
|
-
"type": "boolean"
|
|
154
|
-
},
|
|
155
155
|
"platform_editor_advanced_layouts_post_fix_patch_4": {
|
|
156
156
|
"type": "boolean"
|
|
157
157
|
},
|
package/src/nodeviews/toDOM.ts
CHANGED
|
@@ -5,8 +5,6 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
|
5
5
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
6
6
|
import type { DOMOutputSpec, NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
7
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
8
|
|
|
11
9
|
import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
12
10
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
@@ -22,10 +20,6 @@ type Config = {
|
|
|
22
20
|
export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
|
|
23
21
|
const tableNode = config.isNestingSupported ? tableWithNestedTable : table;
|
|
24
22
|
|
|
25
|
-
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
26
|
-
return tableNode;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
23
|
return {
|
|
30
24
|
...tableNode,
|
|
31
25
|
toDOM: (node: PMNode): DOMOutputSpec => {
|
|
@@ -120,6 +114,8 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
|
|
|
120
114
|
];
|
|
121
115
|
}
|
|
122
116
|
|
|
117
|
+
const tableWidthAttribute = node.attrs.width ? `${node.attrs.width}px` : `100%`;
|
|
118
|
+
|
|
123
119
|
const tableResizingDiv = [
|
|
124
120
|
'div',
|
|
125
121
|
{
|
|
@@ -130,7 +126,7 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
|
|
|
130
126
|
'div',
|
|
131
127
|
{
|
|
132
128
|
class: 'pm-table-resizer-container',
|
|
133
|
-
style: `width: min(calc(100cqw - ${gutterPadding}px), ${
|
|
129
|
+
style: `width: min(calc(100cqw - ${gutterPadding}px), ${tableWidthAttribute});`,
|
|
134
130
|
},
|
|
135
131
|
[
|
|
136
132
|
'div',
|
|
@@ -145,9 +141,7 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): NodeSpec => {
|
|
|
145
141
|
'--ak-editor-table-min-width': `${tableMinWidth}px`,
|
|
146
142
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
147
143
|
maxWidth: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))`,
|
|
148
|
-
width:
|
|
149
|
-
? `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${node.attrs.width}px)`
|
|
150
|
-
: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${node.attrs.width})`,
|
|
144
|
+
width: `min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ${tableWidthAttribute})`,
|
|
151
145
|
}),
|
|
152
146
|
},
|
|
153
147
|
[
|
package/src/pm-plugins/main.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
INPUT_METHOD,
|
|
8
8
|
} from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
10
|
-
import { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
10
|
+
import { insideTable, isSSR } from '@atlaskit/editor-common/core-utils';
|
|
11
11
|
import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
12
12
|
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
13
13
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
@@ -130,6 +130,25 @@ export const createPlugin = (
|
|
|
130
130
|
|
|
131
131
|
return editorView.state;
|
|
132
132
|
};
|
|
133
|
+
|
|
134
|
+
const nodeViews =
|
|
135
|
+
isSSR() && fg('platform_editor_table_fallback_to_dom_on_ssr')
|
|
136
|
+
? undefined
|
|
137
|
+
: {
|
|
138
|
+
table: lazyTableView({
|
|
139
|
+
portalProviderAPI,
|
|
140
|
+
eventDispatcher,
|
|
141
|
+
getEditorContainerWidth,
|
|
142
|
+
getEditorFeatureFlags,
|
|
143
|
+
dispatchAnalyticsEvent,
|
|
144
|
+
pluginInjectionApi,
|
|
145
|
+
isCommentEditor,
|
|
146
|
+
isChromelessEditor,
|
|
147
|
+
}),
|
|
148
|
+
tableRow: lazyTableRowView({ eventDispatcher }),
|
|
149
|
+
tableCell: lazyTableCellView({ eventDispatcher, pluginInjectionApi }),
|
|
150
|
+
tableHeader: lazyTableHeaderView({ eventDispatcher, pluginInjectionApi }),
|
|
151
|
+
};
|
|
133
152
|
return new SafePlugin({
|
|
134
153
|
state: state,
|
|
135
154
|
key: pluginKey,
|
|
@@ -380,21 +399,7 @@ export const createPlugin = (
|
|
|
380
399
|
}
|
|
381
400
|
return false;
|
|
382
401
|
},
|
|
383
|
-
nodeViews
|
|
384
|
-
table: lazyTableView({
|
|
385
|
-
portalProviderAPI,
|
|
386
|
-
eventDispatcher,
|
|
387
|
-
getEditorContainerWidth,
|
|
388
|
-
getEditorFeatureFlags,
|
|
389
|
-
dispatchAnalyticsEvent,
|
|
390
|
-
pluginInjectionApi,
|
|
391
|
-
isCommentEditor,
|
|
392
|
-
isChromelessEditor,
|
|
393
|
-
}),
|
|
394
|
-
tableRow: lazyTableRowView({ eventDispatcher }),
|
|
395
|
-
tableCell: lazyTableCellView({ eventDispatcher, pluginInjectionApi }),
|
|
396
|
-
tableHeader: lazyTableHeaderView({ eventDispatcher, pluginInjectionApi }),
|
|
397
|
-
},
|
|
402
|
+
nodeViews,
|
|
398
403
|
handleDOMEvents: {
|
|
399
404
|
focus: handleFocus,
|
|
400
405
|
blur: handleBlur,
|