File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 8282
8383 < main class ="canvas-container ">
8484 < div class ="floating-actions ">
85+ < button class ="export-btn-floating " id ="copy-link-btn " aria-label ="Copy link " title ="Copy diagram link ">
86+ < svg width ="20 " height ="20 " viewBox ="0 0 24 24 " fill ="none " stroke ="currentColor " stroke-width ="2.2 " stroke-linecap ="round " stroke-linejoin ="round " aria-hidden ="true ">
87+ < rect x ="9 " y ="9 " width ="13 " height ="13 " rx ="2 "> </ rect >
88+ < path d ="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1 "> </ path >
89+ </ svg >
90+ </ button >
8591 < button class ="export-btn-floating refresh-btn " id ="refresh-btn " aria-label ="Refresh diagram " title ="Refresh diagram ">
8692 < svg width ="20 " height ="20 " viewBox ="0 0 24 24 " fill ="none " stroke ="currentColor " stroke-width ="2.2 " stroke-linecap ="round " stroke-linejoin ="round " aria-hidden ="true ">
8793 < path d ="M23 4v6h-6 "> </ path >
Original file line number Diff line number Diff line change @@ -639,6 +639,7 @@ export async function initializeApp() {
639639 initModelPicker ( ) ;
640640 initLayerDragTargets ( ) ;
641641 initExportButton ( ) ;
642+ initCopyLinkButton ( ) ;
642643 initRefreshButton ( ) ;
643644 const restored = await restoreDiagramStateFromStorage ( ) ;
644645 if ( ! restored ) {
@@ -735,6 +736,20 @@ function initRefreshButton() {
735736 } ) ;
736737}
737738
739+ function initCopyLinkButton ( ) {
740+ const copyBtn = document . getElementById ( 'copy-link-btn' ) ;
741+ if ( ! copyBtn ) return ;
742+ copyBtn . addEventListener ( 'click' , async ( ) => {
743+ try {
744+ await persistDiagramState ( ) ;
745+ const url = new URL ( window . location . href ) ;
746+ await navigator . clipboard . writeText ( url . toString ( ) ) ;
747+ } catch ( error ) {
748+ console . error ( 'Failed to copy link' , error ) ;
749+ }
750+ } ) ;
751+ }
752+
738753function clearCustomItemIndex ( ) {
739754 Object . keys ( itemCategoryIndex ) . forEach ( id => {
740755 if ( id . startsWith ( 'custom-' ) ) {
You can’t perform that action at this time.
0 commit comments