mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-09-20 22:44:52 +00:00
hi
This commit is contained in:
@@ -85,6 +85,7 @@ export default function Editor(props) {
|
||||
notNull: true,
|
||||
increment: true,
|
||||
comment: "",
|
||||
id: 0,
|
||||
},
|
||||
],
|
||||
comment: "",
|
||||
@@ -105,6 +106,22 @@ export default function Editor(props) {
|
||||
}
|
||||
};
|
||||
|
||||
const updateField = (tid, fid, updatedValues) => {
|
||||
setTables((prev) =>
|
||||
prev.map((table, i) => {
|
||||
if (tid === i) {
|
||||
return {
|
||||
...table,
|
||||
fields: table.fields.map((field, j) =>
|
||||
fid === j ? { ...field, ...updatedValues } : field
|
||||
),
|
||||
};
|
||||
}
|
||||
return table;
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
const addArea = (addToHistory = true, data) => {
|
||||
if (data) {
|
||||
setAreas((prev) => {
|
||||
@@ -325,7 +342,7 @@ export default function Editor(props) {
|
||||
);
|
||||
};
|
||||
|
||||
const editNote = (id, values, addToHistory=true) => {
|
||||
const editNote = (id, values, addToHistory = true) => {
|
||||
setNotes((prev) =>
|
||||
prev.map((t) => {
|
||||
if (t.id === id) {
|
||||
@@ -337,7 +354,7 @@ export default function Editor(props) {
|
||||
return t;
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
document.title = "Editor - drawDB";
|
||||
@@ -351,6 +368,7 @@ export default function Editor(props) {
|
||||
setTables,
|
||||
addTable,
|
||||
moveTable,
|
||||
updateField,
|
||||
deleteTable,
|
||||
relationships,
|
||||
setRelationships,
|
||||
|
Reference in New Issue
Block a user