@atlaskit/editor-plugin-table 7.25.2 → 7.25.4
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 +18 -0
- package/dist/cjs/commands/column-resize.js +4 -1
- package/dist/cjs/commands-with-analytics.js +2 -1
- package/dist/cjs/event-handlers.js +3 -2
- package/dist/cjs/nodeviews/TableComponent.js +18 -19
- package/dist/cjs/nodeviews/TableResizer.js +1 -1
- package/dist/cjs/nodeviews/lazy-node-views.js +1 -5
- package/dist/cjs/nodeviews/table.js +18 -8
- package/dist/cjs/plugin.js +6 -4
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +10 -5
- package/dist/cjs/pm-plugins/keymap.js +2 -2
- package/dist/cjs/pm-plugins/main.js +0 -1
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +6 -4
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +2 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +4 -1
- package/dist/cjs/toolbar.js +10 -6
- package/dist/cjs/ui/DragHandle/index.js +2 -1
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +5 -2
- package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/es2019/commands/column-resize.js +4 -1
- package/dist/es2019/commands-with-analytics.js +2 -1
- package/dist/es2019/event-handlers.js +2 -2
- package/dist/es2019/nodeviews/TableComponent.js +17 -19
- package/dist/es2019/nodeviews/TableResizer.js +1 -1
- package/dist/es2019/nodeviews/lazy-node-views.js +1 -5
- package/dist/es2019/nodeviews/table.js +21 -8
- package/dist/es2019/plugin.js +6 -4
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +8 -6
- package/dist/es2019/pm-plugins/keymap.js +2 -2
- package/dist/es2019/pm-plugins/main.js +1 -2
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +6 -4
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +3 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +5 -3
- package/dist/es2019/toolbar.js +10 -10
- package/dist/es2019/ui/DragHandle/index.js +1 -1
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +5 -2
- package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/esm/commands/column-resize.js +4 -1
- package/dist/esm/commands-with-analytics.js +2 -1
- package/dist/esm/event-handlers.js +3 -2
- package/dist/esm/nodeviews/TableComponent.js +18 -19
- package/dist/esm/nodeviews/TableResizer.js +1 -1
- package/dist/esm/nodeviews/lazy-node-views.js +1 -5
- package/dist/esm/nodeviews/table.js +18 -8
- package/dist/esm/plugin.js +6 -4
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +10 -5
- package/dist/esm/pm-plugins/keymap.js +2 -2
- package/dist/esm/pm-plugins/main.js +1 -2
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +6 -4
- package/dist/esm/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +3 -2
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +5 -2
- package/dist/esm/toolbar.js +10 -6
- package/dist/esm/ui/DragHandle/index.js +2 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +5 -2
- package/dist/esm/ui/FloatingContextualMenu/index.js +4 -2
- package/dist/types/commands/column-resize.d.ts +2 -1
- package/dist/types/commands-with-analytics.d.ts +1 -1
- package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/plugin.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
- package/dist/types/toolbar.d.ts +2 -2
- package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +1 -0
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +2 -1
- package/dist/types-ts4.5/commands/column-resize.d.ts +2 -1
- package/dist/types-ts4.5/commands-with-analytics.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/plugin.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
- package/dist/types-ts4.5/toolbar.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +1 -0
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +2 -1
- package/package.json +9 -12
- package/src/commands/column-resize.ts +7 -2
- package/src/commands-with-analytics.ts +2 -0
- package/src/event-handlers.ts +2 -1
- package/src/nodeviews/TableComponent.tsx +17 -14
- package/src/nodeviews/TableResizer.tsx +1 -0
- package/src/nodeviews/lazy-node-views.ts +0 -4
- package/src/nodeviews/table.tsx +30 -8
- package/src/plugin.tsx +8 -2
- package/src/pm-plugins/drag-and-drop/plugin.ts +9 -4
- package/src/pm-plugins/keymap.ts +2 -0
- package/src/pm-plugins/main.ts +0 -4
- package/src/pm-plugins/table-resizing/event-handlers.ts +11 -6
- package/src/pm-plugins/table-resizing/plugin.ts +2 -0
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +5 -3
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +6 -3
- package/src/toolbar.tsx +10 -1
- package/src/ui/DragHandle/index.tsx +1 -1
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +6 -2
- package/src/ui/FloatingContextualMenu/index.tsx +3 -0
- package/dist/cjs/nodeviews/ignore-mutation-delegate.js +0 -23
- package/dist/es2019/nodeviews/ignore-mutation-delegate.js +0 -20
- package/dist/esm/nodeviews/ignore-mutation-delegate.js +0 -17
- package/dist/types/nodeviews/ignore-mutation-delegate.d.ts +0 -5
- package/dist/types-ts4.5/nodeviews/ignore-mutation-delegate.d.ts +0 -5
- package/src/nodeviews/ignore-mutation-delegate.ts +0 -28
|
@@ -34,6 +34,7 @@ const destroyFn = (
|
|
|
34
34
|
editorAnalyticsAPI: any,
|
|
35
35
|
isTableScalingEnabled: boolean,
|
|
36
36
|
isTableFixedColumnWidthsOptionEnabled: boolean,
|
|
37
|
+
isCommentEditor: boolean,
|
|
37
38
|
) => {
|
|
38
39
|
const editorPageScrollContainer = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
39
40
|
|
|
@@ -224,8 +225,10 @@ const destroyFn = (
|
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
const shouldUseIncreasedScalingPercent =
|
|
227
|
-
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
228
|
-
|
|
228
|
+
(isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
229
|
+
fg('platform.editor.table.use-increased-scaling-percent')) ||
|
|
230
|
+
// When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
231
|
+
(isTableScalingEnabled && isCommentEditor);
|
|
229
232
|
|
|
230
233
|
insertColgroupFromNode(
|
|
231
234
|
tableRef,
|
|
@@ -249,6 +252,7 @@ export const createPlugin = (
|
|
|
249
252
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
250
253
|
isTableScalingEnabled = false,
|
|
251
254
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
255
|
+
isCommentEditor = false,
|
|
252
256
|
) => {
|
|
253
257
|
return new SafePlugin({
|
|
254
258
|
state: createPluginState(dispatch, (state) => ({
|
|
@@ -264,7 +268,7 @@ export const createPlugin = (
|
|
|
264
268
|
appendTransaction: (transactions, oldState, newState) => {
|
|
265
269
|
const { targetCellPosition: oldTargetCellPosition } = getTablePluginState(oldState);
|
|
266
270
|
const { targetCellPosition: newTargetCellPosition } = getTablePluginState(newState);
|
|
267
|
-
const { isDragMenuOpen, dragMenuIndex } = getPluginState(newState);
|
|
271
|
+
const { isDragMenuOpen = false, dragMenuIndex } = getPluginState(newState);
|
|
268
272
|
|
|
269
273
|
transactions.forEach((transaction) => {
|
|
270
274
|
if (transaction.getMeta('selectedRowViaKeyboard')) {
|
|
@@ -323,6 +327,7 @@ export const createPlugin = (
|
|
|
323
327
|
editorAnalyticsAPI,
|
|
324
328
|
isTableScalingEnabled,
|
|
325
329
|
isTableFixedColumnWidthsOptionEnabled,
|
|
330
|
+
isCommentEditor,
|
|
326
331
|
),
|
|
327
332
|
};
|
|
328
333
|
},
|
|
@@ -361,7 +366,7 @@ export const createPlugin = (
|
|
|
361
366
|
].includes(((event.target as HTMLElement) || null)?.id);
|
|
362
367
|
const keysToTrap = ['Enter', ' '];
|
|
363
368
|
|
|
364
|
-
const { isDragMenuOpen } = getPluginState(view.state);
|
|
369
|
+
const { isDragMenuOpen = false } = getPluginState(view.state);
|
|
365
370
|
|
|
366
371
|
// drag handle is focused, and user presses any key return them back to editing
|
|
367
372
|
if (isDragHandleFocused && !isDragMenuOpen && !keysToTrap.includes(event.key)) {
|
package/src/pm-plugins/keymap.ts
CHANGED
|
@@ -286,6 +286,7 @@ export function keymapPlugin(
|
|
|
286
286
|
getEditorContainerWidth,
|
|
287
287
|
isTableScalingEnabled,
|
|
288
288
|
isTableFixedColumnWidthsOptionEnabled,
|
|
289
|
+
!!isCommentEditor,
|
|
289
290
|
INPUT_METHOD.SHORTCUT,
|
|
290
291
|
ariaNotifyPlugin,
|
|
291
292
|
getIntl,
|
|
@@ -300,6 +301,7 @@ export function keymapPlugin(
|
|
|
300
301
|
getEditorContainerWidth,
|
|
301
302
|
isTableScalingEnabled,
|
|
302
303
|
isTableFixedColumnWidthsOptionEnabled,
|
|
304
|
+
!!isCommentEditor,
|
|
303
305
|
INPUT_METHOD.SHORTCUT,
|
|
304
306
|
ariaNotifyPlugin,
|
|
305
307
|
getIntl,
|
package/src/pm-plugins/main.ts
CHANGED
|
@@ -44,7 +44,6 @@ import {
|
|
|
44
44
|
handleMouseEnter,
|
|
45
45
|
handleMouseLeave,
|
|
46
46
|
handleMouseMove,
|
|
47
|
-
handleMouseOut,
|
|
48
47
|
handleMouseOver,
|
|
49
48
|
handleMouseUp,
|
|
50
49
|
handleTripleClick,
|
|
@@ -375,9 +374,6 @@ export const createPlugin = (
|
|
|
375
374
|
? undefined
|
|
376
375
|
: withCellTracking(whenTableInFocus(handleMouseOver)),
|
|
377
376
|
mouseleave: handleMouseLeave,
|
|
378
|
-
mouseout: fg('editor_react_18_fix_table_delete_col_decorations')
|
|
379
|
-
? undefined
|
|
380
|
-
: whenTableInFocus(handleMouseOut),
|
|
381
377
|
mousemove: whenTableInFocus(handleMouseMove),
|
|
382
378
|
mouseenter: handleMouseEnter,
|
|
383
379
|
mouseup: whenTableInFocus(handleMouseUp),
|
|
@@ -50,6 +50,7 @@ export const handleMouseDown = (
|
|
|
50
50
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
51
51
|
isNewColumnResizingEnabled?: boolean,
|
|
52
52
|
isTableAlignmentEnabled?: boolean,
|
|
53
|
+
isCommentEditor?: boolean,
|
|
53
54
|
): boolean => {
|
|
54
55
|
const { state, dispatch } = view;
|
|
55
56
|
const editorDisabled = !view.editable;
|
|
@@ -112,8 +113,10 @@ export const handleMouseDown = (
|
|
|
112
113
|
domAtPos,
|
|
113
114
|
isTableScalingEnabled: shouldScale,
|
|
114
115
|
shouldUseIncreasedScalingPercent:
|
|
115
|
-
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
116
|
-
|
|
116
|
+
(isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
117
|
+
fg('platform.editor.table.use-increased-scaling-percent')) ||
|
|
118
|
+
// When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
119
|
+
(isTableScalingEnabled && !!isCommentEditor),
|
|
117
120
|
});
|
|
118
121
|
|
|
119
122
|
if (
|
|
@@ -211,8 +214,9 @@ export const handleMouseDown = (
|
|
|
211
214
|
|
|
212
215
|
const resizedDelta = clientX - startX;
|
|
213
216
|
const shouldUseIncreasedScalingPercent =
|
|
214
|
-
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
215
|
-
|
|
217
|
+
(isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
218
|
+
fg('platform.editor.table.use-increased-scaling-percent')) ||
|
|
219
|
+
(isTableScalingEnabled && !!isCommentEditor);
|
|
216
220
|
|
|
217
221
|
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
218
222
|
const newResizeState = resizeColumnAndTable({
|
|
@@ -345,8 +349,9 @@ export const handleMouseDown = (
|
|
|
345
349
|
let shouldScale = tableDepth === 0 && isTableScalingEnabled;
|
|
346
350
|
|
|
347
351
|
const shouldUseIncreasedScalingPercent =
|
|
348
|
-
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
349
|
-
|
|
352
|
+
(isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
353
|
+
fg('platform.editor.table.use-increased-scaling-percent')) ||
|
|
354
|
+
(isTableScalingEnabled && isCommentEditor);
|
|
350
355
|
|
|
351
356
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
352
357
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
@@ -24,6 +24,7 @@ export function createPlugin(
|
|
|
24
24
|
isTableScalingEnabled?: boolean,
|
|
25
25
|
isNewColumnResizingEnabled?: boolean,
|
|
26
26
|
isTableAlignmentEnabled?: boolean,
|
|
27
|
+
isCommentEditor?: boolean,
|
|
27
28
|
) {
|
|
28
29
|
return new SafePlugin({
|
|
29
30
|
key: pluginKey,
|
|
@@ -76,6 +77,7 @@ export function createPlugin(
|
|
|
76
77
|
editorAnalyticsAPI,
|
|
77
78
|
isNewColumnResizingEnabled,
|
|
78
79
|
isTableAlignmentEnabled,
|
|
80
|
+
isCommentEditor,
|
|
79
81
|
)
|
|
80
82
|
) {
|
|
81
83
|
const { state, dispatch } = view;
|
|
@@ -5,7 +5,7 @@ import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
|
|
|
5
5
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
8
|
-
import {
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
|
|
10
10
|
import { getSelectedTableInfo } from '../../../utils';
|
|
11
11
|
|
|
@@ -326,6 +326,7 @@ export const getNewResizeStateFromSelectedColumns = (
|
|
|
326
326
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
327
327
|
isTableScalingEnabled = false,
|
|
328
328
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
329
|
+
isCommentEditor = false,
|
|
329
330
|
): ResizeStateWithAnalytics | undefined => {
|
|
330
331
|
// Fail early so that we don't do complex calculations for no reason
|
|
331
332
|
const numColumnsSelected = rect.right - rect.left;
|
|
@@ -381,8 +382,9 @@ export const getNewResizeStateFromSelectedColumns = (
|
|
|
381
382
|
domAtPos,
|
|
382
383
|
isTableScalingEnabled: isTableScalingEnabledOnCurrentTable,
|
|
383
384
|
shouldUseIncreasedScalingPercent:
|
|
384
|
-
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
385
|
-
|
|
385
|
+
(isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
386
|
+
fg('platform.editor.table.use-increased-scaling-percent')) ||
|
|
387
|
+
(isTableScalingEnabled && isCommentEditor),
|
|
386
388
|
});
|
|
387
389
|
|
|
388
390
|
const newResizeState = evenSelectedColumnsWidths(resizeState, rect);
|
|
@@ -4,7 +4,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
4
4
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { DomAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
7
|
-
import {
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
|
|
9
9
|
import { updateColumnWidths } from '../../../transforms';
|
|
10
10
|
import { getTableWidth } from '../../../utils';
|
|
@@ -154,6 +154,7 @@ export const previewScaleTable = (
|
|
|
154
154
|
domAtPos: DomAtPos,
|
|
155
155
|
isTableScalingEnabled: boolean = false,
|
|
156
156
|
isTableWithFixedColumnWidthsOptionEnabled: boolean = false,
|
|
157
|
+
isCommentEditor: boolean = false,
|
|
157
158
|
) => {
|
|
158
159
|
const { node, start, parentWidth } = options;
|
|
159
160
|
|
|
@@ -185,8 +186,10 @@ export const previewScaleTable = (
|
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
const shouldUseIncreasedScalingPercent =
|
|
188
|
-
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
189
|
-
|
|
189
|
+
(isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
190
|
+
fg('platform.editor.table.use-increased-scaling-percent')) ||
|
|
191
|
+
// When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
192
|
+
(isTableScalingEnabled && isCommentEditor);
|
|
190
193
|
|
|
191
194
|
const resizeState = parentWidth
|
|
192
195
|
? scaleWithParent(
|
package/src/toolbar.tsx
CHANGED
|
@@ -197,6 +197,7 @@ export const getToolbarCellOptionsConfig = (
|
|
|
197
197
|
isCellBackgroundDuplicated = false,
|
|
198
198
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
199
199
|
shouldUseIncreasedScalingPercent = false,
|
|
200
|
+
isCommentEditor = false,
|
|
200
201
|
): FloatingToolbarDropdown<Command> => {
|
|
201
202
|
const { top, bottom, right, left } = initialSelectionRect;
|
|
202
203
|
const numberOfColumns = right - left;
|
|
@@ -322,6 +323,7 @@ export const getToolbarCellOptionsConfig = (
|
|
|
322
323
|
getEditorContainerWidth,
|
|
323
324
|
isTableScalingEnabled,
|
|
324
325
|
isTableFixedColumnWidthsOptionEnabled,
|
|
326
|
+
isCommentEditor,
|
|
325
327
|
)
|
|
326
328
|
: undefined;
|
|
327
329
|
const wouldChange = newResizeStateWithAnalytics?.changed ?? false;
|
|
@@ -549,6 +551,7 @@ export const getToolbarConfig =
|
|
|
549
551
|
isCellBackgroundDuplicated,
|
|
550
552
|
isTableFixedColumnWidthsOptionEnabled,
|
|
551
553
|
shouldUseIncreasedScalingPercent,
|
|
554
|
+
options?.isCommentEditor,
|
|
552
555
|
);
|
|
553
556
|
|
|
554
557
|
const columnSettingsItems = pluginState.isDragAndDropEnabled
|
|
@@ -560,6 +563,7 @@ export const getToolbarConfig =
|
|
|
560
563
|
editorAnalyticsAPI,
|
|
561
564
|
isTableScalingEnabled,
|
|
562
565
|
isTableFixedColumnWidthsOptionEnabled,
|
|
566
|
+
options?.isCommentEditor,
|
|
563
567
|
)
|
|
564
568
|
: [];
|
|
565
569
|
const colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView);
|
|
@@ -661,6 +665,7 @@ const getCellItems = (
|
|
|
661
665
|
isCellBackgroundDuplicated = false,
|
|
662
666
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
663
667
|
shouldUseIncreasedScalingPercent = false,
|
|
668
|
+
isCommentEditor = false,
|
|
664
669
|
): Array<FloatingToolbarItem<Command>> => {
|
|
665
670
|
const initialSelectionRect = getClosestSelectionRect(state);
|
|
666
671
|
if (initialSelectionRect) {
|
|
@@ -675,6 +680,7 @@ const getCellItems = (
|
|
|
675
680
|
isCellBackgroundDuplicated,
|
|
676
681
|
isTableFixedColumnWidthsOptionEnabled,
|
|
677
682
|
shouldUseIncreasedScalingPercent,
|
|
683
|
+
isCommentEditor,
|
|
678
684
|
);
|
|
679
685
|
return [cellOptions, separator(cellOptions.hidden!)];
|
|
680
686
|
}
|
|
@@ -687,6 +693,7 @@ export const getDistributeConfig =
|
|
|
687
693
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
688
694
|
isTableScalingEnabled = false,
|
|
689
695
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
696
|
+
isCommentEditor = false,
|
|
690
697
|
): Command =>
|
|
691
698
|
(state, dispatch, editorView) => {
|
|
692
699
|
const selectionOrTableRect = getClosestSelectionOrTableRect(state);
|
|
@@ -701,6 +708,7 @@ export const getDistributeConfig =
|
|
|
701
708
|
getEditorContainerWidth,
|
|
702
709
|
isTableScalingEnabled,
|
|
703
710
|
isTableFixedColumnWidthsOptionEnabled,
|
|
711
|
+
isCommentEditor,
|
|
704
712
|
);
|
|
705
713
|
|
|
706
714
|
if (newResizeStateWithAnalytics) {
|
|
@@ -723,13 +731,13 @@ const getColumnSettingItems = (
|
|
|
723
731
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
724
732
|
isTableScalingEnabled = false,
|
|
725
733
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
734
|
+
isCommentEditor = false,
|
|
726
735
|
): Array<FloatingToolbarItem<Command>> => {
|
|
727
736
|
const pluginState = getPluginState(editorState);
|
|
728
737
|
const selectionOrTableRect = getClosestSelectionOrTableRect(editorState);
|
|
729
738
|
if (!selectionOrTableRect || !editorView) {
|
|
730
739
|
return [];
|
|
731
740
|
}
|
|
732
|
-
|
|
733
741
|
const newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(
|
|
734
742
|
selectionOrTableRect,
|
|
735
743
|
editorState,
|
|
@@ -755,6 +763,7 @@ const getColumnSettingItems = (
|
|
|
755
763
|
editorAnalyticsAPI,
|
|
756
764
|
isTableScalingEnabled,
|
|
757
765
|
isTableFixedColumnWidthsOptionEnabled,
|
|
766
|
+
isCommentEditor,
|
|
758
767
|
)(state, dispatch, view),
|
|
759
768
|
disabled: !wouldChange,
|
|
760
769
|
});
|
|
@@ -72,7 +72,7 @@ const DragHandleComponent = ({
|
|
|
72
72
|
state: { selection },
|
|
73
73
|
} = editorView;
|
|
74
74
|
const { hoveredColumns, hoveredRows } = getPluginState(state);
|
|
75
|
-
const { isDragMenuOpen } = getDnDPluginState(state);
|
|
75
|
+
const { isDragMenuOpen = false } = getDnDPluginState(state);
|
|
76
76
|
|
|
77
77
|
const isRow = direction === 'row';
|
|
78
78
|
const isColumn = direction === 'column';
|
|
@@ -101,6 +101,7 @@ export interface Props {
|
|
|
101
101
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
102
102
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
103
103
|
isCellMenuOpenByKeyboard?: boolean;
|
|
104
|
+
isCommentEditor?: boolean;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
export interface State {
|
|
@@ -651,6 +652,7 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
651
652
|
getEditorContainerWidth,
|
|
652
653
|
getEditorFeatureFlags,
|
|
653
654
|
isCellMenuOpenByKeyboard,
|
|
655
|
+
isCommentEditor,
|
|
654
656
|
} = this.props;
|
|
655
657
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
656
658
|
const { state, dispatch } = editorView;
|
|
@@ -679,8 +681,10 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
679
681
|
|
|
680
682
|
const shouldUseIncreasedScalingPercent =
|
|
681
683
|
isTableScalingEnabled &&
|
|
682
|
-
tableWithFixedColumnWidthsOption &&
|
|
683
|
-
|
|
684
|
+
((tableWithFixedColumnWidthsOption &&
|
|
685
|
+
fg('platform.editor.table.use-increased-scaling-percent')) ||
|
|
686
|
+
// When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
687
|
+
isCommentEditor);
|
|
684
688
|
|
|
685
689
|
switch (item.value.name) {
|
|
686
690
|
case 'sort_column_desc':
|
|
@@ -44,6 +44,7 @@ export interface Props {
|
|
|
44
44
|
pluginConfig?: PluginConfig;
|
|
45
45
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
46
46
|
isCellMenuOpenByKeyboard?: boolean;
|
|
47
|
+
isCommentEditor?: boolean;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
const FloatingContextualMenu = ({
|
|
@@ -57,6 +58,7 @@ const FloatingContextualMenu = ({
|
|
|
57
58
|
getEditorContainerWidth,
|
|
58
59
|
getEditorFeatureFlags,
|
|
59
60
|
isCellMenuOpenByKeyboard,
|
|
61
|
+
isCommentEditor,
|
|
60
62
|
}: Props) => {
|
|
61
63
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
62
64
|
const { targetCellPosition, isDragAndDropEnabled } = getPluginState(editorView.state);
|
|
@@ -114,6 +116,7 @@ const FloatingContextualMenu = ({
|
|
|
114
116
|
getEditorContainerWidth={getEditorContainerWidth}
|
|
115
117
|
getEditorFeatureFlags={getEditorFeatureFlags}
|
|
116
118
|
isCellMenuOpenByKeyboard={isCellMenuOpenByKeyboard}
|
|
119
|
+
isCommentEditor={isCommentEditor}
|
|
117
120
|
/>
|
|
118
121
|
</div>
|
|
119
122
|
</Popup>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = exports.default = function _default(mutation) {
|
|
8
|
-
var type = mutation.type,
|
|
9
|
-
_mutation$target = mutation.target,
|
|
10
|
-
nodeName = _mutation$target.nodeName,
|
|
11
|
-
firstChild = _mutation$target.firstChild;
|
|
12
|
-
if (type === 'selection' && (nodeName === null || nodeName === void 0 ? void 0 : nodeName.toUpperCase()) === 'DIV' && (firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeName.toUpperCase()) === 'TABLE') {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// ED-16668
|
|
17
|
-
// Do not remove this fixes an issue with windows firefox that relates to
|
|
18
|
-
// the addition of the shadow sentinels
|
|
19
|
-
if (type === 'selection' && (nodeName === null || nodeName === void 0 ? void 0 : nodeName.toUpperCase()) === 'TABLE' && ((firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeName.toUpperCase()) === 'COLGROUP' || (firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeName.toUpperCase()) === 'SPAN')) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
return true;
|
|
23
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export default (mutation => {
|
|
2
|
-
const {
|
|
3
|
-
type,
|
|
4
|
-
target: {
|
|
5
|
-
nodeName,
|
|
6
|
-
firstChild
|
|
7
|
-
}
|
|
8
|
-
} = mutation;
|
|
9
|
-
if (type === 'selection' && (nodeName === null || nodeName === void 0 ? void 0 : nodeName.toUpperCase()) === 'DIV' && (firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeName.toUpperCase()) === 'TABLE') {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// ED-16668
|
|
14
|
-
// Do not remove this fixes an issue with windows firefox that relates to
|
|
15
|
-
// the addition of the shadow sentinels
|
|
16
|
-
if (type === 'selection' && (nodeName === null || nodeName === void 0 ? void 0 : nodeName.toUpperCase()) === 'TABLE' && ((firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeName.toUpperCase()) === 'COLGROUP' || (firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeName.toUpperCase()) === 'SPAN')) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
return true;
|
|
20
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default (function (mutation) {
|
|
2
|
-
var type = mutation.type,
|
|
3
|
-
_mutation$target = mutation.target,
|
|
4
|
-
nodeName = _mutation$target.nodeName,
|
|
5
|
-
firstChild = _mutation$target.firstChild;
|
|
6
|
-
if (type === 'selection' && (nodeName === null || nodeName === void 0 ? void 0 : nodeName.toUpperCase()) === 'DIV' && (firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeName.toUpperCase()) === 'TABLE') {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// ED-16668
|
|
11
|
-
// Do not remove this fixes an issue with windows firefox that relates to
|
|
12
|
-
// the addition of the shadow sentinels
|
|
13
|
-
if (type === 'selection' && (nodeName === null || nodeName === void 0 ? void 0 : nodeName.toUpperCase()) === 'TABLE' && ((firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeName.toUpperCase()) === 'COLGROUP' || (firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeName.toUpperCase()) === 'SPAN')) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
return true;
|
|
17
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export default (mutation: MutationRecord | { type: 'selection'; target: Element }) => {
|
|
2
|
-
const {
|
|
3
|
-
type,
|
|
4
|
-
target: { nodeName, firstChild },
|
|
5
|
-
} = mutation;
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
type === 'selection' &&
|
|
9
|
-
nodeName?.toUpperCase() === 'DIV' &&
|
|
10
|
-
firstChild?.nodeName.toUpperCase() === 'TABLE'
|
|
11
|
-
) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// ED-16668
|
|
16
|
-
// Do not remove this fixes an issue with windows firefox that relates to
|
|
17
|
-
// the addition of the shadow sentinels
|
|
18
|
-
if (
|
|
19
|
-
type === 'selection' &&
|
|
20
|
-
nodeName?.toUpperCase() === 'TABLE' &&
|
|
21
|
-
(firstChild?.nodeName.toUpperCase() === 'COLGROUP' ||
|
|
22
|
-
firstChild?.nodeName.toUpperCase() === 'SPAN')
|
|
23
|
-
) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return true;
|
|
28
|
-
};
|