@@ -24,25 +24,29 @@ public struct FormatToolbar: View {
2424 systemName: " bold " ,
2525 action: { observedWebView. selectedWebView? . bold ( ) } ,
2626 active: $selectionState. bold,
27- onHover: { over in hoverLabel = Text ( over ? " Bold " : " Text Format " ) }
27+ help: ToolbarContents . shared. helpContents. bold,
28+ onHover: onHover ( over: )
2829 )
2930 ToolbarImageButton (
3031 systemName: " italic " ,
3132 action: { observedWebView. selectedWebView? . italic ( ) } ,
3233 active: $selectionState. italic,
34+ help: ToolbarContents . shared. helpContents. italic,
3335 onHover: { over in hoverLabel = Text ( over ? " Italic " : " Text Format " ) }
3436 )
3537 ToolbarImageButton (
3638 systemName: " underline " ,
3739 action: { observedWebView. selectedWebView? . underline ( ) } ,
3840 active: $selectionState. underline,
41+ help: ToolbarContents . shared. helpContents. underline,
3942 onHover: { over in hoverLabel = Text ( over ? " Underline " : " Text Format " ) }
4043 )
4144 if contents. code {
4245 ToolbarImageButton (
4346 systemName: " curlybraces " ,
4447 action: { observedWebView. selectedWebView? . code ( ) } ,
4548 active: $selectionState. code,
49+ help: ToolbarContents . shared. helpContents. code,
4650 onHover: { over in hoverLabel = Text ( over ? " Code " : " Text Format " ) }
4751 )
4852 }
@@ -51,6 +55,7 @@ public struct FormatToolbar: View {
5155 systemName: " strikethrough " ,
5256 action: { observedWebView. selectedWebView? . strike ( ) } ,
5357 active: $selectionState. strike,
58+ help: ToolbarContents . shared. helpContents. strikethrough,
5459 onHover: { over in hoverLabel = Text ( over ? " Strikethrough " : " Text Format " ) }
5560 )
5661 }
@@ -59,17 +64,23 @@ public struct FormatToolbar: View {
5964 systemName: " textformat.subscript " ,
6065 action: { observedWebView. selectedWebView? . subscriptText ( ) } ,
6166 active: $selectionState. sub,
67+ help: ToolbarContents . shared. helpContents. subscript,
6268 onHover: { over in hoverLabel = Text ( over ? " Subscript " : " Text Format " ) }
6369 )
6470 ToolbarImageButton (
6571 systemName: " textformat.superscript " ,
6672 action: { observedWebView. selectedWebView? . superscript ( ) } ,
6773 active: $selectionState. sup,
74+ help: ToolbarContents . shared. helpContents. superscript,
6875 onHover: { over in hoverLabel = Text ( over ? " Superscript " : " Text Format " ) }
6976 )
7077 }
7178 }
7279 }
80+
81+ func onHover( over: Bool ) {
82+ hoverLabel = Text ( over ? " Bold " : " Text Format " )
83+ }
7384}
7485
7586struct FormatToolbar_Previews : PreviewProvider {
0 commit comments