change d2-svg to class
This commit is contained in:
parent
9aea07e22c
commit
21c724c58d
3 changed files with 3 additions and 3 deletions
|
|
@ -27,7 +27,7 @@ function init(reconnectDelay) {
|
||||||
const parsedXML = new DOMParser().parseFromString(msg.svg, "text/xml");
|
const parsedXML = new DOMParser().parseFromString(msg.svg, "text/xml");
|
||||||
d2SVG.replaceChildren(parsedXML.documentElement);
|
d2SVG.replaceChildren(parsedXML.documentElement);
|
||||||
changeFavicon("/static/favicon.ico");
|
changeFavicon("/static/favicon.ico");
|
||||||
const svgEl = d2SVG.querySelector("#d2-svg");
|
const svgEl = d2SVG.querySelector(".d2-svg");
|
||||||
// just use inner SVG in watch mode
|
// just use inner SVG in watch mode
|
||||||
svgEl.parentElement.replaceWith(svgEl);
|
svgEl.parentElement.replaceWith(svgEl);
|
||||||
let width = parseInt(svgEl.getAttribute("width"), 10);
|
let width = parseInt(svgEl.getAttribute("width"), 10);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ func Wrap(rootDiagram *d2target.Diagram, svgs [][]byte, renderOpts d2svg.RenderO
|
||||||
)
|
)
|
||||||
fmt.Fprint(buf, fitToScreenWrapperOpening)
|
fmt.Fprint(buf, fitToScreenWrapperOpening)
|
||||||
|
|
||||||
innerOpening := fmt.Sprintf(`<svg id="d2-svg" width="%d" height="%d" viewBox="%d %d %d %d">`,
|
innerOpening := fmt.Sprintf(`<svg class="d2-svg" width="%d" height="%d" viewBox="%d %d %d %d">`,
|
||||||
width, height, left, top, width, height)
|
width, height, left, top, width, height)
|
||||||
fmt.Fprint(buf, innerOpening)
|
fmt.Fprint(buf, innerOpening)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2123,7 +2123,7 @@ func Render(diagram *d2target.Diagram, opts *RenderOpts) ([]byte, error) {
|
||||||
xmlTag = `<?xml version="1.0" encoding="utf-8"?>`
|
xmlTag = `<?xml version="1.0" encoding="utf-8"?>`
|
||||||
}
|
}
|
||||||
fitToScreenWrapperClosing = "</svg>"
|
fitToScreenWrapperClosing = "</svg>"
|
||||||
idAttr = `id="d2-svg"`
|
idAttr = `class="d2-svg"`
|
||||||
tag = "svg"
|
tag = "svg"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue