@@ -246,6 +246,21 @@ struct ContentView: View {
246246 printDiagram ( )
247247 #endif
248248 }
249+ . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . sharePNG ) ) { _ in
250+ guard ! isSimulationMode else { return }
251+ exportPNG ( )
252+ }
253+ . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . shareDocument ) ) { _ in
254+ guard ! isSimulationMode else { return }
255+ shareDocumentAsFile ( )
256+ }
257+ . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . exportPDF ) ) { _ in
258+ guard ! isSimulationMode else { return }
259+ shareDiagramPDF ( )
260+ }
261+ . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . showAbout ) ) { _ in
262+ showInfo = true
263+ }
249264 . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . close ) ) { _ in
250265 guard ! isSimulationMode else { return }
251266 requestCloseDiagramTab ( id : tabsModel . selectedTabId )
@@ -590,65 +605,6 @@ struct ContentView: View {
590605 . accessibilityLabel (
591606 codeGeneratorAccessGranted ? lang . tr ( " a11y_generate_code " ) : lang . tr ( " a11y_generate_code_locked " )
592607 )
593- Button {
594- exportPNG ( )
595- } label : {
596- Label ( lang . tr ( " action_share_png " ) , systemImage : " square.and.arrow.up " )
597- . foregroundStyle ( isSimulationMode ? . tertiary : . primary )
598- }
599- . buttonStyle ( PaletteListElementButtonStyle ( ) )
600- . disabledAndDimmed ( isSimulationMode )
601- . listRowInsets (
602- isCompact
603- ? EdgeInsets ( top : 3 , leading : 10 , bottom : 3 , trailing : 10 )
604- : EdgeInsets ( top : 5 , leading : 12 , bottom : 5 , trailing : 12 )
605- )
606- . listRowSeparator ( . hidden )
607- . listRowBackground ( Color . clear )
608- Button {
609- shareDocumentAsFile ( )
610- } label : {
611- Label ( lang . tr ( " action_share_document " ) , systemImage : " square.and.arrow.up.on.square " )
612- . foregroundStyle ( isSimulationMode ? . tertiary : . primary )
613- }
614- . buttonStyle ( PaletteListElementButtonStyle ( ) )
615- . disabledAndDimmed ( isSimulationMode )
616- . listRowInsets (
617- isCompact
618- ? EdgeInsets ( top : 3 , leading : 10 , bottom : 3 , trailing : 10 )
619- : EdgeInsets ( top : 5 , leading : 12 , bottom : 5 , trailing : 12 )
620- )
621- . listRowSeparator ( . hidden )
622- . listRowBackground ( Color . clear )
623- Button {
624- shareDiagramPDF ( )
625- } label : {
626- Label ( lang . tr ( " action_export_pdf " ) , systemImage : " doc.text.magnifyingglass " )
627- . foregroundStyle ( isSimulationMode ? . tertiary : . primary )
628- }
629- . buttonStyle ( PaletteListElementButtonStyle ( ) )
630- . disabledAndDimmed ( isSimulationMode )
631- . listRowInsets (
632- isCompact
633- ? EdgeInsets ( top : 3 , leading : 10 , bottom : 3 , trailing : 10 )
634- : EdgeInsets ( top : 5 , leading : 12 , bottom : 5 , trailing : 12 )
635- )
636- . listRowSeparator ( . hidden )
637- . listRowBackground ( Color . clear )
638-
639- Button {
640- showInfo = true
641- } label : {
642- Label ( lang . tr ( " action_about " ) , systemImage : " info.circle " )
643- }
644- . buttonStyle ( PaletteListElementButtonStyle ( ) )
645- . listRowInsets (
646- isCompact
647- ? EdgeInsets ( top : 3 , leading : 10 , bottom : 4 , trailing : 10 )
648- : EdgeInsets ( top : 5 , leading : 12 , bottom : 8 , trailing : 12 )
649- )
650- . listRowSeparator ( . hidden )
651- . listRowBackground ( Color . clear )
652608 }
653609 }
654610 . listStyle ( . insetGrouped )
@@ -745,6 +701,10 @@ struct ContentView: View {
745701 onSave : performPrimarySave ,
746702 onSaveAs : { showExporter = true } ,
747703 onPrint : printAction ,
704+ onSharePNG : exportPNG ,
705+ onShareDocument : shareDocumentAsFile ,
706+ onExportPDF : shareDiagramPDF ,
707+ onShowAbout : { showInfo = true } ,
748708 onKeyboardDismiss : {
749709 focusedField = nil
750710 if isPhone { hideInspectorOnPhone = true }
0 commit comments