@@ -232,6 +232,21 @@ struct ContentView: View {
232232 printDiagram ( )
233233 #endif
234234 }
235+ . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . sharePNG ) ) { _ in
236+ guard ! isSimulationMode else { return }
237+ exportPNG ( )
238+ }
239+ . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . shareDocument ) ) { _ in
240+ guard ! isSimulationMode else { return }
241+ shareDocumentAsFile ( )
242+ }
243+ . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . exportPDF ) ) { _ in
244+ guard ! isSimulationMode else { return }
245+ shareDiagramPDF ( )
246+ }
247+ . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . showAbout ) ) { _ in
248+ showInfo = true
249+ }
235250 . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . close ) ) { _ in
236251 guard ! isSimulationMode else { return }
237252 requestCloseDiagramTab ( id : tabsModel . selectedTabId )
@@ -576,65 +591,6 @@ struct ContentView: View {
576591 . accessibilityLabel (
577592 codeGeneratorAccessGranted ? lang . tr ( " a11y_generate_code " ) : lang . tr ( " a11y_generate_code_locked " )
578593 )
579- Button {
580- exportPNG ( )
581- } label : {
582- Label ( lang . tr ( " action_share_png " ) , systemImage : " square.and.arrow.up " )
583- . foregroundStyle ( isSimulationMode ? . tertiary : . primary )
584- }
585- . buttonStyle ( PaletteListElementButtonStyle ( ) )
586- . disabledAndDimmed ( isSimulationMode )
587- . listRowInsets (
588- isCompact
589- ? EdgeInsets ( top : 3 , leading : 10 , bottom : 3 , trailing : 10 )
590- : EdgeInsets ( top : 5 , leading : 12 , bottom : 5 , trailing : 12 )
591- )
592- . listRowSeparator ( . hidden )
593- . listRowBackground ( Color . clear )
594- Button {
595- shareDocumentAsFile ( )
596- } label : {
597- Label ( lang . tr ( " action_share_document " ) , systemImage : " square.and.arrow.up.on.square " )
598- . foregroundStyle ( isSimulationMode ? . tertiary : . primary )
599- }
600- . buttonStyle ( PaletteListElementButtonStyle ( ) )
601- . disabledAndDimmed ( isSimulationMode )
602- . listRowInsets (
603- isCompact
604- ? EdgeInsets ( top : 3 , leading : 10 , bottom : 3 , trailing : 10 )
605- : EdgeInsets ( top : 5 , leading : 12 , bottom : 5 , trailing : 12 )
606- )
607- . listRowSeparator ( . hidden )
608- . listRowBackground ( Color . clear )
609- Button {
610- shareDiagramPDF ( )
611- } label : {
612- Label ( lang . tr ( " action_export_pdf " ) , systemImage : " doc.text.magnifyingglass " )
613- . foregroundStyle ( isSimulationMode ? . tertiary : . primary )
614- }
615- . buttonStyle ( PaletteListElementButtonStyle ( ) )
616- . disabledAndDimmed ( isSimulationMode )
617- . listRowInsets (
618- isCompact
619- ? EdgeInsets ( top : 3 , leading : 10 , bottom : 3 , trailing : 10 )
620- : EdgeInsets ( top : 5 , leading : 12 , bottom : 5 , trailing : 12 )
621- )
622- . listRowSeparator ( . hidden )
623- . listRowBackground ( Color . clear )
624-
625- Button {
626- showInfo = true
627- } label : {
628- Label ( lang . tr ( " action_about " ) , systemImage : " info.circle " )
629- }
630- . buttonStyle ( PaletteListElementButtonStyle ( ) )
631- . listRowInsets (
632- isCompact
633- ? EdgeInsets ( top : 3 , leading : 10 , bottom : 4 , trailing : 10 )
634- : EdgeInsets ( top : 5 , leading : 12 , bottom : 8 , trailing : 12 )
635- )
636- . listRowSeparator ( . hidden )
637- . listRowBackground ( Color . clear )
638594 }
639595 }
640596 . listStyle ( . insetGrouped )
@@ -731,6 +687,10 @@ struct ContentView: View {
731687 onSave : performPrimarySave ,
732688 onSaveAs : { showExporter = true } ,
733689 onPrint : printAction ,
690+ onSharePNG : exportPNG ,
691+ onShareDocument : shareDocumentAsFile ,
692+ onExportPDF : shareDiagramPDF ,
693+ onShowAbout : { showInfo = true } ,
734694 onKeyboardDismiss : {
735695 focusedField = nil
736696 if isPhone { hideInspectorOnPhone = true }
0 commit comments