@atlaskit/editor-plugin-table 3.1.1 → 3.1.2
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 +6 -0
- package/dist/cjs/plugins/table/nodeviews/table.js +12 -3
- package/dist/cjs/plugins/table/pm-plugins/main.js +5 -15
- package/dist/es2019/plugins/table/nodeviews/table.js +12 -3
- package/dist/es2019/plugins/table/pm-plugins/main.js +5 -15
- package/dist/esm/plugins/table/nodeviews/table.js +12 -3
- package/dist/esm/plugins/table/pm-plugins/main.js +5 -15
- package/dist/types/plugins/table/nodeviews/table.d.ts +2 -2
- package/dist/types/plugins/table/types.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/types.d.ts +3 -0
- package/package.json +2 -2
- package/src/plugins/table/nodeviews/table.tsx +14 -4
- package/src/plugins/table/pm-plugins/main.ts +4 -17
- package/src/plugins/table/types.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 3.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`866a47baae3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/866a47baae3) - Moved the cache FF variables from global to plugin state, to avoid other editor instances from overriding them
|
|
8
|
+
|
|
3
9
|
## 3.1.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -249,9 +249,13 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
249
249
|
return TableView;
|
|
250
250
|
}(_reactNodeView.default);
|
|
251
251
|
exports.default = TableView;
|
|
252
|
-
var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher,
|
|
252
|
+
var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi) {
|
|
253
253
|
var _getPluginState2 = (0, _pluginFactory.getPluginState)(view.state),
|
|
254
|
-
pluginConfig = _getPluginState2.pluginConfig
|
|
254
|
+
pluginConfig = _getPluginState2.pluginConfig,
|
|
255
|
+
isBreakoutEnabled = _getPluginState2.isBreakoutEnabled,
|
|
256
|
+
isFullWidthModeEnabled = _getPluginState2.isFullWidthModeEnabled,
|
|
257
|
+
wasFullWidthModeEnabled = _getPluginState2.wasFullWidthModeEnabled,
|
|
258
|
+
isTableResizingEnabled = _getPluginState2.isTableResizingEnabled;
|
|
255
259
|
var _getPluginConfig = (0, _createPluginConfig.pluginConfig)(pluginConfig),
|
|
256
260
|
allowColumnResizing = _getPluginConfig.allowColumnResizing;
|
|
257
261
|
var hasIntlContext = true;
|
|
@@ -262,7 +266,12 @@ var createTableView = function createTableView(node, view, getPos, portalProvide
|
|
|
262
266
|
portalProviderAPI: portalProviderAPI,
|
|
263
267
|
eventDispatcher: eventDispatcher,
|
|
264
268
|
getPos: getPos,
|
|
265
|
-
options:
|
|
269
|
+
options: {
|
|
270
|
+
isBreakoutEnabled: isBreakoutEnabled,
|
|
271
|
+
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
272
|
+
wasFullWidthModeEnabled: wasFullWidthModeEnabled,
|
|
273
|
+
isTableResizingEnabled: isTableResizingEnabled
|
|
274
|
+
},
|
|
266
275
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
267
276
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
268
277
|
hasIntlContext: hasIntlContext,
|
|
@@ -29,21 +29,16 @@ var _pluginFactory = require("./plugin-factory");
|
|
|
29
29
|
var _pluginKey = require("./plugin-key");
|
|
30
30
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
31
31
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
32
|
-
var isBreakoutEnabled;
|
|
33
|
-
var isFullWidthModeEnabled;
|
|
34
|
-
var wasFullWidthModeEnabled;
|
|
35
|
-
var isTableResizingEnabled;
|
|
36
32
|
var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthModeEnabled, tableResizingEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi) {
|
|
37
33
|
var _window;
|
|
38
|
-
isBreakoutEnabled = breakoutEnabled;
|
|
39
|
-
isFullWidthModeEnabled = fullWidthModeEnabled;
|
|
40
|
-
wasFullWidthModeEnabled = previousFullWidthModeEnabled;
|
|
41
|
-
isTableResizingEnabled = tableResizingEnabled;
|
|
42
34
|
var state = (0, _pluginFactory.createPluginState)(dispatch, _objectSpread(_objectSpread({
|
|
43
35
|
pluginConfig: pluginConfig,
|
|
44
36
|
insertColumnButtonIndex: undefined,
|
|
45
37
|
insertRowButtonIndex: undefined,
|
|
46
|
-
isFullWidthModeEnabled:
|
|
38
|
+
isFullWidthModeEnabled: fullWidthModeEnabled,
|
|
39
|
+
isBreakoutEnabled: breakoutEnabled,
|
|
40
|
+
wasFullWidthModeEnabled: previousFullWidthModeEnabled,
|
|
41
|
+
isTableResizingEnabled: tableResizingEnabled,
|
|
47
42
|
isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
|
|
48
43
|
isHeaderColumnEnabled: false
|
|
49
44
|
}, _defaultTableSelection.defaultTableSelection), {}, {
|
|
@@ -243,12 +238,7 @@ var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, porta
|
|
|
243
238
|
},
|
|
244
239
|
nodeViews: _objectSpread(_objectSpread({}, tableCellNodeview), {}, {
|
|
245
240
|
table: function table(node, view, getPos) {
|
|
246
|
-
return (0, _table.createTableView)(node, view, getPos, portalProviderAPI, eventDispatcher,
|
|
247
|
-
isBreakoutEnabled: isBreakoutEnabled,
|
|
248
|
-
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
249
|
-
wasFullWidthModeEnabled: wasFullWidthModeEnabled,
|
|
250
|
-
isTableResizingEnabled: isTableResizingEnabled
|
|
251
|
-
}, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi);
|
|
241
|
+
return (0, _table.createTableView)(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi);
|
|
252
242
|
}
|
|
253
243
|
}),
|
|
254
244
|
handleDOMEvents: {
|
|
@@ -216,9 +216,13 @@ export default class TableView extends ReactNodeView {
|
|
|
216
216
|
super.destroy();
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
export const createTableView = (node, view, getPos, portalProviderAPI, eventDispatcher,
|
|
219
|
+
export const createTableView = (node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi) => {
|
|
220
220
|
const {
|
|
221
|
-
pluginConfig
|
|
221
|
+
pluginConfig,
|
|
222
|
+
isBreakoutEnabled,
|
|
223
|
+
isFullWidthModeEnabled,
|
|
224
|
+
wasFullWidthModeEnabled,
|
|
225
|
+
isTableResizingEnabled
|
|
222
226
|
} = getPluginState(view.state);
|
|
223
227
|
const {
|
|
224
228
|
allowColumnResizing
|
|
@@ -231,7 +235,12 @@ export const createTableView = (node, view, getPos, portalProviderAPI, eventDisp
|
|
|
231
235
|
portalProviderAPI,
|
|
232
236
|
eventDispatcher,
|
|
233
237
|
getPos: getPos,
|
|
234
|
-
options
|
|
238
|
+
options: {
|
|
239
|
+
isBreakoutEnabled,
|
|
240
|
+
isFullWidthModeEnabled,
|
|
241
|
+
wasFullWidthModeEnabled,
|
|
242
|
+
isTableResizingEnabled
|
|
243
|
+
},
|
|
235
244
|
getEditorContainerWidth,
|
|
236
245
|
getEditorFeatureFlags,
|
|
237
246
|
hasIntlContext,
|
|
@@ -19,21 +19,16 @@ import { isHeaderRowRequired } from '../utils/paste';
|
|
|
19
19
|
import { defaultTableSelection } from './default-table-selection';
|
|
20
20
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
21
21
|
import { pluginKey } from './plugin-key';
|
|
22
|
-
let isBreakoutEnabled;
|
|
23
|
-
let isFullWidthModeEnabled;
|
|
24
|
-
let wasFullWidthModeEnabled;
|
|
25
|
-
let isTableResizingEnabled;
|
|
26
22
|
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthModeEnabled, tableResizingEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi) => {
|
|
27
23
|
var _window;
|
|
28
|
-
isBreakoutEnabled = breakoutEnabled;
|
|
29
|
-
isFullWidthModeEnabled = fullWidthModeEnabled;
|
|
30
|
-
wasFullWidthModeEnabled = previousFullWidthModeEnabled;
|
|
31
|
-
isTableResizingEnabled = tableResizingEnabled;
|
|
32
24
|
const state = createPluginState(dispatch, {
|
|
33
25
|
pluginConfig,
|
|
34
26
|
insertColumnButtonIndex: undefined,
|
|
35
27
|
insertRowButtonIndex: undefined,
|
|
36
|
-
isFullWidthModeEnabled,
|
|
28
|
+
isFullWidthModeEnabled: fullWidthModeEnabled,
|
|
29
|
+
isBreakoutEnabled: breakoutEnabled,
|
|
30
|
+
wasFullWidthModeEnabled: previousFullWidthModeEnabled,
|
|
31
|
+
isTableResizingEnabled: tableResizingEnabled,
|
|
37
32
|
isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
|
|
38
33
|
isHeaderColumnEnabled: false,
|
|
39
34
|
...defaultTableSelection,
|
|
@@ -234,12 +229,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
234
229
|
},
|
|
235
230
|
nodeViews: {
|
|
236
231
|
...tableCellNodeview,
|
|
237
|
-
table: (node, view, getPos) => createTableView(node, view, getPos, portalProviderAPI, eventDispatcher,
|
|
238
|
-
isBreakoutEnabled,
|
|
239
|
-
isFullWidthModeEnabled,
|
|
240
|
-
wasFullWidthModeEnabled,
|
|
241
|
-
isTableResizingEnabled
|
|
242
|
-
}, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi)
|
|
232
|
+
table: (node, view, getPos) => createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi)
|
|
243
233
|
},
|
|
244
234
|
handleDOMEvents: {
|
|
245
235
|
focus: handleFocus,
|
|
@@ -242,9 +242,13 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
242
242
|
return TableView;
|
|
243
243
|
}(ReactNodeView);
|
|
244
244
|
export { TableView as default };
|
|
245
|
-
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher,
|
|
245
|
+
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi) {
|
|
246
246
|
var _getPluginState2 = getPluginState(view.state),
|
|
247
|
-
pluginConfig = _getPluginState2.pluginConfig
|
|
247
|
+
pluginConfig = _getPluginState2.pluginConfig,
|
|
248
|
+
isBreakoutEnabled = _getPluginState2.isBreakoutEnabled,
|
|
249
|
+
isFullWidthModeEnabled = _getPluginState2.isFullWidthModeEnabled,
|
|
250
|
+
wasFullWidthModeEnabled = _getPluginState2.wasFullWidthModeEnabled,
|
|
251
|
+
isTableResizingEnabled = _getPluginState2.isTableResizingEnabled;
|
|
248
252
|
var _getPluginConfig = getPluginConfig(pluginConfig),
|
|
249
253
|
allowColumnResizing = _getPluginConfig.allowColumnResizing;
|
|
250
254
|
var hasIntlContext = true;
|
|
@@ -255,7 +259,12 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
255
259
|
portalProviderAPI: portalProviderAPI,
|
|
256
260
|
eventDispatcher: eventDispatcher,
|
|
257
261
|
getPos: getPos,
|
|
258
|
-
options:
|
|
262
|
+
options: {
|
|
263
|
+
isBreakoutEnabled: isBreakoutEnabled,
|
|
264
|
+
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
265
|
+
wasFullWidthModeEnabled: wasFullWidthModeEnabled,
|
|
266
|
+
isTableResizingEnabled: isTableResizingEnabled
|
|
267
|
+
},
|
|
259
268
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
260
269
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
261
270
|
hasIntlContext: hasIntlContext,
|
|
@@ -22,21 +22,16 @@ import { isHeaderRowRequired } from '../utils/paste';
|
|
|
22
22
|
import { defaultTableSelection } from './default-table-selection';
|
|
23
23
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
24
24
|
import { pluginKey } from './plugin-key';
|
|
25
|
-
var isBreakoutEnabled;
|
|
26
|
-
var isFullWidthModeEnabled;
|
|
27
|
-
var wasFullWidthModeEnabled;
|
|
28
|
-
var isTableResizingEnabled;
|
|
29
25
|
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthModeEnabled, tableResizingEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi) {
|
|
30
26
|
var _window;
|
|
31
|
-
isBreakoutEnabled = breakoutEnabled;
|
|
32
|
-
isFullWidthModeEnabled = fullWidthModeEnabled;
|
|
33
|
-
wasFullWidthModeEnabled = previousFullWidthModeEnabled;
|
|
34
|
-
isTableResizingEnabled = tableResizingEnabled;
|
|
35
27
|
var state = createPluginState(dispatch, _objectSpread(_objectSpread({
|
|
36
28
|
pluginConfig: pluginConfig,
|
|
37
29
|
insertColumnButtonIndex: undefined,
|
|
38
30
|
insertRowButtonIndex: undefined,
|
|
39
|
-
isFullWidthModeEnabled:
|
|
31
|
+
isFullWidthModeEnabled: fullWidthModeEnabled,
|
|
32
|
+
isBreakoutEnabled: breakoutEnabled,
|
|
33
|
+
wasFullWidthModeEnabled: previousFullWidthModeEnabled,
|
|
34
|
+
isTableResizingEnabled: tableResizingEnabled,
|
|
40
35
|
isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
|
|
41
36
|
isHeaderColumnEnabled: false
|
|
42
37
|
}, defaultTableSelection), {}, {
|
|
@@ -236,12 +231,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
236
231
|
},
|
|
237
232
|
nodeViews: _objectSpread(_objectSpread({}, tableCellNodeview), {}, {
|
|
238
233
|
table: function table(node, view, getPos) {
|
|
239
|
-
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher,
|
|
240
|
-
isBreakoutEnabled: isBreakoutEnabled,
|
|
241
|
-
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
242
|
-
wasFullWidthModeEnabled: wasFullWidthModeEnabled,
|
|
243
|
-
isTableResizingEnabled: isTableResizingEnabled
|
|
244
|
-
}, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi);
|
|
234
|
+
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi);
|
|
245
235
|
}
|
|
246
236
|
}),
|
|
247
237
|
handleDOMEvents: {
|
|
@@ -6,7 +6,7 @@ import type { GetEditorContainerWidth, GetEditorFeatureFlags, getPosHandler, get
|
|
|
6
6
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
7
|
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import type { PluginInjectionAPI } from '../types';
|
|
9
|
-
import type { Props
|
|
9
|
+
import type { Props } from './types';
|
|
10
10
|
type ForwardRef = (node: HTMLElement | null) => void;
|
|
11
11
|
export default class TableView extends ReactNodeView<Props> {
|
|
12
12
|
private table;
|
|
@@ -29,5 +29,5 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
29
29
|
}): boolean;
|
|
30
30
|
destroy(): void;
|
|
31
31
|
}
|
|
32
|
-
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher,
|
|
32
|
+
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, pluginInjectionApi?: PluginInjectionAPI) => NodeView;
|
|
33
33
|
export {};
|
|
@@ -70,6 +70,9 @@ export interface TablePluginState {
|
|
|
70
70
|
isTableCollapsed?: boolean;
|
|
71
71
|
canCollapseTable?: boolean;
|
|
72
72
|
getIntl: () => IntlShape;
|
|
73
|
+
isBreakoutEnabled?: boolean;
|
|
74
|
+
wasFullWidthModeEnabled?: boolean;
|
|
75
|
+
isTableResizingEnabled?: boolean;
|
|
73
76
|
}
|
|
74
77
|
export type TablePluginAction = {
|
|
75
78
|
type: 'SET_EDITOR_FOCUS';
|
|
@@ -6,7 +6,7 @@ import type { GetEditorContainerWidth, GetEditorFeatureFlags, getPosHandler, get
|
|
|
6
6
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
7
|
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import type { PluginInjectionAPI } from '../types';
|
|
9
|
-
import type { Props
|
|
9
|
+
import type { Props } from './types';
|
|
10
10
|
type ForwardRef = (node: HTMLElement | null) => void;
|
|
11
11
|
export default class TableView extends ReactNodeView<Props> {
|
|
12
12
|
private table;
|
|
@@ -29,5 +29,5 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
29
29
|
}): boolean;
|
|
30
30
|
destroy(): void;
|
|
31
31
|
}
|
|
32
|
-
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher,
|
|
32
|
+
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, pluginInjectionApi?: PluginInjectionAPI) => NodeView;
|
|
33
33
|
export {};
|
|
@@ -70,6 +70,9 @@ export interface TablePluginState {
|
|
|
70
70
|
isTableCollapsed?: boolean;
|
|
71
71
|
canCollapseTable?: boolean;
|
|
72
72
|
getIntl: () => IntlShape;
|
|
73
|
+
isBreakoutEnabled?: boolean;
|
|
74
|
+
wasFullWidthModeEnabled?: boolean;
|
|
75
|
+
isTableResizingEnabled?: boolean;
|
|
73
76
|
}
|
|
74
77
|
export type TablePluginAction = {
|
|
75
78
|
type: 'SET_EDITOR_FOCUS';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/adf-schema": "^29.1.0",
|
|
31
|
-
"@atlaskit/editor-common": "^75.
|
|
31
|
+
"@atlaskit/editor-common": "^75.6.0",
|
|
32
32
|
"@atlaskit/editor-palette": "1.5.1",
|
|
33
33
|
"@atlaskit/editor-plugin-analytics": "^0.2.0",
|
|
34
34
|
"@atlaskit/editor-plugin-content-insertion": "^0.1.0",
|
|
@@ -35,7 +35,7 @@ import type { PluginInjectionAPI } from '../types';
|
|
|
35
35
|
import { isTableNested } from '../utils';
|
|
36
36
|
|
|
37
37
|
import TableComponent from './TableComponent';
|
|
38
|
-
import type { Props
|
|
38
|
+
import type { Props } from './types';
|
|
39
39
|
|
|
40
40
|
type ForwardRef = (node: HTMLElement | null) => void;
|
|
41
41
|
|
|
@@ -341,12 +341,17 @@ export const createTableView = (
|
|
|
341
341
|
getPos: getPosHandler,
|
|
342
342
|
portalProviderAPI: PortalProviderAPI,
|
|
343
343
|
eventDispatcher: EventDispatcher,
|
|
344
|
-
options: TableOptions,
|
|
345
344
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
346
345
|
getEditorFeatureFlags: GetEditorFeatureFlags,
|
|
347
346
|
pluginInjectionApi?: PluginInjectionAPI,
|
|
348
347
|
): NodeView => {
|
|
349
|
-
const {
|
|
348
|
+
const {
|
|
349
|
+
pluginConfig,
|
|
350
|
+
isBreakoutEnabled,
|
|
351
|
+
isFullWidthModeEnabled,
|
|
352
|
+
wasFullWidthModeEnabled,
|
|
353
|
+
isTableResizingEnabled,
|
|
354
|
+
} = getPluginState(view.state);
|
|
350
355
|
const { allowColumnResizing } = getPluginConfig(pluginConfig);
|
|
351
356
|
const hasIntlContext = true;
|
|
352
357
|
|
|
@@ -357,7 +362,12 @@ export const createTableView = (
|
|
|
357
362
|
portalProviderAPI,
|
|
358
363
|
eventDispatcher,
|
|
359
364
|
getPos: getPos as getPosHandlerNode,
|
|
360
|
-
options
|
|
365
|
+
options: {
|
|
366
|
+
isBreakoutEnabled,
|
|
367
|
+
isFullWidthModeEnabled,
|
|
368
|
+
wasFullWidthModeEnabled,
|
|
369
|
+
isTableResizingEnabled,
|
|
370
|
+
},
|
|
361
371
|
getEditorContainerWidth,
|
|
362
372
|
getEditorFeatureFlags,
|
|
363
373
|
hasIntlContext,
|
|
@@ -90,11 +90,6 @@ import { defaultTableSelection } from './default-table-selection';
|
|
|
90
90
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
91
91
|
import { pluginKey } from './plugin-key';
|
|
92
92
|
|
|
93
|
-
let isBreakoutEnabled: boolean | undefined;
|
|
94
|
-
let isFullWidthModeEnabled: boolean | undefined;
|
|
95
|
-
let wasFullWidthModeEnabled: boolean | undefined;
|
|
96
|
-
let isTableResizingEnabled: boolean | undefined;
|
|
97
|
-
|
|
98
93
|
export const createPlugin = (
|
|
99
94
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent,
|
|
100
95
|
dispatch: Dispatch,
|
|
@@ -111,16 +106,14 @@ export const createPlugin = (
|
|
|
111
106
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
112
107
|
pluginInjectionApi?: PluginInjectionAPI,
|
|
113
108
|
) => {
|
|
114
|
-
isBreakoutEnabled = breakoutEnabled;
|
|
115
|
-
isFullWidthModeEnabled = fullWidthModeEnabled;
|
|
116
|
-
wasFullWidthModeEnabled = previousFullWidthModeEnabled;
|
|
117
|
-
isTableResizingEnabled = tableResizingEnabled;
|
|
118
|
-
|
|
119
109
|
const state = createPluginState(dispatch, {
|
|
120
110
|
pluginConfig,
|
|
121
111
|
insertColumnButtonIndex: undefined,
|
|
122
112
|
insertRowButtonIndex: undefined,
|
|
123
|
-
isFullWidthModeEnabled,
|
|
113
|
+
isFullWidthModeEnabled: fullWidthModeEnabled,
|
|
114
|
+
isBreakoutEnabled: breakoutEnabled,
|
|
115
|
+
wasFullWidthModeEnabled: previousFullWidthModeEnabled,
|
|
116
|
+
isTableResizingEnabled: tableResizingEnabled,
|
|
124
117
|
isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
|
|
125
118
|
isHeaderColumnEnabled: false,
|
|
126
119
|
...defaultTableSelection,
|
|
@@ -376,12 +369,6 @@ export const createPlugin = (
|
|
|
376
369
|
getPos,
|
|
377
370
|
portalProviderAPI,
|
|
378
371
|
eventDispatcher,
|
|
379
|
-
{
|
|
380
|
-
isBreakoutEnabled,
|
|
381
|
-
isFullWidthModeEnabled,
|
|
382
|
-
wasFullWidthModeEnabled,
|
|
383
|
-
isTableResizingEnabled,
|
|
384
|
-
},
|
|
385
372
|
getEditorContainerWidth,
|
|
386
373
|
getEditorFeatureFlags,
|
|
387
374
|
pluginInjectionApi,
|
|
@@ -117,6 +117,10 @@ export interface TablePluginState {
|
|
|
117
117
|
canCollapseTable?: boolean; // enabled/disabled state of collapse option
|
|
118
118
|
|
|
119
119
|
getIntl: () => IntlShape;
|
|
120
|
+
|
|
121
|
+
isBreakoutEnabled?: boolean;
|
|
122
|
+
wasFullWidthModeEnabled?: boolean;
|
|
123
|
+
isTableResizingEnabled?: boolean;
|
|
120
124
|
}
|
|
121
125
|
|
|
122
126
|
export type TablePluginAction =
|