use different ids

This commit is contained in:
Bernard Xie 2023-01-03 15:28:51 -08:00
parent dfd66232fc
commit 6b3634ec4c
No known key found for this signature in database
GPG key ID: 3C3E0036CE0F892C
2 changed files with 3 additions and 3 deletions

View file

@ -5,7 +5,7 @@ window.addEventListener("DOMContentLoaded", () => {
function init(reconnectDelay) {
const d2ErrDiv = window.document.querySelector("#d2-err");
const d2SVG = window.document.querySelector("#d2-svg");
const d2SVG = window.document.querySelector("#d2-svg-container");
const devMode = document.body.dataset.d2DevMode === "true";
const ws = new WebSocket(
@ -34,7 +34,7 @@ function init(reconnectDelay) {
// out the width, height and viewbox out of the top level SVG tag and update those manually.
d2SVG.innerHTML = msg.svg;
const svgEl = d2SVG.querySelector("svg");
const svgEl = d2SVG.querySelector("#d2-svg");
let width = parseInt(svgEl.getAttribute("width"), 10);
let height = parseInt(svgEl.getAttribute("height"), 10);
if (isInit) {

View file

@ -430,7 +430,7 @@ func (w *watcher) handleRoot(hw http.ResponseWriter, r *http.Request) {
</head>
<body data-d2-dev-mode=%t>
<div id="d2-err" style="display: none"></div>
<div id="d2-svg"></div>
<div id="d2-svg-container"></div>
</body>
</html>`, w.outputPath, w.devMode)
}