fix(scroll): disable scroll x behavior (#795)

This commit is contained in:
Guy Ben-Aharon
2025-07-27 20:15:04 +03:00
committed by GitHub
parent 8f27f10dec
commit 4bc71c52ff
2 changed files with 8 additions and 4 deletions

View File

@@ -83,6 +83,7 @@
} }
body { body {
@apply bg-background text-foreground; @apply bg-background text-foreground;
overscroll-behavior-x: none;
} }
.text-editable { .text-editable {

View File

@@ -1,4 +1,4 @@
import React, { useMemo, useState, useEffect } from 'react'; import React, { useMemo, useState, useEffect, useCallback } from 'react';
import type { DBTable } from '@/lib/domain/db-table'; import type { DBTable } from '@/lib/domain/db-table';
import { useChartDB } from '@/hooks/use-chartdb'; import { useChartDB } from '@/hooks/use-chartdb';
import { useTheme } from '@/hooks/use-theme'; import { useTheme } from '@/hooks/use-theme';
@@ -76,12 +76,15 @@ export const TableDBML: React.FC<TableDBMLProps> = ({ filteredTables }) => {
}, [currentDiagram, filteredTables, toast]); }, [currentDiagram, filteredTables, toast]);
// Determine which DBML string to display // Determine which DBML string to display
const dbmlToDisplay = dbmlFormat === 'inline' ? inlineDbml : standardDbml; const dbmlToDisplay = useMemo(
() => (dbmlFormat === 'inline' ? inlineDbml : standardDbml),
[dbmlFormat, inlineDbml, standardDbml]
);
// Toggle function // Toggle function
const toggleFormat = () => { const toggleFormat = useCallback(() => {
setDbmlFormat((prev) => (prev === 'inline' ? 'standard' : 'inline')); setDbmlFormat((prev) => (prev === 'inline' ? 'standard' : 'inline'));
}; }, []);
return ( return (
<CodeSnippet <CodeSnippet