@atlaskit/editor-plugin-table 7.10.0 → 7.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/commands/column-resize.js +7 -1
- package/dist/cjs/commands/insert.js +4 -7
- package/dist/cjs/commands/misc.js +10 -3
- package/dist/cjs/nodeviews/TableRow.js +1 -1
- package/dist/cjs/plugin.js +1 -1
- package/dist/cjs/pm-plugins/analytics/plugin.js +17 -22
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +4 -4
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +1 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +5 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +9 -7
- package/dist/cjs/transforms/column-width.js +3 -1
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +19 -6
- package/dist/es2019/commands/column-resize.js +7 -1
- package/dist/es2019/commands/insert.js +4 -7
- package/dist/es2019/commands/misc.js +10 -3
- package/dist/es2019/nodeviews/TableRow.js +1 -1
- package/dist/es2019/plugin.js +1 -1
- package/dist/es2019/pm-plugins/analytics/plugin.js +21 -26
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +4 -4
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +1 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +5 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +9 -7
- package/dist/es2019/transforms/column-width.js +3 -1
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +19 -6
- package/dist/esm/commands/column-resize.js +7 -1
- package/dist/esm/commands/insert.js +4 -7
- package/dist/esm/commands/misc.js +10 -3
- package/dist/esm/nodeviews/TableRow.js +1 -1
- package/dist/esm/plugin.js +1 -1
- package/dist/esm/pm-plugins/analytics/plugin.js +17 -22
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +4 -4
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +1 -1
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +5 -3
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +9 -7
- package/dist/esm/transforms/column-width.js +3 -1
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +19 -6
- package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +2 -2
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -2
- package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -4
- package/dist/types/ui/TableFloatingControls/index.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-column.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -4
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +2 -2
- package/package.json +8 -8
- package/src/commands/column-resize.ts +11 -3
- package/src/commands/insert.ts +7 -13
- package/src/commands/misc.ts +14 -8
- package/src/nodeviews/TableRow.ts +2 -2
- package/src/plugin.tsx +1 -3
- package/src/pm-plugins/analytics/plugin.ts +24 -33
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +5 -5
- package/src/pm-plugins/table-resizing/utils/misc.ts +2 -2
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +7 -5
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +16 -10
- package/src/transforms/column-width.ts +10 -2
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +28 -11
|
@@ -6,6 +6,7 @@ import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
|
6
6
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
9
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
|
|
10
11
|
import type { ResizeState } from '../pm-plugins/table-resizing/utils';
|
|
11
12
|
import {
|
|
@@ -119,8 +120,15 @@ export const rescaleColumns =
|
|
|
119
120
|
|
|
120
121
|
const newTable = tr.doc.nodeAt(table.pos);
|
|
121
122
|
const domAtPos = view.domAtPos.bind(view);
|
|
122
|
-
const maybeTable = domAtPos(table.start).node
|
|
123
|
-
const
|
|
123
|
+
const maybeTable = domAtPos(table.start).node;
|
|
124
|
+
const maybeTableElement = getBooleanFF(
|
|
125
|
+
'platform.editor.explicit-html-element-check',
|
|
126
|
+
)
|
|
127
|
+
? maybeTable instanceof HTMLElement
|
|
128
|
+
? maybeTable
|
|
129
|
+
: null
|
|
130
|
+
: (maybeTable as HTMLElement | null);
|
|
131
|
+
const tableRef = maybeTableElement?.closest('table');
|
|
124
132
|
|
|
125
133
|
if (!tableRef || !newTable) {
|
|
126
134
|
return tr;
|
|
@@ -16,6 +16,7 @@ import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
16
16
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
17
17
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
18
18
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
19
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
19
20
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
20
21
|
import { token } from '@atlaskit/tokens';
|
|
21
22
|
|
|
@@ -142,19 +143,35 @@ const DragControlsComponent = ({
|
|
|
142
143
|
|
|
143
144
|
const handleMouseMove = useCallback(
|
|
144
145
|
(e: MouseEvent) => {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
if (getBooleanFF('platform.editor.explicit-html-element-check')) {
|
|
147
|
+
const target =
|
|
148
|
+
e.nativeEvent.target instanceof Element ? e.nativeEvent.target : null;
|
|
149
|
+
const isParentDragControls = target?.closest(
|
|
150
|
+
`.${ClassName.DRAG_ROW_CONTROLS}`,
|
|
151
|
+
);
|
|
152
|
+
const rowIndex = target?.getAttribute('data-start-index');
|
|
151
153
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
// avoid updating if event target is not related
|
|
155
|
+
if (!isParentDragControls || !rowIndex) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
156
158
|
|
|
157
|
-
|
|
159
|
+
updateCellHoverLocation(Number(rowIndex));
|
|
160
|
+
} else {
|
|
161
|
+
const isParentDragControls = (e.nativeEvent.target as Element).closest(
|
|
162
|
+
`.${ClassName.DRAG_ROW_CONTROLS}`,
|
|
163
|
+
);
|
|
164
|
+
const rowIndex = (e.nativeEvent.target as Element).getAttribute(
|
|
165
|
+
'data-start-index',
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
// avoid updating if event target is not related
|
|
169
|
+
if (!isParentDragControls || !rowIndex) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
updateCellHoverLocation(Number(rowIndex));
|
|
174
|
+
}
|
|
158
175
|
},
|
|
159
176
|
[updateCellHoverLocation],
|
|
160
177
|
);
|