@atlaskit/editor-plugin-table 23.1.1 → 23.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/nodeviews/TableRow.js +31 -9
- package/dist/cjs/nodeviews/TableRowNativeStickyWithFallback.js +46 -11
- package/dist/cjs/nodeviews/table.js +17 -0
- package/dist/cjs/pm-plugins/main.js +3 -4
- package/dist/cjs/ui/common-styles.js +2 -1
- package/dist/es2019/nodeviews/TableRow.js +31 -9
- package/dist/es2019/nodeviews/TableRowNativeStickyWithFallback.js +46 -11
- package/dist/es2019/nodeviews/table.js +17 -0
- package/dist/es2019/pm-plugins/main.js +11 -14
- package/dist/es2019/ui/common-styles.js +11 -5
- package/dist/esm/nodeviews/TableRow.js +31 -9
- package/dist/esm/nodeviews/TableRowNativeStickyWithFallback.js +46 -11
- package/dist/esm/nodeviews/table.js +17 -0
- package/dist/esm/pm-plugins/main.js +4 -5
- package/dist/esm/ui/common-styles.js +2 -1
- package/package.json +9 -6
|
@@ -106,8 +106,22 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
106
106
|
}
|
|
107
107
|
const pos = this.getPos();
|
|
108
108
|
this.isInNestedTable = false;
|
|
109
|
-
if (
|
|
110
|
-
|
|
109
|
+
if (fg('platform_editor_ai_table_ai_streaming_pos_fix')) {
|
|
110
|
+
try {
|
|
111
|
+
// We cannot trust that the value from getPos will be defined
|
|
112
|
+
// https://discuss.prosemirror.net/t/getpos-is-undefined-in-nodeview-constructor/1246/4
|
|
113
|
+
// There are also scenarios where the value it brings back does not tally with the current doc
|
|
114
|
+
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
115
|
+
if (pos) {
|
|
116
|
+
this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
117
|
+
}
|
|
118
|
+
} catch {
|
|
119
|
+
// Intentionally swallowed — getPos can return stale positions during AI streaming
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
if (pos) {
|
|
123
|
+
this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
124
|
+
}
|
|
111
125
|
}
|
|
112
126
|
if (this.isHeaderRow) {
|
|
113
127
|
this.dom.setAttribute('data-vc-nvs', 'true');
|
|
@@ -663,17 +677,38 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
663
677
|
navigator.userAgent.includes('AppleWebKit') && !navigator.userAgent.includes('Chrome')) {
|
|
664
678
|
const pos = this.getPos();
|
|
665
679
|
if (typeof pos === 'number') {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
680
|
+
if (fg('platform_editor_ai_table_ai_streaming_pos_fix')) {
|
|
681
|
+
try {
|
|
682
|
+
// getPos can return stale positions during AI streaming which cannot be resolved
|
|
683
|
+
const $tableRowPos = this.view.state.doc.resolve(pos);
|
|
684
|
+
|
|
685
|
+
// layout -> layout column -> table -> table row
|
|
686
|
+
if ($tableRowPos.depth >= 3) {
|
|
687
|
+
var _findParentNodeCloses;
|
|
688
|
+
const isInsideLayout = (_findParentNodeCloses = findParentNodeClosestToPos($tableRowPos, node => {
|
|
689
|
+
return node.type.name === 'layoutColumn';
|
|
690
|
+
})) === null || _findParentNodeCloses === void 0 ? void 0 : _findParentNodeCloses.node;
|
|
691
|
+
if (isInsideLayout) {
|
|
692
|
+
return false;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
} catch {
|
|
696
|
+
// getPos can return stale positions during AI streaming — fall back to non-sticky
|
|
675
697
|
return false;
|
|
676
698
|
}
|
|
699
|
+
} else {
|
|
700
|
+
const $tableRowPos = this.view.state.doc.resolve(pos);
|
|
701
|
+
|
|
702
|
+
// layout -> layout column -> table -> table row
|
|
703
|
+
if ($tableRowPos.depth >= 3) {
|
|
704
|
+
var _findParentNodeCloses2;
|
|
705
|
+
const isInsideLayout = (_findParentNodeCloses2 = findParentNodeClosestToPos($tableRowPos, node => {
|
|
706
|
+
return node.type.name === 'layoutColumn';
|
|
707
|
+
})) === null || _findParentNodeCloses2 === void 0 ? void 0 : _findParentNodeCloses2.node;
|
|
708
|
+
if (isInsideLayout) {
|
|
709
|
+
return false;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
677
712
|
}
|
|
678
713
|
}
|
|
679
714
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { isSSR, isSSRStreaming } from '@atlaskit/editor-common/core-utils';
|
|
3
4
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
4
5
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
5
6
|
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
@@ -378,6 +379,22 @@ export const createTableView = (node, view, getPos, portalProviderAPI, eventDisp
|
|
|
378
379
|
} = getPluginConfig(pluginConfig);
|
|
379
380
|
const isTableFixedColumnWidthsOptionEnabled = (fg('platform_editor_table_fixed_column_width_prop') ? allowFixedColumnWidthOption : getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().tableWithFixedColumnWidthsOption) || false;
|
|
380
381
|
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
382
|
+
|
|
383
|
+
// In SSR use native ProseMirror spec-based render for table nodes
|
|
384
|
+
if (isSSR() && isSSRStreaming()) {
|
|
385
|
+
const isNested = isTableNested(view.state, typeof getPos === 'function' ? getPos() : undefined);
|
|
386
|
+
const tableDOMStructure = tableNodeSpecWithFixedToDOM({
|
|
387
|
+
allowColumnResizing: allowColumnResizing !== null && allowColumnResizing !== void 0 ? allowColumnResizing : false,
|
|
388
|
+
tableResizingEnabled: allowTableResizing !== null && allowTableResizing !== void 0 ? allowTableResizing : false,
|
|
389
|
+
getEditorContainerWidth,
|
|
390
|
+
isTableScalingEnabled,
|
|
391
|
+
shouldUseIncreasedScalingPercent,
|
|
392
|
+
isCommentEditor,
|
|
393
|
+
isChromelessEditor,
|
|
394
|
+
isNested
|
|
395
|
+
}).toDOM(node);
|
|
396
|
+
return DOMSerializer.renderSpec(document, tableDOMStructure);
|
|
397
|
+
}
|
|
381
398
|
return new TableView({
|
|
382
399
|
node,
|
|
383
400
|
view,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { bind } from 'bind-event-listener';
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
4
|
-
import { insideTable
|
|
4
|
+
import { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
5
5
|
import { isNestedTablesSupported } from '@atlaskit/editor-common/nesting';
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
7
|
import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveOpenNestedExpand } from '@atlaskit/editor-common/transforms';
|
|
@@ -59,19 +59,16 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
59
59
|
};
|
|
60
60
|
const getNodeView = () => {
|
|
61
61
|
return {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
isChromelessEditor,
|
|
73
|
-
allowFixedColumnWidthOption
|
|
74
|
-
})
|
|
62
|
+
table: tableView({
|
|
63
|
+
portalProviderAPI,
|
|
64
|
+
eventDispatcher,
|
|
65
|
+
getEditorContainerWidth,
|
|
66
|
+
getEditorFeatureFlags,
|
|
67
|
+
dispatchAnalyticsEvent,
|
|
68
|
+
pluginInjectionApi,
|
|
69
|
+
isCommentEditor,
|
|
70
|
+
isChromelessEditor,
|
|
71
|
+
allowFixedColumnWidthOption
|
|
75
72
|
}),
|
|
76
73
|
tableRow: tableRowView({
|
|
77
74
|
eventDispatcher,
|
|
@@ -737,7 +737,8 @@ const baseTableStylesWithoutSharedStyle = props => css`
|
|
|
737
737
|
|
|
738
738
|
position: fixed !important;
|
|
739
739
|
z-index: ${akEditorStickyHeaderZIndex} !important;
|
|
740
|
-
box-shadow: 0px -${stickyRowOffsetTop}px
|
|
740
|
+
box-shadow: 0px -${stickyRowOffsetTop}px
|
|
741
|
+
${expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? `var(${akEditorTableContainerBg}, ${"var(--ds-surface, #FFFFFF)"})` : "var(--ds-surface, #FFFFFF)"};
|
|
741
742
|
border-right: 0 none;
|
|
742
743
|
/* top set by NumberColumn component */
|
|
743
744
|
}
|
|
@@ -770,13 +771,15 @@ const baseTableStylesWithoutSharedStyle = props => css`
|
|
|
770
771
|
position: fixed !important;
|
|
771
772
|
z-index: ${akEditorStickyHeaderZIndex} !important;
|
|
772
773
|
display: flex;
|
|
773
|
-
border-left: ${tableToolbarSize}px solid
|
|
774
|
+
border-left: ${tableToolbarSize}px solid
|
|
775
|
+
${expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? `var(${akEditorTableContainerBg}, ${"var(--ds-surface, #FFFFFF)"})` : "var(--ds-surface, #FFFFFF)"};
|
|
774
776
|
margin-left: -${tableToolbarSize}px;
|
|
775
777
|
}
|
|
776
778
|
|
|
777
779
|
.${ClassName.TABLE_STICKY} col:first-of-type {
|
|
778
780
|
/* moving rows out of a table layout does weird things in Chrome */
|
|
779
|
-
border-right: 1px solid
|
|
781
|
+
border-right: 1px solid
|
|
782
|
+
${expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? `var(${akEditorTableContainerBg}, ${"var(--ds-surface, #FFFFFF)"})` : "var(--ds-surface, #FFFFFF)"};
|
|
780
783
|
}
|
|
781
784
|
|
|
782
785
|
tr.sticky {
|
|
@@ -913,7 +916,8 @@ const baseTableStylesWithoutSharedStyle = props => css`
|
|
|
913
916
|
height: 0;
|
|
914
917
|
margin-bottom: -${tableMarginTop}px;
|
|
915
918
|
position: sticky;
|
|
916
|
-
border-top: ${tableMarginTop}px solid
|
|
919
|
+
border-top: ${tableMarginTop}px solid
|
|
920
|
+
${expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? `var(${akEditorTableContainerBg}, ${"var(--ds-surface, #FFFFFF)"})` : "var(--ds-surface, #FFFFFF)"};
|
|
917
921
|
z-index: ${stickyRowZIndex};
|
|
918
922
|
}
|
|
919
923
|
|
|
@@ -997,7 +1001,8 @@ const baseTableStylesWithoutSharedStyle = props => css`
|
|
|
997
1001
|
}
|
|
998
1002
|
|
|
999
1003
|
.${ClassName.CORNER_CONTROLS}.sticky {
|
|
1000
|
-
border-top: ${tableControlsSpacing - tableToolbarSize}px solid
|
|
1004
|
+
border-top: ${tableControlsSpacing - tableToolbarSize}px solid
|
|
1005
|
+
${expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? `var(${akEditorTableContainerBg}, ${"var(--ds-surface, #FFFFFF)"})` : "var(--ds-surface, #FFFFFF)"};
|
|
1001
1006
|
}
|
|
1002
1007
|
|
|
1003
1008
|
${sentinelStyles}
|
|
@@ -1749,6 +1754,7 @@ const baseTableStylesWithoutSharedStyle = props => css`
|
|
|
1749
1754
|
}
|
|
1750
1755
|
`;
|
|
1751
1756
|
|
|
1757
|
+
// TODO: EDITOR-7593 - No usage found accross AFM, deprecate when EditorContentContainer in editor-core has finished compiled css migration under experiment 'platform_editor_core_static_css'
|
|
1752
1758
|
// re-exporting these styles to use in Gemini test when table node view is rendered outside of PM
|
|
1753
1759
|
export const baseTableStyles = props => css`
|
|
1754
1760
|
${tableSharedStyle()};
|
|
@@ -12,6 +12,7 @@ import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
|
12
12
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
13
13
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
14
14
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
16
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
16
17
|
import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
|
|
17
18
|
import { updateStickyState } from '../pm-plugins/sticky-headers/commands';
|
|
@@ -469,17 +470,38 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
469
470
|
navigator.userAgent.includes('AppleWebKit') && !navigator.userAgent.includes('Chrome')) {
|
|
470
471
|
var pos = this.getPos();
|
|
471
472
|
if (typeof pos === 'number') {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
473
|
+
if (fg('platform_editor_ai_table_ai_streaming_pos_fix')) {
|
|
474
|
+
try {
|
|
475
|
+
// getPos can return stale positions during AI streaming which cannot be resolved
|
|
476
|
+
var $tableRowPos = this.view.state.doc.resolve(pos);
|
|
477
|
+
|
|
478
|
+
// layout -> layout column -> table -> table row
|
|
479
|
+
if ($tableRowPos.depth >= 3) {
|
|
480
|
+
var _findParentNodeCloses;
|
|
481
|
+
var isInsideLayout = (_findParentNodeCloses = findParentNodeClosestToPos($tableRowPos, function (node) {
|
|
482
|
+
return node.type.name === 'layoutColumn';
|
|
483
|
+
})) === null || _findParentNodeCloses === void 0 ? void 0 : _findParentNodeCloses.node;
|
|
484
|
+
if (isInsideLayout) {
|
|
485
|
+
return false;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
} catch (_unused2) {
|
|
489
|
+
// getPos can return stale positions during AI streaming — fall back to non-sticky
|
|
481
490
|
return false;
|
|
482
491
|
}
|
|
492
|
+
} else {
|
|
493
|
+
var _$tableRowPos = this.view.state.doc.resolve(pos);
|
|
494
|
+
|
|
495
|
+
// layout -> layout column -> table -> table row
|
|
496
|
+
if (_$tableRowPos.depth >= 3) {
|
|
497
|
+
var _findParentNodeCloses2;
|
|
498
|
+
var _isInsideLayout = (_findParentNodeCloses2 = findParentNodeClosestToPos(_$tableRowPos, function (node) {
|
|
499
|
+
return node.type.name === 'layoutColumn';
|
|
500
|
+
})) === null || _findParentNodeCloses2 === void 0 ? void 0 : _findParentNodeCloses2.node;
|
|
501
|
+
if (_isInsideLayout) {
|
|
502
|
+
return false;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
483
505
|
}
|
|
484
506
|
}
|
|
485
507
|
}
|
|
@@ -114,8 +114,22 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_TableNodeView) {
|
|
|
114
114
|
}
|
|
115
115
|
var pos = _this.getPos();
|
|
116
116
|
_this.isInNestedTable = false;
|
|
117
|
-
if (
|
|
118
|
-
|
|
117
|
+
if (fg('platform_editor_ai_table_ai_streaming_pos_fix')) {
|
|
118
|
+
try {
|
|
119
|
+
// We cannot trust that the value from getPos will be defined
|
|
120
|
+
// https://discuss.prosemirror.net/t/getpos-is-undefined-in-nodeview-constructor/1246/4
|
|
121
|
+
// There are also scenarios where the value it brings back does not tally with the current doc
|
|
122
|
+
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
123
|
+
if (pos) {
|
|
124
|
+
_this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
125
|
+
}
|
|
126
|
+
} catch (_unused) {
|
|
127
|
+
// Intentionally swallowed — getPos can return stale positions during AI streaming
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
if (pos) {
|
|
131
|
+
_this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
132
|
+
}
|
|
119
133
|
}
|
|
120
134
|
if (_this.isHeaderRow) {
|
|
121
135
|
_this.dom.setAttribute('data-vc-nvs', 'true');
|
|
@@ -704,17 +718,38 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_TableNodeView) {
|
|
|
704
718
|
navigator.userAgent.includes('AppleWebKit') && !navigator.userAgent.includes('Chrome')) {
|
|
705
719
|
var pos = this.getPos();
|
|
706
720
|
if (typeof pos === 'number') {
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
721
|
+
if (fg('platform_editor_ai_table_ai_streaming_pos_fix')) {
|
|
722
|
+
try {
|
|
723
|
+
// getPos can return stale positions during AI streaming which cannot be resolved
|
|
724
|
+
var $tableRowPos = this.view.state.doc.resolve(pos);
|
|
725
|
+
|
|
726
|
+
// layout -> layout column -> table -> table row
|
|
727
|
+
if ($tableRowPos.depth >= 3) {
|
|
728
|
+
var _findParentNodeCloses;
|
|
729
|
+
var isInsideLayout = (_findParentNodeCloses = findParentNodeClosestToPos($tableRowPos, function (node) {
|
|
730
|
+
return node.type.name === 'layoutColumn';
|
|
731
|
+
})) === null || _findParentNodeCloses === void 0 ? void 0 : _findParentNodeCloses.node;
|
|
732
|
+
if (isInsideLayout) {
|
|
733
|
+
return false;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
} catch (_unused2) {
|
|
737
|
+
// getPos can return stale positions during AI streaming — fall back to non-sticky
|
|
716
738
|
return false;
|
|
717
739
|
}
|
|
740
|
+
} else {
|
|
741
|
+
var _$tableRowPos = this.view.state.doc.resolve(pos);
|
|
742
|
+
|
|
743
|
+
// layout -> layout column -> table -> table row
|
|
744
|
+
if (_$tableRowPos.depth >= 3) {
|
|
745
|
+
var _findParentNodeCloses2;
|
|
746
|
+
var _isInsideLayout = (_findParentNodeCloses2 = findParentNodeClosestToPos(_$tableRowPos, function (node) {
|
|
747
|
+
return node.type.name === 'layoutColumn';
|
|
748
|
+
})) === null || _findParentNodeCloses2 === void 0 ? void 0 : _findParentNodeCloses2.node;
|
|
749
|
+
if (_isInsideLayout) {
|
|
750
|
+
return false;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
718
753
|
}
|
|
719
754
|
}
|
|
720
755
|
}
|
|
@@ -10,6 +10,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
10
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
11
|
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
12
12
|
import React from 'react';
|
|
13
|
+
import { isSSR, isSSRStreaming } from '@atlaskit/editor-common/core-utils';
|
|
13
14
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
14
15
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
15
16
|
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
@@ -417,6 +418,22 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
417
418
|
allowTableAlignment = _getPluginConfig.allowTableAlignment;
|
|
418
419
|
var isTableFixedColumnWidthsOptionEnabled = (fg('platform_editor_table_fixed_column_width_prop') ? allowFixedColumnWidthOption : getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().tableWithFixedColumnWidthsOption) || false;
|
|
419
420
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && (isTableFixedColumnWidthsOptionEnabled || isCommentEditor);
|
|
421
|
+
|
|
422
|
+
// In SSR use native ProseMirror spec-based render for table nodes
|
|
423
|
+
if (isSSR() && isSSRStreaming()) {
|
|
424
|
+
var isNested = isTableNested(view.state, typeof getPos === 'function' ? getPos() : undefined);
|
|
425
|
+
var tableDOMStructure = tableNodeSpecWithFixedToDOM({
|
|
426
|
+
allowColumnResizing: allowColumnResizing !== null && allowColumnResizing !== void 0 ? allowColumnResizing : false,
|
|
427
|
+
tableResizingEnabled: allowTableResizing !== null && allowTableResizing !== void 0 ? allowTableResizing : false,
|
|
428
|
+
getEditorContainerWidth: getEditorContainerWidth,
|
|
429
|
+
isTableScalingEnabled: isTableScalingEnabled,
|
|
430
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
431
|
+
isCommentEditor: isCommentEditor,
|
|
432
|
+
isChromelessEditor: isChromelessEditor,
|
|
433
|
+
isNested: isNested
|
|
434
|
+
}).toDOM(node);
|
|
435
|
+
return DOMSerializer.renderSpec(document, tableDOMStructure);
|
|
436
|
+
}
|
|
420
437
|
return new TableView({
|
|
421
438
|
node: node,
|
|
422
439
|
view: view,
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { bind } from 'bind-event-listener';
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
7
|
-
import { insideTable
|
|
7
|
+
import { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
8
8
|
import { isNestedTablesSupported } from '@atlaskit/editor-common/nesting';
|
|
9
9
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
10
10
|
import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveOpenNestedExpand } from '@atlaskit/editor-common/transforms';
|
|
@@ -60,7 +60,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
60
60
|
return editorView.state;
|
|
61
61
|
};
|
|
62
62
|
var getNodeView = function getNodeView() {
|
|
63
|
-
return
|
|
63
|
+
return {
|
|
64
64
|
table: tableView({
|
|
65
65
|
portalProviderAPI: portalProviderAPI,
|
|
66
66
|
eventDispatcher: eventDispatcher,
|
|
@@ -71,8 +71,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
71
71
|
isCommentEditor: isCommentEditor,
|
|
72
72
|
isChromelessEditor: isChromelessEditor,
|
|
73
73
|
allowFixedColumnWidthOption: allowFixedColumnWidthOption
|
|
74
|
-
})
|
|
75
|
-
}), {}, {
|
|
74
|
+
}),
|
|
76
75
|
tableRow: tableRowView({
|
|
77
76
|
eventDispatcher: eventDispatcher,
|
|
78
77
|
pluginInjectionApi: pluginInjectionApi
|
|
@@ -85,7 +84,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
85
84
|
eventDispatcher: eventDispatcher,
|
|
86
85
|
pluginInjectionApi: pluginInjectionApi
|
|
87
86
|
})
|
|
88
|
-
}
|
|
87
|
+
};
|
|
89
88
|
};
|
|
90
89
|
var nodeViews = getNodeView();
|
|
91
90
|
return new SafePlugin({
|