@atlaskit/editor-plugin-table 7.21.2 → 7.21.3
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/commands/insert.js +6 -3
- package/dist/cjs/nodeviews/TableComponent.js +9 -8
- package/dist/cjs/nodeviews/TableContainer.js +9 -6
- package/dist/cjs/nodeviews/lazy-node-views.js +4 -3
- package/dist/cjs/nodeviews/table.js +8 -3
- package/dist/cjs/plugin.js +16 -7
- package/dist/cjs/pm-plugins/keymap.js +3 -1
- package/dist/cjs/pm-plugins/main.js +3 -2
- package/dist/cjs/utils/create.js +6 -1
- package/dist/es2019/commands/insert.js +6 -3
- package/dist/es2019/nodeviews/TableComponent.js +10 -9
- package/dist/es2019/nodeviews/TableContainer.js +9 -6
- package/dist/es2019/nodeviews/lazy-node-views.js +4 -3
- package/dist/es2019/nodeviews/table.js +8 -3
- package/dist/es2019/plugin.js +14 -7
- package/dist/es2019/pm-plugins/keymap.js +2 -2
- package/dist/es2019/pm-plugins/main.js +3 -2
- package/dist/es2019/utils/create.js +6 -1
- package/dist/esm/commands/insert.js +6 -3
- package/dist/esm/nodeviews/TableComponent.js +10 -9
- package/dist/esm/nodeviews/TableContainer.js +9 -6
- package/dist/esm/nodeviews/lazy-node-views.js +4 -3
- package/dist/esm/nodeviews/table.js +8 -3
- package/dist/esm/plugin.js +16 -7
- package/dist/esm/pm-plugins/keymap.js +3 -1
- package/dist/esm/pm-plugins/main.js +3 -2
- package/dist/esm/utils/create.js +6 -1
- package/dist/types/commands/insert.d.ts +2 -2
- package/dist/types/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types/nodeviews/lazy-node-views.d.ts +1 -0
- package/dist/types/nodeviews/table.d.ts +1 -1
- package/dist/types/nodeviews/types.d.ts +1 -0
- package/dist/types/plugin.d.ts +1 -0
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/utils/create.d.ts +3 -1
- package/dist/types-ts4.5/commands/insert.d.ts +2 -2
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types-ts4.5/nodeviews/lazy-node-views.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/types.d.ts +1 -0
- package/dist/types-ts4.5/plugin.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/utils/create.d.ts +3 -1
- package/package.json +1 -1
- package/src/commands/insert.ts +6 -0
- package/src/nodeviews/TableComponent.tsx +9 -8
- package/src/nodeviews/TableContainer.tsx +15 -3
- package/src/nodeviews/lazy-node-views.ts +4 -0
- package/src/nodeviews/table.tsx +7 -1
- package/src/nodeviews/types.ts +1 -0
- package/src/plugin.tsx +12 -1
- package/src/pm-plugins/keymap.ts +4 -0
- package/src/pm-plugins/main.ts +2 -0
- package/src/utils/create.ts +9 -2
package/dist/es2019/plugin.js
CHANGED
|
@@ -137,7 +137,9 @@ const tablesPlugin = ({
|
|
|
137
137
|
const node = createTableWithWidth({
|
|
138
138
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
139
139
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
|
|
140
|
-
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled
|
|
140
|
+
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
|
|
141
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
142
|
+
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
|
|
141
143
|
})(state.schema);
|
|
142
144
|
return (_api$contentInsertion = api === null || api === void 0 ? void 0 : (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 ? void 0 : (_api$contentInsertion3 = _api$contentInsertion2.actions) === null || _api$contentInsertion3 === void 0 ? void 0 : _api$contentInsertion3.insert({
|
|
143
145
|
state,
|
|
@@ -192,9 +194,10 @@ const tablesPlugin = ({
|
|
|
192
194
|
getEditorFeatureFlags,
|
|
193
195
|
dragAndDropEnabled,
|
|
194
196
|
isTableScalingEnabled,
|
|
195
|
-
isTableAlignmentEnabled
|
|
197
|
+
isTableAlignmentEnabled,
|
|
198
|
+
isCommentEditor
|
|
196
199
|
} = options || {};
|
|
197
|
-
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent);
|
|
200
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor);
|
|
198
201
|
}
|
|
199
202
|
}, {
|
|
200
203
|
name: 'tablePMColResizing',
|
|
@@ -231,9 +234,11 @@ const tablesPlugin = ({
|
|
|
231
234
|
dragAndDropEnabled,
|
|
232
235
|
isTableScalingEnabled = false,
|
|
233
236
|
isTableAlignmentEnabled = false,
|
|
234
|
-
fullWidthEnabled = false
|
|
237
|
+
fullWidthEnabled = false,
|
|
238
|
+
isCommentEditor = false,
|
|
239
|
+
tableResizingEnabled = false
|
|
235
240
|
} = options || {};
|
|
236
|
-
return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent);
|
|
241
|
+
return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, tableResizingEnabled);
|
|
237
242
|
}
|
|
238
243
|
}, {
|
|
239
244
|
name: 'tableSelectionKeymap',
|
|
@@ -294,7 +299,7 @@ const tablesPlugin = ({
|
|
|
294
299
|
dispatch
|
|
295
300
|
}) => {
|
|
296
301
|
var _options$fullWidthEna, _options$isTableScali, _options$isTableAlign;
|
|
297
|
-
return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$isTableAlign = options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled) !== null && _options$isTableAlign !== void 0 ? _options$isTableAlign : false) : undefined;
|
|
302
|
+
return options !== null && options !== void 0 && options.tableResizingEnabled && !(options !== null && options !== void 0 && options.isCommentEditor) ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$isTableAlign = options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled) !== null && _options$isTableAlign !== void 0 ? _options$isTableAlign : false) : undefined;
|
|
298
303
|
}
|
|
299
304
|
},
|
|
300
305
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
@@ -492,7 +497,9 @@ const tablesPlugin = ({
|
|
|
492
497
|
const tableNode = createTableWithWidth({
|
|
493
498
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
494
499
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
|
|
495
|
-
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled
|
|
500
|
+
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
501
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
502
|
+
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
|
|
496
503
|
})(state.schema);
|
|
497
504
|
const tr = insert(tableNode);
|
|
498
505
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
@@ -8,13 +8,13 @@ import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSele
|
|
|
8
8
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
9
9
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, createTable } from '../commands/insert';
|
|
10
10
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
|
-
export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isTableAlignmentEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl, isCellBackgroundDuplicated = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent) {
|
|
11
|
+
export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isTableAlignmentEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl, isCellBackgroundDuplicated = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent, isCommentEditor, isTableResizingEnabled) {
|
|
12
12
|
var _pluginInjectionApi$a;
|
|
13
13
|
const list = {};
|
|
14
14
|
const ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
15
15
|
bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
|
|
16
16
|
bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1), list);
|
|
17
|
-
bindKeymapWithCommand(toggleTable.common, createTable(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI), list);
|
|
17
|
+
bindKeymapWithCommand(toggleTable.common, createTable(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI, isCommentEditor, isTableResizingEnabled), list);
|
|
18
18
|
bindKeymapWithCommand(backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
|
|
19
19
|
bindKeymapWithCommand(backspace.common, moveCursorBackward, list);
|
|
20
20
|
|
|
@@ -20,7 +20,7 @@ import { isHeaderRowRequired } from '../utils/paste';
|
|
|
20
20
|
import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
|
|
21
21
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
22
22
|
import { pluginKey } from './plugin-key';
|
|
23
|
-
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent) => {
|
|
23
|
+
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor) => {
|
|
24
24
|
var _accessibilityUtils;
|
|
25
25
|
const state = createPluginState(dispatch, {
|
|
26
26
|
pluginConfig,
|
|
@@ -261,7 +261,8 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
261
261
|
getEditorFeatureFlags,
|
|
262
262
|
dispatchAnalyticsEvent,
|
|
263
263
|
pluginInjectionApi,
|
|
264
|
-
isTableAlignmentEnabled
|
|
264
|
+
isTableAlignmentEnabled,
|
|
265
|
+
isCommentEditor
|
|
265
266
|
}),
|
|
266
267
|
tableRow: lazyTableRowView({
|
|
267
268
|
eventDispatcher
|
|
@@ -4,15 +4,20 @@ export const createTableWithWidth = ({
|
|
|
4
4
|
isTableScalingEnabled,
|
|
5
5
|
isTableAlignmentEnabled,
|
|
6
6
|
isFullWidthModeEnabled,
|
|
7
|
+
isCommentEditor,
|
|
8
|
+
isTableResizingEnabled,
|
|
7
9
|
createTableProps
|
|
8
10
|
}) => schema => {
|
|
9
11
|
const attrsOverrides = {};
|
|
10
|
-
if (isTableScalingEnabled && isFullWidthModeEnabled) {
|
|
12
|
+
if (isTableScalingEnabled && isFullWidthModeEnabled && !isCommentEditor) {
|
|
11
13
|
attrsOverrides.tableWidth = TABLE_MAX_WIDTH;
|
|
12
14
|
}
|
|
13
15
|
if (isTableAlignmentEnabled && isFullWidthModeEnabled) {
|
|
14
16
|
attrsOverrides.layout = 'align-start';
|
|
15
17
|
}
|
|
18
|
+
if (isCommentEditor && isTableResizingEnabled) {
|
|
19
|
+
attrsOverrides.tableWidth = 'inherit';
|
|
20
|
+
}
|
|
16
21
|
return createTable({
|
|
17
22
|
schema,
|
|
18
23
|
...createTableProps,
|
|
@@ -141,12 +141,14 @@ export var insertRow = function insertRow(row, moveCursorToTheNewRow, isCellBack
|
|
|
141
141
|
return true;
|
|
142
142
|
};
|
|
143
143
|
};
|
|
144
|
-
export var createTable = function createTable(isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI) {
|
|
144
|
+
export var createTable = function createTable(isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI, isCommentEditor, isTableResizingEnabled) {
|
|
145
145
|
return function (state, dispatch) {
|
|
146
146
|
var table = createTableWithWidth({
|
|
147
147
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
148
148
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
149
|
-
isFullWidthModeEnabled: isFullWidthModeEnabled
|
|
149
|
+
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
150
|
+
isCommentEditor: isCommentEditor,
|
|
151
|
+
isTableResizingEnabled: isTableResizingEnabled
|
|
150
152
|
})(state.schema);
|
|
151
153
|
if (dispatch) {
|
|
152
154
|
var tr = safeInsert(table)(state.tr).scrollIntoView();
|
|
@@ -166,7 +168,7 @@ export var createTable = function createTable(isTableScalingEnabled, isTableAlig
|
|
|
166
168
|
return true;
|
|
167
169
|
};
|
|
168
170
|
};
|
|
169
|
-
export var insertTableWithSize = function insertTableWithSize(isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI) {
|
|
171
|
+
export var insertTableWithSize = function insertTableWithSize(isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI, isCommentEditor) {
|
|
170
172
|
return function (rowsCount, colsCount, inputMethod) {
|
|
171
173
|
return function (_ref) {
|
|
172
174
|
var tr = _ref.tr;
|
|
@@ -174,6 +176,7 @@ export var insertTableWithSize = function insertTableWithSize(isFullWidthModeEna
|
|
|
174
176
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
175
177
|
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
176
178
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
179
|
+
isCommentEditor: isCommentEditor,
|
|
177
180
|
createTableProps: {
|
|
178
181
|
rowsCount: rowsCount,
|
|
179
182
|
colsCount: colsCount
|
|
@@ -25,7 +25,7 @@ import { tableMarginSides } from '@atlaskit/editor-common/styles';
|
|
|
25
25
|
import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
|
|
26
26
|
import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
27
27
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
28
|
-
import {
|
|
28
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
29
29
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
30
30
|
import { autoSizeTable, clearHoverSelection } from '../commands';
|
|
31
31
|
import { autoScrollerFactory } from '../pm-plugins/drag-and-drop/utils';
|
|
@@ -348,7 +348,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
348
348
|
getNode = _this$props7.getNode,
|
|
349
349
|
getEditorFeatureFlags = _this$props7.getEditorFeatureFlags,
|
|
350
350
|
isTableScalingEnabled = _this$props7.isTableScalingEnabled;
|
|
351
|
-
if (
|
|
351
|
+
if (fg('platform.editor.table.live-pages-sorting_4malx')) {
|
|
352
352
|
var _this$props$pluginInj;
|
|
353
353
|
var _ref = ((_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 || (_this$props$pluginInj = _this$props$pluginInj.editorViewMode) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.sharedState.currentState()) || {},
|
|
354
354
|
mode = _ref.mode;
|
|
@@ -437,7 +437,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
437
437
|
if (!(options !== null && options !== void 0 && options.isTableResizingEnabled) && allowColumnResizing) {
|
|
438
438
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
439
439
|
}
|
|
440
|
-
if (
|
|
440
|
+
if (fg('platform.editor.table.live-pages-sorting_4malx')) {
|
|
441
441
|
var _this$table2;
|
|
442
442
|
this === null || this === void 0 || (_this$table2 = this.table) === null || _this$table2 === void 0 || _this$table2.removeEventListener('mouseenter', this.handleMouseEnter);
|
|
443
443
|
}
|
|
@@ -495,7 +495,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
495
495
|
_getEditorFeatureFlag5 = _getEditorFeatureFlag4.tableWithFixedColumnWidthsOption,
|
|
496
496
|
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag5 === void 0 ? false : _getEditorFeatureFlag5;
|
|
497
497
|
var isTableScalingWithFixedColumnWidthsOptionEnabled = ((_this$props$options = this.props.options) === null || _this$props$options === void 0 ? void 0 : _this$props$options.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
|
|
498
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
498
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') || false;
|
|
499
499
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
500
500
|
var _this$props$options2;
|
|
501
501
|
var resizeState = getResizeState({
|
|
@@ -543,7 +543,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
543
543
|
getEditorFeatureFlags = _this$props10.getEditorFeatureFlags;
|
|
544
544
|
var isInDanger = this.props.isInDanger;
|
|
545
545
|
var table = findTable(view.state.selection);
|
|
546
|
-
if (!
|
|
546
|
+
if (!fg('platform.editor.table.use-shared-state-hook')) {
|
|
547
547
|
var pluginState = getPluginState(view.state);
|
|
548
548
|
isInDanger = pluginState.isInDanger;
|
|
549
549
|
}
|
|
@@ -557,7 +557,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
557
557
|
shouldHandleColgroupUpdates = true;
|
|
558
558
|
}
|
|
559
559
|
var isTableScalingWithFixedColumnWidthsOptionEnabled = isTableScalingEnabled && tableWithFixedColumnWidthsOption;
|
|
560
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
560
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent');
|
|
561
561
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled && getNode().attrs.displayMode !== 'fixed') {
|
|
562
562
|
shouldScale = true;
|
|
563
563
|
shouldHandleColgroupUpdates = true;
|
|
@@ -681,7 +681,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
681
681
|
showBeforeShadow = _this$state3.showBeforeShadow,
|
|
682
682
|
showAfterShadow = _this$state3.showAfterShadow;
|
|
683
683
|
var node = getNode();
|
|
684
|
-
if (!
|
|
684
|
+
if (!fg('platform.editor.table.use-shared-state-hook')) {
|
|
685
685
|
var pluginState = getPluginState(view.state);
|
|
686
686
|
isInDanger = pluginState.isInDanger;
|
|
687
687
|
hoveredRows = pluginState.hoveredRows;
|
|
@@ -768,7 +768,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
768
768
|
stickyScrollbar = _getEditorFeatureFlag8.stickyScrollbar,
|
|
769
769
|
_getEditorFeatureFlag9 = _getEditorFeatureFlag8.tableWithFixedColumnWidthsOption,
|
|
770
770
|
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag9 === void 0 ? false : _getEditorFeatureFlag9;
|
|
771
|
-
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption &&
|
|
771
|
+
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && fg('platform.editor.table.use-increased-scaling-percent');
|
|
772
772
|
return /*#__PURE__*/React.createElement(TableContainer
|
|
773
773
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
774
774
|
, {
|
|
@@ -787,7 +787,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
787
787
|
isTableWithFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
788
788
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
789
789
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
790
|
-
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
790
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
791
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
|
|
791
792
|
}, /*#__PURE__*/React.createElement("div", {
|
|
792
793
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
793
794
|
className: ClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
@@ -118,7 +118,8 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
118
118
|
isTableScalingEnabled = _ref4.isTableScalingEnabled,
|
|
119
119
|
isTableWithFixedColumnWidthsOptionEnabled = _ref4.isTableWithFixedColumnWidthsOptionEnabled,
|
|
120
120
|
isTableAlignmentEnabled = _ref4.isTableAlignmentEnabled,
|
|
121
|
-
shouldUseIncreasedScalingPercent = _ref4.shouldUseIncreasedScalingPercent
|
|
121
|
+
shouldUseIncreasedScalingPercent = _ref4.shouldUseIncreasedScalingPercent,
|
|
122
|
+
isCommentEditor = _ref4.isCommentEditor;
|
|
122
123
|
var containerRef = useRef(null);
|
|
123
124
|
var tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
124
125
|
var _useState = useState(false),
|
|
@@ -201,13 +202,13 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
201
202
|
// containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
|
|
202
203
|
// a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
|
|
203
204
|
// padding left = padding right = akEditorGutterPadding = 32
|
|
204
|
-
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - akEditorGutterPaddingDynamic() * 2 : containerWidth - akEditorGutterPaddingDynamic() * 2 - resizeHandleSpacing;
|
|
205
|
+
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - akEditorGutterPaddingDynamic() * 2 : containerWidth - akEditorGutterPaddingDynamic() * 2 - (isCommentEditor ? 0 : resizeHandleSpacing);
|
|
205
206
|
}
|
|
206
|
-
var width = Math.min(tableWidth, responsiveContainerWidth);
|
|
207
|
+
var width = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
207
208
|
if (!isResizing) {
|
|
208
209
|
tableWidthRef.current = width;
|
|
209
210
|
}
|
|
210
|
-
var maxResizerWidth = Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
|
|
211
|
+
var maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
|
|
211
212
|
var tableResizerProps = {
|
|
212
213
|
width: width,
|
|
213
214
|
maxWidth: maxResizerWidth,
|
|
@@ -282,7 +283,8 @@ export var TableContainer = function TableContainer(_ref6) {
|
|
|
282
283
|
isTableScalingEnabled = _ref6.isTableScalingEnabled,
|
|
283
284
|
isTableWithFixedColumnWidthsOptionEnabled = _ref6.isTableWithFixedColumnWidthsOptionEnabled,
|
|
284
285
|
isTableAlignmentEnabled = _ref6.isTableAlignmentEnabled,
|
|
285
|
-
shouldUseIncreasedScalingPercent = _ref6.shouldUseIncreasedScalingPercent
|
|
286
|
+
shouldUseIncreasedScalingPercent = _ref6.shouldUseIncreasedScalingPercent,
|
|
287
|
+
isCommentEditor = _ref6.isCommentEditor;
|
|
286
288
|
if (isTableResizingEnabled && !isNested) {
|
|
287
289
|
return /*#__PURE__*/React.createElement(ResizableTableContainer
|
|
288
290
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -301,7 +303,8 @@ export var TableContainer = function TableContainer(_ref6) {
|
|
|
301
303
|
isTableWithFixedColumnWidthsOptionEnabled: isTableWithFixedColumnWidthsOptionEnabled,
|
|
302
304
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
303
305
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
304
|
-
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent
|
|
306
|
+
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
307
|
+
isCommentEditor: isCommentEditor
|
|
305
308
|
}, children);
|
|
306
309
|
}
|
|
307
310
|
return /*#__PURE__*/React.createElement(InnerContainer, {
|
|
@@ -7,7 +7,7 @@ import TableRow from './TableRow';
|
|
|
7
7
|
export var lazyTableView = function lazyTableView(options) {
|
|
8
8
|
if (!fg('platform_editor_lazy-node-views')) {
|
|
9
9
|
return function (node, view, getPos) {
|
|
10
|
-
return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isTableAlignmentEnabled);
|
|
10
|
+
return createTableView(node, view, getPos, options.portalProviderAPI, options.eventDispatcher, options.getEditorContainerWidth, options.getEditorFeatureFlags, options.dispatchAnalyticsEvent, options.pluginInjectionApi, options.isTableAlignmentEnabled, options.isCommentEditor);
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
var loader = function loader() {
|
|
@@ -22,8 +22,9 @@ export var lazyTableView = function lazyTableView(options) {
|
|
|
22
22
|
getEditorFeatureFlags = _getNodeViewOptions.getEditorFeatureFlags,
|
|
23
23
|
dispatchAnalyticsEvent = _getNodeViewOptions.dispatchAnalyticsEvent,
|
|
24
24
|
pluginInjectionApi = _getNodeViewOptions.pluginInjectionApi,
|
|
25
|
-
isTableAlignmentEnabled = _getNodeViewOptions.isTableAlignmentEnabled
|
|
26
|
-
|
|
25
|
+
isTableAlignmentEnabled = _getNodeViewOptions.isTableAlignmentEnabled,
|
|
26
|
+
isCommentEditor = _getNodeViewOptions.isCommentEditor;
|
|
27
|
+
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled, isCommentEditor);
|
|
27
28
|
};
|
|
28
29
|
});
|
|
29
30
|
return result;
|
|
@@ -34,11 +34,15 @@ var tableAttributes = function tableAttributes(node) {
|
|
|
34
34
|
'data-layout': node.attrs.layout,
|
|
35
35
|
'data-autosize': node.attrs.__autoSize,
|
|
36
36
|
'data-table-local-id': node.attrs.localId || '',
|
|
37
|
-
'data-table-width': node.attrs.width,
|
|
37
|
+
'data-table-width': node.attrs.width || 'inherit',
|
|
38
38
|
'data-table-display-mode': node.attrs.displayMode
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
var getInlineWidth = function getInlineWidth(node, options, state, pos) {
|
|
42
|
+
if (!node.attrs.width && options !== null && options !== void 0 && options.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
42
46
|
// provide a width for tables when custom table width is supported
|
|
43
47
|
// this is to ensure 'responsive' tables (colgroup widths are undefined) become fixed to
|
|
44
48
|
// support screen size adjustments
|
|
@@ -280,7 +284,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
280
284
|
return TableView;
|
|
281
285
|
}(ReactNodeView);
|
|
282
286
|
export { TableView as default };
|
|
283
|
-
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled) {
|
|
287
|
+
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi, isTableAlignmentEnabled, isCommentEditor) {
|
|
284
288
|
var _getPluginState2 = getPluginState(view.state),
|
|
285
289
|
pluginConfig = _getPluginState2.pluginConfig,
|
|
286
290
|
isFullWidthModeEnabled = _getPluginState2.isFullWidthModeEnabled,
|
|
@@ -306,7 +310,8 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
306
310
|
isDragAndDropEnabled: isDragAndDropEnabled,
|
|
307
311
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
308
312
|
// same as options.isTableScalingEnabled
|
|
309
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled
|
|
313
|
+
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
314
|
+
isCommentEditor: isCommentEditor
|
|
310
315
|
},
|
|
311
316
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
312
317
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
package/dist/esm/plugin.js
CHANGED
|
@@ -141,7 +141,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
141
141
|
var node = createTableWithWidth({
|
|
142
142
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
143
143
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
|
|
144
|
-
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled
|
|
144
|
+
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
|
|
145
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
146
|
+
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
|
|
145
147
|
})(state.schema);
|
|
146
148
|
return (_api$contentInsertion = api === null || api === void 0 || (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 || (_api$contentInsertion2 = _api$contentInsertion2.actions) === null || _api$contentInsertion2 === void 0 ? void 0 : _api$contentInsertion2.insert({
|
|
147
149
|
state: state,
|
|
@@ -194,8 +196,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
194
196
|
getEditorFeatureFlags = _ref3.getEditorFeatureFlags,
|
|
195
197
|
dragAndDropEnabled = _ref3.dragAndDropEnabled,
|
|
196
198
|
isTableScalingEnabled = _ref3.isTableScalingEnabled,
|
|
197
|
-
isTableAlignmentEnabled = _ref3.isTableAlignmentEnabled
|
|
198
|
-
|
|
199
|
+
isTableAlignmentEnabled = _ref3.isTableAlignmentEnabled,
|
|
200
|
+
isCommentEditor = _ref3.isCommentEditor;
|
|
201
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor);
|
|
199
202
|
}
|
|
200
203
|
}, {
|
|
201
204
|
name: 'tablePMColResizing',
|
|
@@ -233,8 +236,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
233
236
|
_ref7$isTableAlignmen = _ref7.isTableAlignmentEnabled,
|
|
234
237
|
isTableAlignmentEnabled = _ref7$isTableAlignmen === void 0 ? false : _ref7$isTableAlignmen,
|
|
235
238
|
_ref7$fullWidthEnable = _ref7.fullWidthEnabled,
|
|
236
|
-
fullWidthEnabled = _ref7$fullWidthEnable === void 0 ? false : _ref7$fullWidthEnable
|
|
237
|
-
|
|
239
|
+
fullWidthEnabled = _ref7$fullWidthEnable === void 0 ? false : _ref7$fullWidthEnable,
|
|
240
|
+
_ref7$isCommentEditor = _ref7.isCommentEditor,
|
|
241
|
+
isCommentEditor = _ref7$isCommentEditor === void 0 ? false : _ref7$isCommentEditor,
|
|
242
|
+
_ref7$tableResizingEn = _ref7.tableResizingEnabled,
|
|
243
|
+
tableResizingEnabled = _ref7$tableResizingEn === void 0 ? false : _ref7$tableResizingEn;
|
|
244
|
+
return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, tableResizingEnabled);
|
|
238
245
|
}
|
|
239
246
|
}, {
|
|
240
247
|
name: 'tableSelectionKeymap',
|
|
@@ -296,7 +303,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
296
303
|
var _options$fullWidthEna, _options$isTableScali, _options$isTableAlign;
|
|
297
304
|
var dispatchAnalyticsEvent = _ref14.dispatchAnalyticsEvent,
|
|
298
305
|
dispatch = _ref14.dispatch;
|
|
299
|
-
return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$isTableAlign = options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled) !== null && _options$isTableAlign !== void 0 ? _options$isTableAlign : false) : undefined;
|
|
306
|
+
return options !== null && options !== void 0 && options.tableResizingEnabled && !(options !== null && options !== void 0 && options.isCommentEditor) ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$isTableAlign = options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled) !== null && _options$isTableAlign !== void 0 ? _options$isTableAlign : false) : undefined;
|
|
300
307
|
}
|
|
301
308
|
},
|
|
302
309
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
@@ -491,7 +498,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
491
498
|
var tableNode = createTableWithWidth({
|
|
492
499
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
493
500
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
|
|
494
|
-
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled
|
|
501
|
+
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
502
|
+
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
503
|
+
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
|
|
495
504
|
})(state.schema);
|
|
496
505
|
var tr = insert(tableNode);
|
|
497
506
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
@@ -18,11 +18,13 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
|
|
|
18
18
|
var isCellBackgroundDuplicated = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
|
|
19
19
|
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
|
|
20
20
|
var shouldUseIncreasedScalingPercent = arguments.length > 10 ? arguments[10] : undefined;
|
|
21
|
+
var isCommentEditor = arguments.length > 11 ? arguments[11] : undefined;
|
|
22
|
+
var isTableResizingEnabled = arguments.length > 12 ? arguments[12] : undefined;
|
|
21
23
|
var list = {};
|
|
22
24
|
var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
23
25
|
bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
|
|
24
26
|
bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1), list);
|
|
25
|
-
bindKeymapWithCommand(toggleTable.common, createTable(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI), list);
|
|
27
|
+
bindKeymapWithCommand(toggleTable.common, createTable(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI, isCommentEditor, isTableResizingEnabled), list);
|
|
26
28
|
bindKeymapWithCommand(backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
|
|
27
29
|
bindKeymapWithCommand(backspace.common, moveCursorBackward, list);
|
|
28
30
|
|
|
@@ -23,7 +23,7 @@ import { isHeaderRowRequired } from '../utils/paste';
|
|
|
23
23
|
import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
|
|
24
24
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
25
25
|
import { pluginKey } from './plugin-key';
|
|
26
|
-
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent) {
|
|
26
|
+
export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor) {
|
|
27
27
|
var _accessibilityUtils;
|
|
28
28
|
var state = createPluginState(dispatch, _objectSpread(_objectSpread(_objectSpread({
|
|
29
29
|
pluginConfig: pluginConfig,
|
|
@@ -256,7 +256,8 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
256
256
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
257
257
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
258
258
|
pluginInjectionApi: pluginInjectionApi,
|
|
259
|
-
isTableAlignmentEnabled: isTableAlignmentEnabled
|
|
259
|
+
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
260
|
+
isCommentEditor: isCommentEditor
|
|
260
261
|
}),
|
|
261
262
|
tableRow: lazyTableRowView({
|
|
262
263
|
eventDispatcher: eventDispatcher
|
package/dist/esm/utils/create.js
CHANGED
|
@@ -7,15 +7,20 @@ export var createTableWithWidth = function createTableWithWidth(_ref) {
|
|
|
7
7
|
var isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
8
8
|
isTableAlignmentEnabled = _ref.isTableAlignmentEnabled,
|
|
9
9
|
isFullWidthModeEnabled = _ref.isFullWidthModeEnabled,
|
|
10
|
+
isCommentEditor = _ref.isCommentEditor,
|
|
11
|
+
isTableResizingEnabled = _ref.isTableResizingEnabled,
|
|
10
12
|
createTableProps = _ref.createTableProps;
|
|
11
13
|
return function (schema) {
|
|
12
14
|
var attrsOverrides = {};
|
|
13
|
-
if (isTableScalingEnabled && isFullWidthModeEnabled) {
|
|
15
|
+
if (isTableScalingEnabled && isFullWidthModeEnabled && !isCommentEditor) {
|
|
14
16
|
attrsOverrides.tableWidth = TABLE_MAX_WIDTH;
|
|
15
17
|
}
|
|
16
18
|
if (isTableAlignmentEnabled && isFullWidthModeEnabled) {
|
|
17
19
|
attrsOverrides.layout = 'align-start';
|
|
18
20
|
}
|
|
21
|
+
if (isCommentEditor && isTableResizingEnabled) {
|
|
22
|
+
attrsOverrides.tableWidth = 'inherit';
|
|
23
|
+
}
|
|
19
24
|
return createTable(_objectSpread(_objectSpread({
|
|
20
25
|
schema: schema
|
|
21
26
|
}, createTableProps), attrsOverrides));
|
|
@@ -8,5 +8,5 @@ export declare const addColumnBefore: (isTableScalingEnabled?: boolean, isCellBa
|
|
|
8
8
|
export declare const addColumnAfter: (isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => Command;
|
|
9
9
|
export declare const insertColumn: (isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => (column: number) => Command;
|
|
10
10
|
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean, isCellBackgroundDuplicated?: boolean) => Command;
|
|
11
|
-
export declare const createTable: (isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null) => Command;
|
|
12
|
-
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
11
|
+
export declare const createTable: (isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null, isCommentEditor?: boolean, isTableResizingEnabled?: boolean) => Command;
|
|
12
|
+
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isCommentEditor?: boolean) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
@@ -31,8 +31,9 @@ type ResizableTableContainerProps = {
|
|
|
31
31
|
isTableWithFixedColumnWidthsOptionEnabled?: boolean;
|
|
32
32
|
isTableAlignmentEnabled?: boolean;
|
|
33
33
|
shouldUseIncreasedScalingPercent?: boolean;
|
|
34
|
+
isCommentEditor?: boolean;
|
|
34
35
|
};
|
|
35
|
-
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, lineLength, editorView, getPos, tableRef, isResizing, pluginInjectionApi, tableWrapperHeight, isWholeTableInDanger, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element>;
|
|
36
|
+
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, lineLength, editorView, getPos, tableRef, isResizing, pluginInjectionApi, tableWrapperHeight, isWholeTableInDanger, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element>;
|
|
36
37
|
type TableContainerProps = {
|
|
37
38
|
node: PMNode;
|
|
38
39
|
className: string;
|
|
@@ -50,6 +51,7 @@ type TableContainerProps = {
|
|
|
50
51
|
isTableWithFixedColumnWidthsOptionEnabled?: boolean;
|
|
51
52
|
isTableAlignmentEnabled?: boolean;
|
|
52
53
|
shouldUseIncreasedScalingPercent?: boolean;
|
|
54
|
+
isCommentEditor?: boolean;
|
|
53
55
|
};
|
|
54
|
-
export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth, lineLength }, editorView, getPos, tableRef, isNested, tableWrapperHeight, isResizing, pluginInjectionApi, isWholeTableInDanger, isTableResizingEnabled, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
56
|
+
export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth, lineLength }, editorView, getPos, tableRef, isNested, tableWrapperHeight, isResizing, pluginInjectionApi, isWholeTableInDanger, isTableResizingEnabled, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
55
57
|
export {};
|
|
@@ -15,6 +15,7 @@ type TableViewOptions = {
|
|
|
15
15
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
16
16
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
17
17
|
isTableAlignmentEnabled?: boolean;
|
|
18
|
+
isCommentEditor?: boolean;
|
|
18
19
|
};
|
|
19
20
|
export declare const lazyTableView: (options: TableViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor;
|
|
20
21
|
type TableCellViewOptions = {
|
|
@@ -32,5 +32,5 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
32
32
|
}): boolean;
|
|
33
33
|
destroy(): void;
|
|
34
34
|
}
|
|
35
|
-
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, dispatchAnalyticsEvent: DispatchAnalyticsEvent, pluginInjectionApi?: PluginInjectionAPI, isTableAlignmentEnabled?: boolean) => NodeView;
|
|
35
|
+
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, dispatchAnalyticsEvent: DispatchAnalyticsEvent, pluginInjectionApi?: PluginInjectionAPI, isTableAlignmentEnabled?: boolean, isCommentEditor?: boolean) => NodeView;
|
|
36
36
|
export {};
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface TablePluginOptions {
|
|
|
21
21
|
isTableScalingEnabled?: boolean;
|
|
22
22
|
isTableAlignmentEnabled?: boolean;
|
|
23
23
|
isNewColumnResizingEnabled?: boolean;
|
|
24
|
+
isCommentEditor?: boolean;
|
|
24
25
|
}
|
|
25
26
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
26
27
|
type MediaPlugin = NextEditorPlugin<'media', {
|
|
@@ -3,5 +3,5 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
|
3
3
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { PluginInjectionAPIWithA11y } from '../types';
|
|
6
|
-
export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, dragAndDropEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthEnabled?: boolean, pluginInjectionApi?: PluginInjectionAPIWithA11y, getIntl?: () => IntlShape, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean): SafePlugin;
|
|
6
|
+
export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, dragAndDropEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthEnabled?: boolean, pluginInjectionApi?: PluginInjectionAPIWithA11y, getIntl?: () => IntlShape, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isTableResizingEnabled?: boolean): SafePlugin;
|
|
7
7
|
export default keymapPlugin;
|
|
@@ -5,4 +5,4 @@ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
8
|
-
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
8
|
+
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
export declare const createTableWithWidth: ({ isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, createTableProps, }: {
|
|
2
|
+
export declare const createTableWithWidth: ({ isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, isCommentEditor, isTableResizingEnabled, createTableProps, }: {
|
|
3
3
|
isTableScalingEnabled?: boolean | undefined;
|
|
4
4
|
isTableAlignmentEnabled?: boolean | undefined;
|
|
5
5
|
isFullWidthModeEnabled?: boolean | undefined;
|
|
6
|
+
isCommentEditor?: boolean | undefined;
|
|
7
|
+
isTableResizingEnabled?: boolean | undefined;
|
|
6
8
|
createTableProps?: {
|
|
7
9
|
rowsCount?: number | undefined;
|
|
8
10
|
colsCount?: number | undefined;
|
|
@@ -8,5 +8,5 @@ export declare const addColumnBefore: (isTableScalingEnabled?: boolean, isCellBa
|
|
|
8
8
|
export declare const addColumnAfter: (isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => Command;
|
|
9
9
|
export declare const insertColumn: (isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => (column: number) => Command;
|
|
10
10
|
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean, isCellBackgroundDuplicated?: boolean) => Command;
|
|
11
|
-
export declare const createTable: (isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null) => Command;
|
|
12
|
-
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
11
|
+
export declare const createTable: (isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null, isCommentEditor?: boolean, isTableResizingEnabled?: boolean) => Command;
|
|
12
|
+
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isCommentEditor?: boolean) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
@@ -31,8 +31,9 @@ type ResizableTableContainerProps = {
|
|
|
31
31
|
isTableWithFixedColumnWidthsOptionEnabled?: boolean;
|
|
32
32
|
isTableAlignmentEnabled?: boolean;
|
|
33
33
|
shouldUseIncreasedScalingPercent?: boolean;
|
|
34
|
+
isCommentEditor?: boolean;
|
|
34
35
|
};
|
|
35
|
-
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, lineLength, editorView, getPos, tableRef, isResizing, pluginInjectionApi, tableWrapperHeight, isWholeTableInDanger, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element>;
|
|
36
|
+
export declare const ResizableTableContainer: React.MemoExoticComponent<({ children, className, node, containerWidth, lineLength, editorView, getPos, tableRef, isResizing, pluginInjectionApi, tableWrapperHeight, isWholeTableInDanger, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element>;
|
|
36
37
|
type TableContainerProps = {
|
|
37
38
|
node: PMNode;
|
|
38
39
|
className: string;
|
|
@@ -50,6 +51,7 @@ type TableContainerProps = {
|
|
|
50
51
|
isTableWithFixedColumnWidthsOptionEnabled?: boolean;
|
|
51
52
|
isTableAlignmentEnabled?: boolean;
|
|
52
53
|
shouldUseIncreasedScalingPercent?: boolean;
|
|
54
|
+
isCommentEditor?: boolean;
|
|
53
55
|
};
|
|
54
|
-
export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth, lineLength }, editorView, getPos, tableRef, isNested, tableWrapperHeight, isResizing, pluginInjectionApi, isWholeTableInDanger, isTableResizingEnabled, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
56
|
+
export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth, lineLength }, editorView, getPos, tableRef, isNested, tableWrapperHeight, isResizing, pluginInjectionApi, isWholeTableInDanger, isTableResizingEnabled, isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
55
57
|
export {};
|
|
@@ -15,6 +15,7 @@ type TableViewOptions = {
|
|
|
15
15
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
16
16
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
17
17
|
isTableAlignmentEnabled?: boolean;
|
|
18
|
+
isCommentEditor?: boolean;
|
|
18
19
|
};
|
|
19
20
|
export declare const lazyTableView: (options: TableViewOptions) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor;
|
|
20
21
|
type TableCellViewOptions = {
|