@atlaskit/editor-plugin-table 7.17.2 → 7.17.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 +8 -0
- package/dist/cjs/plugin.js +3 -2
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +3 -3
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/es2019/plugin.js +3 -2
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +3 -3
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/esm/plugin.js +3 -2
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +3 -3
- package/dist/esm/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/types/plugin.d.ts +1 -0
- 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-ts4.5/plugin.d.ts +1 -0
- 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/package.json +19 -11
- package/src/plugin.tsx +9 -2
- package/src/pm-plugins/table-resizing/event-handlers.ts +3 -8
- package/src/pm-plugins/table-resizing/plugin.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.17.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#111381](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111381)
|
|
8
|
+
[`5ec7ab3d39035`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5ec7ab3d39035) -
|
|
9
|
+
Replace the LD flag controlling new column resizing experience with statsig experiment
|
|
10
|
+
|
|
3
11
|
## 7.17.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -177,12 +177,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
177
177
|
fullWidthEnabled = _ref5.fullWidthEnabled,
|
|
178
178
|
tableOptions = _ref5.tableOptions,
|
|
179
179
|
getEditorFeatureFlags = _ref5.getEditorFeatureFlags,
|
|
180
|
-
isTableScalingEnabled = _ref5.isTableScalingEnabled
|
|
180
|
+
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
181
|
+
isNewColumnResizingEnabled = _ref5.isNewColumnResizingEnabled;
|
|
181
182
|
var _pluginConfig = (0, _createPluginConfig.pluginConfig)(tableOptions),
|
|
182
183
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
183
184
|
return allowColumnResizing ? (0, _tableResizing.createPlugin)(dispatch, {
|
|
184
185
|
lastColumnResizable: !fullWidthEnabled
|
|
185
|
-
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false) : undefined;
|
|
186
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled) : undefined;
|
|
186
187
|
}
|
|
187
188
|
}, {
|
|
188
189
|
name: 'tableEditing',
|
|
@@ -18,7 +18,7 @@ var _tableAnalytics = require("../table-analytics");
|
|
|
18
18
|
var _commands = require("./commands");
|
|
19
19
|
var _pluginFactory2 = require("./plugin-factory");
|
|
20
20
|
var _utils3 = require("./utils");
|
|
21
|
-
var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, editorAnalyticsAPI) {
|
|
21
|
+
var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, editorAnalyticsAPI, isNewColumnResizingEnabled) {
|
|
22
22
|
var state = view.state,
|
|
23
23
|
dispatch = view.dispatch;
|
|
24
24
|
var editorDisabled = !view.editable;
|
|
@@ -147,7 +147,7 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
|
|
|
147
147
|
_shouldScale = _shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
148
148
|
}
|
|
149
149
|
var resizedDelta = clientX - startX;
|
|
150
|
-
if (
|
|
150
|
+
if (isNewColumnResizingEnabled && !(0, _utils2.isTableNested)(state, tablePos)) {
|
|
151
151
|
var newResizeState = (0, _utils3.resizeColumnAndTable)(resizeState, colIndex, clientX - startX, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, _shouldScale);
|
|
152
152
|
tr = (0, _transforms.updateColumnWidths)(newResizeState, table, start)(tr);
|
|
153
153
|
tr.setNodeAttribute(start - 1, 'width', newResizeState.tableWidth);
|
|
@@ -224,7 +224,7 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(view, e
|
|
|
224
224
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
225
225
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
226
226
|
}
|
|
227
|
-
if (
|
|
227
|
+
if (isNewColumnResizingEnabled && !(0, _utils2.isTableNested)(state, tablePos)) {
|
|
228
228
|
(0, _utils3.resizeColumnAndTable)(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale, undefined, shouldUseIncreasedScalingPercent);
|
|
229
229
|
} else {
|
|
230
230
|
(0, _utils3.resizeColumn)(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale, shouldUseIncreasedScalingPercent);
|
|
@@ -16,7 +16,7 @@ var _eventHandlers = require("./event-handlers");
|
|
|
16
16
|
var _pluginFactory2 = require("./plugin-factory");
|
|
17
17
|
var _pluginKey = require("./plugin-key");
|
|
18
18
|
var _utils = require("./utils");
|
|
19
|
-
function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled) {
|
|
19
|
+
function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled) {
|
|
20
20
|
var _ref$lastColumnResiza = _ref.lastColumnResizable,
|
|
21
21
|
lastColumnResizable = _ref$lastColumnResiza === void 0 ? true : _ref$lastColumnResiza;
|
|
22
22
|
return new _safePlugin.SafePlugin({
|
|
@@ -56,7 +56,7 @@ function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureF
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
|
|
59
|
-
if ((0, _eventHandlers.handleMouseDown)(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI)) {
|
|
59
|
+
if ((0, _eventHandlers.handleMouseDown)(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI, isNewColumnResizingEnabled)) {
|
|
60
60
|
var _state = view.state,
|
|
61
61
|
_dispatch = view.dispatch;
|
|
62
62
|
return (0, _commands.setResizeHandlePos)(resizeHandlePos)(_state, _dispatch);
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -169,14 +169,15 @@ const tablesPlugin = ({
|
|
|
169
169
|
fullWidthEnabled,
|
|
170
170
|
tableOptions,
|
|
171
171
|
getEditorFeatureFlags,
|
|
172
|
-
isTableScalingEnabled
|
|
172
|
+
isTableScalingEnabled,
|
|
173
|
+
isNewColumnResizingEnabled
|
|
173
174
|
} = options || {};
|
|
174
175
|
const {
|
|
175
176
|
allowColumnResizing
|
|
176
177
|
} = pluginConfig(tableOptions);
|
|
177
178
|
return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
|
|
178
179
|
lastColumnResizable: !fullWidthEnabled
|
|
179
|
-
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false) : undefined;
|
|
180
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled) : undefined;
|
|
180
181
|
}
|
|
181
182
|
}, {
|
|
182
183
|
name: 'tableEditing',
|
|
@@ -12,7 +12,7 @@ import { META_KEYS } from '../table-analytics';
|
|
|
12
12
|
import { evenColumns, setDragging, stopResizing } from './commands';
|
|
13
13
|
import { getPluginState } from './plugin-factory';
|
|
14
14
|
import { currentColWidth, getResizeState, getTableMaxWidth, pointsAtCell, resizeColumn, resizeColumnAndTable, updateControls } from './utils';
|
|
15
|
-
export const handleMouseDown = (view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, editorAnalyticsAPI) => {
|
|
15
|
+
export const handleMouseDown = (view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, editorAnalyticsAPI, isNewColumnResizingEnabled) => {
|
|
16
16
|
const {
|
|
17
17
|
state,
|
|
18
18
|
dispatch
|
|
@@ -154,7 +154,7 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
|
|
|
154
154
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
155
155
|
}
|
|
156
156
|
const resizedDelta = clientX - startX;
|
|
157
|
-
if (
|
|
157
|
+
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
158
158
|
const newResizeState = resizeColumnAndTable(resizeState, colIndex, clientX - startX, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, shouldScale);
|
|
159
159
|
tr = updateColumnWidths(newResizeState, table, start)(tr);
|
|
160
160
|
tr.setNodeAttribute(start - 1, 'width', newResizeState.tableWidth);
|
|
@@ -237,7 +237,7 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
|
|
|
237
237
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
238
238
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
239
239
|
}
|
|
240
|
-
if (
|
|
240
|
+
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
241
241
|
resizeColumnAndTable(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale, undefined, shouldUseIncreasedScalingPercent);
|
|
242
242
|
} else {
|
|
243
243
|
resizeColumn(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale, shouldUseIncreasedScalingPercent);
|
|
@@ -10,7 +10,7 @@ import { pluginKey } from './plugin-key';
|
|
|
10
10
|
import { getResizeCellPos } from './utils';
|
|
11
11
|
export function createPlugin(dispatch, {
|
|
12
12
|
lastColumnResizable = true
|
|
13
|
-
}, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled) {
|
|
13
|
+
}, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled) {
|
|
14
14
|
return new SafePlugin({
|
|
15
15
|
key: pluginKey,
|
|
16
16
|
state: createPluginState(dispatch, {
|
|
@@ -54,7 +54,7 @@ export function createPlugin(dispatch, {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
|
|
57
|
-
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI)) {
|
|
57
|
+
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI, isNewColumnResizingEnabled)) {
|
|
58
58
|
const {
|
|
59
59
|
state,
|
|
60
60
|
dispatch
|
package/dist/esm/plugin.js
CHANGED
|
@@ -170,12 +170,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
170
170
|
fullWidthEnabled = _ref5.fullWidthEnabled,
|
|
171
171
|
tableOptions = _ref5.tableOptions,
|
|
172
172
|
getEditorFeatureFlags = _ref5.getEditorFeatureFlags,
|
|
173
|
-
isTableScalingEnabled = _ref5.isTableScalingEnabled
|
|
173
|
+
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
174
|
+
isNewColumnResizingEnabled = _ref5.isNewColumnResizingEnabled;
|
|
174
175
|
var _pluginConfig = pluginConfig(tableOptions),
|
|
175
176
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
176
177
|
return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
|
|
177
178
|
lastColumnResizable: !fullWidthEnabled
|
|
178
|
-
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false) : undefined;
|
|
179
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled) : undefined;
|
|
179
180
|
}
|
|
180
181
|
}, {
|
|
181
182
|
name: 'tableEditing',
|
|
@@ -12,7 +12,7 @@ import { META_KEYS } from '../table-analytics';
|
|
|
12
12
|
import { evenColumns, setDragging, stopResizing } from './commands';
|
|
13
13
|
import { getPluginState } from './plugin-factory';
|
|
14
14
|
import { currentColWidth, getResizeState, getTableMaxWidth, pointsAtCell, resizeColumn, resizeColumnAndTable, updateControls } from './utils';
|
|
15
|
-
export var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, editorAnalyticsAPI) {
|
|
15
|
+
export var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, editorAnalyticsAPI, isNewColumnResizingEnabled) {
|
|
16
16
|
var state = view.state,
|
|
17
17
|
dispatch = view.dispatch;
|
|
18
18
|
var editorDisabled = !view.editable;
|
|
@@ -141,7 +141,7 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
141
141
|
_shouldScale = _shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
142
142
|
}
|
|
143
143
|
var resizedDelta = clientX - startX;
|
|
144
|
-
if (
|
|
144
|
+
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
145
145
|
var newResizeState = resizeColumnAndTable(resizeState, colIndex, clientX - startX, dom, originalTable, resizingSelectedColumns ? selectedColumns : undefined, _shouldScale);
|
|
146
146
|
tr = updateColumnWidths(newResizeState, table, start)(tr);
|
|
147
147
|
tr.setNodeAttribute(start - 1, 'width', newResizeState.tableWidth);
|
|
@@ -218,7 +218,7 @@ export var handleMouseDown = function handleMouseDown(view, event, localResizeHa
|
|
|
218
218
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
|
|
219
219
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
220
220
|
}
|
|
221
|
-
if (
|
|
221
|
+
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
222
222
|
resizeColumnAndTable(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale, undefined, shouldUseIncreasedScalingPercent);
|
|
223
223
|
} else {
|
|
224
224
|
resizeColumn(resizeState, colIndex, clientX - dragging.startX, dom, table, undefined, shouldScale, shouldUseIncreasedScalingPercent);
|
|
@@ -9,7 +9,7 @@ import { handleMouseDown } from './event-handlers';
|
|
|
9
9
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
10
10
|
import { pluginKey } from './plugin-key';
|
|
11
11
|
import { getResizeCellPos } from './utils';
|
|
12
|
-
export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled) {
|
|
12
|
+
export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled) {
|
|
13
13
|
var _ref$lastColumnResiza = _ref.lastColumnResizable,
|
|
14
14
|
lastColumnResizable = _ref$lastColumnResiza === void 0 ? true : _ref$lastColumnResiza;
|
|
15
15
|
return new SafePlugin({
|
|
@@ -49,7 +49,7 @@ export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorF
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
|
|
52
|
-
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI)) {
|
|
52
|
+
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, editorAnalyticsAPI, isNewColumnResizingEnabled)) {
|
|
53
53
|
var _state = view.state,
|
|
54
54
|
_dispatch = view.dispatch;
|
|
55
55
|
return setResizeHandlePos(resizeHandlePos)(_state, _dispatch);
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export interface TablePluginOptions {
|
|
|
20
20
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
21
21
|
isTableScalingEnabled?: boolean;
|
|
22
22
|
isTableAlignmentEnabled?: boolean;
|
|
23
|
+
isNewColumnResizingEnabled?: boolean;
|
|
23
24
|
}
|
|
24
25
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
25
26
|
type MediaPlugin = NextEditorPlugin<'media', {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, isTableScalingEnabled: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => boolean;
|
|
4
|
+
export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, isTableScalingEnabled: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isNewColumnResizingEnabled?: boolean) => boolean;
|
|
@@ -3,4 +3,4 @@ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { ColumnResizingPluginState } from '../../types';
|
|
6
|
-
export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean): SafePlugin<ColumnResizingPluginState>;
|
|
6
|
+
export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isNewColumnResizingEnabled?: boolean): SafePlugin<ColumnResizingPluginState>;
|
|
@@ -20,6 +20,7 @@ export interface TablePluginOptions {
|
|
|
20
20
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
21
21
|
isTableScalingEnabled?: boolean;
|
|
22
22
|
isTableAlignmentEnabled?: boolean;
|
|
23
|
+
isNewColumnResizingEnabled?: boolean;
|
|
23
24
|
}
|
|
24
25
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
25
26
|
type MediaPlugin = NextEditorPlugin<'media', {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, isTableScalingEnabled: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => boolean;
|
|
4
|
+
export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, isTableScalingEnabled: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isNewColumnResizingEnabled?: boolean) => boolean;
|
|
@@ -3,4 +3,4 @@ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
|
3
3
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { ColumnResizingPluginState } from '../../types';
|
|
6
|
-
export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean): SafePlugin<ColumnResizingPluginState>;
|
|
6
|
+
export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isNewColumnResizingEnabled?: boolean): SafePlugin<ColumnResizingPluginState>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.17.
|
|
3
|
+
"version": "7.17.3",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
"types": "dist/types/index.d.ts",
|
|
14
14
|
"typesVersions": {
|
|
15
15
|
">=4.5 <4.9": {
|
|
16
|
-
"*": [
|
|
16
|
+
"*": [
|
|
17
|
+
"dist/types-ts4.5/*",
|
|
18
|
+
"dist/types-ts4.5/index.d.ts"
|
|
19
|
+
]
|
|
17
20
|
}
|
|
18
21
|
},
|
|
19
22
|
"sideEffects": false,
|
|
@@ -28,7 +31,7 @@
|
|
|
28
31
|
"@atlaskit/adf-schema": "^36.10.7",
|
|
29
32
|
"@atlaskit/button": "^17.17.0",
|
|
30
33
|
"@atlaskit/custom-steps": "^0.2.0",
|
|
31
|
-
"@atlaskit/editor-common": "^82.
|
|
34
|
+
"@atlaskit/editor-common": "^82.7.0",
|
|
32
35
|
"@atlaskit/editor-palette": "1.6.0",
|
|
33
36
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.1.0",
|
|
34
37
|
"@atlaskit/editor-plugin-analytics": "^1.2.0",
|
|
@@ -46,7 +49,7 @@
|
|
|
46
49
|
"@atlaskit/pragmatic-drag-and-drop": "^1.1.0",
|
|
47
50
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.3.0",
|
|
48
51
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
49
|
-
"@atlaskit/primitives": "^7.
|
|
52
|
+
"@atlaskit/primitives": "^7.3.0",
|
|
50
53
|
"@atlaskit/theme": "^12.9.0",
|
|
51
54
|
"@atlaskit/toggle": "^13.1.0",
|
|
52
55
|
"@atlaskit/tokens": "^1.50.0",
|
|
@@ -76,13 +79,21 @@
|
|
|
76
79
|
},
|
|
77
80
|
"techstack": {
|
|
78
81
|
"@atlassian/frontend": {
|
|
79
|
-
"import-structure": [
|
|
80
|
-
|
|
82
|
+
"import-structure": [
|
|
83
|
+
"atlassian-conventions"
|
|
84
|
+
],
|
|
85
|
+
"circular-dependencies": [
|
|
86
|
+
"file-and-folder-level"
|
|
87
|
+
]
|
|
81
88
|
},
|
|
82
89
|
"@repo/internal": {
|
|
83
|
-
"design-tokens": [
|
|
90
|
+
"design-tokens": [
|
|
91
|
+
"color"
|
|
92
|
+
],
|
|
84
93
|
"deprecation": "no-deprecated-imports",
|
|
85
|
-
"styling": [
|
|
94
|
+
"styling": [
|
|
95
|
+
"emotion"
|
|
96
|
+
]
|
|
86
97
|
}
|
|
87
98
|
},
|
|
88
99
|
"stricter": {
|
|
@@ -118,9 +129,6 @@
|
|
|
118
129
|
"platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33": {
|
|
119
130
|
"type": "boolean"
|
|
120
131
|
},
|
|
121
|
-
"platform.editor.table.colum-resizing-improvements": {
|
|
122
|
-
"type": "boolean"
|
|
123
|
-
},
|
|
124
132
|
"platform.editor.table.use-increased-scaling-percent": {
|
|
125
133
|
"type": "boolean"
|
|
126
134
|
},
|
package/src/plugin.tsx
CHANGED
|
@@ -94,6 +94,7 @@ export interface TablePluginOptions {
|
|
|
94
94
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
95
95
|
isTableScalingEnabled?: boolean;
|
|
96
96
|
isTableAlignmentEnabled?: boolean;
|
|
97
|
+
isNewColumnResizingEnabled?: boolean;
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
@@ -296,8 +297,13 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
296
297
|
{
|
|
297
298
|
name: 'tablePMColResizing',
|
|
298
299
|
plugin: ({ dispatch }) => {
|
|
299
|
-
const {
|
|
300
|
-
|
|
300
|
+
const {
|
|
301
|
+
fullWidthEnabled,
|
|
302
|
+
tableOptions,
|
|
303
|
+
getEditorFeatureFlags,
|
|
304
|
+
isTableScalingEnabled,
|
|
305
|
+
isNewColumnResizingEnabled,
|
|
306
|
+
} = options || ({} as TablePluginOptions);
|
|
301
307
|
const { allowColumnResizing } = pluginConfig(tableOptions);
|
|
302
308
|
return allowColumnResizing
|
|
303
309
|
? createFlexiResizingPlugin(
|
|
@@ -309,6 +315,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
309
315
|
getEditorFeatureFlags || defaultGetEditorFeatureFlags,
|
|
310
316
|
editorAnalyticsAPI,
|
|
311
317
|
isTableScalingEnabled || false,
|
|
318
|
+
isNewColumnResizingEnabled,
|
|
312
319
|
)
|
|
313
320
|
: undefined;
|
|
314
321
|
},
|
|
@@ -41,6 +41,7 @@ export const handleMouseDown = (
|
|
|
41
41
|
getEditorFeatureFlags: GetEditorFeatureFlags,
|
|
42
42
|
isTableScalingEnabled: boolean,
|
|
43
43
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
44
|
+
isNewColumnResizingEnabled?: boolean,
|
|
44
45
|
): boolean => {
|
|
45
46
|
const { state, dispatch } = view;
|
|
46
47
|
const editorDisabled = !view.editable;
|
|
@@ -192,10 +193,7 @@ export const handleMouseDown = (
|
|
|
192
193
|
|
|
193
194
|
const resizedDelta = clientX - startX;
|
|
194
195
|
|
|
195
|
-
if (
|
|
196
|
-
getBooleanFF('platform.editor.table.colum-resizing-improvements') &&
|
|
197
|
-
!isTableNested(state, tablePos)
|
|
198
|
-
) {
|
|
196
|
+
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
199
197
|
const newResizeState = resizeColumnAndTable(
|
|
200
198
|
resizeState,
|
|
201
199
|
colIndex,
|
|
@@ -300,10 +298,7 @@ export const handleMouseDown = (
|
|
|
300
298
|
shouldScale = shouldScale && originalTable.attrs.displayMode !== 'fixed';
|
|
301
299
|
}
|
|
302
300
|
|
|
303
|
-
if (
|
|
304
|
-
getBooleanFF('platform.editor.table.colum-resizing-improvements') &&
|
|
305
|
-
!isTableNested(state, tablePos)
|
|
306
|
-
) {
|
|
301
|
+
if (isNewColumnResizingEnabled && !isTableNested(state, tablePos)) {
|
|
307
302
|
resizeColumnAndTable(
|
|
308
303
|
resizeState,
|
|
309
304
|
colIndex,
|
|
@@ -23,6 +23,7 @@ export function createPlugin(
|
|
|
23
23
|
getEditorFeatureFlags: GetEditorFeatureFlags,
|
|
24
24
|
editorAnalyticsAPI?: EditorAnalyticsAPI,
|
|
25
25
|
isTableScalingEnabled?: boolean,
|
|
26
|
+
isNewColumnResizingEnabled?: boolean,
|
|
26
27
|
) {
|
|
27
28
|
return new SafePlugin({
|
|
28
29
|
key: pluginKey,
|
|
@@ -75,6 +76,7 @@ export function createPlugin(
|
|
|
75
76
|
getEditorFeatureFlags,
|
|
76
77
|
isTableScalingEnabled || false,
|
|
77
78
|
editorAnalyticsAPI,
|
|
79
|
+
isNewColumnResizingEnabled,
|
|
78
80
|
)
|
|
79
81
|
) {
|
|
80
82
|
const { state, dispatch } = view;
|