@atlaskit/editor-plugin-table 2.10.7 → 2.11.0
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 +41 -0
- package/dist/cjs/plugins/table/commands/misc.js +58 -5
- package/dist/cjs/plugins/table/event-handlers.js +3 -6
- package/dist/cjs/plugins/table/index.js +66 -63
- package/dist/cjs/plugins/table/nodeviews/TableContainer.js +5 -5
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +13 -19
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-resizing.js +18 -5
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/index.js +6 -0
- package/dist/cjs/plugins/table/pm-plugins/main.js +7 -3
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +2 -0
- package/dist/cjs/plugins/table/reducer.js +26 -2
- package/dist/cjs/plugins/table/types.js +1 -0
- package/dist/cjs/plugins/table/ui/ColumnResizeWidget/index.js +44 -0
- package/dist/cjs/plugins/table/ui/messages.js +5 -0
- package/dist/cjs/plugins/table/utils/decoration.js +17 -4
- package/dist/es2019/plugins/table/commands/misc.js +49 -5
- package/dist/es2019/plugins/table/event-handlers.js +3 -6
- package/dist/es2019/plugins/table/index.js +14 -10
- package/dist/es2019/plugins/table/nodeviews/TableContainer.js +5 -5
- package/dist/es2019/plugins/table/nodeviews/TableResizer.js +14 -17
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-resizing.js +12 -2
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/index.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/main.js +6 -3
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +2 -0
- package/dist/es2019/plugins/table/reducer.js +29 -2
- package/dist/es2019/plugins/table/types.js +1 -0
- package/dist/es2019/plugins/table/ui/ColumnResizeWidget/index.js +35 -0
- package/dist/es2019/plugins/table/ui/messages.js +5 -0
- package/dist/es2019/plugins/table/utils/decoration.js +16 -5
- package/dist/esm/plugins/table/commands/misc.js +56 -5
- package/dist/esm/plugins/table/event-handlers.js +3 -6
- package/dist/esm/plugins/table/index.js +66 -63
- package/dist/esm/plugins/table/nodeviews/TableContainer.js +5 -5
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +13 -19
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-resizing.js +15 -3
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/index.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/main.js +8 -4
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +2 -0
- package/dist/esm/plugins/table/reducer.js +26 -2
- package/dist/esm/plugins/table/types.js +1 -0
- package/dist/esm/plugins/table/ui/ColumnResizeWidget/index.js +35 -0
- package/dist/esm/plugins/table/ui/messages.js +5 -0
- package/dist/esm/plugins/table/utils/decoration.js +17 -4
- package/dist/types/plugins/table/commands/misc.d.ts +8 -6
- package/dist/types/plugins/table/event-handlers.d.ts +3 -3
- package/dist/types/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +4 -2
- package/dist/types/plugins/table/pm-plugins/decorations/utils/index.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/plugin.d.ts +2 -2
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -3
- package/dist/types/plugins/table/reducer.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +18 -0
- package/dist/types/plugins/table/ui/ColumnResizeWidget/index.d.ts +9 -0
- package/dist/types/plugins/table/ui/messages.d.ts +5 -0
- package/dist/types/plugins/table/utils/decoration.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +8 -6
- package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +3 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +4 -2
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -3
- package/dist/types-ts4.5/plugins/table/reducer.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +18 -0
- package/dist/types-ts4.5/plugins/table/ui/ColumnResizeWidget/index.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/ui/messages.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +2 -1
- package/package.json +4 -4
- package/src/__tests__/unit/event-handlers.ts +1 -1
- package/src/__tests__/unit/nodeviews/TableComponent.tsx +6 -8
- package/src/__tests__/unit/nodeviews/TableContainer.tsx +22 -15
- package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +2 -0
- package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +9 -10
- package/src/__tests__/unit/ui/FloatingInsertButton.tsx +9 -9
- package/src/plugins/table/commands/misc.ts +84 -7
- package/src/plugins/table/event-handlers.ts +11 -16
- package/src/plugins/table/index.tsx +6 -4
- package/src/plugins/table/nodeviews/TableContainer.tsx +4 -4
- package/src/plugins/table/nodeviews/TableResizer.tsx +12 -20
- package/src/plugins/table/pm-plugins/decorations/utils/column-resizing.ts +34 -7
- package/src/plugins/table/pm-plugins/decorations/utils/index.ts +4 -1
- package/src/plugins/table/pm-plugins/main.ts +7 -1
- package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +5 -0
- package/src/plugins/table/pm-plugins/table-resizing/plugin.ts +3 -5
- package/src/plugins/table/pm-plugins/table-resizing/utils/scale-table.ts +5 -3
- package/src/plugins/table/reducer.ts +51 -3
- package/src/plugins/table/types.ts +19 -0
- package/src/plugins/table/ui/ColumnResizeWidget/index.tsx +53 -0
- package/src/plugins/table/ui/messages.ts +5 -0
- package/src/plugins/table/utils/decoration.ts +27 -5
- package/tmp/api-report-tmp.d.ts +111 -0
|
@@ -39,6 +39,7 @@ export var TableDecorations = /*#__PURE__*/function (TableDecorations) {
|
|
|
39
39
|
TableDecorations["COLUMN_CONTROLS_DECORATIONS"] = "COLUMN_CONTROLS_DECORATIONS";
|
|
40
40
|
TableDecorations["COLUMN_SELECTED"] = "COLUMN_SELECTED";
|
|
41
41
|
TableDecorations["COLUMN_RESIZING_HANDLE"] = "COLUMN_RESIZING_HANDLE";
|
|
42
|
+
TableDecorations["COLUMN_RESIZING_HANDLE_WIDGET"] = "COLUMN_RESIZING_HANDLE_WIDGET";
|
|
42
43
|
TableDecorations["COLUMN_RESIZING_HANDLE_LINE"] = "COLUMN_RESIZING_HANDLE_LINE";
|
|
43
44
|
TableDecorations["LAST_CELL_ELEMENT"] = "LAST_CELL_ELEMENT";
|
|
44
45
|
return TableDecorations;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
import { useIntl } from 'react-intl-next';
|
|
6
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
+
import { TableCssClassName } from '../../types';
|
|
8
|
+
import messages from '../messages';
|
|
9
|
+
export var ColumnResizeWidget = function ColumnResizeWidget(_ref) {
|
|
10
|
+
var startIndex = _ref.startIndex,
|
|
11
|
+
endIndex = _ref.endIndex,
|
|
12
|
+
includeTooltip = _ref.includeTooltip;
|
|
13
|
+
var _useIntl = useIntl(),
|
|
14
|
+
formatMessage = _useIntl.formatMessage;
|
|
15
|
+
if (!includeTooltip) {
|
|
16
|
+
return jsx("div", {
|
|
17
|
+
className: TableCssClassName.RESIZE_HANDLE_DECORATION,
|
|
18
|
+
"data-start-index": startIndex,
|
|
19
|
+
"data-end-index": endIndex
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return jsx(Tooltip, {
|
|
23
|
+
content: formatMessage(messages.adjustColumns),
|
|
24
|
+
hideTooltipOnClick: true,
|
|
25
|
+
hideTooltipOnMouseDown: true,
|
|
26
|
+
position: "mouse",
|
|
27
|
+
mousePosition: "auto-start"
|
|
28
|
+
}, function (tooltipProps) {
|
|
29
|
+
return jsx("div", _extends({
|
|
30
|
+
className: TableCssClassName.RESIZE_HANDLE_DECORATION,
|
|
31
|
+
"data-start-index": startIndex,
|
|
32
|
+
"data-end-index": endIndex
|
|
33
|
+
}, tooltipProps));
|
|
34
|
+
});
|
|
35
|
+
};
|
|
@@ -54,5 +54,10 @@ export default defineMessages({
|
|
|
54
54
|
id: 'fabric.editor.extension.sourceNoTitledName',
|
|
55
55
|
defaultMessage: 'this element',
|
|
56
56
|
description: 'The current element without preset name been selected'
|
|
57
|
+
},
|
|
58
|
+
adjustColumns: {
|
|
59
|
+
id: 'fabric.editor.tables.adjustColumn',
|
|
60
|
+
defaultMessage: 'Adjust column',
|
|
61
|
+
description: 'Tooltip displayed on table column resize handle'
|
|
57
62
|
}
|
|
58
63
|
});
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { createElement } from 'react';
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
4
|
+
import { RawIntlProvider } from 'react-intl-next';
|
|
2
5
|
import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
3
6
|
|
|
4
7
|
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
@@ -7,6 +10,7 @@ import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
|
7
10
|
import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
8
11
|
import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
12
|
import { TableCssClassName as ClassName, TableDecorations } from '../types';
|
|
13
|
+
import { ColumnResizeWidget } from '../ui/ColumnResizeWidget';
|
|
10
14
|
var filterDecorationByKey = function filterDecorationByKey(key, decorationSet) {
|
|
11
15
|
return decorationSet.find(undefined, undefined, function (spec) {
|
|
12
16
|
return spec.key.indexOf(key) > -1;
|
|
@@ -257,6 +261,8 @@ var makeArray = function makeArray(n) {
|
|
|
257
261
|
* hence the second media will receive this class `ClassName.LAST_ITEM_IN_CELL`
|
|
258
262
|
*/
|
|
259
263
|
export var createResizeHandleDecoration = function createResizeHandleDecoration(tr, rowIndexTarget, columnEndIndexTarget) {
|
|
264
|
+
var includeTooltip = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
265
|
+
var getIntl = arguments.length > 4 ? arguments[4] : undefined;
|
|
260
266
|
var emptyResult = [[], []];
|
|
261
267
|
var table = findTable(tr.selection);
|
|
262
268
|
if (!table || !table.node) {
|
|
@@ -270,12 +276,19 @@ export var createResizeHandleDecoration = function createResizeHandleDecoration(
|
|
|
270
276
|
var position = cellPos + cellNode.nodeSize - 1;
|
|
271
277
|
return Decoration.widget(position, function () {
|
|
272
278
|
var element = document.createElement('div');
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
279
|
+
ReactDOM.render( /*#__PURE__*/createElement(RawIntlProvider, {
|
|
280
|
+
value: getIntl()
|
|
281
|
+
}, /*#__PURE__*/createElement(ColumnResizeWidget, {
|
|
282
|
+
startIndex: cellColumnPositioning.left,
|
|
283
|
+
endIndex: cellColumnPositioning.right,
|
|
284
|
+
includeTooltip: includeTooltip
|
|
285
|
+
})), element);
|
|
276
286
|
return element;
|
|
277
287
|
}, {
|
|
278
|
-
key: "".concat(TableDecorations.
|
|
288
|
+
key: "".concat(TableDecorations.COLUMN_RESIZING_HANDLE_WIDGET, "_").concat(rowIndex, "_").concat(columnIndex, "_").concat(includeTooltip ? 'with' : 'no', "-tooltip"),
|
|
289
|
+
destroy: function destroy(node) {
|
|
290
|
+
ReactDOM.unmountComponentAtNode(node);
|
|
291
|
+
}
|
|
279
292
|
});
|
|
280
293
|
};
|
|
281
294
|
var createLastCellElementDecoration = function createLastCellElementDecoration(cellColumnPositioning, cellPos, cellNode) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Command } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
1
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
export declare const setEditorFocus: (editorHasFocus: boolean) => Command;
|
|
7
7
|
export declare const setTableRef: (ref?: HTMLTableElement) => Command;
|
|
8
8
|
export declare const setCellAttr: (name: string, value: any) => Command;
|
|
@@ -20,7 +20,9 @@ export declare const selectRow: (row: number, expand?: boolean) => Command;
|
|
|
20
20
|
export declare const showInsertColumnButton: (columnIndex: number) => Command;
|
|
21
21
|
export declare const showInsertRowButton: (rowIndex: number) => Command;
|
|
22
22
|
export declare const hideInsertColumnOrRowButton: () => Command;
|
|
23
|
-
export declare const addResizeHandleDecorations: (rowIndex: number, columnIndex: number) => Command;
|
|
23
|
+
export declare const addResizeHandleDecorations: (rowIndex: number, columnIndex: number, includeTooltip: boolean) => Command;
|
|
24
|
+
export declare const updateResizeHandleDecorations: (rowIndex?: number, columnIndex?: number, includeTooltip?: boolean) => Command;
|
|
25
|
+
export declare const removeResizeHandleDecorations: () => Command;
|
|
24
26
|
export declare const autoSizeTable: (view: EditorView, node: PMNode, table: HTMLTableElement, basePos: number | undefined, opts: {
|
|
25
27
|
containerWidth: number;
|
|
26
28
|
}) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import { ElementContentRects } from './types';
|
|
2
|
+
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { ElementContentRects } from './types';
|
|
5
5
|
export declare const handleBlur: (view: EditorView, event: Event) => boolean;
|
|
6
6
|
export declare const handleFocus: (view: EditorView, event: Event) => boolean;
|
|
7
7
|
export declare const handleClick: (view: EditorView, event: Event) => boolean;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { DecorationTransformer } from './types';
|
|
3
|
+
export declare const buildColumnResizingDecorations: (rowEndIndex: number, columnEndIndex: number, includeTooltip: boolean, getIntl: () => IntlShape) => DecorationTransformer;
|
|
4
|
+
export declare const clearColumnResizingDecorations: () => DecorationTransformer;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecoration, } from './column-controls';
|
|
2
|
-
export { buildColumnResizingDecorations } from './column-resizing';
|
|
2
|
+
export { buildColumnResizingDecorations, clearColumnResizingDecorations, } from './column-resizing';
|
|
3
3
|
export { composeDecorations } from './compose-decorations';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
1
2
|
import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
4
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
4
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
6
7
|
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
7
|
-
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, breakoutEnabled?: boolean, fullWidthModeEnabled?: boolean, tableResizingEnabled?: boolean, previousFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI) => 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, breakoutEnabled?: boolean, fullWidthModeEnabled?: boolean, tableResizingEnabled?: boolean, previousFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
|
+
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
|
-
import { ColumnResizingPluginState } from '../../types';
|
|
5
|
+
import type { ColumnResizingPluginState } from '../../types';
|
|
6
6
|
export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI): SafePlugin<ColumnResizingPluginState>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { DomAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import { ResizeState } from '../utils/types';
|
|
4
|
+
import type { ResizeState } from '../utils/types';
|
|
5
5
|
export interface ScaleOptions {
|
|
6
6
|
node: PMNode;
|
|
7
7
|
prevNode: PMNode;
|
|
@@ -69,10 +69,13 @@ export interface TablePluginState {
|
|
|
69
69
|
isFullWidthModeEnabled?: boolean;
|
|
70
70
|
layout?: TableLayout;
|
|
71
71
|
ordering?: TableColumnOrdering;
|
|
72
|
+
isResizeHandleWidgetAdded?: boolean;
|
|
72
73
|
resizeHandleRowIndex?: number;
|
|
73
74
|
resizeHandleColumnIndex?: number;
|
|
75
|
+
resizeHandleIncludeTooltip?: boolean;
|
|
74
76
|
isTableCollapsed?: boolean;
|
|
75
77
|
canCollapseTable?: boolean;
|
|
78
|
+
getIntl: () => IntlShape;
|
|
76
79
|
}
|
|
77
80
|
export type TablePluginAction = {
|
|
78
81
|
type: 'SET_EDITOR_FOCUS';
|
|
@@ -131,6 +134,20 @@ export type TablePluginAction = {
|
|
|
131
134
|
decorationSet: DecorationSet;
|
|
132
135
|
resizeHandleRowIndex: number;
|
|
133
136
|
resizeHandleColumnIndex: number;
|
|
137
|
+
resizeHandleIncludeTooltip: boolean;
|
|
138
|
+
};
|
|
139
|
+
} | {
|
|
140
|
+
type: 'UPDATE_RESIZE_HANDLE_DECORATIONS';
|
|
141
|
+
data: {
|
|
142
|
+
decorationSet: DecorationSet;
|
|
143
|
+
resizeHandleRowIndex: number | undefined;
|
|
144
|
+
resizeHandleColumnIndex: number | undefined;
|
|
145
|
+
resizeHandleIncludeTooltip: boolean | undefined;
|
|
146
|
+
};
|
|
147
|
+
} | {
|
|
148
|
+
type: 'REMOVE_RESIZE_HANDLE_DECORATIONS';
|
|
149
|
+
data: {
|
|
150
|
+
decorationSet: DecorationSet;
|
|
134
151
|
};
|
|
135
152
|
} | {
|
|
136
153
|
type: 'CLEAR_HOVER_SELECTION';
|
|
@@ -212,6 +229,7 @@ export declare enum TableDecorations {
|
|
|
212
229
|
COLUMN_CONTROLS_DECORATIONS = "COLUMN_CONTROLS_DECORATIONS",
|
|
213
230
|
COLUMN_SELECTED = "COLUMN_SELECTED",
|
|
214
231
|
COLUMN_RESIZING_HANDLE = "COLUMN_RESIZING_HANDLE",
|
|
232
|
+
COLUMN_RESIZING_HANDLE_WIDGET = "COLUMN_RESIZING_HANDLE_WIDGET",
|
|
215
233
|
COLUMN_RESIZING_HANDLE_LINE = "COLUMN_RESIZING_HANDLE_LINE",
|
|
216
234
|
LAST_CELL_ELEMENT = "LAST_CELL_ELEMENT"
|
|
217
235
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
1
2
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { ReadonlyTransaction, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -11,5 +12,5 @@ export declare const createControlsHoverDecoration: (cells: Cell[], type: 'row'
|
|
|
11
12
|
export declare const createColumnSelectedDecoration: (tr: Transaction | ReadonlyTransaction) => Decoration[];
|
|
12
13
|
export declare const createColumnControlsDecoration: (selection: Selection) => Decoration[];
|
|
13
14
|
export declare const updateDecorations: (node: PmNode, decorationSet: DecorationSet, decorations: Decoration[], key: TableDecorations) => DecorationSet;
|
|
14
|
-
export declare const createResizeHandleDecoration: (tr: Transaction | ReadonlyTransaction, rowIndexTarget: number, columnEndIndexTarget: Omit<CellColumnPositioning, 'left'
|
|
15
|
+
export declare const createResizeHandleDecoration: (tr: Transaction | ReadonlyTransaction, rowIndexTarget: number, columnEndIndexTarget: Omit<CellColumnPositioning, 'left'>, includeTooltip: boolean | undefined, getIntl: () => IntlShape) => [Decoration[], Decoration[]];
|
|
15
16
|
export declare const createColumnLineResize: (selection: Selection, cellColumnPositioning: Omit<CellColumnPositioning, 'left'>) => Decoration[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Command } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
1
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
export declare const setEditorFocus: (editorHasFocus: boolean) => Command;
|
|
7
7
|
export declare const setTableRef: (ref?: HTMLTableElement) => Command;
|
|
8
8
|
export declare const setCellAttr: (name: string, value: any) => Command;
|
|
@@ -20,7 +20,9 @@ export declare const selectRow: (row: number, expand?: boolean) => Command;
|
|
|
20
20
|
export declare const showInsertColumnButton: (columnIndex: number) => Command;
|
|
21
21
|
export declare const showInsertRowButton: (rowIndex: number) => Command;
|
|
22
22
|
export declare const hideInsertColumnOrRowButton: () => Command;
|
|
23
|
-
export declare const addResizeHandleDecorations: (rowIndex: number, columnIndex: number) => Command;
|
|
23
|
+
export declare const addResizeHandleDecorations: (rowIndex: number, columnIndex: number, includeTooltip: boolean) => Command;
|
|
24
|
+
export declare const updateResizeHandleDecorations: (rowIndex?: number, columnIndex?: number, includeTooltip?: boolean) => Command;
|
|
25
|
+
export declare const removeResizeHandleDecorations: () => Command;
|
|
24
26
|
export declare const autoSizeTable: (view: EditorView, node: PMNode, table: HTMLTableElement, basePos: number | undefined, opts: {
|
|
25
27
|
containerWidth: number;
|
|
26
28
|
}) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import { ElementContentRects } from './types';
|
|
2
|
+
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { ElementContentRects } from './types';
|
|
5
5
|
export declare const handleBlur: (view: EditorView, event: Event) => boolean;
|
|
6
6
|
export declare const handleFocus: (view: EditorView, event: Event) => boolean;
|
|
7
7
|
export declare const handleClick: (view: EditorView, event: Event) => boolean;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { DecorationTransformer } from './types';
|
|
3
|
+
export declare const buildColumnResizingDecorations: (rowEndIndex: number, columnEndIndex: number, includeTooltip: boolean, getIntl: () => IntlShape) => DecorationTransformer;
|
|
4
|
+
export declare const clearColumnResizingDecorations: () => DecorationTransformer;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecoration, } from './column-controls';
|
|
2
|
-
export { buildColumnResizingDecorations } from './column-resizing';
|
|
2
|
+
export { buildColumnResizingDecorations, clearColumnResizingDecorations, } from './column-resizing';
|
|
3
3
|
export { composeDecorations } from './compose-decorations';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
1
2
|
import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
4
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
4
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
6
7
|
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
7
|
-
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, breakoutEnabled?: boolean, fullWidthModeEnabled?: boolean, tableResizingEnabled?: boolean, previousFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI) => 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, breakoutEnabled?: boolean, fullWidthModeEnabled?: boolean, tableResizingEnabled?: boolean, previousFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
|
+
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
|
-
import { ColumnResizingPluginState } from '../../types';
|
|
5
|
+
import type { ColumnResizingPluginState } from '../../types';
|
|
6
6
|
export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI): SafePlugin<ColumnResizingPluginState>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { DomAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import { ResizeState } from '../utils/types';
|
|
4
|
+
import type { ResizeState } from '../utils/types';
|
|
5
5
|
export interface ScaleOptions {
|
|
6
6
|
node: PMNode;
|
|
7
7
|
prevNode: PMNode;
|
|
@@ -69,10 +69,13 @@ export interface TablePluginState {
|
|
|
69
69
|
isFullWidthModeEnabled?: boolean;
|
|
70
70
|
layout?: TableLayout;
|
|
71
71
|
ordering?: TableColumnOrdering;
|
|
72
|
+
isResizeHandleWidgetAdded?: boolean;
|
|
72
73
|
resizeHandleRowIndex?: number;
|
|
73
74
|
resizeHandleColumnIndex?: number;
|
|
75
|
+
resizeHandleIncludeTooltip?: boolean;
|
|
74
76
|
isTableCollapsed?: boolean;
|
|
75
77
|
canCollapseTable?: boolean;
|
|
78
|
+
getIntl: () => IntlShape;
|
|
76
79
|
}
|
|
77
80
|
export type TablePluginAction = {
|
|
78
81
|
type: 'SET_EDITOR_FOCUS';
|
|
@@ -131,6 +134,20 @@ export type TablePluginAction = {
|
|
|
131
134
|
decorationSet: DecorationSet;
|
|
132
135
|
resizeHandleRowIndex: number;
|
|
133
136
|
resizeHandleColumnIndex: number;
|
|
137
|
+
resizeHandleIncludeTooltip: boolean;
|
|
138
|
+
};
|
|
139
|
+
} | {
|
|
140
|
+
type: 'UPDATE_RESIZE_HANDLE_DECORATIONS';
|
|
141
|
+
data: {
|
|
142
|
+
decorationSet: DecorationSet;
|
|
143
|
+
resizeHandleRowIndex: number | undefined;
|
|
144
|
+
resizeHandleColumnIndex: number | undefined;
|
|
145
|
+
resizeHandleIncludeTooltip: boolean | undefined;
|
|
146
|
+
};
|
|
147
|
+
} | {
|
|
148
|
+
type: 'REMOVE_RESIZE_HANDLE_DECORATIONS';
|
|
149
|
+
data: {
|
|
150
|
+
decorationSet: DecorationSet;
|
|
134
151
|
};
|
|
135
152
|
} | {
|
|
136
153
|
type: 'CLEAR_HOVER_SELECTION';
|
|
@@ -212,6 +229,7 @@ export declare enum TableDecorations {
|
|
|
212
229
|
COLUMN_CONTROLS_DECORATIONS = "COLUMN_CONTROLS_DECORATIONS",
|
|
213
230
|
COLUMN_SELECTED = "COLUMN_SELECTED",
|
|
214
231
|
COLUMN_RESIZING_HANDLE = "COLUMN_RESIZING_HANDLE",
|
|
232
|
+
COLUMN_RESIZING_HANDLE_WIDGET = "COLUMN_RESIZING_HANDLE_WIDGET",
|
|
215
233
|
COLUMN_RESIZING_HANDLE_LINE = "COLUMN_RESIZING_HANDLE_LINE",
|
|
216
234
|
LAST_CELL_ELEMENT = "LAST_CELL_ELEMENT"
|
|
217
235
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
1
2
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { ReadonlyTransaction, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -11,7 +12,7 @@ export declare const createControlsHoverDecoration: (cells: Cell[], type: 'row'
|
|
|
11
12
|
export declare const createColumnSelectedDecoration: (tr: Transaction | ReadonlyTransaction) => Decoration[];
|
|
12
13
|
export declare const createColumnControlsDecoration: (selection: Selection) => Decoration[];
|
|
13
14
|
export declare const updateDecorations: (node: PmNode, decorationSet: DecorationSet, decorations: Decoration[], key: TableDecorations) => DecorationSet;
|
|
14
|
-
export declare const createResizeHandleDecoration: (tr: Transaction | ReadonlyTransaction, rowIndexTarget: number, columnEndIndexTarget: Omit<CellColumnPositioning, 'left'
|
|
15
|
+
export declare const createResizeHandleDecoration: (tr: Transaction | ReadonlyTransaction, rowIndexTarget: number, columnEndIndexTarget: Omit<CellColumnPositioning, 'left'>, includeTooltip: boolean | undefined, getIntl: () => IntlShape) => [
|
|
15
16
|
Decoration[],
|
|
16
17
|
Decoration[]
|
|
17
18
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/adf-schema": "28.1.2",
|
|
31
|
-
"@atlaskit/editor-common": "^74.
|
|
31
|
+
"@atlaskit/editor-common": "^74.54.0",
|
|
32
32
|
"@atlaskit/editor-palette": "1.5.1",
|
|
33
33
|
"@atlaskit/editor-plugin-analytics": "^0.1.0",
|
|
34
|
-
"@atlaskit/editor-plugin-content-insertion": "^0.0.
|
|
34
|
+
"@atlaskit/editor-plugin-content-insertion": "^0.0.11",
|
|
35
35
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
36
36
|
"@atlaskit/editor-shared-styles": "^2.6.0",
|
|
37
37
|
"@atlaskit/editor-tables": "^2.3.0",
|
|
38
38
|
"@atlaskit/icon": "^21.12.0",
|
|
39
39
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
40
40
|
"@atlaskit/theme": "^12.5.0",
|
|
41
|
-
"@atlaskit/tokens": "^1.
|
|
41
|
+
"@atlaskit/tokens": "^1.17.0",
|
|
42
42
|
"@atlaskit/tooltip": "^17.8.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"@emotion/react": "^11.7.1",
|
|
@@ -215,7 +215,7 @@ describe('table event handlers', () => {
|
|
|
215
215
|
);
|
|
216
216
|
const { state, dispatch } = editorView;
|
|
217
217
|
|
|
218
|
-
addResizeHandleDecorations(0, 0)(state, dispatch);
|
|
218
|
+
addResizeHandleDecorations(0, 0, false)(state, dispatch);
|
|
219
219
|
|
|
220
220
|
const firstCell = editorView.domAtPos(refs['<>']);
|
|
221
221
|
const event = {
|
|
@@ -4,9 +4,9 @@ import { render } from '@testing-library/react';
|
|
|
4
4
|
import { replaceRaf } from 'raf-stub';
|
|
5
5
|
|
|
6
6
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
7
|
-
import { Command } from '@atlaskit/editor-common/types';
|
|
7
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
8
8
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
10
10
|
import { selectTableClosestToPos } from '@atlaskit/editor-tables/src/utils/select-nodes';
|
|
11
11
|
import {
|
|
12
12
|
findTable,
|
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
selectTable,
|
|
15
15
|
} from '@atlaskit/editor-tables/utils';
|
|
16
16
|
import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
|
|
17
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
17
18
|
import {
|
|
18
19
|
doc,
|
|
19
|
-
DocBuilder,
|
|
20
20
|
p,
|
|
21
21
|
table,
|
|
22
22
|
td,
|
|
@@ -34,10 +34,8 @@ import {
|
|
|
34
34
|
} from '../../../plugins/table/commands';
|
|
35
35
|
import TableComponent from '../../../plugins/table/nodeviews/TableComponent';
|
|
36
36
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
37
|
-
import {
|
|
38
|
-
|
|
39
|
-
TablePluginState,
|
|
40
|
-
} from '../../../plugins/table/types';
|
|
37
|
+
import type { TablePluginState } from '../../../plugins/table/types';
|
|
38
|
+
import { TableCssClassName as ClassName } from '../../../plugins/table/types';
|
|
41
39
|
|
|
42
40
|
jest.mock('../../../plugins/table/utils/nodes', () =>
|
|
43
41
|
Object.assign({}, jest.requireActual('../../../plugins/table/utils/nodes'), {
|
|
@@ -67,7 +65,7 @@ describe('table -> nodeviews -> TableComponent.tsx', () => {
|
|
|
67
65
|
editorProps: {
|
|
68
66
|
allowTables: false,
|
|
69
67
|
dangerouslyAppendPlugins: {
|
|
70
|
-
__plugins: [tablePlugin()],
|
|
68
|
+
__plugins: [tablePlugin({ config: undefined })],
|
|
71
69
|
},
|
|
72
70
|
featureFlags,
|
|
73
71
|
},
|