Skip to content

Commit 2c251a7

Browse files
committed
Auto merge of rust-lang#14565 - Veykril:view-crate-graph, r=Veykril
minor: Allow copying the graphviz source from the view crategraph webview
2 parents 08ce44e + 34177d8 commit 2c251a7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

editors/code/src/commands.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,17 +667,22 @@ function crateGraph(ctx: CtxInit, full: boolean): Cmd {
667667
<script type="text/javascript" src="${uri}/d3-graphviz/build/d3-graphviz.min.js"></script>
668668
<div id="graph"></div>
669669
<script>
670+
let dot = \`${dot}\`;
670671
let graph = d3.select("#graph")
671672
.graphviz({ useWorker: false, useSharedWorker: false })
672673
.fit(true)
673674
.zoomScaleExtent([0.1, Infinity])
674-
.renderDot(\`${dot}\`);
675+
.renderDot(dot);
675676
676677
d3.select(window).on("click", (event) => {
677678
if (event.ctrlKey) {
678679
graph.resetZoom(d3.transition().duration(100));
679680
}
680681
});
682+
d3.select(window).on("copy", (event) => {
683+
event.clipboardData.setData("text/plain", dot);
684+
event.preventDefault();
685+
});
681686
</script>
682687
</body>
683688
`;

0 commit comments

Comments
 (0)