From b43bf80856220c1e1876d53760078989ca2d649d Mon Sep 17 00:00:00 2001 From: Alexei Anoshenko Date: Thu, 26 May 2022 12:01:49 +0300 Subject: [PATCH] Bug fixing --- editView.go | 13 ++++++++++--- tabsLayout.go | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/editView.go b/editView.go index 7ad9439..7086cec 100644 --- a/editView.go +++ b/editView.go @@ -491,23 +491,30 @@ func (edit *editViewData) htmlProperties(self View, buffer *strings.Builder) { buffer.WriteByte('"') } + convertText := func(text string) string { + if strings.ContainsRune(text, '"') { + text = strings.ReplaceAll(text, `"`, `"`) + } + return textToJS(text) + } + if hint := GetHint(edit, ""); hint != "" { buffer.WriteString(` placeholder="`) - buffer.WriteString(textToJS(hint)) + buffer.WriteString(convertText(hint)) buffer.WriteByte('"') } buffer.WriteString(` oninput="editViewInputEvent(this)"`) if pattern := GetEditViewPattern(edit, ""); pattern != "" { buffer.WriteString(` pattern="`) - buffer.WriteString(textToJS(pattern)) + buffer.WriteString(convertText(pattern)) buffer.WriteByte('"') } if editType != MultiLineText { if text := GetText(edit, ""); text != "" { buffer.WriteString(` value="`) - buffer.WriteString(textToJS(text)) + buffer.WriteString(convertText(text)) buffer.WriteByte('"') } } diff --git a/tabsLayout.go b/tabsLayout.go index 9ebfe48..bb7d6e2 100644 --- a/tabsLayout.go +++ b/tabsLayout.go @@ -251,7 +251,7 @@ func (tabsLayout *tabsLayoutData) set(tag string, value interface{}) bool { updateInnerHTML(htmlID, tabsLayout.session) } - case TabStyle, CurrentTabStyle: + case TabStyle, CurrentTabStyle, TabBarStyle: if text, ok := value.(string); ok { if text == "" { delete(tabsLayout.properties, tag)