@atlaskit/editor-plugin-table 10.11.5 → 10.11.6

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 10.11.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#162726](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/162726)
8
+ [`05c3aa3d6cd0c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/05c3aa3d6cd0c) -
9
+ NOISSUE - Remove lazy node view for tables. Includes cleaning up the feature gates:
10
+ platform_editor_disable_table_lnv & platform_editor_enable_table_lnv.
11
+
3
12
  ## 10.11.5
4
13
 
5
14
  ### Patch Changes
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.tableView = exports.tableRowView = exports.tableHeaderView = exports.tableCellView = void 0;
8
+ var _table = require("./table");
9
+ var _TableCell = _interopRequireDefault(require("./TableCell"));
10
+ var _TableRow = _interopRequireDefault(require("./TableRow"));
11
+ // TODO: ED-23976 - Clean up
12
+
13
+ var tableView = exports.tableView = function tableView(options) {
14
+ return function (node, view, getPos) {
15
+ return (0, _table.createTableView)(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isCommentEditor, options.isChromelessEditor);
16
+ };
17
+ };
18
+ var tableCellView = exports.tableCellView = function tableCellView(options) {
19
+ return function (node, view, getPos) {
20
+ var _options$pluginInject;
21
+ 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);
22
+ };
23
+ };
24
+ var tableHeaderView = exports.tableHeaderView = function tableHeaderView(options) {
25
+ return function (node, view, getPos) {
26
+ var _options$pluginInject2;
27
+ 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);
28
+ };
29
+ };
30
+ var tableRowView = exports.tableRowView = function tableRowView(options) {
31
+ return function (node, view, getPos) {
32
+ return new _TableRow.default(node, view, getPos, options.eventDispatcher);
33
+ };
34
+ };
@@ -15,7 +15,7 @@ var _utils2 = require("@atlaskit/editor-prosemirror/utils");
15
15
  var _editorTables = require("@atlaskit/editor-tables");
16
16
  var _utils3 = require("@atlaskit/editor-tables/utils");
17
17
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
- var _lazyNodeViews = require("../nodeviews/lazy-node-views");
18
+ var _tableNodeViews = require("../nodeviews/table-node-views");
19
19
  var _plugin = require("../pm-plugins/decorations/plugin");
20
20
  var _types = require("../types");
21
21
  var _eventHandlers = require("../ui/event-handlers");
@@ -60,7 +60,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
60
60
  return editorView.state;
61
61
  };
62
62
  var nodeViews = (0, _coreUtils.isSSR)() && (0, _platformFeatureFlags.fg)('platform_editor_table_fallback_to_dom_on_ssr') ? undefined : {
63
- table: (0, _lazyNodeViews.lazyTableView)({
63
+ table: (0, _tableNodeViews.tableView)({
64
64
  portalProviderAPI: portalProviderAPI,
65
65
  eventDispatcher: eventDispatcher,
66
66
  getEditorContainerWidth: getEditorContainerWidth,
@@ -70,14 +70,14 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
70
70
  isCommentEditor: isCommentEditor,
71
71
  isChromelessEditor: isChromelessEditor
72
72
  }),
73
- tableRow: (0, _lazyNodeViews.lazyTableRowView)({
73
+ tableRow: (0, _tableNodeViews.tableRowView)({
74
74
  eventDispatcher: eventDispatcher
75
75
  }),
76
- tableCell: (0, _lazyNodeViews.lazyTableCellView)({
76
+ tableCell: (0, _tableNodeViews.tableCellView)({
77
77
  eventDispatcher: eventDispatcher,
78
78
  pluginInjectionApi: pluginInjectionApi
79
79
  }),
80
- tableHeader: (0, _lazyNodeViews.lazyTableHeaderView)({
80
+ tableHeader: (0, _tableNodeViews.tableHeaderView)({
81
81
  eventDispatcher: eventDispatcher,
82
82
  pluginInjectionApi: pluginInjectionApi
83
83
  })
@@ -0,0 +1,26 @@
1
+ // TODO: ED-23976 - Clean up
2
+ import { createTableView } from './table';
3
+ import TableCell from './TableCell';
4
+ import TableRow from './TableRow';
5
+ export const tableView = options => {
6
+ return (node, view, getPos) => {
7
+ return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isCommentEditor, options.isChromelessEditor);
8
+ };
9
+ };
10
+ export const tableCellView = options => {
11
+ return (node, view, getPos) => {
12
+ var _options$pluginInject, _options$pluginInject2;
13
+ 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);
14
+ };
15
+ };
16
+ export const tableHeaderView = options => {
17
+ return (node, view, getPos) => {
18
+ var _options$pluginInject3, _options$pluginInject4;
19
+ 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);
20
+ };
21
+ };
22
+ export const tableRowView = options => {
23
+ return (node, view, getPos) => {
24
+ return new TableRow(node, view, getPos, options.eventDispatcher);
25
+ };
26
+ };
@@ -7,7 +7,7 @@ import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-p
7
7
  import { TableMap } from '@atlaskit/editor-tables';
8
8
  import { findTable } from '@atlaskit/editor-tables/utils';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
- import { lazyTableCellView, lazyTableHeaderView, lazyTableRowView, lazyTableView } from '../nodeviews/lazy-node-views';
10
+ import { tableCellView, tableHeaderView, tableRowView, tableView } from '../nodeviews/table-node-views';
11
11
  import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
12
12
  import { TableCssClassName as ClassName } from '../types';
13
13
  import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseEnter, handleMouseLeave, handleMouseMove, handleMouseUp, handleTripleClick, whenTableInFocus, withCellTracking } from '../ui/event-handlers';
@@ -51,7 +51,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
51
51
  return editorView.state;
52
52
  };
53
53
  const nodeViews = isSSR() && fg('platform_editor_table_fallback_to_dom_on_ssr') ? undefined : {
54
- table: lazyTableView({
54
+ table: tableView({
55
55
  portalProviderAPI,
56
56
  eventDispatcher,
57
57
  getEditorContainerWidth,
@@ -61,14 +61,14 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
61
61
  isCommentEditor,
62
62
  isChromelessEditor
63
63
  }),
64
- tableRow: lazyTableRowView({
64
+ tableRow: tableRowView({
65
65
  eventDispatcher
66
66
  }),
67
- tableCell: lazyTableCellView({
67
+ tableCell: tableCellView({
68
68
  eventDispatcher,
69
69
  pluginInjectionApi
70
70
  }),
71
- tableHeader: lazyTableHeaderView({
71
+ tableHeader: tableHeaderView({
72
72
  eventDispatcher,
73
73
  pluginInjectionApi
74
74
  })
@@ -0,0 +1,26 @@
1
+ // TODO: ED-23976 - Clean up
2
+ import { createTableView } from './table';
3
+ import TableCell from './TableCell';
4
+ import TableRow from './TableRow';
5
+ export var tableView = function tableView(options) {
6
+ return function (node, view, getPos) {
7
+ return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isCommentEditor, options.isChromelessEditor);
8
+ };
9
+ };
10
+ export var tableCellView = function tableCellView(options) {
11
+ return function (node, view, getPos) {
12
+ var _options$pluginInject;
13
+ 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);
14
+ };
15
+ };
16
+ export var tableHeaderView = function tableHeaderView(options) {
17
+ return function (node, view, getPos) {
18
+ var _options$pluginInject2;
19
+ 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);
20
+ };
21
+ };
22
+ export var tableRowView = function tableRowView(options) {
23
+ return function (node, view, getPos) {
24
+ return new TableRow(node, view, getPos, options.eventDispatcher);
25
+ };
26
+ };
@@ -10,7 +10,7 @@ import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-p
10
10
  import { TableMap } from '@atlaskit/editor-tables';
11
11
  import { findTable } from '@atlaskit/editor-tables/utils';
12
12
  import { fg } from '@atlaskit/platform-feature-flags';
13
- import { lazyTableCellView, lazyTableHeaderView, lazyTableRowView, lazyTableView } from '../nodeviews/lazy-node-views';
13
+ import { tableCellView, tableHeaderView, tableRowView, tableView } from '../nodeviews/table-node-views';
14
14
  import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
15
15
  import { TableCssClassName as ClassName } from '../types';
16
16
  import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseEnter, handleMouseLeave, handleMouseMove, handleMouseUp, handleTripleClick, whenTableInFocus, withCellTracking } from '../ui/event-handlers';
@@ -53,7 +53,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
53
53
  return editorView.state;
54
54
  };
55
55
  var nodeViews = isSSR() && fg('platform_editor_table_fallback_to_dom_on_ssr') ? undefined : {
56
- table: lazyTableView({
56
+ table: tableView({
57
57
  portalProviderAPI: portalProviderAPI,
58
58
  eventDispatcher: eventDispatcher,
59
59
  getEditorContainerWidth: getEditorContainerWidth,
@@ -63,14 +63,14 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
63
63
  isCommentEditor: isCommentEditor,
64
64
  isChromelessEditor: isChromelessEditor
65
65
  }),
66
- tableRow: lazyTableRowView({
66
+ tableRow: tableRowView({
67
67
  eventDispatcher: eventDispatcher
68
68
  }),
69
- tableCell: lazyTableCellView({
69
+ tableCell: tableCellView({
70
70
  eventDispatcher: eventDispatcher,
71
71
  pluginInjectionApi: pluginInjectionApi
72
72
  }),
73
- tableHeader: lazyTableHeaderView({
73
+ tableHeader: tableHeaderView({
74
74
  eventDispatcher: eventDispatcher,
75
75
  pluginInjectionApi: pluginInjectionApi
76
76
  })
@@ -17,12 +17,12 @@ type TableViewOptions = {
17
17
  isCommentEditor?: boolean;
18
18
  isChromelessEditor?: boolean;
19
19
  };
20
- export declare const lazyTableView: (options: TableViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor;
20
+ export declare const tableView: (options: TableViewOptions) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => import("prosemirror-view").NodeView;
21
21
  type TableCellViewOptions = {
22
22
  eventDispatcher: EventDispatcher;
23
23
  pluginInjectionApi?: PluginInjectionAPI;
24
24
  };
25
- export declare const lazyTableCellView: (options: TableCellViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor | ((node: PMNode, view: EditorView, getPos: () => number | undefined) => TableCell);
26
- export declare const lazyTableHeaderView: (options: TableCellViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor | ((node: PMNode, view: EditorView, getPos: () => number | undefined) => TableCell);
27
- export declare const lazyTableRowView: (options: TableCellViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor | ((node: PMNode, view: EditorView, getPos: () => number | undefined) => TableRow);
25
+ export declare const tableCellView: (options: TableCellViewOptions) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => TableCell;
26
+ export declare const tableHeaderView: (options: TableCellViewOptions) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => TableCell;
27
+ export declare const tableRowView: (options: TableCellViewOptions) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => TableRow;
28
28
  export {};
@@ -17,12 +17,12 @@ type TableViewOptions = {
17
17
  isCommentEditor?: boolean;
18
18
  isChromelessEditor?: boolean;
19
19
  };
20
- export declare const lazyTableView: (options: TableViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor;
20
+ export declare const tableView: (options: TableViewOptions) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => import("prosemirror-view").NodeView;
21
21
  type TableCellViewOptions = {
22
22
  eventDispatcher: EventDispatcher;
23
23
  pluginInjectionApi?: PluginInjectionAPI;
24
24
  };
25
- export declare const lazyTableCellView: (options: TableCellViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor | ((node: PMNode, view: EditorView, getPos: () => number | undefined) => TableCell);
26
- export declare const lazyTableHeaderView: (options: TableCellViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor | ((node: PMNode, view: EditorView, getPos: () => number | undefined) => TableCell);
27
- export declare const lazyTableRowView: (options: TableCellViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor | ((node: PMNode, view: EditorView, getPos: () => number | undefined) => TableRow);
25
+ export declare const tableCellView: (options: TableCellViewOptions) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => TableCell;
26
+ export declare const tableHeaderView: (options: TableCellViewOptions) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => TableCell;
27
+ export declare const tableRowView: (options: TableCellViewOptions) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => TableRow;
28
28
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "10.11.5",
3
+ "version": "10.11.6",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -55,7 +55,7 @@
55
55
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
56
56
  "@atlaskit/primitives": "^14.8.0",
57
57
  "@atlaskit/theme": "^18.0.0",
58
- "@atlaskit/tmp-editor-statsig": "^5.6.0",
58
+ "@atlaskit/tmp-editor-statsig": "^5.7.0",
59
59
  "@atlaskit/toggle": "^15.0.0",
60
60
  "@atlaskit/tokens": "^4.9.0",
61
61
  "@atlaskit/tooltip": "^20.2.0",
@@ -136,12 +136,6 @@
136
136
  "platform_editor_live_page_prevent_table_recreation": {
137
137
  "type": "boolean"
138
138
  },
139
- "platform_editor_disable_table_lnv": {
140
- "type": "boolean"
141
- },
142
- "platform_editor_enable_table_lnv": {
143
- "type": "boolean"
144
- },
145
139
  "nested_table_control_padding_with_css": {
146
140
  "type": "boolean"
147
141
  },
@@ -0,0 +1,76 @@
1
+ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
+ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
+ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
4
+ import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
5
+ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
6
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
+
8
+ import type { PluginInjectionAPI } from '../types';
9
+
10
+ // TODO: ED-23976 - Clean up
11
+ import { createTableView } from './table';
12
+ import TableCell from './TableCell';
13
+ import TableRow from './TableRow';
14
+
15
+ type TableViewOptions = {
16
+ portalProviderAPI: PortalProviderAPI;
17
+ eventDispatcher: EventDispatcher;
18
+ getEditorContainerWidth: GetEditorContainerWidth;
19
+ getEditorFeatureFlags: GetEditorFeatureFlags;
20
+ dispatchAnalyticsEvent: DispatchAnalyticsEvent;
21
+ pluginInjectionApi?: PluginInjectionAPI;
22
+ isCommentEditor?: boolean;
23
+ isChromelessEditor?: boolean;
24
+ };
25
+
26
+ export const tableView = (options: TableViewOptions) => {
27
+ return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
28
+ return createTableView(
29
+ node,
30
+ view,
31
+ getPos,
32
+ options.portalProviderAPI,
33
+ options.eventDispatcher,
34
+ options.getEditorContainerWidth,
35
+ options.getEditorFeatureFlags,
36
+ options.dispatchAnalyticsEvent,
37
+ options.pluginInjectionApi,
38
+ options.isCommentEditor,
39
+ options.isChromelessEditor,
40
+ );
41
+ };
42
+ };
43
+
44
+ type TableCellViewOptions = {
45
+ eventDispatcher: EventDispatcher;
46
+ pluginInjectionApi?: PluginInjectionAPI;
47
+ };
48
+ export const tableCellView = (options: TableCellViewOptions) => {
49
+ return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
50
+ return new TableCell(
51
+ node,
52
+ view,
53
+ getPos,
54
+ options.eventDispatcher,
55
+ options.pluginInjectionApi?.analytics?.actions,
56
+ );
57
+ };
58
+ };
59
+
60
+ export const tableHeaderView = (options: TableCellViewOptions) => {
61
+ return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
62
+ return new TableCell(
63
+ node,
64
+ view,
65
+ getPos,
66
+ options.eventDispatcher,
67
+ options.pluginInjectionApi?.analytics?.actions,
68
+ );
69
+ };
70
+ };
71
+
72
+ export const tableRowView = (options: TableCellViewOptions) => {
73
+ return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
74
+ return new TableRow(node, view, getPos, options.eventDispatcher);
75
+ };
76
+ };
@@ -28,11 +28,11 @@ import { findTable } from '@atlaskit/editor-tables/utils';
28
28
  import { fg } from '@atlaskit/platform-feature-flags';
29
29
 
30
30
  import {
31
- lazyTableCellView,
32
- lazyTableHeaderView,
33
- lazyTableRowView,
34
- lazyTableView,
35
- } from '../nodeviews/lazy-node-views';
31
+ tableCellView,
32
+ tableHeaderView,
33
+ tableRowView,
34
+ tableView,
35
+ } from '../nodeviews/table-node-views';
36
36
  import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
37
37
  import type {
38
38
  InvalidNodeAttr,
@@ -135,7 +135,7 @@ export const createPlugin = (
135
135
  isSSR() && fg('platform_editor_table_fallback_to_dom_on_ssr')
136
136
  ? undefined
137
137
  : {
138
- table: lazyTableView({
138
+ table: tableView({
139
139
  portalProviderAPI,
140
140
  eventDispatcher,
141
141
  getEditorContainerWidth,
@@ -145,9 +145,9 @@ export const createPlugin = (
145
145
  isCommentEditor,
146
146
  isChromelessEditor,
147
147
  }),
148
- tableRow: lazyTableRowView({ eventDispatcher }),
149
- tableCell: lazyTableCellView({ eventDispatcher, pluginInjectionApi }),
150
- tableHeader: lazyTableHeaderView({ eventDispatcher, pluginInjectionApi }),
148
+ tableRow: tableRowView({ eventDispatcher }),
149
+ tableCell: tableCellView({ eventDispatcher, pluginInjectionApi }),
150
+ tableHeader: tableHeaderView({ eventDispatcher, pluginInjectionApi }),
151
151
  };
152
152
  return new SafePlugin({
153
153
  state: state,
@@ -1,148 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.lazyTableView = exports.lazyTableRowView = exports.lazyTableHeaderView = exports.lazyTableCellView = void 0;
8
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
- var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
10
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
- var _table = require("./table");
13
- var _TableCell = _interopRequireDefault(require("./TableCell"));
14
- var _TableRow = _interopRequireDefault(require("./TableRow"));
15
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != (0, _typeof2.default)(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } // TODO: ED-23976 - Clean up
16
- var lazyTableView = exports.lazyTableView = function lazyTableView(options) {
17
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
18
- // Enabling them again via the platform_editor_enable_table_lnv flag.
19
- if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false) || !(0, _platformFeatureFlags.fg)('platform_editor_enable_table_lnv') && (0, _platformFeatureFlags.fg)('platform_editor_disable_table_lnv')) {
20
- return function (node, view, getPos) {
21
- return (0, _table.createTableView)(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isCommentEditor, options.isChromelessEditor);
22
- };
23
- }
24
- var loader = function loader() {
25
- var result = Promise.resolve().then(function () {
26
- return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-plugin-table_nodeview" */
27
- './table'));
28
- }).then(function (_ref) {
29
- var createTableView = _ref.createTableView;
30
- return function (node, view, getPos, decorations, getNodeViewOptions) {
31
- var _getNodeViewOptions = getNodeViewOptions(),
32
- portalProviderAPI = _getNodeViewOptions.portalProviderAPI,
33
- eventDispatcher = _getNodeViewOptions.eventDispatcher,
34
- getEditorContainerWidth = _getNodeViewOptions.getEditorContainerWidth,
35
- getEditorFeatureFlags = _getNodeViewOptions.getEditorFeatureFlags,
36
- dispatchAnalyticsEvent = _getNodeViewOptions.dispatchAnalyticsEvent,
37
- pluginInjectionApi = _getNodeViewOptions.pluginInjectionApi,
38
- isCommentEditor = _getNodeViewOptions.isCommentEditor,
39
- isChromelessEditor = _getNodeViewOptions.isChromelessEditor;
40
- return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor);
41
- };
42
- });
43
- return result;
44
- };
45
- return (0, _lazyNodeView.withLazyLoading)({
46
- nodeName: 'table',
47
- getNodeViewOptions: function getNodeViewOptions() {
48
- return options;
49
- },
50
- loader: loader
51
- });
52
- };
53
- var lazyTableCellView = exports.lazyTableCellView = function lazyTableCellView(options) {
54
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
55
- // Enabling them again via the platform_editor_enable_table_lnv flag.
56
- if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false) || !(0, _platformFeatureFlags.fg)('platform_editor_enable_table_lnv') && (0, _platformFeatureFlags.fg)('platform_editor_disable_table_lnv')) {
57
- return function (node, view, getPos) {
58
- var _options$pluginInject;
59
- 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);
60
- };
61
- }
62
- var loader = function loader() {
63
- var result = Promise.resolve().then(function () {
64
- return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-plugin-table_nodeview" */
65
- './TableCell'));
66
- }).then(function (_ref2) {
67
- var TableCell = _ref2.default;
68
- return function (node, view, getPos, decorations, getNodeViewOptions) {
69
- var _pluginInjectionApi$a;
70
- var _getNodeViewOptions2 = getNodeViewOptions(),
71
- eventDispatcher = _getNodeViewOptions2.eventDispatcher,
72
- pluginInjectionApi = _getNodeViewOptions2.pluginInjectionApi;
73
- return new TableCell(node, view, getPos, eventDispatcher, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions);
74
- };
75
- });
76
- return result;
77
- };
78
- return (0, _lazyNodeView.withLazyLoading)({
79
- nodeName: 'tableCell',
80
- getNodeViewOptions: function getNodeViewOptions() {
81
- return options;
82
- },
83
- loader: loader
84
- });
85
- };
86
- var lazyTableHeaderView = exports.lazyTableHeaderView = function lazyTableHeaderView(options) {
87
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
88
- // Enabling them again via the platform_editor_enable_table_lnv flag.
89
- if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false) || !(0, _platformFeatureFlags.fg)('platform_editor_enable_table_lnv') && (0, _platformFeatureFlags.fg)('platform_editor_disable_table_lnv')) {
90
- return function (node, view, getPos) {
91
- var _options$pluginInject2;
92
- 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);
93
- };
94
- }
95
- var loader = function loader() {
96
- var result = Promise.resolve().then(function () {
97
- return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-plugin-table-cell_nodeview" */
98
- './TableCell'));
99
- }).then(function (_ref3) {
100
- var TableCell = _ref3.default;
101
- return function (node, view, getPos, decorations, getNodeViewOptions) {
102
- var _pluginInjectionApi$a2;
103
- var _getNodeViewOptions3 = getNodeViewOptions(),
104
- eventDispatcher = _getNodeViewOptions3.eventDispatcher,
105
- pluginInjectionApi = _getNodeViewOptions3.pluginInjectionApi;
106
- return new TableCell(node, view, getPos, eventDispatcher, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions);
107
- };
108
- });
109
- return result;
110
- };
111
- return (0, _lazyNodeView.withLazyLoading)({
112
- nodeName: 'tableHeader',
113
- getNodeViewOptions: function getNodeViewOptions() {
114
- return options;
115
- },
116
- loader: loader
117
- });
118
- };
119
- var lazyTableRowView = exports.lazyTableRowView = function lazyTableRowView(options) {
120
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
121
- // Enabling them again via the platform_editor_enable_table_lnv flag.
122
- if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false) || !(0, _platformFeatureFlags.fg)('platform_editor_enable_table_lnv') && (0, _platformFeatureFlags.fg)('platform_editor_disable_table_lnv')) {
123
- return function (node, view, getPos) {
124
- return new _TableRow.default(node, view, getPos, options.eventDispatcher);
125
- };
126
- }
127
- var loader = function loader() {
128
- var result = Promise.resolve().then(function () {
129
- return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-plugin-table-row_nodeview" */
130
- './TableRow'));
131
- }).then(function (_ref4) {
132
- var TableRow = _ref4.default;
133
- return function (node, view, getPos, decorations, getNodeViewOptions) {
134
- var _getNodeViewOptions4 = getNodeViewOptions(),
135
- eventDispatcher = _getNodeViewOptions4.eventDispatcher;
136
- return new TableRow(node, view, getPos, eventDispatcher);
137
- };
138
- });
139
- return result;
140
- };
141
- return (0, _lazyNodeView.withLazyLoading)({
142
- nodeName: 'tableRow',
143
- getNodeViewOptions: function getNodeViewOptions() {
144
- return options;
145
- },
146
- loader: loader
147
- });
148
- };
@@ -1,132 +0,0 @@
1
- import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
- // TODO: ED-23976 - Clean up
5
- import { createTableView } from './table';
6
- import TableCell from './TableCell';
7
- import TableRow from './TableRow';
8
- export const lazyTableView = options => {
9
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
10
- // Enabling them again via the platform_editor_enable_table_lnv flag.
11
- if (editorExperiment('platform_editor_exp_lazy_node_views', false) || !fg('platform_editor_enable_table_lnv') && fg('platform_editor_disable_table_lnv')) {
12
- return (node, view, getPos) => {
13
- return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isCommentEditor, options.isChromelessEditor);
14
- };
15
- }
16
- const loader = () => {
17
- const result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-table_nodeview" */
18
- './table').then(({
19
- createTableView
20
- }) => {
21
- return (node, view, getPos, decorations, getNodeViewOptions) => {
22
- const {
23
- portalProviderAPI,
24
- eventDispatcher,
25
- getEditorContainerWidth,
26
- getEditorFeatureFlags,
27
- dispatchAnalyticsEvent,
28
- pluginInjectionApi,
29
- isCommentEditor,
30
- isChromelessEditor
31
- } = getNodeViewOptions();
32
- return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor);
33
- };
34
- });
35
- return result;
36
- };
37
- return withLazyLoading({
38
- nodeName: 'table',
39
- getNodeViewOptions: () => options,
40
- loader
41
- });
42
- };
43
- export const lazyTableCellView = options => {
44
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
45
- // Enabling them again via the platform_editor_enable_table_lnv flag.
46
- if (editorExperiment('platform_editor_exp_lazy_node_views', false) || !fg('platform_editor_enable_table_lnv') && fg('platform_editor_disable_table_lnv')) {
47
- return (node, view, getPos) => {
48
- var _options$pluginInject, _options$pluginInject2;
49
- 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);
50
- };
51
- }
52
- const loader = () => {
53
- const result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-table_nodeview" */
54
- './TableCell').then(({
55
- default: TableCell
56
- }) => {
57
- return (node, view, getPos, decorations, getNodeViewOptions) => {
58
- var _pluginInjectionApi$a;
59
- const {
60
- eventDispatcher,
61
- pluginInjectionApi
62
- } = getNodeViewOptions();
63
- return new TableCell(node, view, getPos, eventDispatcher, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions);
64
- };
65
- });
66
- return result;
67
- };
68
- return withLazyLoading({
69
- nodeName: 'tableCell',
70
- getNodeViewOptions: () => options,
71
- loader
72
- });
73
- };
74
- export const lazyTableHeaderView = options => {
75
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
76
- // Enabling them again via the platform_editor_enable_table_lnv flag.
77
- if (editorExperiment('platform_editor_exp_lazy_node_views', false) || !fg('platform_editor_enable_table_lnv') && fg('platform_editor_disable_table_lnv')) {
78
- return (node, view, getPos) => {
79
- var _options$pluginInject3, _options$pluginInject4;
80
- 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);
81
- };
82
- }
83
- const loader = () => {
84
- const result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-table-cell_nodeview" */
85
- './TableCell').then(({
86
- default: TableCell
87
- }) => {
88
- return (node, view, getPos, decorations, getNodeViewOptions) => {
89
- var _pluginInjectionApi$a2;
90
- const {
91
- eventDispatcher,
92
- pluginInjectionApi
93
- } = getNodeViewOptions();
94
- return new TableCell(node, view, getPos, eventDispatcher, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions);
95
- };
96
- });
97
- return result;
98
- };
99
- return withLazyLoading({
100
- nodeName: 'tableHeader',
101
- getNodeViewOptions: () => options,
102
- loader
103
- });
104
- };
105
- export const lazyTableRowView = options => {
106
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
107
- // Enabling them again via the platform_editor_enable_table_lnv flag.
108
- if (editorExperiment('platform_editor_exp_lazy_node_views', false) || !fg('platform_editor_enable_table_lnv') && fg('platform_editor_disable_table_lnv')) {
109
- return (node, view, getPos) => {
110
- return new TableRow(node, view, getPos, options.eventDispatcher);
111
- };
112
- }
113
- const loader = () => {
114
- const result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-table-row_nodeview" */
115
- './TableRow').then(({
116
- default: TableRow
117
- }) => {
118
- return (node, view, getPos, decorations, getNodeViewOptions) => {
119
- const {
120
- eventDispatcher
121
- } = getNodeViewOptions();
122
- return new TableRow(node, view, getPos, eventDispatcher);
123
- };
124
- });
125
- return result;
126
- };
127
- return withLazyLoading({
128
- nodeName: 'tableRow',
129
- getNodeViewOptions: () => options,
130
- loader
131
- });
132
- };
@@ -1,132 +0,0 @@
1
- import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
- // TODO: ED-23976 - Clean up
5
- import { createTableView } from './table';
6
- import TableCell from './TableCell';
7
- import TableRow from './TableRow';
8
- export var lazyTableView = function lazyTableView(options) {
9
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
10
- // Enabling them again via the platform_editor_enable_table_lnv flag.
11
- if (editorExperiment('platform_editor_exp_lazy_node_views', false) || !fg('platform_editor_enable_table_lnv') && fg('platform_editor_disable_table_lnv')) {
12
- return function (node, view, getPos) {
13
- return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isCommentEditor, options.isChromelessEditor);
14
- };
15
- }
16
- var loader = function loader() {
17
- var result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-table_nodeview" */
18
- './table').then(function (_ref) {
19
- var createTableView = _ref.createTableView;
20
- return function (node, view, getPos, decorations, getNodeViewOptions) {
21
- var _getNodeViewOptions = getNodeViewOptions(),
22
- portalProviderAPI = _getNodeViewOptions.portalProviderAPI,
23
- eventDispatcher = _getNodeViewOptions.eventDispatcher,
24
- getEditorContainerWidth = _getNodeViewOptions.getEditorContainerWidth,
25
- getEditorFeatureFlags = _getNodeViewOptions.getEditorFeatureFlags,
26
- dispatchAnalyticsEvent = _getNodeViewOptions.dispatchAnalyticsEvent,
27
- pluginInjectionApi = _getNodeViewOptions.pluginInjectionApi,
28
- isCommentEditor = _getNodeViewOptions.isCommentEditor,
29
- isChromelessEditor = _getNodeViewOptions.isChromelessEditor;
30
- return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isCommentEditor, isChromelessEditor);
31
- };
32
- });
33
- return result;
34
- };
35
- return withLazyLoading({
36
- nodeName: 'table',
37
- getNodeViewOptions: function getNodeViewOptions() {
38
- return options;
39
- },
40
- loader: loader
41
- });
42
- };
43
- export var lazyTableCellView = function lazyTableCellView(options) {
44
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
45
- // Enabling them again via the platform_editor_enable_table_lnv flag.
46
- if (editorExperiment('platform_editor_exp_lazy_node_views', false) || !fg('platform_editor_enable_table_lnv') && fg('platform_editor_disable_table_lnv')) {
47
- return function (node, view, getPos) {
48
- var _options$pluginInject;
49
- 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);
50
- };
51
- }
52
- var loader = function loader() {
53
- var result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-table_nodeview" */
54
- './TableCell').then(function (_ref2) {
55
- var TableCell = _ref2.default;
56
- return function (node, view, getPos, decorations, getNodeViewOptions) {
57
- var _pluginInjectionApi$a;
58
- var _getNodeViewOptions2 = getNodeViewOptions(),
59
- eventDispatcher = _getNodeViewOptions2.eventDispatcher,
60
- pluginInjectionApi = _getNodeViewOptions2.pluginInjectionApi;
61
- return new TableCell(node, view, getPos, eventDispatcher, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions);
62
- };
63
- });
64
- return result;
65
- };
66
- return withLazyLoading({
67
- nodeName: 'tableCell',
68
- getNodeViewOptions: function getNodeViewOptions() {
69
- return options;
70
- },
71
- loader: loader
72
- });
73
- };
74
- export var lazyTableHeaderView = function lazyTableHeaderView(options) {
75
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
76
- // Enabling them again via the platform_editor_enable_table_lnv flag.
77
- if (editorExperiment('platform_editor_exp_lazy_node_views', false) || !fg('platform_editor_enable_table_lnv') && fg('platform_editor_disable_table_lnv')) {
78
- return function (node, view, getPos) {
79
- var _options$pluginInject2;
80
- 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);
81
- };
82
- }
83
- var loader = function loader() {
84
- var result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-table-cell_nodeview" */
85
- './TableCell').then(function (_ref3) {
86
- var TableCell = _ref3.default;
87
- return function (node, view, getPos, decorations, getNodeViewOptions) {
88
- var _pluginInjectionApi$a2;
89
- var _getNodeViewOptions3 = getNodeViewOptions(),
90
- eventDispatcher = _getNodeViewOptions3.eventDispatcher,
91
- pluginInjectionApi = _getNodeViewOptions3.pluginInjectionApi;
92
- return new TableCell(node, view, getPos, eventDispatcher, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions);
93
- };
94
- });
95
- return result;
96
- };
97
- return withLazyLoading({
98
- nodeName: 'tableHeader',
99
- getNodeViewOptions: function getNodeViewOptions() {
100
- return options;
101
- },
102
- loader: loader
103
- });
104
- };
105
- export var lazyTableRowView = function lazyTableRowView(options) {
106
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
107
- // Enabling them again via the platform_editor_enable_table_lnv flag.
108
- if (editorExperiment('platform_editor_exp_lazy_node_views', false) || !fg('platform_editor_enable_table_lnv') && fg('platform_editor_disable_table_lnv')) {
109
- return function (node, view, getPos) {
110
- return new TableRow(node, view, getPos, options.eventDispatcher);
111
- };
112
- }
113
- var loader = function loader() {
114
- var result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-table-row_nodeview" */
115
- './TableRow').then(function (_ref4) {
116
- var TableRow = _ref4.default;
117
- return function (node, view, getPos, decorations, getNodeViewOptions) {
118
- var _getNodeViewOptions4 = getNodeViewOptions(),
119
- eventDispatcher = _getNodeViewOptions4.eventDispatcher;
120
- return new TableRow(node, view, getPos, eventDispatcher);
121
- };
122
- });
123
- return result;
124
- };
125
- return withLazyLoading({
126
- nodeName: 'tableRow',
127
- getNodeViewOptions: function getNodeViewOptions() {
128
- return options;
129
- },
130
- loader: loader
131
- });
132
- };
@@ -1,246 +0,0 @@
1
- import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
- import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
- import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
4
- import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
5
- import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
6
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
7
- import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
-
11
- import type { PluginInjectionAPI } from '../types';
12
-
13
- // TODO: ED-23976 - Clean up
14
- import { createTableView } from './table';
15
- import TableCell from './TableCell';
16
- import TableRow from './TableRow';
17
-
18
- type TableViewOptions = {
19
- portalProviderAPI: PortalProviderAPI;
20
- eventDispatcher: EventDispatcher;
21
- getEditorContainerWidth: GetEditorContainerWidth;
22
- getEditorFeatureFlags: GetEditorFeatureFlags;
23
- dispatchAnalyticsEvent: DispatchAnalyticsEvent;
24
- pluginInjectionApi?: PluginInjectionAPI;
25
- isCommentEditor?: boolean;
26
- isChromelessEditor?: boolean;
27
- };
28
-
29
- export const lazyTableView = (options: TableViewOptions) => {
30
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
31
- // Enabling them again via the platform_editor_enable_table_lnv flag.
32
- if (
33
- editorExperiment('platform_editor_exp_lazy_node_views', false) ||
34
- (!fg('platform_editor_enable_table_lnv') && fg('platform_editor_disable_table_lnv'))
35
- ) {
36
- return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
37
- return createTableView(
38
- node,
39
- view,
40
- getPos,
41
- options.portalProviderAPI,
42
- options.eventDispatcher,
43
- options.getEditorContainerWidth,
44
- options.getEditorFeatureFlags,
45
- options.dispatchAnalyticsEvent,
46
- options.pluginInjectionApi,
47
- options.isCommentEditor,
48
- options.isChromelessEditor,
49
- );
50
- };
51
- }
52
-
53
- const loader = () => {
54
- const result = import(
55
- /* webpackChunkName: "@atlaskit-internal_editor-plugin-table_nodeview" */
56
- './table'
57
- ).then(({ createTableView }) => {
58
- return (
59
- node: PMNode,
60
- view: EditorView,
61
- getPos: () => number | undefined,
62
- decorations: readonly Decoration[],
63
- getNodeViewOptions: () => TableViewOptions,
64
- ) => {
65
- const {
66
- portalProviderAPI,
67
- eventDispatcher,
68
- getEditorContainerWidth,
69
- getEditorFeatureFlags,
70
- dispatchAnalyticsEvent,
71
- pluginInjectionApi,
72
- isCommentEditor,
73
- isChromelessEditor,
74
- } = getNodeViewOptions();
75
-
76
- return createTableView(
77
- node,
78
- view,
79
- getPos,
80
- portalProviderAPI,
81
- eventDispatcher,
82
- getEditorContainerWidth,
83
- getEditorFeatureFlags,
84
- dispatchAnalyticsEvent,
85
- pluginInjectionApi,
86
- isCommentEditor,
87
- isChromelessEditor,
88
- );
89
- };
90
- });
91
-
92
- return result;
93
- };
94
- return withLazyLoading({
95
- nodeName: 'table',
96
- getNodeViewOptions: () => options,
97
- loader,
98
- });
99
- };
100
-
101
- type TableCellViewOptions = {
102
- eventDispatcher: EventDispatcher;
103
- pluginInjectionApi?: PluginInjectionAPI;
104
- };
105
- export const lazyTableCellView = (options: TableCellViewOptions) => {
106
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
107
- // Enabling them again via the platform_editor_enable_table_lnv flag.
108
- if (
109
- editorExperiment('platform_editor_exp_lazy_node_views', false) ||
110
- (!fg('platform_editor_enable_table_lnv') && fg('platform_editor_disable_table_lnv'))
111
- ) {
112
- return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
113
- return new TableCell(
114
- node,
115
- view,
116
- getPos,
117
- options.eventDispatcher,
118
- options.pluginInjectionApi?.analytics?.actions,
119
- );
120
- };
121
- }
122
-
123
- const loader = () => {
124
- const result = import(
125
- /* webpackChunkName: "@atlaskit-internal_editor-plugin-table_nodeview" */
126
- './TableCell'
127
- ).then(({ default: TableCell }) => {
128
- return (
129
- node: PMNode,
130
- view: EditorView,
131
- getPos: () => number | undefined,
132
- decorations: readonly Decoration[],
133
- getNodeViewOptions: () => TableCellViewOptions,
134
- ) => {
135
- const { eventDispatcher, pluginInjectionApi } = getNodeViewOptions();
136
-
137
- return new TableCell(
138
- node,
139
- view,
140
- getPos,
141
- eventDispatcher,
142
- pluginInjectionApi?.analytics?.actions,
143
- );
144
- };
145
- });
146
-
147
- return result;
148
- };
149
-
150
- return withLazyLoading({
151
- nodeName: 'tableCell',
152
- getNodeViewOptions: () => options,
153
- loader,
154
- });
155
- };
156
-
157
- export const lazyTableHeaderView = (options: TableCellViewOptions) => {
158
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
159
- // Enabling them again via the platform_editor_enable_table_lnv flag.
160
- if (
161
- editorExperiment('platform_editor_exp_lazy_node_views', false) ||
162
- (!fg('platform_editor_enable_table_lnv') && fg('platform_editor_disable_table_lnv'))
163
- ) {
164
- return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
165
- return new TableCell(
166
- node,
167
- view,
168
- getPos,
169
- options.eventDispatcher,
170
- options.pluginInjectionApi?.analytics?.actions,
171
- );
172
- };
173
- }
174
-
175
- const loader = () => {
176
- const result = import(
177
- /* webpackChunkName: "@atlaskit-internal_editor-plugin-table-cell_nodeview" */
178
- './TableCell'
179
- ).then(({ default: TableCell }) => {
180
- return (
181
- node: PMNode,
182
- view: EditorView,
183
- getPos: () => number | undefined,
184
- decorations: readonly Decoration[],
185
- getNodeViewOptions: () => TableCellViewOptions,
186
- ) => {
187
- const { eventDispatcher, pluginInjectionApi } = getNodeViewOptions();
188
-
189
- return new TableCell(
190
- node,
191
- view,
192
- getPos,
193
- eventDispatcher,
194
- pluginInjectionApi?.analytics?.actions,
195
- );
196
- };
197
- });
198
-
199
- return result;
200
- };
201
-
202
- return withLazyLoading({
203
- nodeName: 'tableHeader',
204
- getNodeViewOptions: () => options,
205
- loader,
206
- });
207
- };
208
-
209
- export const lazyTableRowView = (options: TableCellViewOptions) => {
210
- // LNV tables were broken in concurrent mode - they were temporarily disabled to unblock concurrent mode.
211
- // Enabling them again via the platform_editor_enable_table_lnv flag.
212
- if (
213
- editorExperiment('platform_editor_exp_lazy_node_views', false) ||
214
- (!fg('platform_editor_enable_table_lnv') && fg('platform_editor_disable_table_lnv'))
215
- ) {
216
- return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
217
- return new TableRow(node, view, getPos, options.eventDispatcher);
218
- };
219
- }
220
-
221
- const loader = () => {
222
- const result = import(
223
- /* webpackChunkName: "@atlaskit-internal_editor-plugin-table-row_nodeview" */
224
- './TableRow'
225
- ).then(({ default: TableRow }) => {
226
- return (
227
- node: PMNode,
228
- view: EditorView,
229
- getPos: () => number | undefined,
230
- decorations: readonly Decoration[],
231
- getNodeViewOptions: () => TableCellViewOptions,
232
- ) => {
233
- const { eventDispatcher } = getNodeViewOptions();
234
-
235
- return new TableRow(node, view, getPos, eventDispatcher);
236
- };
237
- });
238
-
239
- return result;
240
- };
241
- return withLazyLoading({
242
- nodeName: 'tableRow',
243
- getNodeViewOptions: () => options,
244
- loader,
245
- });
246
- };