mirror of https://github.com/anoshenko/rui.git
Bug fixing
This commit is contained in:
parent
fd424f56c1
commit
86709b2f1b
|
|
@ -296,7 +296,7 @@ func dataListHtmlSubviews(view View, buffer *strings.Builder, normalizeItem func
|
||||||
text = strings.ReplaceAll(text, "\n", `\n`)
|
text = strings.ReplaceAll(text, "\n", `\n`)
|
||||||
}
|
}
|
||||||
buffer.WriteString(`<option value="`)
|
buffer.WriteString(`<option value="`)
|
||||||
buffer.WriteString(text)
|
buffer.WriteString(textToHtml(text))
|
||||||
buffer.WriteString(`"></option>`)
|
buffer.WriteString(`"></option>`)
|
||||||
}
|
}
|
||||||
buffer.WriteString(`</datalist>`)
|
buffer.WriteString(`</datalist>`)
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ func (detailsView *detailsViewData) htmlSubviews(self View, buffer *strings.Buil
|
||||||
} else {
|
} else {
|
||||||
buffer.WriteString("<summary>")
|
buffer.WriteString("<summary>")
|
||||||
}
|
}
|
||||||
buffer.WriteString(value)
|
buffer.WriteString(textToHtml(value))
|
||||||
buffer.WriteString("</summary>")
|
buffer.WriteString("</summary>")
|
||||||
summary = true
|
summary = true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,7 @@ func (list *dropDownListData) htmlSubviews(self View, buffer *strings.Builder) {
|
||||||
item, _ = list.session.GetString(item)
|
item, _ = list.session.GetString(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.WriteString(item)
|
buffer.WriteString(textToHtml(item))
|
||||||
buffer.WriteString("</option>")
|
buffer.WriteString("</option>")
|
||||||
for _, index := range separators {
|
for _, index := range separators {
|
||||||
if i == index {
|
if i == index {
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,7 @@ func (edit *editViewData) htmlTag() string {
|
||||||
func (edit *editViewData) htmlSubviews(self View, buffer *strings.Builder) {
|
func (edit *editViewData) htmlSubviews(self View, buffer *strings.Builder) {
|
||||||
if GetEditViewType(edit) == MultiLineText {
|
if GetEditViewType(edit) == MultiLineText {
|
||||||
if text := GetText(edit); text != "" {
|
if text := GetText(edit); text != "" {
|
||||||
buffer.WriteString(text)
|
buffer.WriteString(textToHtml(text))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dataListHtmlSubviews(self, buffer, func(text string, session Session) string {
|
dataListHtmlSubviews(self, buffer, func(text string, session Session) string {
|
||||||
|
|
|
||||||
|
|
@ -671,7 +671,7 @@ func (tabsLayout *tabsLayoutData) htmlSubviews(self View, buffer *strings.Builde
|
||||||
buffer.WriteString(view.htmlID())
|
buffer.WriteString(view.htmlID())
|
||||||
buffer.WriteString(`-title"`)
|
buffer.WriteString(`-title"`)
|
||||||
buffer.WriteString(titleStyle)
|
buffer.WriteString(titleStyle)
|
||||||
buffer.WriteString(title)
|
buffer.WriteString(textToHtml(title))
|
||||||
buffer.WriteString(`</div>`)
|
buffer.WriteString(`</div>`)
|
||||||
|
|
||||||
close, ok := boolProperty(view, TabCloseButton, tabsLayout.session)
|
close, ok := boolProperty(view, TabCloseButton, tabsLayout.session)
|
||||||
|
|
|
||||||
|
|
@ -100,11 +100,11 @@ func (textView *textViewData) setFunc(tag PropertyName, value any) []PropertyNam
|
||||||
|
|
||||||
func (textView *textViewData) htmlSubviews(self View, buffer *strings.Builder) {
|
func (textView *textViewData) htmlSubviews(self View, buffer *strings.Builder) {
|
||||||
if value := textView.getRaw(Text); value != nil {
|
if value := textView.getRaw(Text); value != nil {
|
||||||
if text, ok := value.(string); ok {
|
if text, ok := value.(string); ok && text != "" {
|
||||||
if !GetNotTranslate(textView) {
|
if !GetNotTranslate(textView) {
|
||||||
text, _ = textView.session.GetString(text)
|
text, _ = textView.session.GetString(text)
|
||||||
}
|
}
|
||||||
buffer.WriteString(text)
|
buffer.WriteString(textToHtml(text))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
16
utils.go
16
utils.go
|
|
@ -114,3 +114,19 @@ func InlineFileFromData(data []byte, mimeType string) string {
|
||||||
|
|
||||||
return "data:" + mimeType + ";base64," + base64.StdEncoding.EncodeToString(data)
|
return "data:" + mimeType + ";base64," + base64.StdEncoding.EncodeToString(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func textToHtml(text string) string {
|
||||||
|
replace := []struct{ old, new string }{
|
||||||
|
{old: "&", new: "&"},
|
||||||
|
{old: "\"", new: """},
|
||||||
|
{old: "'", new: "'"},
|
||||||
|
{old: "<", new: "<"},
|
||||||
|
{old: ">", new: ">"},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, r := range replace {
|
||||||
|
text = strings.ReplaceAll(text, r.old, r.new)
|
||||||
|
}
|
||||||
|
|
||||||
|
return text
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue