From fd516af017ec74898479e6c9cea98ef2cdab5347 Mon Sep 17 00:00:00 2001 From: Alexei Anoshenko Date: Thu, 16 May 2024 11:13:45 +0300 Subject: [PATCH] Bug fixing --- app_styles.css | 3 +++ editView.go | 25 ++++++++----------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/app_styles.css b/app_styles.css index 1af77fa..19cda67 100644 --- a/app_styles.css +++ b/app_styles.css @@ -41,12 +41,14 @@ div:focus { */ input { + box-sizing: border-box; margin: 2px; padding: 1px; font-size: inherit; } select { + box-sizing: border-box; margin: 2px; font-size: inherit; } @@ -56,6 +58,7 @@ button { } textarea { + box-sizing: border-box; margin: 2px; padding: 4px; overflow: auto; diff --git a/editView.go b/editView.go index 627ac71..9df560e 100644 --- a/editView.go +++ b/editView.go @@ -208,11 +208,7 @@ func (edit *editViewData) set(tag string, value any) bool { if text = GetText(edit); oldText != text { edit.textChanged(text, oldText) if edit.created { - if GetEditViewType(edit) == MultiLineText { - updateInnerHTML(edit.htmlID(), edit.Session()) - } else { - edit.session.callFunc("setInputValue", edit.htmlID(), text) - } + edit.session.callFunc("setInputValue", edit.htmlID(), text) } } return true @@ -442,6 +438,9 @@ func (edit *editViewData) htmlProperties(self View, buffer *strings.Builder) { if strings.ContainsRune(text, '"') { text = strings.ReplaceAll(text, `"`, `"`) } + if strings.ContainsRune(text, '\n') { + text = strings.ReplaceAll(text, "\n", `\n`) + } return text } @@ -458,18 +457,10 @@ func (edit *editViewData) htmlProperties(self View, buffer *strings.Builder) { buffer.WriteByte('"') } - if editType != MultiLineText { - if text := GetText(edit); text != "" { - buffer.WriteString(` value="`) - buffer.WriteString(convertText(text)) - buffer.WriteByte('"') - } - } -} - -func (edit *editViewData) htmlSubviews(self View, buffer *strings.Builder) { - if GetEditViewType(edit) == MultiLineText { - buffer.WriteString(GetText(edit)) + if text := GetText(edit); text != "" { + buffer.WriteString(` value="`) + buffer.WriteString(convertText(text)) + buffer.WriteByte('"') } }