MCPcopy
hub / github.com/tone-row/flowchart-fun / JSONCanvasShare

Function JSONCanvasShare

app/src/components/ShareDialog.tsx:639–676  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

637}
638
639function JSONCanvasShare() {
640 const title = useDocDetails("title", "flowchart.fun");
641
642 return (
643 <div className="grid gap-2">
644 <p className="leading-normal">
645 <Trans>
646 JSON Canvas is a JSON representation of your diagram used by{" "}
647 <a
648 href="https://obsidian.md/"
649 target="_blank"
650 className="text-blue-500 dark:text-blue-300 font-bold"
651 >
652 Obsidian
653 </a>{" "}
654 Canvas and other applications.
655 </Trans>
656 </p>
657 <Button2
658 color="blue"
659 data-session-activity="Download JSON Canvas"
660 onClick={() => {
661 if (!window.__cy) return;
662 const jsonCanvas = toJSONCanvas(window.__cy);
663 const blob = new Blob([JSON.stringify(jsonCanvas, null, 2)], {
664 type: "text/plain;charset=utf-8",
665 });
666 saveAs(blob, `${slugify(title)}.canvas`);
667 }}
668 className="w-full text-left text-neutral-500 dark:text-neutral-400 p-2 rounded border border-neutral-300 dark:border-neutral-700"
669 aria-label="Copy JSON Canvas"
670 leftIcon={<DownloadSimple size={16} />}
671 >
672 Download JSON Canvas
673 </Button2>
674 </div>
675 );
676}

Callers

nothing calls this directly

Calls 3

useDocDetailsFunction · 0.90
toJSONCanvasFunction · 0.90
slugifyFunction · 0.90

Tested by

no test coverage detected