i want something yummy
This commit is contained in:
parent
09c84e0379
commit
e08c381e0d
@ -90,7 +90,6 @@ function Diagram(props) {
|
|||||||
const canvas = useRef(null);
|
const canvas = useRef(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// const graph = new dia.Graph();
|
|
||||||
new dia.Paper({
|
new dia.Paper({
|
||||||
el: document.getElementById("canvas"),
|
el: document.getElementById("canvas"),
|
||||||
background: {
|
background: {
|
||||||
@ -102,20 +101,6 @@ function Diagram(props) {
|
|||||||
gridSize: 1,
|
gridSize: 1,
|
||||||
interactive: true,
|
interactive: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const rect = new shapes.standard.Rectangle();
|
|
||||||
rect.position(100, 100);
|
|
||||||
rect.resize(100, 40);
|
|
||||||
rect.attr({
|
|
||||||
body: {
|
|
||||||
fill: "#7039FF",
|
|
||||||
},
|
|
||||||
label: {
|
|
||||||
text: "hi",
|
|
||||||
fill: "white",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
rect.addTo(props.graph);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return <div id="canvas" ref={canvas} />;
|
return <div id="canvas" ref={canvas} />;
|
||||||
@ -124,6 +109,8 @@ function Diagram(props) {
|
|||||||
export default function Editor(props) {
|
export default function Editor(props) {
|
||||||
const graph = useMemo(() => new dia.Graph(), []);
|
const graph = useMemo(() => new dia.Graph(), []);
|
||||||
const [editor, setEditor] = useState(true);
|
const [editor, setEditor] = useState(true);
|
||||||
|
const [code, setCode] = useState("");
|
||||||
|
|
||||||
useEffect(() => {}, [graph]);
|
useEffect(() => {}, [graph]);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -146,7 +133,7 @@ export default function Editor(props) {
|
|||||||
>
|
>
|
||||||
change view
|
change view
|
||||||
</button>
|
</button>
|
||||||
|
<br />
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const rect = new shapes.standard.Rectangle();
|
const rect = new shapes.standard.Rectangle();
|
||||||
@ -162,12 +149,14 @@ export default function Editor(props) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
rect.addTo(graph);
|
rect.addTo(graph);
|
||||||
|
setCode(`${code}\n\ncreate table hi`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
add
|
add
|
||||||
</button>
|
</button>
|
||||||
{editor ? (
|
{editor ? (
|
||||||
<CodeMirror
|
<CodeMirror
|
||||||
|
value={code}
|
||||||
height="100%"
|
height="100%"
|
||||||
theme={myTheme}
|
theme={myTheme}
|
||||||
extensions={[sql()]}
|
extensions={[sql()]}
|
||||||
|
Loading…
Reference in New Issue
Block a user