@atlaskit/editor-plugin-table 7.24.0 → 7.24.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 +17 -0
- package/dist/cjs/nodeviews/TableComponent.js +76 -44
- package/dist/cjs/nodeviews/TableContainer.js +4 -2
- package/dist/cjs/nodeviews/TableResizer.js +6 -5
- package/dist/cjs/nodeviews/lazy-node-views.js +4 -3
- package/dist/cjs/nodeviews/table.js +3 -2
- package/dist/cjs/plugin.js +5 -3
- package/dist/cjs/pm-plugins/main.js +3 -2
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +6 -5
- package/dist/cjs/ui/FloatingInsertButton/index.js +5 -3
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +4 -3
- package/dist/cjs/ui/TableFloatingControls/index.js +3 -2
- package/dist/cjs/ui/common-styles.js +1 -1
- package/dist/cjs/ui/ui-styles.js +1 -1
- package/dist/es2019/nodeviews/TableComponent.js +33 -4
- package/dist/es2019/nodeviews/TableContainer.js +4 -2
- package/dist/es2019/nodeviews/TableResizer.js +6 -5
- package/dist/es2019/nodeviews/lazy-node-views.js +4 -3
- package/dist/es2019/nodeviews/table.js +3 -2
- package/dist/es2019/plugin.js +5 -3
- package/dist/es2019/pm-plugins/main.js +3 -2
- package/dist/es2019/types.js +2 -0
- package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +8 -6
- package/dist/es2019/ui/FloatingInsertButton/index.js +6 -4
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +5 -4
- package/dist/es2019/ui/TableFloatingControls/index.js +3 -2
- package/dist/es2019/ui/common-styles.js +8 -0
- package/dist/es2019/ui/ui-styles.js +4 -0
- package/dist/esm/nodeviews/TableComponent.js +76 -44
- package/dist/esm/nodeviews/TableContainer.js +4 -2
- package/dist/esm/nodeviews/TableResizer.js +6 -5
- package/dist/esm/nodeviews/lazy-node-views.js +4 -3
- package/dist/esm/nodeviews/table.js +3 -2
- package/dist/esm/plugin.js +5 -3
- package/dist/esm/pm-plugins/main.js +3 -2
- package/dist/esm/types.js +2 -0
- package/dist/esm/ui/FloatingInsertButton/InsertButton.js +6 -5
- package/dist/esm/ui/FloatingInsertButton/index.js +6 -4
- package/dist/esm/ui/TableFloatingColumnControls/index.js +5 -4
- package/dist/esm/ui/TableFloatingControls/index.js +3 -2
- package/dist/esm/ui/common-styles.js +1 -1
- package/dist/esm/ui/ui-styles.js +1 -1
- package/dist/types/nodeviews/TableContainer.d.ts +2 -1
- package/dist/types/nodeviews/lazy-node-views.d.ts +1 -0
- package/dist/types/nodeviews/table.d.ts +1 -1
- package/dist/types/nodeviews/types.d.ts +1 -0
- package/dist/types/plugin.d.ts +1 -0
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/types.d.ts +2 -0
- package/dist/types/ui/FloatingInsertButton/InsertButton.d.ts +2 -1
- package/dist/types/ui/FloatingInsertButton/index.d.ts +1 -0
- package/dist/types/ui/TableFloatingColumnControls/index.d.ts +2 -1
- package/dist/types/ui/TableFloatingControls/index.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/lazy-node-views.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/types.d.ts +1 -0
- package/dist/types-ts4.5/plugin.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +2 -0
- package/dist/types-ts4.5/ui/FloatingInsertButton/InsertButton.d.ts +2 -1
- package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +2 -1
- package/package.json +2 -2
- package/src/nodeviews/TableComponent.tsx +31 -0
- package/src/nodeviews/TableContainer.tsx +3 -0
- package/src/nodeviews/TableResizer.tsx +5 -6
- package/src/nodeviews/lazy-node-views.ts +4 -0
- package/src/nodeviews/table.tsx +2 -0
- package/src/nodeviews/types.ts +1 -0
- package/src/plugin.tsx +4 -0
- package/src/pm-plugins/main.ts +2 -0
- package/src/types.ts +2 -0
- package/src/ui/FloatingInsertButton/InsertButton.tsx +12 -4
- package/src/ui/FloatingInsertButton/index.tsx +5 -2
- package/src/ui/TableFloatingColumnControls/index.tsx +8 -3
- package/src/ui/TableFloatingControls/index.tsx +5 -1
- package/src/ui/common-styles.ts +8 -0
- package/src/ui/ui-styles.ts +4 -0
|
@@ -5,7 +5,7 @@ import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
|
5
5
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
-
import {
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
10
10
|
|
|
11
11
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
@@ -37,6 +37,7 @@ export interface Props {
|
|
|
37
37
|
getScrollOffset?: () => number;
|
|
38
38
|
tableWrapperHeight?: number;
|
|
39
39
|
api?: PluginInjectionAPI;
|
|
40
|
+
isChromelessEditor?: boolean;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
export const TableFloatingColumnControls = ({
|
|
@@ -56,6 +57,7 @@ export const TableFloatingColumnControls = ({
|
|
|
56
57
|
getScrollOffset,
|
|
57
58
|
tableWrapperHeight,
|
|
58
59
|
api,
|
|
60
|
+
isChromelessEditor,
|
|
59
61
|
}: Props) => {
|
|
60
62
|
const [isDragging, setIsDragging] = useState(false);
|
|
61
63
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
@@ -109,7 +111,10 @@ export const TableFloatingColumnControls = ({
|
|
|
109
111
|
<div
|
|
110
112
|
ref={containerRef}
|
|
111
113
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
112
|
-
className={
|
|
114
|
+
className={
|
|
115
|
+
ClassName.DRAG_COLUMN_CONTROLS_WRAPPER +
|
|
116
|
+
(isChromelessEditor ? ' ' + ClassName.DRAG_CONTROLS_CHROMELESS : '')
|
|
117
|
+
}
|
|
113
118
|
data-testid="table-floating-column-controls-wrapper"
|
|
114
119
|
>
|
|
115
120
|
<ColumnControls
|
|
@@ -128,7 +133,7 @@ export const TableFloatingColumnControls = ({
|
|
|
128
133
|
isNumberColumnEnabled={isNumberColumnEnabled}
|
|
129
134
|
isDragging={isDragging}
|
|
130
135
|
getScrollOffset={getScrollOffset}
|
|
131
|
-
api={
|
|
136
|
+
api={fg('platform.editor.table.use-shared-state-hook') ? api : undefined}
|
|
132
137
|
/>
|
|
133
138
|
{isDragging && (
|
|
134
139
|
<ColumnDropTargets
|
|
@@ -47,6 +47,7 @@ export interface TableFloatingControlsProps {
|
|
|
47
47
|
stickyHeader?: RowStickyState;
|
|
48
48
|
insertRowButtonIndex?: number;
|
|
49
49
|
tableWrapperWidth?: number;
|
|
50
|
+
isChromelessEditor?: boolean;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
export const TableFloatingControls = ({
|
|
@@ -67,6 +68,7 @@ export const TableFloatingControls = ({
|
|
|
67
68
|
isTableHovered,
|
|
68
69
|
tableWrapperWidth,
|
|
69
70
|
api,
|
|
71
|
+
isChromelessEditor,
|
|
70
72
|
}: TableFloatingControlsProps & { api?: ExtractInjectionAPI<TablePlugin> }) => {
|
|
71
73
|
const _selectRow = useCallback(
|
|
72
74
|
(row: number, expand: boolean) => {
|
|
@@ -126,7 +128,9 @@ export const TableFloatingControls = ({
|
|
|
126
128
|
stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
|
|
127
129
|
|
|
128
130
|
const wrapperClassName = isDragAndDropEnabled
|
|
129
|
-
?
|
|
131
|
+
? isChromelessEditor
|
|
132
|
+
? ClassName.DRAG_ROW_CONTROLS_WRAPPER + ' ' + ClassName.DRAG_CONTROLS_CHROMELESS
|
|
133
|
+
: ClassName.DRAG_ROW_CONTROLS_WRAPPER
|
|
130
134
|
: ClassName.ROW_CONTROLS_WRAPPER;
|
|
131
135
|
|
|
132
136
|
const tablePos = findTable(editorView.state.selection)?.pos;
|
package/src/ui/common-styles.ts
CHANGED
|
@@ -514,10 +514,18 @@ export const baseTableStyles = (props: { featureFlags?: FeatureFlags }) => css`
|
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
|
|
517
|
+
.${ClassName.DRAG_ROW_CONTROLS_WRAPPER}.${ClassName.DRAG_CONTROLS_CHROMELESS} {
|
|
518
|
+
left: -4px;
|
|
519
|
+
}
|
|
520
|
+
|
|
517
521
|
.${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
|
|
518
522
|
padding: 0 ${tablePadding}px;
|
|
519
523
|
}
|
|
520
524
|
|
|
525
|
+
.${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER}.${ClassName.DRAG_CONTROLS_CHROMELESS} {
|
|
526
|
+
left: -8px;
|
|
527
|
+
}
|
|
528
|
+
|
|
521
529
|
&.${ClassName.TABLE_CONTAINER}[data-number-column='true'] {
|
|
522
530
|
padding-left: ${akEditorTableNumberColumnWidth + tablePadding - 1}px;
|
|
523
531
|
}
|
package/src/ui/ui-styles.ts
CHANGED
|
@@ -198,6 +198,10 @@ export const dragInsertButtonWrapper = () => css`
|
|
|
198
198
|
left: -3px;
|
|
199
199
|
bottom: -2px;
|
|
200
200
|
}
|
|
201
|
+
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW_CHROMELESS} {
|
|
202
|
+
left: 6px;
|
|
203
|
+
bottom: -2px;
|
|
204
|
+
}
|
|
201
205
|
|
|
202
206
|
.${ClassName.DRAG_CONTROLS_INSERT_BUTTON} {
|
|
203
207
|
${Button(`
|