@atlaskit/editor-plugin-table 15.6.7 → 15.6.8
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 +7 -0
- package/dist/cjs/nodeviews/TableRowNativeStickyWithFallback.js +33 -35
- package/dist/es2019/nodeviews/TableRowNativeStickyWithFallback.js +33 -35
- package/dist/esm/nodeviews/TableRowNativeStickyWithFallback.js +32 -34
- package/dist/types/nodeviews/TableRowNativeStickyWithFallback.d.ts +2 -2
- package/dist/types-ts4.5/nodeviews/TableRowNativeStickyWithFallback.d.ts +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -79,6 +79,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
79
79
|
(0, _defineProperty2.default)(_this, "listening", false);
|
|
80
80
|
(0, _defineProperty2.default)(_this, "padding", 0);
|
|
81
81
|
(0, _defineProperty2.default)(_this, "top", 0);
|
|
82
|
+
(0, _defineProperty2.default)(_this, "hasScrolledSinceLoad", false);
|
|
82
83
|
(0, _defineProperty2.default)(_this, "disableNativeSticky", false);
|
|
83
84
|
/**
|
|
84
85
|
* Methods
|
|
@@ -261,45 +262,43 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
261
262
|
if (this.editorScrollableElement) {
|
|
262
263
|
this.initObservers();
|
|
263
264
|
this.topPosEditorElement = (0, _dom2.getTop)(this.editorScrollableElement);
|
|
264
|
-
if (
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_table_sticky_header_patch_5')) {
|
|
266
|
+
this.scrollListener = function () {
|
|
267
|
+
var _this3$overflowObserv;
|
|
268
|
+
if (_this3.hasScrolledSinceLoad) {
|
|
267
269
|
return;
|
|
268
270
|
}
|
|
269
|
-
|
|
271
|
+
_this3.hasScrolledSinceLoad = true;
|
|
270
272
|
if (!_this3.overflowObserver) {
|
|
271
273
|
return;
|
|
272
274
|
}
|
|
273
275
|
|
|
274
276
|
// Re-check intersection state now that scrolling has occurred
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
_this3.dom.classList.remove(_types.TableCssClassName.NATIVE_STICKY);
|
|
294
|
-
_this3.isNativeSticky = false;
|
|
295
|
-
}
|
|
296
|
-
_this3.refreshLegacyStickyState();
|
|
277
|
+
var entries = (_this3$overflowObserv = _this3.overflowObserverEntries) !== null && _this3$overflowObserv !== void 0 ? _this3$overflowObserv : _this3.overflowObserver.takeRecords();
|
|
278
|
+
_this3.overflowObserverEntries = undefined;
|
|
279
|
+
|
|
280
|
+
/** NOTE: This logic is duplicated in the overflowObserver callback
|
|
281
|
+
* to avoid conflicting with a follow up refactor where this will
|
|
282
|
+
* be cleaned up.
|
|
283
|
+
*/
|
|
284
|
+
entries.forEach(function (entry) {
|
|
285
|
+
var tableWrapper = _this3.dom.closest(".".concat(_types.TableCssClassName.TABLE_NODE_WRAPPER));
|
|
286
|
+
if (tableWrapper && tableWrapper instanceof HTMLElement) {
|
|
287
|
+
if (entry.isIntersecting) {
|
|
288
|
+
tableWrapper.classList.add(_types.TableCssClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
289
|
+
_this3.dom.classList.add(_types.TableCssClassName.NATIVE_STICKY);
|
|
290
|
+
_this3.isNativeSticky = true;
|
|
291
|
+
} else {
|
|
292
|
+
tableWrapper.classList.remove(_types.TableCssClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
293
|
+
_this3.dom.classList.remove(_types.TableCssClassName.NATIVE_STICKY);
|
|
294
|
+
_this3.isNativeSticky = false;
|
|
297
295
|
}
|
|
298
|
-
|
|
299
|
-
|
|
296
|
+
_this3.refreshLegacyStickyState();
|
|
297
|
+
}
|
|
298
|
+
});
|
|
300
299
|
};
|
|
301
300
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
302
|
-
this.editorScrollableElement.addEventListener('scroll',
|
|
301
|
+
this.editorScrollableElement.addEventListener('scroll', this.scrollListener, {
|
|
303
302
|
passive: true,
|
|
304
303
|
once: true
|
|
305
304
|
});
|
|
@@ -342,10 +341,10 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
342
341
|
if (this.resizeObserver) {
|
|
343
342
|
this.resizeObserver.disconnect();
|
|
344
343
|
}
|
|
345
|
-
if (
|
|
344
|
+
if (this.scrollListener && this.editorScrollableElement) {
|
|
346
345
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
347
|
-
this.editorScrollableElement.removeEventListener('scroll',
|
|
348
|
-
|
|
346
|
+
this.editorScrollableElement.removeEventListener('scroll', this.scrollListener);
|
|
347
|
+
this.scrollListener = undefined;
|
|
349
348
|
}
|
|
350
349
|
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
351
350
|
// Ignored via go/ees005
|
|
@@ -378,7 +377,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
378
377
|
return;
|
|
379
378
|
}
|
|
380
379
|
// Only apply classes if page has scrolled since load
|
|
381
|
-
if (!
|
|
380
|
+
if (!_this4.hasScrolledSinceLoad && (0, _platformFeatureFlags.fg)('platform_editor_table_sticky_header_patch_5')) {
|
|
382
381
|
_this4.overflowObserverEntries = entries;
|
|
383
382
|
return;
|
|
384
383
|
}
|
|
@@ -976,5 +975,4 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
976
975
|
}
|
|
977
976
|
}
|
|
978
977
|
}]);
|
|
979
|
-
}(_TableNodeViewBase.default);
|
|
980
|
-
(0, _defineProperty2.default)(TableRowNativeStickyWithFallback, "hasScrolledSinceLoad", false);
|
|
978
|
+
}(_TableNodeViewBase.default);
|
|
@@ -63,6 +63,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
63
63
|
_defineProperty(this, "listening", false);
|
|
64
64
|
_defineProperty(this, "padding", 0);
|
|
65
65
|
_defineProperty(this, "top", 0);
|
|
66
|
+
_defineProperty(this, "hasScrolledSinceLoad", false);
|
|
66
67
|
_defineProperty(this, "disableNativeSticky", false);
|
|
67
68
|
/**
|
|
68
69
|
* Methods
|
|
@@ -235,45 +236,43 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
235
236
|
if (this.editorScrollableElement) {
|
|
236
237
|
this.initObservers();
|
|
237
238
|
this.topPosEditorElement = getTop(this.editorScrollableElement);
|
|
238
|
-
if (
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
if (fg('platform_editor_table_sticky_header_patch_5')) {
|
|
240
|
+
this.scrollListener = () => {
|
|
241
|
+
var _this$overflowObserve;
|
|
242
|
+
if (this.hasScrolledSinceLoad) {
|
|
241
243
|
return;
|
|
242
244
|
}
|
|
243
|
-
|
|
245
|
+
this.hasScrolledSinceLoad = true;
|
|
244
246
|
if (!this.overflowObserver) {
|
|
245
247
|
return;
|
|
246
248
|
}
|
|
247
249
|
|
|
248
250
|
// Re-check intersection state now that scrolling has occurred
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
this.dom.classList.remove(ClassName.NATIVE_STICKY);
|
|
268
|
-
this.isNativeSticky = false;
|
|
269
|
-
}
|
|
270
|
-
this.refreshLegacyStickyState();
|
|
251
|
+
const entries = (_this$overflowObserve = this.overflowObserverEntries) !== null && _this$overflowObserve !== void 0 ? _this$overflowObserve : this.overflowObserver.takeRecords();
|
|
252
|
+
this.overflowObserverEntries = undefined;
|
|
253
|
+
|
|
254
|
+
/** NOTE: This logic is duplicated in the overflowObserver callback
|
|
255
|
+
* to avoid conflicting with a follow up refactor where this will
|
|
256
|
+
* be cleaned up.
|
|
257
|
+
*/
|
|
258
|
+
entries.forEach(entry => {
|
|
259
|
+
const tableWrapper = this.dom.closest(`.${ClassName.TABLE_NODE_WRAPPER}`);
|
|
260
|
+
if (tableWrapper && tableWrapper instanceof HTMLElement) {
|
|
261
|
+
if (entry.isIntersecting) {
|
|
262
|
+
tableWrapper.classList.add(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
263
|
+
this.dom.classList.add(ClassName.NATIVE_STICKY);
|
|
264
|
+
this.isNativeSticky = true;
|
|
265
|
+
} else {
|
|
266
|
+
tableWrapper.classList.remove(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
267
|
+
this.dom.classList.remove(ClassName.NATIVE_STICKY);
|
|
268
|
+
this.isNativeSticky = false;
|
|
271
269
|
}
|
|
272
|
-
|
|
273
|
-
|
|
270
|
+
this.refreshLegacyStickyState();
|
|
271
|
+
}
|
|
272
|
+
});
|
|
274
273
|
};
|
|
275
274
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
276
|
-
this.editorScrollableElement.addEventListener('scroll',
|
|
275
|
+
this.editorScrollableElement.addEventListener('scroll', this.scrollListener, {
|
|
277
276
|
passive: true,
|
|
278
277
|
once: true
|
|
279
278
|
});
|
|
@@ -314,10 +313,10 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
314
313
|
if (this.resizeObserver) {
|
|
315
314
|
this.resizeObserver.disconnect();
|
|
316
315
|
}
|
|
317
|
-
if (
|
|
316
|
+
if (this.scrollListener && this.editorScrollableElement) {
|
|
318
317
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
319
|
-
this.editorScrollableElement.removeEventListener('scroll',
|
|
320
|
-
|
|
318
|
+
this.editorScrollableElement.removeEventListener('scroll', this.scrollListener);
|
|
319
|
+
this.scrollListener = undefined;
|
|
321
320
|
}
|
|
322
321
|
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
323
322
|
// Ignored via go/ees005
|
|
@@ -347,7 +346,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
347
346
|
return;
|
|
348
347
|
}
|
|
349
348
|
// Only apply classes if page has scrolled since load
|
|
350
|
-
if (!
|
|
349
|
+
if (!this.hasScrolledSinceLoad && fg('platform_editor_table_sticky_header_patch_5')) {
|
|
351
350
|
this.overflowObserverEntries = entries;
|
|
352
351
|
return;
|
|
353
352
|
}
|
|
@@ -906,5 +905,4 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
906
905
|
})(this.view.state, this.view.dispatch, this.view);
|
|
907
906
|
}
|
|
908
907
|
}
|
|
909
|
-
}
|
|
910
|
-
_defineProperty(TableRowNativeStickyWithFallback, "hasScrolledSinceLoad", false);
|
|
908
|
+
}
|
|
@@ -72,6 +72,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
72
72
|
_defineProperty(_this, "listening", false);
|
|
73
73
|
_defineProperty(_this, "padding", 0);
|
|
74
74
|
_defineProperty(_this, "top", 0);
|
|
75
|
+
_defineProperty(_this, "hasScrolledSinceLoad", false);
|
|
75
76
|
_defineProperty(_this, "disableNativeSticky", false);
|
|
76
77
|
/**
|
|
77
78
|
* Methods
|
|
@@ -254,45 +255,43 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
254
255
|
if (this.editorScrollableElement) {
|
|
255
256
|
this.initObservers();
|
|
256
257
|
this.topPosEditorElement = getTop(this.editorScrollableElement);
|
|
257
|
-
if (
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
if (fg('platform_editor_table_sticky_header_patch_5')) {
|
|
259
|
+
this.scrollListener = function () {
|
|
260
|
+
var _this3$overflowObserv;
|
|
261
|
+
if (_this3.hasScrolledSinceLoad) {
|
|
260
262
|
return;
|
|
261
263
|
}
|
|
262
|
-
|
|
264
|
+
_this3.hasScrolledSinceLoad = true;
|
|
263
265
|
if (!_this3.overflowObserver) {
|
|
264
266
|
return;
|
|
265
267
|
}
|
|
266
268
|
|
|
267
269
|
// Re-check intersection state now that scrolling has occurred
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
_this3.dom.classList.remove(ClassName.NATIVE_STICKY);
|
|
287
|
-
_this3.isNativeSticky = false;
|
|
288
|
-
}
|
|
289
|
-
_this3.refreshLegacyStickyState();
|
|
270
|
+
var entries = (_this3$overflowObserv = _this3.overflowObserverEntries) !== null && _this3$overflowObserv !== void 0 ? _this3$overflowObserv : _this3.overflowObserver.takeRecords();
|
|
271
|
+
_this3.overflowObserverEntries = undefined;
|
|
272
|
+
|
|
273
|
+
/** NOTE: This logic is duplicated in the overflowObserver callback
|
|
274
|
+
* to avoid conflicting with a follow up refactor where this will
|
|
275
|
+
* be cleaned up.
|
|
276
|
+
*/
|
|
277
|
+
entries.forEach(function (entry) {
|
|
278
|
+
var tableWrapper = _this3.dom.closest(".".concat(ClassName.TABLE_NODE_WRAPPER));
|
|
279
|
+
if (tableWrapper && tableWrapper instanceof HTMLElement) {
|
|
280
|
+
if (entry.isIntersecting) {
|
|
281
|
+
tableWrapper.classList.add(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
282
|
+
_this3.dom.classList.add(ClassName.NATIVE_STICKY);
|
|
283
|
+
_this3.isNativeSticky = true;
|
|
284
|
+
} else {
|
|
285
|
+
tableWrapper.classList.remove(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
286
|
+
_this3.dom.classList.remove(ClassName.NATIVE_STICKY);
|
|
287
|
+
_this3.isNativeSticky = false;
|
|
290
288
|
}
|
|
291
|
-
|
|
292
|
-
|
|
289
|
+
_this3.refreshLegacyStickyState();
|
|
290
|
+
}
|
|
291
|
+
});
|
|
293
292
|
};
|
|
294
293
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
295
|
-
this.editorScrollableElement.addEventListener('scroll',
|
|
294
|
+
this.editorScrollableElement.addEventListener('scroll', this.scrollListener, {
|
|
296
295
|
passive: true,
|
|
297
296
|
once: true
|
|
298
297
|
});
|
|
@@ -335,10 +334,10 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
335
334
|
if (this.resizeObserver) {
|
|
336
335
|
this.resizeObserver.disconnect();
|
|
337
336
|
}
|
|
338
|
-
if (
|
|
337
|
+
if (this.scrollListener && this.editorScrollableElement) {
|
|
339
338
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
340
|
-
this.editorScrollableElement.removeEventListener('scroll',
|
|
341
|
-
|
|
339
|
+
this.editorScrollableElement.removeEventListener('scroll', this.scrollListener);
|
|
340
|
+
this.scrollListener = undefined;
|
|
342
341
|
}
|
|
343
342
|
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
344
343
|
// Ignored via go/ees005
|
|
@@ -371,7 +370,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
371
370
|
return;
|
|
372
371
|
}
|
|
373
372
|
// Only apply classes if page has scrolled since load
|
|
374
|
-
if (!
|
|
373
|
+
if (!_this4.hasScrolledSinceLoad && fg('platform_editor_table_sticky_header_patch_5')) {
|
|
375
374
|
_this4.overflowObserverEntries = entries;
|
|
376
375
|
return;
|
|
377
376
|
}
|
|
@@ -970,5 +969,4 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
970
969
|
}
|
|
971
970
|
}]);
|
|
972
971
|
}(TableNodeView);
|
|
973
|
-
_defineProperty(TableRowNativeStickyWithFallback, "hasScrolledSinceLoad", false);
|
|
974
972
|
export { TableRowNativeStickyWithFallback as default };
|
|
@@ -4,8 +4,6 @@ import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
|
4
4
|
import { type PluginInjectionAPI } from '../types';
|
|
5
5
|
import TableNodeView from './TableNodeViewBase';
|
|
6
6
|
export default class TableRowNativeStickyWithFallback extends TableNodeView<HTMLTableRowElement> implements NodeView {
|
|
7
|
-
static hasScrolledSinceLoad: boolean;
|
|
8
|
-
static scrollListener?: () => void;
|
|
9
7
|
private nodeVisibilityObserverCleanupFn?;
|
|
10
8
|
cleanup: () => void;
|
|
11
9
|
constructor(node: PMNode, view: EditorView, getPos: () => number | undefined, eventDispatcher: EventDispatcher, api?: PluginInjectionAPI);
|
|
@@ -33,6 +31,8 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView<HTML
|
|
|
33
31
|
/** Native sticky header variables */
|
|
34
32
|
private overflowObserver?;
|
|
35
33
|
private stickyStateObserver?;
|
|
34
|
+
private hasScrolledSinceLoad;
|
|
35
|
+
private scrollListener?;
|
|
36
36
|
private overflowObserverEntries?;
|
|
37
37
|
private isNativeSticky?;
|
|
38
38
|
private disableNativeSticky;
|
|
@@ -4,8 +4,6 @@ import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
|
4
4
|
import { type PluginInjectionAPI } from '../types';
|
|
5
5
|
import TableNodeView from './TableNodeViewBase';
|
|
6
6
|
export default class TableRowNativeStickyWithFallback extends TableNodeView<HTMLTableRowElement> implements NodeView {
|
|
7
|
-
static hasScrolledSinceLoad: boolean;
|
|
8
|
-
static scrollListener?: () => void;
|
|
9
7
|
private nodeVisibilityObserverCleanupFn?;
|
|
10
8
|
cleanup: () => void;
|
|
11
9
|
constructor(node: PMNode, view: EditorView, getPos: () => number | undefined, eventDispatcher: EventDispatcher, api?: PluginInjectionAPI);
|
|
@@ -33,6 +31,8 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView<HTML
|
|
|
33
31
|
/** Native sticky header variables */
|
|
34
32
|
private overflowObserver?;
|
|
35
33
|
private stickyStateObserver?;
|
|
34
|
+
private hasScrolledSinceLoad;
|
|
35
|
+
private scrollListener?;
|
|
36
36
|
private overflowObserverEntries?;
|
|
37
37
|
private isNativeSticky?;
|
|
38
38
|
private disableNativeSticky;
|