File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1031,9 +1031,20 @@ func initRichTextWidget() WidgetInfo {
10311031 },
10321032 Gostring : func (obj fyne.CanvasObject , c Context , defs map [string ]string ) string {
10331033 props := c .Metadata ()[obj ]
1034- // TODO wrap
1035- return widgetRef (props , defs ,
1036- fmt .Sprintf ("widget.NewRichTextFromMarkdown(`%s`)" , props ["text" ]))
1034+ rich := obj .(* widget.RichText )
1035+
1036+ str := & strings.Builder {}
1037+ wrap := rich .Wrapping != fyne .TextWrapOff
1038+ if wrap {
1039+ str .WriteString ("func() *widget.RichText {\n rich := " )
1040+ }
1041+ str .WriteString (fmt .Sprintf ("widget.NewRichTextFromMarkdown(`%s`)" , props ["text" ]))
1042+
1043+ if wrap {
1044+ str .WriteString (fmt .Sprintf ("\n \t rich.Wrapping = %#v\n " , rich .Wrapping ))
1045+ str .WriteString ("return rich\n }()" )
1046+ }
1047+ return widgetRef (props , defs , str .String ())
10371048 },
10381049 }
10391050}
You can’t perform that action at this time.
0 commit comments