This commit is contained in:
1ilit
2023-09-19 15:48:24 +03:00
parent 76b9f7fc94
commit c83667be4e
4 changed files with 13 additions and 53 deletions

View File

@@ -241,7 +241,8 @@ export default function Canvas(props) {
onMouseMove={handleMouseMove}
onMouseDown={handleMouseDown}
onMouseUp={handleMouseUp}
style={{ width: "100%", height: "100%", cursor: cursor }}
style={{ width: "100%", height: "100%", cursor: cursor, backgroundColor:"white" }}
>
<defs>
<pattern
@@ -264,7 +265,7 @@ export default function Canvas(props) {
</defs>
<rect
x="0"
y="0"
y="0"
width="100%"
height="100%"
fill="url(#pattern-circles)"

View File

@@ -6,7 +6,7 @@ import { sql } from "@codemirror/lang-sql";
import { tags as t } from "@lezer/highlight";
import Shape from "./shape";
import { saveAs } from "file-saver";
import html2canvas from "html2canvas";
import { toPng } from "html-to-image";
import { Parser } from "node-sql-parser";
import { Tabs } from "@douyinfe/semi-ui";
import "react-resizable/css/styles.css";
@@ -165,10 +165,8 @@ const EditorPanel = (props) => {
<br />
<button
onClick={() => {
html2canvas(document.getElementById("canvas")).then((canvas) => {
canvas.toBlob((blob) => {
saveAs(blob, "image.png");
});
toPng(document.getElementById("canvas")).then(function (dataUrl) {
saveAs(dataUrl, "canvas.png");
});
}}
>