Bug fixing

This commit is contained in:
Alexei Anoshenko 2024-05-16 11:13:45 +03:00
parent b1628023f7
commit fd516af017
2 changed files with 11 additions and 17 deletions

View File

@ -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;

View File

@ -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('"')
}
}