@atlaskit/editor-plugin-table 7.25.3 → 7.25.5
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 +17 -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 +14 -10
- 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/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 +13 -10
- 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/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 +14 -10
- 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/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 +5 -5
- 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 +11 -8
- 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/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
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
|
-
};
|