@@ -249,6 +249,21 @@ struct ContentView: View {
249249 printDiagram ( )
250250 #endif
251251 }
252+ . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . sharePNG ) ) { _ in
253+ guard ! isSimulationMode else { return }
254+ exportPNG ( )
255+ }
256+ . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . shareDocument ) ) { _ in
257+ guard ! isSimulationMode else { return }
258+ shareDocumentAsFile ( )
259+ }
260+ . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . exportPDF ) ) { _ in
261+ guard ! isSimulationMode else { return }
262+ shareDiagramPDF ( )
263+ }
264+ . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . showAbout ) ) { _ in
265+ showInfo = true
266+ }
252267 . onReceive ( NotificationCenter . default . publisher ( for : DiagramMenuNotification . close ) ) { _ in
253268 guard ! isSimulationMode else { return }
254269 requestCloseDiagramTab ( id : tabsModel . selectedTabId )
@@ -599,65 +614,6 @@ struct ContentView: View {
599614 . accessibilityLabel (
600615 codeGeneratorAccessGranted ? lang . tr ( " a11y_generate_code " ) : lang . tr ( " a11y_generate_code_locked " )
601616 )
602- Button {
603- exportPNG ( )
604- } label : {
605- Label ( lang . tr ( " action_share_png " ) , systemImage : " square.and.arrow.up " )
606- . foregroundStyle ( isSimulationMode ? . tertiary : . primary )
607- }
608- . buttonStyle ( PaletteListElementButtonStyle ( ) )
609- . disabledAndDimmed ( isSimulationMode )
610- . listRowInsets (
611- isCompact
612- ? EdgeInsets ( top : 3 , leading : 10 , bottom : 3 , trailing : 10 )
613- : EdgeInsets ( top : 5 , leading : 12 , bottom : 5 , trailing : 12 )
614- )
615- . listRowSeparator ( . hidden )
616- . listRowBackground ( Color . clear )
617- Button {
618- shareDocumentAsFile ( )
619- } label : {
620- Label ( lang . tr ( " action_share_document " ) , systemImage : " square.and.arrow.up.on.square " )
621- . foregroundStyle ( isSimulationMode ? . tertiary : . primary )
622- }
623- . buttonStyle ( PaletteListElementButtonStyle ( ) )
624- . disabledAndDimmed ( isSimulationMode )
625- . listRowInsets (
626- isCompact
627- ? EdgeInsets ( top : 3 , leading : 10 , bottom : 3 , trailing : 10 )
628- : EdgeInsets ( top : 5 , leading : 12 , bottom : 5 , trailing : 12 )
629- )
630- . listRowSeparator ( . hidden )
631- . listRowBackground ( Color . clear )
632- Button {
633- shareDiagramPDF ( )
634- } label : {
635- Label ( lang . tr ( " action_export_pdf " ) , systemImage : " doc.text.magnifyingglass " )
636- . foregroundStyle ( isSimulationMode ? . tertiary : . primary )
637- }
638- . buttonStyle ( PaletteListElementButtonStyle ( ) )
639- . disabledAndDimmed ( isSimulationMode )
640- . listRowInsets (
641- isCompact
642- ? EdgeInsets ( top : 3 , leading : 10 , bottom : 3 , trailing : 10 )
643- : EdgeInsets ( top : 5 , leading : 12 , bottom : 5 , trailing : 12 )
644- )
645- . listRowSeparator ( . hidden )
646- . listRowBackground ( Color . clear )
647-
648- Button {
649- showInfo = true
650- } label : {
651- Label ( lang . tr ( " action_about " ) , systemImage : " info.circle " )
652- }
653- . buttonStyle ( PaletteListElementButtonStyle ( ) )
654- . listRowInsets (
655- isCompact
656- ? EdgeInsets ( top : 3 , leading : 10 , bottom : 4 , trailing : 10 )
657- : EdgeInsets ( top : 5 , leading : 12 , bottom : 8 , trailing : 12 )
658- )
659- . listRowSeparator ( . hidden )
660- . listRowBackground ( Color . clear )
661617 }
662618 }
663619 . listStyle ( . insetGrouped )
@@ -754,6 +710,10 @@ struct ContentView: View {
754710 onSave : performPrimarySave ,
755711 onSaveAs : { showExporter = true } ,
756712 onPrint : printAction ,
713+ onSharePNG : exportPNG ,
714+ onShareDocument : shareDocumentAsFile ,
715+ onExportPDF : shareDiagramPDF ,
716+ onShowAbout : { showInfo = true } ,
757717 onKeyboardDismiss : {
758718 focusedField = nil
759719 if isPhone { hideInspectorOnPhone = true }
0 commit comments