@atlaskit/editor-plugin-table 10.10.7 → 10.11.1
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 +21 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/dist/cjs/nodeviews/TableComponent.js +48 -24
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +14 -6
- package/dist/cjs/nodeviews/TableResizer.js +6 -1
- package/dist/cjs/nodeviews/TableRow.js +29 -7
- package/dist/es2019/nodeviews/TableComponent.js +22 -0
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +14 -6
- package/dist/es2019/nodeviews/TableResizer.js +6 -1
- package/dist/es2019/nodeviews/TableRow.js +24 -3
- package/dist/esm/nodeviews/TableComponent.js +48 -24
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +14 -6
- package/dist/esm/nodeviews/TableResizer.js +6 -1
- package/dist/esm/nodeviews/TableRow.js +29 -7
- package/dist/types/nodeviews/TableRow.d.ts +2 -0
- package/dist/types/tablePluginType.d.ts +3 -1
- package/dist/types-ts4.5/nodeviews/TableRow.d.ts +2 -0
- package/dist/types-ts4.5/tablePluginType.d.ts +3 -1
- package/package.json +10 -6
- package/src/nodeviews/TableComponent.tsx +24 -0
- package/src/nodeviews/TableComponentWithSharedState.tsx +29 -3
- package/src/nodeviews/TableResizer.tsx +15 -1
- package/src/nodeviews/TableRow.ts +27 -3
- package/src/tablePluginType.ts +2 -0
- package/tsconfig.app.json +3 -0
|
@@ -3,11 +3,13 @@ import throttle from 'lodash/throttle';
|
|
|
3
3
|
|
|
4
4
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
5
5
|
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
6
|
+
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
6
7
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
7
8
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
8
9
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
9
10
|
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
10
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
13
|
|
|
12
14
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
13
15
|
import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
|
|
@@ -44,6 +46,8 @@ const HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
|
|
|
44
46
|
const HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT = 400;
|
|
45
47
|
|
|
46
48
|
export default class TableRow extends TableNodeView<HTMLTableRowElement> implements NodeView {
|
|
49
|
+
private nodeVisibilityObserverCleanupFn?: () => void;
|
|
50
|
+
|
|
47
51
|
constructor(
|
|
48
52
|
node: PMNode,
|
|
49
53
|
view: EditorView,
|
|
@@ -66,13 +70,31 @@ export default class TableRow extends TableNodeView<HTMLTableRowElement> impleme
|
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
if (this.isHeaderRow) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
if (editorExperiment('platform_editor_nodevisibility', false)) {
|
|
74
|
+
this.subscribeWhenRowVisible();
|
|
75
|
+
} else {
|
|
76
|
+
const { observe } = nodeVisibilityManager(view.dom);
|
|
77
|
+
this.nodeVisibilityObserverCleanupFn = observe({
|
|
78
|
+
element: this.contentDOM,
|
|
79
|
+
onFirstVisible: () => {
|
|
80
|
+
this.subscribeWhenRowVisible();
|
|
81
|
+
},
|
|
82
|
+
});
|
|
72
83
|
}
|
|
73
84
|
}
|
|
74
85
|
}
|
|
75
86
|
|
|
87
|
+
subscribeWhenRowVisible() {
|
|
88
|
+
if (this.listening) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
this.dom.setAttribute('data-header-row', 'true');
|
|
93
|
+
if (this.isStickyHeaderEnabled) {
|
|
94
|
+
this.subscribe();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
76
98
|
/**
|
|
77
99
|
* Variables
|
|
78
100
|
*/
|
|
@@ -151,6 +173,8 @@ export default class TableRow extends TableNodeView<HTMLTableRowElement> impleme
|
|
|
151
173
|
if (this.isStickyHeaderEnabled) {
|
|
152
174
|
this.unsubscribe();
|
|
153
175
|
|
|
176
|
+
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
177
|
+
|
|
154
178
|
const tree = getTree(this.dom);
|
|
155
179
|
if (tree) {
|
|
156
180
|
this.makeRowHeaderNotSticky(tree.table, true);
|
package/src/tablePluginType.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmo
|
|
|
14
14
|
import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
|
|
15
15
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
16
16
|
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
17
|
+
import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
17
18
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
18
19
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
19
20
|
|
|
@@ -82,6 +83,7 @@ export type TablePluginDependencies = [
|
|
|
82
83
|
OptionalPlugin<EditorViewModePlugin>,
|
|
83
84
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
84
85
|
OptionalPlugin<ExtensionPlugin>,
|
|
86
|
+
OptionalPlugin<InteractionPlugin>,
|
|
85
87
|
];
|
|
86
88
|
|
|
87
89
|
export type TablePlugin = NextEditorPlugin<
|