mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 12:33:33 +00:00
minor: Allow copying the graphviz source from the view crategraph webview
This commit is contained in:
parent
7a6d5c680c
commit
34177d8552
1 changed files with 6 additions and 1 deletions
|
@ -667,17 +667,22 @@ function crateGraph(ctx: CtxInit, full: boolean): Cmd {
|
|||
<script type="text/javascript" src="${uri}/d3-graphviz/build/d3-graphviz.min.js"></script>
|
||||
<div id="graph"></div>
|
||||
<script>
|
||||
let dot = \`${dot}\`;
|
||||
let graph = d3.select("#graph")
|
||||
.graphviz({ useWorker: false, useSharedWorker: false })
|
||||
.fit(true)
|
||||
.zoomScaleExtent([0.1, Infinity])
|
||||
.renderDot(\`${dot}\`);
|
||||
.renderDot(dot);
|
||||
|
||||
d3.select(window).on("click", (event) => {
|
||||
if (event.ctrlKey) {
|
||||
graph.resetZoom(d3.transition().duration(100));
|
||||
}
|
||||
});
|
||||
d3.select(window).on("copy", (event) => {
|
||||
event.clipboardData.setData("text/plain", dot);
|
||||
event.preventDefault();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
`;
|
||||
|
|
Loading…
Reference in a new issue