mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-09-01 18:35:24 +00:00
Table and field drag and drop ordering (#444)
* Add dnd for tables and fields * Fix inputs * Decouple ids and indecies in the editor * Decouple ids and indecies in utils * Fix field indexes * Use nanoid instead of numberic ids for fields and tables * Fix review comments
This commit is contained in:
@@ -28,13 +28,15 @@ import { get } from "../api/gists";
|
||||
|
||||
export const IdContext = createContext({ gistId: "", setGistId: () => {} });
|
||||
|
||||
const SIDEPANEL_MIN_WIDTH = 384;
|
||||
|
||||
export default function WorkSpace() {
|
||||
const [id, setId] = useState(0);
|
||||
const [gistId, setGistId] = useState("");
|
||||
const [loadedFromGistId, setLoadedFromGistId] = useState("");
|
||||
const [title, setTitle] = useState("Untitled Diagram");
|
||||
const [resize, setResize] = useState(false);
|
||||
const [width, setWidth] = useState(340);
|
||||
const [width, setWidth] = useState(SIDEPANEL_MIN_WIDTH);
|
||||
const [lastSaved, setLastSaved] = useState("");
|
||||
const [showSelectDbModal, setShowSelectDbModal] = useState(false);
|
||||
const [selectedDb, setSelectedDb] = useState("");
|
||||
@@ -61,7 +63,7 @@ export default function WorkSpace() {
|
||||
const handleResize = (e) => {
|
||||
if (!resize) return;
|
||||
const w = isRtl(i18n.language) ? window.innerWidth - e.clientX : e.clientX;
|
||||
if (w > 340) setWidth(w);
|
||||
if (w > SIDEPANEL_MIN_WIDTH) setWidth(w);
|
||||
};
|
||||
|
||||
const save = useCallback(async () => {
|
||||
|
Reference in New Issue
Block a user