diff --git a/services/web/frontend/js/features/source-editor/components/table-generator/cell.tsx b/services/web/frontend/js/features/source-editor/components/table-generator/cell.tsx
index e71260ca97..cde64a37d1 100644
--- a/services/web/frontend/js/features/source-editor/components/table-generator/cell.tsx
+++ b/services/web/frontend/js/features/source-editor/components/table-generator/cell.tsx
@@ -180,7 +180,7 @@ export const Cell: FC<{
[update, filterInput]
)
- let body =
+ let body =
if (editing) {
body = (
{
const { table: tableData } = useTableContext()
const tableRef = useRef(null)
const view = useCodeMirrorViewContext()
- const cellWidths: number[] = useMemo(() => {
+ const { columns: cellWidths, tableWidth } = useMemo(() => {
const columns = Array.from(
{ length: tableData.columns.length },
() => MINIMUM_CELL_WIDTH_CHARACTERS
@@ -95,9 +95,9 @@ export const Table: FC = () => {
// Third pass, normalize the columns to the total width of the table
const totalLog = columns.reduce((a, b) => a + b, 0)
for (let i = 0; i < columns.length; ++i) {
- columns[i] = Math.round((columns[i] / totalLog) * total)
+ columns[i] = Math.round((columns[i] / totalLog) * 100)
}
- return columns
+ return { columns, tableWidth: total }
}, [
tableData,
cellData?.cellIndex,
@@ -333,20 +333,15 @@ export const Table: FC = () => {
onKeyDown={onKeyDown}
tabIndex={-1}
ref={tableRef}
+ style={{ width: `${tableWidth}ch` }}
>
+
+
+ {tableData.columns.map((_, index) => (
+
+ ))}
+
- {/* A workaround for a chrome bug where it will not respect colspan
- unless there is a row filled with cells without colspan */}
-
- {/* A td for the row selector */}
- |
- {tableData.columns.map((_, columnIndex) => (
- |
- ))}
-
|
{tableData.columns.map((_, columnIndex) => (
diff --git a/services/web/frontend/js/features/source-editor/extensions/visual/table-generator.ts b/services/web/frontend/js/features/source-editor/extensions/visual/table-generator.ts
index 4fa772701d..dbcd1f204e 100644
--- a/services/web/frontend/js/features/source-editor/extensions/visual/table-generator.ts
+++ b/services/web/frontend/js/features/source-editor/extensions/visual/table-generator.ts
@@ -117,8 +117,11 @@ export const tableGeneratorTheme = EditorView.baseTheme({
'border-bottom-color': 'var(--table-generator-active-border-color)',
'border-bottom-width': 'var(--table-generator-active-border-width)',
},
- 'overflow-x': 'auto',
- 'overflow-y': 'hidden',
+ '& .table-generator-cell-render': {
+ 'overflow-x': 'auto',
+ 'overflow-y': 'hidden',
+ width: '100%',
+ },
},
'.table-generator-table': {