@atlaskit/editor-plugin-table 7.6.11 → 7.6.13
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 +14 -0
- package/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/nodeviews/TableContainer.js +7 -1
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/ui/DragHandle/index.js +9 -0
- package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +8 -1
- package/dist/es2019/nodeviews/TableContainer.js +8 -1
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/ui/DragHandle/index.js +9 -0
- package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +8 -1
- package/dist/esm/nodeviews/TableContainer.js +7 -1
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/ui/DragHandle/index.js +9 -0
- package/dist/esm/ui/FloatingInsertButton/InsertButton.js +8 -1
- package/dist/types/plugin.d.ts +3 -1
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +90 -2
- package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +180 -4
- package/dist/types/ui/TableFloatingControls/index.d.ts +90 -2
- package/dist/types-ts4.5/plugin.d.ts +3 -1
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +106 -2
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +212 -4
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +106 -2
- package/package.json +3 -2
- package/src/nodeviews/TableContainer.tsx +12 -2
- package/src/plugin.tsx +2 -0
- package/src/pm-plugins/main.ts +4 -1
- package/src/ui/DragHandle/index.tsx +9 -0
- package/src/ui/FloatingInsertButton/InsertButton.tsx +16 -1
- package/tsconfig.app.json +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.13",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,11 +30,12 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^35.8.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.0.17",
|
|
33
|
-
"@atlaskit/editor-common": "^78.
|
|
33
|
+
"@atlaskit/editor-common": "^78.24.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.5.3",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-content-insertion": "^1.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^1.0.0",
|
|
38
39
|
"@atlaskit/editor-plugin-guideline": "^1.0.0",
|
|
39
40
|
"@atlaskit/editor-plugin-selection": "^1.1.0",
|
|
40
41
|
"@atlaskit/editor-plugin-width": "^1.0.0",
|
|
@@ -5,6 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
|
|
6
6
|
import type { TableEventPayload } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import type { GuidelineConfig } from '@atlaskit/editor-common/guideline';
|
|
8
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
8
9
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
9
10
|
import { calcTableWidth } from '@atlaskit/editor-common/styles';
|
|
10
11
|
import type { EditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
@@ -180,6 +181,9 @@ export const ResizableTableContainer = React.memo(
|
|
|
180
181
|
);
|
|
181
182
|
|
|
182
183
|
const tableWidth = getTableContainerWidth(node);
|
|
184
|
+
const { editorViewModeState } = useSharedPluginState(pluginInjectionApi, [
|
|
185
|
+
'editorViewMode',
|
|
186
|
+
]);
|
|
183
187
|
|
|
184
188
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
185
189
|
const responsiveContainerWidth = isTableScalingEnabled
|
|
@@ -239,11 +243,17 @@ export const ResizableTableContainer = React.memo(
|
|
|
239
243
|
className={ClassName.TABLE_RESIZER_CONTAINER}
|
|
240
244
|
ref={containerRef}
|
|
241
245
|
>
|
|
242
|
-
|
|
246
|
+
{editorViewModeState?.mode === 'view' ? (
|
|
243
247
|
<InnerContainer className={className} node={node}>
|
|
244
248
|
{children}
|
|
245
249
|
</InnerContainer>
|
|
246
|
-
|
|
250
|
+
) : (
|
|
251
|
+
<TableResizer {...tableResizerProps}>
|
|
252
|
+
<InnerContainer className={className} node={node}>
|
|
253
|
+
{children}
|
|
254
|
+
</InnerContainer>
|
|
255
|
+
</TableResizer>
|
|
256
|
+
)}
|
|
247
257
|
</div>
|
|
248
258
|
</div>
|
|
249
259
|
);
|
package/src/plugin.tsx
CHANGED
|
@@ -35,6 +35,7 @@ import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
|
35
35
|
import type { AccessibilityUtilsPlugin } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
36
36
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
37
37
|
import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
38
|
+
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
38
39
|
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
39
40
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
40
41
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
@@ -141,6 +142,7 @@ export type TablePlugin = NextEditorPlugin<
|
|
|
141
142
|
GuidelinePlugin,
|
|
142
143
|
SelectionPlugin,
|
|
143
144
|
OptionalPlugin<MediaPlugin>,
|
|
145
|
+
OptionalPlugin<EditorViewModePlugin>,
|
|
144
146
|
];
|
|
145
147
|
}
|
|
146
148
|
>;
|
package/src/pm-plugins/main.ts
CHANGED
|
@@ -352,7 +352,10 @@ export const createPlugin = (
|
|
|
352
352
|
|
|
353
353
|
if (
|
|
354
354
|
targetClassList.contains(ClassName.CONTROLS_BUTTON) ||
|
|
355
|
-
targetClassList.contains(ClassName.CONTEXTUAL_MENU_BUTTON)
|
|
355
|
+
targetClassList.contains(ClassName.CONTEXTUAL_MENU_BUTTON) ||
|
|
356
|
+
targetClassList.contains(
|
|
357
|
+
ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE,
|
|
358
|
+
)
|
|
356
359
|
) {
|
|
357
360
|
return true;
|
|
358
361
|
}
|
|
@@ -227,6 +227,15 @@ const DragHandleComponent = ({
|
|
|
227
227
|
alignSelf: isColumn ? 'none' : 'center',
|
|
228
228
|
zIndex: isColumn ? '-1' : 'auto',
|
|
229
229
|
}}
|
|
230
|
+
onMouseUp={(e) => {
|
|
231
|
+
// should toggle menu if current drag menu open.
|
|
232
|
+
// return focus to editor so copying table selections whilst still works, i cannot call e.preventDefault in a mousemove event as this stops dragstart events from firing
|
|
233
|
+
// -> this is bad for a11y but is the current standard new copy/paste keyboard shortcuts should be introduced instead
|
|
234
|
+
editorView.focus();
|
|
235
|
+
if (isDragMenuOpen) {
|
|
236
|
+
toggleDragMenu && toggleDragMenu('mouse', e);
|
|
237
|
+
}
|
|
238
|
+
}}
|
|
230
239
|
onClick={onClick}
|
|
231
240
|
/>
|
|
232
241
|
<button
|
|
@@ -58,6 +58,19 @@ const getToolbarSize = (tableRef: HTMLElement): number => {
|
|
|
58
58
|
return tableToolbarSize;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
+
const getNumberColumnWidth = (
|
|
62
|
+
tableRef: HTMLElement,
|
|
63
|
+
isDragAndDropEnabled?: boolean,
|
|
64
|
+
): number => {
|
|
65
|
+
const parent = closestElement(tableRef, `.${ClassName.TABLE_CONTAINER}`);
|
|
66
|
+
if (parent && isDragAndDropEnabled) {
|
|
67
|
+
return parent.querySelector(`.${ClassName.NUMBERED_COLUMN}`)
|
|
68
|
+
? akEditorTableNumberColumnWidth - 1
|
|
69
|
+
: 0;
|
|
70
|
+
}
|
|
71
|
+
return 0;
|
|
72
|
+
};
|
|
73
|
+
|
|
61
74
|
const getInsertLineWidth = (
|
|
62
75
|
tableRef: HTMLElement,
|
|
63
76
|
isDragAndDropEnabled?: boolean,
|
|
@@ -78,7 +91,9 @@ const getInsertLineWidth = (
|
|
|
78
91
|
Math.min(
|
|
79
92
|
offsetWidth + toolbarSize,
|
|
80
93
|
parentOffsetWidth + toolbarSize - Math.max(scrollLeft - diff, 0),
|
|
81
|
-
) +
|
|
94
|
+
) +
|
|
95
|
+
lineOffset +
|
|
96
|
+
getNumberColumnWidth(tableRef, isDragAndDropEnabled)
|
|
82
97
|
);
|
|
83
98
|
};
|
|
84
99
|
|